Documentation
¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Contact
- type ContactClient
- func (c *ContactClient) Create() *ContactCreate
- func (c *ContactClient) CreateBulk(builders ...*ContactCreate) *ContactCreateBulk
- func (c *ContactClient) Delete() *ContactDelete
- func (c *ContactClient) DeleteOne(co *Contact) *ContactDeleteOne
- func (c *ContactClient) DeleteOneID(id int) *ContactDeleteOne
- func (c *ContactClient) Get(ctx context.Context, id int) (*Contact, error)
- func (c *ContactClient) GetX(ctx context.Context, id int) *Contact
- func (c *ContactClient) Hooks() []Hook
- func (c *ContactClient) Query() *ContactQuery
- func (c *ContactClient) QueryOwner(co *Contact) *UserQuery
- func (c *ContactClient) Update() *ContactUpdate
- func (c *ContactClient) UpdateOne(co *Contact) *ContactUpdateOne
- func (c *ContactClient) UpdateOneID(id int) *ContactUpdateOne
- func (c *ContactClient) Use(hooks ...Hook)
- type ContactCreate
- func (cc *ContactCreate) Mutation() *ContactMutation
- func (cc *ContactCreate) Save(ctx context.Context) (*Contact, error)
- func (cc *ContactCreate) SaveX(ctx context.Context) *Contact
- func (cc *ContactCreate) SetAddress(s string) *ContactCreate
- func (cc *ContactCreate) SetName(s string) *ContactCreate
- func (cc *ContactCreate) SetOwner(u *User) *ContactCreate
- func (cc *ContactCreate) SetOwnerID(id int) *ContactCreate
- func (cc *ContactCreate) SetPhone(s string) *ContactCreate
- type ContactCreateBulk
- type ContactDelete
- type ContactDeleteOne
- type ContactEdges
- type ContactGroupBy
- func (cgb *ContactGroupBy) Aggregate(fns ...AggregateFunc) *ContactGroupBy
- func (cgb *ContactGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (cgb *ContactGroupBy) BoolX(ctx context.Context) bool
- func (cgb *ContactGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (cgb *ContactGroupBy) BoolsX(ctx context.Context) []bool
- func (cgb *ContactGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (cgb *ContactGroupBy) Float64X(ctx context.Context) float64
- func (cgb *ContactGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (cgb *ContactGroupBy) Float64sX(ctx context.Context) []float64
- func (cgb *ContactGroupBy) Int(ctx context.Context) (_ int, err error)
- func (cgb *ContactGroupBy) IntX(ctx context.Context) int
- func (cgb *ContactGroupBy) Ints(ctx context.Context) ([]int, error)
- func (cgb *ContactGroupBy) IntsX(ctx context.Context) []int
- func (cgb *ContactGroupBy) Scan(ctx context.Context, v interface{}) error
- func (cgb *ContactGroupBy) ScanX(ctx context.Context, v interface{})
- func (cgb *ContactGroupBy) String(ctx context.Context) (_ string, err error)
- func (cgb *ContactGroupBy) StringX(ctx context.Context) string
- func (cgb *ContactGroupBy) Strings(ctx context.Context) ([]string, error)
- func (cgb *ContactGroupBy) StringsX(ctx context.Context) []string
- type ContactMutation
- func (m *ContactMutation) AddField(name string, value ent.Value) error
- func (m *ContactMutation) AddedEdges() []string
- func (m *ContactMutation) AddedField(name string) (ent.Value, bool)
- func (m *ContactMutation) AddedFields() []string
- func (m *ContactMutation) AddedIDs(name string) []ent.Value
- func (m *ContactMutation) Address() (r string, exists bool)
- func (m *ContactMutation) ClearEdge(name string) error
- func (m *ContactMutation) ClearField(name string) error
- func (m *ContactMutation) ClearOwner()
- func (m *ContactMutation) ClearedEdges() []string
- func (m *ContactMutation) ClearedFields() []string
- func (m ContactMutation) Client() *Client
- func (m *ContactMutation) EdgeCleared(name string) bool
- func (m *ContactMutation) Field(name string) (ent.Value, bool)
- func (m *ContactMutation) FieldCleared(name string) bool
- func (m *ContactMutation) Fields() []string
- func (m *ContactMutation) ID() (id int, exists bool)
- func (m *ContactMutation) Name() (r string, exists bool)
- func (m *ContactMutation) OldAddress(ctx context.Context) (v string, err error)
- func (m *ContactMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ContactMutation) OldName(ctx context.Context) (v string, err error)
- func (m *ContactMutation) OldPhone(ctx context.Context) (v string, err error)
- func (m *ContactMutation) Op() Op
- func (m *ContactMutation) OwnerCleared() bool
- func (m *ContactMutation) OwnerID() (id int, exists bool)
- func (m *ContactMutation) OwnerIDs() (ids []int)
- func (m *ContactMutation) Phone() (r string, exists bool)
- func (m *ContactMutation) RemovedEdges() []string
- func (m *ContactMutation) RemovedIDs(name string) []ent.Value
- func (m *ContactMutation) ResetAddress()
- func (m *ContactMutation) ResetEdge(name string) error
- func (m *ContactMutation) ResetField(name string) error
- func (m *ContactMutation) ResetName()
- func (m *ContactMutation) ResetOwner()
- func (m *ContactMutation) ResetPhone()
- func (m *ContactMutation) SetAddress(s string)
- func (m *ContactMutation) SetField(name string, value ent.Value) error
- func (m *ContactMutation) SetName(s string)
- func (m *ContactMutation) SetOwnerID(id int)
- func (m *ContactMutation) SetPhone(s string)
- func (m ContactMutation) Tx() (*Tx, error)
- func (m *ContactMutation) Type() string
- type ContactQuery
- func (cq *ContactQuery) All(ctx context.Context) ([]*Contact, error)
- func (cq *ContactQuery) AllX(ctx context.Context) []*Contact
- func (cq *ContactQuery) Clone() *ContactQuery
- func (cq *ContactQuery) Count(ctx context.Context) (int, error)
- func (cq *ContactQuery) CountX(ctx context.Context) int
- func (cq *ContactQuery) Exist(ctx context.Context) (bool, error)
- func (cq *ContactQuery) ExistX(ctx context.Context) bool
- func (cq *ContactQuery) First(ctx context.Context) (*Contact, error)
- func (cq *ContactQuery) FirstID(ctx context.Context) (id int, err error)
- func (cq *ContactQuery) FirstX(ctx context.Context) *Contact
- func (cq *ContactQuery) FirstXID(ctx context.Context) int
- func (cq *ContactQuery) GroupBy(field string, fields ...string) *ContactGroupBy
- func (cq *ContactQuery) IDs(ctx context.Context) ([]int, error)
- func (cq *ContactQuery) IDsX(ctx context.Context) []int
- func (cq *ContactQuery) Limit(limit int) *ContactQuery
- func (cq *ContactQuery) Offset(offset int) *ContactQuery
- func (cq *ContactQuery) Only(ctx context.Context) (*Contact, error)
- func (cq *ContactQuery) OnlyID(ctx context.Context) (id int, err error)
- func (cq *ContactQuery) OnlyIDX(ctx context.Context) int
- func (cq *ContactQuery) OnlyX(ctx context.Context) *Contact
- func (cq *ContactQuery) Order(o ...OrderFunc) *ContactQuery
- func (cq *ContactQuery) QueryOwner() *UserQuery
- func (cq *ContactQuery) Select(field string, fields ...string) *ContactSelect
- func (cq *ContactQuery) Where(ps ...predicate.Contact) *ContactQuery
- func (cq *ContactQuery) WithOwner(opts ...func(*UserQuery)) *ContactQuery
- type ContactSelect
- func (cs *ContactSelect) Bool(ctx context.Context) (_ bool, err error)
- func (cs *ContactSelect) BoolX(ctx context.Context) bool
- func (cs *ContactSelect) Bools(ctx context.Context) ([]bool, error)
- func (cs *ContactSelect) BoolsX(ctx context.Context) []bool
- func (cs *ContactSelect) Float64(ctx context.Context) (_ float64, err error)
- func (cs *ContactSelect) Float64X(ctx context.Context) float64
- func (cs *ContactSelect) Float64s(ctx context.Context) ([]float64, error)
- func (cs *ContactSelect) Float64sX(ctx context.Context) []float64
- func (cs *ContactSelect) Int(ctx context.Context) (_ int, err error)
- func (cs *ContactSelect) IntX(ctx context.Context) int
- func (cs *ContactSelect) Ints(ctx context.Context) ([]int, error)
- func (cs *ContactSelect) IntsX(ctx context.Context) []int
- func (cs *ContactSelect) Scan(ctx context.Context, v interface{}) error
- func (cs *ContactSelect) ScanX(ctx context.Context, v interface{})
- func (cs *ContactSelect) String(ctx context.Context) (_ string, err error)
- func (cs *ContactSelect) StringX(ctx context.Context) string
- func (cs *ContactSelect) Strings(ctx context.Context) ([]string, error)
- func (cs *ContactSelect) StringsX(ctx context.Context) []string
- type ContactUpdate
- func (cu *ContactUpdate) ClearOwner() *ContactUpdate
- func (cu *ContactUpdate) Exec(ctx context.Context) error
- func (cu *ContactUpdate) ExecX(ctx context.Context)
- func (cu *ContactUpdate) Mutation() *ContactMutation
- func (cu *ContactUpdate) Save(ctx context.Context) (int, error)
- func (cu *ContactUpdate) SaveX(ctx context.Context) int
- func (cu *ContactUpdate) SetAddress(s string) *ContactUpdate
- func (cu *ContactUpdate) SetName(s string) *ContactUpdate
- func (cu *ContactUpdate) SetOwner(u *User) *ContactUpdate
- func (cu *ContactUpdate) SetOwnerID(id int) *ContactUpdate
- func (cu *ContactUpdate) SetPhone(s string) *ContactUpdate
- func (cu *ContactUpdate) Where(ps ...predicate.Contact) *ContactUpdate
- type ContactUpdateOne
- func (cuo *ContactUpdateOne) ClearOwner() *ContactUpdateOne
- func (cuo *ContactUpdateOne) Exec(ctx context.Context) error
- func (cuo *ContactUpdateOne) ExecX(ctx context.Context)
- func (cuo *ContactUpdateOne) Mutation() *ContactMutation
- func (cuo *ContactUpdateOne) Save(ctx context.Context) (*Contact, error)
- func (cuo *ContactUpdateOne) SaveX(ctx context.Context) *Contact
- func (cuo *ContactUpdateOne) SetAddress(s string) *ContactUpdateOne
- func (cuo *ContactUpdateOne) SetName(s string) *ContactUpdateOne
- func (cuo *ContactUpdateOne) SetOwner(u *User) *ContactUpdateOne
- func (cuo *ContactUpdateOne) SetOwnerID(id int) *ContactUpdateOne
- func (cuo *ContactUpdateOne) SetPhone(s string) *ContactUpdateOne
- type Contacts
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Token
- type TokenClient
- func (c *TokenClient) Create() *TokenCreate
- func (c *TokenClient) CreateBulk(builders ...*TokenCreate) *TokenCreateBulk
- func (c *TokenClient) Delete() *TokenDelete
- func (c *TokenClient) DeleteOne(t *Token) *TokenDeleteOne
- func (c *TokenClient) DeleteOneID(id int) *TokenDeleteOne
- func (c *TokenClient) Get(ctx context.Context, id int) (*Token, error)
- func (c *TokenClient) GetX(ctx context.Context, id int) *Token
- func (c *TokenClient) Hooks() []Hook
- func (c *TokenClient) Query() *TokenQuery
- func (c *TokenClient) QueryUser(t *Token) *UserQuery
- func (c *TokenClient) Update() *TokenUpdate
- func (c *TokenClient) UpdateOne(t *Token) *TokenUpdateOne
- func (c *TokenClient) UpdateOneID(id int) *TokenUpdateOne
- func (c *TokenClient) Use(hooks ...Hook)
- type TokenCreate
- func (tc *TokenCreate) Mutation() *TokenMutation
- func (tc *TokenCreate) Save(ctx context.Context) (*Token, error)
- func (tc *TokenCreate) SaveX(ctx context.Context) *Token
- func (tc *TokenCreate) SetUser(u *User) *TokenCreate
- func (tc *TokenCreate) SetUserID(id int) *TokenCreate
- func (tc *TokenCreate) SetValue(s string) *TokenCreate
- type TokenCreateBulk
- type TokenDelete
- type TokenDeleteOne
- type TokenEdges
- type TokenGroupBy
- func (tgb *TokenGroupBy) Aggregate(fns ...AggregateFunc) *TokenGroupBy
- func (tgb *TokenGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (tgb *TokenGroupBy) BoolX(ctx context.Context) bool
- func (tgb *TokenGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TokenGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TokenGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (tgb *TokenGroupBy) Float64X(ctx context.Context) float64
- func (tgb *TokenGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TokenGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TokenGroupBy) Int(ctx context.Context) (_ int, err error)
- func (tgb *TokenGroupBy) IntX(ctx context.Context) int
- func (tgb *TokenGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TokenGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TokenGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TokenGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TokenGroupBy) String(ctx context.Context) (_ string, err error)
- func (tgb *TokenGroupBy) StringX(ctx context.Context) string
- func (tgb *TokenGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *TokenGroupBy) StringsX(ctx context.Context) []string
- type TokenMutation
- func (m *TokenMutation) AddField(name string, value ent.Value) error
- func (m *TokenMutation) AddedEdges() []string
- func (m *TokenMutation) AddedField(name string) (ent.Value, bool)
- func (m *TokenMutation) AddedFields() []string
- func (m *TokenMutation) AddedIDs(name string) []ent.Value
- func (m *TokenMutation) ClearEdge(name string) error
- func (m *TokenMutation) ClearField(name string) error
- func (m *TokenMutation) ClearUser()
- func (m *TokenMutation) ClearedEdges() []string
- func (m *TokenMutation) ClearedFields() []string
- func (m TokenMutation) Client() *Client
- func (m *TokenMutation) EdgeCleared(name string) bool
- func (m *TokenMutation) Field(name string) (ent.Value, bool)
- func (m *TokenMutation) FieldCleared(name string) bool
- func (m *TokenMutation) Fields() []string
- func (m *TokenMutation) ID() (id int, exists bool)
- func (m *TokenMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TokenMutation) OldValue(ctx context.Context) (v string, err error)
- func (m *TokenMutation) Op() Op
- func (m *TokenMutation) RemovedEdges() []string
- func (m *TokenMutation) RemovedIDs(name string) []ent.Value
- func (m *TokenMutation) ResetEdge(name string) error
- func (m *TokenMutation) ResetField(name string) error
- func (m *TokenMutation) ResetUser()
- func (m *TokenMutation) ResetValue()
- func (m *TokenMutation) SetField(name string, value ent.Value) error
- func (m *TokenMutation) SetUserID(id int)
- func (m *TokenMutation) SetValue(s string)
- func (m TokenMutation) Tx() (*Tx, error)
- func (m *TokenMutation) Type() string
- func (m *TokenMutation) UserCleared() bool
- func (m *TokenMutation) UserID() (id int, exists bool)
- func (m *TokenMutation) UserIDs() (ids []int)
- func (m *TokenMutation) Value() (r string, exists bool)
- type TokenQuery
- func (tq *TokenQuery) All(ctx context.Context) ([]*Token, error)
- func (tq *TokenQuery) AllX(ctx context.Context) []*Token
- func (tq *TokenQuery) Clone() *TokenQuery
- func (tq *TokenQuery) Count(ctx context.Context) (int, error)
- func (tq *TokenQuery) CountX(ctx context.Context) int
- func (tq *TokenQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TokenQuery) ExistX(ctx context.Context) bool
- func (tq *TokenQuery) First(ctx context.Context) (*Token, error)
- func (tq *TokenQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TokenQuery) FirstX(ctx context.Context) *Token
- func (tq *TokenQuery) FirstXID(ctx context.Context) int
- func (tq *TokenQuery) GroupBy(field string, fields ...string) *TokenGroupBy
- func (tq *TokenQuery) IDs(ctx context.Context) ([]int, error)
- func (tq *TokenQuery) IDsX(ctx context.Context) []int
- func (tq *TokenQuery) Limit(limit int) *TokenQuery
- func (tq *TokenQuery) Offset(offset int) *TokenQuery
- func (tq *TokenQuery) Only(ctx context.Context) (*Token, error)
- func (tq *TokenQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TokenQuery) OnlyIDX(ctx context.Context) int
- func (tq *TokenQuery) OnlyX(ctx context.Context) *Token
- func (tq *TokenQuery) Order(o ...OrderFunc) *TokenQuery
- func (tq *TokenQuery) QueryUser() *UserQuery
- func (tq *TokenQuery) Select(field string, fields ...string) *TokenSelect
- func (tq *TokenQuery) Where(ps ...predicate.Token) *TokenQuery
- func (tq *TokenQuery) WithUser(opts ...func(*UserQuery)) *TokenQuery
- type TokenSelect
- func (ts *TokenSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ts *TokenSelect) BoolX(ctx context.Context) bool
- func (ts *TokenSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TokenSelect) BoolsX(ctx context.Context) []bool
- func (ts *TokenSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ts *TokenSelect) Float64X(ctx context.Context) float64
- func (ts *TokenSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TokenSelect) Float64sX(ctx context.Context) []float64
- func (ts *TokenSelect) Int(ctx context.Context) (_ int, err error)
- func (ts *TokenSelect) IntX(ctx context.Context) int
- func (ts *TokenSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TokenSelect) IntsX(ctx context.Context) []int
- func (ts *TokenSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TokenSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TokenSelect) String(ctx context.Context) (_ string, err error)
- func (ts *TokenSelect) StringX(ctx context.Context) string
- func (ts *TokenSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *TokenSelect) StringsX(ctx context.Context) []string
- type TokenUpdate
- func (tu *TokenUpdate) ClearUser() *TokenUpdate
- func (tu *TokenUpdate) Exec(ctx context.Context) error
- func (tu *TokenUpdate) ExecX(ctx context.Context)
- func (tu *TokenUpdate) Mutation() *TokenMutation
- func (tu *TokenUpdate) Save(ctx context.Context) (int, error)
- func (tu *TokenUpdate) SaveX(ctx context.Context) int
- func (tu *TokenUpdate) SetUser(u *User) *TokenUpdate
- func (tu *TokenUpdate) SetUserID(id int) *TokenUpdate
- func (tu *TokenUpdate) SetValue(s string) *TokenUpdate
- func (tu *TokenUpdate) Where(ps ...predicate.Token) *TokenUpdate
- type TokenUpdateOne
- func (tuo *TokenUpdateOne) ClearUser() *TokenUpdateOne
- func (tuo *TokenUpdateOne) Exec(ctx context.Context) error
- func (tuo *TokenUpdateOne) ExecX(ctx context.Context)
- func (tuo *TokenUpdateOne) Mutation() *TokenMutation
- func (tuo *TokenUpdateOne) Save(ctx context.Context) (*Token, error)
- func (tuo *TokenUpdateOne) SaveX(ctx context.Context) *Token
- func (tuo *TokenUpdateOne) SetUser(u *User) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetUserID(id int) *TokenUpdateOne
- func (tuo *TokenUpdateOne) SetValue(s string) *TokenUpdateOne
- type Tokens
- type Tx
- type User
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryContacts(u *User) *ContactQuery
- func (c *UserClient) QueryToken(u *User) *TokenQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (uc *UserCreate) AddContactIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddContacts(c ...*Contact) *UserCreate
- func (uc *UserCreate) AddToken(t ...*Token) *UserCreate
- func (uc *UserCreate) AddTokenIDs(ids ...int) *UserCreate
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetUsername(s string) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserEdges
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (ugb *UserGroupBy) BoolX(ctx context.Context) bool
- func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (ugb *UserGroupBy) Float64X(ctx context.Context) float64
- func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (ugb *UserGroupBy) IntX(ctx context.Context) int
- func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
- func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)
- func (ugb *UserGroupBy) StringX(ctx context.Context) string
- func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ugb *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) AddContactIDs(ids ...int)
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddTokenIDs(ids ...int)
- func (m *UserMutation) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) ClearContacts()
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearToken()
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) ContactsCleared() bool
- func (m *UserMutation) ContactsIDs() (ids []int)
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) RemoveContactIDs(ids ...int)
- func (m *UserMutation) RemoveTokenIDs(ids ...int)
- func (m *UserMutation) RemovedContactsIDs() (ids []int)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedTokenIDs() (ids []int)
- func (m *UserMutation) ResetContacts()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetToken()
- func (m *UserMutation) ResetUsername()
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetUsername(s string)
- func (m *UserMutation) TokenCleared() bool
- func (m *UserMutation) TokenIDs() (ids []int)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) Username() (r string, exists bool)
- type UserQuery
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) FirstXID(ctx context.Context) int
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) int
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery
- func (uq *UserQuery) QueryContacts() *ContactQuery
- func (uq *UserQuery) QueryToken() *TokenQuery
- func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithContacts(opts ...func(*ContactQuery)) *UserQuery
- func (uq *UserQuery) WithToken(opts ...func(*TokenQuery)) *UserQuery
- type UserSelect
- func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (us *UserSelect) BoolX(ctx context.Context) bool
- func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (us *UserSelect) BoolsX(ctx context.Context) []bool
- func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (us *UserSelect) Float64X(ctx context.Context) float64
- func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (us *UserSelect) Float64sX(ctx context.Context) []float64
- func (us *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (us *UserSelect) IntX(ctx context.Context) int
- func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (us *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
- func (us *UserSelect) ScanX(ctx context.Context, v interface{})
- func (us *UserSelect) String(ctx context.Context) (_ string, err error)
- func (us *UserSelect) StringX(ctx context.Context) string
- func (us *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (us *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) AddContactIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddContacts(c ...*Contact) *UserUpdate
- func (uu *UserUpdate) AddToken(t ...*Token) *UserUpdate
- func (uu *UserUpdate) AddTokenIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) ClearContacts() *UserUpdate
- func (uu *UserUpdate) ClearToken() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveContactIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveContacts(c ...*Contact) *UserUpdate
- func (uu *UserUpdate) RemoveToken(t ...*Token) *UserUpdate
- func (uu *UserUpdate) RemoveTokenIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetUsername(s string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddContactIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddContacts(c ...*Contact) *UserUpdateOne
- func (uuo *UserUpdateOne) AddToken(t ...*Token) *UserUpdateOne
- func (uuo *UserUpdateOne) AddTokenIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearContacts() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearToken() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveContactIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveContacts(c ...*Contact) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveToken(t ...*Token) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveTokenIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
- type Users
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeContact = "Contact" TypeToken = "Token" TypeUser = "User" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validaton error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Contact is the client for interacting with the Contact builders. Contact *ContactClient // Token is the client for interacting with the Token builders. Token *TokenClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Contact. Query(). Count(ctx)
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Contact ¶
type Contact struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Phone holds the value of the "phone" field. Phone string `json:"phone,omitempty"` // Address holds the value of the "address" field. Address string `json:"address,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ContactQuery when eager-loading is set. Edges ContactEdges `json:"edges"` // contains filtered or unexported fields }
Contact is the model entity for the Contact schema.
func (*Contact) QueryOwner ¶
QueryOwner queries the owner edge of the Contact.
func (*Contact) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Contact) Update ¶
func (c *Contact) Update() *ContactUpdateOne
Update returns a builder for updating this Contact. Note that, you need to call Contact.Unwrap() before calling this method, if this Contact was returned from a transaction, and the transaction was committed or rolled back.
type ContactClient ¶
type ContactClient struct {
// contains filtered or unexported fields
}
ContactClient is a client for the Contact schema.
func NewContactClient ¶
func NewContactClient(c config) *ContactClient
NewContactClient returns a client for the Contact from the given config.
func (*ContactClient) Create ¶
func (c *ContactClient) Create() *ContactCreate
Create returns a create builder for Contact.
func (*ContactClient) CreateBulk ¶
func (c *ContactClient) CreateBulk(builders ...*ContactCreate) *ContactCreateBulk
BulkCreate returns a builder for creating a bulk of Contact entities.
func (*ContactClient) Delete ¶
func (c *ContactClient) Delete() *ContactDelete
Delete returns a delete builder for Contact.
func (*ContactClient) DeleteOne ¶
func (c *ContactClient) DeleteOne(co *Contact) *ContactDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ContactClient) DeleteOneID ¶
func (c *ContactClient) DeleteOneID(id int) *ContactDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ContactClient) GetX ¶
func (c *ContactClient) GetX(ctx context.Context, id int) *Contact
GetX is like Get, but panics if an error occurs.
func (*ContactClient) Hooks ¶
func (c *ContactClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ContactClient) Query ¶
func (c *ContactClient) Query() *ContactQuery
Query returns a query builder for Contact.
func (*ContactClient) QueryOwner ¶
func (c *ContactClient) QueryOwner(co *Contact) *UserQuery
QueryOwner queries the owner edge of a Contact.
func (*ContactClient) Update ¶
func (c *ContactClient) Update() *ContactUpdate
Update returns an update builder for Contact.
func (*ContactClient) UpdateOne ¶
func (c *ContactClient) UpdateOne(co *Contact) *ContactUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ContactClient) UpdateOneID ¶
func (c *ContactClient) UpdateOneID(id int) *ContactUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ContactClient) Use ¶
func (c *ContactClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `contact.Hooks(f(g(h())))`.
type ContactCreate ¶
type ContactCreate struct {
// contains filtered or unexported fields
}
ContactCreate is the builder for creating a Contact entity.
func (*ContactCreate) Mutation ¶
func (cc *ContactCreate) Mutation() *ContactMutation
Mutation returns the ContactMutation object of the builder.
func (*ContactCreate) Save ¶
func (cc *ContactCreate) Save(ctx context.Context) (*Contact, error)
Save creates the Contact in the database.
func (*ContactCreate) SaveX ¶
func (cc *ContactCreate) SaveX(ctx context.Context) *Contact
SaveX calls Save and panics if Save returns an error.
func (*ContactCreate) SetAddress ¶
func (cc *ContactCreate) SetAddress(s string) *ContactCreate
SetAddress sets the address field.
func (*ContactCreate) SetName ¶
func (cc *ContactCreate) SetName(s string) *ContactCreate
SetName sets the name field.
func (*ContactCreate) SetOwner ¶
func (cc *ContactCreate) SetOwner(u *User) *ContactCreate
SetOwner sets the owner edge to User.
func (*ContactCreate) SetOwnerID ¶
func (cc *ContactCreate) SetOwnerID(id int) *ContactCreate
SetOwnerID sets the owner edge to User by id.
func (*ContactCreate) SetPhone ¶
func (cc *ContactCreate) SetPhone(s string) *ContactCreate
SetPhone sets the phone field.
type ContactCreateBulk ¶
type ContactCreateBulk struct {
// contains filtered or unexported fields
}
ContactCreateBulk is the builder for creating a bulk of Contact entities.
type ContactDelete ¶
type ContactDelete struct {
// contains filtered or unexported fields
}
ContactDelete is the builder for deleting a Contact entity.
func (*ContactDelete) Exec ¶
func (cd *ContactDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ContactDelete) ExecX ¶
func (cd *ContactDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ContactDelete) Where ¶
func (cd *ContactDelete) Where(ps ...predicate.Contact) *ContactDelete
Where adds a new predicate to the delete builder.
type ContactDeleteOne ¶
type ContactDeleteOne struct {
// contains filtered or unexported fields
}
ContactDeleteOne is the builder for deleting a single Contact entity.
func (*ContactDeleteOne) Exec ¶
func (cdo *ContactDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ContactDeleteOne) ExecX ¶
func (cdo *ContactDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ContactEdges ¶
type ContactEdges struct { // Owner holds the value of the owner edge. Owner *User // contains filtered or unexported fields }
ContactEdges holds the relations/edges for other nodes in the graph.
func (ContactEdges) OwnerOrErr ¶
func (e ContactEdges) OwnerOrErr() (*User, error)
OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type ContactGroupBy ¶
type ContactGroupBy struct {
// contains filtered or unexported fields
}
ContactGroupBy is the builder for group-by Contact entities.
func (*ContactGroupBy) Aggregate ¶
func (cgb *ContactGroupBy) Aggregate(fns ...AggregateFunc) *ContactGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ContactGroupBy) Bool ¶
func (cgb *ContactGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) BoolX ¶
func (cgb *ContactGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ContactGroupBy) Bools ¶
func (cgb *ContactGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) BoolsX ¶
func (cgb *ContactGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ContactGroupBy) Float64 ¶
func (cgb *ContactGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) Float64X ¶
func (cgb *ContactGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ContactGroupBy) Float64s ¶
func (cgb *ContactGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) Float64sX ¶
func (cgb *ContactGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ContactGroupBy) Int ¶
func (cgb *ContactGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) IntX ¶
func (cgb *ContactGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ContactGroupBy) Ints ¶
func (cgb *ContactGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) IntsX ¶
func (cgb *ContactGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ContactGroupBy) Scan ¶
func (cgb *ContactGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*ContactGroupBy) ScanX ¶
func (cgb *ContactGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ContactGroupBy) String ¶
func (cgb *ContactGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from group-by. It is only allowed when querying group-by with one field.
func (*ContactGroupBy) StringX ¶
func (cgb *ContactGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ContactMutation ¶
type ContactMutation struct {
// contains filtered or unexported fields
}
ContactMutation represents an operation that mutate the Contacts nodes in the graph.
func (*ContactMutation) AddField ¶
func (m *ContactMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ContactMutation) AddedEdges ¶
func (m *ContactMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ContactMutation) AddedField ¶
func (m *ContactMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*ContactMutation) AddedFields ¶
func (m *ContactMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*ContactMutation) AddedIDs ¶
func (m *ContactMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*ContactMutation) Address ¶
func (m *ContactMutation) Address() (r string, exists bool)
Address returns the address value in the mutation.
func (*ContactMutation) ClearEdge ¶
func (m *ContactMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*ContactMutation) ClearField ¶
func (m *ContactMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*ContactMutation) ClearOwner ¶
func (m *ContactMutation) ClearOwner()
ClearOwner clears the owner edge to User.
func (*ContactMutation) ClearedEdges ¶
func (m *ContactMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ContactMutation) ClearedFields ¶
func (m *ContactMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ContactMutation) Client ¶
func (m ContactMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*ContactMutation) EdgeCleared ¶
func (m *ContactMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*ContactMutation) Field ¶
func (m *ContactMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*ContactMutation) FieldCleared ¶
func (m *ContactMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*ContactMutation) Fields ¶
func (m *ContactMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*ContactMutation) ID ¶
func (m *ContactMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*ContactMutation) Name ¶
func (m *ContactMutation) Name() (r string, exists bool)
Name returns the name value in the mutation.
func (*ContactMutation) OldAddress ¶
func (m *ContactMutation) OldAddress(ctx context.Context) (v string, err error)
OldAddress returns the old address value of the Contact. If the Contact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*ContactMutation) OldField ¶
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 was failed.
func (*ContactMutation) OldName ¶
func (m *ContactMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old name value of the Contact. If the Contact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*ContactMutation) OldPhone ¶
func (m *ContactMutation) OldPhone(ctx context.Context) (v string, err error)
OldPhone returns the old phone value of the Contact. If the Contact object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*ContactMutation) OwnerCleared ¶
func (m *ContactMutation) OwnerCleared() bool
OwnerCleared returns if the edge owner was cleared.
func (*ContactMutation) OwnerID ¶
func (m *ContactMutation) OwnerID() (id int, exists bool)
OwnerID returns the owner id in the mutation.
func (*ContactMutation) OwnerIDs ¶
func (m *ContactMutation) OwnerIDs() (ids []int)
OwnerIDs returns the owner ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.
func (*ContactMutation) Phone ¶
func (m *ContactMutation) Phone() (r string, exists bool)
Phone returns the phone value in the mutation.
func (*ContactMutation) RemovedEdges ¶
func (m *ContactMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ContactMutation) RemovedIDs ¶
func (m *ContactMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*ContactMutation) ResetAddress ¶
func (m *ContactMutation) ResetAddress()
ResetAddress reset all changes of the "address" field.
func (*ContactMutation) ResetEdge ¶
func (m *ContactMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*ContactMutation) ResetField ¶
func (m *ContactMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*ContactMutation) ResetName ¶
func (m *ContactMutation) ResetName()
ResetName reset all changes of the "name" field.
func (*ContactMutation) ResetOwner ¶
func (m *ContactMutation) ResetOwner()
ResetOwner reset all changes of the "owner" edge.
func (*ContactMutation) ResetPhone ¶
func (m *ContactMutation) ResetPhone()
ResetPhone reset all changes of the "phone" field.
func (*ContactMutation) SetAddress ¶
func (m *ContactMutation) SetAddress(s string)
SetAddress sets the address field.
func (*ContactMutation) SetField ¶
func (m *ContactMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*ContactMutation) SetName ¶
func (m *ContactMutation) SetName(s string)
SetName sets the name field.
func (*ContactMutation) SetOwnerID ¶
func (m *ContactMutation) SetOwnerID(id int)
SetOwnerID sets the owner edge to User by id.
func (*ContactMutation) SetPhone ¶
func (m *ContactMutation) SetPhone(s string)
SetPhone sets the phone field.
func (ContactMutation) Tx ¶
func (m ContactMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ContactMutation) Type ¶
func (m *ContactMutation) Type() string
Type returns the node type of this mutation (Contact).
type ContactQuery ¶
type ContactQuery struct {
// contains filtered or unexported fields
}
ContactQuery is the builder for querying Contact entities.
func (*ContactQuery) All ¶
func (cq *ContactQuery) All(ctx context.Context) ([]*Contact, error)
All executes the query and returns a list of Contacts.
func (*ContactQuery) AllX ¶
func (cq *ContactQuery) AllX(ctx context.Context) []*Contact
AllX is like All, but panics if an error occurs.
func (*ContactQuery) Clone ¶
func (cq *ContactQuery) Clone() *ContactQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ContactQuery) Count ¶
func (cq *ContactQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ContactQuery) CountX ¶
func (cq *ContactQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ContactQuery) Exist ¶
func (cq *ContactQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ContactQuery) ExistX ¶
func (cq *ContactQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ContactQuery) First ¶
func (cq *ContactQuery) First(ctx context.Context) (*Contact, error)
First returns the first Contact entity in the query. Returns *NotFoundError when no contact was found.
func (*ContactQuery) FirstID ¶
func (cq *ContactQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Contact id in the query. Returns *NotFoundError when no id was found.
func (*ContactQuery) FirstX ¶
func (cq *ContactQuery) FirstX(ctx context.Context) *Contact
FirstX is like First, but panics if an error occurs.
func (*ContactQuery) FirstXID ¶
func (cq *ContactQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*ContactQuery) GroupBy ¶
func (cq *ContactQuery) GroupBy(field string, fields ...string) *ContactGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Contact.Query(). GroupBy(contact.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ContactQuery) IDs ¶
func (cq *ContactQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Contact ids.
func (*ContactQuery) IDsX ¶
func (cq *ContactQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ContactQuery) Limit ¶
func (cq *ContactQuery) Limit(limit int) *ContactQuery
Limit adds a limit step to the query.
func (*ContactQuery) Offset ¶
func (cq *ContactQuery) Offset(offset int) *ContactQuery
Offset adds an offset step to the query.
func (*ContactQuery) Only ¶
func (cq *ContactQuery) Only(ctx context.Context) (*Contact, error)
Only returns the only Contact entity in the query, returns an error if not exactly one entity was returned.
func (*ContactQuery) OnlyID ¶
func (cq *ContactQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Contact id in the query, returns an error if not exactly one id was returned.
func (*ContactQuery) OnlyIDX ¶
func (cq *ContactQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ContactQuery) OnlyX ¶
func (cq *ContactQuery) OnlyX(ctx context.Context) *Contact
OnlyX is like Only, but panics if an error occurs.
func (*ContactQuery) Order ¶
func (cq *ContactQuery) Order(o ...OrderFunc) *ContactQuery
Order adds an order step to the query.
func (*ContactQuery) QueryOwner ¶
func (cq *ContactQuery) QueryOwner() *UserQuery
QueryOwner chains the current query on the owner edge.
func (*ContactQuery) Select ¶
func (cq *ContactQuery) Select(field string, fields ...string) *ContactSelect
Select one or more fields from the given query.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Contact.Query(). Select(contact.FieldName). Scan(ctx, &v)
func (*ContactQuery) Where ¶
func (cq *ContactQuery) Where(ps ...predicate.Contact) *ContactQuery
Where adds a new predicate for the builder.
func (*ContactQuery) WithOwner ¶
func (cq *ContactQuery) WithOwner(opts ...func(*UserQuery)) *ContactQuery
WithOwner tells the query-builder to eager-loads the nodes that are connected to
the "owner" edge. The optional arguments used to configure the query builder of the edge.
type ContactSelect ¶
type ContactSelect struct {
// contains filtered or unexported fields
}
ContactSelect is the builder for select fields of Contact entities.
func (*ContactSelect) Bool ¶
func (cs *ContactSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from selector. It is only allowed when selecting one field.
func (*ContactSelect) BoolX ¶
func (cs *ContactSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ContactSelect) Bools ¶
func (cs *ContactSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*ContactSelect) BoolsX ¶
func (cs *ContactSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ContactSelect) Float64 ¶
func (cs *ContactSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from selector. It is only allowed when selecting one field.
func (*ContactSelect) Float64X ¶
func (cs *ContactSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ContactSelect) Float64s ¶
func (cs *ContactSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*ContactSelect) Float64sX ¶
func (cs *ContactSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ContactSelect) Int ¶
func (cs *ContactSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from selector. It is only allowed when selecting one field.
func (*ContactSelect) IntX ¶
func (cs *ContactSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ContactSelect) Ints ¶
func (cs *ContactSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*ContactSelect) IntsX ¶
func (cs *ContactSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ContactSelect) Scan ¶
func (cs *ContactSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*ContactSelect) ScanX ¶
func (cs *ContactSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ContactSelect) String ¶
func (cs *ContactSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from selector. It is only allowed when selecting one field.
func (*ContactSelect) StringX ¶
func (cs *ContactSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ContactUpdate ¶
type ContactUpdate struct {
// contains filtered or unexported fields
}
ContactUpdate is the builder for updating Contact entities.
func (*ContactUpdate) ClearOwner ¶
func (cu *ContactUpdate) ClearOwner() *ContactUpdate
ClearOwner clears the "owner" edge to type User.
func (*ContactUpdate) Exec ¶
func (cu *ContactUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ContactUpdate) ExecX ¶
func (cu *ContactUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ContactUpdate) Mutation ¶
func (cu *ContactUpdate) Mutation() *ContactMutation
Mutation returns the ContactMutation object of the builder.
func (*ContactUpdate) Save ¶
func (cu *ContactUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*ContactUpdate) SaveX ¶
func (cu *ContactUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ContactUpdate) SetAddress ¶
func (cu *ContactUpdate) SetAddress(s string) *ContactUpdate
SetAddress sets the address field.
func (*ContactUpdate) SetName ¶
func (cu *ContactUpdate) SetName(s string) *ContactUpdate
SetName sets the name field.
func (*ContactUpdate) SetOwner ¶
func (cu *ContactUpdate) SetOwner(u *User) *ContactUpdate
SetOwner sets the owner edge to User.
func (*ContactUpdate) SetOwnerID ¶
func (cu *ContactUpdate) SetOwnerID(id int) *ContactUpdate
SetOwnerID sets the owner edge to User by id.
func (*ContactUpdate) SetPhone ¶
func (cu *ContactUpdate) SetPhone(s string) *ContactUpdate
SetPhone sets the phone field.
func (*ContactUpdate) Where ¶
func (cu *ContactUpdate) Where(ps ...predicate.Contact) *ContactUpdate
Where adds a new predicate for the builder.
type ContactUpdateOne ¶
type ContactUpdateOne struct {
// contains filtered or unexported fields
}
ContactUpdateOne is the builder for updating a single Contact entity.
func (*ContactUpdateOne) ClearOwner ¶
func (cuo *ContactUpdateOne) ClearOwner() *ContactUpdateOne
ClearOwner clears the "owner" edge to type User.
func (*ContactUpdateOne) Exec ¶
func (cuo *ContactUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ContactUpdateOne) ExecX ¶
func (cuo *ContactUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ContactUpdateOne) Mutation ¶
func (cuo *ContactUpdateOne) Mutation() *ContactMutation
Mutation returns the ContactMutation object of the builder.
func (*ContactUpdateOne) Save ¶
func (cuo *ContactUpdateOne) Save(ctx context.Context) (*Contact, error)
Save executes the query and returns the updated entity.
func (*ContactUpdateOne) SaveX ¶
func (cuo *ContactUpdateOne) SaveX(ctx context.Context) *Contact
SaveX is like Save, but panics if an error occurs.
func (*ContactUpdateOne) SetAddress ¶
func (cuo *ContactUpdateOne) SetAddress(s string) *ContactUpdateOne
SetAddress sets the address field.
func (*ContactUpdateOne) SetName ¶
func (cuo *ContactUpdateOne) SetName(s string) *ContactUpdateOne
SetName sets the name field.
func (*ContactUpdateOne) SetOwner ¶
func (cuo *ContactUpdateOne) SetOwner(u *User) *ContactUpdateOne
SetOwner sets the owner edge to User.
func (*ContactUpdateOne) SetOwnerID ¶
func (cuo *ContactUpdateOne) SetOwnerID(id int) *ContactUpdateOne
SetOwnerID sets the owner edge to User by id.
func (*ContactUpdateOne) SetPhone ¶
func (cuo *ContactUpdateOne) SetPhone(s string) *ContactUpdateOne
SetPhone sets the phone field.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflict in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollbacker method.
type Token ¶
type Token struct { // ID of the ent. ID int `json:"id,omitempty"` // Value holds the value of the "value" field. Value string `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TokenQuery when eager-loading is set. Edges TokenEdges `json:"edges"` // contains filtered or unexported fields }
Token is the model entity for the Token schema.
func (*Token) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Token) Update ¶
func (t *Token) Update() *TokenUpdateOne
Update returns a builder for updating this Token. Note that, you need to call Token.Unwrap() before calling this method, if this Token was returned from a transaction, and the transaction was committed or rolled back.
type TokenClient ¶
type TokenClient struct {
// contains filtered or unexported fields
}
TokenClient is a client for the Token schema.
func NewTokenClient ¶
func NewTokenClient(c config) *TokenClient
NewTokenClient returns a client for the Token from the given config.
func (*TokenClient) Create ¶
func (c *TokenClient) Create() *TokenCreate
Create returns a create builder for Token.
func (*TokenClient) CreateBulk ¶
func (c *TokenClient) CreateBulk(builders ...*TokenCreate) *TokenCreateBulk
BulkCreate returns a builder for creating a bulk of Token entities.
func (*TokenClient) Delete ¶
func (c *TokenClient) Delete() *TokenDelete
Delete returns a delete builder for Token.
func (*TokenClient) DeleteOne ¶
func (c *TokenClient) DeleteOne(t *Token) *TokenDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*TokenClient) DeleteOneID ¶
func (c *TokenClient) DeleteOneID(id int) *TokenDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*TokenClient) GetX ¶
func (c *TokenClient) GetX(ctx context.Context, id int) *Token
GetX is like Get, but panics if an error occurs.
func (*TokenClient) Query ¶
func (c *TokenClient) Query() *TokenQuery
Query returns a query builder for Token.
func (*TokenClient) QueryUser ¶
func (c *TokenClient) QueryUser(t *Token) *UserQuery
QueryUser queries the user edge of a Token.
func (*TokenClient) Update ¶
func (c *TokenClient) Update() *TokenUpdate
Update returns an update builder for Token.
func (*TokenClient) UpdateOne ¶
func (c *TokenClient) UpdateOne(t *Token) *TokenUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TokenClient) UpdateOneID ¶
func (c *TokenClient) UpdateOneID(id int) *TokenUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TokenClient) Use ¶
func (c *TokenClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `token.Hooks(f(g(h())))`.
type TokenCreate ¶
type TokenCreate struct {
// contains filtered or unexported fields
}
TokenCreate is the builder for creating a Token entity.
func (*TokenCreate) Mutation ¶
func (tc *TokenCreate) Mutation() *TokenMutation
Mutation returns the TokenMutation object of the builder.
func (*TokenCreate) Save ¶
func (tc *TokenCreate) Save(ctx context.Context) (*Token, error)
Save creates the Token in the database.
func (*TokenCreate) SaveX ¶
func (tc *TokenCreate) SaveX(ctx context.Context) *Token
SaveX calls Save and panics if Save returns an error.
func (*TokenCreate) SetUser ¶
func (tc *TokenCreate) SetUser(u *User) *TokenCreate
SetUser sets the user edge to User.
func (*TokenCreate) SetUserID ¶
func (tc *TokenCreate) SetUserID(id int) *TokenCreate
SetUserID sets the user edge to User by id.
func (*TokenCreate) SetValue ¶
func (tc *TokenCreate) SetValue(s string) *TokenCreate
SetValue sets the value field.
type TokenCreateBulk ¶
type TokenCreateBulk struct {
// contains filtered or unexported fields
}
TokenCreateBulk is the builder for creating a bulk of Token entities.
type TokenDelete ¶
type TokenDelete struct {
// contains filtered or unexported fields
}
TokenDelete is the builder for deleting a Token entity.
func (*TokenDelete) Exec ¶
func (td *TokenDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TokenDelete) ExecX ¶
func (td *TokenDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TokenDelete) Where ¶
func (td *TokenDelete) Where(ps ...predicate.Token) *TokenDelete
Where adds a new predicate to the delete builder.
type TokenDeleteOne ¶
type TokenDeleteOne struct {
// contains filtered or unexported fields
}
TokenDeleteOne is the builder for deleting a single Token entity.
func (*TokenDeleteOne) Exec ¶
func (tdo *TokenDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TokenDeleteOne) ExecX ¶
func (tdo *TokenDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TokenEdges ¶
type TokenEdges struct { // User holds the value of the user edge. User *User // contains filtered or unexported fields }
TokenEdges holds the relations/edges for other nodes in the graph.
func (TokenEdges) UserOrErr ¶
func (e TokenEdges) UserOrErr() (*User, error)
UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type TokenGroupBy ¶
type TokenGroupBy struct {
// contains filtered or unexported fields
}
TokenGroupBy is the builder for group-by Token entities.
func (*TokenGroupBy) Aggregate ¶
func (tgb *TokenGroupBy) Aggregate(fns ...AggregateFunc) *TokenGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TokenGroupBy) Bool ¶
func (tgb *TokenGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) BoolX ¶
func (tgb *TokenGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TokenGroupBy) Bools ¶
func (tgb *TokenGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) BoolsX ¶
func (tgb *TokenGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TokenGroupBy) Float64 ¶
func (tgb *TokenGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) Float64X ¶
func (tgb *TokenGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TokenGroupBy) Float64s ¶
func (tgb *TokenGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) Float64sX ¶
func (tgb *TokenGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TokenGroupBy) Int ¶
func (tgb *TokenGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) IntX ¶
func (tgb *TokenGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TokenGroupBy) Ints ¶
func (tgb *TokenGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) IntsX ¶
func (tgb *TokenGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TokenGroupBy) Scan ¶
func (tgb *TokenGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*TokenGroupBy) ScanX ¶
func (tgb *TokenGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TokenGroupBy) String ¶
func (tgb *TokenGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from group-by. It is only allowed when querying group-by with one field.
func (*TokenGroupBy) StringX ¶
func (tgb *TokenGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type TokenMutation ¶
type TokenMutation struct {
// contains filtered or unexported fields
}
TokenMutation represents an operation that mutate the Tokens nodes in the graph.
func (*TokenMutation) AddField ¶
func (m *TokenMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*TokenMutation) AddedEdges ¶
func (m *TokenMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TokenMutation) AddedField ¶
func (m *TokenMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*TokenMutation) AddedFields ¶
func (m *TokenMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*TokenMutation) AddedIDs ¶
func (m *TokenMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*TokenMutation) ClearEdge ¶
func (m *TokenMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*TokenMutation) ClearField ¶
func (m *TokenMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*TokenMutation) ClearUser ¶
func (m *TokenMutation) ClearUser()
ClearUser clears the user edge to User.
func (*TokenMutation) ClearedEdges ¶
func (m *TokenMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TokenMutation) ClearedFields ¶
func (m *TokenMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TokenMutation) Client ¶
func (m TokenMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*TokenMutation) EdgeCleared ¶
func (m *TokenMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*TokenMutation) Field ¶
func (m *TokenMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*TokenMutation) FieldCleared ¶
func (m *TokenMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*TokenMutation) Fields ¶
func (m *TokenMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*TokenMutation) ID ¶
func (m *TokenMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*TokenMutation) OldField ¶
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 was failed.
func (*TokenMutation) OldValue ¶
func (m *TokenMutation) OldValue(ctx context.Context) (v string, err error)
OldValue returns the old value value of the Token. If the Token object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*TokenMutation) RemovedEdges ¶
func (m *TokenMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TokenMutation) RemovedIDs ¶
func (m *TokenMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*TokenMutation) ResetEdge ¶
func (m *TokenMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*TokenMutation) ResetField ¶
func (m *TokenMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*TokenMutation) ResetUser ¶
func (m *TokenMutation) ResetUser()
ResetUser reset all changes of the "user" edge.
func (*TokenMutation) ResetValue ¶
func (m *TokenMutation) ResetValue()
ResetValue reset all changes of the "value" field.
func (*TokenMutation) SetField ¶
func (m *TokenMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*TokenMutation) SetUserID ¶
func (m *TokenMutation) SetUserID(id int)
SetUserID sets the user edge to User by id.
func (*TokenMutation) SetValue ¶
func (m *TokenMutation) SetValue(s string)
SetValue sets the value field.
func (TokenMutation) Tx ¶
func (m TokenMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TokenMutation) Type ¶
func (m *TokenMutation) Type() string
Type returns the node type of this mutation (Token).
func (*TokenMutation) UserCleared ¶
func (m *TokenMutation) UserCleared() bool
UserCleared returns if the edge user was cleared.
func (*TokenMutation) UserID ¶
func (m *TokenMutation) UserID() (id int, exists bool)
UserID returns the user id in the mutation.
func (*TokenMutation) UserIDs ¶
func (m *TokenMutation) UserIDs() (ids []int)
UserIDs returns the user ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.
func (*TokenMutation) Value ¶
func (m *TokenMutation) Value() (r string, exists bool)
Value returns the value value in the mutation.
type TokenQuery ¶
type TokenQuery struct {
// contains filtered or unexported fields
}
TokenQuery is the builder for querying Token entities.
func (*TokenQuery) All ¶
func (tq *TokenQuery) All(ctx context.Context) ([]*Token, error)
All executes the query and returns a list of Tokens.
func (*TokenQuery) AllX ¶
func (tq *TokenQuery) AllX(ctx context.Context) []*Token
AllX is like All, but panics if an error occurs.
func (*TokenQuery) Clone ¶
func (tq *TokenQuery) Clone() *TokenQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TokenQuery) Count ¶
func (tq *TokenQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*TokenQuery) CountX ¶
func (tq *TokenQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*TokenQuery) Exist ¶
func (tq *TokenQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*TokenQuery) ExistX ¶
func (tq *TokenQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*TokenQuery) First ¶
func (tq *TokenQuery) First(ctx context.Context) (*Token, error)
First returns the first Token entity in the query. Returns *NotFoundError when no token was found.
func (*TokenQuery) FirstID ¶
func (tq *TokenQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Token id in the query. Returns *NotFoundError when no id was found.
func (*TokenQuery) FirstX ¶
func (tq *TokenQuery) FirstX(ctx context.Context) *Token
FirstX is like First, but panics if an error occurs.
func (*TokenQuery) FirstXID ¶
func (tq *TokenQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*TokenQuery) GroupBy ¶
func (tq *TokenQuery) GroupBy(field string, fields ...string) *TokenGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Value string `json:"value,omitempty"` Count int `json:"count,omitempty"` } client.Token.Query(). GroupBy(token.FieldValue). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TokenQuery) IDs ¶
func (tq *TokenQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Token ids.
func (*TokenQuery) IDsX ¶
func (tq *TokenQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*TokenQuery) Limit ¶
func (tq *TokenQuery) Limit(limit int) *TokenQuery
Limit adds a limit step to the query.
func (*TokenQuery) Offset ¶
func (tq *TokenQuery) Offset(offset int) *TokenQuery
Offset adds an offset step to the query.
func (*TokenQuery) Only ¶
func (tq *TokenQuery) Only(ctx context.Context) (*Token, error)
Only returns the only Token entity in the query, returns an error if not exactly one entity was returned.
func (*TokenQuery) OnlyID ¶
func (tq *TokenQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Token id in the query, returns an error if not exactly one id was returned.
func (*TokenQuery) OnlyIDX ¶
func (tq *TokenQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*TokenQuery) OnlyX ¶
func (tq *TokenQuery) OnlyX(ctx context.Context) *Token
OnlyX is like Only, but panics if an error occurs.
func (*TokenQuery) Order ¶
func (tq *TokenQuery) Order(o ...OrderFunc) *TokenQuery
Order adds an order step to the query.
func (*TokenQuery) QueryUser ¶
func (tq *TokenQuery) QueryUser() *UserQuery
QueryUser chains the current query on the user edge.
func (*TokenQuery) Select ¶
func (tq *TokenQuery) Select(field string, fields ...string) *TokenSelect
Select one or more fields from the given query.
Example:
var v []struct { Value string `json:"value,omitempty"` } client.Token.Query(). Select(token.FieldValue). Scan(ctx, &v)
func (*TokenQuery) Where ¶
func (tq *TokenQuery) Where(ps ...predicate.Token) *TokenQuery
Where adds a new predicate for the builder.
func (*TokenQuery) WithUser ¶
func (tq *TokenQuery) WithUser(opts ...func(*UserQuery)) *TokenQuery
WithUser tells the query-builder to eager-loads the nodes that are connected to
the "user" edge. The optional arguments used to configure the query builder of the edge.
type TokenSelect ¶
type TokenSelect struct {
// contains filtered or unexported fields
}
TokenSelect is the builder for select fields of Token entities.
func (*TokenSelect) Bool ¶
func (ts *TokenSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from selector. It is only allowed when selecting one field.
func (*TokenSelect) BoolX ¶
func (ts *TokenSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TokenSelect) Bools ¶
func (ts *TokenSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*TokenSelect) BoolsX ¶
func (ts *TokenSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TokenSelect) Float64 ¶
func (ts *TokenSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from selector. It is only allowed when selecting one field.
func (*TokenSelect) Float64X ¶
func (ts *TokenSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TokenSelect) Float64s ¶
func (ts *TokenSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*TokenSelect) Float64sX ¶
func (ts *TokenSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TokenSelect) Int ¶
func (ts *TokenSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from selector. It is only allowed when selecting one field.
func (*TokenSelect) IntX ¶
func (ts *TokenSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TokenSelect) Ints ¶
func (ts *TokenSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*TokenSelect) IntsX ¶
func (ts *TokenSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TokenSelect) Scan ¶
func (ts *TokenSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*TokenSelect) ScanX ¶
func (ts *TokenSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TokenSelect) String ¶
func (ts *TokenSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from selector. It is only allowed when selecting one field.
func (*TokenSelect) StringX ¶
func (ts *TokenSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type TokenUpdate ¶
type TokenUpdate struct {
// contains filtered or unexported fields
}
TokenUpdate is the builder for updating Token entities.
func (*TokenUpdate) ClearUser ¶
func (tu *TokenUpdate) ClearUser() *TokenUpdate
ClearUser clears the "user" edge to type User.
func (*TokenUpdate) Exec ¶
func (tu *TokenUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TokenUpdate) ExecX ¶
func (tu *TokenUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TokenUpdate) Mutation ¶
func (tu *TokenUpdate) Mutation() *TokenMutation
Mutation returns the TokenMutation object of the builder.
func (*TokenUpdate) Save ¶
func (tu *TokenUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*TokenUpdate) SaveX ¶
func (tu *TokenUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TokenUpdate) SetUser ¶
func (tu *TokenUpdate) SetUser(u *User) *TokenUpdate
SetUser sets the user edge to User.
func (*TokenUpdate) SetUserID ¶
func (tu *TokenUpdate) SetUserID(id int) *TokenUpdate
SetUserID sets the user edge to User by id.
func (*TokenUpdate) SetValue ¶
func (tu *TokenUpdate) SetValue(s string) *TokenUpdate
SetValue sets the value field.
func (*TokenUpdate) Where ¶
func (tu *TokenUpdate) Where(ps ...predicate.Token) *TokenUpdate
Where adds a new predicate for the builder.
type TokenUpdateOne ¶
type TokenUpdateOne struct {
// contains filtered or unexported fields
}
TokenUpdateOne is the builder for updating a single Token entity.
func (*TokenUpdateOne) ClearUser ¶
func (tuo *TokenUpdateOne) ClearUser() *TokenUpdateOne
ClearUser clears the "user" edge to type User.
func (*TokenUpdateOne) Exec ¶
func (tuo *TokenUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TokenUpdateOne) ExecX ¶
func (tuo *TokenUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TokenUpdateOne) Mutation ¶
func (tuo *TokenUpdateOne) Mutation() *TokenMutation
Mutation returns the TokenMutation object of the builder.
func (*TokenUpdateOne) Save ¶
func (tuo *TokenUpdateOne) Save(ctx context.Context) (*Token, error)
Save executes the query and returns the updated entity.
func (*TokenUpdateOne) SaveX ¶
func (tuo *TokenUpdateOne) SaveX(ctx context.Context) *Token
SaveX is like Save, but panics if an error occurs.
func (*TokenUpdateOne) SetUser ¶
func (tuo *TokenUpdateOne) SetUser(u *User) *TokenUpdateOne
SetUser sets the user edge to User.
func (*TokenUpdateOne) SetUserID ¶
func (tuo *TokenUpdateOne) SetUserID(id int) *TokenUpdateOne
SetUserID sets the user edge to User by id.
func (*TokenUpdateOne) SetValue ¶
func (tuo *TokenUpdateOne) SetValue(s string) *TokenUpdateOne
SetValue sets the value field.
type Tx ¶
type Tx struct { // Contact is the client for interacting with the Contact builders. Contact *ContactClient // Token is the client for interacting with the Token builders. Token *TokenClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns the Tx stored in a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type User ¶
type User struct { // ID of the ent. ID int `json:"id,omitempty"` // Username holds the value of the "username" field. Username string `json:"username,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. Edges UserEdges `json:"edges"` // contains filtered or unexported fields }
User is the model entity for the User schema.
func (*User) QueryContacts ¶
func (u *User) QueryContacts() *ContactQuery
QueryContacts queries the contacts edge of the User.
func (*User) QueryToken ¶
func (u *User) QueryToken() *TokenQuery
QueryToken queries the token edge of the User.
func (*User) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that, you need to call User.Unwrap() before calling this method, if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a create builder for User.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
BulkCreate returns a builder for creating a bulk of User entities.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryContacts ¶
func (c *UserClient) QueryContacts(u *User) *ContactQuery
QueryContacts queries the contacts edge of a User.
func (*UserClient) QueryToken ¶
func (c *UserClient) QueryToken(u *User) *TokenQuery
QueryToken queries the token edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddContactIDs ¶
func (uc *UserCreate) AddContactIDs(ids ...int) *UserCreate
AddContactIDs adds the contacts edge to Contact by ids.
func (*UserCreate) AddContacts ¶
func (uc *UserCreate) AddContacts(c ...*Contact) *UserCreate
AddContacts adds the contacts edges to Contact.
func (*UserCreate) AddToken ¶
func (uc *UserCreate) AddToken(t ...*Token) *UserCreate
AddToken adds the token edges to Token.
func (*UserCreate) AddTokenIDs ¶
func (uc *UserCreate) AddTokenIDs(ids ...int) *UserCreate
AddTokenIDs adds the token edge to Token by ids.
func (*UserCreate) Mutation ¶
func (uc *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetPassword ¶
func (uc *UserCreate) SetPassword(s string) *UserCreate
SetPassword sets the password field.
func (*UserCreate) SetUsername ¶
func (uc *UserCreate) SetUsername(s string) *UserCreate
SetUsername sets the username field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating a bulk of User entities.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where adds a new predicate to the delete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserEdges ¶
type UserEdges struct { // Contacts holds the value of the contacts edge. Contacts []*Contact // Token holds the value of the token edge. Token []*Token // contains filtered or unexported fields }
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) ContactsOrErr ¶
ContactsOrErr returns the Contacts value or an error if the edge was not loaded in eager-loading.
func (UserEdges) TokenOrErr ¶
TokenOrErr returns the Token value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the builder for group-by User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) BoolX ¶
func (ugb *UserGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*UserGroupBy) Bools ¶
func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) BoolsX ¶
func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserGroupBy) Float64 ¶
func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) Float64X ¶
func (ugb *UserGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*UserGroupBy) Float64s ¶
func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) Float64sX ¶
func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserGroupBy) Int ¶
func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) IntX ¶
func (ugb *UserGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*UserGroupBy) Ints ¶
func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) IntsX ¶
func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*UserGroupBy) ScanX ¶
func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*UserGroupBy) String ¶
func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) StringX ¶
func (ugb *UserGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutate the Users nodes in the graph.
func (*UserMutation) AddContactIDs ¶
func (m *UserMutation) AddContactIDs(ids ...int)
AddContactIDs adds the contacts edge to Contact by ids.
func (*UserMutation) AddField ¶
func (m *UserMutation) AddField(name string, value ent.Value) error
AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*UserMutation) AddTokenIDs ¶
func (m *UserMutation) AddTokenIDs(ids ...int)
AddTokenIDs adds the token edge to Token by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented or decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all ids (to other nodes) that were added for the given edge name.
func (*UserMutation) ClearContacts ¶
func (m *UserMutation) ClearContacts()
ClearContacts clears the contacts edge to Contact.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearToken ¶
func (m *UserMutation) ClearToken()
ClearToken clears the token edge to Token.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) ContactsCleared ¶
func (m *UserMutation) ContactsCleared() bool
ContactsCleared returns if the edge contacts was cleared.
func (*UserMutation) ContactsIDs ¶
func (m *UserMutation) ContactsIDs() (ids []int)
ContactsIDs returns the contacts ids in the mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicates if this field was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.
func (*UserMutation) OldField ¶
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 was failed.
func (*UserMutation) OldPassword ¶
func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
OldPassword returns the old password value of the User. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*UserMutation) OldUsername ¶
func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
OldUsername returns the old username value of the User. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the password value in the mutation.
func (*UserMutation) RemoveContactIDs ¶
func (m *UserMutation) RemoveContactIDs(ids ...int)
RemoveContactIDs removes the contacts edge to Contact by ids.
func (*UserMutation) RemoveTokenIDs ¶
func (m *UserMutation) RemoveTokenIDs(ids ...int)
RemoveTokenIDs removes the token edge to Token by ids.
func (*UserMutation) RemovedContactsIDs ¶
func (m *UserMutation) RemovedContactsIDs() (ids []int)
RemovedContacts returns the removed ids of contacts.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
func (*UserMutation) RemovedTokenIDs ¶
func (m *UserMutation) RemovedTokenIDs() (ids []int)
RemovedToken returns the removed ids of token.
func (*UserMutation) ResetContacts ¶
func (m *UserMutation) ResetContacts()
ResetContacts reset all changes of the "contacts" edge.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes in the mutation regarding the given edge name. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetField ¶
func (m *UserMutation) ResetField(name string) error
ResetField resets all changes in the mutation regarding the given field name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword reset all changes of the "password" field.
func (*UserMutation) ResetToken ¶
func (m *UserMutation) ResetToken()
ResetToken reset all changes of the "token" edge.
func (*UserMutation) ResetUsername ¶
func (m *UserMutation) ResetUsername()
ResetUsername reset all changes of the "username" field.
func (*UserMutation) SetField ¶
func (m *UserMutation) SetField(name string, value ent.Value) error
SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the password field.
func (*UserMutation) SetUsername ¶
func (m *UserMutation) SetUsername(s string)
SetUsername sets the username field.
func (*UserMutation) TokenCleared ¶
func (m *UserMutation) TokenCleared() bool
TokenCleared returns if the edge token was cleared.
func (*UserMutation) TokenIDs ¶
func (m *UserMutation) TokenIDs() (ids []int)
TokenIDs returns the token ids in the mutation.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) Username ¶
func (m *UserMutation) Username() (r string, exists bool)
Username returns the username value in the mutation.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*UserQuery) First ¶
First returns the first User entity in the query. Returns *NotFoundError when no user was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User id in the query. Returns *NotFoundError when no id was found.
func (*UserQuery) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { Username string `json:"username,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldUsername). Aggregate(ent.Count()). Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns the only User entity in the query, returns an error if not exactly one entity was returned.
func (*UserQuery) OnlyID ¶
OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.
func (*UserQuery) QueryContacts ¶
func (uq *UserQuery) QueryContacts() *ContactQuery
QueryContacts chains the current query on the contacts edge.
func (*UserQuery) QueryToken ¶
func (uq *UserQuery) QueryToken() *TokenQuery
QueryToken chains the current query on the token edge.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
Select one or more fields from the given query.
Example:
var v []struct { Username string `json:"username,omitempty"` } client.User.Query(). Select(user.FieldUsername). Scan(ctx, &v)
func (*UserQuery) WithContacts ¶
func (uq *UserQuery) WithContacts(opts ...func(*ContactQuery)) *UserQuery
WithContacts tells the query-builder to eager-loads the nodes that are connected to
the "contacts" edge. The optional arguments used to configure the query builder of the edge.
func (*UserQuery) WithToken ¶
func (uq *UserQuery) WithToken(opts ...func(*TokenQuery)) *UserQuery
WithToken tells the query-builder to eager-loads the nodes that are connected to
the "token" edge. The optional arguments used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct {
// contains filtered or unexported fields
}
UserSelect is the builder for select fields of User entities.
func (*UserSelect) Bool ¶
func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from selector. It is only allowed when selecting one field.
func (*UserSelect) BoolX ¶
func (us *UserSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*UserSelect) Bools ¶
func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*UserSelect) BoolsX ¶
func (us *UserSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserSelect) Float64 ¶
func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from selector. It is only allowed when selecting one field.
func (*UserSelect) Float64X ¶
func (us *UserSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*UserSelect) Float64s ¶
func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*UserSelect) Float64sX ¶
func (us *UserSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserSelect) Int ¶
func (us *UserSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from selector. It is only allowed when selecting one field.
func (*UserSelect) IntX ¶
func (us *UserSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*UserSelect) Ints ¶
func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*UserSelect) IntsX ¶
func (us *UserSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*UserSelect) ScanX ¶
func (us *UserSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*UserSelect) String ¶
func (us *UserSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from selector. It is only allowed when selecting one field.
func (*UserSelect) StringX ¶
func (us *UserSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) AddContactIDs ¶
func (uu *UserUpdate) AddContactIDs(ids ...int) *UserUpdate
AddContactIDs adds the contacts edge to Contact by ids.
func (*UserUpdate) AddContacts ¶
func (uu *UserUpdate) AddContacts(c ...*Contact) *UserUpdate
AddContacts adds the contacts edges to Contact.
func (*UserUpdate) AddToken ¶
func (uu *UserUpdate) AddToken(t ...*Token) *UserUpdate
AddToken adds the token edges to Token.
func (*UserUpdate) AddTokenIDs ¶
func (uu *UserUpdate) AddTokenIDs(ids ...int) *UserUpdate
AddTokenIDs adds the token edge to Token by ids.
func (*UserUpdate) ClearContacts ¶
func (uu *UserUpdate) ClearContacts() *UserUpdate
ClearContacts clears all "contacts" edges to type Contact.
func (*UserUpdate) ClearToken ¶
func (uu *UserUpdate) ClearToken() *UserUpdate
ClearToken clears all "token" edges to type Token.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Mutation ¶
func (uu *UserUpdate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdate) RemoveContactIDs ¶
func (uu *UserUpdate) RemoveContactIDs(ids ...int) *UserUpdate
RemoveContactIDs removes the contacts edge to Contact by ids.
func (*UserUpdate) RemoveContacts ¶
func (uu *UserUpdate) RemoveContacts(c ...*Contact) *UserUpdate
RemoveContacts removes contacts edges to Contact.
func (*UserUpdate) RemoveToken ¶
func (uu *UserUpdate) RemoveToken(t ...*Token) *UserUpdate
RemoveToken removes token edges to Token.
func (*UserUpdate) RemoveTokenIDs ¶
func (uu *UserUpdate) RemoveTokenIDs(ids ...int) *UserUpdate
RemoveTokenIDs removes the token edge to Token by ids.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the password field.
func (*UserUpdate) SetUsername ¶
func (uu *UserUpdate) SetUsername(s string) *UserUpdate
SetUsername sets the username field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where adds a new predicate for the builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddContactIDs ¶
func (uuo *UserUpdateOne) AddContactIDs(ids ...int) *UserUpdateOne
AddContactIDs adds the contacts edge to Contact by ids.
func (*UserUpdateOne) AddContacts ¶
func (uuo *UserUpdateOne) AddContacts(c ...*Contact) *UserUpdateOne
AddContacts adds the contacts edges to Contact.
func (*UserUpdateOne) AddToken ¶
func (uuo *UserUpdateOne) AddToken(t ...*Token) *UserUpdateOne
AddToken adds the token edges to Token.
func (*UserUpdateOne) AddTokenIDs ¶
func (uuo *UserUpdateOne) AddTokenIDs(ids ...int) *UserUpdateOne
AddTokenIDs adds the token edge to Token by ids.
func (*UserUpdateOne) ClearContacts ¶
func (uuo *UserUpdateOne) ClearContacts() *UserUpdateOne
ClearContacts clears all "contacts" edges to type Contact.
func (*UserUpdateOne) ClearToken ¶
func (uuo *UserUpdateOne) ClearToken() *UserUpdateOne
ClearToken clears all "token" edges to type Token.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) Mutation ¶
func (uuo *UserUpdateOne) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdateOne) RemoveContactIDs ¶
func (uuo *UserUpdateOne) RemoveContactIDs(ids ...int) *UserUpdateOne
RemoveContactIDs removes the contacts edge to Contact by ids.
func (*UserUpdateOne) RemoveContacts ¶
func (uuo *UserUpdateOne) RemoveContacts(c ...*Contact) *UserUpdateOne
RemoveContacts removes contacts edges to Contact.
func (*UserUpdateOne) RemoveToken ¶
func (uuo *UserUpdateOne) RemoveToken(t ...*Token) *UserUpdateOne
RemoveToken removes token edges to Token.
func (*UserUpdateOne) RemoveTokenIDs ¶
func (uuo *UserUpdateOne) RemoveTokenIDs(ids ...int) *UserUpdateOne
RemoveTokenIDs removes the token edge to Token by ids.
func (*UserUpdateOne) Save ¶
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated entity.
func (*UserUpdateOne) SaveX ¶
func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the password field.
func (*UserUpdateOne) SetUsername ¶
func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
SetUsername sets the username field.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field fails.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap implements the errors.Wrapper interface.