ent

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeCharacter           = "Character"
	TypeDeprecatedCharacter = "DeprecatedCharacter"
	TypePlayer              = "Player"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

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 Character

type Character struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// PlayerID holds the value of the "player_id" field.
	PlayerID uuid.UUID `json:"player_id,omitempty"`
	// Version holds the value of the "version" field.
	Version int `json:"version"`
	// Slot holds the value of the "slot" field.
	Slot int `json:"slot"`
	// Size holds the value of the "size" field.
	Size int `json:"size,omitempty"`
	// Data holds the value of the "data" field.
	Data string `json:"data,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 CharacterQuery when eager-loading is set.
	Edges CharacterEdges `json:"edges"`
	// contains filtered or unexported fields
}

Character is the model entity for the Character schema.

func (*Character) QueryPlayer added in v1.0.5

func (c *Character) QueryPlayer() *PlayerQuery

QueryPlayer queries the "player" edge of the Character entity.

func (*Character) String

func (c *Character) String() string

String implements the fmt.Stringer.

func (*Character) Unwrap

func (c *Character) Unwrap() *Character

Unwrap unwraps the Character 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 (*Character) Update

func (c *Character) Update() *CharacterUpdateOne

Update returns a builder for updating this Character. Note that you need to call Character.Unwrap() before calling this method if this Character was returned from a transaction, and the transaction was committed or rolled back.

type CharacterClient

type CharacterClient struct {
	// contains filtered or unexported fields
}

CharacterClient is a client for the Character schema.

func NewCharacterClient

func NewCharacterClient(c config) *CharacterClient

NewCharacterClient returns a client for the Character from the given config.

func (*CharacterClient) Create

func (c *CharacterClient) Create() *CharacterCreate

Create returns a create builder for Character.

func (*CharacterClient) CreateBulk

func (c *CharacterClient) CreateBulk(builders ...*CharacterCreate) *CharacterCreateBulk

CreateBulk returns a builder for creating a bulk of Character entities.

func (*CharacterClient) Delete

func (c *CharacterClient) Delete() *CharacterDelete

Delete returns a delete builder for Character.

func (*CharacterClient) DeleteOne

func (c *CharacterClient) DeleteOne(ch *Character) *CharacterDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CharacterClient) DeleteOneID

func (c *CharacterClient) DeleteOneID(id uuid.UUID) *CharacterDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CharacterClient) Get

func (c *CharacterClient) Get(ctx context.Context, id uuid.UUID) (*Character, error)

Get returns a Character entity by its id.

func (*CharacterClient) GetX

func (c *CharacterClient) GetX(ctx context.Context, id uuid.UUID) *Character

GetX is like Get, but panics if an error occurs.

func (*CharacterClient) Hooks

func (c *CharacterClient) Hooks() []Hook

Hooks returns the client hooks.

func (*CharacterClient) Query

func (c *CharacterClient) Query() *CharacterQuery

Query returns a query builder for Character.

func (*CharacterClient) QueryPlayer added in v1.0.5

func (c *CharacterClient) QueryPlayer(ch *Character) *PlayerQuery

QueryPlayer queries the player edge of a Character.

func (*CharacterClient) Update

func (c *CharacterClient) Update() *CharacterUpdate

Update returns an update builder for Character.

func (*CharacterClient) UpdateOne

func (c *CharacterClient) UpdateOne(ch *Character) *CharacterUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CharacterClient) UpdateOneID

func (c *CharacterClient) UpdateOneID(id uuid.UUID) *CharacterUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CharacterClient) Use

func (c *CharacterClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `character.Hooks(f(g(h())))`.

type CharacterCreate

type CharacterCreate struct {
	// contains filtered or unexported fields
}

CharacterCreate is the builder for creating a Character entity.

func (*CharacterCreate) Exec

func (cc *CharacterCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CharacterCreate) ExecX

func (cc *CharacterCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CharacterCreate) Mutation

func (cc *CharacterCreate) Mutation() *CharacterMutation

Mutation returns the CharacterMutation object of the builder.

func (*CharacterCreate) Save

func (cc *CharacterCreate) Save(ctx context.Context) (*Character, error)

Save creates the Character in the database.

func (*CharacterCreate) SaveX

func (cc *CharacterCreate) SaveX(ctx context.Context) *Character

SaveX calls Save and panics if Save returns an error.

func (*CharacterCreate) SetCreatedAt added in v1.0.5

func (cc *CharacterCreate) SetCreatedAt(t time.Time) *CharacterCreate

SetCreatedAt sets the "created_at" field.

func (*CharacterCreate) SetData added in v1.0.1

func (cc *CharacterCreate) SetData(s string) *CharacterCreate

SetData sets the "data" field.

func (*CharacterCreate) SetDeletedAt added in v1.0.5

func (cc *CharacterCreate) SetDeletedAt(t time.Time) *CharacterCreate

SetDeletedAt sets the "deleted_at" field.

func (*CharacterCreate) SetID

func (cc *CharacterCreate) SetID(u uuid.UUID) *CharacterCreate

SetID sets the "id" field.

func (*CharacterCreate) SetNillableCreatedAt added in v1.0.5

func (cc *CharacterCreate) SetNillableCreatedAt(t *time.Time) *CharacterCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*CharacterCreate) SetNillableDeletedAt added in v1.0.5

func (cc *CharacterCreate) SetNillableDeletedAt(t *time.Time) *CharacterCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*CharacterCreate) SetNillableID

func (cc *CharacterCreate) SetNillableID(u *uuid.UUID) *CharacterCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*CharacterCreate) SetNillableSize added in v1.0.1

func (cc *CharacterCreate) SetNillableSize(i *int) *CharacterCreate

SetNillableSize sets the "size" field if the given value is not nil.

func (*CharacterCreate) SetNillableSlot added in v1.0.3

func (cc *CharacterCreate) SetNillableSlot(i *int) *CharacterCreate

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*CharacterCreate) SetNillableUpdatedAt added in v1.0.5

func (cc *CharacterCreate) SetNillableUpdatedAt(t *time.Time) *CharacterCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*CharacterCreate) SetPlayer added in v1.0.5

func (cc *CharacterCreate) SetPlayer(p *Player) *CharacterCreate

SetPlayer sets the "player" edge to the Player entity.

func (*CharacterCreate) SetPlayerID added in v1.0.5

func (cc *CharacterCreate) SetPlayerID(u uuid.UUID) *CharacterCreate

SetPlayerID sets the "player_id" field.

func (*CharacterCreate) SetSize added in v1.0.1

func (cc *CharacterCreate) SetSize(i int) *CharacterCreate

SetSize sets the "size" field.

func (*CharacterCreate) SetSlot

func (cc *CharacterCreate) SetSlot(i int) *CharacterCreate

SetSlot sets the "slot" field.

func (*CharacterCreate) SetUpdatedAt added in v1.0.5

func (cc *CharacterCreate) SetUpdatedAt(t time.Time) *CharacterCreate

SetUpdatedAt sets the "updated_at" field.

func (*CharacterCreate) SetVersion added in v1.0.5

func (cc *CharacterCreate) SetVersion(i int) *CharacterCreate

SetVersion sets the "version" field.

type CharacterCreateBulk

type CharacterCreateBulk struct {
	// contains filtered or unexported fields
}

CharacterCreateBulk is the builder for creating many Character entities in bulk.

func (*CharacterCreateBulk) Exec

func (ccb *CharacterCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CharacterCreateBulk) ExecX

func (ccb *CharacterCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CharacterCreateBulk) Save

func (ccb *CharacterCreateBulk) Save(ctx context.Context) ([]*Character, error)

Save creates the Character entities in the database.

func (*CharacterCreateBulk) SaveX

func (ccb *CharacterCreateBulk) SaveX(ctx context.Context) []*Character

SaveX is like Save, but panics if an error occurs.

type CharacterDelete

type CharacterDelete struct {
	// contains filtered or unexported fields
}

CharacterDelete is the builder for deleting a Character entity.

func (*CharacterDelete) Exec

func (cd *CharacterDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*CharacterDelete) ExecX

func (cd *CharacterDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*CharacterDelete) Where

Where appends a list predicates to the CharacterDelete builder.

type CharacterDeleteOne

type CharacterDeleteOne struct {
	// contains filtered or unexported fields
}

CharacterDeleteOne is the builder for deleting a single Character entity.

func (*CharacterDeleteOne) Exec

func (cdo *CharacterDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CharacterDeleteOne) ExecX

func (cdo *CharacterDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type CharacterEdges added in v1.0.5

type CharacterEdges struct {
	// Player holds the value of the player edge.
	Player *Player `json:"player,omitempty"`
	// contains filtered or unexported fields
}

CharacterEdges holds the relations/edges for other nodes in the graph.

func (CharacterEdges) PlayerOrErr added in v1.0.5

func (e CharacterEdges) PlayerOrErr() (*Player, error)

PlayerOrErr returns the Player value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type CharacterGroupBy

type CharacterGroupBy struct {
	// contains filtered or unexported fields
}

CharacterGroupBy is the group-by builder for Character entities.

func (*CharacterGroupBy) Aggregate

func (cgb *CharacterGroupBy) Aggregate(fns ...AggregateFunc) *CharacterGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*CharacterGroupBy) Bool

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) BoolX

func (cgb *CharacterGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CharacterGroupBy) Bools

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) BoolsX

func (cgb *CharacterGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CharacterGroupBy) Float64

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) Float64X

func (cgb *CharacterGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CharacterGroupBy) Float64s

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) Float64sX

func (cgb *CharacterGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CharacterGroupBy) Int

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) IntX

func (cgb *CharacterGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CharacterGroupBy) Ints

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) IntsX

func (cgb *CharacterGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CharacterGroupBy) Scan

func (cgb *CharacterGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*CharacterGroupBy) ScanX

func (cgb *CharacterGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CharacterGroupBy) String

func (cgb *CharacterGroupBy) 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 (*CharacterGroupBy) StringX

func (cgb *CharacterGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CharacterGroupBy) Strings

func (cgb *CharacterGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*CharacterGroupBy) StringsX

func (cgb *CharacterGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CharacterMutation

type CharacterMutation struct {
	// contains filtered or unexported fields
}

CharacterMutation represents an operation that mutates the Character nodes in the graph.

func (*CharacterMutation) AddField

func (m *CharacterMutation) 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 (*CharacterMutation) AddSize added in v1.0.1

func (m *CharacterMutation) AddSize(i int)

AddSize adds i to the "size" field.

func (*CharacterMutation) AddSlot

func (m *CharacterMutation) AddSlot(i int)

AddSlot adds i to the "slot" field.

func (*CharacterMutation) AddVersion added in v1.0.5

func (m *CharacterMutation) AddVersion(i int)

AddVersion adds i to the "version" field.

func (*CharacterMutation) AddedEdges

func (m *CharacterMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*CharacterMutation) AddedField

func (m *CharacterMutation) 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 (*CharacterMutation) AddedFields

func (m *CharacterMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*CharacterMutation) AddedIDs

func (m *CharacterMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*CharacterMutation) AddedSize added in v1.0.1

func (m *CharacterMutation) AddedSize() (r int, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*CharacterMutation) AddedSlot

func (m *CharacterMutation) AddedSlot() (r int, exists bool)

AddedSlot returns the value that was added to the "slot" field in this mutation.

func (*CharacterMutation) AddedVersion added in v1.0.5

func (m *CharacterMutation) AddedVersion() (r int, exists bool)

AddedVersion returns the value that was added to the "version" field in this mutation.

func (*CharacterMutation) ClearDeletedAt added in v1.0.5

func (m *CharacterMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CharacterMutation) ClearEdge

func (m *CharacterMutation) 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 (*CharacterMutation) ClearField

func (m *CharacterMutation) 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 (*CharacterMutation) ClearPlayer added in v1.0.5

func (m *CharacterMutation) ClearPlayer()

ClearPlayer clears the "player" edge to the Player entity.

func (*CharacterMutation) ClearedEdges

func (m *CharacterMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*CharacterMutation) ClearedFields

func (m *CharacterMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (CharacterMutation) Client

func (m CharacterMutation) 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 (*CharacterMutation) CreatedAt added in v1.0.5

func (m *CharacterMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*CharacterMutation) Data added in v1.0.1

func (m *CharacterMutation) Data() (r string, exists bool)

Data returns the value of the "data" field in the mutation.

func (*CharacterMutation) DeletedAt added in v1.0.5

func (m *CharacterMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*CharacterMutation) DeletedAtCleared added in v1.0.5

func (m *CharacterMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*CharacterMutation) EdgeCleared

func (m *CharacterMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*CharacterMutation) Field

func (m *CharacterMutation) 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 (*CharacterMutation) FieldCleared

func (m *CharacterMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*CharacterMutation) Fields

func (m *CharacterMutation) 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 (*CharacterMutation) ID

func (m *CharacterMutation) ID() (id uuid.UUID, 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 (*CharacterMutation) IDs

func (m *CharacterMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*CharacterMutation) OldCreatedAt added in v1.0.5

func (m *CharacterMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldData added in v1.0.1

func (m *CharacterMutation) OldData(ctx context.Context) (v string, err error)

OldData returns the old "data" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldDeletedAt added in v1.0.5

func (m *CharacterMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldField

func (m *CharacterMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*CharacterMutation) OldPlayerID added in v1.0.5

func (m *CharacterMutation) OldPlayerID(ctx context.Context) (v uuid.UUID, err error)

OldPlayerID returns the old "player_id" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldSize added in v1.0.1

func (m *CharacterMutation) OldSize(ctx context.Context) (v int, err error)

OldSize returns the old "size" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldSlot

func (m *CharacterMutation) OldSlot(ctx context.Context) (v int, err error)

OldSlot returns the old "slot" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldUpdatedAt added in v1.0.5

func (m *CharacterMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Character entity. If the Character 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 (*CharacterMutation) OldVersion added in v1.0.5

func (m *CharacterMutation) OldVersion(ctx context.Context) (v int, err error)

OldVersion returns the old "version" field's value of the Character entity. If the Character 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 (*CharacterMutation) Op

func (m *CharacterMutation) Op() Op

Op returns the operation name.

func (*CharacterMutation) PlayerCleared added in v1.0.5

func (m *CharacterMutation) PlayerCleared() bool

PlayerCleared reports if the "player" edge to the Player entity was cleared.

func (*CharacterMutation) PlayerID added in v1.0.5

func (m *CharacterMutation) PlayerID() (r uuid.UUID, exists bool)

PlayerID returns the value of the "player_id" field in the mutation.

func (*CharacterMutation) PlayerIDs added in v1.0.5

func (m *CharacterMutation) PlayerIDs() (ids []uuid.UUID)

PlayerIDs returns the "player" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PlayerID instead. It exists only for internal usage by the builders.

func (*CharacterMutation) RemovedEdges

func (m *CharacterMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*CharacterMutation) RemovedIDs

func (m *CharacterMutation) 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 (*CharacterMutation) ResetCreatedAt added in v1.0.5

func (m *CharacterMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CharacterMutation) ResetData added in v1.0.1

func (m *CharacterMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*CharacterMutation) ResetDeletedAt added in v1.0.5

func (m *CharacterMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*CharacterMutation) ResetEdge

func (m *CharacterMutation) 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 (*CharacterMutation) ResetField

func (m *CharacterMutation) 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 (*CharacterMutation) ResetPlayer added in v1.0.5

func (m *CharacterMutation) ResetPlayer()

ResetPlayer resets all changes to the "player" edge.

func (*CharacterMutation) ResetPlayerID added in v1.0.5

func (m *CharacterMutation) ResetPlayerID()

ResetPlayerID resets all changes to the "player_id" field.

func (*CharacterMutation) ResetSize added in v1.0.1

func (m *CharacterMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*CharacterMutation) ResetSlot

func (m *CharacterMutation) ResetSlot()

ResetSlot resets all changes to the "slot" field.

func (*CharacterMutation) ResetUpdatedAt added in v1.0.5

func (m *CharacterMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CharacterMutation) ResetVersion added in v1.0.5

func (m *CharacterMutation) ResetVersion()

ResetVersion resets all changes to the "version" field.

func (*CharacterMutation) SetCreatedAt added in v1.0.5

func (m *CharacterMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*CharacterMutation) SetData added in v1.0.1

func (m *CharacterMutation) SetData(s string)

SetData sets the "data" field.

func (*CharacterMutation) SetDeletedAt added in v1.0.5

func (m *CharacterMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*CharacterMutation) SetField

func (m *CharacterMutation) 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 (*CharacterMutation) SetID

func (m *CharacterMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Character entities.

func (*CharacterMutation) SetPlayerID added in v1.0.5

func (m *CharacterMutation) SetPlayerID(u uuid.UUID)

SetPlayerID sets the "player_id" field.

func (*CharacterMutation) SetSize added in v1.0.1

func (m *CharacterMutation) SetSize(i int)

SetSize sets the "size" field.

func (*CharacterMutation) SetSlot

func (m *CharacterMutation) SetSlot(i int)

SetSlot sets the "slot" field.

func (*CharacterMutation) SetUpdatedAt added in v1.0.5

func (m *CharacterMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*CharacterMutation) SetVersion added in v1.0.5

func (m *CharacterMutation) SetVersion(i int)

SetVersion sets the "version" field.

func (*CharacterMutation) Size added in v1.0.1

func (m *CharacterMutation) Size() (r int, exists bool)

Size returns the value of the "size" field in the mutation.

func (*CharacterMutation) Slot

func (m *CharacterMutation) Slot() (r int, exists bool)

Slot returns the value of the "slot" field in the mutation.

func (CharacterMutation) Tx

func (m CharacterMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*CharacterMutation) Type

func (m *CharacterMutation) Type() string

Type returns the node type of this mutation (Character).

func (*CharacterMutation) UpdatedAt added in v1.0.5

func (m *CharacterMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*CharacterMutation) Version added in v1.0.5

func (m *CharacterMutation) Version() (r int, exists bool)

Version returns the value of the "version" field in the mutation.

func (*CharacterMutation) Where

func (m *CharacterMutation) Where(ps ...predicate.Character)

Where appends a list predicates to the CharacterMutation builder.

type CharacterQuery

type CharacterQuery struct {
	// contains filtered or unexported fields
}

CharacterQuery is the builder for querying Character entities.

func (*CharacterQuery) All

func (cq *CharacterQuery) All(ctx context.Context) ([]*Character, error)

All executes the query and returns a list of Characters.

func (*CharacterQuery) AllX

func (cq *CharacterQuery) AllX(ctx context.Context) []*Character

AllX is like All, but panics if an error occurs.

func (*CharacterQuery) Clone

func (cq *CharacterQuery) Clone() *CharacterQuery

Clone returns a duplicate of the CharacterQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*CharacterQuery) Count

func (cq *CharacterQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CharacterQuery) CountX

func (cq *CharacterQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*CharacterQuery) Exist

func (cq *CharacterQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*CharacterQuery) ExistX

func (cq *CharacterQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*CharacterQuery) First

func (cq *CharacterQuery) First(ctx context.Context) (*Character, error)

First returns the first Character entity from the query. Returns a *NotFoundError when no Character was found.

func (*CharacterQuery) FirstID

func (cq *CharacterQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Character ID from the query. Returns a *NotFoundError when no Character ID was found.

func (*CharacterQuery) FirstIDX

func (cq *CharacterQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*CharacterQuery) FirstX

func (cq *CharacterQuery) FirstX(ctx context.Context) *Character

FirstX is like First, but panics if an error occurs.

func (*CharacterQuery) GroupBy

func (cq *CharacterQuery) GroupBy(field string, fields ...string) *CharacterGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Character.Query().
	GroupBy(character.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CharacterQuery) IDs

func (cq *CharacterQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Character IDs.

func (*CharacterQuery) IDsX

func (cq *CharacterQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*CharacterQuery) Limit

func (cq *CharacterQuery) Limit(limit int) *CharacterQuery

Limit adds a limit step to the query.

func (*CharacterQuery) Offset

func (cq *CharacterQuery) Offset(offset int) *CharacterQuery

Offset adds an offset step to the query.

func (*CharacterQuery) Only

func (cq *CharacterQuery) Only(ctx context.Context) (*Character, error)

Only returns a single Character entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Character entity is found. Returns a *NotFoundError when no Character entities are found.

func (*CharacterQuery) OnlyID

func (cq *CharacterQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Character ID in the query. Returns a *NotSingularError when more than one Character ID is found. Returns a *NotFoundError when no entities are found.

func (*CharacterQuery) OnlyIDX

func (cq *CharacterQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*CharacterQuery) OnlyX

func (cq *CharacterQuery) OnlyX(ctx context.Context) *Character

OnlyX is like Only, but panics if an error occurs.

func (*CharacterQuery) Order

func (cq *CharacterQuery) Order(o ...OrderFunc) *CharacterQuery

Order adds an order step to the query.

func (*CharacterQuery) QueryPlayer added in v1.0.5

func (cq *CharacterQuery) QueryPlayer() *PlayerQuery

QueryPlayer chains the current query on the "player" edge.

func (*CharacterQuery) Select

func (cq *CharacterQuery) Select(fields ...string) *CharacterSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Character.Query().
	Select(character.FieldCreatedAt).
	Scan(ctx, &v)

func (*CharacterQuery) Unique

func (cq *CharacterQuery) Unique(unique bool) *CharacterQuery

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 (*CharacterQuery) Where

Where adds a new predicate for the CharacterQuery builder.

func (*CharacterQuery) WithPlayer added in v1.0.5

func (cq *CharacterQuery) WithPlayer(opts ...func(*PlayerQuery)) *CharacterQuery

WithPlayer tells the query-builder to eager-load the nodes that are connected to the "player" edge. The optional arguments are used to configure the query builder of the edge.

type CharacterSelect

type CharacterSelect struct {
	*CharacterQuery
	// contains filtered or unexported fields
}

CharacterSelect is the builder for selecting fields of Character entities.

func (*CharacterSelect) Bool

func (cs *CharacterSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) BoolX

func (cs *CharacterSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CharacterSelect) Bools

func (cs *CharacterSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) BoolsX

func (cs *CharacterSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CharacterSelect) Float64

func (cs *CharacterSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) Float64X

func (cs *CharacterSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CharacterSelect) Float64s

func (cs *CharacterSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) Float64sX

func (cs *CharacterSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CharacterSelect) Int

func (cs *CharacterSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) IntX

func (cs *CharacterSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CharacterSelect) Ints

func (cs *CharacterSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) IntsX

func (cs *CharacterSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CharacterSelect) Scan

func (cs *CharacterSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*CharacterSelect) ScanX

func (cs *CharacterSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CharacterSelect) String

func (cs *CharacterSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) StringX

func (cs *CharacterSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CharacterSelect) Strings

func (cs *CharacterSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*CharacterSelect) StringsX

func (cs *CharacterSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CharacterUpdate

type CharacterUpdate struct {
	// contains filtered or unexported fields
}

CharacterUpdate is the builder for updating Character entities.

func (*CharacterUpdate) AddSize added in v1.0.1

func (cu *CharacterUpdate) AddSize(i int) *CharacterUpdate

AddSize adds i to the "size" field.

func (*CharacterUpdate) AddSlot

func (cu *CharacterUpdate) AddSlot(i int) *CharacterUpdate

AddSlot adds i to the "slot" field.

func (*CharacterUpdate) AddVersion added in v1.0.5

func (cu *CharacterUpdate) AddVersion(i int) *CharacterUpdate

AddVersion adds i to the "version" field.

func (*CharacterUpdate) ClearDeletedAt added in v1.0.5

func (cu *CharacterUpdate) ClearDeletedAt() *CharacterUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CharacterUpdate) ClearPlayer added in v1.0.5

func (cu *CharacterUpdate) ClearPlayer() *CharacterUpdate

ClearPlayer clears the "player" edge to the Player entity.

func (*CharacterUpdate) Exec

func (cu *CharacterUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CharacterUpdate) ExecX

func (cu *CharacterUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CharacterUpdate) Mutation

func (cu *CharacterUpdate) Mutation() *CharacterMutation

Mutation returns the CharacterMutation object of the builder.

func (*CharacterUpdate) Save

func (cu *CharacterUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*CharacterUpdate) SaveX

func (cu *CharacterUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*CharacterUpdate) SetData added in v1.0.1

func (cu *CharacterUpdate) SetData(s string) *CharacterUpdate

SetData sets the "data" field.

func (*CharacterUpdate) SetDeletedAt added in v1.0.5

func (cu *CharacterUpdate) SetDeletedAt(t time.Time) *CharacterUpdate

SetDeletedAt sets the "deleted_at" field.

func (*CharacterUpdate) SetNillableDeletedAt added in v1.0.5

func (cu *CharacterUpdate) SetNillableDeletedAt(t *time.Time) *CharacterUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*CharacterUpdate) SetNillableSize added in v1.0.1

func (cu *CharacterUpdate) SetNillableSize(i *int) *CharacterUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*CharacterUpdate) SetNillableSlot added in v1.0.3

func (cu *CharacterUpdate) SetNillableSlot(i *int) *CharacterUpdate

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*CharacterUpdate) SetPlayer added in v1.0.5

func (cu *CharacterUpdate) SetPlayer(p *Player) *CharacterUpdate

SetPlayer sets the "player" edge to the Player entity.

func (*CharacterUpdate) SetPlayerID added in v1.0.5

func (cu *CharacterUpdate) SetPlayerID(u uuid.UUID) *CharacterUpdate

SetPlayerID sets the "player_id" field.

func (*CharacterUpdate) SetSize added in v1.0.1

func (cu *CharacterUpdate) SetSize(i int) *CharacterUpdate

SetSize sets the "size" field.

func (*CharacterUpdate) SetSlot

func (cu *CharacterUpdate) SetSlot(i int) *CharacterUpdate

SetSlot sets the "slot" field.

func (*CharacterUpdate) SetUpdatedAt added in v1.0.5

func (cu *CharacterUpdate) SetUpdatedAt(t time.Time) *CharacterUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CharacterUpdate) SetVersion added in v1.0.5

func (cu *CharacterUpdate) SetVersion(i int) *CharacterUpdate

SetVersion sets the "version" field.

func (*CharacterUpdate) Where

Where appends a list predicates to the CharacterUpdate builder.

type CharacterUpdateOne

type CharacterUpdateOne struct {
	// contains filtered or unexported fields
}

CharacterUpdateOne is the builder for updating a single Character entity.

func (*CharacterUpdateOne) AddSize added in v1.0.1

func (cuo *CharacterUpdateOne) AddSize(i int) *CharacterUpdateOne

AddSize adds i to the "size" field.

func (*CharacterUpdateOne) AddSlot

func (cuo *CharacterUpdateOne) AddSlot(i int) *CharacterUpdateOne

AddSlot adds i to the "slot" field.

func (*CharacterUpdateOne) AddVersion added in v1.0.5

func (cuo *CharacterUpdateOne) AddVersion(i int) *CharacterUpdateOne

AddVersion adds i to the "version" field.

func (*CharacterUpdateOne) ClearDeletedAt added in v1.0.5

func (cuo *CharacterUpdateOne) ClearDeletedAt() *CharacterUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CharacterUpdateOne) ClearPlayer added in v1.0.5

func (cuo *CharacterUpdateOne) ClearPlayer() *CharacterUpdateOne

ClearPlayer clears the "player" edge to the Player entity.

func (*CharacterUpdateOne) Exec

func (cuo *CharacterUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CharacterUpdateOne) ExecX

func (cuo *CharacterUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CharacterUpdateOne) Mutation

func (cuo *CharacterUpdateOne) Mutation() *CharacterMutation

Mutation returns the CharacterMutation object of the builder.

func (*CharacterUpdateOne) Save

func (cuo *CharacterUpdateOne) Save(ctx context.Context) (*Character, error)

Save executes the query and returns the updated Character entity.

func (*CharacterUpdateOne) SaveX

func (cuo *CharacterUpdateOne) SaveX(ctx context.Context) *Character

SaveX is like Save, but panics if an error occurs.

func (*CharacterUpdateOne) Select

func (cuo *CharacterUpdateOne) Select(field string, fields ...string) *CharacterUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*CharacterUpdateOne) SetData added in v1.0.1

func (cuo *CharacterUpdateOne) SetData(s string) *CharacterUpdateOne

SetData sets the "data" field.

func (*CharacterUpdateOne) SetDeletedAt added in v1.0.5

func (cuo *CharacterUpdateOne) SetDeletedAt(t time.Time) *CharacterUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*CharacterUpdateOne) SetNillableDeletedAt added in v1.0.5

func (cuo *CharacterUpdateOne) SetNillableDeletedAt(t *time.Time) *CharacterUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*CharacterUpdateOne) SetNillableSize added in v1.0.1

func (cuo *CharacterUpdateOne) SetNillableSize(i *int) *CharacterUpdateOne

SetNillableSize sets the "size" field if the given value is not nil.

func (*CharacterUpdateOne) SetNillableSlot added in v1.0.3

func (cuo *CharacterUpdateOne) SetNillableSlot(i *int) *CharacterUpdateOne

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*CharacterUpdateOne) SetPlayer added in v1.0.5

func (cuo *CharacterUpdateOne) SetPlayer(p *Player) *CharacterUpdateOne

SetPlayer sets the "player" edge to the Player entity.

func (*CharacterUpdateOne) SetPlayerID added in v1.0.5

func (cuo *CharacterUpdateOne) SetPlayerID(u uuid.UUID) *CharacterUpdateOne

SetPlayerID sets the "player_id" field.

func (*CharacterUpdateOne) SetSize added in v1.0.1

func (cuo *CharacterUpdateOne) SetSize(i int) *CharacterUpdateOne

SetSize sets the "size" field.

func (*CharacterUpdateOne) SetSlot

func (cuo *CharacterUpdateOne) SetSlot(i int) *CharacterUpdateOne

SetSlot sets the "slot" field.

func (*CharacterUpdateOne) SetUpdatedAt added in v1.0.5

func (cuo *CharacterUpdateOne) SetUpdatedAt(t time.Time) *CharacterUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CharacterUpdateOne) SetVersion added in v1.0.5

func (cuo *CharacterUpdateOne) SetVersion(i int) *CharacterUpdateOne

SetVersion sets the "version" field.

type Characters

type Characters []*Character

Characters is a parsable slice of Character.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Character is the client for interacting with the Character builders.
	Character *CharacterClient
	// DeprecatedCharacter is the client for interacting with the DeprecatedCharacter builders.
	DeprecatedCharacter *DeprecatedCharacterClient
	// Player is the client for interacting with the Player builders.
	Player *PlayerClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

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) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Character.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

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.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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 Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

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 DeprecatedCharacter added in v1.0.5

type DeprecatedCharacter struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Steamid holds the value of the "steamid" field.
	Steamid string `json:"steamid,omitempty"`
	// Slot holds the value of the "slot" field.
	Slot int `json:"slot"`
	// Size holds the value of the "size" field.
	Size int `json:"size,omitempty"`
	// Data holds the value of the "data" field.
	Data string `json:"data,omitempty"`
	// contains filtered or unexported fields
}

DeprecatedCharacter is the model entity for the DeprecatedCharacter schema.

func (*DeprecatedCharacter) String added in v1.0.5

func (dc *DeprecatedCharacter) String() string

String implements the fmt.Stringer.

func (*DeprecatedCharacter) Unwrap added in v1.0.5

Unwrap unwraps the DeprecatedCharacter 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 (*DeprecatedCharacter) Update added in v1.0.5

Update returns a builder for updating this DeprecatedCharacter. Note that you need to call DeprecatedCharacter.Unwrap() before calling this method if this DeprecatedCharacter was returned from a transaction, and the transaction was committed or rolled back.

type DeprecatedCharacterClient added in v1.0.5

type DeprecatedCharacterClient struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterClient is a client for the DeprecatedCharacter schema.

func NewDeprecatedCharacterClient added in v1.0.5

func NewDeprecatedCharacterClient(c config) *DeprecatedCharacterClient

NewDeprecatedCharacterClient returns a client for the DeprecatedCharacter from the given config.

func (*DeprecatedCharacterClient) Create added in v1.0.5

Create returns a create builder for DeprecatedCharacter.

func (*DeprecatedCharacterClient) CreateBulk added in v1.0.5

CreateBulk returns a builder for creating a bulk of DeprecatedCharacter entities.

func (*DeprecatedCharacterClient) Delete added in v1.0.5

Delete returns a delete builder for DeprecatedCharacter.

func (*DeprecatedCharacterClient) DeleteOne added in v1.0.5

DeleteOne returns a delete builder for the given entity.

func (*DeprecatedCharacterClient) DeleteOneID added in v1.0.5

DeleteOneID returns a delete builder for the given id.

func (*DeprecatedCharacterClient) Get added in v1.0.5

Get returns a DeprecatedCharacter entity by its id.

func (*DeprecatedCharacterClient) GetX added in v1.0.5

GetX is like Get, but panics if an error occurs.

func (*DeprecatedCharacterClient) Hooks added in v1.0.5

func (c *DeprecatedCharacterClient) Hooks() []Hook

Hooks returns the client hooks.

func (*DeprecatedCharacterClient) Query added in v1.0.5

Query returns a query builder for DeprecatedCharacter.

func (*DeprecatedCharacterClient) Update added in v1.0.5

Update returns an update builder for DeprecatedCharacter.

func (*DeprecatedCharacterClient) UpdateOne added in v1.0.5

UpdateOne returns an update builder for the given entity.

func (*DeprecatedCharacterClient) UpdateOneID added in v1.0.5

UpdateOneID returns an update builder for the given id.

func (*DeprecatedCharacterClient) Use added in v1.0.5

func (c *DeprecatedCharacterClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `deprecatedcharacter.Hooks(f(g(h())))`.

type DeprecatedCharacterCreate added in v1.0.5

type DeprecatedCharacterCreate struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterCreate is the builder for creating a DeprecatedCharacter entity.

func (*DeprecatedCharacterCreate) Exec added in v1.0.5

Exec executes the query.

func (*DeprecatedCharacterCreate) ExecX added in v1.0.5

func (dcc *DeprecatedCharacterCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*DeprecatedCharacterCreate) Mutation added in v1.0.5

Mutation returns the DeprecatedCharacterMutation object of the builder.

func (*DeprecatedCharacterCreate) Save added in v1.0.5

Save creates the DeprecatedCharacter in the database.

func (*DeprecatedCharacterCreate) SaveX added in v1.0.5

SaveX calls Save and panics if Save returns an error.

func (*DeprecatedCharacterCreate) SetData added in v1.0.5

SetData sets the "data" field.

func (*DeprecatedCharacterCreate) SetID added in v1.0.5

SetID sets the "id" field.

func (*DeprecatedCharacterCreate) SetNillableID added in v1.0.5

SetNillableID sets the "id" field if the given value is not nil.

func (*DeprecatedCharacterCreate) SetNillableSize added in v1.0.5

func (dcc *DeprecatedCharacterCreate) SetNillableSize(i *int) *DeprecatedCharacterCreate

SetNillableSize sets the "size" field if the given value is not nil.

func (*DeprecatedCharacterCreate) SetNillableSlot added in v1.0.5

func (dcc *DeprecatedCharacterCreate) SetNillableSlot(i *int) *DeprecatedCharacterCreate

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*DeprecatedCharacterCreate) SetSize added in v1.0.5

SetSize sets the "size" field.

func (*DeprecatedCharacterCreate) SetSlot added in v1.0.5

SetSlot sets the "slot" field.

func (*DeprecatedCharacterCreate) SetSteamid added in v1.0.5

SetSteamid sets the "steamid" field.

type DeprecatedCharacterCreateBulk added in v1.0.5

type DeprecatedCharacterCreateBulk struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterCreateBulk is the builder for creating many DeprecatedCharacter entities in bulk.

func (*DeprecatedCharacterCreateBulk) Exec added in v1.0.5

Exec executes the query.

func (*DeprecatedCharacterCreateBulk) ExecX added in v1.0.5

ExecX is like Exec, but panics if an error occurs.

func (*DeprecatedCharacterCreateBulk) Save added in v1.0.5

Save creates the DeprecatedCharacter entities in the database.

func (*DeprecatedCharacterCreateBulk) SaveX added in v1.0.5

SaveX is like Save, but panics if an error occurs.

type DeprecatedCharacterDelete added in v1.0.5

type DeprecatedCharacterDelete struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterDelete is the builder for deleting a DeprecatedCharacter entity.

func (*DeprecatedCharacterDelete) Exec added in v1.0.5

Exec executes the deletion query and returns how many vertices were deleted.

func (*DeprecatedCharacterDelete) ExecX added in v1.0.5

func (dcd *DeprecatedCharacterDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*DeprecatedCharacterDelete) Where added in v1.0.5

Where appends a list predicates to the DeprecatedCharacterDelete builder.

type DeprecatedCharacterDeleteOne added in v1.0.5

type DeprecatedCharacterDeleteOne struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterDeleteOne is the builder for deleting a single DeprecatedCharacter entity.

func (*DeprecatedCharacterDeleteOne) Exec added in v1.0.5

Exec executes the deletion query.

func (*DeprecatedCharacterDeleteOne) ExecX added in v1.0.5

func (dcdo *DeprecatedCharacterDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type DeprecatedCharacterGroupBy added in v1.0.5

type DeprecatedCharacterGroupBy struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterGroupBy is the group-by builder for DeprecatedCharacter entities.

func (*DeprecatedCharacterGroupBy) Aggregate added in v1.0.5

Aggregate adds the given aggregation functions to the group-by query.

func (*DeprecatedCharacterGroupBy) Bool added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) BoolX added in v1.0.5

BoolX is like Bool, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Bools added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) BoolsX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Float64 added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) Float64X added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Float64s added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) Float64sX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Int added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) IntX added in v1.0.5

IntX is like Int, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Ints added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) IntsX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Scan added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*DeprecatedCharacterGroupBy) ScanX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) String added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) 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 (*DeprecatedCharacterGroupBy) StringX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*DeprecatedCharacterGroupBy) Strings added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*DeprecatedCharacterGroupBy) StringsX added in v1.0.5

func (dcgb *DeprecatedCharacterGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type DeprecatedCharacterMutation added in v1.0.5

type DeprecatedCharacterMutation struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterMutation represents an operation that mutates the DeprecatedCharacter nodes in the graph.

func (*DeprecatedCharacterMutation) AddField added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) AddSize added in v1.0.5

func (m *DeprecatedCharacterMutation) AddSize(i int)

AddSize adds i to the "size" field.

func (*DeprecatedCharacterMutation) AddSlot added in v1.0.5

func (m *DeprecatedCharacterMutation) AddSlot(i int)

AddSlot adds i to the "slot" field.

func (*DeprecatedCharacterMutation) AddedEdges added in v1.0.5

func (m *DeprecatedCharacterMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*DeprecatedCharacterMutation) AddedField added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) AddedFields added in v1.0.5

func (m *DeprecatedCharacterMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*DeprecatedCharacterMutation) AddedIDs added in v1.0.5

func (m *DeprecatedCharacterMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*DeprecatedCharacterMutation) AddedSize added in v1.0.5

func (m *DeprecatedCharacterMutation) AddedSize() (r int, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*DeprecatedCharacterMutation) AddedSlot added in v1.0.5

func (m *DeprecatedCharacterMutation) AddedSlot() (r int, exists bool)

AddedSlot returns the value that was added to the "slot" field in this mutation.

func (*DeprecatedCharacterMutation) ClearEdge added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ClearField added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ClearedEdges added in v1.0.5

func (m *DeprecatedCharacterMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*DeprecatedCharacterMutation) ClearedFields added in v1.0.5

func (m *DeprecatedCharacterMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (DeprecatedCharacterMutation) Client added in v1.0.5

func (m DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) Data added in v1.0.5

func (m *DeprecatedCharacterMutation) Data() (r string, exists bool)

Data returns the value of the "data" field in the mutation.

func (*DeprecatedCharacterMutation) EdgeCleared added in v1.0.5

func (m *DeprecatedCharacterMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*DeprecatedCharacterMutation) Field added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) FieldCleared added in v1.0.5

func (m *DeprecatedCharacterMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*DeprecatedCharacterMutation) Fields added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ID added in v1.0.5

func (m *DeprecatedCharacterMutation) ID() (id uuid.UUID, 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 (*DeprecatedCharacterMutation) IDs added in v1.0.5

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 (*DeprecatedCharacterMutation) OldData added in v1.0.5

func (m *DeprecatedCharacterMutation) OldData(ctx context.Context) (v string, err error)

OldData returns the old "data" field's value of the DeprecatedCharacter entity. If the DeprecatedCharacter 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 (*DeprecatedCharacterMutation) OldField added in v1.0.5

func (m *DeprecatedCharacterMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*DeprecatedCharacterMutation) OldSize added in v1.0.5

func (m *DeprecatedCharacterMutation) OldSize(ctx context.Context) (v int, err error)

OldSize returns the old "size" field's value of the DeprecatedCharacter entity. If the DeprecatedCharacter 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 (*DeprecatedCharacterMutation) OldSlot added in v1.0.5

func (m *DeprecatedCharacterMutation) OldSlot(ctx context.Context) (v int, err error)

OldSlot returns the old "slot" field's value of the DeprecatedCharacter entity. If the DeprecatedCharacter 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 (*DeprecatedCharacterMutation) OldSteamid added in v1.0.5

func (m *DeprecatedCharacterMutation) OldSteamid(ctx context.Context) (v string, err error)

OldSteamid returns the old "steamid" field's value of the DeprecatedCharacter entity. If the DeprecatedCharacter 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 (*DeprecatedCharacterMutation) Op added in v1.0.5

Op returns the operation name.

func (*DeprecatedCharacterMutation) RemovedEdges added in v1.0.5

func (m *DeprecatedCharacterMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*DeprecatedCharacterMutation) RemovedIDs added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ResetData added in v1.0.5

func (m *DeprecatedCharacterMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*DeprecatedCharacterMutation) ResetEdge added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ResetField added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) ResetSize added in v1.0.5

func (m *DeprecatedCharacterMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*DeprecatedCharacterMutation) ResetSlot added in v1.0.5

func (m *DeprecatedCharacterMutation) ResetSlot()

ResetSlot resets all changes to the "slot" field.

func (*DeprecatedCharacterMutation) ResetSteamid added in v1.0.5

func (m *DeprecatedCharacterMutation) ResetSteamid()

ResetSteamid resets all changes to the "steamid" field.

func (*DeprecatedCharacterMutation) SetData added in v1.0.5

func (m *DeprecatedCharacterMutation) SetData(s string)

SetData sets the "data" field.

func (*DeprecatedCharacterMutation) SetField added in v1.0.5

func (m *DeprecatedCharacterMutation) 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 (*DeprecatedCharacterMutation) SetID added in v1.0.5

func (m *DeprecatedCharacterMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of DeprecatedCharacter entities.

func (*DeprecatedCharacterMutation) SetSize added in v1.0.5

func (m *DeprecatedCharacterMutation) SetSize(i int)

SetSize sets the "size" field.

func (*DeprecatedCharacterMutation) SetSlot added in v1.0.5

func (m *DeprecatedCharacterMutation) SetSlot(i int)

SetSlot sets the "slot" field.

func (*DeprecatedCharacterMutation) SetSteamid added in v1.0.5

func (m *DeprecatedCharacterMutation) SetSteamid(s string)

SetSteamid sets the "steamid" field.

func (*DeprecatedCharacterMutation) Size added in v1.0.5

func (m *DeprecatedCharacterMutation) Size() (r int, exists bool)

Size returns the value of the "size" field in the mutation.

func (*DeprecatedCharacterMutation) Slot added in v1.0.5

func (m *DeprecatedCharacterMutation) Slot() (r int, exists bool)

Slot returns the value of the "slot" field in the mutation.

func (*DeprecatedCharacterMutation) Steamid added in v1.0.5

func (m *DeprecatedCharacterMutation) Steamid() (r string, exists bool)

Steamid returns the value of the "steamid" field in the mutation.

func (DeprecatedCharacterMutation) Tx added in v1.0.5

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*DeprecatedCharacterMutation) Type added in v1.0.5

Type returns the node type of this mutation (DeprecatedCharacter).

func (*DeprecatedCharacterMutation) Where added in v1.0.5

Where appends a list predicates to the DeprecatedCharacterMutation builder.

type DeprecatedCharacterQuery added in v1.0.5

type DeprecatedCharacterQuery struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterQuery is the builder for querying DeprecatedCharacter entities.

func (*DeprecatedCharacterQuery) All added in v1.0.5

All executes the query and returns a list of DeprecatedCharacters.

func (*DeprecatedCharacterQuery) AllX added in v1.0.5

AllX is like All, but panics if an error occurs.

func (*DeprecatedCharacterQuery) Clone added in v1.0.5

Clone returns a duplicate of the DeprecatedCharacterQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*DeprecatedCharacterQuery) Count added in v1.0.5

func (dcq *DeprecatedCharacterQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DeprecatedCharacterQuery) CountX added in v1.0.5

func (dcq *DeprecatedCharacterQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*DeprecatedCharacterQuery) Exist added in v1.0.5

func (dcq *DeprecatedCharacterQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*DeprecatedCharacterQuery) ExistX added in v1.0.5

func (dcq *DeprecatedCharacterQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*DeprecatedCharacterQuery) First added in v1.0.5

First returns the first DeprecatedCharacter entity from the query. Returns a *NotFoundError when no DeprecatedCharacter was found.

func (*DeprecatedCharacterQuery) FirstID added in v1.0.5

func (dcq *DeprecatedCharacterQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first DeprecatedCharacter ID from the query. Returns a *NotFoundError when no DeprecatedCharacter ID was found.

func (*DeprecatedCharacterQuery) FirstIDX added in v1.0.5

func (dcq *DeprecatedCharacterQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*DeprecatedCharacterQuery) FirstX added in v1.0.5

FirstX is like First, but panics if an error occurs.

func (*DeprecatedCharacterQuery) GroupBy added in v1.0.5

func (dcq *DeprecatedCharacterQuery) GroupBy(field string, fields ...string) *DeprecatedCharacterGroupBy

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 {
	Steamid string `json:"steamid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.DeprecatedCharacter.Query().
	GroupBy(deprecatedcharacter.FieldSteamid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DeprecatedCharacterQuery) IDs added in v1.0.5

IDs executes the query and returns a list of DeprecatedCharacter IDs.

func (*DeprecatedCharacterQuery) IDsX added in v1.0.5

IDsX is like IDs, but panics if an error occurs.

func (*DeprecatedCharacterQuery) Limit added in v1.0.5

Limit adds a limit step to the query.

func (*DeprecatedCharacterQuery) Offset added in v1.0.5

Offset adds an offset step to the query.

func (*DeprecatedCharacterQuery) Only added in v1.0.5

Only returns a single DeprecatedCharacter entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one DeprecatedCharacter entity is found. Returns a *NotFoundError when no DeprecatedCharacter entities are found.

func (*DeprecatedCharacterQuery) OnlyID added in v1.0.5

func (dcq *DeprecatedCharacterQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only DeprecatedCharacter ID in the query. Returns a *NotSingularError when more than one DeprecatedCharacter ID is found. Returns a *NotFoundError when no entities are found.

func (*DeprecatedCharacterQuery) OnlyIDX added in v1.0.5

func (dcq *DeprecatedCharacterQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*DeprecatedCharacterQuery) OnlyX added in v1.0.5

OnlyX is like Only, but panics if an error occurs.

func (*DeprecatedCharacterQuery) Order added in v1.0.5

Order adds an order step to the query.

func (*DeprecatedCharacterQuery) Select added in v1.0.5

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 {
	Steamid string `json:"steamid,omitempty"`
}

client.DeprecatedCharacter.Query().
	Select(deprecatedcharacter.FieldSteamid).
	Scan(ctx, &v)

func (*DeprecatedCharacterQuery) Unique added in v1.0.5

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 (*DeprecatedCharacterQuery) Where added in v1.0.5

Where adds a new predicate for the DeprecatedCharacterQuery builder.

type DeprecatedCharacterSelect added in v1.0.5

type DeprecatedCharacterSelect struct {
	*DeprecatedCharacterQuery
	// contains filtered or unexported fields
}

DeprecatedCharacterSelect is the builder for selecting fields of DeprecatedCharacter entities.

func (*DeprecatedCharacterSelect) Bool added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) BoolX added in v1.0.5

