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

Method AddField

ent/mutation.go:13839–13850  ·  view source on GitHub ↗

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

(name string, value ent.Value)

Source from the content-addressed store, hash-verified

13837// the field is not defined in the schema, or if the type mismatched the field
13838// type.
13839func (m *StoragePolicyMutation) AddField(name string, value ent.Value) error {
13840 switch name {
13841 case storagepolicy.FieldMaxSize:
13842 v, ok := value.(int64)
13843 if !ok {
13844 return fmt.Errorf("unexpected type %T for field %s", value, name)
13845 }
13846 m.AddMaxSize(v)
13847 return nil
13848 }
13849 return fmt.Errorf("unknown StoragePolicy numeric field %s", name)
13850}
13851
13852// ClearedFields returns all nullable fields that were cleared during this
13853// mutation.

Callers

nothing calls this directly

Calls 1

AddMaxSizeMethod · 0.95

Tested by

no test coverage detected