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

Method MapCreateBulk

ent/client.go:369–380  ·  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(*DavAccountCreate, int))

Source from the content-addressed store, hash-verified

367// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
368// a builder and applies setFunc on it.
369func (c *DavAccountClient) MapCreateBulk(slice any, setFunc func(*DavAccountCreate, int)) *DavAccountCreateBulk {
370 rv := reflect.ValueOf(slice)
371 if rv.Kind() != reflect.Slice {
372 return &DavAccountCreateBulk{err: fmt.Errorf("calling to DavAccountClient.MapCreateBulk with wrong type %T, need slice", slice)}
373 }
374 builders := make([]*DavAccountCreate, rv.Len())
375 for i := 0; i < rv.Len(); i++ {
376 builders[i] = c.Create()
377 setFunc(builders[i], i)
378 }
379 return &DavAccountCreateBulk{config: c.config, builders: builders}
380}
381
382// Update returns an update builder for DavAccount.
383func (c *DavAccountClient) Update() *DavAccountUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected