pull knows how to pull bulks of data from Xenia, leveraging the foundation that we have built. We don't need to add method to System to do this. There is no state inside System that we want the System to maintain. Instead, we want the System to understand the behavior. Functions are a great way of w
(x *Xenia, data []Data)
| 121 | // doesn't indicate any level, what field or state that we are using on that value that we use to |
| 122 | // make the call. |
| 123 | func pull(x *Xenia, data []Data) (int, error) { |
| 124 | // Range over the slice of data and share each element with the Xenial's Pull method. |
| 125 | for i := range data { |
| 126 | if err := x.Pull(&data[i]); err != nil { |
| 127 | return i, err |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | return len(data), nil |
| 132 | } |
| 133 | |
| 134 | // store knows how to store bulks of data into Pillar. |
| 135 | // Similar to the function above. |