MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / MapCreateBulk

Method MapCreateBulk

app/controlplane/pkg/data/ent/client.go:1080–1091  ·  view source on GitHub ↗

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(*GroupCreate, int))

Source from the content-addressed store, hash-verified

1078// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
1079// a builder and applies setFunc on it.
1080func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk {
1081 rv := reflect.ValueOf(slice)
1082 if rv.Kind() != reflect.Slice {
1083 return &GroupCreateBulk{err: fmt.Errorf("calling to GroupClient.MapCreateBulk with wrong type %T, need slice", slice)}
1084 }
1085 builders := make([]*GroupCreate, rv.Len())
1086 for i := 0; i < rv.Len(); i++ {
1087 builders[i] = c.Create()
1088 setFunc(builders[i], i)
1089 }
1090 return &GroupCreateBulk{config: c.config, builders: builders}
1091}
1092
1093// Update returns an update builder for Group.
1094func (c *GroupClient) Update() *GroupUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
KindMethod · 0.45

Tested by

no test coverage detected