Versions in this module Expand all Collapse all v1 v1.5.0 Oct 24, 2022 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypePet + const TypeUser + 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 func(*sql.Selector) string + func As(fn AggregateFunc, end string) AggregateFunc + func Count() AggregateFunc + func Max(field string) AggregateFunc + func Mean(field string) AggregateFunc + func Min(field string) AggregateFunc + func Sum(field string) AggregateFunc + type Client struct + Pet *PetClient + Schema *migrate.Schema + User *UserClient + func FromContext(ctx context.Context) *Client + func NewClient(opts ...Option) *Client + func Open(driverName, dataSourceName string, options ...Option) (*Client, error) + func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (c *Client) Close() error + func (c *Client) Debug() *Client + func (c *Client) Tx(ctx context.Context) (*Tx, error) + func (c *Client) Use(hooks ...Hook) + type CommitFunc func(context.Context, *Tx) error + func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error + type CommitHook func(Committer) Committer + type Committer interface + Commit func(context.Context, *Tx) error + type ConstraintError struct + func (e *ConstraintError) Unwrap() error + func (e ConstraintError) Error() string + type Hook = ent.Hook + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...interface{})) Option + type OrderFunc func(*sql.Selector) + func Asc(fields ...string) OrderFunc + func Desc(fields ...string) OrderFunc + type Pet struct + Edges PetEdges + ID int + Name string + func (pe *Pet) QueryOwner() *UserQuery + func (pe *Pet) String() string + func (pe *Pet) Unwrap() *Pet + func (pe *Pet) Update() *PetUpdateOne + type PetClient struct + func NewPetClient(c config) *PetClient + func (c *PetClient) Create() *PetCreate + func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk + func (c *PetClient) Delete() *PetDelete + func (c *PetClient) DeleteOne(pe *Pet) *PetDeleteOne + func (c *PetClient) DeleteOneID(id int) *PetDeleteOne + func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error) + func (c *PetClient) GetX(ctx context.Context, id int) *Pet + func (c *PetClient) Hooks() []Hook + func (c *PetClient) Query() *PetQuery + func (c *PetClient) QueryOwner(pe *Pet) *UserQuery + func (c *PetClient) Update() *PetUpdate + func (c *PetClient) UpdateOne(pe *Pet) *PetUpdateOne + func (c *PetClient) UpdateOneID(id int) *PetUpdateOne + func (c *PetClient) Use(hooks ...Hook) + type PetCreate struct + func (pc *PetCreate) Mutation() *PetMutation + func (pc *PetCreate) Save(ctx context.Context) (*Pet, error) + func (pc *PetCreate) SaveX(ctx context.Context) *Pet + func (pc *PetCreate) SetName(s string) *PetCreate + func (pc *PetCreate) SetNillableOwnerID(id *int) *PetCreate + func (pc *PetCreate) SetOwner(u *User) *PetCreate + func (pc *PetCreate) SetOwnerID(id int) *PetCreate + type PetCreateBulk struct + func (pcb *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error) + func (pcb *PetCreateBulk) SaveX(ctx context.Context) []*Pet + type PetDelete struct + func (pd *PetDelete) Exec(ctx context.Context) (int, error) + func (pd *PetDelete) ExecX(ctx context.Context) int + func (pd *PetDelete) Where(ps ...predicate.Pet) *PetDelete + type PetDeleteOne struct + func (pdo *PetDeleteOne) Exec(ctx context.Context) error + func (pdo *PetDeleteOne) ExecX(ctx context.Context) + type PetEdges struct + Owner *User + func (e PetEdges) OwnerOrErr() (*User, error) + type PetGroupBy struct + func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy + func (pgb *PetGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (pgb *PetGroupBy) BoolX(ctx context.Context) bool + func (pgb *PetGroupBy) Bools(ctx context.Context) ([]bool, error) + func (pgb *PetGroupBy) BoolsX(ctx context.Context) []bool + func (pgb *PetGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (pgb *PetGroupBy) Float64X(ctx context.Context) float64 + func (pgb *PetGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (pgb *PetGroupBy) Float64sX(ctx context.Context) []float64 + func (pgb *PetGroupBy) Int(ctx context.Context) (_ int, err error) + func (pgb *PetGroupBy) IntX(ctx context.Context) int + func (pgb *PetGroupBy) Ints(ctx context.Context) ([]int, error) + func (pgb *PetGroupBy) IntsX(ctx context.Context) []int + func (pgb *PetGroupBy) Scan(ctx context.Context, v interface{}) error + func (pgb *PetGroupBy) ScanX(ctx context.Context, v interface{}) + func (pgb *PetGroupBy) String(ctx context.Context) (_ string, err error) + func (pgb *PetGroupBy) StringX(ctx context.Context) string + func (pgb *PetGroupBy) Strings(ctx context.Context) ([]string, error) + func (pgb *PetGroupBy) StringsX(ctx context.Context) []string + type PetMutation struct + func (m *PetMutation) AddField(name string, value ent.Value) error + func (m *PetMutation) AddedEdges() []string + func (m *PetMutation) AddedField(name string) (ent.Value, bool) + func (m *PetMutation) AddedFields() []string + func (m *PetMutation) AddedIDs(name string) []ent.Value + func (m *PetMutation) ClearEdge(name string) error + func (m *PetMutation) ClearField(name string) error + func (m *PetMutation) ClearOwner() + func (m *PetMutation) ClearedEdges() []string + func (m *PetMutation) ClearedFields() []string + func (m *PetMutation) EdgeCleared(name string) bool + func (m *PetMutation) Field(name string) (ent.Value, bool) + func (m *PetMutation) FieldCleared(name string) bool + func (m *PetMutation) Fields() []string + func (m *PetMutation) ID() (id int, exists bool) + func (m *PetMutation) Name() (r string, exists bool) + func (m *PetMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *PetMutation) OldName(ctx context.Context) (v string, err error) + func (m *PetMutation) Op() Op + func (m *PetMutation) OwnerCleared() bool + func (m *PetMutation) OwnerID() (id int, exists bool) + func (m *PetMutation) OwnerIDs() (ids []int) + func (m *PetMutation) RemovedEdges() []string + func (m *PetMutation) RemovedIDs(name string) []ent.Value + func (m *PetMutation) ResetEdge(name string) error + func (m *PetMutation) ResetField(name string) error + func (m *PetMutation) ResetName() + func (m *PetMutation) ResetOwner() + func (m *PetMutation) SetField(name string, value ent.Value) error + func (m *PetMutation) SetName(s string) + func (m *PetMutation) SetOwnerID(id int) + func (m *PetMutation) Type() string + func (m PetMutation) Client() *Client + func (m PetMutation) Tx() (*Tx, error) + type PetQuery struct + func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) + func (pq *PetQuery) AllX(ctx context.Context) []*Pet + func (pq *PetQuery) Clone() *PetQuery + func (pq *PetQuery) Count(ctx context.Context) (int, error) + func (pq *PetQuery) CountX(ctx context.Context) int + func (pq *PetQuery) Exist(ctx context.Context) (bool, error) + func (pq *PetQuery) ExistX(ctx context.Context) bool + func (pq *PetQuery) First(ctx context.Context) (*Pet, error) + func (pq *PetQuery) FirstID(ctx context.Context) (id int, err error) + func (pq *PetQuery) FirstX(ctx context.Context) *Pet + func (pq *PetQuery) FirstXID(ctx context.Context) int + func (pq *PetQuery) GroupBy(field string, fields ...string) *PetGroupBy + func (pq *PetQuery) IDs(ctx context.Context) ([]int, error) + func (pq *PetQuery) IDsX(ctx context.Context) []int + func (pq *PetQuery) Limit(limit int) *PetQuery + func (pq *PetQuery) Offset(offset int) *PetQuery + func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) + func (pq *PetQuery) OnlyID(ctx context.Context) (id int, err error) + func (pq *PetQuery) OnlyIDX(ctx context.Context) int + func (pq *PetQuery) OnlyX(ctx context.Context) *Pet + func (pq *PetQuery) Order(o ...OrderFunc) *PetQuery + func (pq *PetQuery) QueryOwner() *UserQuery + func (pq *PetQuery) Select(field string, fields ...string) *PetSelect + func (pq *PetQuery) Where(ps ...predicate.Pet) *PetQuery + func (pq *PetQuery) WithOwner(opts ...func(*UserQuery)) *PetQuery + type PetSelect struct + func (ps *PetSelect) Bool(ctx context.Context) (_ bool, err error) + func (ps *PetSelect) BoolX(ctx context.Context) bool + func (ps *PetSelect) Bools(ctx context.Context) ([]bool, error) + func (ps *PetSelect) BoolsX(ctx context.Context) []bool + func (ps *PetSelect) Float64(ctx context.Context) (_ float64, err error) + func (ps *PetSelect) Float64X(ctx context.Context) float64 + func (ps *PetSelect) Float64s(ctx context.Context) ([]float64, error) + func (ps *PetSelect) Float64sX(ctx context.Context) []float64 + func (ps *PetSelect) Int(ctx context.Context) (_ int, err error) + func (ps *PetSelect) IntX(ctx context.Context) int + func (ps *PetSelect) Ints(ctx context.Context) ([]int, error) + func (ps *PetSelect) IntsX(ctx context.Context) []int + func (ps *PetSelect) Scan(ctx context.Context, v interface{}) error + func (ps *PetSelect) ScanX(ctx context.Context, v interface{}) + func (ps *PetSelect) String(ctx context.Context) (_ string, err error) + func (ps *PetSelect) StringX(ctx context.Context) string + func (ps *PetSelect) Strings(ctx context.Context) ([]string, error) + func (ps *PetSelect) StringsX(ctx context.Context) []string + type PetUpdate struct + func (pu *PetUpdate) ClearOwner() *PetUpdate + func (pu *PetUpdate) Exec(ctx context.Context) error + func (pu *PetUpdate) ExecX(ctx context.Context) + func (pu *PetUpdate) Mutation() *PetMutation + func (pu *PetUpdate) Save(ctx context.Context) (int, error) + func (pu *PetUpdate) SaveX(ctx context.Context) int + func (pu *PetUpdate) SetName(s string) *PetUpdate + func (pu *PetUpdate) SetNillableOwnerID(id *int) *PetUpdate + func (pu *PetUpdate) SetOwner(u *User) *PetUpdate + func (pu *PetUpdate) SetOwnerID(id int) *PetUpdate + func (pu *PetUpdate) Where(ps ...predicate.Pet) *PetUpdate + type PetUpdateOne struct + func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne + func (puo *PetUpdateOne) Exec(ctx context.Context) error + func (puo *PetUpdateOne) ExecX(ctx context.Context) + func (puo *PetUpdateOne) Mutation() *PetMutation + func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) + func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet + func (puo *PetUpdateOne) SetName(s string) *PetUpdateOne + func (puo *PetUpdateOne) SetNillableOwnerID(id *int) *PetUpdateOne + func (puo *PetUpdateOne) SetOwner(u *User) *PetUpdateOne + func (puo *PetUpdateOne) SetOwnerID(id int) *PetUpdateOne + type Pets []*Pet + type Policy = ent.Policy + type Query = ent.Query + type RollbackFunc func(context.Context, *Tx) error + func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error + type RollbackHook func(Rollbacker) Rollbacker + type Rollbacker interface + Rollback func(context.Context, *Tx) error + type Tx struct + Pet *PetClient + User *UserClient + func TxFromContext(ctx context.Context) *Tx + func (tx *Tx) Client() *Client + func (tx *Tx) Commit() error + func (tx *Tx) OnCommit(f CommitHook) + func (tx *Tx) OnRollback(f RollbackHook) + func (tx *Tx) Rollback() error + type User struct + Age int + Edges UserEdges + ID int + Name string + func (u *User) QueryPets() *PetQuery + func (u *User) String() string + func (u *User) Unwrap() *User + func (u *User) Update() *UserUpdateOne + type UserClient struct + func NewUserClient(c config) *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) QueryPets(u *User) *PetQuery + 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 struct + func (uc *UserCreate) AddPetIDs(ids ...int) *UserCreate + func (uc *UserCreate) AddPets(p ...*Pet) *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) SetAge(i int) *UserCreate + func (uc *UserCreate) SetName(s string) *UserCreate + type UserCreateBulk struct + func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) + func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User + type UserDelete struct + func (ud *UserDelete) Exec(ctx context.Context) (int, error) + func (ud *UserDelete) ExecX(ctx context.Context) int + func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete + type UserDeleteOne struct + func (udo *UserDeleteOne) Exec(ctx context.Context) error + func (udo *UserDeleteOne) ExecX(ctx context.Context) + type UserEdges struct + Pets []*Pet + func (e UserEdges) PetsOrErr() ([]*Pet, error) + type UserGroupBy struct + 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 struct + func (m *UserMutation) AddAge(i int) + func (m *UserMutation) AddField(name string, value ent.Value) error + func (m *UserMutation) AddPetIDs(ids ...int) + func (m *UserMutation) AddedAge() (r int, exists bool) + 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) Age() (r int, exists bool) + func (m *UserMutation) ClearEdge(name string) error + func (m *UserMutation) ClearField(name string) error + func (m *UserMutation) ClearedEdges() []string + func (m *UserMutation) ClearedFields() []string + 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) Name() (r string, exists bool) + func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) + func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *UserMutation) OldName(ctx context.Context) (v string, err error) + func (m *UserMutation) Op() Op + func (m *UserMutation) PetsIDs() (ids []int) + func (m *UserMutation) RemovePetIDs(ids ...int) + func (m *UserMutation) RemovedEdges() []string + func (m *UserMutation) RemovedIDs(name string) []ent.Value + func (m *UserMutation) RemovedPetsIDs() (ids []int) + func (m *UserMutation) ResetAge() + func (m *UserMutation) ResetEdge(name string) error + func (m *UserMutation) ResetField(name string) error + func (m *UserMutation) ResetName() + func (m *UserMutation) ResetPets() + func (m *UserMutation) SetAge(i int) + func (m *UserMutation) SetField(name string, value ent.Value) error + func (m *UserMutation) SetName(s string) + func (m *UserMutation) Type() string + func (m UserMutation) Client() *Client + func (m UserMutation) Tx() (*Tx, error) + type UserQuery struct + 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) QueryPets() *PetQuery + func (uq *UserQuery) Select(field string, fields ...string) *UserSelect + func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery + func (uq *UserQuery) WithPets(opts ...func(*PetQuery)) *UserQuery + type UserSelect struct + 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 struct + func (uu *UserUpdate) AddAge(i int) *UserUpdate + func (uu *UserUpdate) AddPetIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) AddPets(p ...*Pet) *UserUpdate + func (uu *UserUpdate) Exec(ctx context.Context) error + func (uu *UserUpdate) ExecX(ctx context.Context) + func (uu *UserUpdate) Mutation() *UserMutation + func (uu *UserUpdate) RemovePetIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) RemovePets(p ...*Pet) *UserUpdate + func (uu *UserUpdate) Save(ctx context.Context) (int, error) + func (uu *UserUpdate) SaveX(ctx context.Context) int + func (uu *UserUpdate) SetAge(i int) *UserUpdate + func (uu *UserUpdate) SetName(s string) *UserUpdate + func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate + type UserUpdateOne struct + func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne + func (uuo *UserUpdateOne) AddPetIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) AddPets(p ...*Pet) *UserUpdateOne + func (uuo *UserUpdateOne) Exec(ctx context.Context) error + func (uuo *UserUpdateOne) ExecX(ctx context.Context) + func (uuo *UserUpdateOne) Mutation() *UserMutation + func (uuo *UserUpdateOne) RemovePetIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) RemovePets(p ...*Pet) *UserUpdateOne + func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) + func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User + func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne + func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne + type Users []*User + type ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value