Documentation ¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type 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 int64) *GameDeleteOne
- func (c *GameClient) Get(ctx context.Context, id int64) (*Game, error)
- func (c *GameClient) GetX(ctx context.Context, id int64) *Game
- func (c *GameClient) Hooks() []Hook
- func (c *GameClient) Query() *GameQuery
- func (c *GameClient) Update() *GameUpdate
- func (c *GameClient) UpdateOne(ga *Game) *GameUpdateOne
- func (c *GameClient) UpdateOneID(id int64) *GameUpdateOne
- func (c *GameClient) Use(hooks ...Hook)
- type 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) SetCount(i int64) *GameCreate
- func (gc *GameCreate) SetCreatedAt(t time.Time) *GameCreate
- func (gc *GameCreate) SetDescription(s string) *GameCreate
- func (gc *GameCreate) SetID(i int64) *GameCreate
- func (gc *GameCreate) SetName(s string) *GameCreate
- func (gc *GameCreate) SetNillableCreatedAt(t *time.Time) *GameCreate
- func (gc *GameCreate) SetNillableUpdatedAt(t *time.Time) *GameCreate
- func (gc *GameCreate) SetUpdatedAt(t time.Time) *GameCreate
- type GameCreateBulk
- type GameDelete
- type GameDeleteOne
- type GameGroupBy
- func (ggb *GameGroupBy) Aggregate(fns ...AggregateFunc) *GameGroupBy
- func (ggb *GameGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (ggb *GameGroupBy) BoolX(ctx context.Context) bool
- func (ggb *GameGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ggb *GameGroupBy) BoolsX(ctx context.Context) []bool
- func (ggb *GameGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (ggb *GameGroupBy) Float64X(ctx context.Context) float64
- func (ggb *GameGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ggb *GameGroupBy) Float64sX(ctx context.Context) []float64
- func (ggb *GameGroupBy) Int(ctx context.Context) (_ int, err error)
- func (ggb *GameGroupBy) IntX(ctx context.Context) int
- func (ggb *GameGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ggb *GameGroupBy) IntsX(ctx context.Context) []int
- func (ggb *GameGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ggb *GameGroupBy) ScanX(ctx context.Context, v interface{})
- func (ggb *GameGroupBy) String(ctx context.Context) (_ string, err error)
- func (ggb *GameGroupBy) StringX(ctx context.Context) string
- func (ggb *GameGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ggb *GameGroupBy) StringsX(ctx context.Context) []string
- type GameMutation
- func (m *GameMutation) AddCount(i int64)
- func (m *GameMutation) AddField(name string, value ent.Value) error
- func (m *GameMutation) AddedCount() (r int64, exists bool)
- 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) ClearEdge(name string) error
- func (m *GameMutation) ClearField(name string) error
- func (m *GameMutation) ClearedEdges() []string
- func (m *GameMutation) ClearedFields() []string
- func (m GameMutation) Client() *Client
- func (m *GameMutation) Count() (r int64, exists bool)
- func (m *GameMutation) CreatedAt() (r time.Time, exists bool)
- func (m *GameMutation) Description() (r string, exists 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) ID() (id int64, exists bool)
- func (m *GameMutation) IDs(ctx context.Context) ([]int64, error)
- func (m *GameMutation) Name() (r string, exists bool)
- func (m *GameMutation) OldCount(ctx context.Context) (v int64, err error)
- func (m *GameMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *GameMutation) OldDescription(ctx context.Context) (v string, err error)
- func (m *GameMutation) OldField(ctx context.Context, name string) (ent.Value, 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) RemovedEdges() []string
- func (m *GameMutation) RemovedIDs(name string) []ent.Value
- func (m *GameMutation) ResetCount()
- func (m *GameMutation) ResetCreatedAt()
- func (m *GameMutation) ResetDescription()
- func (m *GameMutation) ResetEdge(name string) error
- func (m *GameMutation) ResetField(name string) error
- func (m *GameMutation) ResetName()
- func (m *GameMutation) ResetUpdatedAt()
- func (m *GameMutation) SetCount(i int64)
- func (m *GameMutation) SetCreatedAt(t time.Time)
- func (m *GameMutation) SetDescription(s string)
- func (m *GameMutation) SetField(name string, value ent.Value) error
- func (m *GameMutation) SetID(id int64)
- func (m *GameMutation) SetName(s string)
- 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)
- type GameQuery
- 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 int64, err error)
- func (gq *GameQuery) FirstIDX(ctx context.Context) int64
- func (gq *GameQuery) FirstX(ctx context.Context) *Game
- func (gq *GameQuery) GroupBy(field string, fields ...string) *GameGroupBy
- func (gq *GameQuery) IDs(ctx context.Context) ([]int64, error)
- func (gq *GameQuery) IDsX(ctx context.Context) []int64
- 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 int64, err error)
- func (gq *GameQuery) OnlyIDX(ctx context.Context) int64
- func (gq *GameQuery) OnlyX(ctx context.Context) *Game
- func (gq *GameQuery) Order(o ...OrderFunc) *GameQuery
- func (gq *GameQuery) Select(fields ...string) *GameSelect
- func (gq *GameQuery) Unique(unique bool) *GameQuery
- func (gq *GameQuery) Where(ps ...predicate.Game) *GameQuery
- type GameSelect
- func (gs *GameSelect) Bool(ctx context.Context) (_ bool, err error)
- func (gs *GameSelect) BoolX(ctx context.Context) bool
- func (gs *GameSelect) Bools(ctx context.Context) ([]bool, error)
- func (gs *GameSelect) BoolsX(ctx context.Context) []bool
- func (gs *GameSelect) Float64(ctx context.Context) (_ float64, err error)
- func (gs *GameSelect) Float64X(ctx context.Context) float64
- func (gs *GameSelect) Float64s(ctx context.Context) ([]float64, error)
- func (gs *GameSelect) Float64sX(ctx context.Context) []float64
- func (gs *GameSelect) Int(ctx context.Context) (_ int, err error)
- func (gs *GameSelect) IntX(ctx context.Context) int
- func (gs *GameSelect) Ints(ctx context.Context) ([]int, error)
- func (gs *GameSelect) IntsX(ctx context.Context) []int
- func (gs *GameSelect) Scan(ctx context.Context, v interface{}) error
- func (gs *GameSelect) ScanX(ctx context.Context, v interface{})
- func (gs *GameSelect) String(ctx context.Context) (_ string, err error)
- func (gs *GameSelect) StringX(ctx context.Context) string
- func (gs *GameSelect) Strings(ctx context.Context) ([]string, error)
- func (gs *GameSelect) StringsX(ctx context.Context) []string
- type GameUpdate
- func (gu *GameUpdate) AddCount(i int64) *GameUpdate
- func (gu *GameUpdate) Exec(ctx context.Context) error
- func (gu *GameUpdate) ExecX(ctx context.Context)
- func (gu *GameUpdate) Mutation() *GameMutation
- func (gu *GameUpdate) Save(ctx context.Context) (int, error)
- func (gu *GameUpdate) SaveX(ctx context.Context) int
- func (gu *GameUpdate) SetCount(i int64) *GameUpdate
- func (gu *GameUpdate) SetCreatedAt(t time.Time) *GameUpdate
- func (gu *GameUpdate) SetDescription(s string) *GameUpdate
- func (gu *GameUpdate) SetName(s string) *GameUpdate
- func (gu *GameUpdate) SetNillableCreatedAt(t *time.Time) *GameUpdate
- func (gu *GameUpdate) SetNillableUpdatedAt(t *time.Time) *GameUpdate
- func (gu *GameUpdate) SetUpdatedAt(t time.Time) *GameUpdate
- func (gu *GameUpdate) Where(ps ...predicate.Game) *GameUpdate
- type GameUpdateOne
- func (guo *GameUpdateOne) AddCount(i int64) *GameUpdateOne
- func (guo *GameUpdateOne) Exec(ctx context.Context) error
- func (guo *GameUpdateOne) ExecX(ctx context.Context)
- func (guo *GameUpdateOne) Mutation() *GameMutation
- 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) SetCount(i int64) *GameUpdateOne
- func (guo *GameUpdateOne) SetCreatedAt(t time.Time) *GameUpdateOne
- func (guo *GameUpdateOne) SetDescription(s string) *GameUpdateOne
- func (guo *GameUpdateOne) SetName(s string) *GameUpdateOne
- func (guo *GameUpdateOne) SetNillableCreatedAt(t *time.Time) *GameUpdateOne
- func (guo *GameUpdateOne) SetNillableUpdatedAt(t *time.Time) *GameUpdateOne
- func (guo *GameUpdateOne) SetUpdatedAt(t time.Time) *GameUpdateOne
- type Games
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- 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. TypeGame = "Game" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Game is the client for interacting with the Game builders. Game *GameClient // 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(). Game. Query(). Count(ctx)
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(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 int64 `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` // Count holds the value of the "count" field. Count int64 `json:"count,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 }
Game is the model entity for the Game schema.
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 create builder for Game.
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 delete builder for the given entity.
func (*GameClient) DeleteOneID ¶
func (c *GameClient) DeleteOneID(id int64) *GameDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*GameClient) GetX ¶
func (c *GameClient) GetX(ctx context.Context, id int64) *Game
GetX is like Get, but panics if an error occurs.
func (*GameClient) Query ¶
func (c *GameClient) Query() *GameQuery
Query returns a query builder for 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 int64) *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) 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) SetCount ¶
func (gc *GameCreate) SetCount(i int64) *GameCreate
SetCount sets the "count" field.
func (*GameCreate) SetCreatedAt ¶
func (gc *GameCreate) SetCreatedAt(t time.Time) *GameCreate
SetCreatedAt sets the "created_at" field.
func (*GameCreate) SetDescription ¶
func (gc *GameCreate) SetDescription(s string) *GameCreate
SetDescription sets the "description" field.
func (*GameCreate) SetID ¶
func (gc *GameCreate) SetID(i int64) *GameCreate
SetID sets the "id" 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) 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.
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 ¶
func (ggb *GameGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) BoolX ¶
func (ggb *GameGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*GameGroupBy) Bools ¶
func (ggb *GameGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) BoolsX ¶
func (ggb *GameGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*GameGroupBy) Float64 ¶
func (ggb *GameGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) Float64X ¶
func (ggb *GameGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*GameGroupBy) Float64s ¶
func (ggb *GameGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) Float64sX ¶
func (ggb *GameGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*GameGroupBy) Int ¶
func (ggb *GameGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) IntX ¶
func (ggb *GameGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*GameGroupBy) Ints ¶
func (ggb *GameGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) IntsX ¶
func (ggb *GameGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*GameGroupBy) Scan ¶
func (ggb *GameGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*GameGroupBy) ScanX ¶
func (ggb *GameGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*GameGroupBy) String ¶
func (ggb *GameGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*GameGroupBy) StringX ¶
func (ggb *GameGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type GameMutation ¶
type GameMutation struct {
// contains filtered or unexported fields
}
GameMutation represents an operation that mutates the Game nodes in the graph.
func (*GameMutation) AddCount ¶
func (m *GameMutation) AddCount(i int64)
AddCount adds i to the "count" field.
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) AddedCount ¶
func (m *GameMutation) AddedCount() (r int64, exists bool)
AddedCount returns the value that was added to the "count" field in this mutation.
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) 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) 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) Count ¶
func (m *GameMutation) Count() (r int64, exists bool)
Count returns the value of the "count" field in the mutation.
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) Description ¶
func (m *GameMutation) Description() (r string, exists bool)
Description returns the value of the "description" field in the 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) ID ¶
func (m *GameMutation) ID() (id int64, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*GameMutation) IDs ¶
func (m *GameMutation) IDs(ctx context.Context) ([]int64, 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) Name ¶
func (m *GameMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*GameMutation) OldCount ¶
func (m *GameMutation) OldCount(ctx context.Context) (v int64, err error)
OldCount returns the old "count" 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) 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) OldDescription ¶
func (m *GameMutation) OldDescription(ctx context.Context) (v string, err error)
OldDescription returns the old "description" 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) 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) RemovedEdges ¶
func (m *GameMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
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) ResetCount ¶
func (m *GameMutation) ResetCount()
ResetCount resets all changes to the "count" field.
func (*GameMutation) ResetCreatedAt ¶
func (m *GameMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*GameMutation) ResetDescription ¶
func (m *GameMutation) ResetDescription()
ResetDescription resets all changes to the "description" 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) 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) SetCount ¶
func (m *GameMutation) SetCount(i int64)
SetCount sets the "count" field.
func (*GameMutation) SetCreatedAt ¶
func (m *GameMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*GameMutation) SetDescription ¶
func (m *GameMutation) SetDescription(s string)
SetDescription sets the "description" 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) SetID ¶
func (m *GameMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Game entities.
func (*GameMutation) SetName ¶
func (m *GameMutation) SetName(s string)
SetName sets the "name" field.
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.
type GameQuery ¶
type GameQuery struct {
// contains filtered or unexported fields
}
GameQuery is the builder for querying Game entities.
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 exactly one Game entity is not 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 exactly one Game ID is not found. Returns a *NotFoundError when no entities are found.
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)
type GameSelect ¶
type GameSelect struct { *GameQuery // contains filtered or unexported fields }
GameSelect is the builder for selecting fields of Game entities.
func (*GameSelect) Bool ¶
func (gs *GameSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*GameSelect) BoolX ¶
func (gs *GameSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*GameSelect) Bools ¶
func (gs *GameSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*GameSelect) BoolsX ¶
func (gs *GameSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*GameSelect) Float64 ¶
func (gs *GameSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*GameSelect) Float64X ¶
func (gs *GameSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*GameSelect) Float64s ¶
func (gs *GameSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*GameSelect) Float64sX ¶
func (gs *GameSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*GameSelect) Int ¶
func (gs *GameSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*GameSelect) IntX ¶
func (gs *GameSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*GameSelect) Ints ¶
func (gs *GameSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*GameSelect) IntsX ¶
func (gs *GameSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*GameSelect) Scan ¶
func (gs *GameSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*GameSelect) ScanX ¶
func (gs *GameSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*GameSelect) String ¶
func (gs *GameSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*GameSelect) StringX ¶
func (gs *GameSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type GameUpdate ¶
type GameUpdate struct {
// contains filtered or unexported fields
}
GameUpdate is the builder for updating Game entities.
func (*GameUpdate) AddCount ¶
func (gu *GameUpdate) AddCount(i int64) *GameUpdate
AddCount adds i to the "count" 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) 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) SetCount ¶
func (gu *GameUpdate) SetCount(i int64) *GameUpdate
SetCount sets the "count" field.
func (*GameUpdate) SetCreatedAt ¶
func (gu *GameUpdate) SetCreatedAt(t time.Time) *GameUpdate
SetCreatedAt sets the "created_at" field.
func (*GameUpdate) SetDescription ¶
func (gu *GameUpdate) SetDescription(s string) *GameUpdate
SetDescription sets the "description" field.
func (*GameUpdate) SetName ¶
func (gu *GameUpdate) SetName(s string) *GameUpdate
SetName sets the "name" field.
func (*GameUpdate) SetNillableCreatedAt ¶
func (gu *GameUpdate) SetNillableCreatedAt(t *time.Time) *GameUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*GameUpdate) SetNillableUpdatedAt ¶
func (gu *GameUpdate) SetNillableUpdatedAt(t *time.Time) *GameUpdate
SetNillableUpdatedAt sets the "updated_at" 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) AddCount ¶
func (guo *GameUpdateOne) AddCount(i int64) *GameUpdateOne
AddCount adds i to the "count" 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) 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) SetCount ¶
func (guo *GameUpdateOne) SetCount(i int64) *GameUpdateOne
SetCount sets the "count" field.
func (*GameUpdateOne) SetCreatedAt ¶
func (guo *GameUpdateOne) SetCreatedAt(t time.Time) *GameUpdateOne
SetCreatedAt sets the "created_at" field.
func (*GameUpdateOne) SetDescription ¶
func (guo *GameUpdateOne) SetDescription(s string) *GameUpdateOne
SetDescription sets the "description" field.
func (*GameUpdateOne) SetName ¶
func (guo *GameUpdateOne) SetName(s string) *GameUpdateOne
SetName sets the "name" field.
func (*GameUpdateOne) SetNillableCreatedAt ¶
func (guo *GameUpdateOne) SetNillableCreatedAt(t *time.Time) *GameUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*GameUpdateOne) SetNillableUpdatedAt ¶
func (guo *GameUpdateOne) SetNillableUpdatedAt(t *time.Time) *GameUpdateOne
SetNillableUpdatedAt sets the "updated_at" 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.
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 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 Tx ¶
type Tx struct { // Game is the client for interacting with the Game builders. Game *GameClient // 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 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.