BoolX is like Bool, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Bools added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) BoolsX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Float64 added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) Float64X added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Float64s added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) Float64sX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Int added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) IntX added in v1.0.5

IntX is like Int, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Ints added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) IntsX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Scan added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*DeprecatedCharacterSelect) ScanX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*DeprecatedCharacterSelect) String added in v1.0.5

func (dcs *DeprecatedCharacterSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) StringX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*DeprecatedCharacterSelect) Strings added in v1.0.5

func (dcs *DeprecatedCharacterSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*DeprecatedCharacterSelect) StringsX added in v1.0.5

func (dcs *DeprecatedCharacterSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type DeprecatedCharacterUpdate added in v1.0.5

type DeprecatedCharacterUpdate struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterUpdate is the builder for updating DeprecatedCharacter entities.

func (*DeprecatedCharacterUpdate) AddSize added in v1.0.5

AddSize adds i to the "size" field.

func (*DeprecatedCharacterUpdate) AddSlot added in v1.0.5

AddSlot adds i to the "slot" field.

func (*DeprecatedCharacterUpdate) Exec added in v1.0.5

Exec executes the query.

func (*DeprecatedCharacterUpdate) ExecX added in v1.0.5

func (dcu *DeprecatedCharacterUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*DeprecatedCharacterUpdate) Mutation added in v1.0.5

Mutation returns the DeprecatedCharacterMutation object of the builder.

func (*DeprecatedCharacterUpdate) Save added in v1.0.5

Save executes the query and returns the number of nodes affected by the update operation.

func (*DeprecatedCharacterUpdate) SaveX added in v1.0.5

func (dcu *DeprecatedCharacterUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*DeprecatedCharacterUpdate) SetData added in v1.0.5

SetData sets the "data" field.

func (*DeprecatedCharacterUpdate) SetNillableSize added in v1.0.5

func (dcu *DeprecatedCharacterUpdate) SetNillableSize(i *int) *DeprecatedCharacterUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*DeprecatedCharacterUpdate) SetNillableSlot added in v1.0.5

