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

Method MapCreateBulk

ent/client.go:1736–1747  ·  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(*OAuthClientCreate, int))

Source from the content-addressed store, hash-verified

1734// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
1735// a builder and applies setFunc on it.
1736func (c *OAuthClientClient) MapCreateBulk(slice any, setFunc func(*OAuthClientCreate, int)) *OAuthClientCreateBulk {
1737 rv := reflect.ValueOf(slice)
1738 if rv.Kind() != reflect.Slice {
1739 return &OAuthClientCreateBulk{err: fmt.Errorf("calling to OAuthClientClient.MapCreateBulk with wrong type %T, need slice", slice)}
1740 }
1741 builders := make([]*OAuthClientCreate, rv.Len())
1742 for i := 0; i < rv.Len(); i++ {
1743 builders[i] = c.Create()
1744 setFunc(builders[i], i)
1745 }
1746 return &OAuthClientCreateBulk{config: c.config, builders: builders}
1747}
1748
1749// Update returns an update builder for OAuthClient.
1750func (c *OAuthClientClient) Update() *OAuthClientUpdate {

Callers

nothing calls this directly

Calls 2

CreateMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected