Versions in this module Expand all Collapse all v1 v1.0.3 Feb 27, 2023 v1.0.2 Feb 27, 2023 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypeUser + func IsConstraintError(err error) bool + func IsNotFound(err error) bool + func IsNotLoaded(err error) bool + func IsNotSingular(err error) bool + func IsValidationError(err error) bool + func MaskNotFound(err error) error + func NewContext(parent context.Context, c *Client) context.Context + func NewTxContext(parent context.Context, tx *Tx) context.Context + type AggregateFunc func(*sql.Selector) string + func As(fn AggregateFunc, end string) AggregateFunc + func Count() AggregateFunc + func Max(field string) AggregateFunc + func Mean(field string) AggregateFunc + func Min(field string) AggregateFunc + func Sum(field string) AggregateFunc + type Client struct + Schema *migrate.Schema + User *UserClient + func FromContext(ctx context.Context) *Client + func NewClient(opts ...Option) *Client + func Open(driverName, dataSourceName string, options ...Option) (*Client, error) + func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (c *Client) Close() error + func (c *Client) Debug() *Client + func (c *Client) Tx(ctx context.Context) (*Tx, error) + func (c *Client) Use(hooks ...Hook) + type CommitFunc func(context.Context, *Tx) error + func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error + type CommitHook func(Committer) Committer + type Committer interface + Commit func(context.Context, *Tx) error + type ConstraintError struct + func (e *ConstraintError) Unwrap() error + func (e ConstraintError) Error() string + type Database struct + func NewDatabase(opts ...Option) *Database + func (db *Database) InTx(ctx context.Context, f func(context.Context) error) error + func (db *Database) User(ctx context.Context) *UserClient + type Hook = ent.Hook + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func AlternateSchema(schemaConfig SchemaConfig) Option + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...any)) Option + type OrderFunc func(*sql.Selector) + func Asc(fields ...string) OrderFunc + func Desc(fields ...string) OrderFunc + type Policy = ent.Policy + type Query = ent.Query + type RollbackFunc func(context.Context, *Tx) error + func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error + type RollbackHook func(Rollbacker) Rollbacker + type Rollbacker interface + Rollback func(context.Context, *Tx) error + type SchemaConfig = internal.SchemaConfig + type Tx struct + User *UserClient + func TxFromContext(ctx context.Context) *Tx + func (tx *Tx) Client() *Client + func (tx *Tx) Commit() error + func (tx *Tx) OnCommit(f CommitHook) + func (tx *Tx) OnRollback(f RollbackHook) + func (tx *Tx) Rollback() error + type User struct + ID int + Username string + func (u *User) String() string + func (u *User) Unwrap() *User + func (u *User) Update() *UserUpdateOne + type UserClient struct + func NewUserClient(c config) *UserClient + func (c *UserClient) Create() *UserCreate + func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk + func (c *UserClient) Delete() *UserDelete + func (c *UserClient) DeleteOne(u *User) *UserDeleteOne + func (c *UserClient) DeleteOneID(id int) *UserDeleteOne + func (c *UserClient) Get(ctx context.Context, id int) (*User, error) + func (c *UserClient) GetX(ctx context.Context, id int) *User + func (c *UserClient) Hooks() []Hook + func (c *UserClient) Query() *UserQuery + func (c *UserClient) Update() *UserUpdate + func (c *UserClient) UpdateOne(u *User) *UserUpdateOne + func (c *UserClient) UpdateOneID(id int) *UserUpdateOne + func (c *UserClient) Use(hooks ...Hook) + type UserCreate struct + func (uc *UserCreate) Exec(ctx context.Context) error + func (uc *UserCreate) ExecX(ctx context.Context) + func (uc *UserCreate) Mutation() *UserMutation + func (uc *UserCreate) Save(ctx context.Context) (*User, error) + func (uc *UserCreate) SaveX(ctx context.Context) *User + func (uc *UserCreate) SetUsername(s string) *UserCreate + type UserCreateBulk struct + func (ucb *UserCreateBulk) Exec(ctx context.Context) error + func (ucb *UserCreateBulk) ExecX(ctx context.Context) + func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) + func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User + type UserDelete struct + func (ud *UserDelete) Exec(ctx context.Context) (int, error) + func (ud *UserDelete) ExecX(ctx context.Context) int + func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete + type UserDeleteOne struct + func (udo *UserDeleteOne) Exec(ctx context.Context) error + func (udo *UserDeleteOne) ExecX(ctx context.Context) + type UserFilter struct + func (f *UserFilter) Where(p entql.P) + func (f *UserFilter) WhereID(p entql.IntP) + func (f *UserFilter) WhereUsername(p entql.StringP) + type UserGroupBy struct + func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (s *UserGroupBy) BoolX(ctx context.Context) bool + func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error) + func (s *UserGroupBy) BoolsX(ctx context.Context) []bool + func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (s *UserGroupBy) Float64X(ctx context.Context) float64 + func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (s *UserGroupBy) Float64sX(ctx context.Context) []float64 + func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error) + func (s *UserGroupBy) IntX(ctx context.Context) int + func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error) + func (s *UserGroupBy) IntsX(ctx context.Context) []int + func (s *UserGroupBy) ScanX(ctx context.Context, v any) + func (s *UserGroupBy) String(ctx context.Context) (_ string, err error) + func (s *UserGroupBy) StringX(ctx context.Context) string + func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error) + func (s *UserGroupBy) StringsX(ctx context.Context) []string + func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy + func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error + type UserMutation struct + func (m *UserMutation) AddField(name string, value ent.Value) error + func (m *UserMutation) AddedEdges() []string + func (m *UserMutation) AddedField(name string) (ent.Value, bool) + func (m *UserMutation) AddedFields() []string + func (m *UserMutation) AddedIDs(name string) []ent.Value + func (m *UserMutation) ClearEdge(name string) error + func (m *UserMutation) ClearField(name string) error + func (m *UserMutation) ClearedEdges() []string + func (m *UserMutation) ClearedFields() []string + func (m *UserMutation) EdgeCleared(name string) bool + func (m *UserMutation) Field(name string) (ent.Value, bool) + func (m *UserMutation) FieldCleared(name string) bool + func (m *UserMutation) Fields() []string + func (m *UserMutation) Filter() *UserFilter + func (m *UserMutation) ID() (id int, exists bool) + func (m *UserMutation) IDs(ctx context.Context) ([]int, error) + func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error) + func (m *UserMutation) Op() Op + func (m *UserMutation) RemovedEdges() []string + func (m *UserMutation) RemovedIDs(name string) []ent.Value + func (m *UserMutation) ResetEdge(name string) error + func (m *UserMutation) ResetField(name string) error + func (m *UserMutation) ResetUsername() + func (m *UserMutation) SetField(name string, value ent.Value) error + func (m *UserMutation) SetUsername(s string) + func (m *UserMutation) Type() string + func (m *UserMutation) Username() (r string, exists bool) + func (m *UserMutation) Where(ps ...predicate.User) + func (m UserMutation) Client() *Client + func (m UserMutation) Tx() (*Tx, error) + type UserQuery struct + func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect + func (uq *UserQuery) All(ctx context.Context) ([]*User, error) + func (uq *UserQuery) AllX(ctx context.Context) []*User + func (uq *UserQuery) Clone() *UserQuery + func (uq *UserQuery) Count(ctx context.Context) (int, error) + func (uq *UserQuery) CountX(ctx context.Context) int + func (uq *UserQuery) Exist(ctx context.Context) (bool, error) + func (uq *UserQuery) ExistX(ctx context.Context) bool + func (uq *UserQuery) Filter() *UserFilter + func (uq *UserQuery) First(ctx context.Context) (*User, error) + func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error) + func (uq *UserQuery) FirstIDX(ctx context.Context) int + func (uq *UserQuery) FirstX(ctx context.Context) *User + func (uq *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery + func (uq *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery + func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy + func (uq *UserQuery) IDs(ctx context.Context) ([]int, error) + func (uq *UserQuery) IDsX(ctx context.Context) []int + func (uq *UserQuery) Limit(limit int) *UserQuery + func (uq *UserQuery) Modify(modifiers ...func(s *sql.Selector)) *UserSelect + func (uq *UserQuery) Offset(offset int) *UserQuery + func (uq *UserQuery) Only(ctx context.Context) (*User, error) + func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error) + func (uq *UserQuery) OnlyIDX(ctx context.Context) int + func (uq *UserQuery) OnlyX(ctx context.Context) *User + func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery + func (uq *UserQuery) Select(fields ...string) *UserSelect + func (uq *UserQuery) Unique(unique bool) *UserQuery + func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery + type UserSelect struct + func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error) + func (s *UserSelect) BoolX(ctx context.Context) bool + func (s *UserSelect) Bools(ctx context.Context) ([]bool, error) + func (s *UserSelect) BoolsX(ctx context.Context) []bool + func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error) + func (s *UserSelect) Float64X(ctx context.Context) float64 + func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error) + func (s *UserSelect) Float64sX(ctx context.Context) []float64 + func (s *UserSelect) Int(ctx context.Context) (_ int, err error) + func (s *UserSelect) IntX(ctx context.Context) int + func (s *UserSelect) Ints(ctx context.Context) ([]int, error) + func (s *UserSelect) IntsX(ctx context.Context) []int + func (s *UserSelect) ScanX(ctx context.Context, v any) + func (s *UserSelect) String(ctx context.Context) (_ string, err error) + func (s *UserSelect) StringX(ctx context.Context) string + func (s *UserSelect) Strings(ctx context.Context) ([]string, error) + func (s *UserSelect) StringsX(ctx context.Context) []string + func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect + func (us *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect + func (us *UserSelect) Scan(ctx context.Context, v any) error + type UserUpdate struct + func (uu *UserUpdate) Exec(ctx context.Context) error + func (uu *UserUpdate) ExecX(ctx context.Context) + func (uu *UserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdate + func (uu *UserUpdate) Mutation() *UserMutation + func (uu *UserUpdate) Save(ctx context.Context) (int, error) + func (uu *UserUpdate) SaveX(ctx context.Context) int + func (uu *UserUpdate) SetUsername(s string) *UserUpdate + func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate + type UserUpdateOne struct + func (uuo *UserUpdateOne) Exec(ctx context.Context) error + func (uuo *UserUpdateOne) ExecX(ctx context.Context) + func (uuo *UserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *UserUpdateOne + func (uuo *UserUpdateOne) Mutation() *UserMutation + func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) + func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User + func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne + func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne + type Users []*User + type ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value