func (dcu *DeprecatedCharacterUpdate) SetNillableSlot(i *int) *DeprecatedCharacterUpdate

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*DeprecatedCharacterUpdate) SetSize added in v1.0.5

SetSize sets the "size" field.

func (*DeprecatedCharacterUpdate) SetSlot added in v1.0.5

SetSlot sets the "slot" field.

func (*DeprecatedCharacterUpdate) SetSteamid added in v1.0.5

SetSteamid sets the "steamid" field.

func (*DeprecatedCharacterUpdate) Where added in v1.0.5

Where appends a list predicates to the DeprecatedCharacterUpdate builder.

type DeprecatedCharacterUpdateOne added in v1.0.5

type DeprecatedCharacterUpdateOne struct {
	// contains filtered or unexported fields
}

DeprecatedCharacterUpdateOne is the builder for updating a single DeprecatedCharacter entity.

func (*DeprecatedCharacterUpdateOne) AddSize added in v1.0.5

AddSize adds i to the "size" field.

func (*DeprecatedCharacterUpdateOne) AddSlot added in v1.0.5

AddSlot adds i to the "slot" field.

func (*DeprecatedCharacterUpdateOne) Exec added in v1.0.5

Exec executes the query on the entity.

func (*DeprecatedCharacterUpdateOne) ExecX added in v1.0.5

