Versions in this module Expand all Collapse all v0 v0.2.5 Jun 2, 2022 v0.2.4 Mar 23, 2022 v0.2.3 Mar 3, 2022 v0.2.2 Mar 3, 2022 v0.2.1 Mar 2, 2022 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 Hook = ent.Hook + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...interface{})) Option + type OrderFunc func(*sql.Selector) + func Asc(fields ...string) OrderFunc + func Desc(fields ...string) OrderFunc + type 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 + 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 + Edges UserEdges + ID int + func (u *User) QueryChildren() *UserQuery + func (u *User) QueryFollowers() *UserQuery + func (u *User) QueryFollowing() *UserQuery + func (u *User) QueryFriends() *UserQuery + func (u *User) QueryParent() *UserQuery + 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) QueryChildren(u *User) *UserQuery + func (c *UserClient) QueryFollowers(u *User) *UserQuery + func (c *UserClient) QueryFollowing(u *User) *UserQuery + func (c *UserClient) QueryFriends(u *User) *UserQuery + func (c *UserClient) QueryParent(u *User) *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) AddChildIDs(ids ...int) *UserCreate + func (uc *UserCreate) AddChildren(u ...*User) *UserCreate + func (uc *UserCreate) AddFollowerIDs(ids ...int) *UserCreate + func (uc *UserCreate) AddFollowers(u ...*User) *UserCreate + func (uc *UserCreate) AddFollowing(u ...*User) *UserCreate + func (uc *UserCreate) AddFollowingIDs(ids ...int) *UserCreate + func (uc *UserCreate) AddFriendIDs(ids ...int) *UserCreate + func (uc *UserCreate) AddFriends(u ...*User) *UserCreate + 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) SetNillableParentID(id *int) *UserCreate + func (uc *UserCreate) SetParent(u *User) *UserCreate + func (uc *UserCreate) SetParentID(id int) *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 UserEdges struct + Children []*User + Followers []*User + Following []*User + Friends []*User + Parent *User + func (e UserEdges) ChildrenOrErr() ([]*User, error) + func (e UserEdges) FollowersOrErr() ([]*User, error) + func (e UserEdges) FollowingOrErr() ([]*User, error) + func (e UserEdges) FriendsOrErr() ([]*User, error) + func (e UserEdges) ParentOrErr() (*User, error) + type UserGroupBy struct + func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy + func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (ugb *UserGroupBy) BoolX(ctx context.Context) bool + func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error) + func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool + func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (ugb *UserGroupBy) Float64X(ctx context.Context) float64 + func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64 + func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error) + func (ugb *UserGroupBy) IntX(ctx context.Context) int + func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error) + func (ugb *UserGroupBy) IntsX(ctx context.Context) []int + func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error + func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{}) + func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error) + func (ugb *UserGroupBy) StringX(ctx context.Context) string + func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error) + func (ugb *UserGroupBy) StringsX(ctx context.Context) []string + type UserMutation struct + func (m *UserMutation) AddChildIDs(ids ...int) + func (m *UserMutation) AddField(name string, value ent.Value) error + func (m *UserMutation) AddFollowerIDs(ids ...int) + func (m *UserMutation) AddFollowingIDs(ids ...int) + func (m *UserMutation) AddFriendIDs(ids ...int) + 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) ChildrenCleared() bool + func (m *UserMutation) ChildrenIDs() (ids []int) + func (m *UserMutation) ClearChildren() + func (m *UserMutation) ClearEdge(name string) error + func (m *UserMutation) ClearField(name string) error + func (m *UserMutation) ClearFollowers() + func (m *UserMutation) ClearFollowing() + func (m *UserMutation) ClearFriends() + func (m *UserMutation) ClearParent() + 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) FollowersCleared() bool + func (m *UserMutation) FollowersIDs() (ids []int) + func (m *UserMutation) FollowingCleared() bool + func (m *UserMutation) FollowingIDs() (ids []int) + func (m *UserMutation) FriendsCleared() bool + func (m *UserMutation) FriendsIDs() (ids []int) + 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) Op() Op + func (m *UserMutation) ParentCleared() bool + func (m *UserMutation) ParentID() (id int, exists bool) + func (m *UserMutation) ParentIDs() (ids []int) + func (m *UserMutation) RemoveChildIDs(ids ...int) + func (m *UserMutation) RemoveFollowerIDs(ids ...int) + func (m *UserMutation) RemoveFollowingIDs(ids ...int) + func (m *UserMutation) RemoveFriendIDs(ids ...int) + func (m *UserMutation) RemovedChildrenIDs() (ids []int) + func (m *UserMutation) RemovedEdges() []string + func (m *UserMutation) RemovedFollowersIDs() (ids []int) + func (m *UserMutation) RemovedFollowingIDs() (ids []int) + func (m *UserMutation) RemovedFriendsIDs() (ids []int) + func (m *UserMutation) RemovedIDs(name string) []ent.Value + func (m *UserMutation) ResetChildren() + func (m *UserMutation) ResetEdge(name string) error + func (m *UserMutation) ResetField(name string) error + func (m *UserMutation) ResetFollowers() + func (m *UserMutation) ResetFollowing() + func (m *UserMutation) ResetFriends() + func (m *UserMutation) ResetParent() + func (m *UserMutation) SetField(name string, value ent.Value) error + func (m *UserMutation) SetParentID(id int) + func (m *UserMutation) Type() string + func (m *UserMutation) Where(ps ...predicate.User) + func (m UserMutation) Client() *Client + func (m UserMutation) Tx() (*Tx, error) + type UserQuery struct + func (uq *UserQuery) All(ctx context.Context) ([]*User, error) + func (uq *UserQuery) AllX(ctx context.Context) []*User + func (uq *UserQuery) Clone() *UserQuery + func (uq *UserQuery) Count(ctx context.Context) (int, error) + func (uq *UserQuery) CountX(ctx context.Context) int + func (uq *UserQuery) Exist(ctx context.Context) (bool, error) + func (uq *UserQuery) ExistX(ctx context.Context) bool + func (uq *UserQuery) First(ctx context.Context) (*User, error) + func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error) + func (uq *UserQuery) FirstIDX(ctx context.Context) int + func (uq *UserQuery) FirstX(ctx context.Context) *User + func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy + func (uq *UserQuery) IDs(ctx context.Context) ([]int, error) + func (uq *UserQuery) IDsX(ctx context.Context) []int + func (uq *UserQuery) Limit(limit int) *UserQuery + func (uq *UserQuery) Offset(offset int) *UserQuery + func (uq *UserQuery) Only(ctx context.Context) (*User, error) + func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error) + func (uq *UserQuery) OnlyIDX(ctx context.Context) int + func (uq *UserQuery) OnlyX(ctx context.Context) *User + func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery + func (uq *UserQuery) QueryChildren() *UserQuery + func (uq *UserQuery) QueryFollowers() *UserQuery + func (uq *UserQuery) QueryFollowing() *UserQuery + func (uq *UserQuery) QueryFriends() *UserQuery + func (uq *UserQuery) QueryParent() *UserQuery + func (uq *UserQuery) Select(fields ...string) *UserSelect + func (uq *UserQuery) Unique(unique bool) *UserQuery + func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery + func (uq *UserQuery) WithChildren(opts ...func(*UserQuery)) *UserQuery + func (uq *UserQuery) WithFollowers(opts ...func(*UserQuery)) *UserQuery + func (uq *UserQuery) WithFollowing(opts ...func(*UserQuery)) *UserQuery + func (uq *UserQuery) WithFriends(opts ...func(*UserQuery)) *UserQuery + func (uq *UserQuery) WithParent(opts ...func(*UserQuery)) *UserQuery + type UserSelect struct + func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error) + func (us *UserSelect) BoolX(ctx context.Context) bool + func (us *UserSelect) Bools(ctx context.Context) ([]bool, error) + func (us *UserSelect) BoolsX(ctx context.Context) []bool + func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error) + func (us *UserSelect) Float64X(ctx context.Context) float64 + func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error) + func (us *UserSelect) Float64sX(ctx context.Context) []float64 + func (us *UserSelect) Int(ctx context.Context) (_ int, err error) + func (us *UserSelect) IntX(ctx context.Context) int + func (us *UserSelect) Ints(ctx context.Context) ([]int, error) + func (us *UserSelect) IntsX(ctx context.Context) []int + func (us *UserSelect) Scan(ctx context.Context, v interface{}) error + func (us *UserSelect) ScanX(ctx context.Context, v interface{}) + func (us *UserSelect) String(ctx context.Context) (_ string, err error) + func (us *UserSelect) StringX(ctx context.Context) string + func (us *UserSelect) Strings(ctx context.Context) ([]string, error) + func (us *UserSelect) StringsX(ctx context.Context) []string + type UserUpdate struct + func (uu *UserUpdate) AddChildIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) AddChildren(u ...*User) *UserUpdate + func (uu *UserUpdate) AddFollowerIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) AddFollowers(u ...*User) *UserUpdate + func (uu *UserUpdate) AddFollowing(u ...*User) *UserUpdate + func (uu *UserUpdate) AddFollowingIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) AddFriendIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) AddFriends(u ...*User) *UserUpdate + func (uu *UserUpdate) ClearChildren() *UserUpdate + func (uu *UserUpdate) ClearFollowers() *UserUpdate + func (uu *UserUpdate) ClearFollowing() *UserUpdate + func (uu *UserUpdate) ClearFriends() *UserUpdate + func (uu *UserUpdate) ClearParent() *UserUpdate + func (uu *UserUpdate) Exec(ctx context.Context) error + func (uu *UserUpdate) ExecX(ctx context.Context) + func (uu *UserUpdate) Mutation() *UserMutation + func (uu *UserUpdate) RemoveChildIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) RemoveChildren(u ...*User) *UserUpdate + func (uu *UserUpdate) RemoveFollowerIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) RemoveFollowers(u ...*User) *UserUpdate + func (uu *UserUpdate) RemoveFollowing(u ...*User) *UserUpdate + func (uu *UserUpdate) RemoveFollowingIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) RemoveFriendIDs(ids ...int) *UserUpdate + func (uu *UserUpdate) RemoveFriends(u ...*User) *UserUpdate + func (uu *UserUpdate) Save(ctx context.Context) (int, error) + func (uu *UserUpdate) SaveX(ctx context.Context) int + func (uu *UserUpdate) SetNillableParentID(id *int) *UserUpdate + func (uu *UserUpdate) SetParent(u *User) *UserUpdate + func (uu *UserUpdate) SetParentID(id int) *UserUpdate + func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate + type UserUpdateOne struct + func (uuo *UserUpdateOne) AddChildIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) AddChildren(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) AddFollowerIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) AddFollowers(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) AddFollowing(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) AddFollowingIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) AddFriendIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) AddFriends(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) ClearChildren() *UserUpdateOne + func (uuo *UserUpdateOne) ClearFollowers() *UserUpdateOne + func (uuo *UserUpdateOne) ClearFollowing() *UserUpdateOne + func (uuo *UserUpdateOne) ClearFriends() *UserUpdateOne + func (uuo *UserUpdateOne) ClearParent() *UserUpdateOne + func (uuo *UserUpdateOne) Exec(ctx context.Context) error + func (uuo *UserUpdateOne) ExecX(ctx context.Context) + func (uuo *UserUpdateOne) Mutation() *UserMutation + func (uuo *UserUpdateOne) RemoveChildIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveChildren(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFollowerIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFollowers(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFollowing(u ...*User) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFollowingIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFriendIDs(ids ...int) *UserUpdateOne + func (uuo *UserUpdateOne) RemoveFriends(u ...*User) *UserUpdateOne + 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) SetNillableParentID(id *int) *UserUpdateOne + func (uuo *UserUpdateOne) SetParent(u *User) *UserUpdateOne + func (uuo *UserUpdateOne) SetParentID(id int) *UserUpdateOne + type Users []*User + type ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value