Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- 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 Article
- type ArticleClient
- func (c *ArticleClient) Create() *ArticleCreate
- func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk
- func (c *ArticleClient) Delete() *ArticleDelete
- func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne
- func (c *ArticleClient) DeleteOneID(id int) *ArticleDeleteOne
- func (c *ArticleClient) Get(ctx context.Context, id int) (*Article, error)
- func (c *ArticleClient) GetX(ctx context.Context, id int) *Article
- func (c *ArticleClient) Hooks() []Hook
- func (c *ArticleClient) Intercept(interceptors ...Interceptor)
- func (c *ArticleClient) Interceptors() []Interceptor
- func (c *ArticleClient) MapCreateBulk(slice any, setFunc func(*ArticleCreate, int)) *ArticleCreateBulk
- func (c *ArticleClient) Query() *ArticleQuery
- func (c *ArticleClient) Update() *ArticleUpdate
- func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne
- func (c *ArticleClient) UpdateOneID(id int) *ArticleUpdateOne
- func (c *ArticleClient) Use(hooks ...Hook)
- type ArticleCreate
- func (ac *ArticleCreate) Exec(ctx context.Context) error
- func (ac *ArticleCreate) ExecX(ctx context.Context)
- func (ac *ArticleCreate) Mutation() *ArticleMutation
- func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)
- func (ac *ArticleCreate) SaveX(ctx context.Context) *Article
- func (ac *ArticleCreate) SetContent(s string) *ArticleCreate
- func (ac *ArticleCreate) SetCreatedAt(t time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetNillableCreatedAt(t *time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetNillableUpdatedAt(t *time.Time) *ArticleCreate
- func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate
- func (ac *ArticleCreate) SetUpdatedAt(t time.Time) *ArticleCreate
- type ArticleCreateBulk
- type ArticleDelete
- type ArticleDeleteOne
- type ArticleGroupBy
- func (agb *ArticleGroupBy) Aggregate(fns ...AggregateFunc) *ArticleGroupBy
- func (s *ArticleGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArticleGroupBy) BoolX(ctx context.Context) bool
- func (s *ArticleGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ArticleGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ArticleGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArticleGroupBy) Float64X(ctx context.Context) float64
- func (s *ArticleGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArticleGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ArticleGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ArticleGroupBy) IntX(ctx context.Context) int
- func (s *ArticleGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ArticleGroupBy) IntsX(ctx context.Context) []int
- func (agb *ArticleGroupBy) Scan(ctx context.Context, v any) error
- func (s *ArticleGroupBy) ScanX(ctx context.Context, v any)
- func (s *ArticleGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ArticleGroupBy) StringX(ctx context.Context) string
- func (s *ArticleGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ArticleGroupBy) StringsX(ctx context.Context) []string
- type ArticleMutation
- func (m *ArticleMutation) AddField(name string, value ent.Value) error
- func (m *ArticleMutation) AddedEdges() []string
- func (m *ArticleMutation) AddedField(name string) (ent.Value, bool)
- func (m *ArticleMutation) AddedFields() []string
- func (m *ArticleMutation) AddedIDs(name string) []ent.Value
- func (m *ArticleMutation) ClearEdge(name string) error
- func (m *ArticleMutation) ClearField(name string) error
- func (m *ArticleMutation) ClearedEdges() []string
- func (m *ArticleMutation) ClearedFields() []string
- func (m ArticleMutation) Client() *Client
- func (m *ArticleMutation) Content() (r string, exists bool)
- func (m *ArticleMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ArticleMutation) EdgeCleared(name string) bool
- func (m *ArticleMutation) Field(name string) (ent.Value, bool)
- func (m *ArticleMutation) FieldCleared(name string) bool
- func (m *ArticleMutation) Fields() []string
- func (m *ArticleMutation) ID() (id int, exists bool)
- func (m *ArticleMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ArticleMutation) OldContent(ctx context.Context) (v string, err error)
- func (m *ArticleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ArticleMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ArticleMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *ArticleMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ArticleMutation) Op() Op
- func (m *ArticleMutation) RemovedEdges() []string
- func (m *ArticleMutation) RemovedIDs(name string) []ent.Value
- func (m *ArticleMutation) ResetContent()
- func (m *ArticleMutation) ResetCreatedAt()
- func (m *ArticleMutation) ResetEdge(name string) error
- func (m *ArticleMutation) ResetField(name string) error
- func (m *ArticleMutation) ResetTitle()
- func (m *ArticleMutation) ResetUpdatedAt()
- func (m *ArticleMutation) SetContent(s string)
- func (m *ArticleMutation) SetCreatedAt(t time.Time)
- func (m *ArticleMutation) SetField(name string, value ent.Value) error
- func (m *ArticleMutation) SetOp(op Op)
- func (m *ArticleMutation) SetTitle(s string)
- func (m *ArticleMutation) SetUpdatedAt(t time.Time)
- func (m *ArticleMutation) Title() (r string, exists bool)
- func (m ArticleMutation) Tx() (*Tx, error)
- func (m *ArticleMutation) Type() string
- func (m *ArticleMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *ArticleMutation) Where(ps ...predicate.Article)
- func (m *ArticleMutation) WhereP(ps ...func(*sql.Selector))
- type ArticleQuery
- func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect
- func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)
- func (aq *ArticleQuery) AllX(ctx context.Context) []*Article
- func (aq *ArticleQuery) Clone() *ArticleQuery
- func (aq *ArticleQuery) Count(ctx context.Context) (int, error)
- func (aq *ArticleQuery) CountX(ctx context.Context) int
- func (aq *ArticleQuery) Exist(ctx context.Context) (bool, error)
- func (aq *ArticleQuery) ExistX(ctx context.Context) bool
- func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)
- func (aq *ArticleQuery) FirstID(ctx context.Context) (id int, err error)
- func (aq *ArticleQuery) FirstIDX(ctx context.Context) int
- func (aq *ArticleQuery) FirstX(ctx context.Context) *Article
- func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy
- func (aq *ArticleQuery) IDs(ctx context.Context) (ids []int, err error)
- func (aq *ArticleQuery) IDsX(ctx context.Context) []int
- func (aq *ArticleQuery) Limit(limit int) *ArticleQuery
- func (aq *ArticleQuery) Offset(offset int) *ArticleQuery
- func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)
- func (aq *ArticleQuery) OnlyID(ctx context.Context) (id int, err error)
- func (aq *ArticleQuery) OnlyIDX(ctx context.Context) int
- func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article
- func (aq *ArticleQuery) Order(o ...article.OrderOption) *ArticleQuery
- func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect
- func (aq *ArticleQuery) Unique(unique bool) *ArticleQuery
- func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery
- type ArticleSelect
- func (as *ArticleSelect) Aggregate(fns ...AggregateFunc) *ArticleSelect
- func (s *ArticleSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArticleSelect) BoolX(ctx context.Context) bool
- func (s *ArticleSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ArticleSelect) BoolsX(ctx context.Context) []bool
- func (s *ArticleSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArticleSelect) Float64X(ctx context.Context) float64
- func (s *ArticleSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArticleSelect) Float64sX(ctx context.Context) []float64
- func (s *ArticleSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ArticleSelect) IntX(ctx context.Context) int
- func (s *ArticleSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ArticleSelect) IntsX(ctx context.Context) []int
- func (as *ArticleSelect) Scan(ctx context.Context, v any) error
- func (s *ArticleSelect) ScanX(ctx context.Context, v any)
- func (s *ArticleSelect) String(ctx context.Context) (_ string, err error)
- func (s *ArticleSelect) StringX(ctx context.Context) string
- func (s *ArticleSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ArticleSelect) StringsX(ctx context.Context) []string
- type ArticleUpdate
- func (au *ArticleUpdate) Exec(ctx context.Context) error
- func (au *ArticleUpdate) ExecX(ctx context.Context)
- func (au *ArticleUpdate) Mutation() *ArticleMutation
- func (au *ArticleUpdate) Save(ctx context.Context) (int, error)
- func (au *ArticleUpdate) SaveX(ctx context.Context) int
- func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate
- func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate
- func (au *ArticleUpdate) SetUpdatedAt(t time.Time) *ArticleUpdate
- func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate
- type ArticleUpdateOne
- func (auo *ArticleUpdateOne) Exec(ctx context.Context) error
- func (auo *ArticleUpdateOne) ExecX(ctx context.Context)
- func (auo *ArticleUpdateOne) Mutation() *ArticleMutation
- func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)
- func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article
- func (auo *ArticleUpdateOne) Select(field string, fields ...string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) SetUpdatedAt(t time.Time) *ArticleUpdateOne
- func (auo *ArticleUpdateOne) Where(ps ...predicate.Article) *ArticleUpdateOne
- type Articles
- type Categories
- type Category
- type CategoryClient
- func (c *CategoryClient) Create() *CategoryCreate
- func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk
- func (c *CategoryClient) Delete() *CategoryDelete
- func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne
- func (c *CategoryClient) DeleteOneID(id int) *CategoryDeleteOne
- func (c *CategoryClient) Get(ctx context.Context, id int) (*Category, error)
- func (c *CategoryClient) GetX(ctx context.Context, id int) *Category
- func (c *CategoryClient) Hooks() []Hook
- func (c *CategoryClient) Intercept(interceptors ...Interceptor)
- func (c *CategoryClient) Interceptors() []Interceptor
- func (c *CategoryClient) MapCreateBulk(slice any, setFunc func(*CategoryCreate, int)) *CategoryCreateBulk
- func (c *CategoryClient) Query() *CategoryQuery
- func (c *CategoryClient) QueryCategoryGame(ca *Category) *GameQuery
- func (c *CategoryClient) Update() *CategoryUpdate
- func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne
- func (c *CategoryClient) UpdateOneID(id int) *CategoryUpdateOne
- func (c *CategoryClient) Use(hooks ...Hook)
- type CategoryCreate
- func (cc *CategoryCreate) Exec(ctx context.Context) error
- func (cc *CategoryCreate) ExecX(ctx context.Context)
- func (cc *CategoryCreate) Mutation() *CategoryMutation
- func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error)
- func (cc *CategoryCreate) SaveX(ctx context.Context) *Category
- func (cc *CategoryCreate) SetCategoryGame(g *Game) *CategoryCreate
- func (cc *CategoryCreate) SetCategoryGameID(id int) *CategoryCreate
- func (cc *CategoryCreate) SetCreatedAt(t time.Time) *CategoryCreate
- func (cc *CategoryCreate) SetDeletedAt(t time.Time) *CategoryCreate
- func (cc *CategoryCreate) SetGameID(i int) *CategoryCreate
- func (cc *CategoryCreate) SetNillableCategoryGameID(id *int) *CategoryCreate
- func (cc *CategoryCreate) SetNillableCreatedAt(t *time.Time) *CategoryCreate
- func (cc *CategoryCreate) SetNillableDeletedAt(t *time.Time) *CategoryCreate
- func (cc *CategoryCreate) SetNillableGameID(i *int) *CategoryCreate
- func (cc *CategoryCreate) SetNillableUpdatedAt(t *time.Time) *CategoryCreate
- func (cc *CategoryCreate) SetTitle(s string) *CategoryCreate
- func (cc *CategoryCreate) SetURL(s string) *CategoryCreate
- func (cc *CategoryCreate) SetUpdatedAt(t time.Time) *CategoryCreate
- type CategoryCreateBulk
- type CategoryDelete
- type CategoryDeleteOne
- type CategoryEdges
- type CategoryGroupBy
- func (cgb *CategoryGroupBy) Aggregate(fns ...AggregateFunc) *CategoryGroupBy
- func (s *CategoryGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *CategoryGroupBy) BoolX(ctx context.Context) bool
- func (s *CategoryGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *CategoryGroupBy) BoolsX(ctx context.Context) []bool
- func (s *CategoryGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *CategoryGroupBy) Float64X(ctx context.Context) float64
- func (s *CategoryGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *CategoryGroupBy) Float64sX(ctx context.Context) []float64
- func (s *CategoryGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *CategoryGroupBy) IntX(ctx context.Context) int
- func (s *CategoryGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *CategoryGroupBy) IntsX(ctx context.Context) []int
- func (cgb *CategoryGroupBy) Scan(ctx context.Context, v any) error
- func (s *CategoryGroupBy) ScanX(ctx context.Context, v any)
- func (s *CategoryGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *CategoryGroupBy) StringX(ctx context.Context) string
- func (s *CategoryGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *CategoryGroupBy) StringsX(ctx context.Context) []string
- type CategoryMutation
- func (m *CategoryMutation) AddField(name string, value ent.Value) error
- func (m *CategoryMutation) AddedEdges() []string
- func (m *CategoryMutation) AddedField(name string) (ent.Value, bool)
- func (m *CategoryMutation) AddedFields() []string
- func (m *CategoryMutation) AddedIDs(name string) []ent.Value
- func (m *CategoryMutation) CategoryGameCleared() bool
- func (m *CategoryMutation) CategoryGameID() (id int, exists bool)
- func (m *CategoryMutation) CategoryGameIDs() (ids []int)
- func (m *CategoryMutation) ClearCategoryGame()
- func (m *CategoryMutation) ClearDeletedAt()
- func (m *CategoryMutation) ClearEdge(name string) error
- func (m *CategoryMutation) ClearField(name string) error
- func (m *CategoryMutation) ClearGameID()
- func (m *CategoryMutation) ClearedEdges() []string
- func (m *CategoryMutation) ClearedFields() []string
- func (m CategoryMutation) Client() *Client
- func (m *CategoryMutation) CreatedAt() (r time.Time, exists bool)
- func (m *CategoryMutation) DeletedAt() (r time.Time, exists bool)
- func (m *CategoryMutation) DeletedAtCleared() bool
- func (m *CategoryMutation) EdgeCleared(name string) bool
- func (m *CategoryMutation) Field(name string) (ent.Value, bool)
- func (m *CategoryMutation) FieldCleared(name string) bool
- func (m *CategoryMutation) Fields() []string
- func (m *CategoryMutation) GameID() (r int, exists bool)
- func (m *CategoryMutation) GameIDCleared() bool
- func (m *CategoryMutation) ID() (id int, exists bool)
- func (m *CategoryMutation) IDs(ctx context.Context) ([]int, error)
- func (m *CategoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *CategoryMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)
- func (m *CategoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *CategoryMutation) OldGameID(ctx context.Context) (v int, err error)
- func (m *CategoryMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *CategoryMutation) OldURL(ctx context.Context) (v string, err error)
- func (m *CategoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *CategoryMutation) Op() Op
- func (m *CategoryMutation) RemovedEdges() []string
- func (m *CategoryMutation) RemovedIDs(name string) []ent.Value
- func (m *CategoryMutation) ResetCategoryGame()
- func (m *CategoryMutation) ResetCreatedAt()
- func (m *CategoryMutation) ResetDeletedAt()
- func (m *CategoryMutation) ResetEdge(name string) error
- func (m *CategoryMutation) ResetField(name string) error
- func (m *CategoryMutation) ResetGameID()
- func (m *CategoryMutation) ResetTitle()
- func (m *CategoryMutation) ResetURL()
- func (m *CategoryMutation) ResetUpdatedAt()
- func (m *CategoryMutation) SetCategoryGameID(id int)
- func (m *CategoryMutation) SetCreatedAt(t time.Time)
- func (m *CategoryMutation) SetDeletedAt(t time.Time)
- func (m *CategoryMutation) SetField(name string, value ent.Value) error
- func (m *CategoryMutation) SetGameID(i int)
- func (m *CategoryMutation) SetOp(op Op)
- func (m *CategoryMutation) SetTitle(s string)
- func (m *CategoryMutation) SetURL(s string)
- func (m *CategoryMutation) SetUpdatedAt(t time.Time)
- func (m *CategoryMutation) Title() (r string, exists bool)
- func (m CategoryMutation) Tx() (*Tx, error)
- func (m *CategoryMutation) Type() string
- func (m *CategoryMutation) URL() (r string, exists bool)
- func (m *CategoryMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *CategoryMutation) Where(ps ...predicate.Category)
- func (m *CategoryMutation) WhereP(ps ...func(*sql.Selector))
- type CategoryQuery
- func (cq *CategoryQuery) Aggregate(fns ...AggregateFunc) *CategorySelect
- func (cq *CategoryQuery) All(ctx context.Context) ([]*Category, error)
- func (cq *CategoryQuery) AllX(ctx context.Context) []*Category
- func (cq *CategoryQuery) Clone() *CategoryQuery
- func (cq *CategoryQuery) Count(ctx context.Context) (int, error)
- func (cq *CategoryQuery) CountX(ctx context.Context) int
- func (cq *CategoryQuery) Exist(ctx context.Context) (bool, error)
- func (cq *CategoryQuery) ExistX(ctx context.Context) bool
- func (cq *CategoryQuery) First(ctx context.Context) (*Category, error)
- func (cq *CategoryQuery) FirstID(ctx context.Context) (id int, err error)
- func (cq *CategoryQuery) FirstIDX(ctx context.Context) int
- func (cq *CategoryQuery) FirstX(ctx context.Context) *Category
- func (cq *CategoryQuery) GroupBy(field string, fields ...string) *CategoryGroupBy
- func (cq *CategoryQuery) IDs(ctx context.Context) (ids []int, err error)
- func (cq *CategoryQuery) IDsX(ctx context.Context) []int
- func (cq *CategoryQuery) Limit(limit int) *CategoryQuery
- func (cq *CategoryQuery) Offset(offset int) *CategoryQuery
- func (cq *CategoryQuery) Only(ctx context.Context) (*Category, error)
- func (cq *CategoryQuery) OnlyID(ctx context.Context) (id int, err error)
- func (cq *CategoryQuery) OnlyIDX(ctx context.Context) int
- func (cq *CategoryQuery) OnlyX(ctx context.Context) *Category
- func (cq *CategoryQuery) Order(o ...category.OrderOption) *CategoryQuery
- func (cq *CategoryQuery) QueryCategoryGame() *GameQuery
- func (cq *CategoryQuery) Select(fields ...string) *CategorySelect
- func (cq *CategoryQuery) Unique(unique bool) *CategoryQuery
- func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery
- func (cq *CategoryQuery) WithCategoryGame(opts ...func(*GameQuery)) *CategoryQuery
- type CategorySelect
- func (cs *CategorySelect) Aggregate(fns ...AggregateFunc) *CategorySelect
- func (s *CategorySelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *CategorySelect) BoolX(ctx context.Context) bool
- func (s *CategorySelect) Bools(ctx context.Context) ([]bool, error)
- func (s *CategorySelect) BoolsX(ctx context.Context) []bool
- func (s *CategorySelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *CategorySelect) Float64X(ctx context.Context) float64
- func (s *CategorySelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *CategorySelect) Float64sX(ctx context.Context) []float64
- func (s *CategorySelect) Int(ctx context.Context) (_ int, err error)
- func (s *CategorySelect) IntX(ctx context.Context) int
- func (s *CategorySelect) Ints(ctx context.Context) ([]int, error)
- func (s *CategorySelect) IntsX(ctx context.Context) []int
- func (cs *CategorySelect) Scan(ctx context.Context, v any) error
- func (s *CategorySelect) ScanX(ctx context.Context, v any)
- func (s *CategorySelect) String(ctx context.Context) (_ string, err error)
- func (s *CategorySelect) StringX(ctx context.Context) string
- func (s *CategorySelect) Strings(ctx context.Context) ([]string, error)
- func (s *CategorySelect) StringsX(ctx context.Context) []string
- type CategoryUpdate
- func (cu *CategoryUpdate) ClearCategoryGame() *CategoryUpdate
- func (cu *CategoryUpdate) ClearDeletedAt() *CategoryUpdate
- func (cu *CategoryUpdate) ClearGameID() *CategoryUpdate
- func (cu *CategoryUpdate) Exec(ctx context.Context) error
- func (cu *CategoryUpdate) ExecX(ctx context.Context)
- func (cu *CategoryUpdate) Mutation() *CategoryMutation
- func (cu *CategoryUpdate) Save(ctx context.Context) (int, error)
- func (cu *CategoryUpdate) SaveX(ctx context.Context) int
- func (cu *CategoryUpdate) SetCategoryGame(g *Game) *CategoryUpdate
- func (cu *CategoryUpdate) SetCategoryGameID(id int) *CategoryUpdate
- func (cu *CategoryUpdate) SetDeletedAt(t time.Time) *CategoryUpdate
- func (cu *CategoryUpdate) SetGameID(i int) *CategoryUpdate
- func (cu *CategoryUpdate) SetNillableCategoryGameID(id *int) *CategoryUpdate
- func (cu *CategoryUpdate) SetNillableGameID(i *int) *CategoryUpdate
- func (cu *CategoryUpdate) SetTitle(s string) *CategoryUpdate
- func (cu *CategoryUpdate) SetURL(s string) *CategoryUpdate
- func (cu *CategoryUpdate) SetUpdatedAt(t time.Time) *CategoryUpdate
- func (cu *CategoryUpdate) Where(ps ...predicate.Category) *CategoryUpdate
- type CategoryUpdateOne
- func (cuo *CategoryUpdateOne) ClearCategoryGame() *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) ClearDeletedAt() *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) ClearGameID() *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) Exec(ctx context.Context) error
- func (cuo *CategoryUpdateOne) ExecX(ctx context.Context)
- func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation
- func (cuo *CategoryUpdateOne) Save(ctx context.Context) (*Category, error)
- func (cuo *CategoryUpdateOne) SaveX(ctx context.Context) *Category
- func (cuo *CategoryUpdateOne) Select(field string, fields ...string) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetCategoryGame(g *Game) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetCategoryGameID(id int) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetDeletedAt(t time.Time) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetGameID(i int) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetNillableCategoryGameID(id *int) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetNillableGameID(i *int) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetTitle(s string) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetURL(s string) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) SetUpdatedAt(t time.Time) *CategoryUpdateOne
- func (cuo *CategoryUpdateOne) Where(ps ...predicate.Category) *CategoryUpdateOne
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Game
- type GameClient
- func (c *GameClient) Create() *GameCreate
- func (c *GameClient) CreateBulk(builders ...*GameCreate) *GameCreateBulk
- func (c *GameClient) Delete() *GameDelete
- func (c *GameClient) DeleteOne(ga *Game) *GameDeleteOne
- func (c *GameClient) DeleteOneID(id int) *GameDeleteOne
- func (c *GameClient) Get(ctx context.Context, id int) (*Game, error)
- func (c *GameClient) GetX(ctx context.Context, id int) *Game
- func (c *GameClient) Hooks() []Hook
- func (c *GameClient) Intercept(interceptors ...Interceptor)
- func (c *GameClient) Interceptors() []Interceptor
- func (c *GameClient) MapCreateBulk(slice any, setFunc func(*GameCreate, int)) *GameCreateBulk
- func (c *GameClient) Query() *GameQuery
- func (c *GameClient) QueryGameCategory(ga *Game) *CategoryQuery
- func (c *GameClient) Update() *GameUpdate
- func (c *GameClient) UpdateOne(ga *Game) *GameUpdateOne
- func (c *GameClient) UpdateOneID(id int) *GameUpdateOne
- func (c *GameClient) Use(hooks ...Hook)
- type GameCreate
- func (gc *GameCreate) AddGameCategory(c ...*Category) *GameCreate
- func (gc *GameCreate) AddGameCategoryIDs(ids ...int) *GameCreate
- func (gc *GameCreate) Exec(ctx context.Context) error
- func (gc *GameCreate) ExecX(ctx context.Context)
- func (gc *GameCreate) Mutation() *GameMutation
- func (gc *GameCreate) Save(ctx context.Context) (*Game, error)
- func (gc *GameCreate) SaveX(ctx context.Context) *Game
- func (gc *GameCreate) SetCreatedAt(t time.Time) *GameCreate
- func (gc *GameCreate) SetDeletedAt(t time.Time) *GameCreate
- func (gc *GameCreate) SetIcon(s string) *GameCreate
- func (gc *GameCreate) SetName(s string) *GameCreate
- func (gc *GameCreate) SetNillableCreatedAt(t *time.Time) *GameCreate
- func (gc *GameCreate) SetNillableDeletedAt(t *time.Time) *GameCreate
- func (gc *GameCreate) SetNillableIcon(s *string) *GameCreate
- func (gc *GameCreate) SetNillableUpdatedAt(t *time.Time) *GameCreate
- func (gc *GameCreate) SetUpdatedAt(t time.Time) *GameCreate
- type GameCreateBulk
- type GameDelete
- type GameDeleteOne
- type GameEdges
- type GameGroupBy
- func (ggb *GameGroupBy) Aggregate(fns ...AggregateFunc) *GameGroupBy
- func (s *GameGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *GameGroupBy) BoolX(ctx context.Context) bool
- func (s *GameGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *GameGroupBy) BoolsX(ctx context.Context) []bool
- func (s *GameGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *GameGroupBy) Float64X(ctx context.Context) float64
- func (s *GameGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *GameGroupBy) Float64sX(ctx context.Context) []float64
- func (s *GameGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *GameGroupBy) IntX(ctx context.Context) int
- func (s *GameGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *GameGroupBy) IntsX(ctx context.Context) []int
- func (ggb *GameGroupBy) Scan(ctx context.Context, v any) error
- func (s *GameGroupBy) ScanX(ctx context.Context, v any)
- func (s *GameGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *GameGroupBy) StringX(ctx context.Context) string
- func (s *GameGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *GameGroupBy) StringsX(ctx context.Context) []string
- type GameMutation
- func (m *GameMutation) AddField(name string, value ent.Value) error
- func (m *GameMutation) AddGameCategoryIDs(ids ...int)
- func (m *GameMutation) AddedEdges() []string
- func (m *GameMutation) AddedField(name string) (ent.Value, bool)
- func (m *GameMutation) AddedFields() []string
- func (m *GameMutation) AddedIDs(name string) []ent.Value
- func (m *GameMutation) ClearDeletedAt()
- func (m *GameMutation) ClearEdge(name string) error
- func (m *GameMutation) ClearField(name string) error
- func (m *GameMutation) ClearGameCategory()
- func (m *GameMutation) ClearIcon()
- func (m *GameMutation) ClearedEdges() []string
- func (m *GameMutation) ClearedFields() []string
- func (m GameMutation) Client() *Client
- func (m *GameMutation) CreatedAt() (r time.Time, exists bool)
- func (m *GameMutation) DeletedAt() (r time.Time, exists bool)
- func (m *GameMutation) DeletedAtCleared() bool
- func (m *GameMutation) EdgeCleared(name string) bool
- func (m *GameMutation) Field(name string) (ent.Value, bool)
- func (m *GameMutation) FieldCleared(name string) bool
- func (m *GameMutation) Fields() []string
- func (m *GameMutation) GameCategoryCleared() bool
- func (m *GameMutation) GameCategoryIDs() (ids []int)
- func (m *GameMutation) ID() (id int, exists bool)
- func (m *GameMutation) IDs(ctx context.Context) ([]int, error)
- func (m *GameMutation) Icon() (r string, exists bool)
- func (m *GameMutation) IconCleared() bool
- func (m *GameMutation) Name() (r string, exists bool)
- func (m *GameMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *GameMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)
- func (m *GameMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *GameMutation) OldIcon(ctx context.Context) (v string, err error)
- func (m *GameMutation) OldName(ctx context.Context) (v string, err error)
- func (m *GameMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *GameMutation) Op() Op
- func (m *GameMutation) RemoveGameCategoryIDs(ids ...int)
- func (m *GameMutation) RemovedEdges() []string
- func (m *GameMutation) RemovedGameCategoryIDs() (ids []int)
- func (m *GameMutation) RemovedIDs(name string) []ent.Value
- func (m *GameMutation) ResetCreatedAt()
- func (m *GameMutation) ResetDeletedAt()
- func (m *GameMutation) ResetEdge(name string) error
- func (m *GameMutation) ResetField(name string) error
- func (m *GameMutation) ResetGameCategory()
- func (m *GameMutation) ResetIcon()
- func (m *GameMutation) ResetName()
- func (m *GameMutation) ResetUpdatedAt()
- func (m *GameMutation) SetCreatedAt(t time.Time)
- func (m *GameMutation) SetDeletedAt(t time.Time)
- func (m *GameMutation) SetField(name string, value ent.Value) error
- func (m *GameMutation) SetIcon(s string)
- func (m *GameMutation) SetName(s string)
- func (m *GameMutation) SetOp(op Op)
- func (m *GameMutation) SetUpdatedAt(t time.Time)
- func (m GameMutation) Tx() (*Tx, error)
- func (m *GameMutation) Type() string
- func (m *GameMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *GameMutation) Where(ps ...predicate.Game)
- func (m *GameMutation) WhereP(ps ...func(*sql.Selector))
- type GameQuery
- func (gq *GameQuery) Aggregate(fns ...AggregateFunc) *GameSelect
- func (gq *GameQuery) All(ctx context.Context) ([]*Game, error)
- func (gq *GameQuery) AllX(ctx context.Context) []*Game
- func (gq *GameQuery) Clone() *GameQuery
- func (gq *GameQuery) Count(ctx context.Context) (int, error)
- func (gq *GameQuery) CountX(ctx context.Context) int
- func (gq *GameQuery) Exist(ctx context.Context) (bool, error)
- func (gq *GameQuery) ExistX(ctx context.Context) bool
- func (gq *GameQuery) First(ctx context.Context) (*Game, error)
- func (gq *GameQuery) FirstID(ctx context.Context) (id int, err error)
- func (gq *GameQuery) FirstIDX(ctx context.Context) int
- func (gq *GameQuery) FirstX(ctx context.Context) *Game
- func (gq *GameQuery) GroupBy(field string, fields ...string) *GameGroupBy
- func (gq *GameQuery) IDs(ctx context.Context) (ids []int, err error)
- func (gq *GameQuery) IDsX(ctx context.Context) []int
- func (gq *GameQuery) Limit(limit int) *GameQuery
- func (gq *GameQuery) Offset(offset int) *GameQuery
- func (gq *GameQuery) Only(ctx context.Context) (*Game, error)
- func (gq *GameQuery) OnlyID(ctx context.Context) (id int, err error)
- func (gq *GameQuery) OnlyIDX(ctx context.Context) int
- func (gq *GameQuery) OnlyX(ctx context.Context) *Game
- func (gq *GameQuery) Order(o ...game.OrderOption) *GameQuery
- func (gq *GameQuery) QueryGameCategory() *CategoryQuery
- func (gq *GameQuery) Select(fields ...string) *GameSelect
- func (gq *GameQuery) Unique(unique bool) *GameQuery
- func (gq *GameQuery) Where(ps ...predicate.Game) *GameQuery
- func (gq *GameQuery) WithGameCategory(opts ...func(*CategoryQuery)) *GameQuery
- type GameSelect
- func (gs *GameSelect) Aggregate(fns ...AggregateFunc) *GameSelect
- func (s *GameSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *GameSelect) BoolX(ctx context.Context) bool
- func (s *GameSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *GameSelect) BoolsX(ctx context.Context) []bool
- func (s *GameSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *GameSelect) Float64X(ctx context.Context) float64
- func (s *GameSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *GameSelect) Float64sX(ctx context.Context) []float64
- func (s *GameSelect) Int(ctx context.Context) (_ int, err error)
- func (s *GameSelect) IntX(ctx context.Context) int
- func (s *GameSelect) Ints(ctx context.Context) ([]int, error)
- func (s *GameSelect) IntsX(ctx context.Context) []int
- func (gs *GameSelect) Scan(ctx context.Context, v any) error
- func (s *GameSelect) ScanX(ctx context.Context, v any)
- func (s *GameSelect) String(ctx context.Context) (_ string, err error)
- func (s *GameSelect) StringX(ctx context.Context) string
- func (s *GameSelect) Strings(ctx context.Context) ([]string, error)
- func (s *GameSelect) StringsX(ctx context.Context) []string
- type GameUpdate
- func (gu *GameUpdate) AddGameCategory(c ...*Category) *GameUpdate
- func (gu *GameUpdate) AddGameCategoryIDs(ids ...int) *GameUpdate
- func (gu *GameUpdate) ClearDeletedAt() *GameUpdate
- func (gu *GameUpdate) ClearGameCategory() *GameUpdate
- func (gu *GameUpdate) ClearIcon() *GameUpdate
- func (gu *GameUpdate) Exec(ctx context.Context) error
- func (gu *GameUpdate) ExecX(ctx context.Context)
- func (gu *GameUpdate) Mutation() *GameMutation
- func (gu *GameUpdate) RemoveGameCategory(c ...*Category) *GameUpdate
- func (gu *GameUpdate) RemoveGameCategoryIDs(ids ...int) *GameUpdate
- func (gu *GameUpdate) Save(ctx context.Context) (int, error)
- func (gu *GameUpdate) SaveX(ctx context.Context) int
- func (gu *GameUpdate) SetDeletedAt(t time.Time) *GameUpdate
- func (gu *GameUpdate) SetIcon(s string) *GameUpdate
- func (gu *GameUpdate) SetName(s string) *GameUpdate
- func (gu *GameUpdate) SetNillableIcon(s *string) *GameUpdate
- func (gu *GameUpdate) SetUpdatedAt(t time.Time) *GameUpdate
- func (gu *GameUpdate) Where(ps ...predicate.Game) *GameUpdate
- type GameUpdateOne
- func (guo *GameUpdateOne) AddGameCategory(c ...*Category) *GameUpdateOne
- func (guo *GameUpdateOne) AddGameCategoryIDs(ids ...int) *GameUpdateOne
- func (guo *GameUpdateOne) ClearDeletedAt() *GameUpdateOne
- func (guo *GameUpdateOne) ClearGameCategory() *GameUpdateOne
- func (guo *GameUpdateOne) ClearIcon() *GameUpdateOne
- func (guo *GameUpdateOne) Exec(ctx context.Context) error
- func (guo *GameUpdateOne) ExecX(ctx context.Context)
- func (guo *GameUpdateOne) Mutation() *GameMutation
- func (guo *GameUpdateOne) RemoveGameCategory(c ...*Category) *GameUpdateOne
- func (guo *GameUpdateOne) RemoveGameCategoryIDs(ids ...int) *GameUpdateOne
- func (guo *GameUpdateOne) Save(ctx context.Context) (*Game, error)
- func (guo *GameUpdateOne) SaveX(ctx context.Context) *Game
- func (guo *GameUpdateOne) Select(field string, fields ...string) *GameUpdateOne
- func (guo *GameUpdateOne) SetDeletedAt(t time.Time) *GameUpdateOne
- func (guo *GameUpdateOne) SetIcon(s string) *GameUpdateOne
- func (guo *GameUpdateOne) SetName(s string) *GameUpdateOne
- func (guo *GameUpdateOne) SetNillableIcon(s *string) *GameUpdateOne
- func (guo *GameUpdateOne) SetUpdatedAt(t time.Time) *GameUpdateOne
- func (guo *GameUpdateOne) Where(ps ...predicate.Game) *GameUpdateOne
- type Games
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tx
- type User
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Intercept(interceptors ...Interceptor)
- func (c *UserClient) Interceptors() []Interceptor
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (uc *UserCreate) Exec(ctx context.Context) error
- func (uc *UserCreate) ExecX(ctx context.Context)
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetEmail(s string) *UserCreate
- func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
- func (uc *UserCreate) SetPassword(s string) *UserCreate
- func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
- func (uc *UserCreate) SetUsername(s string) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserGroupBy) BoolX(ctx context.Context) bool
- func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserGroupBy) Float64X(ctx context.Context) float64
- func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *UserGroupBy) IntX(ctx context.Context) int
- func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error
- func (s *UserGroupBy) ScanX(ctx context.Context, v any)
- func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *UserGroupBy) StringX(ctx context.Context) string
- func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *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) ClearDeletedAt()
- 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) CreatedAt() (r time.Time, exists bool)
- func (m *UserMutation) DeletedAt() (r time.Time, exists bool)
- func (m *UserMutation) DeletedAtCleared() bool
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) Email() (r string, exists bool)
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
- func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)
- func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) Password() (r string, exists bool)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) ResetCreatedAt()
- func (m *UserMutation) ResetDeletedAt()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetEmail()
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetPassword()
- func (m *UserMutation) ResetUpdatedAt()
- func (m *UserMutation) ResetUsername()
- func (m *UserMutation) SetCreatedAt(t time.Time)
- func (m *UserMutation) SetDeletedAt(t time.Time)
- func (m *UserMutation) SetEmail(s string)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetOp(op Op)
- func (m *UserMutation) SetPassword(s string)
- func (m *UserMutation) SetUpdatedAt(t time.Time)
- func (m *UserMutation) SetUsername(s string)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *UserMutation) Username() (r string, exists bool)
- func (m *UserMutation) Where(ps ...predicate.User)
- func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
- type UserQuery
- func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) int
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) int
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...user.OrderOption) *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) Aggregate(fns ...AggregateFunc) *UserSelect
- func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserSelect) BoolX(ctx context.Context) bool
- func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *UserSelect) BoolsX(ctx context.Context) []bool
- func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserSelect) Float64X(ctx context.Context) float64
- func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserSelect) Float64sX(ctx context.Context) []float64
- func (s *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (s *UserSelect) IntX(ctx context.Context) int
- func (s *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (s *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v any) error
- func (s *UserSelect) ScanX(ctx context.Context, v any)
- func (s *UserSelect) String(ctx context.Context) (_ string, err error)
- func (s *UserSelect) StringX(ctx context.Context) string
- func (s *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (s *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) ClearDeletedAt() *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) SetDeletedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) SetEmail(s string) *UserUpdate
- func (uu *UserUpdate) SetPassword(s string) *UserUpdate
- func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
- func (uu *UserUpdate) SetUsername(s string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) ClearDeletedAt() *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) SetDeletedAt(t time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
- func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) Where(ps ...predicate.User) *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. TypeArticle = "Article" TypeCategory = "Category" TypeGame = "Game" TypeUser = "User" )
Variables ¶
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
ErrTxStarted is returned when trying to start a new transaction from a transactional client.
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 Article ¶
type Article struct { // ID of the ent. ID int `json:"id,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // Content holds the value of the "content" field. Content string `json:"content,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"` // contains filtered or unexported fields }
Article is the model entity for the Article schema.
func (*Article) Unwrap ¶
Unwrap unwraps the Article 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 (*Article) Update ¶
func (a *Article) Update() *ArticleUpdateOne
Update returns a builder for updating this Article. Note that you need to call Article.Unwrap() before calling this method if this Article was returned from a transaction, and the transaction was committed or rolled back.
type ArticleClient ¶
type ArticleClient struct {
// contains filtered or unexported fields
}
ArticleClient is a client for the Article schema.
func NewArticleClient ¶
func NewArticleClient(c config) *ArticleClient
NewArticleClient returns a client for the Article from the given config.
func (*ArticleClient) Create ¶
func (c *ArticleClient) Create() *ArticleCreate
Create returns a builder for creating a Article entity.
func (*ArticleClient) CreateBulk ¶
func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk
CreateBulk returns a builder for creating a bulk of Article entities.
func (*ArticleClient) Delete ¶
func (c *ArticleClient) Delete() *ArticleDelete
Delete returns a delete builder for Article.
func (*ArticleClient) DeleteOne ¶
func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*ArticleClient) DeleteOneID ¶
func (c *ArticleClient) DeleteOneID(id int) *ArticleDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*ArticleClient) GetX ¶
func (c *ArticleClient) GetX(ctx context.Context, id int) *Article
GetX is like Get, but panics if an error occurs.
func (*ArticleClient) Hooks ¶
func (c *ArticleClient) Hooks() []Hook
Hooks returns the client hooks.
func (*ArticleClient) Intercept ¶
func (c *ArticleClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `article.Intercept(f(g(h())))`.
func (*ArticleClient) Interceptors ¶
func (c *ArticleClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*ArticleClient) MapCreateBulk ¶
func (c *ArticleClient) MapCreateBulk(slice any, setFunc func(*ArticleCreate, int)) *ArticleCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*ArticleClient) Query ¶
func (c *ArticleClient) Query() *ArticleQuery
Query returns a query builder for Article.
func (*ArticleClient) Update ¶
func (c *ArticleClient) Update() *ArticleUpdate
Update returns an update builder for Article.
func (*ArticleClient) UpdateOne ¶
func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ArticleClient) UpdateOneID ¶
func (c *ArticleClient) UpdateOneID(id int) *ArticleUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ArticleClient) Use ¶
func (c *ArticleClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `article.Hooks(f(g(h())))`.
type ArticleCreate ¶
type ArticleCreate struct {
// contains filtered or unexported fields
}
ArticleCreate is the builder for creating a Article entity.
func (*ArticleCreate) Exec ¶
func (ac *ArticleCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleCreate) ExecX ¶
func (ac *ArticleCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleCreate) Mutation ¶
func (ac *ArticleCreate) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleCreate) Save ¶
func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)
Save creates the Article in the database.
func (*ArticleCreate) SaveX ¶
func (ac *ArticleCreate) SaveX(ctx context.Context) *Article
SaveX calls Save and panics if Save returns an error.
func (*ArticleCreate) SetContent ¶
func (ac *ArticleCreate) SetContent(s string) *ArticleCreate
SetContent sets the "content" field.
func (*ArticleCreate) SetCreatedAt ¶
func (ac *ArticleCreate) SetCreatedAt(t time.Time) *ArticleCreate
SetCreatedAt sets the "created_at" field.
func (*ArticleCreate) SetNillableCreatedAt ¶
func (ac *ArticleCreate) SetNillableCreatedAt(t *time.Time) *ArticleCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ArticleCreate) SetNillableUpdatedAt ¶
func (ac *ArticleCreate) SetNillableUpdatedAt(t *time.Time) *ArticleCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ArticleCreate) SetTitle ¶
func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate
SetTitle sets the "title" field.
func (*ArticleCreate) SetUpdatedAt ¶
func (ac *ArticleCreate) SetUpdatedAt(t time.Time) *ArticleCreate
SetUpdatedAt sets the "updated_at" field.
type ArticleCreateBulk ¶
type ArticleCreateBulk struct {
// contains filtered or unexported fields
}
ArticleCreateBulk is the builder for creating many Article entities in bulk.
func (*ArticleCreateBulk) Exec ¶
func (acb *ArticleCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleCreateBulk) ExecX ¶
func (acb *ArticleCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ArticleDelete ¶
type ArticleDelete struct {
// contains filtered or unexported fields
}
ArticleDelete is the builder for deleting a Article entity.
func (*ArticleDelete) Exec ¶
func (ad *ArticleDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ArticleDelete) ExecX ¶
func (ad *ArticleDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ArticleDelete) Where ¶
func (ad *ArticleDelete) Where(ps ...predicate.Article) *ArticleDelete
Where appends a list predicates to the ArticleDelete builder.
type ArticleDeleteOne ¶
type ArticleDeleteOne struct {
// contains filtered or unexported fields
}
ArticleDeleteOne is the builder for deleting a single Article entity.
func (*ArticleDeleteOne) Exec ¶
func (ado *ArticleDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ArticleDeleteOne) ExecX ¶
func (ado *ArticleDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleDeleteOne) Where ¶
func (ado *ArticleDeleteOne) Where(ps ...predicate.Article) *ArticleDeleteOne
Where appends a list predicates to the ArticleDelete builder.
type ArticleGroupBy ¶
type ArticleGroupBy struct {
// contains filtered or unexported fields
}
ArticleGroupBy is the group-by builder for Article entities.
func (*ArticleGroupBy) Aggregate ¶
func (agb *ArticleGroupBy) Aggregate(fns ...AggregateFunc) *ArticleGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ArticleGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ArticleGroupBy) Scan ¶
func (agb *ArticleGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ArticleGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ArticleMutation ¶
type ArticleMutation struct {
// contains filtered or unexported fields
}
ArticleMutation represents an operation that mutates the Article nodes in the graph.
func (*ArticleMutation) AddField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) AddedEdges ¶
func (m *ArticleMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ArticleMutation) AddedField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) AddedFields ¶
func (m *ArticleMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ArticleMutation) AddedIDs ¶
func (m *ArticleMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ArticleMutation) ClearEdge ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ClearField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ClearedEdges ¶
func (m *ArticleMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ArticleMutation) ClearedFields ¶
func (m *ArticleMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ArticleMutation) Client ¶
func (m ArticleMutation) 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 (*ArticleMutation) Content ¶
func (m *ArticleMutation) Content() (r string, exists bool)
Content returns the value of the "content" field in the mutation.
func (*ArticleMutation) CreatedAt ¶
func (m *ArticleMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*ArticleMutation) EdgeCleared ¶
func (m *ArticleMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ArticleMutation) Field ¶
func (m *ArticleMutation) 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 (*ArticleMutation) FieldCleared ¶
func (m *ArticleMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ArticleMutation) Fields ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ID ¶
func (m *ArticleMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*ArticleMutation) IDs ¶
func (m *ArticleMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*ArticleMutation) OldContent ¶
func (m *ArticleMutation) OldContent(ctx context.Context) (v string, err error)
OldContent returns the old "content" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Article entity. If the Article 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 (*ArticleMutation) 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 (*ArticleMutation) OldTitle ¶
func (m *ArticleMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Article entity. If the Article 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 (*ArticleMutation) RemovedEdges ¶
func (m *ArticleMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ArticleMutation) RemovedIDs ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ResetContent ¶
func (m *ArticleMutation) ResetContent()
ResetContent resets all changes to the "content" field.
func (*ArticleMutation) ResetCreatedAt ¶
func (m *ArticleMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*ArticleMutation) ResetEdge ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ResetField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) ResetTitle ¶
func (m *ArticleMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*ArticleMutation) ResetUpdatedAt ¶
func (m *ArticleMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*ArticleMutation) SetContent ¶
func (m *ArticleMutation) SetContent(s string)
SetContent sets the "content" field.
func (*ArticleMutation) SetCreatedAt ¶
func (m *ArticleMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*ArticleMutation) SetField ¶
func (m *ArticleMutation) 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 (*ArticleMutation) SetOp ¶
func (m *ArticleMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*ArticleMutation) SetTitle ¶
func (m *ArticleMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*ArticleMutation) SetUpdatedAt ¶
func (m *ArticleMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*ArticleMutation) Title ¶
func (m *ArticleMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (ArticleMutation) Tx ¶
func (m ArticleMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ArticleMutation) Type ¶
func (m *ArticleMutation) Type() string
Type returns the node type of this mutation (Article).
func (*ArticleMutation) UpdatedAt ¶
func (m *ArticleMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*ArticleMutation) Where ¶
func (m *ArticleMutation) Where(ps ...predicate.Article)
Where appends a list predicates to the ArticleMutation builder.
func (*ArticleMutation) WhereP ¶
func (m *ArticleMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the ArticleMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type ArticleQuery ¶
type ArticleQuery struct {
// contains filtered or unexported fields
}
ArticleQuery is the builder for querying Article entities.
func (*ArticleQuery) Aggregate ¶
func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect
Aggregate returns a ArticleSelect configured with the given aggregations.
func (*ArticleQuery) All ¶
func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)
All executes the query and returns a list of Articles.
func (*ArticleQuery) AllX ¶
func (aq *ArticleQuery) AllX(ctx context.Context) []*Article
AllX is like All, but panics if an error occurs.
func (*ArticleQuery) Clone ¶
func (aq *ArticleQuery) Clone() *ArticleQuery
Clone returns a duplicate of the ArticleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ArticleQuery) Count ¶
func (aq *ArticleQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ArticleQuery) CountX ¶
func (aq *ArticleQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ArticleQuery) Exist ¶
func (aq *ArticleQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ArticleQuery) ExistX ¶
func (aq *ArticleQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ArticleQuery) First ¶
func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)
First returns the first Article entity from the query. Returns a *NotFoundError when no Article was found.
func (*ArticleQuery) FirstID ¶
func (aq *ArticleQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Article ID from the query. Returns a *NotFoundError when no Article ID was found.
func (*ArticleQuery) FirstIDX ¶
func (aq *ArticleQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*ArticleQuery) FirstX ¶
func (aq *ArticleQuery) FirstX(ctx context.Context) *Article
FirstX is like First, but panics if an error occurs.
func (*ArticleQuery) GroupBy ¶
func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy
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 { Title string `json:"title,omitempty"` Count int `json:"count,omitempty"` } client.Article.Query(). GroupBy(article.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ArticleQuery) IDs ¶
func (aq *ArticleQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Article IDs.
func (*ArticleQuery) IDsX ¶
func (aq *ArticleQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ArticleQuery) Limit ¶
func (aq *ArticleQuery) Limit(limit int) *ArticleQuery
Limit the number of records to be returned by this query.
func (*ArticleQuery) Offset ¶
func (aq *ArticleQuery) Offset(offset int) *ArticleQuery
Offset to start from.
func (*ArticleQuery) Only ¶
func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)
Only returns a single Article entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Article entity is found. Returns a *NotFoundError when no Article entities are found.
func (*ArticleQuery) OnlyID ¶
func (aq *ArticleQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Article ID in the query. Returns a *NotSingularError when more than one Article ID is found. Returns a *NotFoundError when no entities are found.
func (*ArticleQuery) OnlyIDX ¶
func (aq *ArticleQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*ArticleQuery) OnlyX ¶
func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article
OnlyX is like Only, but panics if an error occurs.
func (*ArticleQuery) Order ¶
func (aq *ArticleQuery) Order(o ...article.OrderOption) *ArticleQuery
Order specifies how the records should be ordered.
func (*ArticleQuery) Select ¶
func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect
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 { Title string `json:"title,omitempty"` } client.Article.Query(). Select(article.FieldTitle). Scan(ctx, &v)
func (*ArticleQuery) Unique ¶
func (aq *ArticleQuery) Unique(unique bool) *ArticleQuery
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 (*ArticleQuery) Where ¶
func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery
Where adds a new predicate for the ArticleQuery builder.
type ArticleSelect ¶
type ArticleSelect struct { *ArticleQuery // contains filtered or unexported fields }
ArticleSelect is the builder for selecting fields of Article entities.
func (*ArticleSelect) Aggregate ¶
func (as *ArticleSelect) Aggregate(fns ...AggregateFunc) *ArticleSelect
Aggregate adds the given aggregation functions to the selector query.
func (*ArticleSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ArticleSelect) Scan ¶
func (as *ArticleSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*ArticleSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type ArticleUpdate ¶
type ArticleUpdate struct {
// contains filtered or unexported fields
}
ArticleUpdate is the builder for updating Article entities.
func (*ArticleUpdate) Exec ¶
func (au *ArticleUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ArticleUpdate) ExecX ¶
func (au *ArticleUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleUpdate) Mutation ¶
func (au *ArticleUpdate) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleUpdate) Save ¶
func (au *ArticleUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ArticleUpdate) SaveX ¶
func (au *ArticleUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ArticleUpdate) SetContent ¶
func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate
SetContent sets the "content" field.
func (*ArticleUpdate) SetTitle ¶
func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate
SetTitle sets the "title" field.
func (*ArticleUpdate) SetUpdatedAt ¶
func (au *ArticleUpdate) SetUpdatedAt(t time.Time) *ArticleUpdate
SetUpdatedAt sets the "updated_at" field.
func (*ArticleUpdate) Where ¶
func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate
Where appends a list predicates to the ArticleUpdate builder.
type ArticleUpdateOne ¶
type ArticleUpdateOne struct {
// contains filtered or unexported fields
}
ArticleUpdateOne is the builder for updating a single Article entity.
func (*ArticleUpdateOne) Exec ¶
func (auo *ArticleUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ArticleUpdateOne) ExecX ¶
func (auo *ArticleUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ArticleUpdateOne) Mutation ¶
func (auo *ArticleUpdateOne) Mutation() *ArticleMutation
Mutation returns the ArticleMutation object of the builder.
func (*ArticleUpdateOne) Save ¶
func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)
Save executes the query and returns the updated Article entity.
func (*ArticleUpdateOne) SaveX ¶
func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article
SaveX is like Save, but panics if an error occurs.
func (*ArticleUpdateOne) Select ¶
func (auo *ArticleUpdateOne) Select(field string, fields ...string) *ArticleUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*ArticleUpdateOne) SetContent ¶
func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne
SetContent sets the "content" field.
func (*ArticleUpdateOne) SetTitle ¶
func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne
SetTitle sets the "title" field.
func (*ArticleUpdateOne) SetUpdatedAt ¶
func (auo *ArticleUpdateOne) SetUpdatedAt(t time.Time) *ArticleUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*ArticleUpdateOne) Where ¶
func (auo *ArticleUpdateOne) Where(ps ...predicate.Article) *ArticleUpdateOne
Where appends a list predicates to the ArticleUpdate builder.
type Category ¶
type Category struct { // ID of the ent. ID int `json:"id,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // URL holds the value of the "url" field. URL string `json:"url,omitempty"` // GameID holds the value of the "game_id" field. GameID int `json:"game_id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt time.Time `json:"deleted_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CategoryQuery when eager-loading is set. Edges CategoryEdges `json:"edges"` // contains filtered or unexported fields }
Category is the model entity for the Category schema.
func (*Category) QueryCategoryGame ¶
QueryCategoryGame queries the "category_game" edge of the Category entity.
func (*Category) Unwrap ¶
Unwrap unwraps the Category 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 (*Category) Update ¶
func (c *Category) Update() *CategoryUpdateOne
Update returns a builder for updating this Category. Note that you need to call Category.Unwrap() before calling this method if this Category was returned from a transaction, and the transaction was committed or rolled back.
type CategoryClient ¶
type CategoryClient struct {
// contains filtered or unexported fields
}
CategoryClient is a client for the Category schema.
func NewCategoryClient ¶
func NewCategoryClient(c config) *CategoryClient
NewCategoryClient returns a client for the Category from the given config.
func (*CategoryClient) Create ¶
func (c *CategoryClient) Create() *CategoryCreate
Create returns a builder for creating a Category entity.
func (*CategoryClient) CreateBulk ¶
func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk
CreateBulk returns a builder for creating a bulk of Category entities.
func (*CategoryClient) Delete ¶
func (c *CategoryClient) Delete() *CategoryDelete
Delete returns a delete builder for Category.
func (*CategoryClient) DeleteOne ¶
func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*CategoryClient) DeleteOneID ¶
func (c *CategoryClient) DeleteOneID(id int) *CategoryDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*CategoryClient) GetX ¶
func (c *CategoryClient) GetX(ctx context.Context, id int) *Category
GetX is like Get, but panics if an error occurs.
func (*CategoryClient) Hooks ¶
func (c *CategoryClient) Hooks() []Hook
Hooks returns the client hooks.
func (*CategoryClient) Intercept ¶
func (c *CategoryClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `category.Intercept(f(g(h())))`.
func (*CategoryClient) Interceptors ¶
func (c *CategoryClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*CategoryClient) MapCreateBulk ¶
func (c *CategoryClient) MapCreateBulk(slice any, setFunc func(*CategoryCreate, int)) *CategoryCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*CategoryClient) Query ¶
func (c *CategoryClient) Query() *CategoryQuery
Query returns a query builder for Category.
func (*CategoryClient) QueryCategoryGame ¶
func (c *CategoryClient) QueryCategoryGame(ca *Category) *GameQuery
QueryCategoryGame queries the category_game edge of a Category.
func (*CategoryClient) Update ¶
func (c *CategoryClient) Update() *CategoryUpdate
Update returns an update builder for Category.
func (*CategoryClient) UpdateOne ¶
func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne
UpdateOne returns an update builder for the given entity.
func (*CategoryClient) UpdateOneID ¶
func (c *CategoryClient) UpdateOneID(id int) *CategoryUpdateOne
UpdateOneID returns an update builder for the given id.
func (*CategoryClient) Use ¶
func (c *CategoryClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `category.Hooks(f(g(h())))`.
type CategoryCreate ¶
type CategoryCreate struct {
// contains filtered or unexported fields
}
CategoryCreate is the builder for creating a Category entity.
func (*CategoryCreate) Exec ¶
func (cc *CategoryCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*CategoryCreate) ExecX ¶
func (cc *CategoryCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CategoryCreate) Mutation ¶
func (cc *CategoryCreate) Mutation() *CategoryMutation
Mutation returns the CategoryMutation object of the builder.
func (*CategoryCreate) Save ¶
func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error)
Save creates the Category in the database.
func (*CategoryCreate) SaveX ¶
func (cc *CategoryCreate) SaveX(ctx context.Context) *Category
SaveX calls Save and panics if Save returns an error.
func (*CategoryCreate) SetCategoryGame ¶
func (cc *CategoryCreate) SetCategoryGame(g *Game) *CategoryCreate
SetCategoryGame sets the "category_game" edge to the Game entity.
func (*CategoryCreate) SetCategoryGameID ¶
func (cc *CategoryCreate) SetCategoryGameID(id int) *CategoryCreate
SetCategoryGameID sets the "category_game" edge to the Game entity by ID.
func (*CategoryCreate) SetCreatedAt ¶
func (cc *CategoryCreate) SetCreatedAt(t time.Time) *CategoryCreate
SetCreatedAt sets the "created_at" field.
func (*CategoryCreate) SetDeletedAt ¶
func (cc *CategoryCreate) SetDeletedAt(t time.Time) *CategoryCreate
SetDeletedAt sets the "deleted_at" field.
func (*CategoryCreate) SetGameID ¶
func (cc *CategoryCreate) SetGameID(i int) *CategoryCreate
SetGameID sets the "game_id" field.
func (*CategoryCreate) SetNillableCategoryGameID ¶
func (cc *CategoryCreate) SetNillableCategoryGameID(id *int) *CategoryCreate
SetNillableCategoryGameID sets the "category_game" edge to the Game entity by ID if the given value is not nil.
func (*CategoryCreate) SetNillableCreatedAt ¶
func (cc *CategoryCreate) SetNillableCreatedAt(t *time.Time) *CategoryCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*CategoryCreate) SetNillableDeletedAt ¶
func (cc *CategoryCreate) SetNillableDeletedAt(t *time.Time) *CategoryCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*CategoryCreate) SetNillableGameID ¶
func (cc *CategoryCreate) SetNillableGameID(i *int) *CategoryCreate
SetNillableGameID sets the "game_id" field if the given value is not nil.
func (*CategoryCreate) SetNillableUpdatedAt ¶
func (cc *CategoryCreate) SetNillableUpdatedAt(t *time.Time) *CategoryCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*CategoryCreate) SetTitle ¶
func (cc *CategoryCreate) SetTitle(s string) *CategoryCreate
SetTitle sets the "title" field.
func (*CategoryCreate) SetURL ¶
func (cc *CategoryCreate) SetURL(s string) *CategoryCreate
SetURL sets the "url" field.
func (*CategoryCreate) SetUpdatedAt ¶
func (cc *CategoryCreate) SetUpdatedAt(t time.Time) *CategoryCreate
SetUpdatedAt sets the "updated_at" field.
type CategoryCreateBulk ¶
type CategoryCreateBulk struct {
// contains filtered or unexported fields
}
CategoryCreateBulk is the builder for creating many Category entities in bulk.
func (*CategoryCreateBulk) Exec ¶
func (ccb *CategoryCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*CategoryCreateBulk) ExecX ¶
func (ccb *CategoryCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type CategoryDelete ¶
type CategoryDelete struct {
// contains filtered or unexported fields
}
CategoryDelete is the builder for deleting a Category entity.
func (*CategoryDelete) Exec ¶
func (cd *CategoryDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*CategoryDelete) ExecX ¶
func (cd *CategoryDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*CategoryDelete) Where ¶
func (cd *CategoryDelete) Where(ps ...predicate.Category) *CategoryDelete
Where appends a list predicates to the CategoryDelete builder.
type CategoryDeleteOne ¶
type CategoryDeleteOne struct {
// contains filtered or unexported fields
}
CategoryDeleteOne is the builder for deleting a single Category entity.
func (*CategoryDeleteOne) Exec ¶
func (cdo *CategoryDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*CategoryDeleteOne) ExecX ¶
func (cdo *CategoryDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CategoryDeleteOne) Where ¶
func (cdo *CategoryDeleteOne) Where(ps ...predicate.Category) *CategoryDeleteOne
Where appends a list predicates to the CategoryDelete builder.
type CategoryEdges ¶
type CategoryEdges struct { // CategoryGame holds the value of the category_game edge. CategoryGame *Game `json:"category_game,omitempty"` // contains filtered or unexported fields }
CategoryEdges holds the relations/edges for other nodes in the graph.
func (CategoryEdges) CategoryGameOrErr ¶
func (e CategoryEdges) CategoryGameOrErr() (*Game, error)
CategoryGameOrErr returns the CategoryGame value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type CategoryGroupBy ¶
type CategoryGroupBy struct {
// contains filtered or unexported fields
}
CategoryGroupBy is the group-by builder for Category entities.
func (*CategoryGroupBy) Aggregate ¶
func (cgb *CategoryGroupBy) Aggregate(fns ...AggregateFunc) *CategoryGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*CategoryGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*CategoryGroupBy) Scan ¶
func (cgb *CategoryGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*CategoryGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type CategoryMutation ¶
type CategoryMutation struct {
// contains filtered or unexported fields
}
CategoryMutation represents an operation that mutates the Category nodes in the graph.
func (*CategoryMutation) AddField ¶
func (m *CategoryMutation) 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 (*CategoryMutation) AddedEdges ¶
func (m *CategoryMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*CategoryMutation) AddedField ¶
func (m *CategoryMutation) 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 (*CategoryMutation) AddedFields ¶
func (m *CategoryMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*CategoryMutation) AddedIDs ¶
func (m *CategoryMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*CategoryMutation) CategoryGameCleared ¶
func (m *CategoryMutation) CategoryGameCleared() bool
CategoryGameCleared reports if the "category_game" edge to the Game entity was cleared.
func (*CategoryMutation) CategoryGameID ¶
func (m *CategoryMutation) CategoryGameID() (id int, exists bool)
CategoryGameID returns the "category_game" edge ID in the mutation.
func (*CategoryMutation) CategoryGameIDs ¶
func (m *CategoryMutation) CategoryGameIDs() (ids []int)
CategoryGameIDs returns the "category_game" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CategoryGameID instead. It exists only for internal usage by the builders.
func (*CategoryMutation) ClearCategoryGame ¶
func (m *CategoryMutation) ClearCategoryGame()
ClearCategoryGame clears the "category_game" edge to the Game entity.
func (*CategoryMutation) ClearDeletedAt ¶
func (m *CategoryMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*CategoryMutation) ClearEdge ¶
func (m *CategoryMutation) 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 (*CategoryMutation) ClearField ¶
func (m *CategoryMutation) 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 (*CategoryMutation) ClearGameID ¶
func (m *CategoryMutation) ClearGameID()
ClearGameID clears the value of the "game_id" field.
func (*CategoryMutation) ClearedEdges ¶
func (m *CategoryMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*CategoryMutation) ClearedFields ¶
func (m *CategoryMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (CategoryMutation) Client ¶
func (m CategoryMutation) 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 (*CategoryMutation) CreatedAt ¶
func (m *CategoryMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*CategoryMutation) DeletedAt ¶
func (m *CategoryMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*CategoryMutation) DeletedAtCleared ¶
func (m *CategoryMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*CategoryMutation) EdgeCleared ¶
func (m *CategoryMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*CategoryMutation) Field ¶
func (m *CategoryMutation) 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 (*CategoryMutation) FieldCleared ¶
func (m *CategoryMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*CategoryMutation) Fields ¶
func (m *CategoryMutation) 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 (*CategoryMutation) GameID ¶
func (m *CategoryMutation) GameID() (r int, exists bool)
GameID returns the value of the "game_id" field in the mutation.
func (*CategoryMutation) GameIDCleared ¶
func (m *CategoryMutation) GameIDCleared() bool
GameIDCleared returns if the "game_id" field was cleared in this mutation.
func (*CategoryMutation) ID ¶
func (m *CategoryMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*CategoryMutation) IDs ¶
func (m *CategoryMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*CategoryMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the Category entity. If the Category 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 (*CategoryMutation) 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 (*CategoryMutation) OldGameID ¶
func (m *CategoryMutation) OldGameID(ctx context.Context) (v int, err error)
OldGameID returns the old "game_id" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldTitle ¶
func (m *CategoryMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldURL ¶
func (m *CategoryMutation) OldURL(ctx context.Context) (v string, err error)
OldURL returns the old "url" field's value of the Category entity. If the Category 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 (*CategoryMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Category entity. If the Category 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 (*CategoryMutation) RemovedEdges ¶
func (m *CategoryMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*CategoryMutation) RemovedIDs ¶
func (m *CategoryMutation) 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 (*CategoryMutation) ResetCategoryGame ¶
func (m *CategoryMutation) ResetCategoryGame()
ResetCategoryGame resets all changes to the "category_game" edge.
func (*CategoryMutation) ResetCreatedAt ¶
func (m *CategoryMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*CategoryMutation) ResetDeletedAt ¶
func (m *CategoryMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*CategoryMutation) ResetEdge ¶
func (m *CategoryMutation) 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 (*CategoryMutation) ResetField ¶
func (m *CategoryMutation) 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 (*CategoryMutation) ResetGameID ¶
func (m *CategoryMutation) ResetGameID()
ResetGameID resets all changes to the "game_id" field.
func (*CategoryMutation) ResetTitle ¶
func (m *CategoryMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
func (*CategoryMutation) ResetURL ¶
func (m *CategoryMutation) ResetURL()
ResetURL resets all changes to the "url" field.
func (*CategoryMutation) ResetUpdatedAt ¶
func (m *CategoryMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*CategoryMutation) SetCategoryGameID ¶
func (m *CategoryMutation) SetCategoryGameID(id int)
SetCategoryGameID sets the "category_game" edge to the Game entity by id.
func (*CategoryMutation) SetCreatedAt ¶
func (m *CategoryMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*CategoryMutation) SetDeletedAt ¶
func (m *CategoryMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*CategoryMutation) SetField ¶
func (m *CategoryMutation) 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 (*CategoryMutation) SetGameID ¶
func (m *CategoryMutation) SetGameID(i int)
SetGameID sets the "game_id" field.
func (*CategoryMutation) SetOp ¶
func (m *CategoryMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*CategoryMutation) SetTitle ¶
func (m *CategoryMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*CategoryMutation) SetURL ¶
func (m *CategoryMutation) SetURL(s string)
SetURL sets the "url" field.
func (*CategoryMutation) SetUpdatedAt ¶
func (m *CategoryMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*CategoryMutation) Title ¶
func (m *CategoryMutation) Title() (r string, exists bool)
Title returns the value of the "title" field in the mutation.
func (CategoryMutation) Tx ¶
func (m CategoryMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*CategoryMutation) Type ¶
func (m *CategoryMutation) Type() string
Type returns the node type of this mutation (Category).
func (*CategoryMutation) URL ¶
func (m *CategoryMutation) URL() (r string, exists bool)
URL returns the value of the "url" field in the mutation.
func (*CategoryMutation) UpdatedAt ¶
func (m *CategoryMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*CategoryMutation) Where ¶
func (m *CategoryMutation) Where(ps ...predicate.Category)
Where appends a list predicates to the CategoryMutation builder.
func (*CategoryMutation) WhereP ¶
func (m *CategoryMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the CategoryMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type CategoryQuery ¶
type CategoryQuery struct {
// contains filtered or unexported fields
}
CategoryQuery is the builder for querying Category entities.
func (*CategoryQuery) Aggregate ¶
func (cq *CategoryQuery) Aggregate(fns ...AggregateFunc) *CategorySelect
Aggregate returns a CategorySelect configured with the given aggregations.
func (*CategoryQuery) All ¶
func (cq *CategoryQuery) All(ctx context.Context) ([]*Category, error)
All executes the query and returns a list of Categories.
func (*CategoryQuery) AllX ¶
func (cq *CategoryQuery) AllX(ctx context.Context) []*Category
AllX is like All, but panics if an error occurs.
func (*CategoryQuery) Clone ¶
func (cq *CategoryQuery) Clone() *CategoryQuery
Clone returns a duplicate of the CategoryQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*CategoryQuery) Count ¶
func (cq *CategoryQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*CategoryQuery) CountX ¶
func (cq *CategoryQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*CategoryQuery) Exist ¶
func (cq *CategoryQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*CategoryQuery) ExistX ¶
func (cq *CategoryQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*CategoryQuery) First ¶
func (cq *CategoryQuery) First(ctx context.Context) (*Category, error)
First returns the first Category entity from the query. Returns a *NotFoundError when no Category was found.
func (*CategoryQuery) FirstID ¶
func (cq *CategoryQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Category ID from the query. Returns a *NotFoundError when no Category ID was found.
func (*CategoryQuery) FirstIDX ¶
func (cq *CategoryQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*CategoryQuery) FirstX ¶
func (cq *CategoryQuery) FirstX(ctx context.Context) *Category
FirstX is like First, but panics if an error occurs.
func (*CategoryQuery) GroupBy ¶
func (cq *CategoryQuery) GroupBy(field string, fields ...string) *CategoryGroupBy
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 { Title string `json:"title,omitempty"` Count int `json:"count,omitempty"` } client.Category.Query(). GroupBy(category.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*CategoryQuery) IDs ¶
func (cq *CategoryQuery) IDs(ctx context.Context) (ids []int, err error)
IDs executes the query and returns a list of Category IDs.
func (*CategoryQuery) IDsX ¶
func (cq *CategoryQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*CategoryQuery) Limit ¶
func (cq *CategoryQuery) Limit(limit int) *CategoryQuery
Limit the number of records to be returned by this query.
func (*CategoryQuery) Offset ¶
func (cq *CategoryQuery) Offset(offset int) *CategoryQuery
Offset to start from.
func (*CategoryQuery) Only ¶
func (cq *CategoryQuery) Only(ctx context.Context) (*Category, error)
Only returns a single Category entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Category entity is found. Returns a *NotFoundError when no Category entities are found.
func (*CategoryQuery) OnlyID ¶
func (cq *CategoryQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Category ID in the query. Returns a *NotSingularError when more than one Category ID is found. Returns a *NotFoundError when no entities are found.
func (*CategoryQuery) OnlyIDX ¶
func (cq *CategoryQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*CategoryQuery) OnlyX ¶
func (cq *CategoryQuery) OnlyX(ctx context.Context) *Category
OnlyX is like Only, but panics if an error occurs.
func (*CategoryQuery) Order ¶
func (cq *CategoryQuery) Order(o ...category.OrderOption) *CategoryQuery
Order specifies how the records should be ordered.
func (*CategoryQuery) QueryCategoryGame ¶
func (cq *CategoryQuery) QueryCategoryGame() *GameQuery
QueryCategoryGame chains the current query on the "category_game" edge.
func (*CategoryQuery) Select ¶
func (cq *CategoryQuery) Select(fields ...string) *CategorySelect
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 { Title string `json:"title,omitempty"` } client.Category.Query(). Select(category.FieldTitle). Scan(ctx, &v)
func (*CategoryQuery) Unique ¶
func (cq *CategoryQuery) Unique(unique bool) *CategoryQuery
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 (*CategoryQuery) Where ¶
func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery
Where adds a new predicate for the CategoryQuery builder.
func (*CategoryQuery) WithCategoryGame ¶
func (cq *CategoryQuery) WithCategoryGame(opts ...func(*GameQuery)) *CategoryQuery
WithCategoryGame tells the query-builder to eager-load the nodes that are connected to the "category_game" edge. The optional arguments are used to configure the query builder of the edge.
type CategorySelect ¶
type CategorySelect struct { *CategoryQuery // contains filtered or unexported fields }
CategorySelect is the builder for selecting fields of Category entities.
func (*CategorySelect) Aggregate ¶
func (cs *CategorySelect) Aggregate(fns ...AggregateFunc) *CategorySelect
Aggregate adds the given aggregation functions to the selector query.
func (*CategorySelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*CategorySelect) Scan ¶
func (cs *CategorySelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*CategorySelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type CategoryUpdate ¶
type CategoryUpdate struct {
// contains filtered or unexported fields
}
CategoryUpdate is the builder for updating Category entities.
func (*CategoryUpdate) ClearCategoryGame ¶
func (cu *CategoryUpdate) ClearCategoryGame() *CategoryUpdate
ClearCategoryGame clears the "category_game" edge to the Game entity.
func (*CategoryUpdate) ClearDeletedAt ¶
func (cu *CategoryUpdate) ClearDeletedAt() *CategoryUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
func (*CategoryUpdate) ClearGameID ¶
func (cu *CategoryUpdate) ClearGameID() *CategoryUpdate
ClearGameID clears the value of the "game_id" field.
func (*CategoryUpdate) Exec ¶
func (cu *CategoryUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*CategoryUpdate) ExecX ¶
func (cu *CategoryUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CategoryUpdate) Mutation ¶
func (cu *CategoryUpdate) Mutation() *CategoryMutation
Mutation returns the CategoryMutation object of the builder.
func (*CategoryUpdate) Save ¶
func (cu *CategoryUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*CategoryUpdate) SaveX ¶
func (cu *CategoryUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*CategoryUpdate) SetCategoryGame ¶
func (cu *CategoryUpdate) SetCategoryGame(g *Game) *CategoryUpdate
SetCategoryGame sets the "category_game" edge to the Game entity.
func (*CategoryUpdate) SetCategoryGameID ¶
func (cu *CategoryUpdate) SetCategoryGameID(id int) *CategoryUpdate
SetCategoryGameID sets the "category_game" edge to the Game entity by ID.
func (*CategoryUpdate) SetDeletedAt ¶
func (cu *CategoryUpdate) SetDeletedAt(t time.Time) *CategoryUpdate
SetDeletedAt sets the "deleted_at" field.
func (*CategoryUpdate) SetGameID ¶
func (cu *CategoryUpdate) SetGameID(i int) *CategoryUpdate
SetGameID sets the "game_id" field.
func (*CategoryUpdate) SetNillableCategoryGameID ¶
func (cu *CategoryUpdate) SetNillableCategoryGameID(id *int) *CategoryUpdate
SetNillableCategoryGameID sets the "category_game" edge to the Game entity by ID if the given value is not nil.
func (*CategoryUpdate) SetNillableGameID ¶
func (cu *CategoryUpdate) SetNillableGameID(i *int) *CategoryUpdate
SetNillableGameID sets the "game_id" field if the given value is not nil.
func (*CategoryUpdate) SetTitle ¶
func (cu *CategoryUpdate) SetTitle(s string) *CategoryUpdate
SetTitle sets the "title" field.
func (*CategoryUpdate) SetURL ¶
func (cu *CategoryUpdate) SetURL(s string) *CategoryUpdate
SetURL sets the "url" field.
func (*CategoryUpdate) SetUpdatedAt ¶
func (cu *CategoryUpdate) SetUpdatedAt(t time.Time) *CategoryUpdate
SetUpdatedAt sets the "updated_at" field.
func (*CategoryUpdate) Where ¶
func (cu *CategoryUpdate) Where(ps ...predicate.Category) *CategoryUpdate
Where appends a list predicates to the CategoryUpdate builder.
type CategoryUpdateOne ¶
type CategoryUpdateOne struct {
// contains filtered or unexported fields
}
CategoryUpdateOne is the builder for updating a single Category entity.
func (*CategoryUpdateOne) ClearCategoryGame ¶
func (cuo *CategoryUpdateOne) ClearCategoryGame() *CategoryUpdateOne
ClearCategoryGame clears the "category_game" edge to the Game entity.
func (*CategoryUpdateOne) ClearDeletedAt ¶
func (cuo *CategoryUpdateOne) ClearDeletedAt() *CategoryUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*CategoryUpdateOne) ClearGameID ¶
func (cuo *CategoryUpdateOne) ClearGameID() *CategoryUpdateOne
ClearGameID clears the value of the "game_id" field.
func (*CategoryUpdateOne) Exec ¶
func (cuo *CategoryUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*CategoryUpdateOne) ExecX ¶
func (cuo *CategoryUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*CategoryUpdateOne) Mutation ¶
func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation
Mutation returns the CategoryMutation object of the builder.
func (*CategoryUpdateOne) Save ¶
func (cuo *CategoryUpdateOne) Save(ctx context.Context) (*Category, error)
Save executes the query and returns the updated Category entity.
func (*CategoryUpdateOne) SaveX ¶
func (cuo *CategoryUpdateOne) SaveX(ctx context.Context) *Category
SaveX is like Save, but panics if an error occurs.
func (*CategoryUpdateOne) Select ¶
func (cuo *CategoryUpdateOne) Select(field string, fields ...string) *CategoryUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*CategoryUpdateOne) SetCategoryGame ¶
func (cuo *CategoryUpdateOne) SetCategoryGame(g *Game) *CategoryUpdateOne
SetCategoryGame sets the "category_game" edge to the Game entity.
func (*CategoryUpdateOne) SetCategoryGameID ¶
func (cuo *CategoryUpdateOne) SetCategoryGameID(id int) *CategoryUpdateOne
SetCategoryGameID sets the "category_game" edge to the Game entity by ID.
func (*CategoryUpdateOne) SetDeletedAt ¶
func (cuo *CategoryUpdateOne) SetDeletedAt(t time.Time) *CategoryUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*CategoryUpdateOne) SetGameID ¶
func (cuo *CategoryUpdateOne) SetGameID(i int) *CategoryUpdateOne
SetGameID sets the "game_id" field.
func (*CategoryUpdateOne) SetNillableCategoryGameID ¶
func (cuo *CategoryUpdateOne) SetNillableCategoryGameID(id *int) *CategoryUpdateOne
SetNillableCategoryGameID sets the "category_game" edge to the Game entity by ID if the given value is not nil.
func (*CategoryUpdateOne) SetNillableGameID ¶
func (cuo *CategoryUpdateOne) SetNillableGameID(i *int) *CategoryUpdateOne
SetNillableGameID sets the "game_id" field if the given value is not nil.
func (*CategoryUpdateOne) SetTitle ¶
func (cuo *CategoryUpdateOne) SetTitle(s string) *CategoryUpdateOne
SetTitle sets the "title" field.
func (*CategoryUpdateOne) SetURL ¶
func (cuo *CategoryUpdateOne) SetURL(s string) *CategoryUpdateOne
SetURL sets the "url" field.
func (*CategoryUpdateOne) SetUpdatedAt ¶
func (cuo *CategoryUpdateOne) SetUpdatedAt(t time.Time) *CategoryUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*CategoryUpdateOne) Where ¶
func (cuo *CategoryUpdateOne) Where(ps ...predicate.Category) *CategoryUpdateOne
Where appends a list predicates to the CategoryUpdate builder.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Article is the client for interacting with the Article builders. Article *ArticleClient // Category is the client for interacting with the Category builders. Category *CategoryClient // Game is the client for interacting with the Game builders. Game *GameClient // 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(). Article. Query(). Count(ctx)
func (*Client) Intercept ¶
func (c *Client) Intercept(interceptors ...Interceptor)
Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
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(ctx 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 Game ¶
type Game struct { // ID of the ent. ID int `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"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt time.Time `json:"deleted_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GameQuery when eager-loading is set. Edges GameEdges `json:"edges"` // contains filtered or unexported fields }
Game is the model entity for the Game schema.
func (*Game) QueryGameCategory ¶
func (ga *Game) QueryGameCategory() *CategoryQuery
QueryGameCategory queries the "game_category" edge of the Game entity.
func (*Game) Unwrap ¶
Unwrap unwraps the Game 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 (*Game) Update ¶
func (ga *Game) Update() *GameUpdateOne
Update returns a builder for updating this Game. Note that you need to call Game.Unwrap() before calling this method if this Game was returned from a transaction, and the transaction was committed or rolled back.
type GameClient ¶
type GameClient struct {
// contains filtered or unexported fields
}
GameClient is a client for the Game schema.
func NewGameClient ¶
func NewGameClient(c config) *GameClient
NewGameClient returns a client for the Game from the given config.
func (*GameClient) Create ¶
func (c *GameClient) Create() *GameCreate
Create returns a builder for creating a Game entity.
func (*GameClient) CreateBulk ¶
func (c *GameClient) CreateBulk(builders ...*GameCreate) *GameCreateBulk
CreateBulk returns a builder for creating a bulk of Game entities.
func (*GameClient) Delete ¶
func (c *GameClient) Delete() *GameDelete
Delete returns a delete builder for Game.
func (*GameClient) DeleteOne ¶
func (c *GameClient) DeleteOne(ga *Game) *GameDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*GameClient) DeleteOneID ¶
func (c *GameClient) DeleteOneID(id int) *GameDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*GameClient) GetX ¶
func (c *GameClient) GetX(ctx context.Context, id int) *Game
GetX is like Get, but panics if an error occurs.
func (*GameClient) Intercept ¶
func (c *GameClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `game.Intercept(f(g(h())))`.
func (*GameClient) Interceptors ¶
func (c *GameClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*GameClient) MapCreateBulk ¶
func (c *GameClient) MapCreateBulk(slice any, setFunc func(*GameCreate, int)) *GameCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
func (*GameClient) Query ¶
func (c *GameClient) Query() *GameQuery
Query returns a query builder for Game.
func (*GameClient) QueryGameCategory ¶
func (c *GameClient) QueryGameCategory(ga *Game) *CategoryQuery
QueryGameCategory queries the game_category edge of a Game.
func (*GameClient) Update ¶
func (c *GameClient) Update() *GameUpdate
Update returns an update builder for Game.
func (*GameClient) UpdateOne ¶
func (c *GameClient) UpdateOne(ga *Game) *GameUpdateOne
UpdateOne returns an update builder for the given entity.
func (*GameClient) UpdateOneID ¶
func (c *GameClient) UpdateOneID(id int) *GameUpdateOne
UpdateOneID returns an update builder for the given id.
func (*GameClient) Use ¶
func (c *GameClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `game.Hooks(f(g(h())))`.
type GameCreate ¶
type GameCreate struct {
// contains filtered or unexported fields
}
GameCreate is the builder for creating a Game entity.
func (*GameCreate) AddGameCategory ¶
func (gc *GameCreate) AddGameCategory(c ...*Category) *GameCreate
AddGameCategory adds the "game_category" edges to the Category entity.
func (*GameCreate) AddGameCategoryIDs ¶
func (gc *GameCreate) AddGameCategoryIDs(ids ...int) *GameCreate
AddGameCategoryIDs adds the "game_category" edge to the Category entity by IDs.
func (*GameCreate) Exec ¶
func (gc *GameCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*GameCreate) ExecX ¶
func (gc *GameCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GameCreate) Mutation ¶
func (gc *GameCreate) Mutation() *GameMutation
Mutation returns the GameMutation object of the builder.
func (*GameCreate) Save ¶
func (gc *GameCreate) Save(ctx context.Context) (*Game, error)
Save creates the Game in the database.
func (*GameCreate) SaveX ¶
func (gc *GameCreate) SaveX(ctx context.Context) *Game
SaveX calls Save and panics if Save returns an error.
func (*GameCreate) SetCreatedAt ¶
func (gc *GameCreate) SetCreatedAt(t time.Time) *GameCreate
SetCreatedAt sets the "created_at" field.
func (*GameCreate) SetDeletedAt ¶
func (gc *GameCreate) SetDeletedAt(t time.Time) *GameCreate
SetDeletedAt sets the "deleted_at" field.
func (*GameCreate) SetIcon ¶
func (gc *GameCreate) SetIcon(s string) *GameCreate
SetIcon sets the "icon" field.
func (*GameCreate) SetName ¶
func (gc *GameCreate) SetName(s string) *GameCreate
SetName sets the "name" field.
func (*GameCreate) SetNillableCreatedAt ¶
func (gc *GameCreate) SetNillableCreatedAt(t *time.Time) *GameCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*GameCreate) SetNillableDeletedAt ¶
func (gc *GameCreate) SetNillableDeletedAt(t *time.Time) *GameCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*GameCreate) SetNillableIcon ¶
func (gc *GameCreate) SetNillableIcon(s *string) *GameCreate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*GameCreate) SetNillableUpdatedAt ¶
func (gc *GameCreate) SetNillableUpdatedAt(t *time.Time) *GameCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*GameCreate) SetUpdatedAt ¶
func (gc *GameCreate) SetUpdatedAt(t time.Time) *GameCreate
SetUpdatedAt sets the "updated_at" field.
type GameCreateBulk ¶
type GameCreateBulk struct {
// contains filtered or unexported fields
}
GameCreateBulk is the builder for creating many Game entities in bulk.
func (*GameCreateBulk) Exec ¶
func (gcb *GameCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*GameCreateBulk) ExecX ¶
func (gcb *GameCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type GameDelete ¶
type GameDelete struct {
// contains filtered or unexported fields
}
GameDelete is the builder for deleting a Game entity.
func (*GameDelete) Exec ¶
func (gd *GameDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*GameDelete) ExecX ¶
func (gd *GameDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*GameDelete) Where ¶
func (gd *GameDelete) Where(ps ...predicate.Game) *GameDelete
Where appends a list predicates to the GameDelete builder.
type GameDeleteOne ¶
type GameDeleteOne struct {
// contains filtered or unexported fields
}
GameDeleteOne is the builder for deleting a single Game entity.
func (*GameDeleteOne) Exec ¶
func (gdo *GameDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*GameDeleteOne) ExecX ¶
func (gdo *GameDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GameDeleteOne) Where ¶
func (gdo *GameDeleteOne) Where(ps ...predicate.Game) *GameDeleteOne
Where appends a list predicates to the GameDelete builder.
type GameEdges ¶
type GameEdges struct { // GameCategory holds the value of the game_category edge. GameCategory []*Category `json:"game_category,omitempty"` // contains filtered or unexported fields }
GameEdges holds the relations/edges for other nodes in the graph.
func (GameEdges) GameCategoryOrErr ¶
GameCategoryOrErr returns the GameCategory value or an error if the edge was not loaded in eager-loading.
type GameGroupBy ¶
type GameGroupBy struct {
// contains filtered or unexported fields
}
GameGroupBy is the group-by builder for Game entities.
func (*GameGroupBy) Aggregate ¶
func (ggb *GameGroupBy) Aggregate(fns ...AggregateFunc) *GameGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*GameGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*GameGroupBy) Scan ¶
func (ggb *GameGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*GameGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type GameMutation ¶
type GameMutation struct {
// contains filtered or unexported fields
}
GameMutation represents an operation that mutates the Game nodes in the graph.
func (*GameMutation) AddField ¶
func (m *GameMutation) 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 (*GameMutation) AddGameCategoryIDs ¶
func (m *GameMutation) AddGameCategoryIDs(ids ...int)
AddGameCategoryIDs adds the "game_category" edge to the Category entity by ids.
func (*GameMutation) AddedEdges ¶
func (m *GameMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*GameMutation) AddedField ¶
func (m *GameMutation) 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 (*GameMutation) AddedFields ¶
func (m *GameMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*GameMutation) AddedIDs ¶
func (m *GameMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*GameMutation) ClearDeletedAt ¶
func (m *GameMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*GameMutation) ClearEdge ¶
func (m *GameMutation) 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 (*GameMutation) ClearField ¶
func (m *GameMutation) 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 (*GameMutation) ClearGameCategory ¶
func (m *GameMutation) ClearGameCategory()
ClearGameCategory clears the "game_category" edge to the Category entity.
func (*GameMutation) ClearIcon ¶
func (m *GameMutation) ClearIcon()
ClearIcon clears the value of the "icon" field.
func (*GameMutation) ClearedEdges ¶
func (m *GameMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*GameMutation) ClearedFields ¶
func (m *GameMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (GameMutation) Client ¶
func (m GameMutation) 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 (*GameMutation) CreatedAt ¶
func (m *GameMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*GameMutation) DeletedAt ¶
func (m *GameMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*GameMutation) DeletedAtCleared ¶
func (m *GameMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*GameMutation) EdgeCleared ¶
func (m *GameMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*GameMutation) Field ¶
func (m *GameMutation) 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 (*GameMutation) FieldCleared ¶
func (m *GameMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*GameMutation) Fields ¶
func (m *GameMutation) 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 (*GameMutation) GameCategoryCleared ¶
func (m *GameMutation) GameCategoryCleared() bool
GameCategoryCleared reports if the "game_category" edge to the Category entity was cleared.
func (*GameMutation) GameCategoryIDs ¶
func (m *GameMutation) GameCategoryIDs() (ids []int)
GameCategoryIDs returns the "game_category" edge IDs in the mutation.
func (*GameMutation) ID ¶
func (m *GameMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*GameMutation) IDs ¶
func (m *GameMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*GameMutation) Icon ¶
func (m *GameMutation) Icon() (r string, exists bool)
Icon returns the value of the "icon" field in the mutation.
func (*GameMutation) IconCleared ¶
func (m *GameMutation) IconCleared() bool
IconCleared returns if the "icon" field was cleared in this mutation.
func (*GameMutation) Name ¶
func (m *GameMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*GameMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Game entity. If the Game 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 (*GameMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the Game entity. If the Game 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 (*GameMutation) 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 (*GameMutation) OldIcon ¶
func (m *GameMutation) OldIcon(ctx context.Context) (v string, err error)
OldIcon returns the old "icon" field's value of the Game entity. If the Game 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 (*GameMutation) OldName ¶
func (m *GameMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Game entity. If the Game 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 (*GameMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Game entity. If the Game 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 (*GameMutation) RemoveGameCategoryIDs ¶
func (m *GameMutation) RemoveGameCategoryIDs(ids ...int)
RemoveGameCategoryIDs removes the "game_category" edge to the Category entity by IDs.
func (*GameMutation) RemovedEdges ¶
func (m *GameMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*GameMutation) RemovedGameCategoryIDs ¶
func (m *GameMutation) RemovedGameCategoryIDs() (ids []int)
RemovedGameCategory returns the removed IDs of the "game_category" edge to the Category entity.
func (*GameMutation) RemovedIDs ¶
func (m *GameMutation) 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 (*GameMutation) ResetCreatedAt ¶
func (m *GameMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*GameMutation) ResetDeletedAt ¶
func (m *GameMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*GameMutation) ResetEdge ¶
func (m *GameMutation) 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 (*GameMutation) ResetField ¶
func (m *GameMutation) 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 (*GameMutation) ResetGameCategory ¶
func (m *GameMutation) ResetGameCategory()
ResetGameCategory resets all changes to the "game_category" edge.
func (*GameMutation) ResetIcon ¶
func (m *GameMutation) ResetIcon()
ResetIcon resets all changes to the "icon" field.
func (*GameMutation) ResetName ¶
func (m *GameMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*GameMutation) ResetUpdatedAt ¶
func (m *GameMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*GameMutation) SetCreatedAt ¶
func (m *GameMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*GameMutation) SetDeletedAt ¶
func (m *GameMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*GameMutation) SetField ¶
func (m *GameMutation) 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 (*GameMutation) SetIcon ¶
func (m *GameMutation) SetIcon(s string)
SetIcon sets the "icon" field.
func (*GameMutation) SetName ¶
func (m *GameMutation) SetName(s string)
SetName sets the "name" field.
func (*GameMutation) SetOp ¶
func (m *GameMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*GameMutation) SetUpdatedAt ¶
func (m *GameMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (GameMutation) Tx ¶
func (m GameMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*GameMutation) Type ¶
func (m *GameMutation) Type() string
Type returns the node type of this mutation (Game).
func (*GameMutation) UpdatedAt ¶
func (m *GameMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*GameMutation) Where ¶
func (m *GameMutation) Where(ps ...predicate.Game)
Where appends a list predicates to the GameMutation builder.
func (*GameMutation) WhereP ¶
func (m *GameMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the GameMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type GameQuery ¶
type GameQuery struct {
// contains filtered or unexported fields
}
GameQuery is the builder for querying Game entities.
func (*GameQuery) Aggregate ¶
func (gq *GameQuery) Aggregate(fns ...AggregateFunc) *GameSelect
Aggregate returns a GameSelect configured with the given aggregations.
func (*GameQuery) Clone ¶
Clone returns a duplicate of the GameQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*GameQuery) First ¶
First returns the first Game entity from the query. Returns a *NotFoundError when no Game was found.
func (*GameQuery) FirstID ¶
FirstID returns the first Game ID from the query. Returns a *NotFoundError when no Game ID was found.
func (*GameQuery) GroupBy ¶
func (gq *GameQuery) GroupBy(field string, fields ...string) *GameGroupBy
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.Game.Query(). GroupBy(game.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*GameQuery) Only ¶
Only returns a single Game entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Game entity is found. Returns a *NotFoundError when no Game entities are found.
func (*GameQuery) OnlyID ¶
OnlyID is like Only, but returns the only Game ID in the query. Returns a *NotSingularError when more than one Game ID is found. Returns a *NotFoundError when no entities are found.
func (*GameQuery) Order ¶
func (gq *GameQuery) Order(o ...game.OrderOption) *GameQuery
Order specifies how the records should be ordered.
func (*GameQuery) QueryGameCategory ¶
func (gq *GameQuery) QueryGameCategory() *CategoryQuery
QueryGameCategory chains the current query on the "game_category" edge.
func (*GameQuery) Select ¶
func (gq *GameQuery) Select(fields ...string) *GameSelect
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.Game.Query(). Select(game.FieldName). Scan(ctx, &v)
func (*GameQuery) 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 (*GameQuery) WithGameCategory ¶
func (gq *GameQuery) WithGameCategory(opts ...func(*CategoryQuery)) *GameQuery
WithGameCategory tells the query-builder to eager-load the nodes that are connected to the "game_category" edge. The optional arguments are used to configure the query builder of the edge.
type GameSelect ¶
type GameSelect struct { *GameQuery // contains filtered or unexported fields }
GameSelect is the builder for selecting fields of Game entities.
func (*GameSelect) Aggregate ¶
func (gs *GameSelect) Aggregate(fns ...AggregateFunc) *GameSelect
Aggregate adds the given aggregation functions to the selector query.
func (*GameSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*GameSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*GameSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*GameSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*GameSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*GameSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*GameSelect) Scan ¶
func (gs *GameSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*GameSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type GameUpdate ¶
type GameUpdate struct {
// contains filtered or unexported fields
}
GameUpdate is the builder for updating Game entities.
func (*GameUpdate) AddGameCategory ¶
func (gu *GameUpdate) AddGameCategory(c ...*Category) *GameUpdate
AddGameCategory adds the "game_category" edges to the Category entity.
func (*GameUpdate) AddGameCategoryIDs ¶
func (gu *GameUpdate) AddGameCategoryIDs(ids ...int) *GameUpdate
AddGameCategoryIDs adds the "game_category" edge to the Category entity by IDs.
func (*GameUpdate) ClearDeletedAt ¶
func (gu *GameUpdate) ClearDeletedAt() *GameUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
func (*GameUpdate) ClearGameCategory ¶
func (gu *GameUpdate) ClearGameCategory() *GameUpdate
ClearGameCategory clears all "game_category" edges to the Category entity.
func (*GameUpdate) ClearIcon ¶
func (gu *GameUpdate) ClearIcon() *GameUpdate
ClearIcon clears the value of the "icon" field.
func (*GameUpdate) Exec ¶
func (gu *GameUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*GameUpdate) ExecX ¶
func (gu *GameUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GameUpdate) Mutation ¶
func (gu *GameUpdate) Mutation() *GameMutation
Mutation returns the GameMutation object of the builder.
func (*GameUpdate) RemoveGameCategory ¶
func (gu *GameUpdate) RemoveGameCategory(c ...*Category) *GameUpdate
RemoveGameCategory removes "game_category" edges to Category entities.
func (*GameUpdate) RemoveGameCategoryIDs ¶
func (gu *GameUpdate) RemoveGameCategoryIDs(ids ...int) *GameUpdate
RemoveGameCategoryIDs removes the "game_category" edge to Category entities by IDs.
func (*GameUpdate) Save ¶
func (gu *GameUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*GameUpdate) SaveX ¶
func (gu *GameUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*GameUpdate) SetDeletedAt ¶
func (gu *GameUpdate) SetDeletedAt(t time.Time) *GameUpdate
SetDeletedAt sets the "deleted_at" field.
func (*GameUpdate) SetIcon ¶
func (gu *GameUpdate) SetIcon(s string) *GameUpdate
SetIcon sets the "icon" field.
func (*GameUpdate) SetName ¶
func (gu *GameUpdate) SetName(s string) *GameUpdate
SetName sets the "name" field.
func (*GameUpdate) SetNillableIcon ¶
func (gu *GameUpdate) SetNillableIcon(s *string) *GameUpdate
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*GameUpdate) SetUpdatedAt ¶
func (gu *GameUpdate) SetUpdatedAt(t time.Time) *GameUpdate
SetUpdatedAt sets the "updated_at" field.
func (*GameUpdate) Where ¶
func (gu *GameUpdate) Where(ps ...predicate.Game) *GameUpdate
Where appends a list predicates to the GameUpdate builder.
type GameUpdateOne ¶
type GameUpdateOne struct {
// contains filtered or unexported fields
}
GameUpdateOne is the builder for updating a single Game entity.
func (*GameUpdateOne) AddGameCategory ¶
func (guo *GameUpdateOne) AddGameCategory(c ...*Category) *GameUpdateOne
AddGameCategory adds the "game_category" edges to the Category entity.
func (*GameUpdateOne) AddGameCategoryIDs ¶
func (guo *GameUpdateOne) AddGameCategoryIDs(ids ...int) *GameUpdateOne
AddGameCategoryIDs adds the "game_category" edge to the Category entity by IDs.
func (*GameUpdateOne) ClearDeletedAt ¶
func (guo *GameUpdateOne) ClearDeletedAt() *GameUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
func (*GameUpdateOne) ClearGameCategory ¶
func (guo *GameUpdateOne) ClearGameCategory() *GameUpdateOne
ClearGameCategory clears all "game_category" edges to the Category entity.
func (*GameUpdateOne) ClearIcon ¶
func (guo *GameUpdateOne) ClearIcon() *GameUpdateOne
ClearIcon clears the value of the "icon" field.
func (*GameUpdateOne) Exec ¶
func (guo *GameUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*GameUpdateOne) ExecX ¶
func (guo *GameUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*GameUpdateOne) Mutation ¶
func (guo *GameUpdateOne) Mutation() *GameMutation
Mutation returns the GameMutation object of the builder.
func (*GameUpdateOne) RemoveGameCategory ¶
func (guo *GameUpdateOne) RemoveGameCategory(c ...*Category) *GameUpdateOne
RemoveGameCategory removes "game_category" edges to Category entities.
func (*GameUpdateOne) RemoveGameCategoryIDs ¶
func (guo *GameUpdateOne) RemoveGameCategoryIDs(ids ...int) *GameUpdateOne
RemoveGameCategoryIDs removes the "game_category" edge to Category entities by IDs.
func (*GameUpdateOne) Save ¶
func (guo *GameUpdateOne) Save(ctx context.Context) (*Game, error)
Save executes the query and returns the updated Game entity.
func (*GameUpdateOne) SaveX ¶
func (guo *GameUpdateOne) SaveX(ctx context.Context) *Game
SaveX is like Save, but panics if an error occurs.
func (*GameUpdateOne) Select ¶
func (guo *GameUpdateOne) Select(field string, fields ...string) *GameUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*GameUpdateOne) SetDeletedAt ¶
func (guo *GameUpdateOne) SetDeletedAt(t time.Time) *GameUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*GameUpdateOne) SetIcon ¶
func (guo *GameUpdateOne) SetIcon(s string) *GameUpdateOne
SetIcon sets the "icon" field.
func (*GameUpdateOne) SetName ¶
func (guo *GameUpdateOne) SetName(s string) *GameUpdateOne
SetName sets the "name" field.
func (*GameUpdateOne) SetNillableIcon ¶
func (guo *GameUpdateOne) SetNillableIcon(s *string) *GameUpdateOne
SetNillableIcon sets the "icon" field if the given value is not nil.
func (*GameUpdateOne) SetUpdatedAt ¶
func (guo *GameUpdateOne) SetUpdatedAt(t time.Time) *GameUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*GameUpdateOne) Where ¶
func (guo *GameUpdateOne) Where(ps ...predicate.Game) *GameUpdateOne
Where appends a list predicates to the GameUpdate builder.
type InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
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 OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
ent aliases to avoid import conflicts in user's code.
type QueryContext ¶
type QueryContext = ent.QueryContext
ent aliases to avoid import conflicts in user's code.
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(ctx 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 Rollback method.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct { // Article is the client for interacting with the Article builders. Article *ArticleClient // Category is the client for interacting with the Category builders. Category *CategoryClient // Game is the client for interacting with the Game builders. Game *GameClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type User ¶
type User struct { // ID of the ent. ID int `json:"id,omitempty"` // Username holds the value of the "username" field. Username string `json:"username,omitempty"` // Email holds the value of the "email" field. Email string `json:"email,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt time.Time `json:"deleted_at,omitempty"` // 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 builder for creating a User entity.
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 builder for deleting the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Intercept ¶
func (c *UserClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
func (*UserClient) Interceptors ¶
func (c *UserClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*UserClient) MapCreateBulk ¶
func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.
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 int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) Exec ¶
func (uc *UserCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreate) ExecX ¶
func (uc *UserCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserCreate) Mutation ¶
func (uc *UserCreate) Mutation() *UserMutation
Mutation returns the UserMutation object of the builder.
func (*UserCreate) Save ¶
func (uc *UserCreate) Save(ctx context.Context) (*User, error)
Save creates the User in the database.
func (*UserCreate) SaveX ¶
func (uc *UserCreate) SaveX(ctx context.Context) *User
SaveX calls Save and panics if Save returns an error.
func (*UserCreate) SetCreatedAt ¶
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate
SetCreatedAt sets the "created_at" field.
func (*UserCreate) SetDeletedAt ¶
func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate
SetDeletedAt sets the "deleted_at" field.
func (*UserCreate) SetEmail ¶
func (uc *UserCreate) SetEmail(s string) *UserCreate
SetEmail sets the "email" field.
func (*UserCreate) SetNillableCreatedAt ¶
func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*UserCreate) SetNillableDeletedAt ¶
func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate
SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (*UserCreate) SetNillableUpdatedAt ¶
func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*UserCreate) SetPassword ¶
func (uc *UserCreate) SetPassword(s string) *UserCreate
SetPassword sets the "password" field.
func (*UserCreate) SetUpdatedAt ¶
func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate
SetUpdatedAt sets the "updated_at" field.
func (*UserCreate) SetUsername ¶
func (uc *UserCreate) SetUsername(s string) *UserCreate
SetUsername sets the "username" field.
type UserCreateBulk ¶
type UserCreateBulk struct {
// contains filtered or unexported fields
}
UserCreateBulk is the builder for creating many User entities in bulk.
func (*UserCreateBulk) Exec ¶
func (ucb *UserCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*UserCreateBulk) ExecX ¶
func (ucb *UserCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where appends a list predicates to the UserDelete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserDeleteOne) Where ¶
func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne
Where appends a list predicates to the UserDelete builder.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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) ClearDeletedAt ¶
func (m *UserMutation) ClearDeletedAt()
ClearDeletedAt clears the value of the "deleted_at" field.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearedEdges ¶
func (m *UserMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*UserMutation) ClearedFields ¶
func (m *UserMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (UserMutation) Client ¶
func (m UserMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*UserMutation) CreatedAt ¶
func (m *UserMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*UserMutation) DeletedAt ¶
func (m *UserMutation) DeletedAt() (r time.Time, exists bool)
DeletedAt returns the value of the "deleted_at" field in the mutation.
func (*UserMutation) DeletedAtCleared ¶
func (m *UserMutation) DeletedAtCleared() bool
DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (*UserMutation) EdgeCleared ¶
func (m *UserMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*UserMutation) Email ¶
func (m *UserMutation) Email() (r string, exists bool)
Email returns the value of the "email" field in the mutation.
func (*UserMutation) Field ¶
func (m *UserMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) FieldCleared ¶
func (m *UserMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*UserMutation) Fields ¶
func (m *UserMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*UserMutation) ID ¶
func (m *UserMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*UserMutation) IDs ¶
func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*UserMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldDeletedAt ¶
OldDeletedAt returns the old "deleted_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldEmail ¶
func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)
OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*UserMutation) 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) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) OldUsername ¶
func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)
OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*UserMutation) Password ¶
func (m *UserMutation) Password() (r string, exists bool)
Password returns the value of the "password" field in the mutation.
func (*UserMutation) 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) ResetCreatedAt ¶
func (m *UserMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*UserMutation) ResetDeletedAt ¶
func (m *UserMutation) ResetDeletedAt()
ResetDeletedAt resets all changes to the "deleted_at" field.
func (*UserMutation) ResetEdge ¶
func (m *UserMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*UserMutation) ResetEmail ¶
func (m *UserMutation) ResetEmail()
ResetEmail resets all changes to the "email" field.
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) ResetPassword ¶
func (m *UserMutation) ResetPassword()
ResetPassword resets all changes to the "password" field.
func (*UserMutation) ResetUpdatedAt ¶
func (m *UserMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*UserMutation) ResetUsername ¶
func (m *UserMutation) ResetUsername()
ResetUsername resets all changes to the "username" field.
func (*UserMutation) SetCreatedAt ¶
func (m *UserMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*UserMutation) SetDeletedAt ¶
func (m *UserMutation) SetDeletedAt(t time.Time)
SetDeletedAt sets the "deleted_at" field.
func (*UserMutation) SetEmail ¶
func (m *UserMutation) SetEmail(s string)
SetEmail sets the "email" 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) SetOp ¶
func (m *UserMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*UserMutation) SetPassword ¶
func (m *UserMutation) SetPassword(s string)
SetPassword sets the "password" field.
func (*UserMutation) SetUpdatedAt ¶
func (m *UserMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*UserMutation) SetUsername ¶
func (m *UserMutation) SetUsername(s string)
SetUsername sets the "username" field.
func (UserMutation) Tx ¶
func (m UserMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*UserMutation) Type ¶
func (m *UserMutation) Type() string
Type returns the node type of this mutation (User).
func (*UserMutation) UpdatedAt ¶
func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*UserMutation) Username ¶
func (m *UserMutation) Username() (r string, exists bool)
Username returns the value of the "username" field in the mutation.
func (*UserMutation) Where ¶
func (m *UserMutation) Where(ps ...predicate.User)
Where appends a list predicates to the UserMutation builder.
func (*UserMutation) WhereP ¶
func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Aggregate ¶
func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate returns a UserSelect configured with the given aggregations.
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 { Username string `json:"username,omitempty"` Count int `json:"count,omitempty"` } client.User.Query(). GroupBy(user.FieldUsername). 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 more than one User entity is 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 more than one User ID is found. Returns a *NotFoundError when no entities are found.
func (*UserQuery) Order ¶
func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
Order specifies how the records should be ordered.
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 { Username string `json:"username,omitempty"` } client.User.Query(). Select(user.FieldUsername). 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) Aggregate ¶
func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate adds the given aggregation functions to the selector query.
func (*UserSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*UserSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) ClearDeletedAt ¶
func (uu *UserUpdate) ClearDeletedAt() *UserUpdate
ClearDeletedAt clears the value of the "deleted_at" field.
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) SetDeletedAt ¶
func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate
SetDeletedAt sets the "deleted_at" field.
func (*UserUpdate) SetEmail ¶
func (uu *UserUpdate) SetEmail(s string) *UserUpdate
SetEmail sets the "email" field.
func (*UserUpdate) SetPassword ¶
func (uu *UserUpdate) SetPassword(s string) *UserUpdate
SetPassword sets the "password" field.
func (*UserUpdate) SetUpdatedAt ¶
func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdate) SetUsername ¶
func (uu *UserUpdate) SetUsername(s string) *UserUpdate
SetUsername sets the "username" field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) ClearDeletedAt ¶
func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne
ClearDeletedAt clears the value of the "deleted_at" field.
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) SetDeletedAt ¶
func (uuo *UserUpdateOne) SetDeletedAt(t time.Time) *UserUpdateOne
SetDeletedAt sets the "deleted_at" field.
func (*UserUpdateOne) SetEmail ¶
func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne
SetEmail sets the "email" field.
func (*UserUpdateOne) SetPassword ¶
func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne
SetPassword sets the "password" field.
func (*UserUpdateOne) SetUpdatedAt ¶
func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*UserUpdateOne) SetUsername ¶
func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne
SetUsername sets the "username" field.
func (*UserUpdateOne) Where ¶
func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
Where appends a list predicates to the UserUpdate builder.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge 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.
Source Files
¶
- article.go
- article_create.go
- article_delete.go
- article_query.go
- article_update.go
- category.go
- category_create.go
- category_delete.go
- category_query.go
- category_update.go
- client.go
- ent.go
- game.go
- game_create.go
- game_delete.go
- game_query.go
- game_update.go
- mutation.go
- runtime.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go