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 MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type Resources
- type ResourcesClient
- func (c *ResourcesClient) Create() *ResourcesCreate
- func (c *ResourcesClient) CreateBulk(builders ...*ResourcesCreate) *ResourcesCreateBulk
- func (c *ResourcesClient) Delete() *ResourcesDelete
- func (c *ResourcesClient) DeleteOne(r *Resources) *ResourcesDeleteOne
- func (c *ResourcesClient) DeleteOneID(id string) *ResourcesDeleteOne
- func (c *ResourcesClient) Get(ctx context.Context, id string) (*Resources, error)
- func (c *ResourcesClient) GetX(ctx context.Context, id string) *Resources
- func (c *ResourcesClient) Hooks() []Hook
- func (c *ResourcesClient) Query() *ResourcesQuery
- func (c *ResourcesClient) QueryTag(r *Resources) *TagQuery
- func (c *ResourcesClient) Update() *ResourcesUpdate
- func (c *ResourcesClient) UpdateOne(r *Resources) *ResourcesUpdateOne
- func (c *ResourcesClient) UpdateOneID(id string) *ResourcesUpdateOne
- func (c *ResourcesClient) Use(hooks ...Hook)
- type ResourcesCreate
- func (rc *ResourcesCreate) AddTag(t ...*Tag) *ResourcesCreate
- func (rc *ResourcesCreate) AddTagIDs(ids ...string) *ResourcesCreate
- func (rc *ResourcesCreate) Exec(ctx context.Context) error
- func (rc *ResourcesCreate) ExecX(ctx context.Context)
- func (rc *ResourcesCreate) Mutation() *ResourcesMutation
- func (rc *ResourcesCreate) Save(ctx context.Context) (*Resources, error)
- func (rc *ResourcesCreate) SaveX(ctx context.Context) *Resources
- func (rc *ResourcesCreate) SetCreatedAt(t time.Time) *ResourcesCreate
- func (rc *ResourcesCreate) SetDesc(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetExplain(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetID(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetIcon(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetIsTop(b bool) *ResourcesCreate
- func (rc *ResourcesCreate) SetName(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetNillableCreatedAt(t *time.Time) *ResourcesCreate
- func (rc *ResourcesCreate) SetNillableID(s *string) *ResourcesCreate
- func (rc *ResourcesCreate) SetNillableIcon(s *string) *ResourcesCreate
- func (rc *ResourcesCreate) SetNillableUpdatedAt(t *time.Time) *ResourcesCreate
- func (rc *ResourcesCreate) SetURL(s string) *ResourcesCreate
- func (rc *ResourcesCreate) SetUpdatedAt(t time.Time) *ResourcesCreate
- type ResourcesCreateBulk
- type ResourcesDelete
- type ResourcesDeleteOne
- type ResourcesEdges
- type ResourcesGroupBy
- func (rgb *ResourcesGroupBy) Aggregate(fns ...AggregateFunc) *ResourcesGroupBy
- func (rgb *ResourcesGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (rgb *ResourcesGroupBy) BoolX(ctx context.Context) bool
- func (rgb *ResourcesGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (rgb *ResourcesGroupBy) BoolsX(ctx context.Context) []bool
- func (rgb *ResourcesGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (rgb *ResourcesGroupBy) Float64X(ctx context.Context) float64
- func (rgb *ResourcesGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (rgb *ResourcesGroupBy) Float64sX(ctx context.Context) []float64
- func (rgb *ResourcesGroupBy) Int(ctx context.Context) (_ int, err error)
- func (rgb *ResourcesGroupBy) IntX(ctx context.Context) int
- func (rgb *ResourcesGroupBy) Ints(ctx context.Context) ([]int, error)
- func (rgb *ResourcesGroupBy) IntsX(ctx context.Context) []int
- func (rgb *ResourcesGroupBy) Scan(ctx context.Context, v interface{}) error
- func (rgb *ResourcesGroupBy) ScanX(ctx context.Context, v interface{})
- func (rgb *ResourcesGroupBy) String(ctx context.Context) (_ string, err error)
- func (rgb *ResourcesGroupBy) StringX(ctx context.Context) string
- func (rgb *ResourcesGroupBy) Strings(ctx context.Context) ([]string, error)
- func (rgb *ResourcesGroupBy) StringsX(ctx context.Context) []string
- type ResourcesMutation
- func (m *ResourcesMutation) AddField(name string, value ent.Value) error
- func (m *ResourcesMutation) AddTagIDs(ids ...string)
- func (m *ResourcesMutation) AddedEdges() []string
- func (m *ResourcesMutation) AddedField(name string) (ent.Value, bool)
- func (m *ResourcesMutation) AddedFields() []string
- func (m *ResourcesMutation) AddedIDs(name string) []ent.Value
- func (m *ResourcesMutation) ClearEdge(name string) error
- func (m *ResourcesMutation) ClearField(name string) error
- func (m *ResourcesMutation) ClearIcon()
- func (m *ResourcesMutation) ClearTag()
- func (m *ResourcesMutation) ClearedEdges() []string
- func (m *ResourcesMutation) ClearedFields() []string
- func (m ResourcesMutation) Client() *Client
- func (m *ResourcesMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ResourcesMutation) Desc() (r string, exists bool)
- func (m *ResourcesMutation) EdgeCleared(name string) bool
- func (m *ResourcesMutation) Explain() (r string, exists bool)
- func (m *ResourcesMutation) Field(name string) (ent.Value, bool)
- func (m *ResourcesMutation) FieldCleared(name string) bool
- func (m *ResourcesMutation) Fields() []string
- func (m *ResourcesMutation) ID() (id string, exists bool)
- func (m *ResourcesMutation) Icon() (r string, exists bool)
- func (m *ResourcesMutation) IconCleared() bool
- func (m *ResourcesMutation) IsTop() (r bool, exists bool)
- func (m *ResourcesMutation) Name() (r string, exists bool)
- func (m *ResourcesMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ResourcesMutation) OldDesc(ctx context.Context) (v string, err error)
- func (m *ResourcesMutation) OldExplain(ctx context.Context) (v string, err error)
- func (m *ResourcesMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ResourcesMutation) OldIcon(ctx context.Context) (v string, err error)
- func (m *ResourcesMutation) OldIsTop(ctx context.Context) (v bool, err error)
- func (m *ResourcesMutation) OldName(ctx context.Context) (v string, err error)
- func (m *ResourcesMutation) OldURL(ctx context.Context) (v string, err error)
- func (m *ResourcesMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ResourcesMutation) Op() Op
- func (m *ResourcesMutation) RemoveTagIDs(ids ...string)
- func (m *ResourcesMutation) RemovedEdges() []string
- func (m *ResourcesMutation) RemovedIDs(name string) []ent.Value
- func (m *ResourcesMutation) RemovedTagIDs() (ids []string)
- func (m *ResourcesMutation) ResetCreatedAt()
- func (m *ResourcesMutation) ResetDesc()
- func (m *ResourcesMutation) ResetEdge(name string) error
- func (m *ResourcesMutation) ResetExplain()
- func (m *ResourcesMutation) ResetField(name string) error
- func (m *ResourcesMutation) ResetIcon()
- func (m *ResourcesMutation) ResetIsTop()
- func (m *ResourcesMutation) ResetName()
- func (m *ResourcesMutation) ResetTag()
- func (m *ResourcesMutation) ResetURL()
- func (m *ResourcesMutation) ResetUpdatedAt()
- func (m *ResourcesMutation) SetCreatedAt(t time.Time)
- func (m *ResourcesMutation) SetDesc(s string)
- func (m *ResourcesMutation) SetExplain(s string)
- func (m *ResourcesMutation) SetField(name string, value ent.Value) error
- func (m *ResourcesMutation) SetID(id string)
- func (m *ResourcesMutation) SetIcon(s string)
- func (m *ResourcesMutation) SetIsTop(b bool)
- func (m *ResourcesMutation) SetName(s string)
- func (m *ResourcesMutation) SetURL(s string)
- func (m *ResourcesMutation) SetUpdatedAt(t time.Time)
- func (m *ResourcesMutation) TagCleared() bool
- func (m *ResourcesMutation) TagIDs() (ids []string)
- func (m ResourcesMutation) Tx() (*Tx, error)
- func (m *ResourcesMutation) Type() string
- func (m *ResourcesMutation) URL() (r string, exists bool)
- func (m *ResourcesMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *ResourcesMutation) Where(ps ...predicate.Resources)
- type ResourcesQuery
- func (rq *ResourcesQuery) All(ctx context.Context) ([]*Resources, error)
- func (rq *ResourcesQuery) AllX(ctx context.Context) []*Resources
- func (rq *ResourcesQuery) Clone() *ResourcesQuery
- func (rq *ResourcesQuery) Count(ctx context.Context) (int, error)
- func (rq *ResourcesQuery) CountX(ctx context.Context) int
- func (rq *ResourcesQuery) Exist(ctx context.Context) (bool, error)
- func (rq *ResourcesQuery) ExistX(ctx context.Context) bool
- func (rq *ResourcesQuery) First(ctx context.Context) (*Resources, error)
- func (rq *ResourcesQuery) FirstID(ctx context.Context) (id string, err error)
- func (rq *ResourcesQuery) FirstIDX(ctx context.Context) string
- func (rq *ResourcesQuery) FirstX(ctx context.Context) *Resources
- func (rq *ResourcesQuery) GroupBy(field string, fields ...string) *ResourcesGroupBy
- func (rq *ResourcesQuery) IDs(ctx context.Context) ([]string, error)
- func (rq *ResourcesQuery) IDsX(ctx context.Context) []string
- func (rq *ResourcesQuery) Limit(limit int) *ResourcesQuery
- func (rq *ResourcesQuery) Offset(offset int) *ResourcesQuery
- func (rq *ResourcesQuery) Only(ctx context.Context) (*Resources, error)
- func (rq *ResourcesQuery) OnlyID(ctx context.Context) (id string, err error)
- func (rq *ResourcesQuery) OnlyIDX(ctx context.Context) string
- func (rq *ResourcesQuery) OnlyX(ctx context.Context) *Resources
- func (rq *ResourcesQuery) Order(o ...OrderFunc) *ResourcesQuery
- func (rq *ResourcesQuery) QueryTag() *TagQuery
- func (rq *ResourcesQuery) Select(fields ...string) *ResourcesSelect
- func (rq *ResourcesQuery) Unique(unique bool) *ResourcesQuery
- func (rq *ResourcesQuery) Where(ps ...predicate.Resources) *ResourcesQuery
- func (rq *ResourcesQuery) WithTag(opts ...func(*TagQuery)) *ResourcesQuery
- type ResourcesSelect
- func (rs *ResourcesSelect) Bool(ctx context.Context) (_ bool, err error)
- func (rs *ResourcesSelect) BoolX(ctx context.Context) bool
- func (rs *ResourcesSelect) Bools(ctx context.Context) ([]bool, error)
- func (rs *ResourcesSelect) BoolsX(ctx context.Context) []bool
- func (rs *ResourcesSelect) Float64(ctx context.Context) (_ float64, err error)
- func (rs *ResourcesSelect) Float64X(ctx context.Context) float64
- func (rs *ResourcesSelect) Float64s(ctx context.Context) ([]float64, error)
- func (rs *ResourcesSelect) Float64sX(ctx context.Context) []float64
- func (rs *ResourcesSelect) Int(ctx context.Context) (_ int, err error)
- func (rs *ResourcesSelect) IntX(ctx context.Context) int
- func (rs *ResourcesSelect) Ints(ctx context.Context) ([]int, error)
- func (rs *ResourcesSelect) IntsX(ctx context.Context) []int
- func (rs *ResourcesSelect) Scan(ctx context.Context, v interface{}) error
- func (rs *ResourcesSelect) ScanX(ctx context.Context, v interface{})
- func (rs *ResourcesSelect) String(ctx context.Context) (_ string, err error)
- func (rs *ResourcesSelect) StringX(ctx context.Context) string
- func (rs *ResourcesSelect) Strings(ctx context.Context) ([]string, error)
- func (rs *ResourcesSelect) StringsX(ctx context.Context) []string
- type ResourcesSlice
- type ResourcesUpdate
- func (ru *ResourcesUpdate) AddTag(t ...*Tag) *ResourcesUpdate
- func (ru *ResourcesUpdate) AddTagIDs(ids ...string) *ResourcesUpdate
- func (ru *ResourcesUpdate) ClearIcon() *ResourcesUpdate
- func (ru *ResourcesUpdate) ClearTag() *ResourcesUpdate
- func (ru *ResourcesUpdate) Exec(ctx context.Context) error
- func (ru *ResourcesUpdate) ExecX(ctx context.Context)
- func (ru *ResourcesUpdate) Mutation() *ResourcesMutation
- func (ru *ResourcesUpdate) RemoveTag(t ...*Tag) *ResourcesUpdate
- func (ru *ResourcesUpdate) RemoveTagIDs(ids ...string) *ResourcesUpdate
- func (ru *ResourcesUpdate) Save(ctx context.Context) (int, error)
- func (ru *ResourcesUpdate) SaveX(ctx context.Context) int
- func (ru *ResourcesUpdate) SetCreatedAt(t time.Time) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetDesc(s string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetExplain(s string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetIcon(s string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetIsTop(b bool) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetName(s string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetNillableCreatedAt(t *time.Time) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetNillableIcon(s *string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetURL(s string) *ResourcesUpdate
- func (ru *ResourcesUpdate) SetUpdatedAt(t time.Time) *ResourcesUpdate
- func (ru *ResourcesUpdate) Where(ps ...predicate.Resources) *ResourcesUpdate
- type ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) AddTag(t ...*Tag) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) AddTagIDs(ids ...string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) ClearIcon() *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) ClearTag() *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) Exec(ctx context.Context) error
- func (ruo *ResourcesUpdateOne) ExecX(ctx context.Context)
- func (ruo *ResourcesUpdateOne) Mutation() *ResourcesMutation
- func (ruo *ResourcesUpdateOne) RemoveTag(t ...*Tag) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) RemoveTagIDs(ids ...string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) Save(ctx context.Context) (*Resources, error)
- func (ruo *ResourcesUpdateOne) SaveX(ctx context.Context) *Resources
- func (ruo *ResourcesUpdateOne) Select(field string, fields ...string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetCreatedAt(t time.Time) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetDesc(s string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetExplain(s string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetIcon(s string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetIsTop(b bool) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetName(s string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetNillableCreatedAt(t *time.Time) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetNillableIcon(s *string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetURL(s string) *ResourcesUpdateOne
- func (ruo *ResourcesUpdateOne) SetUpdatedAt(t time.Time) *ResourcesUpdateOne
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tag
- type TagClient
- func (c *TagClient) Create() *TagCreate
- func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk
- func (c *TagClient) Delete() *TagDelete
- func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne
- func (c *TagClient) DeleteOneID(id string) *TagDeleteOne
- func (c *TagClient) Get(ctx context.Context, id string) (*Tag, error)
- func (c *TagClient) GetX(ctx context.Context, id string) *Tag
- func (c *TagClient) Hooks() []Hook
- func (c *TagClient) Query() *TagQuery
- func (c *TagClient) QueryResources(t *Tag) *ResourcesQuery
- func (c *TagClient) Update() *TagUpdate
- func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne
- func (c *TagClient) UpdateOneID(id string) *TagUpdateOne
- func (c *TagClient) Use(hooks ...Hook)
- type TagCreate
- func (tc *TagCreate) AddResourceIDs(ids ...string) *TagCreate
- func (tc *TagCreate) AddResources(r ...*Resources) *TagCreate
- func (tc *TagCreate) Exec(ctx context.Context) error
- func (tc *TagCreate) ExecX(ctx context.Context)
- func (tc *TagCreate) Mutation() *TagMutation
- func (tc *TagCreate) Save(ctx context.Context) (*Tag, error)
- func (tc *TagCreate) SaveX(ctx context.Context) *Tag
- func (tc *TagCreate) SetID(s string) *TagCreate
- func (tc *TagCreate) SetNillableID(s *string) *TagCreate
- func (tc *TagCreate) SetTag(s string) *TagCreate
- type TagCreateBulk
- type TagDelete
- type TagDeleteOne
- type TagEdges
- type TagGroupBy
- func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
- func (tgb *TagGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (tgb *TagGroupBy) BoolX(ctx context.Context) bool
- func (tgb *TagGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (tgb *TagGroupBy) BoolsX(ctx context.Context) []bool
- func (tgb *TagGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (tgb *TagGroupBy) Float64X(ctx context.Context) float64
- func (tgb *TagGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (tgb *TagGroupBy) Float64sX(ctx context.Context) []float64
- func (tgb *TagGroupBy) Int(ctx context.Context) (_ int, err error)
- func (tgb *TagGroupBy) IntX(ctx context.Context) int
- func (tgb *TagGroupBy) Ints(ctx context.Context) ([]int, error)
- func (tgb *TagGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error
- func (tgb *TagGroupBy) ScanX(ctx context.Context, v interface{})
- func (tgb *TagGroupBy) String(ctx context.Context) (_ string, err error)
- func (tgb *TagGroupBy) StringX(ctx context.Context) string
- func (tgb *TagGroupBy) Strings(ctx context.Context) ([]string, error)
- func (tgb *TagGroupBy) StringsX(ctx context.Context) []string
- type TagMutation
- func (m *TagMutation) AddField(name string, value ent.Value) error
- func (m *TagMutation) AddResourceIDs(ids ...string)
- func (m *TagMutation) AddedEdges() []string
- func (m *TagMutation) AddedField(name string) (ent.Value, bool)
- func (m *TagMutation) AddedFields() []string
- func (m *TagMutation) AddedIDs(name string) []ent.Value
- func (m *TagMutation) ClearEdge(name string) error
- func (m *TagMutation) ClearField(name string) error
- func (m *TagMutation) ClearResources()
- func (m *TagMutation) ClearedEdges() []string
- func (m *TagMutation) ClearedFields() []string
- func (m TagMutation) Client() *Client
- func (m *TagMutation) EdgeCleared(name string) bool
- func (m *TagMutation) Field(name string) (ent.Value, bool)
- func (m *TagMutation) FieldCleared(name string) bool
- func (m *TagMutation) Fields() []string
- func (m *TagMutation) ID() (id string, exists bool)
- func (m *TagMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TagMutation) OldTag(ctx context.Context) (v string, err error)
- func (m *TagMutation) Op() Op
- func (m *TagMutation) RemoveResourceIDs(ids ...string)
- func (m *TagMutation) RemovedEdges() []string
- func (m *TagMutation) RemovedIDs(name string) []ent.Value
- func (m *TagMutation) RemovedResourcesIDs() (ids []string)
- func (m *TagMutation) ResetEdge(name string) error
- func (m *TagMutation) ResetField(name string) error
- func (m *TagMutation) ResetResources()
- func (m *TagMutation) ResetTag()
- func (m *TagMutation) ResourcesCleared() bool
- func (m *TagMutation) ResourcesIDs() (ids []string)
- func (m *TagMutation) SetField(name string, value ent.Value) error
- func (m *TagMutation) SetID(id string)
- func (m *TagMutation) SetTag(s string)
- func (m *TagMutation) Tag() (r string, exists bool)
- func (m TagMutation) Tx() (*Tx, error)
- func (m *TagMutation) Type() string
- func (m *TagMutation) Where(ps ...predicate.Tag)
- type TagQuery
- func (tq *TagQuery) All(ctx context.Context) ([]*Tag, error)
- func (tq *TagQuery) AllX(ctx context.Context) []*Tag
- func (tq *TagQuery) Clone() *TagQuery
- func (tq *TagQuery) Count(ctx context.Context) (int, error)
- func (tq *TagQuery) CountX(ctx context.Context) int
- func (tq *TagQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TagQuery) ExistX(ctx context.Context) bool
- func (tq *TagQuery) First(ctx context.Context) (*Tag, error)
- func (tq *TagQuery) FirstID(ctx context.Context) (id string, err error)
- func (tq *TagQuery) FirstIDX(ctx context.Context) string
- func (tq *TagQuery) FirstX(ctx context.Context) *Tag
- func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
- func (tq *TagQuery) IDs(ctx context.Context) ([]string, error)
- func (tq *TagQuery) IDsX(ctx context.Context) []string
- func (tq *TagQuery) Limit(limit int) *TagQuery
- func (tq *TagQuery) Offset(offset int) *TagQuery
- func (tq *TagQuery) Only(ctx context.Context) (*Tag, error)
- func (tq *TagQuery) OnlyID(ctx context.Context) (id string, err error)
- func (tq *TagQuery) OnlyIDX(ctx context.Context) string
- func (tq *TagQuery) OnlyX(ctx context.Context) *Tag
- func (tq *TagQuery) Order(o ...OrderFunc) *TagQuery
- func (tq *TagQuery) QueryResources() *ResourcesQuery
- func (tq *TagQuery) Select(fields ...string) *TagSelect
- func (tq *TagQuery) Unique(unique bool) *TagQuery
- func (tq *TagQuery) Where(ps ...predicate.Tag) *TagQuery
- func (tq *TagQuery) WithResources(opts ...func(*ResourcesQuery)) *TagQuery
- type TagSelect
- func (ts *TagSelect) Bool(ctx context.Context) (_ bool, err error)
- func (ts *TagSelect) BoolX(ctx context.Context) bool
- func (ts *TagSelect) Bools(ctx context.Context) ([]bool, error)
- func (ts *TagSelect) BoolsX(ctx context.Context) []bool
- func (ts *TagSelect) Float64(ctx context.Context) (_ float64, err error)
- func (ts *TagSelect) Float64X(ctx context.Context) float64
- func (ts *TagSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ts *TagSelect) Float64sX(ctx context.Context) []float64
- func (ts *TagSelect) Int(ctx context.Context) (_ int, err error)
- func (ts *TagSelect) IntX(ctx context.Context) int
- func (ts *TagSelect) Ints(ctx context.Context) ([]int, error)
- func (ts *TagSelect) IntsX(ctx context.Context) []int
- func (ts *TagSelect) Scan(ctx context.Context, v interface{}) error
- func (ts *TagSelect) ScanX(ctx context.Context, v interface{})
- func (ts *TagSelect) String(ctx context.Context) (_ string, err error)
- func (ts *TagSelect) StringX(ctx context.Context) string
- func (ts *TagSelect) Strings(ctx context.Context) ([]string, error)
- func (ts *TagSelect) StringsX(ctx context.Context) []string
- type TagUpdate
- func (tu *TagUpdate) AddResourceIDs(ids ...string) *TagUpdate
- func (tu *TagUpdate) AddResources(r ...*Resources) *TagUpdate
- func (tu *TagUpdate) ClearResources() *TagUpdate
- func (tu *TagUpdate) Exec(ctx context.Context) error
- func (tu *TagUpdate) ExecX(ctx context.Context)
- func (tu *TagUpdate) Mutation() *TagMutation
- func (tu *TagUpdate) RemoveResourceIDs(ids ...string) *TagUpdate
- func (tu *TagUpdate) RemoveResources(r ...*Resources) *TagUpdate
- func (tu *TagUpdate) Save(ctx context.Context) (int, error)
- func (tu *TagUpdate) SaveX(ctx context.Context) int
- func (tu *TagUpdate) SetTag(s string) *TagUpdate
- func (tu *TagUpdate) Where(ps ...predicate.Tag) *TagUpdate
- type TagUpdateOne
- func (tuo *TagUpdateOne) AddResourceIDs(ids ...string) *TagUpdateOne
- func (tuo *TagUpdateOne) AddResources(r ...*Resources) *TagUpdateOne
- func (tuo *TagUpdateOne) ClearResources() *TagUpdateOne
- func (tuo *TagUpdateOne) Exec(ctx context.Context) error
- func (tuo *TagUpdateOne) ExecX(ctx context.Context)
- func (tuo *TagUpdateOne) Mutation() *TagMutation
- func (tuo *TagUpdateOne) RemoveResourceIDs(ids ...string) *TagUpdateOne
- func (tuo *TagUpdateOne) RemoveResources(r ...*Resources) *TagUpdateOne
- func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
- func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
- func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
- func (tuo *TagUpdateOne) SetTag(s string) *TagUpdateOne
- type Tags
- 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 string) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id string) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id string) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id string) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type 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) SetID(s string) *UserCreate
- func (uc *UserCreate) SetName(s string) *UserCreate
- func (uc *UserCreate) SetNillableID(s *string) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetUserType(ut user.UserType) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- 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) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- 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 string, exists bool)
- func (m *UserMutation) Name() (r string, exists bool)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldUserType(ctx context.Context) (v user.UserType, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetName()
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetUserType()
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetID(id string)
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetUserType(ut user.UserType)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UserType() (r user.UserType, 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 string, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) string
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]string, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []string
- 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 string, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) string
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery
- func (uq *UserQuery) Select(fields ...string) *UserSelect
- func (uq *UserQuery) Unique(unique bool) *UserQuery
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- type UserSelect
- 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) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetName(s string) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetUserType(ut user.UserType) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUserType(ut user.UserType) *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. TypeResources = "Resources" TypeTag = "Tag" 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 // Resources is the client for interacting with the Resources builders. Resources *ResourcesClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // 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(). Resources. 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 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 Resources ¶
type Resources struct { // ID of the ent. ID string `json:"id,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"` // Desc holds the value of the "desc" field. Desc string `json:"desc,omitempty"` // Explain holds the value of the "explain" field. Explain string `json:"explain,omitempty"` // URL holds the value of the "url" field. URL string `json:"url,omitempty"` // IsTop holds the value of the "is_top" field. IsTop bool `json:"is_top,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"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ResourcesQuery when eager-loading is set. Edges ResourcesEdges `json:"edges"` // contains filtered or unexported fields }
Resources is the model entity for the Resources schema.
func (*Resources) Unwrap ¶
Unwrap unwraps the Resources 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 (*Resources) Update ¶
func (r *Resources) Update() *ResourcesUpdateOne
Update returns a builder for updating this Resources. Note that you need to call Resources.Unwrap() before calling this method if this Resources was returned from a transaction, and the transaction was committed or rolled back.
type ResourcesClient ¶
type ResourcesClient struct {
// contains filtered or unexported fields
}
ResourcesClient is a client for the Resources schema.
func NewResourcesClient ¶
func NewResourcesClient(c config) *ResourcesClient
NewResourcesClient returns a client for the Resources from the given config.
func (*ResourcesClient) Create ¶
func (c *ResourcesClient) Create() *ResourcesCreate
Create returns a create builder for Resources.
func (*ResourcesClient) CreateBulk ¶
func (c *ResourcesClient) CreateBulk(builders ...*ResourcesCreate) *ResourcesCreateBulk
CreateBulk returns a builder for creating a bulk of Resources entities.
func (*ResourcesClient) Delete ¶
func (c *ResourcesClient) Delete() *ResourcesDelete
Delete returns a delete builder for Resources.
func (*ResourcesClient) DeleteOne ¶
func (c *ResourcesClient) DeleteOne(r *Resources) *ResourcesDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ResourcesClient) DeleteOneID ¶
func (c *ResourcesClient) DeleteOneID(id string) *ResourcesDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ResourcesClient) GetX ¶
func (c *ResourcesClient) GetX(ctx context.Context, id string) *Resources
GetX is like Get, but panics if an error occurs.
func (*ResourcesClient) Hooks ¶
func (c *ResourcesClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ResourcesClient) Query ¶
func (c *ResourcesClient) Query() *ResourcesQuery
Query returns a query builder for Resources.
func (*ResourcesClient) QueryTag ¶
func (c *ResourcesClient) QueryTag(r *Resources) *TagQuery
QueryTag queries the tag edge of a Resources.
func (*ResourcesClient) Update ¶
func (c *ResourcesClient) Update() *ResourcesUpdate
Update returns an update builder for Resources.
func (*ResourcesClient) UpdateOne ¶
func (c *ResourcesClient) UpdateOne(r *Resources) *ResourcesUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ResourcesClient) UpdateOneID ¶
func (c *ResourcesClient) UpdateOneID(id string) *ResourcesUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ResourcesClient) Use ¶
func (c *ResourcesClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `resources.Hooks(f(g(h())))`.
type ResourcesCreate ¶
type ResourcesCreate struct {
// contains filtered or unexported fields
}
ResourcesCreate is the builder for creating a Resources entity.
func (*ResourcesCreate) AddTag ¶
func (rc *ResourcesCreate) AddTag(t ...*Tag) *ResourcesCreate
AddTag adds the "tag" edges to the Tag entity.
func (*ResourcesCreate) AddTagIDs ¶
func (rc *ResourcesCreate) AddTagIDs(ids ...string) *ResourcesCreate
AddTagIDs adds the "tag" edge to the Tag entity by IDs.
func (*ResourcesCreate) Exec ¶
func (rc *ResourcesCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ResourcesCreate) ExecX ¶
func (rc *ResourcesCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ResourcesCreate) Mutation ¶
func (rc *ResourcesCreate) Mutation() *ResourcesMutation
Mutation returns the ResourcesMutation object of the builder.
func (*ResourcesCreate) Save ¶
func (rc *ResourcesCreate) Save(ctx context.Context) (*Resources, error)
Save creates the Resources in the database.
func (*ResourcesCreate) SaveX ¶
func (rc *ResourcesCreate) SaveX(ctx context.Context) *Resources
SaveX calls Save and panics if Save returns an error.
func (*ResourcesCreate) SetCreatedAt ¶
func (rc *ResourcesCreate) SetCreatedAt(t time.Time) *ResourcesCreate
SetCreatedAt sets the "created_at" field.
func (*ResourcesCreate) SetDesc ¶
func (rc *ResourcesCreate) SetDesc(s string) *ResourcesCreate
SetDesc sets the "desc" field.
func (*ResourcesCreate) SetExplain ¶
func (rc *ResourcesCreate) SetExplain(s string) *ResourcesCreate
SetExplain sets the "explain" field.
func (*ResourcesCreate) SetID ¶
func (rc *ResourcesCreate) SetID(s string) *ResourcesCreate
SetID sets the "id" field.
func (*ResourcesCreate) SetIcon ¶
func (rc *ResourcesCreate) SetIcon(s string) *ResourcesCreate
SetIcon sets the "icon" field.
func (*ResourcesCreate) SetIsTop ¶
func (rc *ResourcesCreate) SetIsTop(b bool) *ResourcesCreate
SetIsTop sets the "is_top" field.
func (*ResourcesCreate) SetName ¶
func (rc *ResourcesCreate) SetName(s string) *ResourcesCreate
SetName sets the "name" field.
func (*ResourcesCreate) SetNillableCreatedAt ¶
func (rc *ResourcesCreate) SetNillableCreatedAt(t *time.Time) *ResourcesCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ResourcesCreate) SetNillableID ¶
func (rc *ResourcesCreate) SetNillableID(s *string) *ResourcesCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*ResourcesCreate) SetNillableIcon ¶
func (rc *ResourcesCreate) SetNillableIcon(s *string) *ResourcesCreate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*ResourcesCreate) SetNillableUpdatedAt ¶
func (rc *ResourcesCreate) SetNillableUpdatedAt(t *time.Time) *ResourcesCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ResourcesCreate) SetURL ¶
func (rc *ResourcesCreate) SetURL(s string) *ResourcesCreate
SetURL sets the "url" field.
func (*ResourcesCreate) SetUpdatedAt ¶
func (rc *ResourcesCreate) SetUpdatedAt(t time.Time) *ResourcesCreate
SetUpdatedAt sets the "updated_at" field.
type ResourcesCreateBulk ¶
type ResourcesCreateBulk struct {
// contains filtered or unexported fields
}
ResourcesCreateBulk is the builder for creating many Resources entities in bulk.
func (*ResourcesCreateBulk) Exec ¶
func (rcb *ResourcesCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ResourcesCreateBulk) ExecX ¶
func (rcb *ResourcesCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ResourcesDelete ¶
type ResourcesDelete struct {
// contains filtered or unexported fields
}
ResourcesDelete is the builder for deleting a Resources entity.
func (*ResourcesDelete) Exec ¶
func (rd *ResourcesDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ResourcesDelete) ExecX ¶
func (rd *ResourcesDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ResourcesDelete) Where ¶
func (rd *ResourcesDelete) Where(ps ...predicate.Resources) *ResourcesDelete
Where appends a list predicates to the ResourcesDelete builder.
type ResourcesDeleteOne ¶
type ResourcesDeleteOne struct {
// contains filtered or unexported fields
}
ResourcesDeleteOne is the builder for deleting a single Resources entity.
func (*ResourcesDeleteOne) Exec ¶
func (rdo *ResourcesDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ResourcesDeleteOne) ExecX ¶
func (rdo *ResourcesDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ResourcesEdges ¶
type ResourcesEdges struct { // Tag holds the value of the tag edge. Tag []*Tag `json:"tag,omitempty"` // contains filtered or unexported fields }
ResourcesEdges holds the relations/edges for other nodes in the graph.
func (ResourcesEdges) TagOrErr ¶
func (e ResourcesEdges) TagOrErr() ([]*Tag, error)
TagOrErr returns the Tag value or an error if the edge was not loaded in eager-loading.
type ResourcesGroupBy ¶
type ResourcesGroupBy struct {
// contains filtered or unexported fields
}
ResourcesGroupBy is the group-by builder for Resources entities.
func (*ResourcesGroupBy) Aggregate ¶
func (rgb *ResourcesGroupBy) Aggregate(fns ...AggregateFunc) *ResourcesGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ResourcesGroupBy) Bool ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) BoolX ¶
func (rgb *ResourcesGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ResourcesGroupBy) Bools ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) BoolsX ¶
func (rgb *ResourcesGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ResourcesGroupBy) Float64 ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) Float64X ¶
func (rgb *ResourcesGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ResourcesGroupBy) Float64s ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) Float64sX ¶
func (rgb *ResourcesGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ResourcesGroupBy) Int ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) IntX ¶
func (rgb *ResourcesGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ResourcesGroupBy) Ints ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) IntsX ¶
func (rgb *ResourcesGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ResourcesGroupBy) Scan ¶
func (rgb *ResourcesGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ResourcesGroupBy) ScanX ¶
func (rgb *ResourcesGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ResourcesGroupBy) String ¶
func (rgb *ResourcesGroupBy) 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 (*ResourcesGroupBy) StringX ¶
func (rgb *ResourcesGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ResourcesMutation ¶
type ResourcesMutation struct {
// contains filtered or unexported fields
}
ResourcesMutation represents an operation that mutates the Resources nodes in the graph.
func (*ResourcesMutation) AddField ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) AddTagIDs ¶
func (m *ResourcesMutation) AddTagIDs(ids ...string)
AddTagIDs adds the "tag" edge to the Tag entity by ids.
func (*ResourcesMutation) AddedEdges ¶
func (m *ResourcesMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ResourcesMutation) AddedField ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) AddedFields ¶
func (m *ResourcesMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ResourcesMutation) AddedIDs ¶
func (m *ResourcesMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ResourcesMutation) ClearEdge ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) ClearField ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) ClearIcon ¶
func (m *ResourcesMutation) ClearIcon()
ClearIcon clears the value of the "icon" field.
func (*ResourcesMutation) ClearTag ¶
func (m *ResourcesMutation) ClearTag()
ClearTag clears the "tag" edge to the Tag entity.
func (*ResourcesMutation) ClearedEdges ¶
func (m *ResourcesMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ResourcesMutation) ClearedFields ¶
func (m *ResourcesMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ResourcesMutation) Client ¶
func (m ResourcesMutation) 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 (*ResourcesMutation) CreatedAt ¶
func (m *ResourcesMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*ResourcesMutation) Desc ¶
func (m *ResourcesMutation) Desc() (r string, exists bool)
Desc returns the value of the "desc" field in the mutation.
func (*ResourcesMutation) EdgeCleared ¶
func (m *ResourcesMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ResourcesMutation) Explain ¶
func (m *ResourcesMutation) Explain() (r string, exists bool)
Explain returns the value of the "explain" field in the mutation.
func (*ResourcesMutation) Field ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) FieldCleared ¶
func (m *ResourcesMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ResourcesMutation) Fields ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) ID ¶
func (m *ResourcesMutation) ID() (id string, 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 (*ResourcesMutation) Icon ¶
func (m *ResourcesMutation) Icon() (r string, exists bool)
Icon returns the value of the "icon" field in the mutation.
func (*ResourcesMutation) IconCleared ¶
func (m *ResourcesMutation) IconCleared() bool
IconCleared returns if the "icon" field was cleared in this mutation.
func (*ResourcesMutation) IsTop ¶
func (m *ResourcesMutation) IsTop() (r bool, exists bool)
IsTop returns the value of the "is_top" field in the mutation.
func (*ResourcesMutation) Name ¶
func (m *ResourcesMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*ResourcesMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldDesc ¶
func (m *ResourcesMutation) OldDesc(ctx context.Context) (v string, err error)
OldDesc returns the old "desc" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldExplain ¶
func (m *ResourcesMutation) OldExplain(ctx context.Context) (v string, err error)
OldExplain returns the old "explain" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) 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 (*ResourcesMutation) OldIcon ¶
func (m *ResourcesMutation) OldIcon(ctx context.Context) (v string, err error)
OldIcon returns the old "icon" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldIsTop ¶
func (m *ResourcesMutation) OldIsTop(ctx context.Context) (v bool, err error)
OldIsTop returns the old "is_top" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldName ¶
func (m *ResourcesMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldURL ¶
func (m *ResourcesMutation) OldURL(ctx context.Context) (v string, err error)
OldURL returns the old "url" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Resources entity. If the Resources 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 (*ResourcesMutation) RemoveTagIDs ¶
func (m *ResourcesMutation) RemoveTagIDs(ids ...string)
RemoveTagIDs removes the "tag" edge to the Tag entity by IDs.
func (*ResourcesMutation) RemovedEdges ¶
func (m *ResourcesMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ResourcesMutation) RemovedIDs ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) RemovedTagIDs ¶
func (m *ResourcesMutation) RemovedTagIDs() (ids []string)
RemovedTag returns the removed IDs of the "tag" edge to the Tag entity.
func (*ResourcesMutation) ResetCreatedAt ¶
func (m *ResourcesMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*ResourcesMutation) ResetDesc ¶
func (m *ResourcesMutation) ResetDesc()
ResetDesc resets all changes to the "desc" field.
func (*ResourcesMutation) ResetEdge ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) ResetExplain ¶
func (m *ResourcesMutation) ResetExplain()
ResetExplain resets all changes to the "explain" field.
func (*ResourcesMutation) ResetField ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) ResetIcon ¶
func (m *ResourcesMutation) ResetIcon()
ResetIcon resets all changes to the "icon" field.
func (*ResourcesMutation) ResetIsTop ¶
func (m *ResourcesMutation) ResetIsTop()
ResetIsTop resets all changes to the "is_top" field.
func (*ResourcesMutation) ResetName ¶
func (m *ResourcesMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*ResourcesMutation) ResetTag ¶
func (m *ResourcesMutation) ResetTag()
ResetTag resets all changes to the "tag" edge.
func (*ResourcesMutation) ResetURL ¶
func (m *ResourcesMutation) ResetURL()
ResetURL resets all changes to the "url" field.
func (*ResourcesMutation) ResetUpdatedAt ¶
func (m *ResourcesMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*ResourcesMutation) SetCreatedAt ¶
func (m *ResourcesMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*ResourcesMutation) SetDesc ¶
func (m *ResourcesMutation) SetDesc(s string)
SetDesc sets the "desc" field.
func (*ResourcesMutation) SetExplain ¶
func (m *ResourcesMutation) SetExplain(s string)
SetExplain sets the "explain" field.
func (*ResourcesMutation) SetField ¶
func (m *ResourcesMutation) 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 (*ResourcesMutation) SetID ¶
func (m *ResourcesMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Resources entities.
func (*ResourcesMutation) SetIcon ¶
func (m *ResourcesMutation) SetIcon(s string)
SetIcon sets the "icon" field.
func (*ResourcesMutation) SetIsTop ¶
func (m *ResourcesMutation) SetIsTop(b bool)
SetIsTop sets the "is_top" field.
func (*ResourcesMutation) SetName ¶
func (m *ResourcesMutation) SetName(s string)
SetName sets the "name" field.
func (*ResourcesMutation) SetURL ¶
func (m *ResourcesMutation) SetURL(s string)
SetURL sets the "url" field.
func (*ResourcesMutation) SetUpdatedAt ¶
func (m *ResourcesMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*ResourcesMutation) TagCleared ¶
func (m *ResourcesMutation) TagCleared() bool
TagCleared reports if the "tag" edge to the Tag entity was cleared.
func (*ResourcesMutation) TagIDs ¶
func (m *ResourcesMutation) TagIDs() (ids []string)
TagIDs returns the "tag" edge IDs in the mutation.
func (ResourcesMutation) Tx ¶
func (m ResourcesMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ResourcesMutation) Type ¶
func (m *ResourcesMutation) Type() string
Type returns the node type of this mutation (Resources).
func (*ResourcesMutation) URL ¶
func (m *ResourcesMutation) URL() (r string, exists bool)
URL returns the value of the "url" field in the mutation.
func (*ResourcesMutation) UpdatedAt ¶
func (m *ResourcesMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*ResourcesMutation) Where ¶
func (m *ResourcesMutation) Where(ps ...predicate.Resources)
Where appends a list predicates to the ResourcesMutation builder.
type ResourcesQuery ¶
type ResourcesQuery struct {
// contains filtered or unexported fields
}
ResourcesQuery is the builder for querying Resources entities.
func (*ResourcesQuery) All ¶
func (rq *ResourcesQuery) All(ctx context.Context) ([]*Resources, error)
All executes the query and returns a list of ResourcesSlice.
func (*ResourcesQuery) AllX ¶
func (rq *ResourcesQuery) AllX(ctx context.Context) []*Resources
AllX is like All, but panics if an error occurs.
func (*ResourcesQuery) Clone ¶
func (rq *ResourcesQuery) Clone() *ResourcesQuery
Clone returns a duplicate of the ResourcesQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ResourcesQuery) Count ¶
func (rq *ResourcesQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ResourcesQuery) CountX ¶
func (rq *ResourcesQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ResourcesQuery) Exist ¶
func (rq *ResourcesQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ResourcesQuery) ExistX ¶
func (rq *ResourcesQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ResourcesQuery) First ¶
func (rq *ResourcesQuery) First(ctx context.Context) (*Resources, error)
First returns the first Resources entity from the query. Returns a *NotFoundError when no Resources was found.
func (*ResourcesQuery) FirstID ¶
func (rq *ResourcesQuery) FirstID(ctx context.Context) (id string, err error)
FirstID returns the first Resources ID from the query. Returns a *NotFoundError when no Resources ID was found.
func (*ResourcesQuery) FirstIDX ¶
func (rq *ResourcesQuery) FirstIDX(ctx context.Context) string
FirstIDX is like FirstID, but panics if an error occurs.
func (*ResourcesQuery) FirstX ¶
func (rq *ResourcesQuery) FirstX(ctx context.Context) *Resources
FirstX is like First, but panics if an error occurs.
func (*ResourcesQuery) GroupBy ¶
func (rq *ResourcesQuery) GroupBy(field string, fields ...string) *ResourcesGroupBy
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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Resources.Query(). GroupBy(resources.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ResourcesQuery) IDs ¶
func (rq *ResourcesQuery) IDs(ctx context.Context) ([]string, error)
IDs executes the query and returns a list of Resources IDs.
func (*ResourcesQuery) IDsX ¶
func (rq *ResourcesQuery) IDsX(ctx context.Context) []string
IDsX is like IDs, but panics if an error occurs.
func (*ResourcesQuery) Limit ¶
func (rq *ResourcesQuery) Limit(limit int) *ResourcesQuery
Limit adds a limit step to the query.
func (*ResourcesQuery) Offset ¶
func (rq *ResourcesQuery) Offset(offset int) *ResourcesQuery
Offset adds an offset step to the query.
func (*ResourcesQuery) Only ¶
func (rq *ResourcesQuery) Only(ctx context.Context) (*Resources, error)
Only returns a single Resources entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Resources entity is not found. Returns a *NotFoundError when no Resources entities are found.
func (*ResourcesQuery) OnlyID ¶
func (rq *ResourcesQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Resources ID in the query. Returns a *NotSingularError when exactly one Resources ID is not found. Returns a *NotFoundError when no entities are found.
func (*ResourcesQuery) OnlyIDX ¶
func (rq *ResourcesQuery) OnlyIDX(ctx context.Context) string
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ResourcesQuery) OnlyX ¶
func (rq *ResourcesQuery) OnlyX(ctx context.Context) *Resources
OnlyX is like Only, but panics if an error occurs.
func (*ResourcesQuery) Order ¶
func (rq *ResourcesQuery) Order(o ...OrderFunc) *ResourcesQuery
Order adds an order step to the query.
func (*ResourcesQuery) QueryTag ¶
func (rq *ResourcesQuery) QueryTag() *TagQuery
QueryTag chains the current query on the "tag" edge.
func (*ResourcesQuery) Select ¶
func (rq *ResourcesQuery) Select(fields ...string) *ResourcesSelect
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 { Name string `json:"name,omitempty"` } client.Resources.Query(). Select(resources.FieldName). Scan(ctx, &v)
func (*ResourcesQuery) Unique ¶
func (rq *ResourcesQuery) Unique(unique bool) *ResourcesQuery
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 (*ResourcesQuery) Where ¶
func (rq *ResourcesQuery) Where(ps ...predicate.Resources) *ResourcesQuery
Where adds a new predicate for the ResourcesQuery builder.
func (*ResourcesQuery) WithTag ¶
func (rq *ResourcesQuery) WithTag(opts ...func(*TagQuery)) *ResourcesQuery
WithTag tells the query-builder to eager-load the nodes that are connected to the "tag" edge. The optional arguments are used to configure the query builder of the edge.
type ResourcesSelect ¶
type ResourcesSelect struct { *ResourcesQuery // contains filtered or unexported fields }
ResourcesSelect is the builder for selecting fields of Resources entities.
func (*ResourcesSelect) Bool ¶
func (rs *ResourcesSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) BoolX ¶
func (rs *ResourcesSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ResourcesSelect) Bools ¶
func (rs *ResourcesSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) BoolsX ¶
func (rs *ResourcesSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ResourcesSelect) Float64 ¶
func (rs *ResourcesSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) Float64X ¶
func (rs *ResourcesSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ResourcesSelect) Float64s ¶
func (rs *ResourcesSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) Float64sX ¶
func (rs *ResourcesSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ResourcesSelect) Int ¶
func (rs *ResourcesSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) IntX ¶
func (rs *ResourcesSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ResourcesSelect) Ints ¶
func (rs *ResourcesSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) IntsX ¶
func (rs *ResourcesSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ResourcesSelect) Scan ¶
func (rs *ResourcesSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ResourcesSelect) ScanX ¶
func (rs *ResourcesSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ResourcesSelect) String ¶
func (rs *ResourcesSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ResourcesSelect) StringX ¶
func (rs *ResourcesSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ResourcesSlice ¶
type ResourcesSlice []*Resources
ResourcesSlice is a parsable slice of Resources.
type ResourcesUpdate ¶
type ResourcesUpdate struct {
// contains filtered or unexported fields
}
ResourcesUpdate is the builder for updating Resources entities.
func (*ResourcesUpdate) AddTag ¶
func (ru *ResourcesUpdate) AddTag(t ...*Tag) *ResourcesUpdate
AddTag adds the "tag" edges to the Tag entity.
func (*ResourcesUpdate) AddTagIDs ¶
func (ru *ResourcesUpdate) AddTagIDs(ids ...string) *ResourcesUpdate
AddTagIDs adds the "tag" edge to the Tag entity by IDs.
func (*ResourcesUpdate) ClearIcon ¶
func (ru *ResourcesUpdate) ClearIcon() *ResourcesUpdate
ClearIcon clears the value of the "icon" field.
func (*ResourcesUpdate) ClearTag ¶
func (ru *ResourcesUpdate) ClearTag() *ResourcesUpdate
ClearTag clears all "tag" edges to the Tag entity.
func (*ResourcesUpdate) Exec ¶
func (ru *ResourcesUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ResourcesUpdate) ExecX ¶
func (ru *ResourcesUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ResourcesUpdate) Mutation ¶
func (ru *ResourcesUpdate) Mutation() *ResourcesMutation
Mutation returns the ResourcesMutation object of the builder.
func (*ResourcesUpdate) RemoveTag ¶
func (ru *ResourcesUpdate) RemoveTag(t ...*Tag) *ResourcesUpdate
RemoveTag removes "tag" edges to Tag entities.
func (*ResourcesUpdate) RemoveTagIDs ¶
func (ru *ResourcesUpdate) RemoveTagIDs(ids ...string) *ResourcesUpdate
RemoveTagIDs removes the "tag" edge to Tag entities by IDs.
func (*ResourcesUpdate) Save ¶
func (ru *ResourcesUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ResourcesUpdate) SaveX ¶
func (ru *ResourcesUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ResourcesUpdate) SetCreatedAt ¶
func (ru *ResourcesUpdate) SetCreatedAt(t time.Time) *ResourcesUpdate
SetCreatedAt sets the "created_at" field.
func (*ResourcesUpdate) SetDesc ¶
func (ru *ResourcesUpdate) SetDesc(s string) *ResourcesUpdate
SetDesc sets the "desc" field.
func (*ResourcesUpdate) SetExplain ¶
func (ru *ResourcesUpdate) SetExplain(s string) *ResourcesUpdate
SetExplain sets the "explain" field.
func (*ResourcesUpdate) SetIcon ¶
func (ru *ResourcesUpdate) SetIcon(s string) *ResourcesUpdate
SetIcon sets the "icon" field.
func (*ResourcesUpdate) SetIsTop ¶
func (ru *ResourcesUpdate) SetIsTop(b bool) *ResourcesUpdate
SetIsTop sets the "is_top" field.
func (*ResourcesUpdate) SetName ¶
func (ru *ResourcesUpdate) SetName(s string) *ResourcesUpdate
SetName sets the "name" field.
func (*ResourcesUpdate) SetNillableCreatedAt ¶
func (ru *ResourcesUpdate) SetNillableCreatedAt(t *time.Time) *ResourcesUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ResourcesUpdate) SetNillableIcon ¶
func (ru *ResourcesUpdate) SetNillableIcon(s *string) *ResourcesUpdate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*ResourcesUpdate) SetURL ¶
func (ru *ResourcesUpdate) SetURL(s string) *ResourcesUpdate
SetURL sets the "url" field.
func (*ResourcesUpdate) SetUpdatedAt ¶
func (ru *ResourcesUpdate) SetUpdatedAt(t time.Time) *ResourcesUpdate
SetUpdatedAt sets the "updated_at" field.
func (*ResourcesUpdate) Where ¶
func (ru *ResourcesUpdate) Where(ps ...predicate.Resources) *ResourcesUpdate
Where appends a list predicates to the ResourcesUpdate builder.
type ResourcesUpdateOne ¶
type ResourcesUpdateOne struct {
// contains filtered or unexported fields
}
ResourcesUpdateOne is the builder for updating a single Resources entity.
func (*ResourcesUpdateOne) AddTag ¶
func (ruo *ResourcesUpdateOne) AddTag(t ...*Tag) *ResourcesUpdateOne
AddTag adds the "tag" edges to the Tag entity.
func (*ResourcesUpdateOne) AddTagIDs ¶
func (ruo *ResourcesUpdateOne) AddTagIDs(ids ...string) *ResourcesUpdateOne
AddTagIDs adds the "tag" edge to the Tag entity by IDs.
func (*ResourcesUpdateOne) ClearIcon ¶
func (ruo *ResourcesUpdateOne) ClearIcon() *ResourcesUpdateOne
ClearIcon clears the value of the "icon" field.
func (*ResourcesUpdateOne) ClearTag ¶
func (ruo *ResourcesUpdateOne) ClearTag() *ResourcesUpdateOne
ClearTag clears all "tag" edges to the Tag entity.
func (*ResourcesUpdateOne) Exec ¶
func (ruo *ResourcesUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ResourcesUpdateOne) ExecX ¶
func (ruo *ResourcesUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ResourcesUpdateOne) Mutation ¶
func (ruo *ResourcesUpdateOne) Mutation() *ResourcesMutation
Mutation returns the ResourcesMutation object of the builder.
func (*ResourcesUpdateOne) RemoveTag ¶
func (ruo *ResourcesUpdateOne) RemoveTag(t ...*Tag) *ResourcesUpdateOne
RemoveTag removes "tag" edges to Tag entities.
func (*ResourcesUpdateOne) RemoveTagIDs ¶
func (ruo *ResourcesUpdateOne) RemoveTagIDs(ids ...string) *ResourcesUpdateOne
RemoveTagIDs removes the "tag" edge to Tag entities by IDs.
func (*ResourcesUpdateOne) Save ¶
func (ruo *ResourcesUpdateOne) Save(ctx context.Context) (*Resources, error)
Save executes the query and returns the updated Resources entity.
func (*ResourcesUpdateOne) SaveX ¶
func (ruo *ResourcesUpdateOne) SaveX(ctx context.Context) *Resources
SaveX is like Save, but panics if an error occurs.
func (*ResourcesUpdateOne) Select ¶
func (ruo *ResourcesUpdateOne) Select(field string, fields ...string) *ResourcesUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ResourcesUpdateOne) SetCreatedAt ¶
func (ruo *ResourcesUpdateOne) SetCreatedAt(t time.Time) *ResourcesUpdateOne
SetCreatedAt sets the "created_at" field.
func (*ResourcesUpdateOne) SetDesc ¶
func (ruo *ResourcesUpdateOne) SetDesc(s string) *ResourcesUpdateOne
SetDesc sets the "desc" field.
func (*ResourcesUpdateOne) SetExplain ¶
func (ruo *ResourcesUpdateOne) SetExplain(s string) *ResourcesUpdateOne
SetExplain sets the "explain" field.
func (*ResourcesUpdateOne) SetIcon ¶
func (ruo *ResourcesUpdateOne) SetIcon(s string) *ResourcesUpdateOne
SetIcon sets the "icon" field.
func (*ResourcesUpdateOne) SetIsTop ¶
func (ruo *ResourcesUpdateOne) SetIsTop(b bool) *ResourcesUpdateOne
SetIsTop sets the "is_top" field.
func (*ResourcesUpdateOne) SetName ¶
func (ruo *ResourcesUpdateOne) SetName(s string) *ResourcesUpdateOne
SetName sets the "name" field.
func (*ResourcesUpdateOne) SetNillableCreatedAt ¶
func (ruo *ResourcesUpdateOne) SetNillableCreatedAt(t *time.Time) *ResourcesUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ResourcesUpdateOne) SetNillableIcon ¶
func (ruo *ResourcesUpdateOne) SetNillableIcon(s *string) *ResourcesUpdateOne
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*ResourcesUpdateOne) SetURL ¶
func (ruo *ResourcesUpdateOne) SetURL(s string) *ResourcesUpdateOne
SetURL sets the "url" field.
func (*ResourcesUpdateOne) SetUpdatedAt ¶
func (ruo *ResourcesUpdateOne) SetUpdatedAt(t time.Time) *ResourcesUpdateOne
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 Tag ¶
type Tag struct { // ID of the ent. ID string `json:"id,omitempty"` // Tag holds the value of the "tag" field. Tag string `json:"tag,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TagQuery when eager-loading is set. Edges TagEdges `json:"edges"` // contains filtered or unexported fields }
Tag is the model entity for the Tag schema.
func (*Tag) QueryResources ¶
func (t *Tag) QueryResources() *ResourcesQuery
QueryResources queries the "resources" edge of the Tag entity.
func (*Tag) Unwrap ¶
Unwrap unwraps the Tag 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 (*Tag) Update ¶
func (t *Tag) Update() *TagUpdateOne
Update returns a builder for updating this Tag. Note that you need to call Tag.Unwrap() before calling this method if this Tag was returned from a transaction, and the transaction was committed or rolled back.
type TagClient ¶
type TagClient struct {
// contains filtered or unexported fields
}
TagClient is a client for the Tag schema.
func NewTagClient ¶
func NewTagClient(c config) *TagClient
NewTagClient returns a client for the Tag from the given config.
func (*TagClient) CreateBulk ¶
func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk
CreateBulk returns a builder for creating a bulk of Tag entities.
func (*TagClient) DeleteOne ¶
func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*TagClient) DeleteOneID ¶
func (c *TagClient) DeleteOneID(id string) *TagDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*TagClient) QueryResources ¶
func (c *TagClient) QueryResources(t *Tag) *ResourcesQuery
QueryResources queries the resources edge of a Tag.
func (*TagClient) UpdateOne ¶
func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TagClient) UpdateOneID ¶
func (c *TagClient) UpdateOneID(id string) *TagUpdateOne
UpdateOneID returns an update builder for the given id.
type TagCreate ¶
type TagCreate struct {
// contains filtered or unexported fields
}
TagCreate is the builder for creating a Tag entity.
func (*TagCreate) AddResourceIDs ¶
AddResourceIDs adds the "resources" edge to the Resources entity by IDs.
func (*TagCreate) AddResources ¶
AddResources adds the "resources" edges to the Resources entity.
func (*TagCreate) Mutation ¶
func (tc *TagCreate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagCreate) SetNillableID ¶
SetNillableID sets the "id" field if the given value is not nil.
type TagCreateBulk ¶
type TagCreateBulk struct {
// contains filtered or unexported fields
}
TagCreateBulk is the builder for creating many Tag entities in bulk.
func (*TagCreateBulk) Exec ¶
func (tcb *TagCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TagCreateBulk) ExecX ¶
func (tcb *TagCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TagDelete ¶
type TagDelete struct {
// contains filtered or unexported fields
}
TagDelete is the builder for deleting a Tag entity.
func (*TagDelete) Exec ¶
Exec executes the deletion query and returns how many vertices were deleted.
type TagDeleteOne ¶
type TagDeleteOne struct {
// contains filtered or unexported fields
}
TagDeleteOne is the builder for deleting a single Tag entity.
func (*TagDeleteOne) Exec ¶
func (tdo *TagDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TagDeleteOne) ExecX ¶
func (tdo *TagDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TagEdges ¶
type TagEdges struct { // Resources holds the value of the resources edge. Resources []*Resources `json:"resources,omitempty"` // contains filtered or unexported fields }
TagEdges holds the relations/edges for other nodes in the graph.
func (TagEdges) ResourcesOrErr ¶
ResourcesOrErr returns the Resources value or an error if the edge was not loaded in eager-loading.
type TagGroupBy ¶
type TagGroupBy struct {
// contains filtered or unexported fields
}
TagGroupBy is the group-by builder for Tag entities.
func (*TagGroupBy) Aggregate ¶
func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TagGroupBy) Bool ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) BoolX ¶
func (tgb *TagGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*TagGroupBy) Bools ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) BoolsX ¶
func (tgb *TagGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*TagGroupBy) Float64 ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) Float64X ¶
func (tgb *TagGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*TagGroupBy) Float64s ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) Float64sX ¶
func (tgb *TagGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*TagGroupBy) Int ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) IntX ¶
func (tgb *TagGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*TagGroupBy) Ints ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) IntsX ¶
func (tgb *TagGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*TagGroupBy) Scan ¶
func (tgb *TagGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*TagGroupBy) ScanX ¶
func (tgb *TagGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*TagGroupBy) String ¶
func (tgb *TagGroupBy) 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 (*TagGroupBy) StringX ¶
func (tgb *TagGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type TagMutation ¶
type TagMutation struct {
// contains filtered or unexported fields
}
TagMutation represents an operation that mutates the Tag nodes in the graph.
func (*TagMutation) AddField ¶
func (m *TagMutation) 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 (*TagMutation) AddResourceIDs ¶
func (m *TagMutation) AddResourceIDs(ids ...string)
AddResourceIDs adds the "resources" edge to the Resources entity by ids.
func (*TagMutation) AddedEdges ¶
func (m *TagMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TagMutation) AddedField ¶
func (m *TagMutation) 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 (*TagMutation) AddedFields ¶
func (m *TagMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TagMutation) AddedIDs ¶
func (m *TagMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TagMutation) ClearEdge ¶
func (m *TagMutation) 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 (*TagMutation) ClearField ¶
func (m *TagMutation) 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 (*TagMutation) ClearResources ¶
func (m *TagMutation) ClearResources()
ClearResources clears the "resources" edge to the Resources entity.
func (*TagMutation) ClearedEdges ¶
func (m *TagMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TagMutation) ClearedFields ¶
func (m *TagMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TagMutation) Client ¶
func (m TagMutation) 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 (*TagMutation) EdgeCleared ¶
func (m *TagMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TagMutation) Field ¶
func (m *TagMutation) 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 (*TagMutation) FieldCleared ¶
func (m *TagMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TagMutation) Fields ¶
func (m *TagMutation) 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 (*TagMutation) ID ¶
func (m *TagMutation) ID() (id string, 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 (*TagMutation) 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 (*TagMutation) OldTag ¶
func (m *TagMutation) OldTag(ctx context.Context) (v string, err error)
OldTag returns the old "tag" field's value of the Tag entity. If the Tag 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 (*TagMutation) RemoveResourceIDs ¶
func (m *TagMutation) RemoveResourceIDs(ids ...string)
RemoveResourceIDs removes the "resources" edge to the Resources entity by IDs.
func (*TagMutation) RemovedEdges ¶
func (m *TagMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TagMutation) RemovedIDs ¶
func (m *TagMutation) 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 (*TagMutation) RemovedResourcesIDs ¶
func (m *TagMutation) RemovedResourcesIDs() (ids []string)
RemovedResources returns the removed IDs of the "resources" edge to the Resources entity.
func (*TagMutation) ResetEdge ¶
func (m *TagMutation) 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 (*TagMutation) ResetField ¶
func (m *TagMutation) 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 (*TagMutation) ResetResources ¶
func (m *TagMutation) ResetResources()
ResetResources resets all changes to the "resources" edge.
func (*TagMutation) ResetTag ¶
func (m *TagMutation) ResetTag()
ResetTag resets all changes to the "tag" field.
func (*TagMutation) ResourcesCleared ¶
func (m *TagMutation) ResourcesCleared() bool
ResourcesCleared reports if the "resources" edge to the Resources entity was cleared.
func (*TagMutation) ResourcesIDs ¶
func (m *TagMutation) ResourcesIDs() (ids []string)
ResourcesIDs returns the "resources" edge IDs in the mutation.
func (*TagMutation) SetField ¶
func (m *TagMutation) 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 (*TagMutation) SetID ¶
func (m *TagMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Tag entities.
func (*TagMutation) Tag ¶
func (m *TagMutation) Tag() (r string, exists bool)
Tag returns the value of the "tag" field in the mutation.
func (TagMutation) Tx ¶
func (m TagMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TagMutation) Type ¶
func (m *TagMutation) Type() string
Type returns the node type of this mutation (Tag).
func (*TagMutation) Where ¶
func (m *TagMutation) Where(ps ...predicate.Tag)
Where appends a list predicates to the TagMutation builder.
type TagQuery ¶
type TagQuery struct {
// contains filtered or unexported fields
}
TagQuery is the builder for querying Tag entities.
func (*TagQuery) Clone ¶
Clone returns a duplicate of the TagQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TagQuery) First ¶
First returns the first Tag entity from the query. Returns a *NotFoundError when no Tag was found.
func (*TagQuery) FirstID ¶
FirstID returns the first Tag ID from the query. Returns a *NotFoundError when no Tag ID was found.
func (*TagQuery) GroupBy ¶
func (tq *TagQuery) GroupBy(field string, fields ...string) *TagGroupBy
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 { Tag string `json:"tag,omitempty"` Count int `json:"count,omitempty"` } client.Tag.Query(). GroupBy(tag.FieldTag). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TagQuery) Only ¶
Only returns a single Tag entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Tag entity is not found. Returns a *NotFoundError when no Tag entities are found.
func (*TagQuery) OnlyID ¶
OnlyID is like Only, but returns the only Tag ID in the query. Returns a *NotSingularError when exactly one Tag ID is not found. Returns a *NotFoundError when no entities are found.
func (*TagQuery) QueryResources ¶
func (tq *TagQuery) QueryResources() *ResourcesQuery
QueryResources chains the current query on the "resources" edge.
func (*TagQuery) Select ¶
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 { Tag string `json:"tag,omitempty"` } client.Tag.Query(). Select(tag.FieldTag). Scan(ctx, &v)
func (*TagQuery) 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 (*TagQuery) WithResources ¶
func (tq *TagQuery) WithResources(opts ...func(*ResourcesQuery)) *TagQuery
WithResources tells the query-builder to eager-load the nodes that are connected to the "resources" edge. The optional arguments are used to configure the query builder of the edge.
type TagSelect ¶
type TagSelect struct { *TagQuery // contains filtered or unexported fields }
TagSelect is the builder for selecting fields of Tag entities.
func (*TagSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TagSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TagSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TagSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TagSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TagSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TagUpdate ¶
type TagUpdate struct {
// contains filtered or unexported fields
}
TagUpdate is the builder for updating Tag entities.
func (*TagUpdate) AddResourceIDs ¶
AddResourceIDs adds the "resources" edge to the Resources entity by IDs.
func (*TagUpdate) AddResources ¶
AddResources adds the "resources" edges to the Resources entity.
func (*TagUpdate) ClearResources ¶
ClearResources clears all "resources" edges to the Resources entity.
func (*TagUpdate) Mutation ¶
func (tu *TagUpdate) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdate) RemoveResourceIDs ¶
RemoveResourceIDs removes the "resources" edge to Resources entities by IDs.
func (*TagUpdate) RemoveResources ¶
RemoveResources removes "resources" edges to Resources entities.
func (*TagUpdate) Save ¶
Save executes the query and returns the number of nodes affected by the update operation.
type TagUpdateOne ¶
type TagUpdateOne struct {
// contains filtered or unexported fields
}
TagUpdateOne is the builder for updating a single Tag entity.
func (*TagUpdateOne) AddResourceIDs ¶
func (tuo *TagUpdateOne) AddResourceIDs(ids ...string) *TagUpdateOne
AddResourceIDs adds the "resources" edge to the Resources entity by IDs.
func (*TagUpdateOne) AddResources ¶
func (tuo *TagUpdateOne) AddResources(r ...*Resources) *TagUpdateOne
AddResources adds the "resources" edges to the Resources entity.
func (*TagUpdateOne) ClearResources ¶
func (tuo *TagUpdateOne) ClearResources() *TagUpdateOne
ClearResources clears all "resources" edges to the Resources entity.
func (*TagUpdateOne) Exec ¶
func (tuo *TagUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TagUpdateOne) ExecX ¶
func (tuo *TagUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TagUpdateOne) Mutation ¶
func (tuo *TagUpdateOne) Mutation() *TagMutation
Mutation returns the TagMutation object of the builder.
func (*TagUpdateOne) RemoveResourceIDs ¶
func (tuo *TagUpdateOne) RemoveResourceIDs(ids ...string) *TagUpdateOne
RemoveResourceIDs removes the "resources" edge to Resources entities by IDs.
func (*TagUpdateOne) RemoveResources ¶
func (tuo *TagUpdateOne) RemoveResources(r ...*Resources) *TagUpdateOne
RemoveResources removes "resources" edges to Resources entities.
func (*TagUpdateOne) Save ¶
func (tuo *TagUpdateOne) Save(ctx context.Context) (*Tag, error)
Save executes the query and returns the updated Tag entity.
func (*TagUpdateOne) SaveX ¶
func (tuo *TagUpdateOne) SaveX(ctx context.Context) *Tag
SaveX is like Save, but panics if an error occurs.
func (*TagUpdateOne) Select ¶
func (tuo *TagUpdateOne) Select(field string, fields ...string) *TagUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TagUpdateOne) SetTag ¶
func (tuo *TagUpdateOne) SetTag(s string) *TagUpdateOne
SetTag sets the "tag" field.
type Tx ¶
type Tx struct { // Resources is the client for interacting with the Resources builders. Resources *ResourcesClient // Tag is the client for interacting with the Tag builders. Tag *TagClient // 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 string `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // UserType holds the value of the "user_type" field. UserType user.UserType `json:"user_type,omitempty"` // 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 string) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id string) *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) 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 string) *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) 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) SetID ¶
func (uc *UserCreate) SetID(s string) *UserCreate
SetID sets the "id" field.
func (*UserCreate) SetName ¶
func (uc *UserCreate) SetName(s string) *UserCreate
SetName sets the "name" field.
func (*UserCreate) SetNillableID ¶
func (uc *UserCreate) SetNillableID(s *string) *UserCreate
SetNillableID sets the "id" 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) SetUserType ¶
func (uc *UserCreate) SetUserType(ut user.UserType) *UserCreate
SetUserType sets the "user_type" 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 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) 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) 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) 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) 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 string, 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) Name ¶
func (m *UserMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
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) OldName ¶
func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "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) OldUserType ¶
OldUserType returns the old "user_type" 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) 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) 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) ResetName ¶
func (m *UserMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*UserMutation) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*UserMutation) ResetUserType ¶
func (m *UserMutation) ResetUserType()
ResetUserType resets all changes to the "user_type" 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 string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.
func (*UserMutation) SetName ¶
func (m *UserMutation) SetName(s string)
SetName sets the "name" field.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*UserMutation) SetUserType ¶
func (m *UserMutation) SetUserType(ut user.UserType)
SetUserType sets the "user_type" field.
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) UserType ¶
func (m *UserMutation) UserType() (r user.UserType, exists bool)
UserType returns the value of the "user_type" 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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldName). 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 { Name string `json:"name,omitempty"` } client.User.Query(). Select(user.FieldName). Scan(ctx, &v)
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) 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) 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) SetName ¶
func (uu *UserUpdate) SetName(s string) *UserUpdate
SetName sets the "name" field.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the "password" field.
func (*UserUpdate) SetUserType ¶
func (uu *UserUpdate) SetUserType(ut user.UserType) *UserUpdate
SetUserType sets the "user_type" 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) 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) 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) SetName ¶
func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
SetName sets the "name" field.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the "password" field.
func (*UserUpdateOne) SetUserType ¶
func (uuo *UserUpdateOne) SetUserType(ut user.UserType) *UserUpdateOne
SetUserType sets the "user_type" 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.