func (dcuo *DeprecatedCharacterUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*DeprecatedCharacterUpdateOne) Mutation added in v1.0.5

Mutation returns the DeprecatedCharacterMutation object of the builder.

func (*DeprecatedCharacterUpdateOne) Save added in v1.0.5

Save executes the query and returns the updated DeprecatedCharacter entity.

func (*DeprecatedCharacterUpdateOne) SaveX added in v1.0.5

SaveX is like Save, but panics if an error occurs.

func (*DeprecatedCharacterUpdateOne) Select added in v1.0.5

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*DeprecatedCharacterUpdateOne) SetData added in v1.0.5

SetData sets the "data" field.

func (*DeprecatedCharacterUpdateOne) SetNillableSize added in v1.0.5

SetNillableSize sets the "size" field if the given value is not nil.

func (*DeprecatedCharacterUpdateOne) SetNillableSlot added in v1.0.5

SetNillableSlot sets the "slot" field if the given value is not nil.

func (*DeprecatedCharacterUpdateOne) SetSize added in v1.0.5

SetSize sets the "size" field.

func (*DeprecatedCharacterUpdateOne) SetSlot added in v1.0.5

SetSlot sets the "slot" field.

func (*DeprecatedCharacterUpdateOne) SetSteamid added in v1.0.5

SetSteamid sets the "steamid" field.

type DeprecatedCharacters added in v1.0.5

type DeprecatedCharacters []*DeprecatedCharacter

DeprecatedCharacters is a parsable slice of DeprecatedCharacter.

type Hook

type Hook = ent.Hook

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 Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

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 Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Player added in v1.0.5

type Player struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Steamid holds the value of the "steamid" field.
	Steamid string `json:"steamid,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PlayerQuery when eager-loading is set.
	Edges PlayerEdges `json:"edges"`
	// contains filtered or unexported fields
}

Player is the model entity for the Player schema.

func (*Player) QueryCharacters added in v1.0.5

func (pl *Player) QueryCharacters() *CharacterQuery

QueryCharacters queries the "characters" edge of the Player entity.

func (*Player) String added in v1.0.5

func (pl *Player) String() string

String implements the fmt.Stringer.

func (*Player) Unwrap added in v1.0.5

func (pl *Player) Unwrap() *Player

Unwrap unwraps the Player 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 (*Player) Update added in v1.0.5

func (pl *Player) Update() *PlayerUpdateOne

Update returns a builder for updating this Player. Note that you need to call Player.Unwrap() before calling this method if this Player was returned from a transaction, and the transaction was committed or rolled back.

type PlayerClient added in v1.0.5

type PlayerClient struct {
	// contains filtered or unexported fields
}

PlayerClient is a client for the Player schema.

func NewPlayerClient added in v1.0.5

func NewPlayerClient(c config) *PlayerClient

NewPlayerClient returns a client for the Player from the given config.

func (*PlayerClient) Create added in v1.0.5

func (c *PlayerClient) Create() *PlayerCreate

Create returns a create builder for Player.

func (*PlayerClient) CreateBulk added in v1.0.5

func (c *PlayerClient) CreateBulk(builders ...*PlayerCreate) *PlayerCreateBulk

CreateBulk returns a builder for creating a bulk of Player entities.

func (*PlayerClient) Delete added in v1.0.5

func (c *PlayerClient) Delete() *PlayerDelete

Delete returns a delete builder for Player.

func (*PlayerClient) DeleteOne added in v1.0.5

func (c *PlayerClient) DeleteOne(pl *Player) *PlayerDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PlayerClient) DeleteOneID added in v1.0.5

func (c *PlayerClient) DeleteOneID(id uuid.UUID) *PlayerDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PlayerClient) Get added in v1.0.5

func (c *PlayerClient) Get(ctx context.Context, id uuid.UUID) (*Player, error)

Get returns a Player entity by its id.

func (*PlayerClient) GetX added in v1.0.5

func (c *PlayerClient) GetX(ctx context.Context, id uuid.UUID) *Player

GetX is like Get, but panics if an error occurs.

func (*PlayerClient) Hooks added in v1.0.5

func (c *PlayerClient) Hooks() []Hook

Hooks returns the client hooks.

func (*PlayerClient) Query added in v1.0.5

func (c *PlayerClient) Query() *PlayerQuery

Query returns a query builder for Player.

func (*PlayerClient) QueryCharacters added in v1.0.5

func (c *PlayerClient) QueryCharacters(pl *Player) *CharacterQuery

QueryCharacters queries the characters edge of a Player.

func (*PlayerClient) Update added in v1.0.5

func (c *PlayerClient) Update() *PlayerUpdate

Update returns an update builder for Player.

func (*PlayerClient) UpdateOne added in v1.0.5

func (c *PlayerClient) UpdateOne(pl *Player) *PlayerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PlayerClient) UpdateOneID added in v1.0.5

func (c *PlayerClient) UpdateOneID(id uuid.UUID) *PlayerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PlayerClient) Use added in v1.0.5

func (c *PlayerClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `player.Hooks(f(g(h())))`.

type PlayerCreate added in v1.0.5

type PlayerCreate struct {
	// contains filtered or unexported fields
}

PlayerCreate is the builder for creating a Player entity.

func (*PlayerCreate) AddCharacterIDs added in v1.0.5

func (pc *PlayerCreate) AddCharacterIDs(ids ...uuid.UUID) *PlayerCreate

AddCharacterIDs adds the "characters" edge to the Character entity by IDs.

func (*PlayerCreate) AddCharacters added in v1.0.5

func (pc *PlayerCreate) AddCharacters(c ...*Character) *PlayerCreate

AddCharacters adds the "characters" edges to the Character entity.

func (*PlayerCreate) Exec added in v1.0.5

func (pc *PlayerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayerCreate) ExecX added in v1.0.5

func (pc *PlayerCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlayerCreate) Mutation added in v1.0.5

func (pc *PlayerCreate) Mutation() *PlayerMutation

Mutation returns the PlayerMutation object of the builder.

func (*PlayerCreate) Save added in v1.0.5

func (pc *PlayerCreate) Save(ctx context.Context) (*Player, error)

Save creates the Player in the database.

func (*PlayerCreate) SaveX added in v1.0.5

func (pc *PlayerCreate) SaveX(ctx context.Context) *Player

SaveX calls Save and panics if Save returns an error.

func (*PlayerCreate) SetCreatedAt added in v1.0.5

func (pc *PlayerCreate) SetCreatedAt(t time.Time) *PlayerCreate

SetCreatedAt sets the "created_at" field.

func (*PlayerCreate) SetID added in v1.0.5

func (pc *PlayerCreate) SetID(u uuid.UUID) *PlayerCreate

SetID sets the "id" field.

func (*PlayerCreate) SetNillableCreatedAt added in v1.0.5

func (pc *PlayerCreate) SetNillableCreatedAt(t *time.Time) *PlayerCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*PlayerCreate) SetNillableID added in v1.0.5

func (pc *PlayerCreate) SetNillableID(u *uuid.UUID) *PlayerCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*PlayerCreate) SetNillableUpdatedAt added in v1.0.5

func (pc *PlayerCreate) SetNillableUpdatedAt(t *time.Time) *PlayerCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*PlayerCreate) SetSteamid added in v1.0.5

func (pc *PlayerCreate) SetSteamid(s string) *PlayerCreate

SetSteamid sets the "steamid" field.

func (*PlayerCreate) SetUpdatedAt added in v1.0.5

func (pc *PlayerCreate) SetUpdatedAt(t time.Time) *PlayerCreate

SetUpdatedAt sets the "updated_at" field.

type PlayerCreateBulk added in v1.0.5

type PlayerCreateBulk struct {
	// contains filtered or unexported fields
}

PlayerCreateBulk is the builder for creating many Player entities in bulk.

func (*PlayerCreateBulk) Exec added in v1.0.5

func (pcb *PlayerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayerCreateBulk) ExecX added in v1.0.5

func (pcb *PlayerCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlayerCreateBulk) Save added in v1.0.5

func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error)

Save creates the Player entities in the database.

func (*PlayerCreateBulk) SaveX added in v1.0.5

func (pcb *PlayerCreateBulk) SaveX(ctx context.Context) []*Player

SaveX is like Save, but panics if an error occurs.

type PlayerDelete added in v1.0.5

type PlayerDelete struct {
	// contains filtered or unexported fields
}

PlayerDelete is the builder for deleting a Player entity.

func (*PlayerDelete) Exec added in v1.0.5

func (pd *PlayerDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*PlayerDelete) ExecX added in v1.0.5

func (pd *PlayerDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*PlayerDelete) Where added in v1.0.5

func (pd *PlayerDelete) Where(ps ...predicate.Player) *PlayerDelete

Where appends a list predicates to the PlayerDelete builder.

type PlayerDeleteOne added in v1.0.5

type PlayerDeleteOne struct {
	// contains filtered or unexported fields
}

PlayerDeleteOne is the builder for deleting a single Player entity.

func (*PlayerDeleteOne) Exec added in v1.0.5

func (pdo *PlayerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PlayerDeleteOne) ExecX added in v1.0.5

func (pdo *PlayerDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type PlayerEdges added in v1.0.5

type PlayerEdges struct {
	// Characters holds the value of the characters edge.
	Characters []*Character `json:"characters,omitempty"`
	// contains filtered or unexported fields
}

PlayerEdges holds the relations/edges for other nodes in the graph.

func (PlayerEdges) CharactersOrErr added in v1.0.5

func (e PlayerEdges) CharactersOrErr() ([]*Character, error)

CharactersOrErr returns the Characters value or an error if the edge was not loaded in eager-loading.

type PlayerGroupBy added in v1.0.5

type PlayerGroupBy struct {
	// contains filtered or unexported fields
}

PlayerGroupBy is the group-by builder for Player entities.

func (*PlayerGroupBy) Aggregate added in v1.0.5

func (pgb *PlayerGroupBy) Aggregate(fns ...AggregateFunc) *PlayerGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*PlayerGroupBy) Bool added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) BoolX added in v1.0.5

func (pgb *PlayerGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PlayerGroupBy) Bools added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) BoolsX added in v1.0.5

func (pgb *PlayerGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PlayerGroupBy) Float64 added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) Float64X added in v1.0.5

func (pgb *PlayerGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PlayerGroupBy) Float64s added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) Float64sX added in v1.0.5

func (pgb *PlayerGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PlayerGroupBy) Int added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) IntX added in v1.0.5

func (pgb *PlayerGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PlayerGroupBy) Ints added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) IntsX added in v1.0.5

func (pgb *PlayerGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PlayerGroupBy) Scan added in v1.0.5

func (pgb *PlayerGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*PlayerGroupBy) ScanX added in v1.0.5

func (pgb *PlayerGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PlayerGroupBy) String added in v1.0.5

func (pgb *PlayerGroupBy) 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 (*PlayerGroupBy) StringX added in v1.0.5

func (pgb *PlayerGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PlayerGroupBy) Strings added in v1.0.5

func (pgb *PlayerGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PlayerGroupBy) StringsX added in v1.0.5

func (pgb *PlayerGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PlayerMutation added in v1.0.5

type PlayerMutation struct {
	// contains filtered or unexported fields
}

PlayerMutation represents an operation that mutates the Player nodes in the graph.

func (*PlayerMutation) AddCharacterIDs added in v1.0.5

func (m *PlayerMutation) AddCharacterIDs(ids ...uuid.UUID)

AddCharacterIDs adds the "characters" edge to the Character entity by ids.

func (*PlayerMutation) AddField added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) AddedEdges added in v1.0.5

func (m *PlayerMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*PlayerMutation) AddedField added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) AddedFields added in v1.0.5

func (m *PlayerMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*PlayerMutation) AddedIDs added in v1.0.5

func (m *PlayerMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*PlayerMutation) CharactersCleared added in v1.0.5

func (m *PlayerMutation) CharactersCleared() bool

CharactersCleared reports if the "characters" edge to the Character entity was cleared.

func (*PlayerMutation) CharactersIDs added in v1.0.5

func (m *PlayerMutation) CharactersIDs() (ids []uuid.UUID)

CharactersIDs returns the "characters" edge IDs in the mutation.

func (*PlayerMutation) ClearCharacters added in v1.0.5

func (m *PlayerMutation) ClearCharacters()

ClearCharacters clears the "characters" edge to the Character entity.

func (*PlayerMutation) ClearEdge added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ClearField added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ClearedEdges added in v1.0.5

func (m *PlayerMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*PlayerMutation) ClearedFields added in v1.0.5

func (m *PlayerMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (PlayerMutation) Client added in v1.0.5

func (m PlayerMutation) 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 (*PlayerMutation) CreatedAt added in v1.0.5

func (m *PlayerMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*PlayerMutation) EdgeCleared added in v1.0.5

func (m *PlayerMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*PlayerMutation) Field added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) FieldCleared added in v1.0.5

func (m *PlayerMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*PlayerMutation) Fields added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ID added in v1.0.5

func (m *PlayerMutation) ID() (id uuid.UUID, 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 (*PlayerMutation) IDs added in v1.0.5

func (m *PlayerMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*PlayerMutation) OldCreatedAt added in v1.0.5

func (m *PlayerMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Player entity. If the Player 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 (*PlayerMutation) OldField added in v1.0.5

func (m *PlayerMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*PlayerMutation) OldSteamid added in v1.0.5

func (m *PlayerMutation) OldSteamid(ctx context.Context) (v string, err error)

OldSteamid returns the old "steamid" field's value of the Player entity. If the Player 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 (*PlayerMutation) OldUpdatedAt added in v1.0.5

func (m *PlayerMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Player entity. If the Player 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 (*PlayerMutation) Op added in v1.0.5

func (m *PlayerMutation) Op() Op

Op returns the operation name.

func (*PlayerMutation) RemoveCharacterIDs added in v1.0.5

func (m *PlayerMutation) RemoveCharacterIDs(ids ...uuid.UUID)

RemoveCharacterIDs removes the "characters" edge to the Character entity by IDs.

func (*PlayerMutation) RemovedCharactersIDs added in v1.0.5

func (m *PlayerMutation) RemovedCharactersIDs() (ids []uuid.UUID)

RemovedCharacters returns the removed IDs of the "characters" edge to the Character entity.

func (*PlayerMutation) RemovedEdges added in v1.0.5

func (m *PlayerMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*PlayerMutation) RemovedIDs added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ResetCharacters added in v1.0.5

func (m *PlayerMutation) ResetCharacters()

ResetCharacters resets all changes to the "characters" edge.

func (*PlayerMutation) ResetCreatedAt added in v1.0.5

func (m *PlayerMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PlayerMutation) ResetEdge added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ResetField added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) ResetSteamid added in v1.0.5

func (m *PlayerMutation) ResetSteamid()

ResetSteamid resets all changes to the "steamid" field.

func (*PlayerMutation) ResetUpdatedAt added in v1.0.5

func (m *PlayerMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PlayerMutation) SetCreatedAt added in v1.0.5

func (m *PlayerMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*PlayerMutation) SetField added in v1.0.5

func (m *PlayerMutation) 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 (*PlayerMutation) SetID added in v1.0.5

func (m *PlayerMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Player entities.

func (*PlayerMutation) SetSteamid added in v1.0.5

func (m *PlayerMutation) SetSteamid(s string)

SetSteamid sets the "steamid" field.

func (*PlayerMutation) SetUpdatedAt added in v1.0.5

func (m *PlayerMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*PlayerMutation) Steamid added in v1.0.5

func (m *PlayerMutation) Steamid() (r string, exists bool)

Steamid returns the value of the "steamid" field in the mutation.

func (PlayerMutation) Tx added in v1.0.5

func (m PlayerMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*PlayerMutation) Type added in v1.0.5

func (m *PlayerMutation) Type() string

Type returns the node type of this mutation (Player).

func (*PlayerMutation) UpdatedAt added in v1.0.5

func (m *PlayerMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*PlayerMutation) Where added in v1.0.5

func (m *PlayerMutation) Where(ps ...predicate.Player)

Where appends a list predicates to the PlayerMutation builder.

type PlayerQuery added in v1.0.5

type PlayerQuery struct {
	// contains filtered or unexported fields
}

PlayerQuery is the builder for querying Player entities.

func (*PlayerQuery) All added in v1.0.5

func (pq *PlayerQuery) All(ctx context.Context) ([]*Player, error)

All executes the query and returns a list of Players.

func (*PlayerQuery) AllX added in v1.0.5

func (pq *PlayerQuery) AllX(ctx context.Context) []*Player

AllX is like All, but panics if an error occurs.

func (*PlayerQuery) Clone added in v1.0.5

func (pq *PlayerQuery) Clone() *PlayerQuery

Clone returns a duplicate of the PlayerQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PlayerQuery) Count added in v1.0.5

func (pq *PlayerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PlayerQuery) CountX added in v1.0.5

func (pq *PlayerQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PlayerQuery) Exist added in v1.0.5

func (pq *PlayerQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PlayerQuery) ExistX added in v1.0.5

func (pq *PlayerQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PlayerQuery) First added in v1.0.5

func (pq *PlayerQuery) First(ctx context.Context) (*Player, error)

First returns the first Player entity from the query. Returns a *NotFoundError when no Player was found.

func (*PlayerQuery) FirstID added in v1.0.5

func (pq *PlayerQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Player ID from the query. Returns a *NotFoundError when no Player ID was found.

func (*PlayerQuery) FirstIDX added in v1.0.5

func (pq *PlayerQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*PlayerQuery) FirstX added in v1.0.5

func (pq *PlayerQuery) FirstX(ctx context.Context) *Player

FirstX is like First, but panics if an error occurs.

func (*PlayerQuery) GroupBy added in v1.0.5

func (pq *PlayerQuery) GroupBy(field string, fields ...string) *PlayerGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Player.Query().
	GroupBy(player.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PlayerQuery) IDs added in v1.0.5

func (pq *PlayerQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Player IDs.

func (*PlayerQuery) IDsX added in v1.0.5

func (pq *PlayerQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*PlayerQuery) Limit added in v1.0.5

func (pq *PlayerQuery) Limit(limit int) *PlayerQuery

Limit adds a limit step to the query.

func (*PlayerQuery) Offset added in v1.0.5

func (pq *PlayerQuery) Offset(offset int) *PlayerQuery

Offset adds an offset step to the query.

func (*PlayerQuery) Only added in v1.0.5

func (pq *PlayerQuery) Only(ctx context.Context) (*Player, error)

Only returns a single Player entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Player entity is found. Returns a *NotFoundError when no Player entities are found.

func (*PlayerQuery) OnlyID added in v1.0.5

func (pq *PlayerQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Player ID in the query. Returns a *NotSingularError when more than one Player ID is found. Returns a *NotFoundError when no entities are found.

func (*PlayerQuery) OnlyIDX added in v1.0.5

func (pq *PlayerQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PlayerQuery) OnlyX added in v1.0.5

func (pq *PlayerQuery) OnlyX(ctx context.Context) *Player

OnlyX is like Only, but panics if an error occurs.

func (*PlayerQuery) Order added in v1.0.5

func (pq *PlayerQuery) Order(o ...OrderFunc) *PlayerQuery

Order adds an order step to the query.

func (*PlayerQuery) QueryCharacters added in v1.0.5

func (pq *PlayerQuery) QueryCharacters() *CharacterQuery

QueryCharacters chains the current query on the "characters" edge.

func (*PlayerQuery) Select added in v1.0.5

func (pq *PlayerQuery) Select(fields ...string) *PlayerSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Player.Query().
	Select(player.FieldCreatedAt).
	Scan(ctx, &v)

func (*PlayerQuery) Unique added in v1.0.5

func (pq *PlayerQuery) Unique(unique bool) *PlayerQuery

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 (*PlayerQuery) Where added in v1.0.5

func (pq *PlayerQuery) Where(ps ...predicate.Player) *PlayerQuery

Where adds a new predicate for the PlayerQuery builder.

func (*PlayerQuery) WithCharacters added in v1.0.5

func (pq *PlayerQuery) WithCharacters(opts ...func(*CharacterQuery)) *PlayerQuery

WithCharacters tells the query-builder to eager-load the nodes that are connected to the "characters" edge. The optional arguments are used to configure the query builder of the edge.

type PlayerSelect added in v1.0.5

type PlayerSelect struct {
	*PlayerQuery
	// contains filtered or unexported fields
}

PlayerSelect is the builder for selecting fields of Player entities.

func (*PlayerSelect) Bool added in v1.0.5

func (ps *PlayerSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) BoolX added in v1.0.5

func (ps *PlayerSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PlayerSelect) Bools added in v1.0.5

func (ps *PlayerSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) BoolsX added in v1.0.5

func (ps *PlayerSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PlayerSelect) Float64 added in v1.0.5

func (ps *PlayerSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) Float64X added in v1.0.5

func (ps *PlayerSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PlayerSelect) Float64s added in v1.0.5

func (ps *PlayerSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) Float64sX added in v1.0.5

func (ps *PlayerSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PlayerSelect) Int added in v1.0.5

func (ps *PlayerSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) IntX added in v1.0.5

func (ps *PlayerSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PlayerSelect) Ints added in v1.0.5

func (ps *PlayerSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) IntsX added in v1.0.5

func (ps *PlayerSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PlayerSelect) Scan added in v1.0.5

func (ps *PlayerSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*PlayerSelect) ScanX added in v1.0.5

func (ps *PlayerSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PlayerSelect) String added in v1.0.5

func (ps *PlayerSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) StringX added in v1.0.5

func (ps *PlayerSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PlayerSelect) Strings added in v1.0.5

func (ps *PlayerSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PlayerSelect) StringsX added in v1.0.5

func (ps *PlayerSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PlayerUpdate added in v1.0.5

type PlayerUpdate struct {
	// contains filtered or unexported fields
}

PlayerUpdate is the builder for updating Player entities.

func (*PlayerUpdate) AddCharacterIDs added in v1.0.5

func (pu *PlayerUpdate) AddCharacterIDs(ids ...uuid.UUID) *PlayerUpdate

AddCharacterIDs adds the "characters" edge to the Character entity by IDs.

func (*PlayerUpdate) AddCharacters added in v1.0.5

func (pu *PlayerUpdate) AddCharacters(c ...*Character) *PlayerUpdate

AddCharacters adds the "characters" edges to the Character entity.

func (*PlayerUpdate) ClearCharacters added in v1.0.5

func (pu *PlayerUpdate) ClearCharacters() *PlayerUpdate

ClearCharacters clears all "characters" edges to the Character entity.

func (*PlayerUpdate) Exec added in v1.0.5

func (pu *PlayerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayerUpdate) ExecX added in v1.0.5

func (pu *PlayerUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlayerUpdate) Mutation added in v1.0.5

func (pu *PlayerUpdate) Mutation() *PlayerMutation

Mutation returns the PlayerMutation object of the builder.

func (*PlayerUpdate) RemoveCharacterIDs added in v1.0.5

func (pu *PlayerUpdate) RemoveCharacterIDs(ids ...uuid.UUID) *PlayerUpdate

RemoveCharacterIDs removes the "characters" edge to Character entities by IDs.

func (*PlayerUpdate) RemoveCharacters added in v1.0.5

func (pu *PlayerUpdate) RemoveCharacters(c ...*Character) *PlayerUpdate

RemoveCharacters removes "characters" edges to Character entities.

func (*PlayerUpdate) Save added in v1.0.5

func (pu *PlayerUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*PlayerUpdate) SaveX added in v1.0.5

func (pu *PlayerUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*PlayerUpdate) SetSteamid added in v1.0.5

func (pu *PlayerUpdate) SetSteamid(s string) *PlayerUpdate

SetSteamid sets the "steamid" field.

func (*PlayerUpdate) SetUpdatedAt added in v1.0.5

func (pu *PlayerUpdate) SetUpdatedAt(t time.Time) *PlayerUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PlayerUpdate) Where added in v1.0.5

func (pu *PlayerUpdate) Where(ps ...predicate.Player) *PlayerUpdate

Where appends a list predicates to the PlayerUpdate builder.

type PlayerUpdateOne added in v1.0.5

type PlayerUpdateOne struct {
	// contains filtered or unexported fields
}

PlayerUpdateOne is the builder for updating a single Player entity.

func (*PlayerUpdateOne) AddCharacterIDs added in v1.0.5

func (puo *PlayerUpdateOne) AddCharacterIDs(ids ...uuid.UUID) *PlayerUpdateOne

AddCharacterIDs adds the "characters" edge to the Character entity by IDs.

func (*PlayerUpdateOne) AddCharacters added in v1.0.5

func (puo *PlayerUpdateOne) AddCharacters(c ...*Character) *PlayerUpdateOne

AddCharacters adds the "characters" edges to the Character entity.

func (*PlayerUpdateOne) ClearCharacters added in v1.0.5

func (puo *PlayerUpdateOne) ClearCharacters() *PlayerUpdateOne

ClearCharacters clears all "characters" edges to the Character entity.

func (*PlayerUpdateOne) Exec added in v1.0.5

func (puo *PlayerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PlayerUpdateOne) ExecX added in v1.0.5

func (puo *PlayerUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlayerUpdateOne) Mutation added in v1.0.5

func (puo *PlayerUpdateOne) Mutation() *PlayerMutation

Mutation returns the PlayerMutation object of the builder.

func (*PlayerUpdateOne) RemoveCharacterIDs added in v1.0.5

func (puo *PlayerUpdateOne) RemoveCharacterIDs(ids ...uuid.UUID) *PlayerUpdateOne

RemoveCharacterIDs removes the "characters" edge to Character entities by IDs.

func (*PlayerUpdateOne) RemoveCharacters added in v1.0.5

func (puo *PlayerUpdateOne) RemoveCharacters(c ...*Character) *PlayerUpdateOne

RemoveCharacters removes "characters" edges to Character entities.

func (*PlayerUpdateOne) Save added in v1.0.5

func (puo *PlayerUpdateOne) Save(ctx context.Context) (*Player, error)

Save executes the query and returns the updated Player entity.

func (*PlayerUpdateOne) SaveX added in v1.0.5

func (puo *PlayerUpdateOne) SaveX(ctx context.Context) *Player

SaveX is like Save, but panics if an error occurs.

func (*PlayerUpdateOne) Select added in v1.0.5

func (puo *PlayerUpdateOne) Select(field string, fields ...string) *PlayerUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*PlayerUpdateOne) SetSteamid added in v1.0.5

func (puo *PlayerUpdateOne) SetSteamid(s string) *PlayerUpdateOne

SetSteamid sets the "steamid" field.

func (*PlayerUpdateOne) SetUpdatedAt added in v1.0.5

func (puo *PlayerUpdateOne) SetUpdatedAt(t time.Time) *PlayerUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Players added in v1.0.5

type Players []*Player

Players is a parsable slice of Player.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

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.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

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

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// Character is the client for interacting with the Character builders.
	Character *CharacterClient
	// DeprecatedCharacter is the client for interacting with the DeprecatedCharacter builders.
	DeprecatedCharacter *DeprecatedCharacterClient
	// Player is the client for interacting with the Player builders.
	Player *PlayerClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

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.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL