MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / MapCreateBulk

Method MapCreateBulk

ent/client.go:2340–2351  ·  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(*ShareCreate, int))

Source from the content-addressed store, hash-verified

2338// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
2339// a builder and applies setFunc on it.
2340func (c *ShareClient) MapCreateBulk(slice any, setFunc func(*ShareCreate, int)) *ShareCreateBulk {
2341 rv := reflect.ValueOf(slice)
2342 if rv.Kind() != reflect.Slice {
2343 return &ShareCreateBulk{err: fmt.Errorf("calling to ShareClient.MapCreateBulk with wrong type %T, need slice", slice)}
2344 }
2345 builders := make([]*ShareCreate, rv.Len())
2346 for i := 0; i < rv.Len(); i++ {
2347 builders[i] = c.Create()
2348 setFunc(builders[i], i)
2349 }
2350 return &ShareCreateBulk{config: c.config, builders: builders}
2351}
2352
2353// Update returns an update builder for Share.
2354func (c *ShareClient) Update() *ShareUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected