Files
upstream-ent/entc/integration/json/ent/user/mutation.go
upstream-mirror 4b3ad0b611
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped
snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:12:36 +05:00

1041 lines
26 KiB
Go

// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package user
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/entc/integration/json/ent/predicate"
"entgo.io/ent/entc/integration/json/ent/schema"
)
// Mutation represents an operation that mutates the User nodes in the graph.
type Mutation struct {
op ent.Op
typ string
t **schema.T
url **url.URL
_URLs *[]*url.URL
append_URLs []*url.URL
raw *json.RawMessage
appendraw json.RawMessage
dirs *[]http.Dir
appenddirs []http.Dir
ints *[]int
appendints []int
floats *[]float64
appendfloats []float64
strings *[]string
appendstrings []string
ints_validate *[]int
appendints_validate []int
floats_validate *[]float64
appendfloats_validate []float64
strings_validate *[]string
appendstrings_validate []string
addr *schema.Addr
unknown *any
clearedFields map[string]struct{}
predicates []predicate.User
}
// NewMutation creates a new Mutation for the User entity.
func NewMutation(op ent.Op) *Mutation {
return &Mutation{
op: op,
typ: "User",
clearedFields: make(map[string]struct{}),
}
}
// Predicates returns the list of predicates set on the mutation.
func (m *Mutation) Predicates() []predicate.User {
return m.predicates
}
// SetT sets the "t" field.
func (m *Mutation) SetT(s *schema.T) {
m.t = &s
}
// T returns the value of the "t" field in the mutation.
func (m *Mutation) T() (r *schema.T, exists bool) {
v := m.t
if v == nil {
return
}
return *v, true
}
// ClearT clears the value of the "t" field.
func (m *Mutation) ClearT() {
m.t = nil
m.clearedFields[FieldT] = struct{}{}
}
// TCleared returns if the "t" field was cleared in this mutation.
func (m *Mutation) TCleared() bool {
_, ok := m.clearedFields[FieldT]
return ok
}
// ResetT resets all changes to the "t" field.
func (m *Mutation) ResetT() {
m.t = nil
delete(m.clearedFields, FieldT)
}
// SetURL sets the "url" field.
func (m *Mutation) SetURL(u *url.URL) {
m.url = &u
}
// URL returns the value of the "url" field in the mutation.
func (m *Mutation) URL() (r *url.URL, exists bool) {
v := m.url
if v == nil {
return
}
return *v, true
}
// ClearURL clears the value of the "url" field.
func (m *Mutation) ClearURL() {
m.url = nil
m.clearedFields[FieldURL] = struct{}{}
}
// URLCleared returns if the "url" field was cleared in this mutation.
func (m *Mutation) URLCleared() bool {
_, ok := m.clearedFields[FieldURL]
return ok
}
// ResetURL resets all changes to the "url" field.
func (m *Mutation) ResetURL() {
m.url = nil
delete(m.clearedFields, FieldURL)
}
// SetURLs sets the "URLs" field.
func (m *Mutation) SetURLs(u []*url.URL) {
m._URLs = &u
m.append_URLs = nil
}
// URLs returns the value of the "URLs" field in the mutation.
func (m *Mutation) URLs() (r []*url.URL, exists bool) {
v := m._URLs
if v == nil {
return
}
return *v, true
}
// AppendURLs adds u to the "URLs" field.
func (m *Mutation) AppendURLs(u []*url.URL) {
m.append_URLs = append(m.append_URLs, u...)
}
// AppendedURLs returns the list of values that were appended to the "URLs" field in this mutation.
func (m *Mutation) AppendedURLs() ([]*url.URL, bool) {
if len(m.append_URLs) == 0 {
return nil, false
}
return m.append_URLs, true
}
// ClearURLs clears the value of the "URLs" field.
func (m *Mutation) ClearURLs() {
m._URLs = nil
m.append_URLs = nil
m.clearedFields[FieldURLs] = struct{}{}
}
// URLsCleared returns if the "URLs" field was cleared in this mutation.
func (m *Mutation) URLsCleared() bool {
_, ok := m.clearedFields[FieldURLs]
return ok
}
// ResetURLs resets all changes to the "URLs" field.
func (m *Mutation) ResetURLs() {
m._URLs = nil
m.append_URLs = nil
delete(m.clearedFields, FieldURLs)
}
// SetRaw sets the "raw" field.
func (m *Mutation) SetRaw(jm json.RawMessage) {
m.raw = &jm
m.appendraw = nil
}
// Raw returns the value of the "raw" field in the mutation.
func (m *Mutation) Raw() (r json.RawMessage, exists bool) {
v := m.raw
if v == nil {
return
}
return *v, true
}
// AppendRaw adds jm to the "raw" field.
func (m *Mutation) AppendRaw(jm json.RawMessage) {
m.appendraw = append(m.appendraw, jm...)
}
// AppendedRaw returns the list of values that were appended to the "raw" field in this mutation.
func (m *Mutation) AppendedRaw() (json.RawMessage, bool) {
if len(m.appendraw) == 0 {
return nil, false
}
return m.appendraw, true
}
// ClearRaw clears the value of the "raw" field.
func (m *Mutation) ClearRaw() {
m.raw = nil
m.appendraw = nil
m.clearedFields[FieldRaw] = struct{}{}
}
// RawCleared returns if the "raw" field was cleared in this mutation.
func (m *Mutation) RawCleared() bool {
_, ok := m.clearedFields[FieldRaw]
return ok
}
// ResetRaw resets all changes to the "raw" field.
func (m *Mutation) ResetRaw() {
m.raw = nil
m.appendraw = nil
delete(m.clearedFields, FieldRaw)
}
// SetDirs sets the "dirs" field.
func (m *Mutation) SetDirs(h []http.Dir) {
m.dirs = &h
m.appenddirs = nil
}
// Dirs returns the value of the "dirs" field in the mutation.
func (m *Mutation) Dirs() (r []http.Dir, exists bool) {
v := m.dirs
if v == nil {
return
}
return *v, true
}
// AppendDirs adds h to the "dirs" field.
func (m *Mutation) AppendDirs(h []http.Dir) {
m.appenddirs = append(m.appenddirs, h...)
}
// AppendedDirs returns the list of values that were appended to the "dirs" field in this mutation.
func (m *Mutation) AppendedDirs() ([]http.Dir, bool) {
if len(m.appenddirs) == 0 {
return nil, false
}
return m.appenddirs, true
}
// ResetDirs resets all changes to the "dirs" field.
func (m *Mutation) ResetDirs() {
m.dirs = nil
m.appenddirs = nil
}
// SetInts sets the "ints" field.
func (m *Mutation) SetInts(i []int) {
m.ints = &i
m.appendints = nil
}
// Ints returns the value of the "ints" field in the mutation.
func (m *Mutation) Ints() (r []int, exists bool) {
v := m.ints
if v == nil {
return
}
return *v, true
}
// AppendInts adds i to the "ints" field.
func (m *Mutation) AppendInts(i []int) {
m.appendints = append(m.appendints, i...)
}
// AppendedInts returns the list of values that were appended to the "ints" field in this mutation.
func (m *Mutation) AppendedInts() ([]int, bool) {
if len(m.appendints) == 0 {
return nil, false
}
return m.appendints, true
}
// ClearInts clears the value of the "ints" field.
func (m *Mutation) ClearInts() {
m.ints = nil
m.appendints = nil
m.clearedFields[FieldInts] = struct{}{}
}
// IntsCleared returns if the "ints" field was cleared in this mutation.
func (m *Mutation) IntsCleared() bool {
_, ok := m.clearedFields[FieldInts]
return ok
}
// ResetInts resets all changes to the "ints" field.
func (m *Mutation) ResetInts() {
m.ints = nil
m.appendints = nil
delete(m.clearedFields, FieldInts)
}
// SetFloats sets the "floats" field.
func (m *Mutation) SetFloats(f []float64) {
m.floats = &f
m.appendfloats = nil
}
// Floats returns the value of the "floats" field in the mutation.
func (m *Mutation) Floats() (r []float64, exists bool) {
v := m.floats
if v == nil {
return
}
return *v, true
}
// AppendFloats adds f to the "floats" field.
func (m *Mutation) AppendFloats(f []float64) {
m.appendfloats = append(m.appendfloats, f...)
}
// AppendedFloats returns the list of values that were appended to the "floats" field in this mutation.
func (m *Mutation) AppendedFloats() ([]float64, bool) {
if len(m.appendfloats) == 0 {
return nil, false
}
return m.appendfloats, true
}
// ClearFloats clears the value of the "floats" field.
func (m *Mutation) ClearFloats() {
m.floats = nil
m.appendfloats = nil
m.clearedFields[FieldFloats] = struct{}{}
}
// FloatsCleared returns if the "floats" field was cleared in this mutation.
func (m *Mutation) FloatsCleared() bool {
_, ok := m.clearedFields[FieldFloats]
return ok
}
// ResetFloats resets all changes to the "floats" field.
func (m *Mutation) ResetFloats() {
m.floats = nil
m.appendfloats = nil
delete(m.clearedFields, FieldFloats)
}
// SetStrings sets the "strings" field.
func (m *Mutation) SetStrings(s []string) {
m.strings = &s
m.appendstrings = nil
}
// Strings returns the value of the "strings" field in the mutation.
func (m *Mutation) Strings() (r []string, exists bool) {
v := m.strings
if v == nil {
return
}
return *v, true
}
// AppendStrings adds s to the "strings" field.
func (m *Mutation) AppendStrings(s []string) {
m.appendstrings = append(m.appendstrings, s...)
}
// AppendedStrings returns the list of values that were appended to the "strings" field in this mutation.
func (m *Mutation) AppendedStrings() ([]string, bool) {
if len(m.appendstrings) == 0 {
return nil, false
}
return m.appendstrings, true
}
// ClearStrings clears the value of the "strings" field.
func (m *Mutation) ClearStrings() {
m.strings = nil
m.appendstrings = nil
m.clearedFields[FieldStrings] = struct{}{}
}
// StringsCleared returns if the "strings" field was cleared in this mutation.
func (m *Mutation) StringsCleared() bool {
_, ok := m.clearedFields[FieldStrings]
return ok
}
// ResetStrings resets all changes to the "strings" field.
func (m *Mutation) ResetStrings() {
m.strings = nil
m.appendstrings = nil
delete(m.clearedFields, FieldStrings)
}
// SetIntsValidate sets the "ints_validate" field.
func (m *Mutation) SetIntsValidate(i []int) {
m.ints_validate = &i
m.appendints_validate = nil
}
// IntsValidate returns the value of the "ints_validate" field in the mutation.
func (m *Mutation) IntsValidate() (r []int, exists bool) {
v := m.ints_validate
if v == nil {
return
}
return *v, true
}
// AppendIntsValidate adds i to the "ints_validate" field.
func (m *Mutation) AppendIntsValidate(i []int) {
m.appendints_validate = append(m.appendints_validate, i...)
}
// AppendedIntsValidate returns the list of values that were appended to the "ints_validate" field in this mutation.
func (m *Mutation) AppendedIntsValidate() ([]int, bool) {
if len(m.appendints_validate) == 0 {
return nil, false
}
return m.appendints_validate, true
}
// ClearIntsValidate clears the value of the "ints_validate" field.
func (m *Mutation) ClearIntsValidate() {
m.ints_validate = nil
m.appendints_validate = nil
m.clearedFields[FieldIntsValidate] = struct{}{}
}
// IntsValidateCleared returns if the "ints_validate" field was cleared in this mutation.
func (m *Mutation) IntsValidateCleared() bool {
_, ok := m.clearedFields[FieldIntsValidate]
return ok
}
// ResetIntsValidate resets all changes to the "ints_validate" field.
func (m *Mutation) ResetIntsValidate() {
m.ints_validate = nil
m.appendints_validate = nil
delete(m.clearedFields, FieldIntsValidate)
}
// SetFloatsValidate sets the "floats_validate" field.
func (m *Mutation) SetFloatsValidate(f []float64) {
m.floats_validate = &f
m.appendfloats_validate = nil
}
// FloatsValidate returns the value of the "floats_validate" field in the mutation.
func (m *Mutation) FloatsValidate() (r []float64, exists bool) {
v := m.floats_validate
if v == nil {
return
}
return *v, true
}
// AppendFloatsValidate adds f to the "floats_validate" field.
func (m *Mutation) AppendFloatsValidate(f []float64) {
m.appendfloats_validate = append(m.appendfloats_validate, f...)
}
// AppendedFloatsValidate returns the list of values that were appended to the "floats_validate" field in this mutation.
func (m *Mutation) AppendedFloatsValidate() ([]float64, bool) {
if len(m.appendfloats_validate) == 0 {
return nil, false
}
return m.appendfloats_validate, true
}
// ClearFloatsValidate clears the value of the "floats_validate" field.
func (m *Mutation) ClearFloatsValidate() {
m.floats_validate = nil
m.appendfloats_validate = nil
m.clearedFields[FieldFloatsValidate] = struct{}{}
}
// FloatsValidateCleared returns if the "floats_validate" field was cleared in this mutation.
func (m *Mutation) FloatsValidateCleared() bool {
_, ok := m.clearedFields[FieldFloatsValidate]
return ok
}
// ResetFloatsValidate resets all changes to the "floats_validate" field.
func (m *Mutation) ResetFloatsValidate() {
m.floats_validate = nil
m.appendfloats_validate = nil
delete(m.clearedFields, FieldFloatsValidate)
}
// SetStringsValidate sets the "strings_validate" field.
func (m *Mutation) SetStringsValidate(s []string) {
m.strings_validate = &s
m.appendstrings_validate = nil
}
// StringsValidate returns the value of the "strings_validate" field in the mutation.
func (m *Mutation) StringsValidate() (r []string, exists bool) {
v := m.strings_validate
if v == nil {
return
}
return *v, true
}
// AppendStringsValidate adds s to the "strings_validate" field.
func (m *Mutation) AppendStringsValidate(s []string) {
m.appendstrings_validate = append(m.appendstrings_validate, s...)
}
// AppendedStringsValidate returns the list of values that were appended to the "strings_validate" field in this mutation.
func (m *Mutation) AppendedStringsValidate() ([]string, bool) {
if len(m.appendstrings_validate) == 0 {
return nil, false
}
return m.appendstrings_validate, true
}
// ClearStringsValidate clears the value of the "strings_validate" field.
func (m *Mutation) ClearStringsValidate() {
m.strings_validate = nil
m.appendstrings_validate = nil
m.clearedFields[FieldStringsValidate] = struct{}{}
}
// StringsValidateCleared returns if the "strings_validate" field was cleared in this mutation.
func (m *Mutation) StringsValidateCleared() bool {
_, ok := m.clearedFields[FieldStringsValidate]
return ok
}
// ResetStringsValidate resets all changes to the "strings_validate" field.
func (m *Mutation) ResetStringsValidate() {
m.strings_validate = nil
m.appendstrings_validate = nil
delete(m.clearedFields, FieldStringsValidate)
}
// SetAddr sets the "addr" field.
func (m *Mutation) SetAddr(s schema.Addr) {
m.addr = &s
}
// Addr returns the value of the "addr" field in the mutation.
func (m *Mutation) Addr() (r schema.Addr, exists bool) {
v := m.addr
if v == nil {
return
}
return *v, true
}
// ClearAddr clears the value of the "addr" field.
func (m *Mutation) ClearAddr() {
m.addr = nil
m.clearedFields[FieldAddr] = struct{}{}
}
// AddrCleared returns if the "addr" field was cleared in this mutation.
func (m *Mutation) AddrCleared() bool {
_, ok := m.clearedFields[FieldAddr]
return ok
}
// ResetAddr resets all changes to the "addr" field.
func (m *Mutation) ResetAddr() {
m.addr = nil
delete(m.clearedFields, FieldAddr)
}
// SetUnknown sets the "unknown" field.
func (m *Mutation) SetUnknown(a any) {
m.unknown = &a
}
// Unknown returns the value of the "unknown" field in the mutation.
func (m *Mutation) Unknown() (r any, exists bool) {
v := m.unknown
if v == nil {
return
}
return *v, true
}
// ClearUnknown clears the value of the "unknown" field.
func (m *Mutation) ClearUnknown() {
m.unknown = nil
m.clearedFields[FieldUnknown] = struct{}{}
}
// UnknownCleared returns if the "unknown" field was cleared in this mutation.
func (m *Mutation) UnknownCleared() bool {
_, ok := m.clearedFields[FieldUnknown]
return ok
}
// ResetUnknown resets all changes to the "unknown" field.
func (m *Mutation) ResetUnknown() {
m.unknown = nil
delete(m.clearedFields, FieldUnknown)
}
// Where appends a list predicates to the Mutation builder.
func (m *Mutation) Where(ps ...predicate.User) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the Mutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *Mutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.User, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *Mutation) Op() ent.Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *Mutation) SetOp(op ent.Op) {
m.op = op
}
// Type returns the node type of this mutation (User).
func (m *Mutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *Mutation) Fields() []string {
fields := make([]string, 0, 13)
if m.t != nil {
fields = append(fields, FieldT)
}
if m.url != nil {
fields = append(fields, FieldURL)
}
if m._URLs != nil {
fields = append(fields, FieldURLs)
}
if m.raw != nil {
fields = append(fields, FieldRaw)
}
if m.dirs != nil {
fields = append(fields, FieldDirs)
}
if m.ints != nil {
fields = append(fields, FieldInts)
}
if m.floats != nil {
fields = append(fields, FieldFloats)
}
if m.strings != nil {
fields = append(fields, FieldStrings)
}
if m.ints_validate != nil {
fields = append(fields, FieldIntsValidate)
}
if m.floats_validate != nil {
fields = append(fields, FieldFloatsValidate)
}
if m.strings_validate != nil {
fields = append(fields, FieldStringsValidate)
}
if m.addr != nil {
fields = append(fields, FieldAddr)
}
if m.unknown != nil {
fields = append(fields, FieldUnknown)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *Mutation) Field(name string) (ent.Value, bool) {
switch name {
case FieldT:
return m.T()
case FieldURL:
return m.URL()
case FieldURLs:
return m.URLs()
case FieldRaw:
return m.Raw()
case FieldDirs:
return m.Dirs()
case FieldInts:
return m.Ints()
case FieldFloats:
return m.Floats()
case FieldStrings:
return m.Strings()
case FieldIntsValidate:
return m.IntsValidate()
case FieldFloatsValidate:
return m.FloatsValidate()
case FieldStringsValidate:
return m.StringsValidate()
case FieldAddr:
return m.Addr()
case FieldUnknown:
return m.Unknown()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error) {
return nil, fmt.Errorf("unknown User field %s", name)
}
// SetField sets the value of a 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.
func (m *Mutation) SetField(name string, value ent.Value) error {
switch name {
case FieldT:
v, ok := value.(*schema.T)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetT(v)
return nil
case FieldURL:
v, ok := value.(*url.URL)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetURL(v)
return nil
case FieldURLs:
v, ok := value.([]*url.URL)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetURLs(v)
return nil
case FieldRaw:
v, ok := value.(json.RawMessage)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRaw(v)
return nil
case FieldDirs:
v, ok := value.([]http.Dir)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDirs(v)
return nil
case FieldInts:
v, ok := value.([]int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetInts(v)
return nil
case FieldFloats:
v, ok := value.([]float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetFloats(v)
return nil
case FieldStrings:
v, ok := value.([]string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStrings(v)
return nil
case FieldIntsValidate:
v, ok := value.([]int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetIntsValidate(v)
return nil
case FieldFloatsValidate:
v, ok := value.([]float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetFloatsValidate(v)
return nil
case FieldStringsValidate:
v, ok := value.([]string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStringsValidate(v)
return nil
case FieldAddr:
v, ok := value.(schema.Addr)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAddr(v)
return nil
case FieldUnknown:
v, ok := value.(any)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUnknown(v)
return nil
}
return fmt.Errorf("unknown User field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *Mutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *Mutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// 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.
func (m *Mutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown User numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *Mutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(FieldT) {
fields = append(fields, FieldT)
}
if m.FieldCleared(FieldURL) {
fields = append(fields, FieldURL)
}
if m.FieldCleared(FieldURLs) {
fields = append(fields, FieldURLs)
}
if m.FieldCleared(FieldRaw) {
fields = append(fields, FieldRaw)
}
if m.FieldCleared(FieldInts) {
fields = append(fields, FieldInts)
}
if m.FieldCleared(FieldFloats) {
fields = append(fields, FieldFloats)
}
if m.FieldCleared(FieldStrings) {
fields = append(fields, FieldStrings)
}
if m.FieldCleared(FieldIntsValidate) {
fields = append(fields, FieldIntsValidate)
}
if m.FieldCleared(FieldFloatsValidate) {
fields = append(fields, FieldFloatsValidate)
}
if m.FieldCleared(FieldStringsValidate) {
fields = append(fields, FieldStringsValidate)
}
if m.FieldCleared(FieldAddr) {
fields = append(fields, FieldAddr)
}
if m.FieldCleared(FieldUnknown) {
fields = append(fields, FieldUnknown)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *Mutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *Mutation) ClearField(name string) error {
switch name {
case FieldT:
m.ClearT()
return nil
case FieldURL:
m.ClearURL()
return nil
case FieldURLs:
m.ClearURLs()
return nil
case FieldRaw:
m.ClearRaw()
return nil
case FieldInts:
m.ClearInts()
return nil
case FieldFloats:
m.ClearFloats()
return nil
case FieldStrings:
m.ClearStrings()
return nil
case FieldIntsValidate:
m.ClearIntsValidate()
return nil
case FieldFloatsValidate:
m.ClearFloatsValidate()
return nil
case FieldStringsValidate:
m.ClearStringsValidate()
return nil
case FieldAddr:
m.ClearAddr()
return nil
case FieldUnknown:
m.ClearUnknown()
return nil
}
return fmt.Errorf("unknown User nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *Mutation) ResetField(name string) error {
switch name {
case FieldT:
m.ResetT()
return nil
case FieldURL:
m.ResetURL()
return nil
case FieldURLs:
m.ResetURLs()
return nil
case FieldRaw:
m.ResetRaw()
return nil
case FieldDirs:
m.ResetDirs()
return nil
case FieldInts:
m.ResetInts()
return nil
case FieldFloats:
m.ResetFloats()
return nil
case FieldStrings:
m.ResetStrings()
return nil
case FieldIntsValidate:
m.ResetIntsValidate()
return nil
case FieldFloatsValidate:
m.ResetFloatsValidate()
return nil
case FieldStringsValidate:
m.ResetStringsValidate()
return nil
case FieldAddr:
m.ResetAddr()
return nil
case FieldUnknown:
m.ResetUnknown()
return nil
}
return fmt.Errorf("unknown User field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *Mutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *Mutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *Mutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *Mutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *Mutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *Mutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *Mutation) ClearEdge(name string) error {
return fmt.Errorf("unknown User unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *Mutation) ResetEdge(name string) error {
return fmt.Errorf("unknown User edge %s", name)
}