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

Method AddField

ent/mutation.go:16448–16459  ·  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

16446// the field is not defined in the schema, or if the type mismatched the field
16447// type.
16448func (m *UserMutation) AddField(name string, value ent.Value) error {
16449 switch name {
16450 case user.FieldStorage:
16451 v, ok := value.(int64)
16452 if !ok {
16453 return fmt.Errorf("unexpected type %T for field %s", value, name)
16454 }
16455 m.AddStorage(v)
16456 return nil
16457 }
16458 return fmt.Errorf("unknown User numeric field %s", name)
16459}
16460
16461// ClearedFields returns all nullable fields that were cleared during this
16462// mutation.

Callers

nothing calls this directly

Calls 1

AddStorageMethod · 0.95

Tested by

no test coverage detected