Versions in this module Expand all Collapse all v1 v1.0.2 May 23, 2022 v1.0.1 Apr 23, 2022 v1.0.0 Jan 20, 2022 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypeModel + 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 + Model *ModelClient + Schema *migrate.Schema + func FromContext(ctx context.Context) *Client + func NewClient(opts ...Option) *Client + func Open(driverName, dataSourceName string, options ...Option) (*Client, error) + func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) + func (c *Client) Close() error + func (c *Client) Debug() *Client + func (c *Client) Tx(ctx context.Context) (*Tx, error) + func (c *Client) Use(hooks ...Hook) + type CommitFunc func(context.Context, *Tx) error + func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error + type CommitHook func(Committer) Committer + type Committer interface + Commit func(context.Context, *Tx) error + type ConstraintError struct + func (e *ConstraintError) Unwrap() error + func (e ConstraintError) Error() string + type Hook = ent.Hook + type Model struct + Age int + Counter int64 + Fax string + ID int + Name string + Right bool + Title string + Web string + func (m *Model) String() string + func (m *Model) Unwrap() *Model + func (m *Model) Update() *ModelUpdateOne + type ModelClient struct + func NewModelClient(c config) *ModelClient + func (c *ModelClient) Create() *ModelCreate + func (c *ModelClient) CreateBulk(builders ...*ModelCreate) *ModelCreateBulk + func (c *ModelClient) Delete() *ModelDelete + func (c *ModelClient) DeleteOne(m *Model) *ModelDeleteOne + func (c *ModelClient) DeleteOneID(id int) *ModelDeleteOne + func (c *ModelClient) Get(ctx context.Context, id int) (*Model, error) + func (c *ModelClient) GetX(ctx context.Context, id int) *Model + func (c *ModelClient) Hooks() []Hook + func (c *ModelClient) Query() *ModelQuery + func (c *ModelClient) Update() *ModelUpdate + func (c *ModelClient) UpdateOne(m *Model) *ModelUpdateOne + func (c *ModelClient) UpdateOneID(id int) *ModelUpdateOne + func (c *ModelClient) Use(hooks ...Hook) + type ModelCreate struct + func (mc *ModelCreate) Exec(ctx context.Context) error + func (mc *ModelCreate) ExecX(ctx context.Context) + func (mc *ModelCreate) Mutation() *ModelMutation + func (mc *ModelCreate) Save(ctx context.Context) (*Model, error) + func (mc *ModelCreate) SaveX(ctx context.Context) *Model + func (mc *ModelCreate) SetAge(i int) *ModelCreate + func (mc *ModelCreate) SetCounter(i int64) *ModelCreate + func (mc *ModelCreate) SetFax(s string) *ModelCreate + func (mc *ModelCreate) SetName(s string) *ModelCreate + func (mc *ModelCreate) SetRight(b bool) *ModelCreate + func (mc *ModelCreate) SetTitle(s string) *ModelCreate + func (mc *ModelCreate) SetWeb(s string) *ModelCreate + type ModelCreateBulk struct + func (mcb *ModelCreateBulk) Exec(ctx context.Context) error + func (mcb *ModelCreateBulk) ExecX(ctx context.Context) + func (mcb *ModelCreateBulk) Save(ctx context.Context) ([]*Model, error) + func (mcb *ModelCreateBulk) SaveX(ctx context.Context) []*Model + type ModelDelete struct + func (md *ModelDelete) Exec(ctx context.Context) (int, error) + func (md *ModelDelete) ExecX(ctx context.Context) int + func (md *ModelDelete) Where(ps ...predicate.Model) *ModelDelete + type ModelDeleteOne struct + func (mdo *ModelDeleteOne) Exec(ctx context.Context) error + func (mdo *ModelDeleteOne) ExecX(ctx context.Context) + type ModelGroupBy struct + func (mgb *ModelGroupBy) Aggregate(fns ...AggregateFunc) *ModelGroupBy + func (mgb *ModelGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (mgb *ModelGroupBy) BoolX(ctx context.Context) bool + func (mgb *ModelGroupBy) Bools(ctx context.Context) ([]bool, error) + func (mgb *ModelGroupBy) BoolsX(ctx context.Context) []bool + func (mgb *ModelGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (mgb *ModelGroupBy) Float64X(ctx context.Context) float64 + func (mgb *ModelGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (mgb *ModelGroupBy) Float64sX(ctx context.Context) []float64 + func (mgb *ModelGroupBy) Int(ctx context.Context) (_ int, err error) + func (mgb *ModelGroupBy) IntX(ctx context.Context) int + func (mgb *ModelGroupBy) Ints(ctx context.Context) ([]int, error) + func (mgb *ModelGroupBy) IntsX(ctx context.Context) []int + func (mgb *ModelGroupBy) Scan(ctx context.Context, v interface{}) error + func (mgb *ModelGroupBy) ScanX(ctx context.Context, v interface{}) + func (mgb *ModelGroupBy) String(ctx context.Context) (_ string, err error) + func (mgb *ModelGroupBy) StringX(ctx context.Context) string + func (mgb *ModelGroupBy) Strings(ctx context.Context) ([]string, error) + func (mgb *ModelGroupBy) StringsX(ctx context.Context) []string + type ModelMutation struct + func (m *ModelMutation) AddAge(i int) + func (m *ModelMutation) AddCounter(i int64) + func (m *ModelMutation) AddField(name string, value ent.Value) error + func (m *ModelMutation) AddedAge() (r int, exists bool) + func (m *ModelMutation) AddedCounter() (r int64, exists bool) + func (m *ModelMutation) AddedEdges() []string + func (m *ModelMutation) AddedField(name string) (ent.Value, bool) + func (m *ModelMutation) AddedFields() []string + func (m *ModelMutation) AddedIDs(name string) []ent.Value + func (m *ModelMutation) Age() (r int, exists bool) + func (m *ModelMutation) ClearEdge(name string) error + func (m *ModelMutation) ClearField(name string) error + func (m *ModelMutation) ClearedEdges() []string + func (m *ModelMutation) ClearedFields() []string + func (m *ModelMutation) Counter() (r int64, exists bool) + func (m *ModelMutation) EdgeCleared(name string) bool + func (m *ModelMutation) Fax() (r string, exists bool) + func (m *ModelMutation) Field(name string) (ent.Value, bool) + func (m *ModelMutation) FieldCleared(name string) bool + func (m *ModelMutation) Fields() []string + func (m *ModelMutation) ID() (id int, exists bool) + func (m *ModelMutation) IDs(ctx context.Context) ([]int, error) + func (m *ModelMutation) Name() (r string, exists bool) + func (m *ModelMutation) OldAge(ctx context.Context) (v int, err error) + func (m *ModelMutation) OldCounter(ctx context.Context) (v int64, err error) + func (m *ModelMutation) OldFax(ctx context.Context) (v string, err error) + func (m *ModelMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *ModelMutation) OldName(ctx context.Context) (v string, err error) + func (m *ModelMutation) OldRight(ctx context.Context) (v bool, err error) + func (m *ModelMutation) OldTitle(ctx context.Context) (v string, err error) + func (m *ModelMutation) OldWeb(ctx context.Context) (v string, err error) + func (m *ModelMutation) Op() Op + func (m *ModelMutation) RemovedEdges() []string + func (m *ModelMutation) RemovedIDs(name string) []ent.Value + func (m *ModelMutation) ResetAge() + func (m *ModelMutation) ResetCounter() + func (m *ModelMutation) ResetEdge(name string) error + func (m *ModelMutation) ResetFax() + func (m *ModelMutation) ResetField(name string) error + func (m *ModelMutation) ResetName() + func (m *ModelMutation) ResetRight() + func (m *ModelMutation) ResetTitle() + func (m *ModelMutation) ResetWeb() + func (m *ModelMutation) Right() (r bool, exists bool) + func (m *ModelMutation) SetAge(i int) + func (m *ModelMutation) SetCounter(i int64) + func (m *ModelMutation) SetFax(s string) + func (m *ModelMutation) SetField(name string, value ent.Value) error + func (m *ModelMutation) SetName(s string) + func (m *ModelMutation) SetRight(b bool) + func (m *ModelMutation) SetTitle(s string) + func (m *ModelMutation) SetWeb(s string) + func (m *ModelMutation) Title() (r string, exists bool) + func (m *ModelMutation) Type() string + func (m *ModelMutation) Web() (r string, exists bool) + func (m *ModelMutation) Where(ps ...predicate.Model) + func (m ModelMutation) Client() *Client + func (m ModelMutation) Tx() (*Tx, error) + type ModelQuery struct + func (mq *ModelQuery) All(ctx context.Context) ([]*Model, error) + func (mq *ModelQuery) AllX(ctx context.Context) []*Model + func (mq *ModelQuery) Clone() *ModelQuery + func (mq *ModelQuery) Count(ctx context.Context) (int, error) + func (mq *ModelQuery) CountX(ctx context.Context) int + func (mq *ModelQuery) Exist(ctx context.Context) (bool, error) + func (mq *ModelQuery) ExistX(ctx context.Context) bool + func (mq *ModelQuery) First(ctx context.Context) (*Model, error) + func (mq *ModelQuery) FirstID(ctx context.Context) (id int, err error) + func (mq *ModelQuery) FirstIDX(ctx context.Context) int + func (mq *ModelQuery) FirstX(ctx context.Context) *Model + func (mq *ModelQuery) GroupBy(field string, fields ...string) *ModelGroupBy + func (mq *ModelQuery) IDs(ctx context.Context) ([]int, error) + func (mq *ModelQuery) IDsX(ctx context.Context) []int + func (mq *ModelQuery) Limit(limit int) *ModelQuery + func (mq *ModelQuery) Offset(offset int) *ModelQuery + func (mq *ModelQuery) Only(ctx context.Context) (*Model, error) + func (mq *ModelQuery) OnlyID(ctx context.Context) (id int, err error) + func (mq *ModelQuery) OnlyIDX(ctx context.Context) int + func (mq *ModelQuery) OnlyX(ctx context.Context) *Model + func (mq *ModelQuery) Order(o ...OrderFunc) *ModelQuery + func (mq *ModelQuery) Select(fields ...string) *ModelSelect + func (mq *ModelQuery) Unique(unique bool) *ModelQuery + func (mq *ModelQuery) Where(ps ...predicate.Model) *ModelQuery + type ModelSelect struct + func (ms *ModelSelect) Bool(ctx context.Context) (_ bool, err error) + func (ms *ModelSelect) BoolX(ctx context.Context) bool + func (ms *ModelSelect) Bools(ctx context.Context) ([]bool, error) + func (ms *ModelSelect) BoolsX(ctx context.Context) []bool + func (ms *ModelSelect) Float64(ctx context.Context) (_ float64, err error) + func (ms *ModelSelect) Float64X(ctx context.Context) float64 + func (ms *ModelSelect) Float64s(ctx context.Context) ([]float64, error) + func (ms *ModelSelect) Float64sX(ctx context.Context) []float64 + func (ms *ModelSelect) Int(ctx context.Context) (_ int, err error) + func (ms *ModelSelect) IntX(ctx context.Context) int + func (ms *ModelSelect) Ints(ctx context.Context) ([]int, error) + func (ms *ModelSelect) IntsX(ctx context.Context) []int + func (ms *ModelSelect) Scan(ctx context.Context, v interface{}) error + func (ms *ModelSelect) ScanX(ctx context.Context, v interface{}) + func (ms *ModelSelect) String(ctx context.Context) (_ string, err error) + func (ms *ModelSelect) StringX(ctx context.Context) string + func (ms *ModelSelect) Strings(ctx context.Context) ([]string, error) + func (ms *ModelSelect) StringsX(ctx context.Context) []string + type ModelUpdate struct + func (mu *ModelUpdate) AddAge(i int) *ModelUpdate + func (mu *ModelUpdate) AddCounter(i int64) *ModelUpdate + func (mu *ModelUpdate) Exec(ctx context.Context) error + func (mu *ModelUpdate) ExecX(ctx context.Context) + func (mu *ModelUpdate) Mutation() *ModelMutation + func (mu *ModelUpdate) Save(ctx context.Context) (int, error) + func (mu *ModelUpdate) SaveX(ctx context.Context) int + func (mu *ModelUpdate) SetAge(i int) *ModelUpdate + func (mu *ModelUpdate) SetCounter(i int64) *ModelUpdate + func (mu *ModelUpdate) SetFax(s string) *ModelUpdate + func (mu *ModelUpdate) SetName(s string) *ModelUpdate + func (mu *ModelUpdate) SetRight(b bool) *ModelUpdate + func (mu *ModelUpdate) SetTitle(s string) *ModelUpdate + func (mu *ModelUpdate) SetWeb(s string) *ModelUpdate + func (mu *ModelUpdate) Where(ps ...predicate.Model) *ModelUpdate + type ModelUpdateOne struct + func (muo *ModelUpdateOne) AddAge(i int) *ModelUpdateOne + func (muo *ModelUpdateOne) AddCounter(i int64) *ModelUpdateOne + func (muo *ModelUpdateOne) Exec(ctx context.Context) error + func (muo *ModelUpdateOne) ExecX(ctx context.Context) + func (muo *ModelUpdateOne) Mutation() *ModelMutation + func (muo *ModelUpdateOne) Save(ctx context.Context) (*Model, error) + func (muo *ModelUpdateOne) SaveX(ctx context.Context) *Model + func (muo *ModelUpdateOne) Select(field string, fields ...string) *ModelUpdateOne + func (muo *ModelUpdateOne) SetAge(i int) *ModelUpdateOne + func (muo *ModelUpdateOne) SetCounter(i int64) *ModelUpdateOne + func (muo *ModelUpdateOne) SetFax(s string) *ModelUpdateOne + func (muo *ModelUpdateOne) SetName(s string) *ModelUpdateOne + func (muo *ModelUpdateOne) SetRight(b bool) *ModelUpdateOne + func (muo *ModelUpdateOne) SetTitle(s string) *ModelUpdateOne + func (muo *ModelUpdateOne) SetWeb(s string) *ModelUpdateOne + type Models []*Model + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...interface{})) Option + type OrderFunc func(*sql.Selector) + func Asc(fields ...string) OrderFunc + func Desc(fields ...string) OrderFunc + type Policy = ent.Policy + type Query = ent.Query + type RollbackFunc func(context.Context, *Tx) error + func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error + type RollbackHook func(Rollbacker) Rollbacker + type Rollbacker interface + Rollback func(context.Context, *Tx) error + type Tx struct + Model *ModelClient + 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 ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value