Documentation ¶
Index ¶
- Constants
- 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
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type Menu
- type MenuClient
- func (c *MenuClient) Create() *MenuCreate
- func (c *MenuClient) CreateBulk(builders ...*MenuCreate) *MenuCreateBulk
- func (c *MenuClient) Delete() *MenuDelete
- func (c *MenuClient) DeleteOne(m *Menu) *MenuDeleteOne
- func (c *MenuClient) DeleteOneID(id int64) *MenuDeleteOne
- func (c *MenuClient) Get(ctx context.Context, id int64) (*Menu, error)
- func (c *MenuClient) GetX(ctx context.Context, id int64) *Menu
- func (c *MenuClient) Hooks() []Hook
- func (c *MenuClient) Query() *MenuQuery
- func (c *MenuClient) QueryChildren(m *Menu) *MenuQuery
- func (c *MenuClient) QueryOwner(m *Menu) *RoleQuery
- func (c *MenuClient) QueryParent(m *Menu) *MenuQuery
- func (c *MenuClient) Update() *MenuUpdate
- func (c *MenuClient) UpdateOne(m *Menu) *MenuUpdateOne
- func (c *MenuClient) UpdateOneID(id int64) *MenuUpdateOne
- func (c *MenuClient) Use(hooks ...Hook)
- type MenuCreate
- func (mc *MenuCreate) AddChildIDs(ids ...int64) *MenuCreate
- func (mc *MenuCreate) AddChildren(m ...*Menu) *MenuCreate
- func (mc *MenuCreate) Exec(ctx context.Context) error
- func (mc *MenuCreate) ExecX(ctx context.Context)
- func (mc *MenuCreate) Mutation() *MenuMutation
- func (mc *MenuCreate) Save(ctx context.Context) (*Menu, error)
- func (mc *MenuCreate) SaveX(ctx context.Context) *Menu
- func (mc *MenuCreate) SetCreatedAt(t time.Time) *MenuCreate
- func (mc *MenuCreate) SetDeletedAt(t time.Time) *MenuCreate
- func (mc *MenuCreate) SetEnable(s string) *MenuCreate
- func (mc *MenuCreate) SetID(i int64) *MenuCreate
- func (mc *MenuCreate) SetIcon(s string) *MenuCreate
- func (mc *MenuCreate) SetName(s string) *MenuCreate
- func (mc *MenuCreate) SetNillableCreatedAt(t *time.Time) *MenuCreate
- func (mc *MenuCreate) SetNillableDeletedAt(t *time.Time) *MenuCreate
- func (mc *MenuCreate) SetNillableEnable(s *string) *MenuCreate
- func (mc *MenuCreate) SetNillableIcon(s *string) *MenuCreate
- func (mc *MenuCreate) SetNillableOwnerID(id *int64) *MenuCreate
- func (mc *MenuCreate) SetNillableParentID(id *int64) *MenuCreate
- func (mc *MenuCreate) SetNillablePath(s *string) *MenuCreate
- func (mc *MenuCreate) SetNillableSort(i *int) *MenuCreate
- func (mc *MenuCreate) SetNillableType(s *string) *MenuCreate
- func (mc *MenuCreate) SetNillableUpdatedAt(t *time.Time) *MenuCreate
- func (mc *MenuCreate) SetOwner(r *Role) *MenuCreate
- func (mc *MenuCreate) SetOwnerID(id int64) *MenuCreate
- func (mc *MenuCreate) SetParent(m *Menu) *MenuCreate
- func (mc *MenuCreate) SetParentID(id int64) *MenuCreate
- func (mc *MenuCreate) SetPath(s string) *MenuCreate
- func (mc *MenuCreate) SetPermission(s string) *MenuCreate
- func (mc *MenuCreate) SetSort(i int) *MenuCreate
- func (mc *MenuCreate) SetType(s string) *MenuCreate
- func (mc *MenuCreate) SetUpdatedAt(t time.Time) *MenuCreate
- type MenuCreateBulk
- type MenuDelete
- type MenuDeleteOne
- type MenuEdges
- type MenuGroupBy
- func (mgb *MenuGroupBy) Aggregate(fns ...AggregateFunc) *MenuGroupBy
- func (mgb *MenuGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (mgb *MenuGroupBy) BoolX(ctx context.Context) bool
- func (mgb *MenuGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (mgb *MenuGroupBy) BoolsX(ctx context.Context) []bool
- func (mgb *MenuGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (mgb *MenuGroupBy) Float64X(ctx context.Context) float64
- func (mgb *MenuGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (mgb *MenuGroupBy) Float64sX(ctx context.Context) []float64
- func (mgb *MenuGroupBy) Int(ctx context.Context) (_ int, err error)
- func (mgb *MenuGroupBy) IntX(ctx context.Context) int
- func (mgb *MenuGroupBy) Ints(ctx context.Context) ([]int, error)
- func (mgb *MenuGroupBy) IntsX(ctx context.Context) []int
- func (mgb *MenuGroupBy) Scan(ctx context.Context, v interface{}) error
- func (mgb *MenuGroupBy) ScanX(ctx context.Context, v interface{})
- func (mgb *MenuGroupBy) String(ctx context.Context) (_ string, err error)
- func (mgb *MenuGroupBy) StringX(ctx context.Context) string
- func (mgb *MenuGroupBy) Strings(ctx context.Context) ([]string, error)
- func (mgb *MenuGroupBy) StringsX(ctx context.Context) []string
- type MenuMutation
- func (m *MenuMutation) AddChildIDs(ids ...int64)
- func (m *MenuMutation) AddField(name string, value ent.Value) error
- func (m *MenuMutation) AddSort(i int)
- func (m *MenuMutation) AddedEdges() []string
- func (m *MenuMutation) AddedField(name string) (ent.Value, bool)
- func (m *MenuMutation) AddedFields() []string
- func (m *MenuMutation) AddedIDs(name string) []ent.Value
- func (m *MenuMutation) AddedSort() (r int, exists bool)
- func (m *MenuMutation) ChildrenCleared() bool
- func (m *MenuMutation) ChildrenIDs() (ids []int64)
- func (m *MenuMutation) ClearChildren()
- func (m *MenuMutation) ClearDeletedAt()
- func (m *MenuMutation) ClearEdge(name string) error
- func (m *MenuMutation) ClearField(name string) error
- func (m *MenuMutation) ClearIcon()
- func (m *MenuMutation) ClearOwner()
- func (m *MenuMutation) ClearParent()
- func (m *MenuMutation) ClearPath()
- func (m *MenuMutation) ClearType()
- func (m *MenuMutation) ClearedEdges() []string
- func (m *MenuMutation) ClearedFields() []string
- func (m MenuMutation) Client() *Client
- func (m *MenuMutation) CreatedAt() (r time.Time, exists bool)
- func (m *MenuMutation) DeletedAt() (r time.Time, exists bool)
- func (m *MenuMutation) DeletedAtCleared() bool
- func (m *MenuMutation) EdgeCleared(name string) bool
- func (m *MenuMutation) Enable() (r string, exists bool)
- func (m *MenuMutation) Field(name string) (ent.Value, bool)
- func (m *MenuMutation) FieldCleared(name string) bool
- func (m *MenuMutation) Fields() []string
- func (m *MenuMutation) GetType() (r string, exists bool)
- func (m *MenuMutation) ID() (id int64, exists bool)
- func (m *MenuMutation) Icon() (r string, exists bool)
- func (m *MenuMutation) IconCleared() bool
- func (m *MenuMutation) Name() (r string, exists bool)
- func (m *MenuMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *MenuMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)
- func (m *MenuMutation) OldEnable(ctx context.Context) (v string, err error)
- func (m *MenuMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *MenuMutation) OldIcon(ctx context.Context) (v *string, err error)
- func (m *MenuMutation) OldName(ctx context.Context) (v string, err error)
- func (m *MenuMutation) OldPath(ctx context.Context) (v *string, err error)
- func (m *MenuMutation) OldPermission(ctx context.Context) (v string, err error)
- func (m *MenuMutation) OldSort(ctx context.Context) (v int, err error)
- func (m *MenuMutation) OldType(ctx context.Context) (v *string, err error)
- func (m *MenuMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *MenuMutation) Op() Op
- func (m *MenuMutation) OwnerCleared() bool
- func (m *MenuMutation) OwnerID() (id int64, exists bool)
- func (m *MenuMutation) OwnerIDs() (ids []int64)
- func (m *MenuMutation) ParentCleared() bool
- func (m *MenuMutation) ParentID() (id int64, exists bool)
- func (m *MenuMutation) ParentIDs() (ids []int64)
- func (m *MenuMutation) Path() (r string, exists bool)
- func (m *MenuMutation) PathCleared() bool
- func (m *MenuMutation) Permission() (r string, exists bool)
- func (m *MenuMutation) RemoveChildIDs(ids ...int64)
- func (m *MenuMutation) RemovedChildrenIDs() (ids []int64)
- func (m *MenuMutation) RemovedEdges() []string
- func (m *MenuMutation) RemovedIDs(name string) []ent.Value
- func (m *MenuMutation) ResetChildren()
- func (m *MenuMutation) ResetCreatedAt()
- func (m *MenuMutation) ResetDeletedAt()
- func (m *MenuMutation) ResetEdge(name string) error
- func (m *MenuMutation) ResetEnable()
- func (m *MenuMutation) ResetField(name string) error
- func (m *MenuMutation) ResetIcon()
- func (m *MenuMutation) ResetName()
- func (m *MenuMutation) ResetOwner()
- func (m *MenuMutation) ResetParent()
- func (m *MenuMutation) ResetPath()
- func (m *MenuMutation) ResetPermission()
- func (m *MenuMutation) ResetSort()
- func (m *MenuMutation) ResetType()
- func (m *MenuMutation) ResetUpdatedAt()
- func (m *MenuMutation) SetCreatedAt(t time.Time)
- func (m *MenuMutation) SetDeletedAt(t time.Time)
- func (m *MenuMutation) SetEnable(s string)
- func (m *MenuMutation) SetField(name string, value ent.Value) error
- func (m *MenuMutation) SetID(id int64)
- func (m *MenuMutation) SetIcon(s string)
- func (m *MenuMutation) SetName(s string)
- func (m *MenuMutation) SetOwnerID(id int64)
- func (m *MenuMutation) SetParentID(id int64)
- func (m *MenuMutation) SetPath(s string)
- func (m *MenuMutation) SetPermission(s string)
- func (m *MenuMutation) SetSort(i int)
- func (m *MenuMutation) SetType(s string)
- func (m *MenuMutation) SetUpdatedAt(t time.Time)
- func (m *MenuMutation) Sort() (r int, exists bool)
- func (m MenuMutation) Tx() (*Tx, error)
- func (m *MenuMutation) Type() string
- func (m *MenuMutation) TypeCleared() bool
- func (m *MenuMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *MenuMutation) Where(ps ...predicate.Menu)
- type MenuQuery
- func (mq *MenuQuery) All(ctx context.Context) ([]*Menu, error)
- func (mq *MenuQuery) AllX(ctx context.Context) []*Menu
- func (mq *MenuQuery) Clone() *MenuQuery
- func (mq *MenuQuery) Count(ctx context.Context) (int, error)
- func (mq *MenuQuery) CountX(ctx context.Context) int
- func (mq *MenuQuery) Exist(ctx context.Context) (bool, error)
- func (mq *MenuQuery) ExistX(ctx context.Context) bool
- func (mq *MenuQuery) First(ctx context.Context) (*Menu, error)
- func (mq *MenuQuery) FirstID(ctx context.Context) (id int64, err error)
- func (mq *MenuQuery) FirstIDX(ctx context.Context) int64
- func (mq *MenuQuery) FirstX(ctx context.Context) *Menu
- func (mq *MenuQuery) GroupBy(field string, fields ...string) *MenuGroupBy
- func (mq *MenuQuery) IDs(ctx context.Context) ([]int64, error)
- func (mq *MenuQuery) IDsX(ctx context.Context) []int64
- func (mq *MenuQuery) Limit(limit int) *MenuQuery
- func (mq *MenuQuery) Offset(offset int) *MenuQuery
- func (mq *MenuQuery) Only(ctx context.Context) (*Menu, error)
- func (mq *MenuQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (mq *MenuQuery) OnlyIDX(ctx context.Context) int64
- func (mq *MenuQuery) OnlyX(ctx context.Context) *Menu
- func (mq *MenuQuery) Order(o ...OrderFunc) *MenuQuery
- func (mq *MenuQuery) QueryChildren() *MenuQuery
- func (mq *MenuQuery) QueryOwner() *RoleQuery
- func (mq *MenuQuery) QueryParent() *MenuQuery
- func (mq *MenuQuery) Select(fields ...string) *MenuSelect
- func (mq *MenuQuery) Unique(unique bool) *MenuQuery
- func (mq *MenuQuery) Where(ps ...predicate.Menu) *MenuQuery
- func (mq *MenuQuery) WithChildren(opts ...func(*MenuQuery)) *MenuQuery
- func (mq *MenuQuery) WithOwner(opts ...func(*RoleQuery)) *MenuQuery
- func (mq *MenuQuery) WithParent(opts ...func(*MenuQuery)) *MenuQuery
- type MenuSelect
- func (ms *MenuSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ms *MenuSelect) BoolX(ctx context.Context) bool
- func (ms *MenuSelect) Bools(ctx context.Context) ([]bool, error)
- func (ms *MenuSelect) BoolsX(ctx context.Context) []bool
- func (ms *MenuSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ms *MenuSelect) Float64X(ctx context.Context) float64
- func (ms *MenuSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ms *MenuSelect) Float64sX(ctx context.Context) []float64
- func (ms *MenuSelect) Int(ctx context.Context) (_ int, err error)
- func (ms *MenuSelect) IntX(ctx context.Context) int
- func (ms *MenuSelect) Ints(ctx context.Context) ([]int, error)
- func (ms *MenuSelect) IntsX(ctx context.Context) []int
- func (ms *MenuSelect) Scan(ctx context.Context, v interface{}) error
- func (ms *MenuSelect) ScanX(ctx context.Context, v interface{})
- func (ms *MenuSelect) String(ctx context.Context) (_ string, err error)
- func (ms *MenuSelect) StringX(ctx context.Context) string
- func (ms *MenuSelect) Strings(ctx context.Context) ([]string, error)
- func (ms *MenuSelect) StringsX(ctx context.Context) []string
- type MenuUpdate
- func (mu *MenuUpdate) AddChildIDs(ids ...int64) *MenuUpdate
- func (mu *MenuUpdate) AddChildren(m ...*Menu) *MenuUpdate
- func (mu *MenuUpdate) AddSort(i int) *MenuUpdate
- func (mu *MenuUpdate) ClearChildren() *MenuUpdate
- func (mu *MenuUpdate) ClearDeletedAt() *MenuUpdate
- func (mu *MenuUpdate) ClearIcon() *MenuUpdate
- func (mu *MenuUpdate) ClearOwner() *MenuUpdate
- func (mu *MenuUpdate) ClearParent() *MenuUpdate
- func (mu *MenuUpdate) ClearPath() *MenuUpdate
- func (mu *MenuUpdate) ClearType() *MenuUpdate
- func (mu *MenuUpdate) Exec(ctx context.Context) error
- func (mu *MenuUpdate) ExecX(ctx context.Context)
- func (mu *MenuUpdate) Mutation() *MenuMutation
- func (mu *MenuUpdate) RemoveChildIDs(ids ...int64) *MenuUpdate
- func (mu *MenuUpdate) RemoveChildren(m ...*Menu) *MenuUpdate
- func (mu *MenuUpdate) Save(ctx context.Context) (int, error)
- func (mu *MenuUpdate) SaveX(ctx context.Context) int
- func (mu *MenuUpdate) SetDeletedAt(t time.Time) *MenuUpdate
- func (mu *MenuUpdate) SetEnable(s string) *MenuUpdate
- func (mu *MenuUpdate) SetIcon(s string) *MenuUpdate
- func (mu *MenuUpdate) SetName(s string) *MenuUpdate
- func (mu *MenuUpdate) SetNillableEnable(s *string) *MenuUpdate
- func (mu *MenuUpdate) SetNillableIcon(s *string) *MenuUpdate
- func (mu *MenuUpdate) SetNillableOwnerID(id *int64) *MenuUpdate
- func (mu *MenuUpdate) SetNillableParentID(id *int64) *MenuUpdate
- func (mu *MenuUpdate) SetNillablePath(s *string) *MenuUpdate
- func (mu *MenuUpdate) SetNillableSort(i *int) *MenuUpdate
- func (mu *MenuUpdate) SetNillableType(s *string) *MenuUpdate
- func (mu *MenuUpdate) SetOwner(r *Role) *MenuUpdate
- func (mu *MenuUpdate) SetOwnerID(id int64) *MenuUpdate
- func (mu *MenuUpdate) SetParent(m *Menu) *MenuUpdate
- func (mu *MenuUpdate) SetParentID(id int64) *MenuUpdate
- func (mu *MenuUpdate) SetPath(s string) *MenuUpdate
- func (mu *MenuUpdate) SetPermission(s string) *MenuUpdate
- func (mu *MenuUpdate) SetSort(i int) *MenuUpdate
- func (mu *MenuUpdate) SetType(s string) *MenuUpdate
- func (mu *MenuUpdate) SetUpdatedAt(t time.Time) *MenuUpdate
- func (mu *MenuUpdate) Where(ps ...predicate.Menu) *MenuUpdate
- type MenuUpdateOne
- func (muo *MenuUpdateOne) AddChildIDs(ids ...int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) AddChildren(m ...*Menu) *MenuUpdateOne
- func (muo *MenuUpdateOne) AddSort(i int) *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearChildren() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearDeletedAt() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearIcon() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearOwner() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearParent() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearPath() *MenuUpdateOne
- func (muo *MenuUpdateOne) ClearType() *MenuUpdateOne
- func (muo *MenuUpdateOne) Exec(ctx context.Context) error
- func (muo *MenuUpdateOne) ExecX(ctx context.Context)
- func (muo *MenuUpdateOne) Mutation() *MenuMutation
- func (muo *MenuUpdateOne) RemoveChildIDs(ids ...int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) RemoveChildren(m ...*Menu) *MenuUpdateOne
- func (muo *MenuUpdateOne) Save(ctx context.Context) (*Menu, error)
- func (muo *MenuUpdateOne) SaveX(ctx context.Context) *Menu
- func (muo *MenuUpdateOne) Select(field string, fields ...string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetDeletedAt(t time.Time) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetEnable(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetIcon(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetName(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableEnable(s *string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableIcon(s *string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableOwnerID(id *int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableParentID(id *int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillablePath(s *string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableSort(i *int) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetNillableType(s *string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetOwner(r *Role) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetOwnerID(id int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetParent(m *Menu) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetParentID(id int64) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetPath(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetPermission(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetSort(i int) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetType(s string) *MenuUpdateOne
- func (muo *MenuUpdateOne) SetUpdatedAt(t time.Time) *MenuUpdateOne
- type Menus
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type Role
- type RoleClient
- func (c *RoleClient) Create() *RoleCreate
- func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk
- func (c *RoleClient) Delete() *RoleDelete
- func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne
- func (c *RoleClient) DeleteOneID(id int64) *RoleDeleteOne
- func (c *RoleClient) Get(ctx context.Context, id int64) (*Role, error)
- func (c *RoleClient) GetX(ctx context.Context, id int64) *Role
- func (c *RoleClient) Hooks() []Hook
- func (c *RoleClient) Query() *RoleQuery
- func (c *RoleClient) QueryMenu(r *Role) *MenuQuery
- func (c *RoleClient) QueryUser(r *Role) *UserQuery
- func (c *RoleClient) Update() *RoleUpdate
- func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne
- func (c *RoleClient) UpdateOneID(id int64) *RoleUpdateOne
- func (c *RoleClient) Use(hooks ...Hook)
- type RoleCreate
- func (rc *RoleCreate) AddMenu(m ...*Menu) *RoleCreate
- func (rc *RoleCreate) AddMenuIDs(ids ...int64) *RoleCreate
- func (rc *RoleCreate) AddUser(u ...*User) *RoleCreate
- func (rc *RoleCreate) AddUserIDs(ids ...int) *RoleCreate
- func (rc *RoleCreate) Exec(ctx context.Context) error
- func (rc *RoleCreate) ExecX(ctx context.Context)
- func (rc *RoleCreate) Mutation() *RoleMutation
- func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)
- func (rc *RoleCreate) SaveX(ctx context.Context) *Role
- func (rc *RoleCreate) SetComment(s string) *RoleCreate
- func (rc *RoleCreate) SetCreatedAt(t time.Time) *RoleCreate
- func (rc *RoleCreate) SetDeletedAt(t time.Time) *RoleCreate
- func (rc *RoleCreate) SetID(i int64) *RoleCreate
- func (rc *RoleCreate) SetKey(s string) *RoleCreate
- func (rc *RoleCreate) SetName(s string) *RoleCreate
- func (rc *RoleCreate) SetNillableComment(s *string) *RoleCreate
- func (rc *RoleCreate) SetNillableCreatedAt(t *time.Time) *RoleCreate
- func (rc *RoleCreate) SetNillableDeletedAt(t *time.Time) *RoleCreate
- func (rc *RoleCreate) SetNillableUpdatedAt(t *time.Time) *RoleCreate
- func (rc *RoleCreate) SetUpdatedAt(t time.Time) *RoleCreate
- type RoleCreateBulk
- type RoleDelete
- type RoleDeleteOne
- type RoleEdges
- type RoleGroupBy
- func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy
- func (rgb *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (rgb *RoleGroupBy) BoolX(ctx context.Context) bool
- func (rgb *RoleGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (rgb *RoleGroupBy) BoolsX(ctx context.Context) []bool
- func (rgb *RoleGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (rgb *RoleGroupBy) Float64X(ctx context.Context) float64
- func (rgb *RoleGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (rgb *RoleGroupBy) Float64sX(ctx context.Context) []float64
- func (rgb *RoleGroupBy) Int(ctx context.Context) (_ int, err error)
- func (rgb *RoleGroupBy) IntX(ctx context.Context) int
- func (rgb *RoleGroupBy) Ints(ctx context.Context) ([]int, error)
- func (rgb *RoleGroupBy) IntsX(ctx context.Context) []int
- func (rgb *RoleGroupBy) Scan(ctx context.Context, v interface{}) error
- func (rgb *RoleGroupBy) ScanX(ctx context.Context, v interface{})
- func (rgb *RoleGroupBy) String(ctx context.Context) (_ string, err error)
- func (rgb *RoleGroupBy) StringX(ctx context.Context) string
- func (rgb *RoleGroupBy) Strings(ctx context.Context) ([]string, error)
- func (rgb *RoleGroupBy) StringsX(ctx context.Context) []string
- type RoleMutation
- func (m *RoleMutation) AddField(name string, value ent.Value) error
- func (m *RoleMutation) AddMenuIDs(ids ...int64)
- func (m *RoleMutation) AddUserIDs(ids ...int)
- func (m *RoleMutation) AddedEdges() []string
- func (m *RoleMutation) AddedField(name string) (ent.Value, bool)
- func (m *RoleMutation) AddedFields() []string
- func (m *RoleMutation) AddedIDs(name string) []ent.Value
- func (m *RoleMutation) ClearComment()
- func (m *RoleMutation) ClearDeletedAt()
- func (m *RoleMutation) ClearEdge(name string) error
- func (m *RoleMutation) ClearField(name string) error
- func (m *RoleMutation) ClearMenu()
- func (m *RoleMutation) ClearUser()
- func (m *RoleMutation) ClearedEdges() []string
- func (m *RoleMutation) ClearedFields() []string
- func (m RoleMutation) Client() *Client
- func (m *RoleMutation) Comment() (r string, exists bool)
- func (m *RoleMutation) CommentCleared() bool
- func (m *RoleMutation) CreatedAt() (r time.Time, exists bool)
- func (m *RoleMutation) DeletedAt() (r time.Time, exists bool)
- func (m *RoleMutation) DeletedAtCleared() bool
- func (m *RoleMutation) EdgeCleared(name string) bool
- func (m *RoleMutation) Field(name string) (ent.Value, bool)
- func (m *RoleMutation) FieldCleared(name string) bool
- func (m *RoleMutation) Fields() []string
- func (m *RoleMutation) ID() (id int64, exists bool)
- func (m *RoleMutation) Key() (r string, exists bool)
- func (m *RoleMutation) MenuCleared() bool
- func (m *RoleMutation) MenuIDs() (ids []int64)
- func (m *RoleMutation) Name() (r string, exists bool)
- func (m *RoleMutation) OldComment(ctx context.Context) (v *string, err error)
- func (m *RoleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *RoleMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)
- func (m *RoleMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *RoleMutation) OldKey(ctx context.Context) (v string, err error)
- func (m *RoleMutation) OldName(ctx context.Context) (v string, err error)
- func (m *RoleMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *RoleMutation) Op() Op
- func (m *RoleMutation) RemoveMenuIDs(ids ...int64)
- func (m *RoleMutation) RemoveUserIDs(ids ...int)
- func (m *RoleMutation) RemovedEdges() []string
- func (m *RoleMutation) RemovedIDs(name string) []ent.Value
- func (m *RoleMutation) RemovedMenuIDs() (ids []int64)
- func (m *RoleMutation) RemovedUserIDs() (ids []int)
- func (m *RoleMutation) ResetComment()
- func (m *RoleMutation) ResetCreatedAt()
- func (m *RoleMutation) ResetDeletedAt()
- func (m *RoleMutation) ResetEdge(name string) error
- func (m *RoleMutation) ResetField(name string) error
- func (m *RoleMutation) ResetKey()
- func (m *RoleMutation) ResetMenu()
- func (m *RoleMutation) ResetName()
- func (m *RoleMutation) ResetUpdatedAt()
- func (m *RoleMutation) ResetUser()
- func (m *RoleMutation) SetComment(s string)
- func (m *RoleMutation) SetCreatedAt(t time.Time)
- func (m *RoleMutation) SetDeletedAt(t time.Time)
- func (m *RoleMutation) SetField(name string, value ent.Value) error
- func (m *RoleMutation) SetID(id int64)
- func (m *RoleMutation) SetKey(s string)
- func (m *RoleMutation) SetName(s string)
- func (m *RoleMutation) SetUpdatedAt(t time.Time)
- func (m RoleMutation) Tx() (*Tx, error)
- func (m *RoleMutation) Type() string
- func (m *RoleMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *RoleMutation) UserCleared() bool
- func (m *RoleMutation) UserIDs() (ids []int)
- func (m *RoleMutation) Where(ps ...predicate.Role)
- type RoleQuery
- func (rq *RoleQuery) All(ctx context.Context) ([]*Role, error)
- func (rq *RoleQuery) AllX(ctx context.Context) []*Role
- func (rq *RoleQuery) Clone() *RoleQuery
- func (rq *RoleQuery) Count(ctx context.Context) (int, error)
- func (rq *RoleQuery) CountX(ctx context.Context) int
- func (rq *RoleQuery) Exist(ctx context.Context) (bool, error)
- func (rq *RoleQuery) ExistX(ctx context.Context) bool
- func (rq *RoleQuery) First(ctx context.Context) (*Role, error)
- func (rq *RoleQuery) FirstID(ctx context.Context) (id int64, err error)
- func (rq *RoleQuery) FirstIDX(ctx context.Context) int64
- func (rq *RoleQuery) FirstX(ctx context.Context) *Role
- func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy
- func (rq *RoleQuery) IDs(ctx context.Context) ([]int64, error)
- func (rq *RoleQuery) IDsX(ctx context.Context) []int64
- func (rq *RoleQuery) Limit(limit int) *RoleQuery
- func (rq *RoleQuery) Offset(offset int) *RoleQuery
- func (rq *RoleQuery) Only(ctx context.Context) (*Role, error)
- func (rq *RoleQuery) OnlyID(ctx context.Context) (id int64, err error)
- func (rq *RoleQuery) OnlyIDX(ctx context.Context) int64
- func (rq *RoleQuery) OnlyX(ctx context.Context) *Role
- func (rq *RoleQuery) Order(o ...OrderFunc) *RoleQuery
- func (rq *RoleQuery) QueryMenu() *MenuQuery
- func (rq *RoleQuery) QueryUser() *UserQuery
- func (rq *RoleQuery) Select(fields ...string) *RoleSelect
- func (rq *RoleQuery) Unique(unique bool) *RoleQuery
- func (rq *RoleQuery) Where(ps ...predicate.Role) *RoleQuery
- func (rq *RoleQuery) WithMenu(opts ...func(*MenuQuery)) *RoleQuery
- func (rq *RoleQuery) WithUser(opts ...func(*UserQuery)) *RoleQuery
- type RoleSelect
- func (rs *RoleSelect) Bool(ctx context.Context) (_ bool, err error)
- func (rs *RoleSelect) BoolX(ctx context.Context) bool
- func (rs *RoleSelect) Bools(ctx context.Context) ([]bool, error)
- func (rs *RoleSelect) BoolsX(ctx context.Context) []bool
- func (rs *RoleSelect) Float64(ctx context.Context) (_ float64, err error)
- func (rs *RoleSelect) Float64X(ctx context.Context) float64
- func (rs *RoleSelect) Float64s(ctx context.Context) ([]float64, error)
- func (rs *RoleSelect) Float64sX(ctx context.Context) []float64
- func (rs *RoleSelect) Int(ctx context.Context) (_ int, err error)
- func (rs *RoleSelect) IntX(ctx context.Context) int
- func (rs *RoleSelect) Ints(ctx context.Context) ([]int, error)
- func (rs *RoleSelect) IntsX(ctx context.Context) []int
- func (rs *RoleSelect) Scan(ctx context.Context, v interface{}) error
- func (rs *RoleSelect) ScanX(ctx context.Context, v interface{})
- func (rs *RoleSelect) String(ctx context.Context) (_ string, err error)
- func (rs *RoleSelect) StringX(ctx context.Context) string
- func (rs *RoleSelect) Strings(ctx context.Context) ([]string, error)
- func (rs *RoleSelect) StringsX(ctx context.Context) []string
- type RoleUpdate
- func (ru *RoleUpdate) AddMenu(m ...*Menu) *RoleUpdate
- func (ru *RoleUpdate) AddMenuIDs(ids ...int64) *RoleUpdate
- func (ru *RoleUpdate) AddUser(u ...*User) *RoleUpdate
- func (ru *RoleUpdate) AddUserIDs(ids ...int) *RoleUpdate
- func (ru *RoleUpdate) ClearComment() *RoleUpdate
- func (ru *RoleUpdate) ClearDeletedAt() *RoleUpdate
- func (ru *RoleUpdate) ClearMenu() *RoleUpdate
- func (ru *RoleUpdate) ClearUser() *RoleUpdate
- func (ru *RoleUpdate) Exec(ctx context.Context) error
- func (ru *RoleUpdate) ExecX(ctx context.Context)
- func (ru *RoleUpdate) Mutation() *RoleMutation
- func (ru *RoleUpdate) RemoveMenu(m ...*Menu) *RoleUpdate
- func (ru *RoleUpdate) RemoveMenuIDs(ids ...int64) *RoleUpdate
- func (ru *RoleUpdate) RemoveUser(u ...*User) *RoleUpdate
- func (ru *RoleUpdate) RemoveUserIDs(ids ...int) *RoleUpdate
- func (ru *RoleUpdate) Save(ctx context.Context) (int, error)
- func (ru *RoleUpdate) SaveX(ctx context.Context) int
- func (ru *RoleUpdate) SetComment(s string) *RoleUpdate
- func (ru *RoleUpdate) SetDeletedAt(t time.Time) *RoleUpdate
- func (ru *RoleUpdate) SetKey(s string) *RoleUpdate
- func (ru *RoleUpdate) SetName(s string) *RoleUpdate
- func (ru *RoleUpdate) SetNillableComment(s *string) *RoleUpdate
- func (ru *RoleUpdate) SetUpdatedAt(t time.Time) *RoleUpdate
- func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate
- type RoleUpdateOne
- func (ruo *RoleUpdateOne) AddMenu(m ...*Menu) *RoleUpdateOne
- func (ruo *RoleUpdateOne) AddMenuIDs(ids ...int64) *RoleUpdateOne
- func (ruo *RoleUpdateOne) AddUser(u ...*User) *RoleUpdateOne
- func (ruo *RoleUpdateOne) AddUserIDs(ids ...int) *RoleUpdateOne
- func (ruo *RoleUpdateOne) ClearComment() *RoleUpdateOne
- func (ruo *RoleUpdateOne) ClearDeletedAt() *RoleUpdateOne
- func (ruo *RoleUpdateOne) ClearMenu() *RoleUpdateOne
- func (ruo *RoleUpdateOne) ClearUser() *RoleUpdateOne
- func (ruo *RoleUpdateOne) Exec(ctx context.Context) error
- func (ruo *RoleUpdateOne) ExecX(ctx context.Context)
- func (ruo *RoleUpdateOne) Mutation() *RoleMutation
- func (ruo *RoleUpdateOne) RemoveMenu(m ...*Menu) *RoleUpdateOne
- func (ruo *RoleUpdateOne) RemoveMenuIDs(ids ...int64) *RoleUpdateOne
- func (ruo *RoleUpdateOne) RemoveUser(u ...*User) *RoleUpdateOne
- func (ruo *RoleUpdateOne) RemoveUserIDs(ids ...int) *RoleUpdateOne
- func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)
- func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role
- func (ruo *RoleUpdateOne) Select(field string, fields ...string) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetComment(s string) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetDeletedAt(t time.Time) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetKey(s string) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetNillableComment(s *string) *RoleUpdateOne
- func (ruo *RoleUpdateOne) SetUpdatedAt(t time.Time) *RoleUpdateOne
- type Roles
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- 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(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) QueryRole(u *User) *RoleQuery
- 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
- func (uc *UserCreate) AddRole(r ...*Role) *UserCreate
- func (uc *UserCreate) AddRoleIDs(ids ...int64) *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) SetCreatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetID(i int) *UserCreate
- func (uc *UserCreate) SetNickName(s string) *UserCreate
- func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableNickName(s *string) *UserCreate
- func (uc *UserCreate) SetNillablePassword(s *string) *UserCreate
- func (uc *UserCreate) SetNillablePhone(s *string) *UserCreate
- func (uc *UserCreate) SetNillableStatus(s *string) *UserCreate
- func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetPhone(s string) *UserCreate
- func (uc *UserCreate) SetStatus(s string) *UserCreate
- func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetUsername(s string) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserEdges
- type UserGroupBy
- 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
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddRoleIDs(ids ...int64)
- 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) ClearDeletedAt()
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearNickName()
- func (m *UserMutation) ClearPassword()
- func (m *UserMutation) ClearPhone()
- func (m *UserMutation) ClearRole()
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
- func (m *UserMutation) DeletedAt() (r time.Time, exists bool)
- func (m *UserMutation) DeletedAtCleared() bool
- 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) ID() (id int, exists bool)
- func (m *UserMutation) NickName() (r string, exists bool)
- func (m *UserMutation) NickNameCleared() bool
- func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldNickName(ctx context.Context) (v *string, err error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v *string, err error)
- func (m *UserMutation) OldPhone(ctx context.Context) (v *string, err error)
- func (m *UserMutation) OldStatus(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) PasswordCleared() bool
- func (m *UserMutation) Phone() (r string, exists bool)
- func (m *UserMutation) PhoneCleared() bool
- func (m *UserMutation) RemoveRoleIDs(ids ...int64)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedRoleIDs() (ids []int64)
- func (m *UserMutation) ResetCreatedAt()
- func (m *UserMutation) ResetDeletedAt()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetNickName()
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetPhone()
- func (m *UserMutation) ResetRole()
- func (m *UserMutation) ResetStatus()
- func (m *UserMutation) ResetUpdatedAt()
- func (m *UserMutation) ResetUsername()
- func (m *UserMutation) RoleCleared() bool
- func (m *UserMutation) RoleIDs() (ids []int64)
- func (m *UserMutation) SetCreatedAt(t time.Time)
- func (m *UserMutation) SetDeletedAt(t time.Time)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetID(id int)
- func (m *UserMutation) SetNickName(s string)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetPhone(s string)
- func (m *UserMutation) SetStatus(s string)
- func (m *UserMutation) SetUpdatedAt(t time.Time)
- func (m *UserMutation) SetUsername(s string)
- func (m *UserMutation) Status() (r string, exists bool)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *UserMutation) Username() (r string, exists bool)
- func (m *UserMutation) Where(ps ...predicate.User)
- type UserQuery
- 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) QueryRole() *RoleQuery
- 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) WithRole(opts ...func(*RoleQuery)) *UserQuery
- type UserSelect
- 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
- func (uu *UserUpdate) AddRole(r ...*Role) *UserUpdate
- func (uu *UserUpdate) AddRoleIDs(ids ...int64) *UserUpdate
- func (uu *UserUpdate) ClearDeletedAt() *UserUpdate
- func (uu *UserUpdate) ClearNickName() *UserUpdate
- func (uu *UserUpdate) ClearPassword() *UserUpdate
- func (uu *UserUpdate) ClearPhone() *UserUpdate
- func (uu *UserUpdate) ClearRole() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveRole(r ...*Role) *UserUpdate
- func (uu *UserUpdate) RemoveRoleIDs(ids ...int64) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) SetNickName(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableNickName(s *string) *UserUpdate
- func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate
- func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate
- func (uu *UserUpdate) SetNillableStatus(s *string) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetPhone(s string) *UserUpdate
- func (uu *UserUpdate) SetStatus(s string) *UserUpdate
- func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) SetUsername(s string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddRole(r ...*Role) *UserUpdateOne
- func (uuo *UserUpdateOne) AddRoleIDs(ids ...int64) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearNickName() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearPassword() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearPhone() *UserUpdateOne
- func (uuo *UserUpdateOne) ClearRole() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveRole(r ...*Role) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveRoleIDs(ids ...int64) *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) SetDeletedAt(t time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNickName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableNickName(s *string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableStatus(s *string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetStatus(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
- type Users
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeMenu = "Menu" TypeRole = "Role" TypeUser = "User" )
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Menu is the client for interacting with the Menu builders. Menu *MenuClient // Role is the client for interacting with the Role builders. Role *RoleClient // 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 Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional 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(). Menu. 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(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 Menu ¶
type Menu struct { // ID of the ent. // 菜单id ID int64 `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. // 创建时间 CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. // 更新时间 UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. // 删除时间 DeletedAt *time.Time `json:"deleted_at,omitempty"` // Permission holds the value of the "permission" field. // 菜单权限标识 Permission string `json:"permission,omitempty"` // Path holds the value of the "path" field. // 前端url Path *string `json:"path,omitempty"` // Name holds the value of the "name" field. // 菜单名称 Name string `json:"name,omitempty"` // Icon holds the value of the "icon" field. // 图标 Icon *string `json:"icon,omitempty"` // Sort holds the value of the "sort" field. // 排序值 Sort int `json:"sort,omitempty"` // Enable holds the value of the "enable" field. // 0-开启,1-关闭 Enable string `json:"enable,omitempty"` // Type holds the value of the "type" field. // 菜单类型 0-菜单 1-按钮 Type *string `json:"type,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the MenuQuery when eager-loading is set. Edges MenuEdges `json:"edges"` // contains filtered or unexported fields }
Menu is the model entity for the Menu schema.
func (*Menu) QueryChildren ¶
QueryChildren queries the "children" edge of the Menu entity.
func (*Menu) QueryOwner ¶
QueryOwner queries the "owner" edge of the Menu entity.
func (*Menu) QueryParent ¶
QueryParent queries the "parent" edge of the Menu entity.
func (*Menu) Unwrap ¶
Unwrap unwraps the Menu 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 (*Menu) Update ¶
func (m *Menu) Update() *MenuUpdateOne
Update returns a builder for updating this Menu. Note that you need to call Menu.Unwrap() before calling this method if this Menu was returned from a transaction, and the transaction was committed or rolled back.
type MenuClient ¶
type MenuClient struct {
// contains filtered or unexported fields
}
MenuClient is a client for the Menu schema.
func NewMenuClient ¶
func NewMenuClient(c config) *MenuClient
NewMenuClient returns a client for the Menu from the given config.
func (*MenuClient) Create ¶
func (c *MenuClient) Create() *MenuCreate
Create returns a create builder for Menu.
func (*MenuClient) CreateBulk ¶
func (c *MenuClient) CreateBulk(builders ...*MenuCreate) *MenuCreateBulk
CreateBulk returns a builder for creating a bulk of Menu entities.
func (*MenuClient) Delete ¶
func (c *MenuClient) Delete() *MenuDelete
Delete returns a delete builder for Menu.
func (*MenuClient) DeleteOne ¶
func (c *MenuClient) DeleteOne(m *Menu) *MenuDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*MenuClient) DeleteOneID ¶
func (c *MenuClient) DeleteOneID(id int64) *MenuDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*MenuClient) GetX ¶
func (c *MenuClient) GetX(ctx context.Context, id int64) *Menu
GetX is like Get, but panics if an error occurs.
func (*MenuClient) Query ¶
func (c *MenuClient) Query() *MenuQuery
Query returns a query builder for Menu.
func (*MenuClient) QueryChildren ¶
func (c *MenuClient) QueryChildren(m *Menu) *MenuQuery
QueryChildren queries the children edge of a Menu.
func (*MenuClient) QueryOwner ¶
func (c *MenuClient) QueryOwner(m *Menu) *RoleQuery
QueryOwner queries the owner edge of a Menu.
func (*MenuClient) QueryParent ¶
func (c *MenuClient) QueryParent(m *Menu) *MenuQuery
QueryParent queries the parent edge of a Menu.
func (*MenuClient) Update ¶
func (c *MenuClient) Update() *MenuUpdate
Update returns an update builder for Menu.
func (*MenuClient) UpdateOne ¶
func (c *MenuClient) UpdateOne(m *Menu) *MenuUpdateOne
UpdateOne returns an update builder for the given entity.
func (*MenuClient) UpdateOneID ¶
func (c *MenuClient) UpdateOneID(id int64) *MenuUpdateOne
UpdateOneID returns an update builder for the given id.
func (*MenuClient) Use ¶
func (c *MenuClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `menu.Hooks(f(g(h())))`.
type MenuCreate ¶
type MenuCreate struct {
// contains filtered or unexported fields
}
MenuCreate is the builder for creating a Menu entity.
func (*MenuCreate) AddChildIDs ¶
func (mc *MenuCreate) AddChildIDs(ids ...int64) *MenuCreate
AddChildIDs adds the "children" edge to the Menu entity by IDs.
func (*MenuCreate) AddChildren ¶
func (mc *MenuCreate) AddChildren(m ...*Menu) *MenuCreate
AddChildren adds the "children" edges to the Menu entity.
func (*MenuCreate) Exec ¶
func (mc *MenuCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*MenuCreate) ExecX ¶
func (mc *MenuCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MenuCreate) Mutation ¶
func (mc *MenuCreate) Mutation() *MenuMutation
Mutation returns the MenuMutation object of the builder.
func (*MenuCreate) Save ¶
func (mc *MenuCreate) Save(ctx context.Context) (*Menu, error)
Save creates the Menu in the database.
func (*MenuCreate) SaveX ¶
func (mc *MenuCreate) SaveX(ctx context.Context) *Menu
SaveX calls Save and panics if Save returns an error.
func (*MenuCreate) SetCreatedAt ¶
func (mc *MenuCreate) SetCreatedAt(t time.Time) *MenuCreate
SetCreatedAt sets the "created_at" field.
func (*MenuCreate) SetDeletedAt ¶
func (mc *MenuCreate) SetDeletedAt(t time.Time) *MenuCreate
SetDeletedAt sets the "deleted_at" field.
func (*MenuCreate) SetEnable ¶
func (mc *MenuCreate) SetEnable(s string) *MenuCreate
SetEnable sets the "enable" field.
func (*MenuCreate) SetID ¶
func (mc *MenuCreate) SetID(i int64) *MenuCreate
SetID sets the "id" field.
func (*MenuCreate) SetIcon ¶
func (mc *MenuCreate) SetIcon(s string) *MenuCreate
SetIcon sets the "icon" field.
func (*MenuCreate) SetName ¶
func (mc *MenuCreate) SetName(s string) *MenuCreate
SetName sets the "name" field.
func (*MenuCreate) SetNillableCreatedAt ¶
func (mc *MenuCreate) SetNillableCreatedAt(t *time.Time) *MenuCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*MenuCreate) SetNillableDeletedAt ¶
func (mc *MenuCreate) SetNillableDeletedAt(t *time.Time) *MenuCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*MenuCreate) SetNillableEnable ¶
func (mc *MenuCreate) SetNillableEnable(s *string) *MenuCreate
SetNillableEnable sets the "enable" field if the given value is not nil.
func (*MenuCreate) SetNillableIcon ¶
func (mc *MenuCreate) SetNillableIcon(s *string) *MenuCreate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*MenuCreate) SetNillableOwnerID ¶
func (mc *MenuCreate) SetNillableOwnerID(id *int64) *MenuCreate
SetNillableOwnerID sets the "owner" edge to the Role entity by ID if the given value is not nil.
func (*MenuCreate) SetNillableParentID ¶
func (mc *MenuCreate) SetNillableParentID(id *int64) *MenuCreate
SetNillableParentID sets the "parent" edge to the Menu entity by ID if the given value is not nil.
func (*MenuCreate) SetNillablePath ¶
func (mc *MenuCreate) SetNillablePath(s *string) *MenuCreate
SetNillablePath sets the "path" field if the given value is not nil.
func (*MenuCreate) SetNillableSort ¶
func (mc *MenuCreate) SetNillableSort(i *int) *MenuCreate
SetNillableSort sets the "sort" field if the given value is not nil.
func (*MenuCreate) SetNillableType ¶
func (mc *MenuCreate) SetNillableType(s *string) *MenuCreate
SetNillableType sets the "type" field if the given value is not nil.
func (*MenuCreate) SetNillableUpdatedAt ¶
func (mc *MenuCreate) SetNillableUpdatedAt(t *time.Time) *MenuCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*MenuCreate) SetOwner ¶
func (mc *MenuCreate) SetOwner(r *Role) *MenuCreate
SetOwner sets the "owner" edge to the Role entity.
func (*MenuCreate) SetOwnerID ¶
func (mc *MenuCreate) SetOwnerID(id int64) *MenuCreate
SetOwnerID sets the "owner" edge to the Role entity by ID.
func (*MenuCreate) SetParent ¶
func (mc *MenuCreate) SetParent(m *Menu) *MenuCreate
SetParent sets the "parent" edge to the Menu entity.
func (*MenuCreate) SetParentID ¶
func (mc *MenuCreate) SetParentID(id int64) *MenuCreate
SetParentID sets the "parent" edge to the Menu entity by ID.
func (*MenuCreate) SetPath ¶
func (mc *MenuCreate) SetPath(s string) *MenuCreate
SetPath sets the "path" field.
func (*MenuCreate) SetPermission ¶
func (mc *MenuCreate) SetPermission(s string) *MenuCreate
SetPermission sets the "permission" field.
func (*MenuCreate) SetSort ¶
func (mc *MenuCreate) SetSort(i int) *MenuCreate
SetSort sets the "sort" field.
func (*MenuCreate) SetType ¶
func (mc *MenuCreate) SetType(s string) *MenuCreate
SetType sets the "type" field.
func (*MenuCreate) SetUpdatedAt ¶
func (mc *MenuCreate) SetUpdatedAt(t time.Time) *MenuCreate
SetUpdatedAt sets the "updated_at" field.
type MenuCreateBulk ¶
type MenuCreateBulk struct {
// contains filtered or unexported fields
}
MenuCreateBulk is the builder for creating many Menu entities in bulk.
func (*MenuCreateBulk) Exec ¶
func (mcb *MenuCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*MenuCreateBulk) ExecX ¶
func (mcb *MenuCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type MenuDelete ¶
type MenuDelete struct {
// contains filtered or unexported fields
}
MenuDelete is the builder for deleting a Menu entity.
func (*MenuDelete) Exec ¶
func (md *MenuDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*MenuDelete) ExecX ¶
func (md *MenuDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*MenuDelete) Where ¶
func (md *MenuDelete) Where(ps ...predicate.Menu) *MenuDelete
Where appends a list predicates to the MenuDelete builder.
type MenuDeleteOne ¶
type MenuDeleteOne struct {
// contains filtered or unexported fields
}
MenuDeleteOne is the builder for deleting a single Menu entity.
func (*MenuDeleteOne) Exec ¶
func (mdo *MenuDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*MenuDeleteOne) ExecX ¶
func (mdo *MenuDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type MenuEdges ¶
type MenuEdges struct { // Parent holds the value of the parent edge. Parent *Menu `json:"parent,omitempty"` // Children holds the value of the children edge. Children []*Menu `json:"children,omitempty"` // Owner holds the value of the owner edge. Owner *Role `json:"owner,omitempty"` // contains filtered or unexported fields }
MenuEdges holds the relations/edges for other nodes in the graph.
func (MenuEdges) ChildrenOrErr ¶
ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.
func (MenuEdges) OwnerOrErr ¶
OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
func (MenuEdges) ParentOrErr ¶
ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type MenuGroupBy ¶
type MenuGroupBy struct {
// contains filtered or unexported fields
}
MenuGroupBy is the group-by builder for Menu entities.
func (*MenuGroupBy) Aggregate ¶
func (mgb *MenuGroupBy) Aggregate(fns ...AggregateFunc) *MenuGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*MenuGroupBy) Bool ¶
func (mgb *MenuGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) BoolX ¶
func (mgb *MenuGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*MenuGroupBy) Bools ¶
func (mgb *MenuGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) BoolsX ¶
func (mgb *MenuGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*MenuGroupBy) Float64 ¶
func (mgb *MenuGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) Float64X ¶
func (mgb *MenuGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*MenuGroupBy) Float64s ¶
func (mgb *MenuGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) Float64sX ¶
func (mgb *MenuGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*MenuGroupBy) Int ¶
func (mgb *MenuGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) IntX ¶
func (mgb *MenuGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*MenuGroupBy) Ints ¶
func (mgb *MenuGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) IntsX ¶
func (mgb *MenuGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*MenuGroupBy) Scan ¶
func (mgb *MenuGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*MenuGroupBy) ScanX ¶
func (mgb *MenuGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*MenuGroupBy) String ¶
func (mgb *MenuGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*MenuGroupBy) StringX ¶
func (mgb *MenuGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type MenuMutation ¶
type MenuMutation struct {
// contains filtered or unexported fields
}
MenuMutation represents an operation that mutates the Menu nodes in the graph.
func (*MenuMutation) AddChildIDs ¶
func (m *MenuMutation) AddChildIDs(ids ...int64)
AddChildIDs adds the "children" edge to the Menu entity by ids.
func (*MenuMutation) AddField ¶
func (m *MenuMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*MenuMutation) AddSort ¶
func (m *MenuMutation) AddSort(i int)
AddSort adds i to the "sort" field.
func (*MenuMutation) AddedEdges ¶
func (m *MenuMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*MenuMutation) AddedField ¶
func (m *MenuMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*MenuMutation) AddedFields ¶
func (m *MenuMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*MenuMutation) AddedIDs ¶
func (m *MenuMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*MenuMutation) AddedSort ¶
func (m *MenuMutation) AddedSort() (r int, exists bool)
AddedSort returns the value that was added to the "sort" field in this mutation.
func (*MenuMutation) ChildrenCleared ¶
func (m *MenuMutation) ChildrenCleared() bool
ChildrenCleared reports if the "children" edge to the Menu entity was cleared.
func (*MenuMutation) ChildrenIDs ¶
func (m *MenuMutation) ChildrenIDs() (ids []int64)
ChildrenIDs returns the "children" edge IDs in the mutation.
func (*MenuMutation) ClearChildren ¶
func (m *MenuMutation) ClearChildren()
ClearChildren clears the "children" edge to the Menu entity.
func (*MenuMutation) ClearDeletedAt ¶
func (m *MenuMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*MenuMutation) ClearEdge ¶
func (m *MenuMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*MenuMutation) ClearField ¶
func (m *MenuMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*MenuMutation) ClearIcon ¶
func (m *MenuMutation) ClearIcon()
ClearIcon clears the value of the "icon" field.
func (*MenuMutation) ClearOwner ¶
func (m *MenuMutation) ClearOwner()
ClearOwner clears the "owner" edge to the Role entity.
func (*MenuMutation) ClearParent ¶
func (m *MenuMutation) ClearParent()
ClearParent clears the "parent" edge to the Menu entity.
func (*MenuMutation) ClearPath ¶
func (m *MenuMutation) ClearPath()
ClearPath clears the value of the "path" field.
func (*MenuMutation) ClearType ¶
func (m *MenuMutation) ClearType()
ClearType clears the value of the "type" field.
func (*MenuMutation) ClearedEdges ¶
func (m *MenuMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*MenuMutation) ClearedFields ¶
func (m *MenuMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (MenuMutation) Client ¶
func (m MenuMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*MenuMutation) CreatedAt ¶
func (m *MenuMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*MenuMutation) DeletedAt ¶
func (m *MenuMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*MenuMutation) DeletedAtCleared ¶
func (m *MenuMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*MenuMutation) EdgeCleared ¶
func (m *MenuMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*MenuMutation) Enable ¶
func (m *MenuMutation) Enable() (r string, exists bool)
Enable returns the value of the "enable" field in the mutation.
func (*MenuMutation) Field ¶
func (m *MenuMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*MenuMutation) FieldCleared ¶
func (m *MenuMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*MenuMutation) Fields ¶
func (m *MenuMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*MenuMutation) GetType ¶
func (m *MenuMutation) GetType() (r string, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*MenuMutation) ID ¶
func (m *MenuMutation) ID() (id int64, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*MenuMutation) Icon ¶
func (m *MenuMutation) Icon() (r string, exists bool)
Icon returns the value of the "icon" field in the mutation.
func (*MenuMutation) IconCleared ¶
func (m *MenuMutation) IconCleared() bool
IconCleared returns if the "icon" field was cleared in this mutation.
func (*MenuMutation) Name ¶
func (m *MenuMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*MenuMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldEnable ¶
func (m *MenuMutation) OldEnable(ctx context.Context) (v string, err error)
OldEnable returns the old "enable" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*MenuMutation) OldIcon ¶
func (m *MenuMutation) OldIcon(ctx context.Context) (v *string, err error)
OldIcon returns the old "icon" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldName ¶
func (m *MenuMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldPath ¶
func (m *MenuMutation) OldPath(ctx context.Context) (v *string, err error)
OldPath returns the old "path" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldPermission ¶
func (m *MenuMutation) OldPermission(ctx context.Context) (v string, err error)
OldPermission returns the old "permission" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldSort ¶
func (m *MenuMutation) OldSort(ctx context.Context) (v int, err error)
OldSort returns the old "sort" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldType ¶
func (m *MenuMutation) OldType(ctx context.Context) (v *string, err error)
OldType returns the old "type" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Menu entity. If the Menu object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*MenuMutation) OwnerCleared ¶
func (m *MenuMutation) OwnerCleared() bool
OwnerCleared reports if the "owner" edge to the Role entity was cleared.
func (*MenuMutation) OwnerID ¶
func (m *MenuMutation) OwnerID() (id int64, exists bool)
OwnerID returns the "owner" edge ID in the mutation.
func (*MenuMutation) OwnerIDs ¶
func (m *MenuMutation) OwnerIDs() (ids []int64)
OwnerIDs returns the "owner" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.
func (*MenuMutation) ParentCleared ¶
func (m *MenuMutation) ParentCleared() bool
ParentCleared reports if the "parent" edge to the Menu entity was cleared.
func (*MenuMutation) ParentID ¶
func (m *MenuMutation) ParentID() (id int64, exists bool)
ParentID returns the "parent" edge ID in the mutation.
func (*MenuMutation) ParentIDs ¶
func (m *MenuMutation) ParentIDs() (ids []int64)
ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.
func (*MenuMutation) Path ¶
func (m *MenuMutation) Path() (r string, exists bool)
Path returns the value of the "path" field in the mutation.
func (*MenuMutation) PathCleared ¶
func (m *MenuMutation) PathCleared() bool
PathCleared returns if the "path" field was cleared in this mutation.
func (*MenuMutation) Permission ¶
func (m *MenuMutation) Permission() (r string, exists bool)
Permission returns the value of the "permission" field in the mutation.
func (*MenuMutation) RemoveChildIDs ¶
func (m *MenuMutation) RemoveChildIDs(ids ...int64)
RemoveChildIDs removes the "children" edge to the Menu entity by IDs.
func (*MenuMutation) RemovedChildrenIDs ¶
func (m *MenuMutation) RemovedChildrenIDs() (ids []int64)
RemovedChildren returns the removed IDs of the "children" edge to the Menu entity.
func (*MenuMutation) RemovedEdges ¶
func (m *MenuMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*MenuMutation) RemovedIDs ¶
func (m *MenuMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*MenuMutation) ResetChildren ¶
func (m *MenuMutation) ResetChildren()
ResetChildren resets all changes to the "children" edge.
func (*MenuMutation) ResetCreatedAt ¶
func (m *MenuMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*MenuMutation) ResetDeletedAt ¶
func (m *MenuMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*MenuMutation) ResetEdge ¶
func (m *MenuMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*MenuMutation) ResetEnable ¶
func (m *MenuMutation) ResetEnable()
ResetEnable resets all changes to the "enable" field.
func (*MenuMutation) ResetField ¶
func (m *MenuMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*MenuMutation) ResetIcon ¶
func (m *MenuMutation) ResetIcon()
ResetIcon resets all changes to the "icon" field.
func (*MenuMutation) ResetName ¶
func (m *MenuMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*MenuMutation) ResetOwner ¶
func (m *MenuMutation) ResetOwner()
ResetOwner resets all changes to the "owner" edge.
func (*MenuMutation) ResetParent ¶
func (m *MenuMutation) ResetParent()
ResetParent resets all changes to the "parent" edge.
func (*MenuMutation) ResetPath ¶
func (m *MenuMutation) ResetPath()
ResetPath resets all changes to the "path" field.
func (*MenuMutation) ResetPermission ¶
func (m *MenuMutation) ResetPermission()
ResetPermission resets all changes to the "permission" field.
func (*MenuMutation) ResetSort ¶
func (m *MenuMutation) ResetSort()
ResetSort resets all changes to the "sort" field.
func (*MenuMutation) ResetType ¶
func (m *MenuMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*MenuMutation) ResetUpdatedAt ¶
func (m *MenuMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*MenuMutation) SetCreatedAt ¶
func (m *MenuMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*MenuMutation) SetDeletedAt ¶
func (m *MenuMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*MenuMutation) SetEnable ¶
func (m *MenuMutation) SetEnable(s string)
SetEnable sets the "enable" field.
func (*MenuMutation) SetField ¶
func (m *MenuMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*MenuMutation) SetID ¶
func (m *MenuMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Menu entities.
func (*MenuMutation) SetIcon ¶
func (m *MenuMutation) SetIcon(s string)
SetIcon sets the "icon" field.
func (*MenuMutation) SetName ¶
func (m *MenuMutation) SetName(s string)
SetName sets the "name" field.
func (*MenuMutation) SetOwnerID ¶
func (m *MenuMutation) SetOwnerID(id int64)
SetOwnerID sets the "owner" edge to the Role entity by id.
func (*MenuMutation) SetParentID ¶
func (m *MenuMutation) SetParentID(id int64)
SetParentID sets the "parent" edge to the Menu entity by id.
func (*MenuMutation) SetPath ¶
func (m *MenuMutation) SetPath(s string)
SetPath sets the "path" field.
func (*MenuMutation) SetPermission ¶
func (m *MenuMutation) SetPermission(s string)
SetPermission sets the "permission" field.
func (*MenuMutation) SetType ¶
func (m *MenuMutation) SetType(s string)
SetType sets the "type" field.
func (*MenuMutation) SetUpdatedAt ¶
func (m *MenuMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*MenuMutation) Sort ¶
func (m *MenuMutation) Sort() (r int, exists bool)
Sort returns the value of the "sort" field in the mutation.
func (MenuMutation) Tx ¶
func (m MenuMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*MenuMutation) Type ¶
func (m *MenuMutation) Type() string
Type returns the node type of this mutation (Menu).
func (*MenuMutation) TypeCleared ¶
func (m *MenuMutation) TypeCleared() bool
TypeCleared returns if the "type" field was cleared in this mutation.
func (*MenuMutation) UpdatedAt ¶
func (m *MenuMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*MenuMutation) Where ¶
func (m *MenuMutation) Where(ps ...predicate.Menu)
Where appends a list predicates to the MenuMutation builder.
type MenuQuery ¶
type MenuQuery struct {
// contains filtered or unexported fields
}
MenuQuery is the builder for querying Menu entities.
func (*MenuQuery) Clone ¶
Clone returns a duplicate of the MenuQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*MenuQuery) First ¶
First returns the first Menu entity from the query. Returns a *NotFoundError when no Menu was found.
func (*MenuQuery) FirstID ¶
FirstID returns the first Menu ID from the query. Returns a *NotFoundError when no Menu ID was found.
func (*MenuQuery) GroupBy ¶
func (mq *MenuQuery) GroupBy(field string, fields ...string) *MenuGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Menu.Query(). GroupBy(menu.FieldCreatedAt). Aggregate(ent.Count()). Scan(ctx, &v)
func (*MenuQuery) Only ¶
Only returns a single Menu entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Menu entity is not found. Returns a *NotFoundError when no Menu entities are found.
func (*MenuQuery) OnlyID ¶
OnlyID is like Only, but returns the only Menu ID in the query. Returns a *NotSingularError when exactly one Menu ID is not found. Returns a *NotFoundError when no entities are found.
func (*MenuQuery) QueryChildren ¶
QueryChildren chains the current query on the "children" edge.
func (*MenuQuery) QueryOwner ¶
QueryOwner chains the current query on the "owner" edge.
func (*MenuQuery) QueryParent ¶
QueryParent chains the current query on the "parent" edge.
func (*MenuQuery) Select ¶
func (mq *MenuQuery) Select(fields ...string) *MenuSelect
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 { CreatedAt time.Time `json:"created_at,omitempty"` } client.Menu.Query(). Select(menu.FieldCreatedAt). Scan(ctx, &v)
func (*MenuQuery) 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 (*MenuQuery) WithChildren ¶
WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.
func (*MenuQuery) WithOwner ¶
WithOwner tells the query-builder to eager-load the nodes that are connected to the "owner" edge. The optional arguments are used to configure the query builder of the edge.
func (*MenuQuery) WithParent ¶
WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.
type MenuSelect ¶
type MenuSelect struct { *MenuQuery // contains filtered or unexported fields }
MenuSelect is the builder for selecting fields of Menu entities.
func (*MenuSelect) Bool ¶
func (ms *MenuSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*MenuSelect) BoolX ¶
func (ms *MenuSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*MenuSelect) Bools ¶
func (ms *MenuSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*MenuSelect) BoolsX ¶
func (ms *MenuSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*MenuSelect) Float64 ¶
func (ms *MenuSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*MenuSelect) Float64X ¶
func (ms *MenuSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*MenuSelect) Float64s ¶
func (ms *MenuSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*MenuSelect) Float64sX ¶
func (ms *MenuSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*MenuSelect) Int ¶
func (ms *MenuSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*MenuSelect) IntX ¶
func (ms *MenuSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*MenuSelect) Ints ¶
func (ms *MenuSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*MenuSelect) IntsX ¶
func (ms *MenuSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*MenuSelect) Scan ¶
func (ms *MenuSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*MenuSelect) ScanX ¶
func (ms *MenuSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*MenuSelect) String ¶
func (ms *MenuSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*MenuSelect) StringX ¶
func (ms *MenuSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type MenuUpdate ¶
type MenuUpdate struct {
// contains filtered or unexported fields
}
MenuUpdate is the builder for updating Menu entities.
func (*MenuUpdate) AddChildIDs ¶
func (mu *MenuUpdate) AddChildIDs(ids ...int64) *MenuUpdate
AddChildIDs adds the "children" edge to the Menu entity by IDs.
func (*MenuUpdate) AddChildren ¶
func (mu *MenuUpdate) AddChildren(m ...*Menu) *MenuUpdate
AddChildren adds the "children" edges to the Menu entity.
func (*MenuUpdate) AddSort ¶
func (mu *MenuUpdate) AddSort(i int) *MenuUpdate
AddSort adds i to the "sort" field.
func (*MenuUpdate) ClearChildren ¶
func (mu *MenuUpdate) ClearChildren() *MenuUpdate
ClearChildren clears all "children" edges to the Menu entity.
func (*MenuUpdate) ClearDeletedAt ¶
func (mu *MenuUpdate) ClearDeletedAt() *MenuUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
func (*MenuUpdate) ClearIcon ¶
func (mu *MenuUpdate) ClearIcon() *MenuUpdate
ClearIcon clears the value of the "icon" field.
func (*MenuUpdate) ClearOwner ¶
func (mu *MenuUpdate) ClearOwner() *MenuUpdate
ClearOwner clears the "owner" edge to the Role entity.
func (*MenuUpdate) ClearParent ¶
func (mu *MenuUpdate) ClearParent() *MenuUpdate
ClearParent clears the "parent" edge to the Menu entity.
func (*MenuUpdate) ClearPath ¶
func (mu *MenuUpdate) ClearPath() *MenuUpdate
ClearPath clears the value of the "path" field.
func (*MenuUpdate) ClearType ¶
func (mu *MenuUpdate) ClearType() *MenuUpdate
ClearType clears the value of the "type" field.
func (*MenuUpdate) Exec ¶
func (mu *MenuUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*MenuUpdate) ExecX ¶
func (mu *MenuUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MenuUpdate) Mutation ¶
func (mu *MenuUpdate) Mutation() *MenuMutation
Mutation returns the MenuMutation object of the builder.
func (*MenuUpdate) RemoveChildIDs ¶
func (mu *MenuUpdate) RemoveChildIDs(ids ...int64) *MenuUpdate
RemoveChildIDs removes the "children" edge to Menu entities by IDs.
func (*MenuUpdate) RemoveChildren ¶
func (mu *MenuUpdate) RemoveChildren(m ...*Menu) *MenuUpdate
RemoveChildren removes "children" edges to Menu entities.
func (*MenuUpdate) Save ¶
func (mu *MenuUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*MenuUpdate) SaveX ¶
func (mu *MenuUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*MenuUpdate) SetDeletedAt ¶
func (mu *MenuUpdate) SetDeletedAt(t time.Time) *MenuUpdate
SetDeletedAt sets the "deleted_at" field.
func (*MenuUpdate) SetEnable ¶
func (mu *MenuUpdate) SetEnable(s string) *MenuUpdate
SetEnable sets the "enable" field.
func (*MenuUpdate) SetIcon ¶
func (mu *MenuUpdate) SetIcon(s string) *MenuUpdate
SetIcon sets the "icon" field.
func (*MenuUpdate) SetName ¶
func (mu *MenuUpdate) SetName(s string) *MenuUpdate
SetName sets the "name" field.
func (*MenuUpdate) SetNillableEnable ¶
func (mu *MenuUpdate) SetNillableEnable(s *string) *MenuUpdate
SetNillableEnable sets the "enable" field if the given value is not nil.
func (*MenuUpdate) SetNillableIcon ¶
func (mu *MenuUpdate) SetNillableIcon(s *string) *MenuUpdate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*MenuUpdate) SetNillableOwnerID ¶
func (mu *MenuUpdate) SetNillableOwnerID(id *int64) *MenuUpdate
SetNillableOwnerID sets the "owner" edge to the Role entity by ID if the given value is not nil.
func (*MenuUpdate) SetNillableParentID ¶
func (mu *MenuUpdate) SetNillableParentID(id *int64) *MenuUpdate
SetNillableParentID sets the "parent" edge to the Menu entity by ID if the given value is not nil.
func (*MenuUpdate) SetNillablePath ¶
func (mu *MenuUpdate) SetNillablePath(s *string) *MenuUpdate
SetNillablePath sets the "path" field if the given value is not nil.
func (*MenuUpdate) SetNillableSort ¶
func (mu *MenuUpdate) SetNillableSort(i *int) *MenuUpdate
SetNillableSort sets the "sort" field if the given value is not nil.
func (*MenuUpdate) SetNillableType ¶
func (mu *MenuUpdate) SetNillableType(s *string) *MenuUpdate
SetNillableType sets the "type" field if the given value is not nil.
func (*MenuUpdate) SetOwner ¶
func (mu *MenuUpdate) SetOwner(r *Role) *MenuUpdate
SetOwner sets the "owner" edge to the Role entity.
func (*MenuUpdate) SetOwnerID ¶
func (mu *MenuUpdate) SetOwnerID(id int64) *MenuUpdate
SetOwnerID sets the "owner" edge to the Role entity by ID.
func (*MenuUpdate) SetParent ¶
func (mu *MenuUpdate) SetParent(m *Menu) *MenuUpdate
SetParent sets the "parent" edge to the Menu entity.
func (*MenuUpdate) SetParentID ¶
func (mu *MenuUpdate) SetParentID(id int64) *MenuUpdate
SetParentID sets the "parent" edge to the Menu entity by ID.
func (*MenuUpdate) SetPath ¶
func (mu *MenuUpdate) SetPath(s string) *MenuUpdate
SetPath sets the "path" field.
func (*MenuUpdate) SetPermission ¶
func (mu *MenuUpdate) SetPermission(s string) *MenuUpdate
SetPermission sets the "permission" field.
func (*MenuUpdate) SetSort ¶
func (mu *MenuUpdate) SetSort(i int) *MenuUpdate
SetSort sets the "sort" field.
func (*MenuUpdate) SetType ¶
func (mu *MenuUpdate) SetType(s string) *MenuUpdate
SetType sets the "type" field.
func (*MenuUpdate) SetUpdatedAt ¶
func (mu *MenuUpdate) SetUpdatedAt(t time.Time) *MenuUpdate
SetUpdatedAt sets the "updated_at" field.
func (*MenuUpdate) Where ¶
func (mu *MenuUpdate) Where(ps ...predicate.Menu) *MenuUpdate
Where appends a list predicates to the MenuUpdate builder.
type MenuUpdateOne ¶
type MenuUpdateOne struct {
// contains filtered or unexported fields
}
MenuUpdateOne is the builder for updating a single Menu entity.
func (*MenuUpdateOne) AddChildIDs ¶
func (muo *MenuUpdateOne) AddChildIDs(ids ...int64) *MenuUpdateOne
AddChildIDs adds the "children" edge to the Menu entity by IDs.
func (*MenuUpdateOne) AddChildren ¶
func (muo *MenuUpdateOne) AddChildren(m ...*Menu) *MenuUpdateOne
AddChildren adds the "children" edges to the Menu entity.
func (*MenuUpdateOne) AddSort ¶
func (muo *MenuUpdateOne) AddSort(i int) *MenuUpdateOne
AddSort adds i to the "sort" field.
func (*MenuUpdateOne) ClearChildren ¶
func (muo *MenuUpdateOne) ClearChildren() *MenuUpdateOne
ClearChildren clears all "children" edges to the Menu entity.
func (*MenuUpdateOne) ClearDeletedAt ¶
func (muo *MenuUpdateOne) ClearDeletedAt() *MenuUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*MenuUpdateOne) ClearIcon ¶
func (muo *MenuUpdateOne) ClearIcon() *MenuUpdateOne
ClearIcon clears the value of the "icon" field.
func (*MenuUpdateOne) ClearOwner ¶
func (muo *MenuUpdateOne) ClearOwner() *MenuUpdateOne
ClearOwner clears the "owner" edge to the Role entity.
func (*MenuUpdateOne) ClearParent ¶
func (muo *MenuUpdateOne) ClearParent() *MenuUpdateOne
ClearParent clears the "parent" edge to the Menu entity.
func (*MenuUpdateOne) ClearPath ¶
func (muo *MenuUpdateOne) ClearPath() *MenuUpdateOne
ClearPath clears the value of the "path" field.
func (*MenuUpdateOne) ClearType ¶
func (muo *MenuUpdateOne) ClearType() *MenuUpdateOne
ClearType clears the value of the "type" field.
func (*MenuUpdateOne) Exec ¶
func (muo *MenuUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*MenuUpdateOne) ExecX ¶
func (muo *MenuUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*MenuUpdateOne) Mutation ¶
func (muo *MenuUpdateOne) Mutation() *MenuMutation
Mutation returns the MenuMutation object of the builder.
func (*MenuUpdateOne) RemoveChildIDs ¶
func (muo *MenuUpdateOne) RemoveChildIDs(ids ...int64) *MenuUpdateOne
RemoveChildIDs removes the "children" edge to Menu entities by IDs.
func (*MenuUpdateOne) RemoveChildren ¶
func (muo *MenuUpdateOne) RemoveChildren(m ...*Menu) *MenuUpdateOne
RemoveChildren removes "children" edges to Menu entities.
func (*MenuUpdateOne) Save ¶
func (muo *MenuUpdateOne) Save(ctx context.Context) (*Menu, error)
Save executes the query and returns the updated Menu entity.
func (*MenuUpdateOne) SaveX ¶
func (muo *MenuUpdateOne) SaveX(ctx context.Context) *Menu
SaveX is like Save, but panics if an error occurs.
func (*MenuUpdateOne) Select ¶
func (muo *MenuUpdateOne) Select(field string, fields ...string) *MenuUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*MenuUpdateOne) SetDeletedAt ¶
func (muo *MenuUpdateOne) SetDeletedAt(t time.Time) *MenuUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*MenuUpdateOne) SetEnable ¶
func (muo *MenuUpdateOne) SetEnable(s string) *MenuUpdateOne
SetEnable sets the "enable" field.
func (*MenuUpdateOne) SetIcon ¶
func (muo *MenuUpdateOne) SetIcon(s string) *MenuUpdateOne
SetIcon sets the "icon" field.
func (*MenuUpdateOne) SetName ¶
func (muo *MenuUpdateOne) SetName(s string) *MenuUpdateOne
SetName sets the "name" field.
func (*MenuUpdateOne) SetNillableEnable ¶
func (muo *MenuUpdateOne) SetNillableEnable(s *string) *MenuUpdateOne
SetNillableEnable sets the "enable" field if the given value is not nil.
func (*MenuUpdateOne) SetNillableIcon ¶
func (muo *MenuUpdateOne) SetNillableIcon(s *string) *MenuUpdateOne
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*MenuUpdateOne) SetNillableOwnerID ¶
func (muo *MenuUpdateOne) SetNillableOwnerID(id *int64) *MenuUpdateOne
SetNillableOwnerID sets the "owner" edge to the Role entity by ID if the given value is not nil.
func (*MenuUpdateOne) SetNillableParentID ¶
func (muo *MenuUpdateOne) SetNillableParentID(id *int64) *MenuUpdateOne
SetNillableParentID sets the "parent" edge to the Menu entity by ID if the given value is not nil.
func (*MenuUpdateOne) SetNillablePath ¶
func (muo *MenuUpdateOne) SetNillablePath(s *string) *MenuUpdateOne
SetNillablePath sets the "path" field if the given value is not nil.
func (*MenuUpdateOne) SetNillableSort ¶
func (muo *MenuUpdateOne) SetNillableSort(i *int) *MenuUpdateOne
SetNillableSort sets the "sort" field if the given value is not nil.
func (*MenuUpdateOne) SetNillableType ¶
func (muo *MenuUpdateOne) SetNillableType(s *string) *MenuUpdateOne
SetNillableType sets the "type" field if the given value is not nil.
func (*MenuUpdateOne) SetOwner ¶
func (muo *MenuUpdateOne) SetOwner(r *Role) *MenuUpdateOne
SetOwner sets the "owner" edge to the Role entity.
func (*MenuUpdateOne) SetOwnerID ¶
func (muo *MenuUpdateOne) SetOwnerID(id int64) *MenuUpdateOne
SetOwnerID sets the "owner" edge to the Role entity by ID.
func (*MenuUpdateOne) SetParent ¶
func (muo *MenuUpdateOne) SetParent(m *Menu) *MenuUpdateOne
SetParent sets the "parent" edge to the Menu entity.
func (*MenuUpdateOne) SetParentID ¶
func (muo *MenuUpdateOne) SetParentID(id int64) *MenuUpdateOne
SetParentID sets the "parent" edge to the Menu entity by ID.
func (*MenuUpdateOne) SetPath ¶
func (muo *MenuUpdateOne) SetPath(s string) *MenuUpdateOne
SetPath sets the "path" field.
func (*MenuUpdateOne) SetPermission ¶
func (muo *MenuUpdateOne) SetPermission(s string) *MenuUpdateOne
SetPermission sets the "permission" field.
func (*MenuUpdateOne) SetSort ¶
func (muo *MenuUpdateOne) SetSort(i int) *MenuUpdateOne
SetSort sets the "sort" field.
func (*MenuUpdateOne) SetType ¶
func (muo *MenuUpdateOne) SetType(s string) *MenuUpdateOne
SetType sets the "type" field.
func (*MenuUpdateOne) SetUpdatedAt ¶
func (muo *MenuUpdateOne) SetUpdatedAt(t time.Time) *MenuUpdateOne
SetUpdatedAt sets the "updated_at" field.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
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 Role ¶
type Role struct { // ID of the ent. // 角色id ID int64 `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. // 创建时间 CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. // 更新时间 UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. // 删除时间 DeletedAt *time.Time `json:"deleted_at,omitempty"` // Key holds the value of the "key" field. // 角色关键字 Key string `json:"key,omitempty"` // Name holds the value of the "name" field. // 角色名称 Name string `json:"name,omitempty"` // Comment holds the value of the "comment" field. // 备注 Comment *string `json:"comment,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the RoleQuery when eager-loading is set. Edges RoleEdges `json:"edges"` // contains filtered or unexported fields }
Role is the model entity for the Role schema.
func (*Role) Unwrap ¶
Unwrap unwraps the Role 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 (*Role) Update ¶
func (r *Role) Update() *RoleUpdateOne
Update returns a builder for updating this Role. Note that you need to call Role.Unwrap() before calling this method if this Role was returned from a transaction, and the transaction was committed or rolled back.
type RoleClient ¶
type RoleClient struct {
// contains filtered or unexported fields
}
RoleClient is a client for the Role schema.
func NewRoleClient ¶
func NewRoleClient(c config) *RoleClient
NewRoleClient returns a client for the Role from the given config.
func (*RoleClient) Create ¶
func (c *RoleClient) Create() *RoleCreate
Create returns a create builder for Role.
func (*RoleClient) CreateBulk ¶
func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk
CreateBulk returns a builder for creating a bulk of Role entities.
func (*RoleClient) Delete ¶
func (c *RoleClient) Delete() *RoleDelete
Delete returns a delete builder for Role.
func (*RoleClient) DeleteOne ¶
func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*RoleClient) DeleteOneID ¶
func (c *RoleClient) DeleteOneID(id int64) *RoleDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*RoleClient) GetX ¶
func (c *RoleClient) GetX(ctx context.Context, id int64) *Role
GetX is like Get, but panics if an error occurs.
func (*RoleClient) Query ¶
func (c *RoleClient) Query() *RoleQuery
Query returns a query builder for Role.
func (*RoleClient) QueryMenu ¶
func (c *RoleClient) QueryMenu(r *Role) *MenuQuery
QueryMenu queries the menu edge of a Role.
func (*RoleClient) QueryUser ¶
func (c *RoleClient) QueryUser(r *Role) *UserQuery
QueryUser queries the user edge of a Role.
func (*RoleClient) Update ¶
func (c *RoleClient) Update() *RoleUpdate
Update returns an update builder for Role.
func (*RoleClient) UpdateOne ¶
func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne
UpdateOne returns an update builder for the given entity.
func (*RoleClient) UpdateOneID ¶
func (c *RoleClient) UpdateOneID(id int64) *RoleUpdateOne
UpdateOneID returns an update builder for the given id.
func (*RoleClient) Use ¶
func (c *RoleClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `role.Hooks(f(g(h())))`.
type RoleCreate ¶
type RoleCreate struct {
// contains filtered or unexported fields
}
RoleCreate is the builder for creating a Role entity.
func (*RoleCreate) AddMenu ¶
func (rc *RoleCreate) AddMenu(m ...*Menu) *RoleCreate
AddMenu adds the "menu" edges to the Menu entity.
func (*RoleCreate) AddMenuIDs ¶
func (rc *RoleCreate) AddMenuIDs(ids ...int64) *RoleCreate
AddMenuIDs adds the "menu" edge to the Menu entity by IDs.
func (*RoleCreate) AddUser ¶
func (rc *RoleCreate) AddUser(u ...*User) *RoleCreate
AddUser adds the "user" edges to the User entity.
func (*RoleCreate) AddUserIDs ¶
func (rc *RoleCreate) AddUserIDs(ids ...int) *RoleCreate
AddUserIDs adds the "user" edge to the User entity by IDs.
func (*RoleCreate) Exec ¶
func (rc *RoleCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*RoleCreate) ExecX ¶
func (rc *RoleCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*RoleCreate) Mutation ¶
func (rc *RoleCreate) Mutation() *RoleMutation
Mutation returns the RoleMutation object of the builder.
func (*RoleCreate) Save ¶
func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)
Save creates the Role in the database.
func (*RoleCreate) SaveX ¶
func (rc *RoleCreate) SaveX(ctx context.Context) *Role
SaveX calls Save and panics if Save returns an error.
func (*RoleCreate) SetComment ¶
func (rc *RoleCreate) SetComment(s string) *RoleCreate
SetComment sets the "comment" field.
func (*RoleCreate) SetCreatedAt ¶
func (rc *RoleCreate) SetCreatedAt(t time.Time) *RoleCreate
SetCreatedAt sets the "created_at" field.
func (*RoleCreate) SetDeletedAt ¶
func (rc *RoleCreate) SetDeletedAt(t time.Time) *RoleCreate
SetDeletedAt sets the "deleted_at" field.
func (*RoleCreate) SetID ¶
func (rc *RoleCreate) SetID(i int64) *RoleCreate
SetID sets the "id" field.
func (*RoleCreate) SetKey ¶
func (rc *RoleCreate) SetKey(s string) *RoleCreate
SetKey sets the "key" field.
func (*RoleCreate) SetName ¶
func (rc *RoleCreate) SetName(s string) *RoleCreate
SetName sets the "name" field.
func (*RoleCreate) SetNillableComment ¶
func (rc *RoleCreate) SetNillableComment(s *string) *RoleCreate
SetNillableComment sets the "comment" field if the given value is not nil.
func (*RoleCreate) SetNillableCreatedAt ¶
func (rc *RoleCreate) SetNillableCreatedAt(t *time.Time) *RoleCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*RoleCreate) SetNillableDeletedAt ¶
func (rc *RoleCreate) SetNillableDeletedAt(t *time.Time) *RoleCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*RoleCreate) SetNillableUpdatedAt ¶
func (rc *RoleCreate) SetNillableUpdatedAt(t *time.Time) *RoleCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*RoleCreate) SetUpdatedAt ¶
func (rc *RoleCreate) SetUpdatedAt(t time.Time) *RoleCreate
SetUpdatedAt sets the "updated_at" field.
type RoleCreateBulk ¶
type RoleCreateBulk struct {
// contains filtered or unexported fields
}
RoleCreateBulk is the builder for creating many Role entities in bulk.
func (*RoleCreateBulk) Exec ¶
func (rcb *RoleCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*RoleCreateBulk) ExecX ¶
func (rcb *RoleCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type RoleDelete ¶
type RoleDelete struct {
// contains filtered or unexported fields
}
RoleDelete is the builder for deleting a Role entity.
func (*RoleDelete) Exec ¶
func (rd *RoleDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*RoleDelete) ExecX ¶
func (rd *RoleDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*RoleDelete) Where ¶
func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete
Where appends a list predicates to the RoleDelete builder.
type RoleDeleteOne ¶
type RoleDeleteOne struct {
// contains filtered or unexported fields
}
RoleDeleteOne is the builder for deleting a single Role entity.
func (*RoleDeleteOne) Exec ¶
func (rdo *RoleDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*RoleDeleteOne) ExecX ¶
func (rdo *RoleDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type RoleEdges ¶
type RoleEdges struct { // User holds the value of the user edge. User []*User `json:"user,omitempty"` // Menu holds the value of the menu edge. Menu []*Menu `json:"menu,omitempty"` // contains filtered or unexported fields }
RoleEdges holds the relations/edges for other nodes in the graph.
type RoleGroupBy ¶
type RoleGroupBy struct {
// contains filtered or unexported fields
}
RoleGroupBy is the group-by builder for Role entities.
func (*RoleGroupBy) Aggregate ¶
func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*RoleGroupBy) Bool ¶
func (rgb *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) BoolX ¶
func (rgb *RoleGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*RoleGroupBy) Bools ¶
func (rgb *RoleGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) BoolsX ¶
func (rgb *RoleGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*RoleGroupBy) Float64 ¶
func (rgb *RoleGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) Float64X ¶
func (rgb *RoleGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*RoleGroupBy) Float64s ¶
func (rgb *RoleGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) Float64sX ¶
func (rgb *RoleGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*RoleGroupBy) Int ¶
func (rgb *RoleGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) IntX ¶
func (rgb *RoleGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*RoleGroupBy) Ints ¶
func (rgb *RoleGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) IntsX ¶
func (rgb *RoleGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*RoleGroupBy) Scan ¶
func (rgb *RoleGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*RoleGroupBy) ScanX ¶
func (rgb *RoleGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*RoleGroupBy) String ¶
func (rgb *RoleGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*RoleGroupBy) StringX ¶
func (rgb *RoleGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type RoleMutation ¶
type RoleMutation struct {
// contains filtered or unexported fields
}
RoleMutation represents an operation that mutates the Role nodes in the graph.
func (*RoleMutation) AddField ¶
func (m *RoleMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*RoleMutation) AddMenuIDs ¶
func (m *RoleMutation) AddMenuIDs(ids ...int64)
AddMenuIDs adds the "menu" edge to the Menu entity by ids.
func (*RoleMutation) AddUserIDs ¶
func (m *RoleMutation) AddUserIDs(ids ...int)
AddUserIDs adds the "user" edge to the User entity by ids.
func (*RoleMutation) AddedEdges ¶
func (m *RoleMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*RoleMutation) AddedField ¶
func (m *RoleMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*RoleMutation) AddedFields ¶
func (m *RoleMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*RoleMutation) AddedIDs ¶
func (m *RoleMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*RoleMutation) ClearComment ¶
func (m *RoleMutation) ClearComment()
ClearComment clears the value of the "comment" field.
func (*RoleMutation) ClearDeletedAt ¶
func (m *RoleMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*RoleMutation) ClearEdge ¶
func (m *RoleMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*RoleMutation) ClearField ¶
func (m *RoleMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*RoleMutation) ClearMenu ¶
func (m *RoleMutation) ClearMenu()
ClearMenu clears the "menu" edge to the Menu entity.
func (*RoleMutation) ClearUser ¶
func (m *RoleMutation) ClearUser()
ClearUser clears the "user" edge to the User entity.
func (*RoleMutation) ClearedEdges ¶
func (m *RoleMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*RoleMutation) ClearedFields ¶
func (m *RoleMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (RoleMutation) Client ¶
func (m RoleMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*RoleMutation) Comment ¶
func (m *RoleMutation) Comment() (r string, exists bool)
Comment returns the value of the "comment" field in the mutation.
func (*RoleMutation) CommentCleared ¶
func (m *RoleMutation) CommentCleared() bool
CommentCleared returns if the "comment" field was cleared in this mutation.
func (*RoleMutation) CreatedAt ¶
func (m *RoleMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*RoleMutation) DeletedAt ¶
func (m *RoleMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*RoleMutation) DeletedAtCleared ¶
func (m *RoleMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*RoleMutation) EdgeCleared ¶
func (m *RoleMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*RoleMutation) Field ¶
func (m *RoleMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*RoleMutation) FieldCleared ¶
func (m *RoleMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*RoleMutation) Fields ¶
func (m *RoleMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*RoleMutation) ID ¶
func (m *RoleMutation) ID() (id int64, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*RoleMutation) Key ¶
func (m *RoleMutation) Key() (r string, exists bool)
Key returns the value of the "key" field in the mutation.
func (*RoleMutation) MenuCleared ¶
func (m *RoleMutation) MenuCleared() bool
MenuCleared reports if the "menu" edge to the Menu entity was cleared.
func (*RoleMutation) MenuIDs ¶
func (m *RoleMutation) MenuIDs() (ids []int64)
MenuIDs returns the "menu" edge IDs in the mutation.
func (*RoleMutation) Name ¶
func (m *RoleMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*RoleMutation) OldComment ¶
func (m *RoleMutation) OldComment(ctx context.Context) (v *string, err error)
OldComment returns the old "comment" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*RoleMutation) OldKey ¶
func (m *RoleMutation) OldKey(ctx context.Context) (v string, err error)
OldKey returns the old "key" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) OldName ¶
func (m *RoleMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*RoleMutation) RemoveMenuIDs ¶
func (m *RoleMutation) RemoveMenuIDs(ids ...int64)
RemoveMenuIDs removes the "menu" edge to the Menu entity by IDs.
func (*RoleMutation) RemoveUserIDs ¶
func (m *RoleMutation) RemoveUserIDs(ids ...int)
RemoveUserIDs removes the "user" edge to the User entity by IDs.
func (*RoleMutation) RemovedEdges ¶
func (m *RoleMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*RoleMutation) RemovedIDs ¶
func (m *RoleMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*RoleMutation) RemovedMenuIDs ¶
func (m *RoleMutation) RemovedMenuIDs() (ids []int64)
RemovedMenu returns the removed IDs of the "menu" edge to the Menu entity.
func (*RoleMutation) RemovedUserIDs ¶
func (m *RoleMutation) RemovedUserIDs() (ids []int)
RemovedUser returns the removed IDs of the "user" edge to the User entity.
func (*RoleMutation) ResetComment ¶
func (m *RoleMutation) ResetComment()
ResetComment resets all changes to the "comment" field.
func (*RoleMutation) ResetCreatedAt ¶
func (m *RoleMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*RoleMutation) ResetDeletedAt ¶
func (m *RoleMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*RoleMutation) ResetEdge ¶
func (m *RoleMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*RoleMutation) ResetField ¶
func (m *RoleMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*RoleMutation) ResetKey ¶
func (m *RoleMutation) ResetKey()
ResetKey resets all changes to the "key" field.
func (*RoleMutation) ResetMenu ¶
func (m *RoleMutation) ResetMenu()
ResetMenu resets all changes to the "menu" edge.
func (*RoleMutation) ResetName ¶
func (m *RoleMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*RoleMutation) ResetUpdatedAt ¶
func (m *RoleMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*RoleMutation) ResetUser ¶
func (m *RoleMutation) ResetUser()
ResetUser resets all changes to the "user" edge.
func (*RoleMutation) SetComment ¶
func (m *RoleMutation) SetComment(s string)
SetComment sets the "comment" field.
func (*RoleMutation) SetCreatedAt ¶
func (m *RoleMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*RoleMutation) SetDeletedAt ¶
func (m *RoleMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*RoleMutation) SetField ¶
func (m *RoleMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*RoleMutation) SetID ¶
func (m *RoleMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Role entities.
func (*RoleMutation) SetName ¶
func (m *RoleMutation) SetName(s string)
SetName sets the "name" field.
func (*RoleMutation) SetUpdatedAt ¶
func (m *RoleMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (RoleMutation) Tx ¶
func (m RoleMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*RoleMutation) Type ¶
func (m *RoleMutation) Type() string
Type returns the node type of this mutation (Role).
func (*RoleMutation) UpdatedAt ¶
func (m *RoleMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*RoleMutation) UserCleared ¶
func (m *RoleMutation) UserCleared() bool
UserCleared reports if the "user" edge to the User entity was cleared.
func (*RoleMutation) UserIDs ¶
func (m *RoleMutation) UserIDs() (ids []int)
UserIDs returns the "user" edge IDs in the mutation.
func (*RoleMutation) Where ¶
func (m *RoleMutation) Where(ps ...predicate.Role)
Where appends a list predicates to the RoleMutation builder.
type RoleQuery ¶
type RoleQuery struct {
// contains filtered or unexported fields
}
RoleQuery is the builder for querying Role entities.
func (*RoleQuery) Clone ¶
Clone returns a duplicate of the RoleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*RoleQuery) First ¶
First returns the first Role entity from the query. Returns a *NotFoundError when no Role was found.
func (*RoleQuery) FirstID ¶
FirstID returns the first Role ID from the query. Returns a *NotFoundError when no Role ID was found.
func (*RoleQuery) GroupBy ¶
func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Role.Query(). GroupBy(role.FieldCreatedAt). Aggregate(ent.Count()). Scan(ctx, &v)
func (*RoleQuery) Only ¶
Only returns a single Role entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Role entity is not found. Returns a *NotFoundError when no Role entities are found.
func (*RoleQuery) OnlyID ¶
OnlyID is like Only, but returns the only Role ID in the query. Returns a *NotSingularError when exactly one Role ID is not found. Returns a *NotFoundError when no entities are found.
func (*RoleQuery) Select ¶
func (rq *RoleQuery) Select(fields ...string) *RoleSelect
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 { CreatedAt time.Time `json:"created_at,omitempty"` } client.Role.Query(). Select(role.FieldCreatedAt). Scan(ctx, &v)
func (*RoleQuery) 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.
type RoleSelect ¶
type RoleSelect struct { *RoleQuery // contains filtered or unexported fields }
RoleSelect is the builder for selecting fields of Role entities.
func (*RoleSelect) Bool ¶
func (rs *RoleSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*RoleSelect) BoolX ¶
func (rs *RoleSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*RoleSelect) Bools ¶
func (rs *RoleSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*RoleSelect) BoolsX ¶
func (rs *RoleSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*RoleSelect) Float64 ¶
func (rs *RoleSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*RoleSelect) Float64X ¶
func (rs *RoleSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*RoleSelect) Float64s ¶
func (rs *RoleSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*RoleSelect) Float64sX ¶
func (rs *RoleSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*RoleSelect) Int ¶
func (rs *RoleSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*RoleSelect) IntX ¶
func (rs *RoleSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*RoleSelect) Ints ¶
func (rs *RoleSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*RoleSelect) IntsX ¶
func (rs *RoleSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*RoleSelect) Scan ¶
func (rs *RoleSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*RoleSelect) ScanX ¶
func (rs *RoleSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*RoleSelect) String ¶
func (rs *RoleSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*RoleSelect) StringX ¶
func (rs *RoleSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type RoleUpdate ¶
type RoleUpdate struct {
// contains filtered or unexported fields
}
RoleUpdate is the builder for updating Role entities.
func (*RoleUpdate) AddMenu ¶
func (ru *RoleUpdate) AddMenu(m ...*Menu) *RoleUpdate
AddMenu adds the "menu" edges to the Menu entity.
func (*RoleUpdate) AddMenuIDs ¶
func (ru *RoleUpdate) AddMenuIDs(ids ...int64) *RoleUpdate
AddMenuIDs adds the "menu" edge to the Menu entity by IDs.
func (*RoleUpdate) AddUser ¶
func (ru *RoleUpdate) AddUser(u ...*User) *RoleUpdate
AddUser adds the "user" edges to the User entity.
func (*RoleUpdate) AddUserIDs ¶
func (ru *RoleUpdate) AddUserIDs(ids ...int) *RoleUpdate
AddUserIDs adds the "user" edge to the User entity by IDs.
func (*RoleUpdate) ClearComment ¶
func (ru *RoleUpdate) ClearComment() *RoleUpdate
ClearComment clears the value of the "comment" field.
func (*RoleUpdate) ClearDeletedAt ¶
func (ru *RoleUpdate) ClearDeletedAt() *RoleUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
func (*RoleUpdate) ClearMenu ¶
func (ru *RoleUpdate) ClearMenu() *RoleUpdate
ClearMenu clears all "menu" edges to the Menu entity.
func (*RoleUpdate) ClearUser ¶
func (ru *RoleUpdate) ClearUser() *RoleUpdate
ClearUser clears all "user" edges to the User entity.
func (*RoleUpdate) Exec ¶
func (ru *RoleUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*RoleUpdate) ExecX ¶
func (ru *RoleUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*RoleUpdate) Mutation ¶
func (ru *RoleUpdate) Mutation() *RoleMutation
Mutation returns the RoleMutation object of the builder.
func (*RoleUpdate) RemoveMenu ¶
func (ru *RoleUpdate) RemoveMenu(m ...*Menu) *RoleUpdate
RemoveMenu removes "menu" edges to Menu entities.
func (*RoleUpdate) RemoveMenuIDs ¶
func (ru *RoleUpdate) RemoveMenuIDs(ids ...int64) *RoleUpdate
RemoveMenuIDs removes the "menu" edge to Menu entities by IDs.
func (*RoleUpdate) RemoveUser ¶
func (ru *RoleUpdate) RemoveUser(u ...*User) *RoleUpdate
RemoveUser removes "user" edges to User entities.
func (*RoleUpdate) RemoveUserIDs ¶
func (ru *RoleUpdate) RemoveUserIDs(ids ...int) *RoleUpdate
RemoveUserIDs removes the "user" edge to User entities by IDs.
func (*RoleUpdate) Save ¶
func (ru *RoleUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*RoleUpdate) SaveX ¶
func (ru *RoleUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*RoleUpdate) SetComment ¶
func (ru *RoleUpdate) SetComment(s string) *RoleUpdate
SetComment sets the "comment" field.
func (*RoleUpdate) SetDeletedAt ¶
func (ru *RoleUpdate) SetDeletedAt(t time.Time) *RoleUpdate
SetDeletedAt sets the "deleted_at" field.
func (*RoleUpdate) SetKey ¶
func (ru *RoleUpdate) SetKey(s string) *RoleUpdate
SetKey sets the "key" field.
func (*RoleUpdate) SetName ¶
func (ru *RoleUpdate) SetName(s string) *RoleUpdate
SetName sets the "name" field.
func (*RoleUpdate) SetNillableComment ¶
func (ru *RoleUpdate) SetNillableComment(s *string) *RoleUpdate
SetNillableComment sets the "comment" field if the given value is not nil.
func (*RoleUpdate) SetUpdatedAt ¶
func (ru *RoleUpdate) SetUpdatedAt(t time.Time) *RoleUpdate
SetUpdatedAt sets the "updated_at" field.
func (*RoleUpdate) Where ¶
func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate
Where appends a list predicates to the RoleUpdate builder.
type RoleUpdateOne ¶
type RoleUpdateOne struct {
// contains filtered or unexported fields
}
RoleUpdateOne is the builder for updating a single Role entity.
func (*RoleUpdateOne) AddMenu ¶
func (ruo *RoleUpdateOne) AddMenu(m ...*Menu) *RoleUpdateOne
AddMenu adds the "menu" edges to the Menu entity.
func (*RoleUpdateOne) AddMenuIDs ¶
func (ruo *RoleUpdateOne) AddMenuIDs(ids ...int64) *RoleUpdateOne
AddMenuIDs adds the "menu" edge to the Menu entity by IDs.
func (*RoleUpdateOne) AddUser ¶
func (ruo *RoleUpdateOne) AddUser(u ...*User) *RoleUpdateOne
AddUser adds the "user" edges to the User entity.
func (*RoleUpdateOne) AddUserIDs ¶
func (ruo *RoleUpdateOne) AddUserIDs(ids ...int) *RoleUpdateOne
AddUserIDs adds the "user" edge to the User entity by IDs.
func (*RoleUpdateOne) ClearComment ¶
func (ruo *RoleUpdateOne) ClearComment() *RoleUpdateOne
ClearComment clears the value of the "comment" field.
func (*RoleUpdateOne) ClearDeletedAt ¶
func (ruo *RoleUpdateOne) ClearDeletedAt() *RoleUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*RoleUpdateOne) ClearMenu ¶
func (ruo *RoleUpdateOne) ClearMenu() *RoleUpdateOne
ClearMenu clears all "menu" edges to the Menu entity.
func (*RoleUpdateOne) ClearUser ¶
func (ruo *RoleUpdateOne) ClearUser() *RoleUpdateOne
ClearUser clears all "user" edges to the User entity.
func (*RoleUpdateOne) Exec ¶
func (ruo *RoleUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*RoleUpdateOne) ExecX ¶
func (ruo *RoleUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*RoleUpdateOne) Mutation ¶
func (ruo *RoleUpdateOne) Mutation() *RoleMutation
Mutation returns the RoleMutation object of the builder.
func (*RoleUpdateOne) RemoveMenu ¶
func (ruo *RoleUpdateOne) RemoveMenu(m ...*Menu) *RoleUpdateOne
RemoveMenu removes "menu" edges to Menu entities.
func (*RoleUpdateOne) RemoveMenuIDs ¶
func (ruo *RoleUpdateOne) RemoveMenuIDs(ids ...int64) *RoleUpdateOne
RemoveMenuIDs removes the "menu" edge to Menu entities by IDs.
func (*RoleUpdateOne) RemoveUser ¶
func (ruo *RoleUpdateOne) RemoveUser(u ...*User) *RoleUpdateOne
RemoveUser removes "user" edges to User entities.
func (*RoleUpdateOne) RemoveUserIDs ¶
func (ruo *RoleUpdateOne) RemoveUserIDs(ids ...int) *RoleUpdateOne
RemoveUserIDs removes the "user" edge to User entities by IDs.
func (*RoleUpdateOne) Save ¶
func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)
Save executes the query and returns the updated Role entity.
func (*RoleUpdateOne) SaveX ¶
func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role
SaveX is like Save, but panics if an error occurs.
func (*RoleUpdateOne) Select ¶
func (ruo *RoleUpdateOne) Select(field string, fields ...string) *RoleUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*RoleUpdateOne) SetComment ¶
func (ruo *RoleUpdateOne) SetComment(s string) *RoleUpdateOne
SetComment sets the "comment" field.
func (*RoleUpdateOne) SetDeletedAt ¶
func (ruo *RoleUpdateOne) SetDeletedAt(t time.Time) *RoleUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*RoleUpdateOne) SetKey ¶
func (ruo *RoleUpdateOne) SetKey(s string) *RoleUpdateOne
SetKey sets the "key" field.
func (*RoleUpdateOne) SetName ¶
func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne
SetName sets the "name" field.
func (*RoleUpdateOne) SetNillableComment ¶
func (ruo *RoleUpdateOne) SetNillableComment(s *string) *RoleUpdateOne
SetNillableComment sets the "comment" field if the given value is not nil.
func (*RoleUpdateOne) SetUpdatedAt ¶
func (ruo *RoleUpdateOne) SetUpdatedAt(t time.Time) *RoleUpdateOne
SetUpdatedAt sets the "updated_at" field.
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(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 Rollbacker method.
type Tx ¶
type Tx struct { // Menu is the client for interacting with the Menu builders. Menu *MenuClient // Role is the client for interacting with the Role builders. Role *RoleClient // 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"` // CreatedAt holds the value of the "created_at" field. // 创建时间 CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. // 更新时间 UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. // 删除时间 DeletedAt *time.Time `json:"deleted_at,omitempty"` // Username holds the value of the "username" field. // 用户名 Username string `json:"username,omitempty"` // Password holds the value of the "password" field. // 密码 Password *string `json:"-"` // NickName holds the value of the "nick_name" field. // 昵称 NickName *string `json:"nick_name,omitempty"` // Phone holds the value of the "phone" field. // 手机号 Phone *string `json:"phone,omitempty"` // Status holds the value of the "status" field. // 用户状态 Status string `json:"status,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) 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 (u *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 create builder for User.
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(u *User) *UserDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a delete builder for the given 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) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QueryRole ¶
func (c *UserClient) QueryRole(u *User) *RoleQuery
QueryRole queries the role 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(u *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.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddRole ¶
func (uc *UserCreate) AddRole(r ...*Role) *UserCreate
AddRole adds the "role" edges to the Role entity.
func (*UserCreate) AddRoleIDs ¶
func (uc *UserCreate) AddRoleIDs(ids ...int64) *UserCreate
AddRoleIDs adds the "role" edge to the Role entity by IDs.
func (*UserCreate) Exec ¶
func (uc *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶
func (uc *UserCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreate) Mutation ¶
func (uc *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetCreatedAt ¶
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
SetCreatedAt sets the "created_at" field.
func (*UserCreate) SetDeletedAt ¶
func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate
SetDeletedAt sets the "deleted_at" field.
func (*UserCreate) SetID ¶
func (uc *UserCreate) SetID(i int) *UserCreate
SetID sets the "id" field.
func (*UserCreate) SetNickName ¶
func (uc *UserCreate) SetNickName(s string) *UserCreate
SetNickName sets the "nick_name" field.
func (*UserCreate) SetNillableCreatedAt ¶
func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*UserCreate) SetNillableDeletedAt ¶
func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*UserCreate) SetNillableNickName ¶
func (uc *UserCreate) SetNillableNickName(s *string) *UserCreate
SetNillableNickName sets the "nick_name" field if the given value is not nil.
func (*UserCreate) SetNillablePassword ¶
func (uc *UserCreate) SetNillablePassword(s *string) *UserCreate
SetNillablePassword sets the "password" field if the given value is not nil.
func (*UserCreate) SetNillablePhone ¶
func (uc *UserCreate) SetNillablePhone(s *string) *UserCreate
SetNillablePhone sets the "phone" field if the given value is not nil.
func (*UserCreate) SetNillableStatus ¶
func (uc *UserCreate) SetNillableStatus(s *string) *UserCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserCreate) SetNillableUpdatedAt ¶
func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*UserCreate) SetPassword ¶
func (uc *UserCreate) SetPassword(s string) *UserCreate
SetPassword sets the "password" field.
func (*UserCreate) SetPhone ¶
func (uc *UserCreate) SetPhone(s string) *UserCreate
SetPhone sets the "phone" field.
func (*UserCreate) SetStatus ¶
func (uc *UserCreate) SetStatus(s string) *UserCreate
SetStatus sets the "status" field.
func (*UserCreate) SetUpdatedAt ¶
func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
SetUpdatedAt sets the "updated_at" field.
func (*UserCreate) SetUsername ¶
func (uc *UserCreate) SetUsername(s string) *UserCreate
SetUsername sets the "username" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
func (*UserCreateBulk) Exec ¶
func (ucb *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶
func (ucb *UserCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.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 (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserEdges ¶
type UserEdges struct { // Role holds the value of the role edge. Role []*Role `json:"role,omitempty"` // contains filtered or unexported fields }
UserEdges holds the relations/edges for other nodes in the graph.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) BoolX ¶
func (ugb *UserGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*UserGroupBy) Bools ¶
func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) BoolsX ¶
func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserGroupBy) Float64 ¶
func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) Float64X ¶
func (ugb *UserGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*UserGroupBy) Float64s ¶
func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) Float64sX ¶
func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserGroupBy) Int ¶
func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) IntX ¶
func (ugb *UserGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*UserGroupBy) Ints ¶
func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) IntsX ¶
func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*UserGroupBy) ScanX ¶
func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*UserGroupBy) String ¶
func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*UserGroupBy) StringX ¶
func (ugb *UserGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type UserMutation ¶
type UserMutation struct {
// contains filtered or unexported fields
}
UserMutation represents an operation that mutates the User nodes in the graph.
func (*UserMutation) AddField ¶
func (m *UserMutation) AddField(name string, value ent.Value) error
AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) AddRoleIDs ¶
func (m *UserMutation) AddRoleIDs(ids ...int64)
AddRoleIDs adds the "role" edge to the Role entity by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*UserMutation) ClearDeletedAt ¶
func (m *UserMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearNickName ¶
func (m *UserMutation) ClearNickName()
ClearNickName clears the value of the "nick_name" field.
func (*UserMutation) ClearPassword ¶
func (m *UserMutation) ClearPassword()
ClearPassword clears the value of the "password" field.
func (*UserMutation) ClearPhone ¶
func (m *UserMutation) ClearPhone()
ClearPhone clears the value of the "phone" field.
func (*UserMutation) ClearRole ¶
func (m *UserMutation) ClearRole()
ClearRole clears the "role" edge to the Role entity.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*UserMutation) DeletedAt ¶
func (m *UserMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*UserMutation) DeletedAtCleared ¶
func (m *UserMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*UserMutation) NickName ¶
func (m *UserMutation) NickName() (r string, exists bool)
NickName returns the value of the "nick_name" field in the mutation.
func (*UserMutation) NickNameCleared ¶
func (m *UserMutation) NickNameCleared() bool
NickNameCleared returns if the "nick_name" field was cleared in this mutation.
func (*UserMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*UserMutation) OldNickName ¶
func (m *UserMutation) OldNickName(ctx context.Context) (v *string, err error)
OldNickName returns the old "nick_name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldPassword ¶
func (m *UserMutation) OldPassword(ctx context.Context) (v *string, err error)
OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldPhone ¶
func (m *UserMutation) OldPhone(ctx context.Context) (v *string, err error)
OldPhone returns the old "phone" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldStatus ¶
func (m *UserMutation) OldStatus(ctx context.Context) (v string, err error)
OldStatus returns the old "status" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldUsername ¶
func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the value of the "password" field in the mutation.
func (*UserMutation) PasswordCleared ¶
func (m *UserMutation) PasswordCleared() bool
PasswordCleared returns if the "password" field was cleared in this mutation.
func (*UserMutation) Phone ¶
func (m *UserMutation) Phone() (r string, exists bool)
Phone returns the value of the "phone" field in the mutation.
func (*UserMutation) PhoneCleared ¶
func (m *UserMutation) PhoneCleared() bool
PhoneCleared returns if the "phone" field was cleared in this mutation.
func (*UserMutation) RemoveRoleIDs ¶
func (m *UserMutation) RemoveRoleIDs(ids ...int64)
RemoveRoleIDs removes the "role" edge to the Role entity by IDs.
func (*UserMutation) RemovedEdges ¶
func (m *UserMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*UserMutation) RemovedIDs ¶
func (m *UserMutation) RemovedIDs(name string) []ent.Value
RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.
func (*UserMutation) RemovedRoleIDs ¶
func (m *UserMutation) RemovedRoleIDs() (ids []int64)
RemovedRole returns the removed IDs of the "role" edge to the Role entity.
func (*UserMutation) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*UserMutation) ResetDeletedAt ¶
func (m *UserMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetField ¶
func (m *UserMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ResetNickName ¶
func (m *UserMutation) ResetNickName()
ResetNickName resets all changes to the "nick_name" field.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*UserMutation) ResetPhone ¶
func (m *UserMutation) ResetPhone()
ResetPhone resets all changes to the "phone" field.
func (*UserMutation) ResetRole ¶
func (m *UserMutation) ResetRole()
ResetRole resets all changes to the "role" edge.
func (*UserMutation) ResetStatus ¶
func (m *UserMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*UserMutation) ResetUpdatedAt ¶
func (m *UserMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*UserMutation) ResetUsername ¶
func (m *UserMutation) ResetUsername()
ResetUsername resets all changes to the "username" field.
func (*UserMutation) RoleCleared ¶
func (m *UserMutation) RoleCleared() bool
RoleCleared reports if the "role" edge to the Role entity was cleared.
func (*UserMutation) RoleIDs ¶
func (m *UserMutation) RoleIDs() (ids []int64)
RoleIDs returns the "role" edge IDs in the mutation.
func (*UserMutation) SetCreatedAt ¶
func (m *UserMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*UserMutation) SetDeletedAt ¶
func (m *UserMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*UserMutation) SetField ¶
func (m *UserMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) SetID ¶
func (m *UserMutation) SetID(id int)
SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.
func (*UserMutation) SetNickName ¶
func (m *UserMutation) SetNickName(s string)
SetNickName sets the "nick_name" field.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*UserMutation) SetPhone ¶
func (m *UserMutation) SetPhone(s string)
SetPhone sets the "phone" field.
func (*UserMutation) SetStatus ¶
func (m *UserMutation) SetStatus(s string)
SetStatus sets the "status" field.
func (*UserMutation) SetUpdatedAt ¶
func (m *UserMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*UserMutation) SetUsername ¶
func (m *UserMutation) SetUsername(s string)
SetUsername sets the "username" field.
func (*UserMutation) Status ¶
func (m *UserMutation) Status() (r string, exists bool)
Status returns the value of the "status" field in the mutation.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) UpdatedAt ¶
func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*UserMutation) Username ¶
func (m *UserMutation) Username() (r string, exists bool)
Username returns the value of the "username" field in the mutation.
func (*UserMutation) Where ¶
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
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) 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) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldCreatedAt). Aggregate(ent.Count()). Scan(ctx, &v)
func (*UserQuery) Only ¶
Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one User entity is not 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 exactly one User ID is not found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Select ¶
func (uq *UserQuery) Select(fields ...string) *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 { CreatedAt time.Time `json:"created_at,omitempty"` } client.User.Query(). Select(user.FieldCreatedAt). 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.
type UserSelect ¶
type UserSelect struct { *UserQuery // contains filtered or unexported fields }
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Bool ¶
func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) BoolX ¶
func (us *UserSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*UserSelect) Bools ¶
func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) BoolsX ¶
func (us *UserSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserSelect) Float64 ¶
func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64X ¶
func (us *UserSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*UserSelect) Float64s ¶
func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64sX ¶
func (us *UserSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserSelect) Int ¶
func (us *UserSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) IntX ¶
func (us *UserSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*UserSelect) Ints ¶
func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserSelect) IntsX ¶
func (us *UserSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*UserSelect) ScanX ¶
func (us *UserSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*UserSelect) String ¶
func (us *UserSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*UserSelect) StringX ¶
func (us *UserSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) AddRole ¶
func (uu *UserUpdate) AddRole(r ...*Role) *UserUpdate
AddRole adds the "role" edges to the Role entity.
func (*UserUpdate) AddRoleIDs ¶
func (uu *UserUpdate) AddRoleIDs(ids ...int64) *UserUpdate
AddRoleIDs adds the "role" edge to the Role entity by IDs.
func (*UserUpdate) ClearDeletedAt ¶
func (uu *UserUpdate) ClearDeletedAt() *UserUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
func (*UserUpdate) ClearNickName ¶
func (uu *UserUpdate) ClearNickName() *UserUpdate
ClearNickName clears the value of the "nick_name" field.
func (*UserUpdate) ClearPassword ¶
func (uu *UserUpdate) ClearPassword() *UserUpdate
ClearPassword clears the value of the "password" field.
func (*UserUpdate) ClearPhone ¶
func (uu *UserUpdate) ClearPhone() *UserUpdate
ClearPhone clears the value of the "phone" field.
func (*UserUpdate) ClearRole ¶
func (uu *UserUpdate) ClearRole() *UserUpdate
ClearRole clears all "role" edges to the Role entity.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Mutation ¶
func (uu *UserUpdate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdate) RemoveRole ¶
func (uu *UserUpdate) RemoveRole(r ...*Role) *UserUpdate
RemoveRole removes "role" edges to Role entities.
func (*UserUpdate) RemoveRoleIDs ¶
func (uu *UserUpdate) RemoveRoleIDs(ids ...int64) *UserUpdate
RemoveRoleIDs removes the "role" edge to Role entities by IDs.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) SetDeletedAt ¶
func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate
SetDeletedAt sets the "deleted_at" field.
func (*UserUpdate) SetNickName ¶
func (uu *UserUpdate) SetNickName(s string) *UserUpdate
SetNickName sets the "nick_name" field.
func (*UserUpdate) SetNillableNickName ¶
func (uu *UserUpdate) SetNillableNickName(s *string) *UserUpdate
SetNillableNickName sets the "nick_name" field if the given value is not nil.
func (*UserUpdate) SetNillablePassword ¶
func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate
SetNillablePassword sets the "password" field if the given value is not nil.
func (*UserUpdate) SetNillablePhone ¶
func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate
SetNillablePhone sets the "phone" field if the given value is not nil.
func (*UserUpdate) SetNillableStatus ¶
func (uu *UserUpdate) SetNillableStatus(s *string) *UserUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the "password" field.
func (*UserUpdate) SetPhone ¶
func (uu *UserUpdate) SetPhone(s string) *UserUpdate
SetPhone sets the "phone" field.
func (*UserUpdate) SetStatus ¶
func (uu *UserUpdate) SetStatus(s string) *UserUpdate
SetStatus sets the "status" field.
func (*UserUpdate) SetUpdatedAt ¶
func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdate) SetUsername ¶
func (uu *UserUpdate) SetUsername(s string) *UserUpdate
SetUsername sets the "username" field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddRole ¶
func (uuo *UserUpdateOne) AddRole(r ...*Role) *UserUpdateOne
AddRole adds the "role" edges to the Role entity.
func (*UserUpdateOne) AddRoleIDs ¶
func (uuo *UserUpdateOne) AddRoleIDs(ids ...int64) *UserUpdateOne
AddRoleIDs adds the "role" edge to the Role entity by IDs.
func (*UserUpdateOne) ClearDeletedAt ¶
func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*UserUpdateOne) ClearNickName ¶
func (uuo *UserUpdateOne) ClearNickName() *UserUpdateOne
ClearNickName clears the value of the "nick_name" field.
func (*UserUpdateOne) ClearPassword ¶
func (uuo *UserUpdateOne) ClearPassword() *UserUpdateOne
ClearPassword clears the value of the "password" field.
func (*UserUpdateOne) ClearPhone ¶
func (uuo *UserUpdateOne) ClearPhone() *UserUpdateOne
ClearPhone clears the value of the "phone" field.
func (*UserUpdateOne) ClearRole ¶
func (uuo *UserUpdateOne) ClearRole() *UserUpdateOne
ClearRole clears all "role" edges to the Role entity.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdateOne) Mutation ¶
func (uuo *UserUpdateOne) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserUpdateOne) RemoveRole ¶
func (uuo *UserUpdateOne) RemoveRole(r ...*Role) *UserUpdateOne
RemoveRole removes "role" edges to Role entities.
func (*UserUpdateOne) RemoveRoleIDs ¶
func (uuo *UserUpdateOne) RemoveRoleIDs(ids ...int64) *UserUpdateOne
RemoveRoleIDs removes the "role" edge to Role entities by IDs.
func (*UserUpdateOne) Save ¶
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
Save executes the query and returns the updated User entity.
func (*UserUpdateOne) SaveX ¶
func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
SaveX is like Save, but panics if an error occurs.
func (*UserUpdateOne) Select ¶
func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*UserUpdateOne) SetDeletedAt ¶
func (uuo *UserUpdateOne) SetDeletedAt(t time.Time) *UserUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*UserUpdateOne) SetNickName ¶
func (uuo *UserUpdateOne) SetNickName(s string) *UserUpdateOne
SetNickName sets the "nick_name" field.
func (*UserUpdateOne) SetNillableNickName ¶
func (uuo *UserUpdateOne) SetNillableNickName(s *string) *UserUpdateOne
SetNillableNickName sets the "nick_name" field if the given value is not nil.
func (*UserUpdateOne) SetNillablePassword ¶
func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne
SetNillablePassword sets the "password" field if the given value is not nil.
func (*UserUpdateOne) SetNillablePhone ¶
func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne
SetNillablePhone sets the "phone" field if the given value is not nil.
func (*UserUpdateOne) SetNillableStatus ¶
func (uuo *UserUpdateOne) SetNillableStatus(s *string) *UserUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the "password" field.
func (*UserUpdateOne) SetPhone ¶
func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne
SetPhone sets the "phone" field.
func (*UserUpdateOne) SetStatus ¶
func (uuo *UserUpdateOne) SetStatus(s string) *UserUpdateOne
SetStatus sets the "status" field.
func (*UserUpdateOne) SetUpdatedAt ¶
func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdateOne) SetUsername ¶
func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
SetUsername sets the "username" field.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field 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.