Documentation
¶
Index ¶
- Constants
- Variables
- func Avg[E any, T ent.Number](column ent.ColumnOf[E, T]) ent.SelectionOf[float64]
- func Count() ent.SelectionOf[int]
- func CountColumn[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[int]
- func ExprSelection[T any](expression ent.Expr[T], alias string) ent.SelectionOf[T]
- func Get[T any](row *Row, selection ent.SelectionOf[T]) T
- func GetNullable[T any](row *Row, selection ent.SelectionOf[T]) (T, bool)
- 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 Max[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[T]
- func Min[E, T any](column ent.ColumnOf[E, T]) ent.SelectionOf[T]
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func Sum[E any, T ent.Number](column ent.ColumnOf[E, T]) ent.SelectionOf[T]
- func Values[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]T, error)
- func ValuesNullable[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]*T, error)
- type Client
- 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) Driver() dialect.Driver
- func (c *Client) Mutate(ctx context.Context, m Mutation) (any, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- type ClientOption
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Expr
- type Group
- type GroupClient
- func (c *GroupClient) Create() *GroupCreate
- func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk
- func (c *GroupClient) Delete() *GroupDelete
- func (c *GroupClient) DeleteOne(_m *Group) *GroupDeleteOne
- func (c *GroupClient) DeleteOneID(id int) *GroupDeleteOne
- func (c *GroupClient) Get(ctx context.Context, id int) (*Group, error)
- func (c *GroupClient) GetX(ctx context.Context, id int) *Group
- func (c *GroupClient) Insert(value GroupInsert) *GroupCreate
- func (c *GroupClient) InsertBulk(values ...GroupInsert) *GroupCreateBulk
- func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk
- func (c *GroupClient) Query() *GroupQuery
- func (c *GroupClient) QueryUsers(_m *Group) *UserQuery
- func (c *GroupClient) Update() *GroupUpdate
- func (c *GroupClient) UpdateOne(_m *Group) *GroupUpdateOne
- func (c *GroupClient) UpdateOneID(id int) *GroupUpdateOne
- type GroupCreate
- func (b *GroupCreate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupCreate
- func (b *GroupCreate) Exec(ctx context.Context) error
- func (b *GroupCreate) ExecX(ctx context.Context)
- func (b *GroupCreate) Insert() *GroupInsert
- func (b *GroupCreate) Mutation() *GroupMutation
- func (b *GroupCreate) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertOne
- func (b *GroupCreate) OnConflictConstraint(name string) *GroupUpsertOne
- func (b *GroupCreate) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertOne
- func (b *GroupCreate) Save(ctx context.Context) (*Group, error)
- func (b *GroupCreate) SaveX(ctx context.Context) *Group
- func (b *GroupCreate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupCreate
- func (b *GroupCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupCreate
- func (b *GroupCreate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupCreate
- func (b *GroupCreate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupCreate
- type GroupCreateBulk
- func (b *GroupCreateBulk) Exec(ctx context.Context) error
- func (b *GroupCreateBulk) ExecX(ctx context.Context)
- func (b *GroupCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertBulk
- func (b *GroupCreateBulk) OnConflictConstraint(name string) *GroupUpsertBulk
- func (b *GroupCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertBulk
- func (_c *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error)
- func (b *GroupCreateBulk) SaveX(ctx context.Context) []*Group
- type GroupDelete
- type GroupDeleteOne
- type GroupEdges
- func (e GroupEdges) Count[N, K any](edge ent.Relation[entity.Group, N, K]) (int, bool)
- func (e GroupEdges) Loaded[N, K any](edge ent.RelationOf[entity.Group, N, K]) bool
- func (e *GroupEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.Group, N, K], loaded bool)
- func (e GroupEdges) UsersOrErr() ([]*User, error)
- type GroupGroupBy
- type GroupInsert
- type GroupMutation
- func (m *GroupMutation) Client() *Client
- func (m *GroupMutation) ID() (id int, exists bool)
- func (m *GroupMutation) IDs(ctx context.Context) ([]int, error)
- func (m *GroupMutation) Insert() *GroupInsert
- func (m *GroupMutation) Op() ent.Op
- func (m *GroupMutation) Patch() *GroupPatch
- func (m *GroupMutation) Predicates() []ent.Predicate[entity.Group]
- func (m *GroupMutation) Tx() (*Tx, error)
- func (m *GroupMutation) Type() string
- func (m *GroupMutation) Where(predicates ...ent.Predicate[entity.Group])
- type GroupPatch
- type GroupQuery
- func (_q *GroupQuery) Aggregate(selections ...ent.Selection) *GroupSelect
- func (_q *GroupQuery) All(ctx context.Context) ([]*Group, error)
- func (_q *GroupQuery) AllX(ctx context.Context) []*Group
- func (_q *GroupQuery) Clone() *GroupQuery
- func (_q *GroupQuery) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupQuery
- func (_q *GroupQuery) Count(ctx context.Context) (int, error)
- func (_q *GroupQuery) CountX(ctx context.Context) int
- func (_q *GroupQuery) Exist(ctx context.Context) (bool, error)
- func (_q *GroupQuery) ExistX(ctx context.Context) bool
- func (_q *GroupQuery) First(ctx context.Context) (*Group, error)
- func (_q *GroupQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *GroupQuery) FirstIDX(ctx context.Context) int
- func (_q *GroupQuery) FirstX(ctx context.Context) *Group
- func (_q *GroupQuery) ForShare(opts ...sql.LockOption) *GroupQuery
- func (_q *GroupQuery) ForUpdate(opts ...sql.LockOption) *GroupQuery
- func (_q *GroupQuery) GroupBy(columns ...ent.EntityColumn[entity.Group]) *GroupGroupBy
- func (_q *GroupQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *GroupQuery) IDsX(ctx context.Context) []int
- func (_q *GroupQuery) Join(table string, on ...func(*sql.Selector)) *GroupQuery
- func (_q *GroupQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery
- func (_q *GroupQuery) LeftJoin(table string, on ...func(*sql.Selector)) *GroupQuery
- func (_q *GroupQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery
- func (_q *GroupQuery) Limit(limit int) *GroupQuery
- func (_q *GroupQuery) Modify(modifiers ...func(s *sql.Selector)) *GroupQuery
- func (_q *GroupQuery) Offset(offset int) *GroupQuery
- func (_q *GroupQuery) Only(ctx context.Context) (*Group, error)
- func (_q *GroupQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *GroupQuery) OnlyIDX(ctx context.Context) int
- func (_q *GroupQuery) OnlyX(ctx context.Context) *Group
- func (_q *GroupQuery) Order(o ...ent.OrderOption[entity.Group]) *GroupQuery
- func (_q *GroupQuery) QueryUsers() *UserQuery
- func (_q *GroupQuery) Select(selections ...ent.Selection) *GroupSelect
- func (_q *GroupQuery) Unique(unique bool) *GroupQuery
- func (_q *GroupQuery) Where(predicates ...ent.Predicate[entity.Group]) *GroupQuery
- func (_q *GroupQuery) WhereP(predicates ...func(*sql.Selector)) *GroupQuery
- func (_q *GroupQuery) WithCount[N, K any](edge ent.Relation[entity.Group, N, K], predicates ...ent.Predicate[N]) *GroupQuery
- func (_q *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery
- type GroupSelect
- func (_s *GroupSelect) Aggregate(selections ...ent.Selection) *GroupSelect
- func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect
- func (_s *GroupSelect) Row(ctx context.Context) (*ent.Row, error)
- func (_s *GroupSelect) Rows(ctx context.Context) ([]*ent.Row, error)
- func (_s *GroupSelect) Scan(ctx context.Context, value any) error
- type GroupUpdate
- func (b *GroupUpdate) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdate
- func (b *GroupUpdate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate
- func (b *GroupUpdate) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdate
- func (b *GroupUpdate) Apply(p GroupPatch) *GroupUpdate
- func (b *GroupUpdate) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdate
- func (b *GroupUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdate
- func (b *GroupUpdate) Exec(ctx context.Context) error
- func (b *GroupUpdate) ExecX(ctx context.Context)
- func (_u *GroupUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdate
- func (b *GroupUpdate) Mutation() *GroupMutation
- func (b *GroupUpdate) Patch() *GroupPatch
- func (b *GroupUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate
- func (b *GroupUpdate) Returning(ctx context.Context) ([]*Group, error)
- func (b *GroupUpdate) Save(ctx context.Context) (int, error)
- func (b *GroupUpdate) SaveX(ctx context.Context) int
- func (b *GroupUpdate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdate
- func (b *GroupUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdate
- func (b *GroupUpdate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdate
- func (b *GroupUpdate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdate
- func (b *GroupUpdate) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdate
- type GroupUpdateOne
- func (b *GroupUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdateOne
- func (b *GroupUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne
- func (b *GroupUpdateOne) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdateOne
- func (b *GroupUpdateOne) Apply(p GroupPatch) *GroupUpdateOne
- func (b *GroupUpdateOne) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdateOne
- func (b *GroupUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdateOne
- func (b *GroupUpdateOne) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupUpdateOne
- func (b *GroupUpdateOne) Exec(ctx context.Context) error
- func (b *GroupUpdateOne) ExecX(ctx context.Context)
- func (_u *GroupUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdateOne
- func (b *GroupUpdateOne) Mutation() *GroupMutation
- func (b *GroupUpdateOne) Patch() *GroupPatch
- func (b *GroupUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne
- func (b *GroupUpdateOne) Save(ctx context.Context) (*Group, error)
- func (b *GroupUpdateOne) SaveOld(ctx context.Context) (old *Group, updated *Group, err error)
- func (b *GroupUpdateOne) SaveX(ctx context.Context) *Group
- func (b *GroupUpdateOne) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdateOne
- func (b *GroupUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdateOne
- func (b *GroupUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdateOne
- func (b *GroupUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdateOne
- func (b *GroupUpdateOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdateOne
- type GroupUpsert
- func (u *GroupUpsert) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpsert
- func (u *GroupUpsert) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert
- func (u *GroupUpsert) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpsert
- func (u *GroupUpsert) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpsert
- func (u *GroupUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert
- type GroupUpsertBulk
- func (u *GroupUpsertBulk) DoNothing() *GroupUpsertBulk
- func (u *GroupUpsertBulk) DoSelect() *GroupUpsertBulk
- func (u *GroupUpsertBulk) DoUpdate(set func(*GroupUpsert)) *GroupUpsertBulk
- func (u *GroupUpsertBulk) Exec(ctx context.Context) error
- func (u *GroupUpsertBulk) ExecX(ctx context.Context)
- func (u *GroupUpsertBulk) Ignore() *GroupUpsertBulk
- func (u *GroupUpsertBulk) Save(ctx context.Context) ([]*Group, error)
- func (u *GroupUpsertBulk) UpdateNewValues() *GroupUpsertBulk
- func (u *GroupUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk
- func (u *GroupUpsertBulk) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk
- type GroupUpsertOne
- func (u *GroupUpsertOne) DoNothing() *GroupUpsertOne
- func (u *GroupUpsertOne) DoSelect() *GroupUpsertOne
- func (u *GroupUpsertOne) DoUpdate(set func(*GroupUpsert)) *GroupUpsertOne
- func (u *GroupUpsertOne) Exec(ctx context.Context) error
- func (u *GroupUpsertOne) ExecX(ctx context.Context)
- func (u *GroupUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *GroupUpsertOne) IDX(ctx context.Context) int
- func (u *GroupUpsertOne) Ignore() *GroupUpsertOne
- func (u *GroupUpsertOne) Save(ctx context.Context) (*Group, error)
- func (u *GroupUpsertOne) UpdateNewValues() *GroupUpsertOne
- func (u *GroupUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne
- func (u *GroupUpsertOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne
- type Groups
- type Mutation
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type Pet
- type PetClient
- func (c *PetClient) Create() *PetCreate
- func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk
- func (c *PetClient) Delete() *PetDelete
- func (c *PetClient) DeleteOne(_m *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) Insert(value PetInsert) *PetCreate
- func (c *PetClient) InsertBulk(values ...PetInsert) *PetCreateBulk
- func (c *PetClient) MapCreateBulk(slice any, setFunc func(*PetCreate, int)) *PetCreateBulk
- func (c *PetClient) Query() *PetQuery
- func (c *PetClient) QueryOwner(_m *Pet) *UserQuery
- func (c *PetClient) Update() *PetUpdate
- func (c *PetClient) UpdateOne(_m *Pet) *PetUpdateOne
- func (c *PetClient) UpdateOneID(id int) *PetUpdateOne
- type PetCreate
- func (b *PetCreate) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetCreate
- func (b *PetCreate) Exec(ctx context.Context) error
- func (b *PetCreate) ExecX(ctx context.Context)
- func (b *PetCreate) Insert() *PetInsert
- func (b *PetCreate) Mutation() *PetMutation
- func (b *PetCreate) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertOne
- func (b *PetCreate) OnConflictConstraint(name string) *PetUpsertOne
- func (b *PetCreate) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertOne
- func (b *PetCreate) Save(ctx context.Context) (*Pet, error)
- func (b *PetCreate) SaveX(ctx context.Context) *Pet
- func (b *PetCreate) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetCreate
- func (b *PetCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetCreate
- func (b *PetCreate) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetCreate
- func (b *PetCreate) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetCreate
- type PetCreateBulk
- func (b *PetCreateBulk) Exec(ctx context.Context) error
- func (b *PetCreateBulk) ExecX(ctx context.Context)
- func (b *PetCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertBulk
- func (b *PetCreateBulk) OnConflictConstraint(name string) *PetUpsertBulk
- func (b *PetCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertBulk
- func (_c *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error)
- func (b *PetCreateBulk) SaveX(ctx context.Context) []*Pet
- type PetDelete
- type PetDeleteOne
- type PetEdges
- type PetGroupBy
- type PetInsert
- type PetMutation
- func (m *PetMutation) Client() *Client
- func (m *PetMutation) ID() (id int, exists bool)
- func (m *PetMutation) IDs(ctx context.Context) ([]int, error)
- func (m *PetMutation) Insert() *PetInsert
- func (m *PetMutation) Op() ent.Op
- func (m *PetMutation) Patch() *PetPatch
- func (m *PetMutation) Predicates() []ent.Predicate[entity.Pet]
- func (m *PetMutation) Tx() (*Tx, error)
- func (m *PetMutation) Type() string
- func (m *PetMutation) Where(predicates ...ent.Predicate[entity.Pet])
- type PetPatch
- type PetQuery
- func (_q *PetQuery) Aggregate(selections ...ent.Selection) *PetSelect
- func (_q *PetQuery) All(ctx context.Context) ([]*Pet, error)
- func (_q *PetQuery) AllX(ctx context.Context) []*Pet
- func (_q *PetQuery) Clone() *PetQuery
- func (_q *PetQuery) Columns(columns ...ent.EntityColumn[entity.Pet]) *PetQuery
- func (_q *PetQuery) Count(ctx context.Context) (int, error)
- func (_q *PetQuery) CountX(ctx context.Context) int
- func (_q *PetQuery) Exist(ctx context.Context) (bool, error)
- func (_q *PetQuery) ExistX(ctx context.Context) bool
- func (_q *PetQuery) First(ctx context.Context) (*Pet, error)
- func (_q *PetQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *PetQuery) FirstIDX(ctx context.Context) int
- func (_q *PetQuery) FirstX(ctx context.Context) *Pet
- func (_q *PetQuery) ForShare(opts ...sql.LockOption) *PetQuery
- func (_q *PetQuery) ForUpdate(opts ...sql.LockOption) *PetQuery
- func (_q *PetQuery) GroupBy(columns ...ent.EntityColumn[entity.Pet]) *PetGroupBy
- func (_q *PetQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *PetQuery) IDsX(ctx context.Context) []int
- func (_q *PetQuery) Join(table string, on ...func(*sql.Selector)) *PetQuery
- func (_q *PetQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *PetQuery
- func (_q *PetQuery) LeftJoin(table string, on ...func(*sql.Selector)) *PetQuery
- func (_q *PetQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *PetQuery
- func (_q *PetQuery) Limit(limit int) *PetQuery
- func (_q *PetQuery) Modify(modifiers ...func(s *sql.Selector)) *PetQuery
- func (_q *PetQuery) Offset(offset int) *PetQuery
- func (_q *PetQuery) Only(ctx context.Context) (*Pet, error)
- func (_q *PetQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *PetQuery) OnlyIDX(ctx context.Context) int
- func (_q *PetQuery) OnlyX(ctx context.Context) *Pet
- func (_q *PetQuery) Order(o ...ent.OrderOption[entity.Pet]) *PetQuery
- func (_q *PetQuery) QueryOwner() *UserQuery
- func (_q *PetQuery) Select(selections ...ent.Selection) *PetSelect
- func (_q *PetQuery) Unique(unique bool) *PetQuery
- func (_q *PetQuery) Where(predicates ...ent.Predicate[entity.Pet]) *PetQuery
- func (_q *PetQuery) WhereP(predicates ...func(*sql.Selector)) *PetQuery
- func (_q *PetQuery) WithCount[N, K any](edge ent.Relation[entity.Pet, N, K], predicates ...ent.Predicate[N]) *PetQuery
- func (_q *PetQuery) WithOwner(opts ...func(*UserQuery)) *PetQuery
- type PetSelect
- func (_s *PetSelect) Aggregate(selections ...ent.Selection) *PetSelect
- func (_s *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect
- func (_s *PetSelect) Row(ctx context.Context) (*ent.Row, error)
- func (_s *PetSelect) Rows(ctx context.Context) ([]*ent.Row, error)
- func (_s *PetSelect) Scan(ctx context.Context, value any) error
- type PetUpdate
- func (b *PetUpdate) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpdate
- func (b *PetUpdate) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdate
- func (b *PetUpdate) Append[T any](column ent.ColumnOf[entity.Pet, T], values T) *PetUpdate
- func (b *PetUpdate) Apply(p PetPatch) *PetUpdate
- func (b *PetUpdate) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpdate
- func (b *PetUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.Pet, N, K]) *PetUpdate
- func (b *PetUpdate) Exec(ctx context.Context) error
- func (b *PetUpdate) ExecX(ctx context.Context)
- func (_u *PetUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdate
- func (b *PetUpdate) Mutation() *PetMutation
- func (b *PetUpdate) Patch() *PetPatch
- func (b *PetUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdate
- func (b *PetUpdate) Returning(ctx context.Context) ([]*Pet, error)
- func (b *PetUpdate) Save(ctx context.Context) (int, error)
- func (b *PetUpdate) SaveX(ctx context.Context) int
- func (b *PetUpdate) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpdate
- func (b *PetUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetUpdate
- func (b *PetUpdate) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpdate
- func (b *PetUpdate) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetUpdate
- func (b *PetUpdate) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpdate
- type PetUpdateOne
- func (b *PetUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpdateOne
- func (b *PetUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne
- func (b *PetUpdateOne) Append[T any](column ent.ColumnOf[entity.Pet, T], values T) *PetUpdateOne
- func (b *PetUpdateOne) Apply(p PetPatch) *PetUpdateOne
- func (b *PetUpdateOne) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpdateOne
- func (b *PetUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Pet, N, K]) *PetUpdateOne
- func (b *PetUpdateOne) Columns(columns ...ent.EntityColumn[entity.Pet]) *PetUpdateOne
- func (b *PetUpdateOne) Exec(ctx context.Context) error
- func (b *PetUpdateOne) ExecX(ctx context.Context)
- func (_u *PetUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdateOne
- func (b *PetUpdateOne) Mutation() *PetMutation
- func (b *PetUpdateOne) Patch() *PetPatch
- func (b *PetUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne
- func (b *PetUpdateOne) Save(ctx context.Context) (*Pet, error)
- func (b *PetUpdateOne) SaveOld(ctx context.Context) (old *Pet, updated *Pet, err error)
- func (b *PetUpdateOne) SaveX(ctx context.Context) *Pet
- func (b *PetUpdateOne) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpdateOne
- func (b *PetUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetUpdateOne
- func (b *PetUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpdateOne
- func (b *PetUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetUpdateOne
- func (b *PetUpdateOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpdateOne
- type PetUpsert
- func (u *PetUpsert) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpsert
- func (u *PetUpsert) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpsert
- func (u *PetUpsert) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpsert
- func (u *PetUpsert) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpsert
- func (u *PetUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpsert
- type PetUpsertBulk
- func (u *PetUpsertBulk) DoNothing() *PetUpsertBulk
- func (u *PetUpsertBulk) DoSelect() *PetUpsertBulk
- func (u *PetUpsertBulk) DoUpdate(set func(*PetUpsert)) *PetUpsertBulk
- func (u *PetUpsertBulk) Exec(ctx context.Context) error
- func (u *PetUpsertBulk) ExecX(ctx context.Context)
- func (u *PetUpsertBulk) Ignore() *PetUpsertBulk
- func (u *PetUpsertBulk) Save(ctx context.Context) ([]*Pet, error)
- func (u *PetUpsertBulk) UpdateNewValues() *PetUpsertBulk
- func (u *PetUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk
- func (u *PetUpsertBulk) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk
- type PetUpsertOne
- func (u *PetUpsertOne) DoNothing() *PetUpsertOne
- func (u *PetUpsertOne) DoSelect() *PetUpsertOne
- func (u *PetUpsertOne) DoUpdate(set func(*PetUpsert)) *PetUpsertOne
- func (u *PetUpsertOne) Exec(ctx context.Context) error
- func (u *PetUpsertOne) ExecX(ctx context.Context)
- func (u *PetUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *PetUpsertOne) IDX(ctx context.Context) int
- func (u *PetUpsertOne) Ignore() *PetUpsertOne
- func (u *PetUpsertOne) Save(ctx context.Context) (*Pet, error)
- func (u *PetUpsertOne) UpdateNewValues() *PetUpsertOne
- func (u *PetUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne
- func (u *PetUpsertOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne
- type Pets
- type Predicate
- type Query
- type QueryContext
- type RelationPatch
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Row
- 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(_m *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) Insert(value UserInsert) *UserCreate
- func (c *UserClient) InsertBulk(values ...UserInsert) *UserCreateBulk
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryGroups(_m *User) *GroupQuery
- func (c *UserClient) QueryPets(_m *User) *PetQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- type UserCreate
- func (b *UserCreate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserCreate
- func (b *UserCreate) Exec(ctx context.Context) error
- func (b *UserCreate) ExecX(ctx context.Context)
- func (b *UserCreate) Insert() *UserInsert
- func (b *UserCreate) Mutation() *UserMutation
- func (b *UserCreate) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertOne
- func (b *UserCreate) OnConflictConstraint(name string) *UserUpsertOne
- func (b *UserCreate) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertOne
- func (b *UserCreate) Save(ctx context.Context) (*User, error)
- func (b *UserCreate) SaveX(ctx context.Context) *User
- func (b *UserCreate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserCreate
- func (b *UserCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserCreate
- func (b *UserCreate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserCreate
- func (b *UserCreate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserCreate
- type UserCreateBulk
- func (b *UserCreateBulk) Exec(ctx context.Context) error
- func (b *UserCreateBulk) ExecX(ctx context.Context)
- func (b *UserCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertBulk
- func (b *UserCreateBulk) OnConflictConstraint(name string) *UserUpsertBulk
- func (b *UserCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertBulk
- func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error)
- func (b *UserCreateBulk) SaveX(ctx context.Context) []*User
- type UserDelete
- type UserDeleteOne
- type UserEdges
- func (e UserEdges) Count[N, K any](edge ent.Relation[entity.User, N, K]) (int, bool)
- func (e UserEdges) GroupsOrErr() ([]*Group, error)
- func (e UserEdges) Loaded[N, K any](edge ent.RelationOf[entity.User, N, K]) bool
- func (e UserEdges) PetsOrErr() ([]*Pet, error)
- func (e *UserEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.User, N, K], loaded bool)
- type UserGroupBy
- type UserInsert
- type UserMutation
- func (m *UserMutation) Client() *Client
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
- func (m *UserMutation) Insert() *UserInsert
- func (m *UserMutation) Op() ent.Op
- func (m *UserMutation) Patch() *UserPatch
- func (m *UserMutation) Predicates() []ent.Predicate[entity.User]
- func (m *UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) Where(predicates ...ent.Predicate[entity.User])
- type UserPatch
- type UserQuery
- func (_q *UserQuery) Aggregate(selections ...ent.Selection) *UserSelect
- func (_q *UserQuery) All(ctx context.Context) ([]*User, error)
- func (_q *UserQuery) AllX(ctx context.Context) []*User
- func (_q *UserQuery) Clone() *UserQuery
- func (_q *UserQuery) Columns(columns ...ent.EntityColumn[entity.User]) *UserQuery
- func (_q *UserQuery) Count(ctx context.Context) (int, error)
- func (_q *UserQuery) CountX(ctx context.Context) int
- func (_q *UserQuery) Exist(ctx context.Context) (bool, error)
- func (_q *UserQuery) ExistX(ctx context.Context) bool
- func (_q *UserQuery) First(ctx context.Context) (*User, error)
- func (_q *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (_q *UserQuery) FirstIDX(ctx context.Context) int
- func (_q *UserQuery) FirstX(ctx context.Context) *User
- func (_q *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery
- func (_q *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery
- func (_q *UserQuery) GroupBy(columns ...ent.EntityColumn[entity.User]) *UserGroupBy
- func (_q *UserQuery) IDs(ctx context.Context) (ids []int, err error)
- func (_q *UserQuery) IDsX(ctx context.Context) []int
- func (_q *UserQuery) Join(table string, on ...func(*sql.Selector)) *UserQuery
- func (_q *UserQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *UserQuery
- func (_q *UserQuery) LeftJoin(table string, on ...func(*sql.Selector)) *UserQuery
- func (_q *UserQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *UserQuery
- func (_q *UserQuery) Limit(limit int) *UserQuery
- func (_q *UserQuery) Modify(modifiers ...func(s *sql.Selector)) *UserQuery
- func (_q *UserQuery) Offset(offset int) *UserQuery
- func (_q *UserQuery) Only(ctx context.Context) (*User, error)
- func (_q *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (_q *UserQuery) OnlyIDX(ctx context.Context) int
- func (_q *UserQuery) OnlyX(ctx context.Context) *User
- func (_q *UserQuery) Order(o ...ent.OrderOption[entity.User]) *UserQuery
- func (_q *UserQuery) QueryGroups() *GroupQuery
- func (_q *UserQuery) QueryPets() *PetQuery
- func (_q *UserQuery) Select(selections ...ent.Selection) *UserSelect
- func (_q *UserQuery) Unique(unique bool) *UserQuery
- func (_q *UserQuery) Where(predicates ...ent.Predicate[entity.User]) *UserQuery
- func (_q *UserQuery) WhereP(predicates ...func(*sql.Selector)) *UserQuery
- func (_q *UserQuery) WithCount[N, K any](edge ent.Relation[entity.User, N, K], predicates ...ent.Predicate[N]) *UserQuery
- func (_q *UserQuery) WithGroups(opts ...func(*GroupQuery)) *UserQuery
- func (_q *UserQuery) WithPets(opts ...func(*PetQuery)) *UserQuery
- type UserSelect
- func (_s *UserSelect) Aggregate(selections ...ent.Selection) *UserSelect
- func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect
- func (_s *UserSelect) Row(ctx context.Context) (*ent.Row, error)
- func (_s *UserSelect) Rows(ctx context.Context) ([]*ent.Row, error)
- func (_s *UserSelect) Scan(ctx context.Context, value any) error
- type UserUpdate
- func (b *UserUpdate) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdate
- func (b *UserUpdate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate
- func (b *UserUpdate) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdate
- func (b *UserUpdate) Apply(p UserPatch) *UserUpdate
- func (b *UserUpdate) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdate
- func (b *UserUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdate
- func (b *UserUpdate) Exec(ctx context.Context) error
- func (b *UserUpdate) ExecX(ctx context.Context)
- func (_u *UserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdate
- func (b *UserUpdate) Mutation() *UserMutation
- func (b *UserUpdate) Patch() *UserPatch
- func (b *UserUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate
- func (b *UserUpdate) Returning(ctx context.Context) ([]*User, error)
- func (b *UserUpdate) Save(ctx context.Context) (int, error)
- func (b *UserUpdate) SaveX(ctx context.Context) int
- func (b *UserUpdate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdate
- func (b *UserUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdate
- func (b *UserUpdate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdate
- func (b *UserUpdate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdate
- func (b *UserUpdate) Where(predicates ...ent.Predicate[entity.User]) *UserUpdate
- type UserUpdateOne
- func (b *UserUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdateOne
- func (b *UserUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne
- func (b *UserUpdateOne) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdateOne
- func (b *UserUpdateOne) Apply(p UserPatch) *UserUpdateOne
- func (b *UserUpdateOne) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdateOne
- func (b *UserUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdateOne
- func (b *UserUpdateOne) Columns(columns ...ent.EntityColumn[entity.User]) *UserUpdateOne
- func (b *UserUpdateOne) Exec(ctx context.Context) error
- func (b *UserUpdateOne) ExecX(ctx context.Context)
- func (_u *UserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdateOne
- func (b *UserUpdateOne) Mutation() *UserMutation
- func (b *UserUpdateOne) Patch() *UserPatch
- func (b *UserUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne
- func (b *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (b *UserUpdateOne) SaveOld(ctx context.Context) (old *User, updated *User, err error)
- func (b *UserUpdateOne) SaveX(ctx context.Context) *User
- func (b *UserUpdateOne) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdateOne
- func (b *UserUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdateOne
- func (b *UserUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdateOne
- func (b *UserUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdateOne
- func (b *UserUpdateOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpdateOne
- type UserUpsert
- func (u *UserUpsert) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpsert
- func (u *UserUpsert) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert
- func (u *UserUpsert) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpsert
- func (u *UserUpsert) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpsert
- func (u *UserUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert
- type UserUpsertBulk
- func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk
- func (u *UserUpsertBulk) DoSelect() *UserUpsertBulk
- func (u *UserUpsertBulk) DoUpdate(set func(*UserUpsert)) *UserUpsertBulk
- func (u *UserUpsertBulk) Exec(ctx context.Context) error
- func (u *UserUpsertBulk) ExecX(ctx context.Context)
- func (u *UserUpsertBulk) Ignore() *UserUpsertBulk
- func (u *UserUpsertBulk) Save(ctx context.Context) ([]*User, error)
- func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk
- func (u *UserUpsertBulk) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk
- type UserUpsertOne
- func (u *UserUpsertOne) DoNothing() *UserUpsertOne
- func (u *UserUpsertOne) DoSelect() *UserUpsertOne
- func (u *UserUpsertOne) DoUpdate(set func(*UserUpsert)) *UserUpsertOne
- func (u *UserUpsertOne) Exec(ctx context.Context) error
- func (u *UserUpsertOne) ExecX(ctx context.Context)
- func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *UserUpsertOne) IDX(ctx context.Context) int
- func (u *UserUpsertOne) Ignore() *UserUpsertOne
- func (u *UserUpsertOne) Save(ctx context.Context) (*User, error)
- func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne
- func (u *UserUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertOne
- func (u *UserUpsertOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertOne
- type Users
- type ValidationError
Constants ¶
const ( OpCreate = ent.OpCreate OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne TypeGroup = "Group" TypePet = "Pet" TypeUser = "User" )
Variables ¶
var ErrConflict = ent.ErrConflict
var ErrTxStarted = errors.New("testschema: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
Functions ¶
func Count ¶
func Count() ent.SelectionOf[int]
func CountColumn ¶
func ExprSelection ¶
func GetNullable ¶
func GetNullable[T any](row *Row, selection ent.SelectionOf[T]) (T, bool)
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 validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
func Values ¶
func Values[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]T, error)
func ValuesNullable ¶
func ValuesNullable[T any](ctx context.Context, query ent.RowsQuerier, selection ent.SelectionOf[T]) ([]*T, error)
Types ¶
type Client ¶
type Client struct {
// Schema is the client for creating, migrating and dropping schema.
Schema *migrate.Schema
// Group is the client for interacting with the Group builders.
Group *GroupClient
// Pet is the client for interacting with the Pet builders.
Pet *PetClient
// 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 a Client stored inside a context, or nil if there isn't one.
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
NewClient creates a new client configured with the given options.
func Open ¶
func Open(driverName, dataSourceName string, options ...ClientOption) (*Client, error)
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. ClientOptional 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(). Group. 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(ctx 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 Group ¶
type Group struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the GroupQuery when eager-loading is set.
Edges GroupEdges `json:"edges"`
// contains filtered or unexported fields
}
Group is the model entity for the Group schema.
func (*Group) QueryUsers ¶
QueryUsers queries the "users" edge of the Group entity.
func (*Group) Unwrap ¶
Unwrap unwraps the Group entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*Group) Update ¶
func (_m *Group) Update() *GroupUpdateOne
Update returns a builder for updating this Group. Note that you need to call Group.Unwrap() before calling this method if this Group was returned from a transaction, and the transaction was committed or rolled back.
type GroupClient ¶
type GroupClient struct {
// contains filtered or unexported fields
}
GroupClient is a client for the Group schema.
func NewGroupClient ¶
func NewGroupClient(c config) *GroupClient
NewGroupClient returns a client for the Group from the given config.
func (*GroupClient) Create ¶
func (c *GroupClient) Create() *GroupCreate
Create returns a builder for creating a Group entity.
func (*GroupClient) CreateBulk ¶
func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk
CreateBulk returns a builder for creating a bulk of Group entities.
func (*GroupClient) Delete ¶
func (c *GroupClient) Delete() *GroupDelete
Delete returns a delete builder for Group.
func (*GroupClient) DeleteOne ¶
func (c *GroupClient) DeleteOne(_m *Group) *GroupDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*GroupClient) DeleteOneID ¶
func (c *GroupClient) DeleteOneID(id int) *GroupDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*GroupClient) GetX ¶
func (c *GroupClient) GetX(ctx context.Context, id int) *Group
GetX is like Get, but panics if an error occurs.
func (*GroupClient) Insert ¶
func (c *GroupClient) Insert(value GroupInsert) *GroupCreate
func (*GroupClient) InsertBulk ¶
func (c *GroupClient) InsertBulk(values ...GroupInsert) *GroupCreateBulk
func (*GroupClient) MapCreateBulk ¶
func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*GroupClient) Query ¶
func (c *GroupClient) Query() *GroupQuery
Query returns a query builder for Group.
func (*GroupClient) QueryUsers ¶
func (c *GroupClient) QueryUsers(_m *Group) *UserQuery
QueryUsers queries the users edge of a Group.
func (*GroupClient) Update ¶
func (c *GroupClient) Update() *GroupUpdate
Update returns an update builder for Group.
func (*GroupClient) UpdateOne ¶
func (c *GroupClient) UpdateOne(_m *Group) *GroupUpdateOne
UpdateOne returns an update builder for the given entity.
func (*GroupClient) UpdateOneID ¶
func (c *GroupClient) UpdateOneID(id int) *GroupUpdateOne
UpdateOneID returns an update builder for the given id.
type GroupCreate ¶
type GroupCreate struct {
// contains filtered or unexported fields
}
func (*GroupCreate) AddIDs ¶
func (b *GroupCreate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupCreate
func (*GroupCreate) ExecX ¶
func (b *GroupCreate) ExecX(ctx context.Context)
func (*GroupCreate) Insert ¶
func (b *GroupCreate) Insert() *GroupInsert
func (*GroupCreate) Mutation ¶
func (b *GroupCreate) Mutation() *GroupMutation
func (*GroupCreate) OnConflict ¶
func (b *GroupCreate) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertOne
func (*GroupCreate) OnConflictConstraint ¶
func (b *GroupCreate) OnConflictConstraint(name string) *GroupUpsertOne
func (*GroupCreate) OnConflictOptions ¶
func (b *GroupCreate) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertOne
func (*GroupCreate) Set ¶
func (b *GroupCreate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupCreate
func (*GroupCreate) SetEdge ¶
func (b *GroupCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupCreate
func (*GroupCreate) SetExpr ¶
func (b *GroupCreate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupCreate
func (*GroupCreate) SetOptional ¶
func (b *GroupCreate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupCreate
type GroupCreateBulk ¶
type GroupCreateBulk struct {
// contains filtered or unexported fields
}
func (*GroupCreateBulk) ExecX ¶
func (b *GroupCreateBulk) ExecX(ctx context.Context)
func (*GroupCreateBulk) OnConflict ¶
func (b *GroupCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Group]) *GroupUpsertBulk
func (*GroupCreateBulk) OnConflictConstraint ¶
func (b *GroupCreateBulk) OnConflictConstraint(name string) *GroupUpsertBulk
func (*GroupCreateBulk) OnConflictOptions ¶
func (b *GroupCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *GroupUpsertBulk
type GroupDelete ¶
type GroupDelete struct {
// contains filtered or unexported fields
}
GroupDelete is the builder for deleting a Group entity.
func (*GroupDelete) Exec ¶
func (_d *GroupDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*GroupDelete) ExecX ¶
func (_d *GroupDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*GroupDelete) Returning ¶
func (b *GroupDelete) Returning(ctx context.Context) ([]*Group, error)
func (*GroupDelete) Where ¶
func (_d *GroupDelete) Where(predicates ...ent.Predicate[entity.Group]) *GroupDelete
Where appends a list predicates to the GroupDelete builder.
type GroupDeleteOne ¶
type GroupDeleteOne struct {
// contains filtered or unexported fields
}
GroupDeleteOne is the builder for deleting a single Group entity.
func (*GroupDeleteOne) Exec ¶
func (_d *GroupDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*GroupDeleteOne) ExecX ¶
func (_d *GroupDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GroupDeleteOne) Where ¶
func (_d *GroupDeleteOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupDeleteOne
Where appends a list predicates to the GroupDelete builder.
type GroupEdges ¶
type GroupEdges struct {
// Users holds the value of the users edge.
Users []*User `json:"users,omitempty"`
// contains filtered or unexported fields
}
GroupEdges holds the relations/edges for other nodes in the graph.
func (GroupEdges) Loaded ¶
func (e GroupEdges) Loaded[N, K any](edge ent.RelationOf[entity.Group, N, K]) bool
func (*GroupEdges) SetLoaded ¶
func (e *GroupEdges) SetLoaded[N, K any](edge ent.RelationOf[entity.Group, N, K], loaded bool)
func (GroupEdges) UsersOrErr ¶
func (e GroupEdges) UsersOrErr() ([]*User, error)
UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading.
type GroupGroupBy ¶
type GroupGroupBy struct {
// contains filtered or unexported fields
}
GroupGroupBy is the group-by builder for Group entities.
func (*GroupGroupBy) Aggregate ¶
func (_g *GroupGroupBy) Aggregate(selections ...ent.Selection) *GroupGroupBy
type GroupInsert ¶
type GroupInsert struct {
Name string `json:"name"`
UserIDs []int `json:"user_ids,omitzero"`
// contains filtered or unexported fields
}
GroupInsert is the write representation of a Group creation.
type GroupMutation ¶
type GroupMutation struct {
// contains filtered or unexported fields
}
func (*GroupMutation) Client ¶
func (m *GroupMutation) Client() *Client
func (*GroupMutation) ID ¶
func (m *GroupMutation) ID() (id int, exists bool)
func (*GroupMutation) Insert ¶
func (m *GroupMutation) Insert() *GroupInsert
func (*GroupMutation) Op ¶
func (m *GroupMutation) Op() ent.Op
func (*GroupMutation) Patch ¶
func (m *GroupMutation) Patch() *GroupPatch
func (*GroupMutation) Predicates ¶
func (m *GroupMutation) Predicates() []ent.Predicate[entity.Group]
func (*GroupMutation) Tx ¶
func (m *GroupMutation) Tx() (*Tx, error)
func (*GroupMutation) Type ¶
func (m *GroupMutation) Type() string
type GroupPatch ¶
type GroupPatch struct {
Name ent.Option[string] `json:"name,omitzero"`
Users ent.RelationPatch[int] `json:"users,omitzero"`
// contains filtered or unexported fields
}
GroupPatch is the write representation of a Group update.
type GroupQuery ¶
type GroupQuery struct {
// contains filtered or unexported fields
}
GroupQuery is the builder for querying Group entities.
func (*GroupQuery) Aggregate ¶
func (_q *GroupQuery) Aggregate(selections ...ent.Selection) *GroupSelect
Aggregate returns a GroupSelect configured with the given aggregations.
func (*GroupQuery) All ¶
func (_q *GroupQuery) All(ctx context.Context) ([]*Group, error)
All executes the query and returns a list of Groups.
func (*GroupQuery) AllX ¶
func (_q *GroupQuery) AllX(ctx context.Context) []*Group
AllX is like All, but panics if an error occurs.
func (*GroupQuery) Clone ¶
func (_q *GroupQuery) Clone() *GroupQuery
Clone returns a duplicate of the GroupQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*GroupQuery) Columns ¶
func (_q *GroupQuery) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupQuery
Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.
func (*GroupQuery) Count ¶
func (_q *GroupQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*GroupQuery) CountX ¶
func (_q *GroupQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*GroupQuery) Exist ¶
func (_q *GroupQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*GroupQuery) ExistX ¶
func (_q *GroupQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*GroupQuery) First ¶
func (_q *GroupQuery) First(ctx context.Context) (*Group, error)
First returns the first Group entity from the query. Returns a *NotFoundError when no Group was found.
func (*GroupQuery) FirstID ¶
func (_q *GroupQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Group ID from the query. Returns a *NotFoundError when no Group ID was found.
func (*GroupQuery) FirstIDX ¶
func (_q *GroupQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*GroupQuery) FirstX ¶
func (_q *GroupQuery) FirstX(ctx context.Context) *Group
FirstX is like First, but panics if an error occurs.
func (*GroupQuery) ForShare ¶
func (_q *GroupQuery) ForShare(opts ...sql.LockOption) *GroupQuery
ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
func (*GroupQuery) ForUpdate ¶
func (_q *GroupQuery) ForUpdate(opts ...sql.LockOption) *GroupQuery
ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
func (*GroupQuery) GroupBy ¶
func (_q *GroupQuery) GroupBy(columns ...ent.EntityColumn[entity.Group]) *GroupGroupBy
GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.
Example:
var v []struct {
Name string `json:"name,omitempty"`
Count int `json:"count,omitempty"`
}
client.Group.Query().
GroupBy(group.Name).
Aggregate(testschema.Count()).
Scan(ctx, &v)
func (*GroupQuery) IDs ¶
func (_q *GroupQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Group IDs.
func (*GroupQuery) IDsX ¶
func (_q *GroupQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*GroupQuery) Join ¶
func (_q *GroupQuery) Join(table string, on ...func(*sql.Selector)) *GroupQuery
func (*GroupQuery) JoinAs ¶
func (_q *GroupQuery) JoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery
func (*GroupQuery) LeftJoin ¶
func (_q *GroupQuery) LeftJoin(table string, on ...func(*sql.Selector)) *GroupQuery
func (*GroupQuery) LeftJoinAs ¶
func (_q *GroupQuery) LeftJoinAs(table, alias string, on ...func(*sql.Selector)) *GroupQuery
func (*GroupQuery) Limit ¶
func (_q *GroupQuery) Limit(limit int) *GroupQuery
Limit the number of records to be returned by this query.
func (*GroupQuery) Modify ¶
func (_q *GroupQuery) Modify(modifiers ...func(s *sql.Selector)) *GroupQuery
Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.
func (*GroupQuery) Offset ¶
func (_q *GroupQuery) Offset(offset int) *GroupQuery
Offset to start from.
func (*GroupQuery) Only ¶
func (_q *GroupQuery) Only(ctx context.Context) (*Group, error)
Only returns a single Group entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Group entity is found. Returns a *NotFoundError when no Group entities are found.
func (*GroupQuery) OnlyID ¶
func (_q *GroupQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Group ID in the query. Returns a *NotSingularError when more than one Group ID is found. Returns a *NotFoundError when no entities are found.
func (*GroupQuery) OnlyIDX ¶
func (_q *GroupQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*GroupQuery) OnlyX ¶
func (_q *GroupQuery) OnlyX(ctx context.Context) *Group
OnlyX is like Only, but panics if an error occurs.
func (*GroupQuery) Order ¶
func (_q *GroupQuery) Order(o ...ent.OrderOption[entity.Group]) *GroupQuery
Order specifies how the records should be ordered.
func (*GroupQuery) QueryUsers ¶
func (_q *GroupQuery) QueryUsers() *UserQuery
QueryUsers chains the current query on the "users" edge.
func (*GroupQuery) Select ¶
func (_q *GroupQuery) Select(selections ...ent.Selection) *GroupSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.Group.Query().
Select(group.Name).
Scan(ctx, &v)
func (*GroupQuery) Unique ¶
func (_q *GroupQuery) Unique(unique bool) *GroupQuery
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*GroupQuery) Where ¶
func (_q *GroupQuery) Where(predicates ...ent.Predicate[entity.Group]) *GroupQuery
Where adds a new predicate for the GroupQuery builder.
func (*GroupQuery) WhereP ¶
func (_q *GroupQuery) WhereP(predicates ...func(*sql.Selector)) *GroupQuery
func (*GroupQuery) WithCount ¶
func (_q *GroupQuery) WithCount[N, K any](edge ent.Relation[entity.Group, N, K], predicates ...ent.Predicate[N]) *GroupQuery
WithCount loads the number of neighbors of a non-unique edge into each returned Group, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.
func (*GroupQuery) WithUsers ¶
func (_q *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery
WithUsers tells the query-builder to eager-load the nodes that are connected to the "users" edge. The optional arguments are used to configure the query builder of the edge.
type GroupSelect ¶
type GroupSelect struct {
// contains filtered or unexported fields
}
GroupSelect is the builder for selecting fields of Group entities.
func (*GroupSelect) Aggregate ¶
func (_s *GroupSelect) Aggregate(selections ...ent.Selection) *GroupSelect
func (*GroupSelect) Modify ¶
func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect
Modify adds a query modifier for attaching custom logic to queries.
type GroupUpdate ¶
type GroupUpdate struct {
// contains filtered or unexported fields
}
func (*GroupUpdate) Add ¶
func (b *GroupUpdate) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdate
func (*GroupUpdate) AddIDs ¶
func (b *GroupUpdate) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate
func (*GroupUpdate) Append ¶
func (b *GroupUpdate) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdate
func (*GroupUpdate) Apply ¶
func (b *GroupUpdate) Apply(p GroupPatch) *GroupUpdate
func (*GroupUpdate) Clear ¶
func (b *GroupUpdate) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdate
func (*GroupUpdate) ClearEdge ¶
func (b *GroupUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdate
func (*GroupUpdate) ExecX ¶
func (b *GroupUpdate) ExecX(ctx context.Context)
func (*GroupUpdate) Modify ¶
func (_u *GroupUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*GroupUpdate) Mutation ¶
func (b *GroupUpdate) Mutation() *GroupMutation
func (*GroupUpdate) Patch ¶
func (b *GroupUpdate) Patch() *GroupPatch
func (*GroupUpdate) RemoveIDs ¶
func (b *GroupUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdate
func (*GroupUpdate) Returning ¶
func (b *GroupUpdate) Returning(ctx context.Context) ([]*Group, error)
func (*GroupUpdate) Set ¶
func (b *GroupUpdate) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdate
func (*GroupUpdate) SetEdge ¶
func (b *GroupUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdate
func (*GroupUpdate) SetExpr ¶
func (b *GroupUpdate) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdate
func (*GroupUpdate) SetOptional ¶
func (b *GroupUpdate) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdate
func (*GroupUpdate) Where ¶
func (b *GroupUpdate) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdate
type GroupUpdateOne ¶
type GroupUpdateOne struct {
// contains filtered or unexported fields
}
func (*GroupUpdateOne) Add ¶
func (b *GroupUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpdateOne
func (*GroupUpdateOne) AddIDs ¶
func (b *GroupUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne
func (*GroupUpdateOne) Append ¶
func (b *GroupUpdateOne) Append[T any](column ent.ColumnOf[entity.Group, T], values T) *GroupUpdateOne
func (*GroupUpdateOne) Apply ¶
func (b *GroupUpdateOne) Apply(p GroupPatch) *GroupUpdateOne
func (*GroupUpdateOne) Clear ¶
func (b *GroupUpdateOne) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpdateOne
func (*GroupUpdateOne) ClearEdge ¶
func (b *GroupUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Group, N, K]) *GroupUpdateOne
func (*GroupUpdateOne) Columns ¶
func (b *GroupUpdateOne) Columns(columns ...ent.EntityColumn[entity.Group]) *GroupUpdateOne
Columns narrows the entity columns returned by the update. The ID is always included.
func (*GroupUpdateOne) ExecX ¶
func (b *GroupUpdateOne) ExecX(ctx context.Context)
func (*GroupUpdateOne) Modify ¶
func (_u *GroupUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *GroupUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*GroupUpdateOne) Mutation ¶
func (b *GroupUpdateOne) Mutation() *GroupMutation
func (*GroupUpdateOne) Patch ¶
func (b *GroupUpdateOne) Patch() *GroupPatch
func (*GroupUpdateOne) RemoveIDs ¶
func (b *GroupUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Group, N, K], ids ...K) *GroupUpdateOne
func (*GroupUpdateOne) Set ¶
func (b *GroupUpdateOne) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpdateOne
func (*GroupUpdateOne) SetEdge ¶
func (b *GroupUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Group, N, K], id K) *GroupUpdateOne
func (*GroupUpdateOne) SetExpr ¶
func (b *GroupUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpdateOne
func (*GroupUpdateOne) SetOptional ¶
func (b *GroupUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Group, T], value ent.Option[T]) *GroupUpdateOne
func (*GroupUpdateOne) Where ¶
func (b *GroupUpdateOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpdateOne
type GroupUpsert ¶
func (*GroupUpsert) Add ¶
func (u *GroupUpsert) Add[T ent.Number](column ent.ColumnOf[entity.Group, T], delta T) *GroupUpsert
func (*GroupUpsert) Clear ¶
func (u *GroupUpsert) Clear[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert
func (*GroupUpsert) Set ¶
func (u *GroupUpsert) Set[T any](column ent.ColumnOf[entity.Group, T], value T) *GroupUpsert
func (*GroupUpsert) SetExpr ¶
func (u *GroupUpsert) SetExpr[T any](column ent.ColumnOf[entity.Group, T], value ent.Expr[T]) *GroupUpsert
func (*GroupUpsert) UpdateNewValue ¶
func (u *GroupUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.Group, T]) *GroupUpsert
type GroupUpsertBulk ¶
type GroupUpsertBulk struct {
// contains filtered or unexported fields
}
func (*GroupUpsertBulk) DoNothing ¶
func (u *GroupUpsertBulk) DoNothing() *GroupUpsertBulk
func (*GroupUpsertBulk) DoSelect ¶
func (u *GroupUpsertBulk) DoSelect() *GroupUpsertBulk
func (*GroupUpsertBulk) DoUpdate ¶
func (u *GroupUpsertBulk) DoUpdate(set func(*GroupUpsert)) *GroupUpsertBulk
func (*GroupUpsertBulk) ExecX ¶
func (u *GroupUpsertBulk) ExecX(ctx context.Context)
func (*GroupUpsertBulk) Ignore ¶
func (u *GroupUpsertBulk) Ignore() *GroupUpsertBulk
func (*GroupUpsertBulk) Save ¶
func (u *GroupUpsertBulk) Save(ctx context.Context) ([]*Group, error)
func (*GroupUpsertBulk) UpdateNewValues ¶
func (u *GroupUpsertBulk) UpdateNewValues() *GroupUpsertBulk
func (*GroupUpsertBulk) UpdateWhere ¶
func (u *GroupUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk
func (*GroupUpsertBulk) Where ¶
func (u *GroupUpsertBulk) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertBulk
type GroupUpsertOne ¶
type GroupUpsertOne struct {
// contains filtered or unexported fields
}
func (*GroupUpsertOne) DoNothing ¶
func (u *GroupUpsertOne) DoNothing() *GroupUpsertOne
func (*GroupUpsertOne) DoSelect ¶
func (u *GroupUpsertOne) DoSelect() *GroupUpsertOne
func (*GroupUpsertOne) DoUpdate ¶
func (u *GroupUpsertOne) DoUpdate(set func(*GroupUpsert)) *GroupUpsertOne
func (*GroupUpsertOne) ExecX ¶
func (u *GroupUpsertOne) ExecX(ctx context.Context)
func (*GroupUpsertOne) Ignore ¶
func (u *GroupUpsertOne) Ignore() *GroupUpsertOne
func (*GroupUpsertOne) UpdateNewValues ¶
func (u *GroupUpsertOne) UpdateNewValues() *GroupUpsertOne
func (*GroupUpsertOne) UpdateWhere ¶
func (u *GroupUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne
func (*GroupUpsertOne) Where ¶
func (u *GroupUpsertOne) Where(predicates ...ent.Predicate[entity.Group]) *GroupUpsertOne
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 Pet ¶
type Pet struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PetQuery when eager-loading is set.
Edges PetEdges `json:"edges"`
// contains filtered or unexported fields
}
Pet is the model entity for the Pet schema.
func (*Pet) QueryOwner ¶
QueryOwner queries the "owner" edge of the Pet entity.
func (*Pet) Unwrap ¶
Unwrap unwraps the Pet entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*Pet) Update ¶
func (_m *Pet) Update() *PetUpdateOne
Update returns a builder for updating this Pet. Note that you need to call Pet.Unwrap() before calling this method if this Pet was returned from a transaction, and the transaction was committed or rolled back.
type PetClient ¶
type PetClient struct {
// contains filtered or unexported fields
}
PetClient is a client for the Pet schema.
func NewPetClient ¶
func NewPetClient(c config) *PetClient
NewPetClient returns a client for the Pet from the given config.
func (*PetClient) CreateBulk ¶
func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk
CreateBulk returns a builder for creating a bulk of Pet entities.
func (*PetClient) DeleteOne ¶
func (c *PetClient) DeleteOne(_m *Pet) *PetDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*PetClient) DeleteOneID ¶
func (c *PetClient) DeleteOneID(id int) *PetDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*PetClient) InsertBulk ¶
func (c *PetClient) InsertBulk(values ...PetInsert) *PetCreateBulk
func (*PetClient) MapCreateBulk ¶
func (c *PetClient) MapCreateBulk(slice any, setFunc func(*PetCreate, int)) *PetCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*PetClient) QueryOwner ¶
QueryOwner queries the owner edge of a Pet.
func (*PetClient) UpdateOne ¶
func (c *PetClient) UpdateOne(_m *Pet) *PetUpdateOne
UpdateOne returns an update builder for the given entity.
func (*PetClient) UpdateOneID ¶
func (c *PetClient) UpdateOneID(id int) *PetUpdateOne
UpdateOneID returns an update builder for the given id.
type PetCreate ¶
type PetCreate struct {
// contains filtered or unexported fields
}
func (*PetCreate) Mutation ¶
func (b *PetCreate) Mutation() *PetMutation
func (*PetCreate) OnConflict ¶
func (b *PetCreate) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertOne
func (*PetCreate) OnConflictConstraint ¶
func (b *PetCreate) OnConflictConstraint(name string) *PetUpsertOne
func (*PetCreate) OnConflictOptions ¶
func (b *PetCreate) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertOne
type PetCreateBulk ¶
type PetCreateBulk struct {
// contains filtered or unexported fields
}
func (*PetCreateBulk) ExecX ¶
func (b *PetCreateBulk) ExecX(ctx context.Context)
func (*PetCreateBulk) OnConflict ¶
func (b *PetCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.Pet]) *PetUpsertBulk
func (*PetCreateBulk) OnConflictConstraint ¶
func (b *PetCreateBulk) OnConflictConstraint(name string) *PetUpsertBulk
func (*PetCreateBulk) OnConflictOptions ¶
func (b *PetCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *PetUpsertBulk
type PetDelete ¶
type PetDelete struct {
// contains filtered or unexported fields
}
PetDelete is the builder for deleting a Pet entity.
func (*PetDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type PetDeleteOne ¶
type PetDeleteOne struct {
// contains filtered or unexported fields
}
PetDeleteOne is the builder for deleting a single Pet entity.
func (*PetDeleteOne) Exec ¶
func (_d *PetDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*PetDeleteOne) ExecX ¶
func (_d *PetDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*PetDeleteOne) Where ¶
func (_d *PetDeleteOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetDeleteOne
Where appends a list predicates to the PetDelete builder.
type PetEdges ¶
type PetEdges struct {
// Owner holds the value of the owner edge.
Owner *User `json:"owner,omitempty"`
// contains filtered or unexported fields
}
PetEdges holds the relations/edges for other nodes in the graph.
func (PetEdges) OwnerOrErr ¶
OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type PetGroupBy ¶
type PetGroupBy struct {
// contains filtered or unexported fields
}
PetGroupBy is the group-by builder for Pet entities.
func (*PetGroupBy) Aggregate ¶
func (_g *PetGroupBy) Aggregate(selections ...ent.Selection) *PetGroupBy
type PetInsert ¶
type PetInsert struct {
Name string `json:"name"`
OwnerID ent.Option[int] `json:"owner_id,omitzero"`
// contains filtered or unexported fields
}
PetInsert is the write representation of a Pet creation.
type PetMutation ¶
type PetMutation struct {
// contains filtered or unexported fields
}
func (*PetMutation) Client ¶
func (m *PetMutation) Client() *Client
func (*PetMutation) ID ¶
func (m *PetMutation) ID() (id int, exists bool)
func (*PetMutation) Insert ¶
func (m *PetMutation) Insert() *PetInsert
func (*PetMutation) Op ¶
func (m *PetMutation) Op() ent.Op
func (*PetMutation) Patch ¶
func (m *PetMutation) Patch() *PetPatch
func (*PetMutation) Predicates ¶
func (m *PetMutation) Predicates() []ent.Predicate[entity.Pet]
func (*PetMutation) Tx ¶
func (m *PetMutation) Tx() (*Tx, error)
func (*PetMutation) Type ¶
func (m *PetMutation) Type() string
type PetPatch ¶
type PetPatch struct {
Name ent.Option[string] `json:"name,omitzero"`
OwnerID ent.Option[int] `json:"owner_id,omitzero"`
// contains filtered or unexported fields
}
PetPatch is the write representation of a Pet update.
type PetQuery ¶
type PetQuery struct {
// contains filtered or unexported fields
}
PetQuery is the builder for querying Pet entities.
func (*PetQuery) Clone ¶
Clone returns a duplicate of the PetQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*PetQuery) Columns ¶
Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.
func (*PetQuery) First ¶
First returns the first Pet entity from the query. Returns a *NotFoundError when no Pet was found.
func (*PetQuery) FirstID ¶
FirstID returns the first Pet ID from the query. Returns a *NotFoundError when no Pet ID was found.
func (*PetQuery) ForShare ¶
func (_q *PetQuery) ForShare(opts ...sql.LockOption) *PetQuery
ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
func (*PetQuery) ForUpdate ¶
func (_q *PetQuery) ForUpdate(opts ...sql.LockOption) *PetQuery
ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
func (*PetQuery) GroupBy ¶
func (_q *PetQuery) GroupBy(columns ...ent.EntityColumn[entity.Pet]) *PetGroupBy
GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.
Example:
var v []struct {
Name string `json:"name,omitempty"`
Count int `json:"count,omitempty"`
}
client.Pet.Query().
GroupBy(pet.Name).
Aggregate(testschema.Count()).
Scan(ctx, &v)
func (*PetQuery) LeftJoinAs ¶
func (*PetQuery) Modify ¶
Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.
func (*PetQuery) Only ¶
Only returns a single Pet entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Pet entity is found. Returns a *NotFoundError when no Pet entities are found.
func (*PetQuery) OnlyID ¶
OnlyID is like Only, but returns the only Pet ID in the query. Returns a *NotSingularError when more than one Pet ID is found. Returns a *NotFoundError when no entities are found.
func (*PetQuery) QueryOwner ¶
QueryOwner chains the current query on the "owner" edge.
func (*PetQuery) Select ¶
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.Pet.Query().
Select(pet.Name).
Scan(ctx, &v)
func (*PetQuery) Unique ¶
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*PetQuery) WithCount ¶
func (_q *PetQuery) WithCount[N, K any](edge ent.Relation[entity.Pet, N, K], predicates ...ent.Predicate[N]) *PetQuery
WithCount loads the number of neighbors of a non-unique edge into each returned Pet, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.
type PetSelect ¶
type PetSelect struct {
// contains filtered or unexported fields
}
PetSelect is the builder for selecting fields of Pet entities.
type PetUpdate ¶
type PetUpdate struct {
// contains filtered or unexported fields
}
func (*PetUpdate) Modify ¶
func (_u *PetUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*PetUpdate) Mutation ¶
func (b *PetUpdate) Mutation() *PetMutation
func (*PetUpdate) SetOptional ¶
type PetUpdateOne ¶
type PetUpdateOne struct {
// contains filtered or unexported fields
}
func (*PetUpdateOne) Add ¶
func (b *PetUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.Pet, T], delta T) *PetUpdateOne
func (*PetUpdateOne) AddIDs ¶
func (b *PetUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne
func (*PetUpdateOne) Append ¶
func (b *PetUpdateOne) Append[T any](column ent.ColumnOf[entity.Pet, T], values T) *PetUpdateOne
func (*PetUpdateOne) Apply ¶
func (b *PetUpdateOne) Apply(p PetPatch) *PetUpdateOne
func (*PetUpdateOne) Clear ¶
func (b *PetUpdateOne) Clear[T any](column ent.ColumnOf[entity.Pet, T]) *PetUpdateOne
func (*PetUpdateOne) ClearEdge ¶
func (b *PetUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.Pet, N, K]) *PetUpdateOne
func (*PetUpdateOne) Columns ¶
func (b *PetUpdateOne) Columns(columns ...ent.EntityColumn[entity.Pet]) *PetUpdateOne
Columns narrows the entity columns returned by the update. The ID is always included.
func (*PetUpdateOne) ExecX ¶
func (b *PetUpdateOne) ExecX(ctx context.Context)
func (*PetUpdateOne) Modify ¶
func (_u *PetUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PetUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*PetUpdateOne) Mutation ¶
func (b *PetUpdateOne) Mutation() *PetMutation
func (*PetUpdateOne) Patch ¶
func (b *PetUpdateOne) Patch() *PetPatch
func (*PetUpdateOne) RemoveIDs ¶
func (b *PetUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.Pet, N, K], ids ...K) *PetUpdateOne
func (*PetUpdateOne) Set ¶
func (b *PetUpdateOne) Set[T any](column ent.ColumnOf[entity.Pet, T], value T) *PetUpdateOne
func (*PetUpdateOne) SetEdge ¶
func (b *PetUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.Pet, N, K], id K) *PetUpdateOne
func (*PetUpdateOne) SetExpr ¶
func (b *PetUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.Pet, T], value ent.Expr[T]) *PetUpdateOne
func (*PetUpdateOne) SetOptional ¶
func (b *PetUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.Pet, T], value ent.Option[T]) *PetUpdateOne
func (*PetUpdateOne) Where ¶
func (b *PetUpdateOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpdateOne
type PetUpsert ¶
type PetUpsertBulk ¶
type PetUpsertBulk struct {
// contains filtered or unexported fields
}
func (*PetUpsertBulk) DoNothing ¶
func (u *PetUpsertBulk) DoNothing() *PetUpsertBulk
func (*PetUpsertBulk) DoSelect ¶
func (u *PetUpsertBulk) DoSelect() *PetUpsertBulk
func (*PetUpsertBulk) DoUpdate ¶
func (u *PetUpsertBulk) DoUpdate(set func(*PetUpsert)) *PetUpsertBulk
func (*PetUpsertBulk) ExecX ¶
func (u *PetUpsertBulk) ExecX(ctx context.Context)
func (*PetUpsertBulk) Ignore ¶
func (u *PetUpsertBulk) Ignore() *PetUpsertBulk
func (*PetUpsertBulk) UpdateNewValues ¶
func (u *PetUpsertBulk) UpdateNewValues() *PetUpsertBulk
func (*PetUpsertBulk) UpdateWhere ¶
func (u *PetUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk
func (*PetUpsertBulk) Where ¶
func (u *PetUpsertBulk) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertBulk
type PetUpsertOne ¶
type PetUpsertOne struct {
// contains filtered or unexported fields
}
func (*PetUpsertOne) DoNothing ¶
func (u *PetUpsertOne) DoNothing() *PetUpsertOne
func (*PetUpsertOne) DoSelect ¶
func (u *PetUpsertOne) DoSelect() *PetUpsertOne
func (*PetUpsertOne) DoUpdate ¶
func (u *PetUpsertOne) DoUpdate(set func(*PetUpsert)) *PetUpsertOne
func (*PetUpsertOne) ExecX ¶
func (u *PetUpsertOne) ExecX(ctx context.Context)
func (*PetUpsertOne) Ignore ¶
func (u *PetUpsertOne) Ignore() *PetUpsertOne
func (*PetUpsertOne) UpdateNewValues ¶
func (u *PetUpsertOne) UpdateNewValues() *PetUpsertOne
func (*PetUpsertOne) UpdateWhere ¶
func (u *PetUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne
func (*PetUpsertOne) Where ¶
func (u *PetUpsertOne) Where(predicates ...ent.Predicate[entity.Pet]) *PetUpsertOne
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
type RelationPatch ¶
type RelationPatch[K comparable] = ent.RelationPatch[K]
ent aliases to avoid import conflicts in user's code.
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(ctx 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 Rollback method.
type Tx ¶
type Tx struct {
// Group is the client for interacting with the Group builders.
Group *GroupClient
// Pet is the client for interacting with the Pet builders.
Pet *PetClient
// 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 a Tx stored inside 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"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Email holds the value of the "email" field.
Email string `json:"email,omitempty"`
// Age holds the value of the "age" field.
Age int `json:"age,omitempty"`
// Nickname holds the value of the "nickname" field.
Nickname *string `json:"nickname,omitempty"`
// Role holds the value of the "role" field.
Role user.RoleValue `json:"role,omitempty"`
// Tags holds the value of the "tags" field.
Tags []string `json:"tags,omitempty"`
// Profile holds the value of the "profile" field.
Profile schema2.Profile `json:"profile,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time2.Time `json:"created_at,omitempty"`
// Avatar holds the value of the "avatar" field.
Avatar []byte `json:"avatar,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) QueryGroups ¶
func (_m *User) QueryGroups() *GroupQuery
QueryGroups queries the "groups" edge of the User entity.
func (*User) Unwrap ¶
Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (_m *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 builder for creating a User entity.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
CreateBulk 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(_m *User) *UserDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a builder for deleting the given entity by its 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) Insert ¶
func (c *UserClient) Insert(value UserInsert) *UserCreate
func (*UserClient) InsertBulk ¶
func (c *UserClient) InsertBulk(values ...UserInsert) *UserCreateBulk
func (*UserClient) MapCreateBulk ¶
func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryGroups ¶
func (c *UserClient) QueryGroups(_m *User) *GroupQuery
QueryGroups queries the groups edge of a User.
func (*UserClient) QueryPets ¶
func (c *UserClient) QueryPets(_m *User) *PetQuery
QueryPets queries the pets 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(_m *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.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
func (*UserCreate) AddIDs ¶
func (b *UserCreate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserCreate
func (*UserCreate) ExecX ¶
func (b *UserCreate) ExecX(ctx context.Context)
func (*UserCreate) Insert ¶
func (b *UserCreate) Insert() *UserInsert
func (*UserCreate) Mutation ¶
func (b *UserCreate) Mutation() *UserMutation
func (*UserCreate) OnConflict ¶
func (b *UserCreate) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertOne
func (*UserCreate) OnConflictConstraint ¶
func (b *UserCreate) OnConflictConstraint(name string) *UserUpsertOne
func (*UserCreate) OnConflictOptions ¶
func (b *UserCreate) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertOne
func (*UserCreate) Set ¶
func (b *UserCreate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserCreate
func (*UserCreate) SetEdge ¶
func (b *UserCreate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserCreate
func (*UserCreate) SetExpr ¶
func (b *UserCreate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserCreate
func (*UserCreate) SetOptional ¶
func (b *UserCreate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserCreate
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
func (*UserCreateBulk) ExecX ¶
func (b *UserCreateBulk) ExecX(ctx context.Context)
func (*UserCreateBulk) OnConflict ¶
func (b *UserCreateBulk) OnConflict(columns ...ent.EntityColumn[entity.User]) *UserUpsertBulk
func (*UserCreateBulk) OnConflictConstraint ¶
func (b *UserCreateBulk) OnConflictConstraint(name string) *UserUpsertBulk
func (*UserCreateBulk) OnConflictOptions ¶
func (b *UserCreateBulk) OnConflictOptions(options ...sql.ConflictOption) *UserUpsertBulk
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (_d *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (_d *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (_d *UserDelete) Where(predicates ...ent.Predicate[entity.User]) *UserDelete
Where appends a list predicates to the UserDelete 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 (_d *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (_d *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserDeleteOne) Where ¶
func (_d *UserDeleteOne) Where(predicates ...ent.Predicate[entity.User]) *UserDeleteOne
Where appends a list predicates to the UserDelete builder.
type UserEdges ¶
type UserEdges struct {
// Pets holds the value of the pets edge.
Pets []*Pet `json:"pets,omitempty"`
// Groups holds the value of the groups edge.
Groups []*Group `json:"groups,omitempty"`
// contains filtered or unexported fields
}
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) GroupsOrErr ¶
GroupsOrErr returns the Groups 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 group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (_g *UserGroupBy) Aggregate(selections ...ent.Selection) *UserGroupBy
type UserInsert ¶
type UserInsert struct {
Name string `json:"name"`
Email string `json:"email"`
Age int `json:"age"`
Nickname ent.Option[string] `json:"nickname,omitzero"`
Role user.RoleValue `json:"role"`
Tags []string `json:"tags"`
Profile schema2.Profile `json:"profile"`
CreatedAt ent.Option[time2.Time] `json:"created_at,omitzero"`
Avatar ent.Option[[]byte] `json:"avatar,omitzero"`
PetIDs []int `json:"pet_ids,omitzero"`
GroupIDs []int `json:"group_ids,omitzero"`
// contains filtered or unexported fields
}
UserInsert is the write representation of a User creation.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
func (*UserMutation) Client ¶
func (m *UserMutation) Client() *Client
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
func (*UserMutation) Insert ¶
func (m *UserMutation) Insert() *UserInsert
func (*UserMutation) Op ¶
func (m *UserMutation) Op() ent.Op
func (*UserMutation) Patch ¶
func (m *UserMutation) Patch() *UserPatch
func (*UserMutation) Predicates ¶
func (m *UserMutation) Predicates() []ent.Predicate[entity.User]
func (*UserMutation) Tx ¶
func (m *UserMutation) Tx() (*Tx, error)
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
type UserPatch ¶
type UserPatch struct {
Name ent.Option[string] `json:"name,omitzero"`
Email ent.Option[string] `json:"email,omitzero"`
Age ent.Option[int] `json:"age,omitzero"`
AgeAdd ent.Option[int] `json:"age_add,omitzero"`
Nickname ent.Option[string] `json:"nickname,omitzero"`
Role ent.Option[user.RoleValue] `json:"role,omitzero"`
Tags ent.Option[[]string] `json:"tags,omitzero"`
Profile ent.Option[schema2.Profile] `json:"profile,omitzero"`
CreatedAt ent.Option[time2.Time] `json:"created_at,omitzero"`
Avatar ent.Option[[]byte] `json:"avatar,omitzero"`
Pets ent.RelationPatch[int] `json:"pets,omitzero"`
Groups ent.RelationPatch[int] `json:"groups,omitzero"`
// contains filtered or unexported fields
}
UserPatch is the write representation of a User update.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Aggregate ¶
func (_q *UserQuery) Aggregate(selections ...ent.Selection) *UserSelect
Aggregate returns a UserSelect configured with the given aggregations.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the UserQuery 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) Columns ¶
Columns narrows the entity columns loaded by this query, including when it is used as an eager-loading query. The ID and any columns required to bind loaded edges are always included.
func (*UserQuery) First ¶
First returns the first User entity from the query. Returns a *NotFoundError when no User was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
func (*UserQuery) ForShare ¶
func (_q *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery
ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.
func (*UserQuery) ForUpdate ¶
func (_q *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery
ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.
func (*UserQuery) GroupBy ¶
func (_q *UserQuery) GroupBy(columns ...ent.EntityColumn[entity.User]) *UserGroupBy
GroupBy is used to group vertices by one or more fields/columns. It can be combined with typed aggregate selections.
Example:
var v []struct {
Name string `json:"name,omitempty"`
Count int `json:"count,omitempty"`
}
client.User.Query().
GroupBy(user.Name).
Aggregate(testschema.Count()).
Scan(ctx, &v)
func (*UserQuery) LeftJoinAs ¶
func (*UserQuery) Modify ¶
Modify adds a query modifier for attaching custom logic to queries. It can be chained with the entity terminals (All, Count, ...) or with Select(...) for projections.
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.
func (*UserQuery) OnlyID ¶
OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) QueryGroups ¶
func (_q *UserQuery) QueryGroups() *GroupQuery
QueryGroups chains the current query on the "groups" edge.
func (*UserQuery) Select ¶
func (_q *UserQuery) Select(selections ...ent.Selection) *UserSelect
Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.
Example:
var v []struct {
Name string `json:"name,omitempty"`
}
client.User.Query().
Select(user.Name).
Scan(ctx, &v)
func (*UserQuery) Unique ¶
Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.
func (*UserQuery) WithCount ¶
func (_q *UserQuery) WithCount[N, K any](edge ent.Relation[entity.User, N, K], predicates ...ent.Predicate[N]) *UserQuery
WithCount loads the number of neighbors of a non-unique edge into each returned User, readable with Edges.Count. Only neighbors matching all predicates are counted, and a parent with no matching neighbor reports a present count of zero. At most one count is kept per edge: a later call for the same edge is ignored.
func (*UserQuery) WithGroups ¶
func (_q *UserQuery) WithGroups(opts ...func(*GroupQuery)) *UserQuery
WithGroups tells the query-builder to eager-load the nodes that are connected to the "groups" edge. The optional arguments are used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct {
// contains filtered or unexported fields
}
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Aggregate ¶
func (_s *UserSelect) Aggregate(selections ...ent.Selection) *UserSelect
func (*UserSelect) Modify ¶
func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect
Modify adds a query modifier for attaching custom logic to queries.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
func (*UserUpdate) Add ¶
func (b *UserUpdate) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdate
func (*UserUpdate) AddIDs ¶
func (b *UserUpdate) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate
func (*UserUpdate) Append ¶
func (b *UserUpdate) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdate
func (*UserUpdate) Apply ¶
func (b *UserUpdate) Apply(p UserPatch) *UserUpdate
func (*UserUpdate) Clear ¶
func (b *UserUpdate) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdate
func (*UserUpdate) ClearEdge ¶
func (b *UserUpdate) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdate
func (*UserUpdate) ExecX ¶
func (b *UserUpdate) ExecX(ctx context.Context)
func (*UserUpdate) Modify ¶
func (_u *UserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdate
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*UserUpdate) Mutation ¶
func (b *UserUpdate) Mutation() *UserMutation
func (*UserUpdate) Patch ¶
func (b *UserUpdate) Patch() *UserPatch
func (*UserUpdate) RemoveIDs ¶
func (b *UserUpdate) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdate
func (*UserUpdate) Set ¶
func (b *UserUpdate) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdate
func (*UserUpdate) SetEdge ¶
func (b *UserUpdate) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdate
func (*UserUpdate) SetExpr ¶
func (b *UserUpdate) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdate
func (*UserUpdate) SetOptional ¶
func (b *UserUpdate) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdate
func (*UserUpdate) Where ¶
func (b *UserUpdate) Where(predicates ...ent.Predicate[entity.User]) *UserUpdate
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
func (*UserUpdateOne) Add ¶
func (b *UserUpdateOne) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpdateOne
func (*UserUpdateOne) AddIDs ¶
func (b *UserUpdateOne) AddIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne
func (*UserUpdateOne) Append ¶
func (b *UserUpdateOne) Append[T any](column ent.ColumnOf[entity.User, T], values T) *UserUpdateOne
func (*UserUpdateOne) Apply ¶
func (b *UserUpdateOne) Apply(p UserPatch) *UserUpdateOne
func (*UserUpdateOne) Clear ¶
func (b *UserUpdateOne) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpdateOne
func (*UserUpdateOne) ClearEdge ¶
func (b *UserUpdateOne) ClearEdge[N, K any](edge ent.RelationOf[entity.User, N, K]) *UserUpdateOne
func (*UserUpdateOne) Columns ¶
func (b *UserUpdateOne) Columns(columns ...ent.EntityColumn[entity.User]) *UserUpdateOne
Columns narrows the entity columns returned by the update. The ID is always included.
func (*UserUpdateOne) ExecX ¶
func (b *UserUpdateOne) ExecX(ctx context.Context)
func (*UserUpdateOne) Modify ¶
func (_u *UserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdateOne
Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (*UserUpdateOne) Mutation ¶
func (b *UserUpdateOne) Mutation() *UserMutation
func (*UserUpdateOne) Patch ¶
func (b *UserUpdateOne) Patch() *UserPatch
func (*UserUpdateOne) RemoveIDs ¶
func (b *UserUpdateOne) RemoveIDs[N, K any](edge ent.Relation[entity.User, N, K], ids ...K) *UserUpdateOne
func (*UserUpdateOne) Set ¶
func (b *UserUpdateOne) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpdateOne
func (*UserUpdateOne) SetEdge ¶
func (b *UserUpdateOne) SetEdge[N, K any](edge ent.UniqueRelation[entity.User, N, K], id K) *UserUpdateOne
func (*UserUpdateOne) SetExpr ¶
func (b *UserUpdateOne) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpdateOne
func (*UserUpdateOne) SetOptional ¶
func (b *UserUpdateOne) SetOptional[T any](column ent.ColumnOf[entity.User, T], value ent.Option[T]) *UserUpdateOne
func (*UserUpdateOne) Where ¶
func (b *UserUpdateOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpdateOne
type UserUpsert ¶
func (*UserUpsert) Add ¶
func (u *UserUpsert) Add[T ent.Number](column ent.ColumnOf[entity.User, T], delta T) *UserUpsert
func (*UserUpsert) Clear ¶
func (u *UserUpsert) Clear[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert
func (*UserUpsert) Set ¶
func (u *UserUpsert) Set[T any](column ent.ColumnOf[entity.User, T], value T) *UserUpsert
func (*UserUpsert) SetExpr ¶
func (u *UserUpsert) SetExpr[T any](column ent.ColumnOf[entity.User, T], value ent.Expr[T]) *UserUpsert
func (*UserUpsert) UpdateNewValue ¶
func (u *UserUpsert) UpdateNewValue[T any](column ent.ColumnOf[entity.User, T]) *UserUpsert
type UserUpsertBulk ¶
type UserUpsertBulk struct {
// contains filtered or unexported fields
}
func (*UserUpsertBulk) DoNothing ¶
func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk
func (*UserUpsertBulk) DoSelect ¶
func (u *UserUpsertBulk) DoSelect() *UserUpsertBulk
func (*UserUpsertBulk) DoUpdate ¶
func (u *UserUpsertBulk) DoUpdate(set func(*UserUpsert)) *UserUpsertBulk
func (*UserUpsertBulk) ExecX ¶
func (u *UserUpsertBulk) ExecX(ctx context.Context)
func (*UserUpsertBulk) Ignore ¶
func (u *UserUpsertBulk) Ignore() *UserUpsertBulk
func (*UserUpsertBulk) UpdateNewValues ¶
func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk
func (*UserUpsertBulk) UpdateWhere ¶
func (u *UserUpsertBulk) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk
func (*UserUpsertBulk) Where ¶
func (u *UserUpsertBulk) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertBulk
type UserUpsertOne ¶
type UserUpsertOne struct {
// contains filtered or unexported fields
}
func (*UserUpsertOne) DoNothing ¶
func (u *UserUpsertOne) DoNothing() *UserUpsertOne
func (*UserUpsertOne) DoSelect ¶
func (u *UserUpsertOne) DoSelect() *UserUpsertOne
func (*UserUpsertOne) DoUpdate ¶
func (u *UserUpsertOne) DoUpdate(set func(*UserUpsert)) *UserUpsertOne
func (*UserUpsertOne) ExecX ¶
func (u *UserUpsertOne) ExecX(ctx context.Context)
func (*UserUpsertOne) Ignore ¶
func (u *UserUpsertOne) Ignore() *UserUpsertOne
func (*UserUpsertOne) UpdateNewValues ¶
func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne
func (*UserUpsertOne) UpdateWhere ¶
func (u *UserUpsertOne) UpdateWhere(predicates ...ent.Predicate[entity.User]) *UserUpsertOne
func (*UserUpsertOne) Where ¶
func (u *UserUpsertOne) Where(predicates ...ent.Predicate[entity.User]) *UserUpsertOne
type ValidationError ¶
type ValidationError struct {
Name string // Field or edge name.
// contains filtered or unexported fields
}
ValidationError returns when validating a field or edge 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.