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

Method MapCreateBulk

app/controlplane/pkg/data/ent/client.go:3055–3066  ·  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(*UserCreate, int))

Source from the content-addressed store, hash-verified

3053// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
3054// a builder and applies setFunc on it.
3055func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk {
3056 rv := reflect.ValueOf(slice)
3057 if rv.Kind() != reflect.Slice {
3058 return &UserCreateBulk{err: fmt.Errorf("calling to UserClient.MapCreateBulk with wrong type %T, need slice", slice)}
3059 }
3060 builders := make([]*UserCreate, rv.Len())
3061 for i := 0; i < rv.Len(); i++ {
3062 builders[i] = c.Create()
3063 setFunc(builders[i], i)
3064 }
3065 return &UserCreateBulk{config: c.config, builders: builders}
3066}
3067
3068// Update returns an update builder for User.
3069func (c *UserClient) Update() *UserUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
KindMethod · 0.45

Tested by

no test coverage detected