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

Method MapCreateBulk

ent/client.go:2205–2216  ·  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(*SettingCreate, int))

Source from the content-addressed store, hash-verified

2203// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
2204// a builder and applies setFunc on it.
2205func (c *SettingClient) MapCreateBulk(slice any, setFunc func(*SettingCreate, int)) *SettingCreateBulk {
2206 rv := reflect.ValueOf(slice)
2207 if rv.Kind() != reflect.Slice {
2208 return &SettingCreateBulk{err: fmt.Errorf("calling to SettingClient.MapCreateBulk with wrong type %T, need slice", slice)}
2209 }
2210 builders := make([]*SettingCreate, rv.Len())
2211 for i := 0; i < rv.Len(); i++ {
2212 builders[i] = c.Create()
2213 setFunc(builders[i], i)
2214 }
2215 return &SettingCreateBulk{config: c.config, builders: builders}
2216}
2217
2218// Update returns an update builder for Setting.
2219func (c *SettingClient) Update() *SettingUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected