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

Method MapCreateBulk

ent/client.go:1116–1127  ·  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(*FsEventCreate, int))

Source from the content-addressed store, hash-verified

1114// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
1115// a builder and applies setFunc on it.
1116func (c *FsEventClient) MapCreateBulk(slice any, setFunc func(*FsEventCreate, int)) *FsEventCreateBulk {
1117 rv := reflect.ValueOf(slice)
1118 if rv.Kind() != reflect.Slice {
1119 return &FsEventCreateBulk{err: fmt.Errorf("calling to FsEventClient.MapCreateBulk with wrong type %T, need slice", slice)}
1120 }
1121 builders := make([]*FsEventCreate, rv.Len())
1122 for i := 0; i < rv.Len(); i++ {
1123 builders[i] = c.Create()
1124 setFunc(builders[i], i)
1125 }
1126 return &FsEventCreateBulk{config: c.config, builders: builders}
1127}
1128
1129// Update returns an update builder for FsEvent.
1130func (c *FsEventClient) Update() *FsEventUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected