MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
(slice any, setFunc func(*NodeCreate, int))
| 1583 | // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates |
| 1584 | // a builder and applies setFunc on it. |
| 1585 | func (c *NodeClient) MapCreateBulk(slice any, setFunc func(*NodeCreate, int)) *NodeCreateBulk { |
| 1586 | rv := reflect.ValueOf(slice) |
| 1587 | if rv.Kind() != reflect.Slice { |
| 1588 | return &NodeCreateBulk{err: fmt.Errorf("calling to NodeClient.MapCreateBulk with wrong type %T, need slice", slice)} |
| 1589 | } |
| 1590 | builders := make([]*NodeCreate, rv.Len()) |
| 1591 | for i := 0; i < rv.Len(); i++ { |
| 1592 | builders[i] = c.Create() |
| 1593 | setFunc(builders[i], i) |
| 1594 | } |
| 1595 | return &NodeCreateBulk{config: c.config, builders: builders} |
| 1596 | } |
| 1597 | |
| 1598 | // Update returns an update builder for Node. |
| 1599 | func (c *NodeClient) Update() *NodeUpdate { |