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(*EntityCreate, int))
| 669 | // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates |
| 670 | // a builder and applies setFunc on it. |
| 671 | func (c *EntityClient) MapCreateBulk(slice any, setFunc func(*EntityCreate, int)) *EntityCreateBulk { |
| 672 | rv := reflect.ValueOf(slice) |
| 673 | if rv.Kind() != reflect.Slice { |
| 674 | return &EntityCreateBulk{err: fmt.Errorf("calling to EntityClient.MapCreateBulk with wrong type %T, need slice", slice)} |
| 675 | } |
| 676 | builders := make([]*EntityCreate, rv.Len()) |
| 677 | for i := 0; i < rv.Len(); i++ { |
| 678 | builders[i] = c.Create() |
| 679 | setFunc(builders[i], i) |
| 680 | } |
| 681 | return &EntityCreateBulk{config: c.config, builders: builders} |
| 682 | } |
| 683 | |
| 684 | // Update returns an update builder for Entity. |
| 685 | func (c *EntityClient) Update() *EntityUpdate { |