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

Method MapCreateBulk

ent/client.go:854–865  ·  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(*FileCreate, int))

Source from the content-addressed store, hash-verified

852// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
853// a builder and applies setFunc on it.
854func (c *FileClient) MapCreateBulk(slice any, setFunc func(*FileCreate, int)) *FileCreateBulk {
855 rv := reflect.ValueOf(slice)
856 if rv.Kind() != reflect.Slice {
857 return &FileCreateBulk{err: fmt.Errorf("calling to FileClient.MapCreateBulk with wrong type %T, need slice", slice)}
858 }
859 builders := make([]*FileCreate, rv.Len())
860 for i := 0; i < rv.Len(); i++ {
861 builders[i] = c.Create()
862 setFunc(builders[i], i)
863 }
864 return &FileCreateBulk{config: c.config, builders: builders}
865}
866
867// Update returns an update builder for File.
868func (c *FileClient) Update() *FileUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected