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

Method MapCreateBulk

ent/client.go:520–531  ·  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(*DirectLinkCreate, int))

Source from the content-addressed store, hash-verified

518// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
519// a builder and applies setFunc on it.
520func (c *DirectLinkClient) MapCreateBulk(slice any, setFunc func(*DirectLinkCreate, int)) *DirectLinkCreateBulk {
521 rv := reflect.ValueOf(slice)
522 if rv.Kind() != reflect.Slice {
523 return &DirectLinkCreateBulk{err: fmt.Errorf("calling to DirectLinkClient.MapCreateBulk with wrong type %T, need slice", slice)}
524 }
525 builders := make([]*DirectLinkCreate, rv.Len())
526 for i := 0; i < rv.Len(); i++ {
527 builders[i] = c.Create()
528 setFunc(builders[i], i)
529 }
530 return &DirectLinkCreateBulk{config: c.config, builders: builders}
531}
532
533// Update returns an update builder for DirectLink.
534func (c *DirectLinkClient) Update() *DirectLinkUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected