Versions in this module Expand all Collapse all v0 v0.10.2 Jan 14, 2022 v0.10.1 Jan 14, 2022 v0.10.0 Jan 14, 2022 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypeNode + 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 + Node *NodeClient + 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 MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type Node struct + Edges NodeEdges + ID int + Value int + func (n *Node) QueryChildren() *NodeQuery + func (n *Node) QueryParent() *NodeQuery + func (n *Node) String() string + func (n *Node) Unwrap() *Node + func (n *Node) Update() *NodeUpdateOne + type NodeClient struct + func NewNodeClient(c config) *NodeClient + func (c *NodeClient) Create() *NodeCreate + func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk + func (c *NodeClient) Delete() *NodeDelete + func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne + func (c *NodeClient) DeleteOneID(id int) *NodeDeleteOne + func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error) + func (c *NodeClient) GetX(ctx context.Context, id int) *Node + func (c *NodeClient) Hooks() []Hook + func (c *NodeClient) Query() *NodeQuery + func (c *NodeClient) QueryChildren(n *Node) *NodeQuery + func (c *NodeClient) QueryParent(n *Node) *NodeQuery + func (c *NodeClient) Update() *NodeUpdate + func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne + func (c *NodeClient) UpdateOneID(id int) *NodeUpdateOne + func (c *NodeClient) Use(hooks ...Hook) + type NodeCreate struct + func (nc *NodeCreate) AddChildIDs(ids ...int) *NodeCreate + func (nc *NodeCreate) AddChildren(n ...*Node) *NodeCreate + func (nc *NodeCreate) Exec(ctx context.Context) error + func (nc *NodeCreate) ExecX(ctx context.Context) + func (nc *NodeCreate) Mutation() *NodeMutation + func (nc *NodeCreate) Save(ctx context.Context) (*Node, error) + func (nc *NodeCreate) SaveX(ctx context.Context) *Node + func (nc *NodeCreate) SetNillableParentID(id *int) *NodeCreate + func (nc *NodeCreate) SetParent(n *Node) *NodeCreate + func (nc *NodeCreate) SetParentID(id int) *NodeCreate + func (nc *NodeCreate) SetValue(i int) *NodeCreate + type NodeCreateBulk struct + func (ncb *NodeCreateBulk) Exec(ctx context.Context) error + func (ncb *NodeCreateBulk) ExecX(ctx context.Context) + func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error) + func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node + type NodeDelete struct + func (nd *NodeDelete) Exec(ctx context.Context) (int, error) + func (nd *NodeDelete) ExecX(ctx context.Context) int + func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete + type NodeDeleteOne struct + func (ndo *NodeDeleteOne) Exec(ctx context.Context) error + func (ndo *NodeDeleteOne) ExecX(ctx context.Context) + type NodeEdges struct + Children []*Node + Parent *Node + func (e NodeEdges) ChildrenOrErr() ([]*Node, error) + func (e NodeEdges) ParentOrErr() (*Node, error) + type NodeGroupBy struct + func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy + func (ngb *NodeGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (ngb *NodeGroupBy) BoolX(ctx context.Context) bool + func (ngb *NodeGroupBy) Bools(ctx context.Context) ([]bool, error) + func (ngb *NodeGroupBy) BoolsX(ctx context.Context) []bool + func (ngb *NodeGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (ngb *NodeGroupBy) Float64X(ctx context.Context) float64 + func (ngb *NodeGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (ngb *NodeGroupBy) Float64sX(ctx context.Context) []float64 + func (ngb *NodeGroupBy) Int(ctx context.Context) (_ int, err error) + func (ngb *NodeGroupBy) IntX(ctx context.Context) int + func (ngb *NodeGroupBy) Ints(ctx context.Context) ([]int, error) + func (ngb *NodeGroupBy) IntsX(ctx context.Context) []int + func (ngb *NodeGroupBy) Scan(ctx context.Context, v interface{}) error + func (ngb *NodeGroupBy) ScanX(ctx context.Context, v interface{}) + func (ngb *NodeGroupBy) String(ctx context.Context) (_ string, err error) + func (ngb *NodeGroupBy) StringX(ctx context.Context) string + func (ngb *NodeGroupBy) Strings(ctx context.Context) ([]string, error) + func (ngb *NodeGroupBy) StringsX(ctx context.Context) []string + type NodeMutation struct + func (m *NodeMutation) AddChildIDs(ids ...int) + func (m *NodeMutation) AddField(name string, value ent.Value) error + func (m *NodeMutation) AddValue(i int) + func (m *NodeMutation) AddedEdges() []string + func (m *NodeMutation) AddedField(name string) (ent.Value, bool) + func (m *NodeMutation) AddedFields() []string + func (m *NodeMutation) AddedIDs(name string) []ent.Value + func (m *NodeMutation) AddedValue() (r int, exists bool) + func (m *NodeMutation) ChildrenCleared() bool + func (m *NodeMutation) ChildrenIDs() (ids []int) + func (m *NodeMutation) ClearChildren() + func (m *NodeMutation) ClearEdge(name string) error + func (m *NodeMutation) ClearField(name string) error + func (m *NodeMutation) ClearParent() + func (m *NodeMutation) ClearedEdges() []string + func (m *NodeMutation) ClearedFields() []string + func (m *NodeMutation) EdgeCleared(name string) bool + func (m *NodeMutation) Field(name string) (ent.Value, bool) + func (m *NodeMutation) FieldCleared(name string) bool + func (m *NodeMutation) Fields() []string + func (m *NodeMutation) ID() (id int, exists bool) + func (m *NodeMutation) IDs(ctx context.Context) ([]int, error) + func (m *NodeMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *NodeMutation) OldValue(ctx context.Context) (v int, err error) + func (m *NodeMutation) Op() Op + func (m *NodeMutation) ParentCleared() bool + func (m *NodeMutation) ParentID() (id int, exists bool) + func (m *NodeMutation) ParentIDs() (ids []int) + func (m *NodeMutation) RemoveChildIDs(ids ...int) + func (m *NodeMutation) RemovedChildrenIDs() (ids []int) + func (m *NodeMutation) RemovedEdges() []string + func (m *NodeMutation) RemovedIDs(name string) []ent.Value + func (m *NodeMutation) ResetChildren() + func (m *NodeMutation) ResetEdge(name string) error + func (m *NodeMutation) ResetField(name string) error + func (m *NodeMutation) ResetParent() + func (m *NodeMutation) ResetValue() + func (m *NodeMutation) SetField(name string, value ent.Value) error + func (m *NodeMutation) SetParentID(id int) + func (m *NodeMutation) SetValue(i int) + func (m *NodeMutation) Type() string + func (m *NodeMutation) Value() (r int, exists bool) + func (m *NodeMutation) Where(ps ...predicate.Node) + func (m NodeMutation) Client() *Client + func (m NodeMutation) Tx() (*Tx, error) + type NodeQuery struct + func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) + func (nq *NodeQuery) AllX(ctx context.Context) []*Node + func (nq *NodeQuery) Clone() *NodeQuery + func (nq *NodeQuery) Count(ctx context.Context) (int, error) + func (nq *NodeQuery) CountX(ctx context.Context) int + func (nq *NodeQuery) Exist(ctx context.Context) (bool, error) + func (nq *NodeQuery) ExistX(ctx context.Context) bool + func (nq *NodeQuery) First(ctx context.Context) (*Node, error) + func (nq *NodeQuery) FirstID(ctx context.Context) (id int, err error) + func (nq *NodeQuery) FirstIDX(ctx context.Context) int + func (nq *NodeQuery) FirstX(ctx context.Context) *Node + func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy + func (nq *NodeQuery) IDs(ctx context.Context) ([]int, error) + func (nq *NodeQuery) IDsX(ctx context.Context) []int + func (nq *NodeQuery) Limit(limit int) *NodeQuery + func (nq *NodeQuery) Offset(offset int) *NodeQuery + func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) + func (nq *NodeQuery) OnlyID(ctx context.Context) (id int, err error) + func (nq *NodeQuery) OnlyIDX(ctx context.Context) int + func (nq *NodeQuery) OnlyX(ctx context.Context) *Node + func (nq *NodeQuery) Order(o ...OrderFunc) *NodeQuery + func (nq *NodeQuery) QueryChildren() *NodeQuery + func (nq *NodeQuery) QueryParent() *NodeQuery + func (nq *NodeQuery) Select(fields ...string) *NodeSelect + func (nq *NodeQuery) Unique(unique bool) *NodeQuery + func (nq *NodeQuery) Where(ps ...predicate.Node) *NodeQuery + func (nq *NodeQuery) WithChildren(opts ...func(*NodeQuery)) *NodeQuery + func (nq *NodeQuery) WithParent(opts ...func(*NodeQuery)) *NodeQuery + type NodeSelect struct + func (ns *NodeSelect) Bool(ctx context.Context) (_ bool, err error) + func (ns *NodeSelect) BoolX(ctx context.Context) bool + func (ns *NodeSelect) Bools(ctx context.Context) ([]bool, error) + func (ns *NodeSelect) BoolsX(ctx context.Context) []bool + func (ns *NodeSelect) Float64(ctx context.Context) (_ float64, err error) + func (ns *NodeSelect) Float64X(ctx context.Context) float64 + func (ns *NodeSelect) Float64s(ctx context.Context) ([]float64, error) + func (ns *NodeSelect) Float64sX(ctx context.Context) []float64 + func (ns *NodeSelect) Int(ctx context.Context) (_ int, err error) + func (ns *NodeSelect) IntX(ctx context.Context) int + func (ns *NodeSelect) Ints(ctx context.Context) ([]int, error) + func (ns *NodeSelect) IntsX(ctx context.Context) []int + func (ns *NodeSelect) Scan(ctx context.Context, v interface{}) error + func (ns *NodeSelect) ScanX(ctx context.Context, v interface{}) + func (ns *NodeSelect) String(ctx context.Context) (_ string, err error) + func (ns *NodeSelect) StringX(ctx context.Context) string + func (ns *NodeSelect) Strings(ctx context.Context) ([]string, error) + func (ns *NodeSelect) StringsX(ctx context.Context) []string + type NodeUpdate struct + func (nu *NodeUpdate) AddChildIDs(ids ...int) *NodeUpdate + func (nu *NodeUpdate) AddChildren(n ...*Node) *NodeUpdate + func (nu *NodeUpdate) AddValue(i int) *NodeUpdate + func (nu *NodeUpdate) ClearChildren() *NodeUpdate + func (nu *NodeUpdate) ClearParent() *NodeUpdate + func (nu *NodeUpdate) Exec(ctx context.Context) error + func (nu *NodeUpdate) ExecX(ctx context.Context) + func (nu *NodeUpdate) Mutation() *NodeMutation + func (nu *NodeUpdate) RemoveChildIDs(ids ...int) *NodeUpdate + func (nu *NodeUpdate) RemoveChildren(n ...*Node) *NodeUpdate + func (nu *NodeUpdate) Save(ctx context.Context) (int, error) + func (nu *NodeUpdate) SaveX(ctx context.Context) int + func (nu *NodeUpdate) SetNillableParentID(id *int) *NodeUpdate + func (nu *NodeUpdate) SetParent(n *Node) *NodeUpdate + func (nu *NodeUpdate) SetParentID(id int) *NodeUpdate + func (nu *NodeUpdate) SetValue(i int) *NodeUpdate + func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate + type NodeUpdateOne struct + func (nuo *NodeUpdateOne) AddChildIDs(ids ...int) *NodeUpdateOne + func (nuo *NodeUpdateOne) AddChildren(n ...*Node) *NodeUpdateOne + func (nuo *NodeUpdateOne) AddValue(i int) *NodeUpdateOne + func (nuo *NodeUpdateOne) ClearChildren() *NodeUpdateOne + func (nuo *NodeUpdateOne) ClearParent() *NodeUpdateOne + func (nuo *NodeUpdateOne) Exec(ctx context.Context) error + func (nuo *NodeUpdateOne) ExecX(ctx context.Context) + func (nuo *NodeUpdateOne) Mutation() *NodeMutation + func (nuo *NodeUpdateOne) RemoveChildIDs(ids ...int) *NodeUpdateOne + func (nuo *NodeUpdateOne) RemoveChildren(n ...*Node) *NodeUpdateOne + func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) + func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node + func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne + func (nuo *NodeUpdateOne) SetNillableParentID(id *int) *NodeUpdateOne + func (nuo *NodeUpdateOne) SetParent(n *Node) *NodeUpdateOne + func (nuo *NodeUpdateOne) SetParentID(id int) *NodeUpdateOne + func (nuo *NodeUpdateOne) SetValue(i int) *NodeUpdateOne + type Nodes []*Node + 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 + Node *NodeClient + 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