ent

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 26 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.
	TypeCabinet  = "Cabinet"
	TypeGame     = "Game"
	TypeLocation = "Location"
)

Variables

View Source
var DefaultCabinetOrder = &CabinetOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &CabinetOrderField{
		Value: func(c *Cabinet) (ent.Value, error) {
			return c.ID, nil
		},
		column: cabinet.FieldID,
		toTerm: cabinet.ByID,
		toCursor: func(c *Cabinet) Cursor {
			return Cursor{ID: c.ID}
		},
	},
}

DefaultCabinetOrder is the default ordering of Cabinet.

View Source
var DefaultGameOrder = &GameOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &GameOrderField{
		Value: func(ga *Game) (ent.Value, error) {
			return ga.ID, nil
		},
		column: game.FieldID,
		toTerm: game.ByID,
		toCursor: func(ga *Game) Cursor {
			return Cursor{ID: ga.ID}
		},
	},
}

DefaultGameOrder is the default ordering of Game.

View Source
var DefaultLocationOrder = &LocationOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &LocationOrderField{
		Value: func(l *Location) (ent.Value, error) {
			return l.ID, nil
		},
		column: location.FieldID,
		toTerm: location.ByID,
		toCursor: func(l *Location) Cursor {
			return Cursor{ID: l.ID}
		},
	},
}

DefaultLocationOrder is the default ordering of Location.

View Source
var ErrEmptyCabinetWhereInput = errors.New("ent: empty predicate CabinetWhereInput")

ErrEmptyCabinetWhereInput is returned in case the CabinetWhereInput is empty.

View Source
var ErrEmptyGameWhereInput = errors.New("ent: empty predicate GameWhereInput")

ErrEmptyGameWhereInput is returned in case the GameWhereInput is empty.

View Source
var ErrEmptyLocationWhereInput = errors.New("ent: empty predicate LocationWhereInput")

ErrEmptyLocationWhereInput is returned in case the LocationWhereInput is empty.

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

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 Cabinet

type Cabinet struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Count holds the value of the "count" field.
	Count *int `json:"count,omitempty"`
	// LocationID holds the value of the "location_id" field.
	LocationID string `json:"location_id,omitempty"`
	// GameID holds the value of the "game_id" field.
	GameID string `json:"game_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CabinetQuery when eager-loading is set.
	Edges CabinetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Cabinet is the model entity for the Cabinet schema.

func (*Cabinet) Game

func (c *Cabinet) Game(ctx context.Context) (*Game, error)

func (*Cabinet) IsNode

func (*Cabinet) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Cabinet) Location

func (c *Cabinet) Location(ctx context.Context) (*Location, error)

func (*Cabinet) QueryGame

func (c *Cabinet) QueryGame() *GameQuery

QueryGame queries the "game" edge of the Cabinet entity.

func (*Cabinet) QueryLocation

func (c *Cabinet) QueryLocation() *LocationQuery

QueryLocation queries the "location" edge of the Cabinet entity.

func (*Cabinet) String

func (c *Cabinet) String() string

String implements the fmt.Stringer.

func (*Cabinet) ToEdge

func (c *Cabinet) ToEdge(order *CabinetOrder) *CabinetEdge

ToEdge converts Cabinet into CabinetEdge.

func (*Cabinet) Unwrap

func (c *Cabinet) Unwrap() *Cabinet

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

func (c *Cabinet) Update() *CabinetUpdateOne

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

func (*Cabinet) Value

func (c *Cabinet) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Cabinet. This includes values selected through modifiers, order, etc.

type CabinetClient

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

CabinetClient is a client for the Cabinet schema.

func NewCabinetClient

func NewCabinetClient(c config) *CabinetClient

NewCabinetClient returns a client for the Cabinet from the given config.

func (*CabinetClient) Create

func (c *CabinetClient) Create() *CabinetCreate

Create returns a builder for creating a Cabinet entity.

func (*CabinetClient) CreateBulk

func (c *CabinetClient) CreateBulk(builders ...*CabinetCreate) *CabinetCreateBulk

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

func (*CabinetClient) Delete

func (c *CabinetClient) Delete() *CabinetDelete

Delete returns a delete builder for Cabinet.

func (*CabinetClient) DeleteOne

func (c *CabinetClient) DeleteOne(ca *Cabinet) *CabinetDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CabinetClient) DeleteOneID

func (c *CabinetClient) DeleteOneID(id string) *CabinetDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*CabinetClient) Get

func (c *CabinetClient) Get(ctx context.Context, id string) (*Cabinet, error)

Get returns a Cabinet entity by its id.

func (*CabinetClient) GetX

func (c *CabinetClient) GetX(ctx context.Context, id string) *Cabinet

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

func (*CabinetClient) Hooks

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

Hooks returns the client hooks.

func (*CabinetClient) Intercept

func (c *CabinetClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `cabinet.Intercept(f(g(h())))`.

func (*CabinetClient) Interceptors

func (c *CabinetClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*CabinetClient) MapCreateBulk

func (c *CabinetClient) MapCreateBulk(slice any, setFunc func(*CabinetCreate, int)) *CabinetCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*CabinetClient) Query

func (c *CabinetClient) Query() *CabinetQuery

Query returns a query builder for Cabinet.

func (*CabinetClient) QueryGame

func (c *CabinetClient) QueryGame(ca *Cabinet) *GameQuery

QueryGame queries the game edge of a Cabinet.

func (*CabinetClient) QueryLocation

func (c *CabinetClient) QueryLocation(ca *Cabinet) *LocationQuery

QueryLocation queries the location edge of a Cabinet.

func (*CabinetClient) Update

func (c *CabinetClient) Update() *CabinetUpdate

Update returns an update builder for Cabinet.

func (*CabinetClient) UpdateOne

func (c *CabinetClient) UpdateOne(ca *Cabinet) *CabinetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CabinetClient) UpdateOneID

func (c *CabinetClient) UpdateOneID(id string) *CabinetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CabinetClient) Use

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

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

type CabinetConnection

type CabinetConnection struct {
	Edges      []*CabinetEdge `json:"edges"`
	PageInfo   PageInfo       `json:"pageInfo"`
	TotalCount int            `json:"totalCount"`
}

CabinetConnection is the connection containing edges to Cabinet.

type CabinetCreate

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

CabinetCreate is the builder for creating a Cabinet entity.

func (*CabinetCreate) Exec

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

Exec executes the query.

func (*CabinetCreate) ExecX

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

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

func (*CabinetCreate) Mutation

func (cc *CabinetCreate) Mutation() *CabinetMutation

Mutation returns the CabinetMutation object of the builder.

func (*CabinetCreate) Save

func (cc *CabinetCreate) Save(ctx context.Context) (*Cabinet, error)

Save creates the Cabinet in the database.

func (*CabinetCreate) SaveX

func (cc *CabinetCreate) SaveX(ctx context.Context) *Cabinet

SaveX calls Save and panics if Save returns an error.

func (*CabinetCreate) SetCount

func (cc *CabinetCreate) SetCount(i int) *CabinetCreate

SetCount sets the "count" field.

func (*CabinetCreate) SetGame

func (cc *CabinetCreate) SetGame(g *Game) *CabinetCreate

SetGame sets the "game" edge to the Game entity.

func (*CabinetCreate) SetGameID

func (cc *CabinetCreate) SetGameID(s string) *CabinetCreate

SetGameID sets the "game_id" field.

func (*CabinetCreate) SetID

func (cc *CabinetCreate) SetID(s string) *CabinetCreate

SetID sets the "id" field.

func (*CabinetCreate) SetLocation

func (cc *CabinetCreate) SetLocation(l *Location) *CabinetCreate

SetLocation sets the "location" edge to the Location entity.

func (*CabinetCreate) SetLocationID

func (cc *CabinetCreate) SetLocationID(s string) *CabinetCreate

SetLocationID sets the "location_id" field.

func (*CabinetCreate) SetNillableCount

func (cc *CabinetCreate) SetNillableCount(i *int) *CabinetCreate

SetNillableCount sets the "count" field if the given value is not nil.

func (*CabinetCreate) SetNillableID

func (cc *CabinetCreate) SetNillableID(s *string) *CabinetCreate

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

type CabinetCreateBulk

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

CabinetCreateBulk is the builder for creating many Cabinet entities in bulk.

func (*CabinetCreateBulk) Exec

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

Exec executes the query.

func (*CabinetCreateBulk) ExecX

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

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

func (*CabinetCreateBulk) Save

func (ccb *CabinetCreateBulk) Save(ctx context.Context) ([]*Cabinet, error)

Save creates the Cabinet entities in the database.

func (*CabinetCreateBulk) SaveX

func (ccb *CabinetCreateBulk) SaveX(ctx context.Context) []*Cabinet

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

type CabinetDelete

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

CabinetDelete is the builder for deleting a Cabinet entity.

func (*CabinetDelete) Exec

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

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

func (*CabinetDelete) ExecX

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

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

func (*CabinetDelete) Where

func (cd *CabinetDelete) Where(ps ...predicate.Cabinet) *CabinetDelete

Where appends a list predicates to the CabinetDelete builder.

type CabinetDeleteOne

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

CabinetDeleteOne is the builder for deleting a single Cabinet entity.

func (*CabinetDeleteOne) Exec

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

Exec executes the deletion query.

func (*CabinetDeleteOne) ExecX

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

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

func (*CabinetDeleteOne) Where

Where appends a list predicates to the CabinetDelete builder.

type CabinetEdge

type CabinetEdge struct {
	Node   *Cabinet `json:"node"`
	Cursor Cursor   `json:"cursor"`
}

CabinetEdge is the edge representation of Cabinet.

type CabinetEdges

type CabinetEdges struct {
	// Location holds the value of the location edge.
	Location *Location `json:"location,omitempty"`
	// Game holds the value of the game edge.
	Game *Game `json:"game,omitempty"`
	// contains filtered or unexported fields
}

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

func (CabinetEdges) GameOrErr

func (e CabinetEdges) GameOrErr() (*Game, error)

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

func (CabinetEdges) LocationOrErr

func (e CabinetEdges) LocationOrErr() (*Location, error)

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

type CabinetGroupBy

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

CabinetGroupBy is the group-by builder for Cabinet entities.

func (*CabinetGroupBy) Aggregate

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

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

func (*CabinetGroupBy) Bool

func (s *CabinetGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*CabinetGroupBy) BoolX

func (s *CabinetGroupBy) BoolX(ctx context.Context) bool

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

func (*CabinetGroupBy) Bools

func (s *CabinetGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*CabinetGroupBy) BoolsX

func (s *CabinetGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CabinetGroupBy) Float64

func (s *CabinetGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*CabinetGroupBy) Float64X

func (s *CabinetGroupBy) Float64X(ctx context.Context) float64

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

func (*CabinetGroupBy) Float64s

func (s *CabinetGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*CabinetGroupBy) Float64sX

func (s *CabinetGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CabinetGroupBy) Int

func (s *CabinetGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*CabinetGroupBy) IntX

func (s *CabinetGroupBy) IntX(ctx context.Context) int

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

func (*CabinetGroupBy) Ints

func (s *CabinetGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*CabinetGroupBy) IntsX

func (s *CabinetGroupBy) IntsX(ctx context.Context) []int

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

func (*CabinetGroupBy) Scan

func (cgb *CabinetGroupBy) Scan(ctx context.Context, v any) error

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

func (*CabinetGroupBy) ScanX

func (s *CabinetGroupBy) ScanX(ctx context.Context, v any)

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

func (*CabinetGroupBy) String

func (s *CabinetGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*CabinetGroupBy) StringX

func (s *CabinetGroupBy) StringX(ctx context.Context) string

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

func (*CabinetGroupBy) Strings

func (s *CabinetGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CabinetGroupBy) StringsX

func (s *CabinetGroupBy) StringsX(ctx context.Context) []string

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

type CabinetMutation

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

CabinetMutation represents an operation that mutates the Cabinet nodes in the graph.

func (*CabinetMutation) AddCount

func (m *CabinetMutation) AddCount(i int)

AddCount adds i to the "count" field.

func (*CabinetMutation) AddField

func (m *CabinetMutation) 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 (*CabinetMutation) AddedCount

func (m *CabinetMutation) AddedCount() (r int, exists bool)

AddedCount returns the value that was added to the "count" field in this mutation.

func (*CabinetMutation) AddedEdges

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

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

func (*CabinetMutation) AddedField

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

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

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

func (*CabinetMutation) AddedIDs

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

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

func (*CabinetMutation) ClearCount

func (m *CabinetMutation) ClearCount()

ClearCount clears the value of the "count" field.

func (*CabinetMutation) ClearEdge

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

func (m *CabinetMutation) 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 (*CabinetMutation) ClearGame

func (m *CabinetMutation) ClearGame()

ClearGame clears the "game" edge to the Game entity.

func (*CabinetMutation) ClearLocation

func (m *CabinetMutation) ClearLocation()

ClearLocation clears the "location" edge to the Location entity.

func (*CabinetMutation) ClearedEdges

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

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

func (*CabinetMutation) ClearedFields

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

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

func (CabinetMutation) Client

func (m CabinetMutation) 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 (*CabinetMutation) Count

func (m *CabinetMutation) Count() (r int, exists bool)

Count returns the value of the "count" field in the mutation.

func (*CabinetMutation) CountCleared

func (m *CabinetMutation) CountCleared() bool

CountCleared returns if the "count" field was cleared in this mutation.

func (*CabinetMutation) EdgeCleared

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

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

func (*CabinetMutation) Field

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

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

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

func (*CabinetMutation) Fields

func (m *CabinetMutation) 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 (*CabinetMutation) GameCleared

func (m *CabinetMutation) GameCleared() bool

GameCleared reports if the "game" edge to the Game entity was cleared.

func (*CabinetMutation) GameID

func (m *CabinetMutation) GameID() (r string, exists bool)

GameID returns the value of the "game_id" field in the mutation.

func (*CabinetMutation) GameIDs

func (m *CabinetMutation) GameIDs() (ids []string)

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

func (*CabinetMutation) ID

func (m *CabinetMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*CabinetMutation) IDs

func (m *CabinetMutation) IDs(ctx context.Context) ([]string, 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 (*CabinetMutation) LocationCleared

func (m *CabinetMutation) LocationCleared() bool

LocationCleared reports if the "location" edge to the Location entity was cleared.

func (*CabinetMutation) LocationID

func (m *CabinetMutation) LocationID() (r string, exists bool)

LocationID returns the value of the "location_id" field in the mutation.

func (*CabinetMutation) LocationIDs

func (m *CabinetMutation) LocationIDs() (ids []string)

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

func (*CabinetMutation) OldCount

func (m *CabinetMutation) OldCount(ctx context.Context) (v *int, err error)

OldCount returns the old "count" field's value of the Cabinet entity. If the Cabinet 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 (*CabinetMutation) OldField

func (m *CabinetMutation) 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 (*CabinetMutation) OldGameID

func (m *CabinetMutation) OldGameID(ctx context.Context) (v string, err error)

OldGameID returns the old "game_id" field's value of the Cabinet entity. If the Cabinet 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 (*CabinetMutation) OldLocationID

func (m *CabinetMutation) OldLocationID(ctx context.Context) (v string, err error)

OldLocationID returns the old "location_id" field's value of the Cabinet entity. If the Cabinet 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 (*CabinetMutation) Op

func (m *CabinetMutation) Op() Op

Op returns the operation name.

func (*CabinetMutation) RemovedEdges

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

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

func (*CabinetMutation) RemovedIDs

func (m *CabinetMutation) 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 (*CabinetMutation) ResetCount

func (m *CabinetMutation) ResetCount()

ResetCount resets all changes to the "count" field.

func (*CabinetMutation) ResetEdge

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

func (m *CabinetMutation) 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 (*CabinetMutation) ResetGame

func (m *CabinetMutation) ResetGame()

ResetGame resets all changes to the "game" edge.

func (*CabinetMutation) ResetGameID

func (m *CabinetMutation) ResetGameID()

ResetGameID resets all changes to the "game_id" field.

func (*CabinetMutation) ResetLocation

func (m *CabinetMutation) ResetLocation()

ResetLocation resets all changes to the "location" edge.

func (*CabinetMutation) ResetLocationID

func (m *CabinetMutation) ResetLocationID()

ResetLocationID resets all changes to the "location_id" field.

func (*CabinetMutation) SetCount

func (m *CabinetMutation) SetCount(i int)

SetCount sets the "count" field.

func (*CabinetMutation) SetField

func (m *CabinetMutation) 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 (*CabinetMutation) SetGameID

func (m *CabinetMutation) SetGameID(s string)

SetGameID sets the "game_id" field.

func (*CabinetMutation) SetID

func (m *CabinetMutation) SetID(id string)

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

func (*CabinetMutation) SetLocationID

func (m *CabinetMutation) SetLocationID(s string)

SetLocationID sets the "location_id" field.

func (*CabinetMutation) SetOp

func (m *CabinetMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (CabinetMutation) Tx

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

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

func (*CabinetMutation) Type

func (m *CabinetMutation) Type() string

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

func (*CabinetMutation) Where

func (m *CabinetMutation) Where(ps ...predicate.Cabinet)

Where appends a list predicates to the CabinetMutation builder.

func (*CabinetMutation) WhereP

func (m *CabinetMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the CabinetMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type CabinetOrder

type CabinetOrder struct {
	Direction OrderDirection     `json:"direction"`
	Field     *CabinetOrderField `json:"field"`
}

CabinetOrder defines the ordering of Cabinet.

type CabinetOrderField

type CabinetOrderField struct {
	// Value extracts the ordering value from the given Cabinet.
	Value func(*Cabinet) (ent.Value, error)
	// contains filtered or unexported fields
}

CabinetOrderField defines the ordering field of Cabinet.

type CabinetPaginateOption

type CabinetPaginateOption func(*cabinetPager) error

CabinetPaginateOption enables pagination customization.

func WithCabinetFilter

func WithCabinetFilter(filter func(*CabinetQuery) (*CabinetQuery, error)) CabinetPaginateOption

WithCabinetFilter configures pagination filter.

func WithCabinetOrder

func WithCabinetOrder(order *CabinetOrder) CabinetPaginateOption

WithCabinetOrder configures pagination ordering.

type CabinetQuery

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

CabinetQuery is the builder for querying Cabinet entities.

func (*CabinetQuery) Aggregate

func (cq *CabinetQuery) Aggregate(fns ...AggregateFunc) *CabinetSelect

Aggregate returns a CabinetSelect configured with the given aggregations.

func (*CabinetQuery) All

func (cq *CabinetQuery) All(ctx context.Context) ([]*Cabinet, error)

All executes the query and returns a list of Cabinets.

func (*CabinetQuery) AllX

func (cq *CabinetQuery) AllX(ctx context.Context) []*Cabinet

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

func (*CabinetQuery) Clone

func (cq *CabinetQuery) Clone() *CabinetQuery

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

func (*CabinetQuery) CollectFields

func (c *CabinetQuery) CollectFields(ctx context.Context, satisfies ...string) (*CabinetQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*CabinetQuery) Count

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

Count returns the count of the given query.

func (*CabinetQuery) CountX

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

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

func (*CabinetQuery) Exist

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

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

func (*CabinetQuery) ExistX

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

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

func (*CabinetQuery) First

func (cq *CabinetQuery) First(ctx context.Context) (*Cabinet, error)

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

func (*CabinetQuery) FirstID

func (cq *CabinetQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*CabinetQuery) FirstIDX

func (cq *CabinetQuery) FirstIDX(ctx context.Context) string

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

func (*CabinetQuery) FirstX

func (cq *CabinetQuery) FirstX(ctx context.Context) *Cabinet

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

func (*CabinetQuery) GroupBy

func (cq *CabinetQuery) GroupBy(field string, fields ...string) *CabinetGroupBy

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

client.Cabinet.Query().
	GroupBy(cabinet.FieldCount).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CabinetQuery) IDs

func (cq *CabinetQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*CabinetQuery) IDsX

func (cq *CabinetQuery) IDsX(ctx context.Context) []string

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

func (*CabinetQuery) Limit

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

Limit the number of records to be returned by this query.

func (*CabinetQuery) Offset

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

Offset to start from.

func (*CabinetQuery) Only

func (cq *CabinetQuery) Only(ctx context.Context) (*Cabinet, error)

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

func (*CabinetQuery) OnlyID

func (cq *CabinetQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*CabinetQuery) OnlyIDX

func (cq *CabinetQuery) OnlyIDX(ctx context.Context) string

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

func (*CabinetQuery) OnlyX

func (cq *CabinetQuery) OnlyX(ctx context.Context) *Cabinet

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

func (*CabinetQuery) Order

func (cq *CabinetQuery) Order(o ...cabinet.OrderOption) *CabinetQuery

Order specifies how the records should be ordered.

func (*CabinetQuery) Paginate

func (c *CabinetQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...CabinetPaginateOption,
) (*CabinetConnection, error)

Paginate executes the query and returns a relay based cursor connection to Cabinet.

func (*CabinetQuery) QueryGame

func (cq *CabinetQuery) QueryGame() *GameQuery

QueryGame chains the current query on the "game" edge.

func (*CabinetQuery) QueryLocation

func (cq *CabinetQuery) QueryLocation() *LocationQuery

QueryLocation chains the current query on the "location" edge.

func (*CabinetQuery) Select

func (cq *CabinetQuery) Select(fields ...string) *CabinetSelect

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

client.Cabinet.Query().
	Select(cabinet.FieldCount).
	Scan(ctx, &v)

func (*CabinetQuery) Unique

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

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

func (cq *CabinetQuery) Where(ps ...predicate.Cabinet) *CabinetQuery

Where adds a new predicate for the CabinetQuery builder.

func (*CabinetQuery) WithGame

func (cq *CabinetQuery) WithGame(opts ...func(*GameQuery)) *CabinetQuery

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

func (*CabinetQuery) WithLocation

func (cq *CabinetQuery) WithLocation(opts ...func(*LocationQuery)) *CabinetQuery

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

type CabinetSelect

type CabinetSelect struct {
	*CabinetQuery
	// contains filtered or unexported fields
}

CabinetSelect is the builder for selecting fields of Cabinet entities.

func (*CabinetSelect) Aggregate

func (cs *CabinetSelect) Aggregate(fns ...AggregateFunc) *CabinetSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CabinetSelect) Bool

func (s *CabinetSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CabinetSelect) BoolX

func (s *CabinetSelect) BoolX(ctx context.Context) bool

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

func (*CabinetSelect) Bools

func (s *CabinetSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CabinetSelect) BoolsX

func (s *CabinetSelect) BoolsX(ctx context.Context) []bool

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

func (*CabinetSelect) Float64

func (s *CabinetSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CabinetSelect) Float64X

func (s *CabinetSelect) Float64X(ctx context.Context) float64

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

func (*CabinetSelect) Float64s

func (s *CabinetSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CabinetSelect) Float64sX

func (s *CabinetSelect) Float64sX(ctx context.Context) []float64

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

func (*CabinetSelect) Int

func (s *CabinetSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CabinetSelect) IntX

func (s *CabinetSelect) IntX(ctx context.Context) int

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

func (*CabinetSelect) Ints

func (s *CabinetSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CabinetSelect) IntsX

func (s *CabinetSelect) IntsX(ctx context.Context) []int

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

func (*CabinetSelect) Scan

func (cs *CabinetSelect) Scan(ctx context.Context, v any) error

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

func (*CabinetSelect) ScanX

func (s *CabinetSelect) ScanX(ctx context.Context, v any)

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

func (*CabinetSelect) String

func (s *CabinetSelect) String(ctx context.Context) (_ string, err error)

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

func (*CabinetSelect) StringX

func (s *CabinetSelect) StringX(ctx context.Context) string

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

func (*CabinetSelect) Strings

func (s *CabinetSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CabinetSelect) StringsX

func (s *CabinetSelect) StringsX(ctx context.Context) []string

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

type CabinetUpdate

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

CabinetUpdate is the builder for updating Cabinet entities.

func (*CabinetUpdate) AddCount

func (cu *CabinetUpdate) AddCount(i int) *CabinetUpdate

AddCount adds i to the "count" field.

func (*CabinetUpdate) ClearCount

func (cu *CabinetUpdate) ClearCount() *CabinetUpdate

ClearCount clears the value of the "count" field.

func (*CabinetUpdate) ClearGame

func (cu *CabinetUpdate) ClearGame() *CabinetUpdate

ClearGame clears the "game" edge to the Game entity.

func (*CabinetUpdate) ClearLocation

func (cu *CabinetUpdate) ClearLocation() *CabinetUpdate

ClearLocation clears the "location" edge to the Location entity.

func (*CabinetUpdate) Exec

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

Exec executes the query.

func (*CabinetUpdate) ExecX

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

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

func (*CabinetUpdate) Mutation

func (cu *CabinetUpdate) Mutation() *CabinetMutation

Mutation returns the CabinetMutation object of the builder.

func (*CabinetUpdate) Save

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

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

func (*CabinetUpdate) SaveX

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

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

func (*CabinetUpdate) SetCount

func (cu *CabinetUpdate) SetCount(i int) *CabinetUpdate

SetCount sets the "count" field.

func (*CabinetUpdate) SetGame

func (cu *CabinetUpdate) SetGame(g *Game) *CabinetUpdate

SetGame sets the "game" edge to the Game entity.

func (*CabinetUpdate) SetGameID

func (cu *CabinetUpdate) SetGameID(s string) *CabinetUpdate

SetGameID sets the "game_id" field.

func (*CabinetUpdate) SetLocation

func (cu *CabinetUpdate) SetLocation(l *Location) *CabinetUpdate

SetLocation sets the "location" edge to the Location entity.

func (*CabinetUpdate) SetLocationID

func (cu *CabinetUpdate) SetLocationID(s string) *CabinetUpdate

SetLocationID sets the "location_id" field.

func (*CabinetUpdate) SetNillableCount

func (cu *CabinetUpdate) SetNillableCount(i *int) *CabinetUpdate

SetNillableCount sets the "count" field if the given value is not nil.

func (*CabinetUpdate) SetNillableGameID

func (cu *CabinetUpdate) SetNillableGameID(s *string) *CabinetUpdate

SetNillableGameID sets the "game_id" field if the given value is not nil.

func (*CabinetUpdate) SetNillableLocationID

func (cu *CabinetUpdate) SetNillableLocationID(s *string) *CabinetUpdate

SetNillableLocationID sets the "location_id" field if the given value is not nil.

func (*CabinetUpdate) Where

func (cu *CabinetUpdate) Where(ps ...predicate.Cabinet) *CabinetUpdate

Where appends a list predicates to the CabinetUpdate builder.

type CabinetUpdateOne

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

CabinetUpdateOne is the builder for updating a single Cabinet entity.

func (*CabinetUpdateOne) AddCount

func (cuo *CabinetUpdateOne) AddCount(i int) *CabinetUpdateOne

AddCount adds i to the "count" field.

func (*CabinetUpdateOne) ClearCount

func (cuo *CabinetUpdateOne) ClearCount() *CabinetUpdateOne

ClearCount clears the value of the "count" field.

func (*CabinetUpdateOne) ClearGame

func (cuo *CabinetUpdateOne) ClearGame() *CabinetUpdateOne

ClearGame clears the "game" edge to the Game entity.

func (*CabinetUpdateOne) ClearLocation

func (cuo *CabinetUpdateOne) ClearLocation() *CabinetUpdateOne

ClearLocation clears the "location" edge to the Location entity.

func (*CabinetUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CabinetUpdateOne) ExecX

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

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

func (*CabinetUpdateOne) Mutation

func (cuo *CabinetUpdateOne) Mutation() *CabinetMutation

Mutation returns the CabinetMutation object of the builder.

func (*CabinetUpdateOne) Save

func (cuo *CabinetUpdateOne) Save(ctx context.Context) (*Cabinet, error)

Save executes the query and returns the updated Cabinet entity.

func (*CabinetUpdateOne) SaveX

func (cuo *CabinetUpdateOne) SaveX(ctx context.Context) *Cabinet

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

func (*CabinetUpdateOne) Select

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

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

func (*CabinetUpdateOne) SetCount

func (cuo *CabinetUpdateOne) SetCount(i int) *CabinetUpdateOne

SetCount sets the "count" field.

func (*CabinetUpdateOne) SetGame

func (cuo *CabinetUpdateOne) SetGame(g *Game) *CabinetUpdateOne

SetGame sets the "game" edge to the Game entity.

func (*CabinetUpdateOne) SetGameID

func (cuo *CabinetUpdateOne) SetGameID(s string) *CabinetUpdateOne

SetGameID sets the "game_id" field.

func (*CabinetUpdateOne) SetLocation

func (cuo *CabinetUpdateOne) SetLocation(l *Location) *CabinetUpdateOne

SetLocation sets the "location" edge to the Location entity.

func (*CabinetUpdateOne) SetLocationID

func (cuo *CabinetUpdateOne) SetLocationID(s string) *CabinetUpdateOne

SetLocationID sets the "location_id" field.

func (*CabinetUpdateOne) SetNillableCount

func (cuo *CabinetUpdateOne) SetNillableCount(i *int) *CabinetUpdateOne

SetNillableCount sets the "count" field if the given value is not nil.

func (*CabinetUpdateOne) SetNillableGameID

func (cuo *CabinetUpdateOne) SetNillableGameID(s *string) *CabinetUpdateOne

SetNillableGameID sets the "game_id" field if the given value is not nil.

func (*CabinetUpdateOne) SetNillableLocationID

func (cuo *CabinetUpdateOne) SetNillableLocationID(s *string) *CabinetUpdateOne

SetNillableLocationID sets the "location_id" field if the given value is not nil.

func (*CabinetUpdateOne) Where

Where appends a list predicates to the CabinetUpdate builder.

type CabinetWhereInput

type CabinetWhereInput struct {
	Predicates []predicate.Cabinet  `json:"-"`
	Not        *CabinetWhereInput   `json:"not,omitempty"`
	Or         []*CabinetWhereInput `json:"or,omitempty"`
	And        []*CabinetWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID             *string  `json:"id,omitempty"`
	IDNEQ          *string  `json:"idNEQ,omitempty"`
	IDIn           []string `json:"idIn,omitempty"`
	IDNotIn        []string `json:"idNotIn,omitempty"`
	IDGT           *string  `json:"idGT,omitempty"`
	IDGTE          *string  `json:"idGTE,omitempty"`
	IDLT           *string  `json:"idLT,omitempty"`
	IDLTE          *string  `json:"idLTE,omitempty"`
	IDEqualFold    *string  `json:"idEqualFold,omitempty"`
	IDContainsFold *string  `json:"idContainsFold,omitempty"`

	// "count" field predicates.
	Count       *int  `json:"count,omitempty"`
	CountNEQ    *int  `json:"countNEQ,omitempty"`
	CountIn     []int `json:"countIn,omitempty"`
	CountNotIn  []int `json:"countNotIn,omitempty"`
	CountGT     *int  `json:"countGT,omitempty"`
	CountGTE    *int  `json:"countGTE,omitempty"`
	CountLT     *int  `json:"countLT,omitempty"`
	CountLTE    *int  `json:"countLTE,omitempty"`
	CountIsNil  bool  `json:"countIsNil,omitempty"`
	CountNotNil bool  `json:"countNotNil,omitempty"`

	// "location" edge predicates.
	HasLocation     *bool                 `json:"hasLocation,omitempty"`
	HasLocationWith []*LocationWhereInput `json:"hasLocationWith,omitempty"`

	// "game" edge predicates.
	HasGame     *bool             `json:"hasGame,omitempty"`
	HasGameWith []*GameWhereInput `json:"hasGameWith,omitempty"`
}

CabinetWhereInput represents a where input for filtering Cabinet queries.

func (*CabinetWhereInput) AddPredicates

func (i *CabinetWhereInput) AddPredicates(predicates ...predicate.Cabinet)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*CabinetWhereInput) Filter

Filter applies the CabinetWhereInput filter on the CabinetQuery builder.

func (*CabinetWhereInput) P

P returns a predicate for filtering cabinets. An error is returned if the input is empty or invalid.

type Cabinets

type Cabinets []*Cabinet

Cabinets is a parsable slice of Cabinet.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Cabinet is the client for interacting with the Cabinet builders.
	Cabinet *CabinetClient
	// Game is the client for interacting with the Game builders.
	Game *GameClient
	// Location is the client for interacting with the Location builders.
	Location *LocationClient
	// 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().
	Cabinet.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Noder

func (c *Client) Noder(ctx context.Context, id string, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(typeResolver))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []string, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

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 CreateLocationInput

type CreateLocationInput struct {
	Name       string
	RawAddress *string
	Coordinate *postgis.PointS
	CabinetIDs []string
}

CreateLocationInput represents a mutation input for creating locations.

func (*CreateLocationInput) Mutate

func (i *CreateLocationInput) Mutate(m *LocationMutation)

Mutate applies the CreateLocationInput on the LocationMutation builder.

type Cursor

type Cursor = entgql.Cursor[string]

Common entgql types.

type Game

type Game struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// contains filtered or unexported fields
}

Game is the model entity for the Game schema.

func (*Game) IsNode

func (*Game) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Game) String

func (ga *Game) String() string

String implements the fmt.Stringer.

func (*Game) ToEdge

func (ga *Game) ToEdge(order *GameOrder) *GameEdge

ToEdge converts Game into GameEdge.

func (*Game) Unwrap

func (ga *Game) Unwrap() *Game

Unwrap unwraps the Game entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Game) Update

func (ga *Game) Update() *GameUpdateOne

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

func (*Game) Value

func (ga *Game) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Game. This includes values selected through modifiers, order, etc.

type GameClient

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

GameClient is a client for the Game schema.

func NewGameClient

func NewGameClient(c config) *GameClient

NewGameClient returns a client for the Game from the given config.

func (*GameClient) Create

func (c *GameClient) Create() *GameCreate

Create returns a builder for creating a Game entity.

func (*GameClient) CreateBulk

func (c *GameClient) CreateBulk(builders ...*GameCreate) *GameCreateBulk

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

func (*GameClient) Delete

func (c *GameClient) Delete() *GameDelete

Delete returns a delete builder for Game.

func (*GameClient) DeleteOne

func (c *GameClient) DeleteOne(ga *Game) *GameDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*GameClient) DeleteOneID

func (c *GameClient) DeleteOneID(id string) *GameDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*GameClient) Get

func (c *GameClient) Get(ctx context.Context, id string) (*Game, error)

Get returns a Game entity by its id.

func (*GameClient) GetX

func (c *GameClient) GetX(ctx context.Context, id string) *Game

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

func (*GameClient) Hooks

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

Hooks returns the client hooks.

func (*GameClient) Intercept

func (c *GameClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `game.Intercept(f(g(h())))`.

func (*GameClient) Interceptors

func (c *GameClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*GameClient) MapCreateBulk

func (c *GameClient) MapCreateBulk(slice any, setFunc func(*GameCreate, int)) *GameCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*GameClient) Query

func (c *GameClient) Query() *GameQuery

Query returns a query builder for Game.

func (*GameClient) Update

func (c *GameClient) Update() *GameUpdate

Update returns an update builder for Game.

func (*GameClient) UpdateOne

func (c *GameClient) UpdateOne(ga *Game) *GameUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GameClient) UpdateOneID

func (c *GameClient) UpdateOneID(id string) *GameUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GameClient) Use

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

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

type GameConnection

type GameConnection struct {
	Edges      []*GameEdge `json:"edges"`
	PageInfo   PageInfo    `json:"pageInfo"`
	TotalCount int         `json:"totalCount"`
}

GameConnection is the connection containing edges to Game.

type GameCreate

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

GameCreate is the builder for creating a Game entity.

func (*GameCreate) Exec

func (gc *GameCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*GameCreate) ExecX

func (gc *GameCreate) ExecX(ctx context.Context)

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

func (*GameCreate) Mutation

func (gc *GameCreate) Mutation() *GameMutation

Mutation returns the GameMutation object of the builder.

func (*GameCreate) Save

func (gc *GameCreate) Save(ctx context.Context) (*Game, error)

Save creates the Game in the database.

func (*GameCreate) SaveX

func (gc *GameCreate) SaveX(ctx context.Context) *Game

SaveX calls Save and panics if Save returns an error.

func (*GameCreate) SetID

func (gc *GameCreate) SetID(s string) *GameCreate

SetID sets the "id" field.

func (*GameCreate) SetName

func (gc *GameCreate) SetName(s string) *GameCreate

SetName sets the "name" field.

func (*GameCreate) SetNillableID

func (gc *GameCreate) SetNillableID(s *string) *GameCreate

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

type GameCreateBulk

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

GameCreateBulk is the builder for creating many Game entities in bulk.

func (*GameCreateBulk) Exec

func (gcb *GameCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*GameCreateBulk) ExecX

func (gcb *GameCreateBulk) ExecX(ctx context.Context)

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

func (*GameCreateBulk) Save

func (gcb *GameCreateBulk) Save(ctx context.Context) ([]*Game, error)

Save creates the Game entities in the database.

func (*GameCreateBulk) SaveX

func (gcb *GameCreateBulk) SaveX(ctx context.Context) []*Game

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

type GameDelete

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

GameDelete is the builder for deleting a Game entity.

func (*GameDelete) Exec

func (gd *GameDelete) Exec(ctx context.Context) (int, error)

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

func (*GameDelete) ExecX

func (gd *GameDelete) ExecX(ctx context.Context) int

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

func (*GameDelete) Where

func (gd *GameDelete) Where(ps ...predicate.Game) *GameDelete

Where appends a list predicates to the GameDelete builder.

type GameDeleteOne

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

GameDeleteOne is the builder for deleting a single Game entity.

func (*GameDeleteOne) Exec

func (gdo *GameDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*GameDeleteOne) ExecX

func (gdo *GameDeleteOne) ExecX(ctx context.Context)

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

func (*GameDeleteOne) Where

func (gdo *GameDeleteOne) Where(ps ...predicate.Game) *GameDeleteOne

Where appends a list predicates to the GameDelete builder.

type GameEdge

type GameEdge struct {
	Node   *Game  `json:"node"`
	Cursor Cursor `json:"cursor"`
}

GameEdge is the edge representation of Game.

type GameGroupBy

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

GameGroupBy is the group-by builder for Game entities.

func (*GameGroupBy) Aggregate

func (ggb *GameGroupBy) Aggregate(fns ...AggregateFunc) *GameGroupBy

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

func (*GameGroupBy) Bool

func (s *GameGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*GameGroupBy) BoolX

func (s *GameGroupBy) BoolX(ctx context.Context) bool

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

func (*GameGroupBy) Bools

func (s *GameGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*GameGroupBy) BoolsX

func (s *GameGroupBy) BoolsX(ctx context.Context) []bool

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

func (*GameGroupBy) Float64

func (s *GameGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*GameGroupBy) Float64X

func (s *GameGroupBy) Float64X(ctx context.Context) float64

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

func (*GameGroupBy) Float64s

func (s *GameGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*GameGroupBy) Float64sX

func (s *GameGroupBy) Float64sX(ctx context.Context) []float64

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

func (*GameGroupBy) Int

func (s *GameGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*GameGroupBy) IntX

func (s *GameGroupBy) IntX(ctx context.Context) int

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

func (*GameGroupBy) Ints

func (s *GameGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*GameGroupBy) IntsX

func (s *GameGroupBy) IntsX(ctx context.Context) []int

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

func (*GameGroupBy) Scan

func (ggb *GameGroupBy) Scan(ctx context.Context, v any) error

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

func (*GameGroupBy) ScanX

func (s *GameGroupBy) ScanX(ctx context.Context, v any)

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

func (*GameGroupBy) String

func (s *GameGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*GameGroupBy) StringX

func (s *GameGroupBy) StringX(ctx context.Context) string

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

func (*GameGroupBy) Strings

func (s *GameGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*GameGroupBy) StringsX

func (s *GameGroupBy) StringsX(ctx context.Context) []string

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

type GameMutation

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

GameMutation represents an operation that mutates the Game nodes in the graph.

func (*GameMutation) AddField

func (m *GameMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*GameMutation) AddedEdges

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

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

func (*GameMutation) AddedField

func (m *GameMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*GameMutation) AddedFields

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

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

func (*GameMutation) AddedIDs

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

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

func (*GameMutation) ClearEdge

func (m *GameMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*GameMutation) ClearField

func (m *GameMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*GameMutation) ClearedEdges

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

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

func (*GameMutation) ClearedFields

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

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

func (GameMutation) Client

func (m GameMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*GameMutation) EdgeCleared

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

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

func (*GameMutation) Field

func (m *GameMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*GameMutation) FieldCleared

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

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

func (*GameMutation) Fields

func (m *GameMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*GameMutation) ID

func (m *GameMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*GameMutation) IDs

func (m *GameMutation) IDs(ctx context.Context) ([]string, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*GameMutation) Name

func (m *GameMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*GameMutation) OldField

func (m *GameMutation) 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 (*GameMutation) OldName

func (m *GameMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Game entity. If the Game object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*GameMutation) Op

func (m *GameMutation) Op() Op

Op returns the operation name.

func (*GameMutation) RemovedEdges

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

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

func (*GameMutation) RemovedIDs

func (m *GameMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*GameMutation) ResetEdge

func (m *GameMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*GameMutation) ResetField

func (m *GameMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*GameMutation) ResetName

func (m *GameMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*GameMutation) SetField

func (m *GameMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*GameMutation) SetID

func (m *GameMutation) SetID(id string)

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

func (*GameMutation) SetName

func (m *GameMutation) SetName(s string)

SetName sets the "name" field.

func (*GameMutation) SetOp

func (m *GameMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (GameMutation) Tx

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

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

func (*GameMutation) Type

func (m *GameMutation) Type() string

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

func (*GameMutation) Where

func (m *GameMutation) Where(ps ...predicate.Game)

Where appends a list predicates to the GameMutation builder.

func (*GameMutation) WhereP

func (m *GameMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the GameMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type GameOrder

type GameOrder struct {
	Direction OrderDirection  `json:"direction"`
	Field     *GameOrderField `json:"field"`
}

GameOrder defines the ordering of Game.

type GameOrderField

type GameOrderField struct {
	// Value extracts the ordering value from the given Game.
	Value func(*Game) (ent.Value, error)
	// contains filtered or unexported fields
}

GameOrderField defines the ordering field of Game.

type GamePaginateOption

type GamePaginateOption func(*gamePager) error

GamePaginateOption enables pagination customization.

func WithGameFilter

func WithGameFilter(filter func(*GameQuery) (*GameQuery, error)) GamePaginateOption

WithGameFilter configures pagination filter.

func WithGameOrder

func WithGameOrder(order *GameOrder) GamePaginateOption

WithGameOrder configures pagination ordering.

type GameQuery

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

GameQuery is the builder for querying Game entities.

func (*GameQuery) Aggregate

func (gq *GameQuery) Aggregate(fns ...AggregateFunc) *GameSelect

Aggregate returns a GameSelect configured with the given aggregations.

func (*GameQuery) All

func (gq *GameQuery) All(ctx context.Context) ([]*Game, error)

All executes the query and returns a list of Games.

func (*GameQuery) AllX

func (gq *GameQuery) AllX(ctx context.Context) []*Game

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

func (*GameQuery) Clone

func (gq *GameQuery) Clone() *GameQuery

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

func (*GameQuery) CollectFields

func (ga *GameQuery) CollectFields(ctx context.Context, satisfies ...string) (*GameQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*GameQuery) Count

func (gq *GameQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*GameQuery) CountX

func (gq *GameQuery) CountX(ctx context.Context) int

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

func (*GameQuery) Exist

func (gq *GameQuery) Exist(ctx context.Context) (bool, error)

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

func (*GameQuery) ExistX

func (gq *GameQuery) ExistX(ctx context.Context) bool

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

func (*GameQuery) First

func (gq *GameQuery) First(ctx context.Context) (*Game, error)

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

func (*GameQuery) FirstID

func (gq *GameQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*GameQuery) FirstIDX

func (gq *GameQuery) FirstIDX(ctx context.Context) string

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

func (*GameQuery) FirstX

func (gq *GameQuery) FirstX(ctx context.Context) *Game

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

func (*GameQuery) GroupBy

func (gq *GameQuery) GroupBy(field string, fields ...string) *GameGroupBy

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Game.Query().
	GroupBy(game.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GameQuery) IDs

func (gq *GameQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*GameQuery) IDsX

func (gq *GameQuery) IDsX(ctx context.Context) []string

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

func (*GameQuery) Limit

func (gq *GameQuery) Limit(limit int) *GameQuery

Limit the number of records to be returned by this query.

func (*GameQuery) Offset

func (gq *GameQuery) Offset(offset int) *GameQuery

Offset to start from.

func (*GameQuery) Only

func (gq *GameQuery) Only(ctx context.Context) (*Game, error)

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

func (*GameQuery) OnlyID

func (gq *GameQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*GameQuery) OnlyIDX

func (gq *GameQuery) OnlyIDX(ctx context.Context) string

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

func (*GameQuery) OnlyX

func (gq *GameQuery) OnlyX(ctx context.Context) *Game

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

func (*GameQuery) Order

func (gq *GameQuery) Order(o ...game.OrderOption) *GameQuery

Order specifies how the records should be ordered.

func (*GameQuery) Paginate

func (ga *GameQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...GamePaginateOption,
) (*GameConnection, error)

Paginate executes the query and returns a relay based cursor connection to Game.

func (*GameQuery) Select

func (gq *GameQuery) Select(fields ...string) *GameSelect

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Game.Query().
	Select(game.FieldName).
	Scan(ctx, &v)

func (*GameQuery) Unique

func (gq *GameQuery) Unique(unique bool) *GameQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*GameQuery) Where

func (gq *GameQuery) Where(ps ...predicate.Game) *GameQuery

Where adds a new predicate for the GameQuery builder.

type GameSelect

type GameSelect struct {
	*GameQuery
	// contains filtered or unexported fields
}

GameSelect is the builder for selecting fields of Game entities.

func (*GameSelect) Aggregate

func (gs *GameSelect) Aggregate(fns ...AggregateFunc) *GameSelect

Aggregate adds the given aggregation functions to the selector query.

func (*GameSelect) Bool

func (s *GameSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*GameSelect) BoolX

func (s *GameSelect) BoolX(ctx context.Context) bool

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

func (*GameSelect) Bools

func (s *GameSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*GameSelect) BoolsX

func (s *GameSelect) BoolsX(ctx context.Context) []bool

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

func (*GameSelect) Float64

func (s *GameSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*GameSelect) Float64X

func (s *GameSelect) Float64X(ctx context.Context) float64

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

func (*GameSelect) Float64s

func (s *GameSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*GameSelect) Float64sX

func (s *GameSelect) Float64sX(ctx context.Context) []float64

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

func (*GameSelect) Int

func (s *GameSelect) Int(ctx context.Context) (_ int, err error)

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

func (*GameSelect) IntX

func (s *GameSelect) IntX(ctx context.Context) int

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

func (*GameSelect) Ints

func (s *GameSelect) Ints(ctx context.Context) ([]int, error)

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

func (*GameSelect) IntsX

func (s *GameSelect) IntsX(ctx context.Context) []int

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

func (*GameSelect) Scan

func (gs *GameSelect) Scan(ctx context.Context, v any) error

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

func (*GameSelect) ScanX

func (s *GameSelect) ScanX(ctx context.Context, v any)

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

func (*GameSelect) String

func (s *GameSelect) String(ctx context.Context) (_ string, err error)

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

func (*GameSelect) StringX

func (s *GameSelect) StringX(ctx context.Context) string

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

func (*GameSelect) Strings

func (s *GameSelect) Strings(ctx context.Context) ([]string, error)

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

func (*GameSelect) StringsX

func (s *GameSelect) StringsX(ctx context.Context) []string

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

type GameUpdate

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

GameUpdate is the builder for updating Game entities.

func (*GameUpdate) Exec

func (gu *GameUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*GameUpdate) ExecX

func (gu *GameUpdate) ExecX(ctx context.Context)

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

func (*GameUpdate) Mutation

func (gu *GameUpdate) Mutation() *GameMutation

Mutation returns the GameMutation object of the builder.

func (*GameUpdate) Save

func (gu *GameUpdate) Save(ctx context.Context) (int, error)

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

func (*GameUpdate) SaveX

func (gu *GameUpdate) SaveX(ctx context.Context) int

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

func (*GameUpdate) SetName

func (gu *GameUpdate) SetName(s string) *GameUpdate

SetName sets the "name" field.

func (*GameUpdate) SetNillableName

func (gu *GameUpdate) SetNillableName(s *string) *GameUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*GameUpdate) Where

func (gu *GameUpdate) Where(ps ...predicate.Game) *GameUpdate

Where appends a list predicates to the GameUpdate builder.

type GameUpdateOne

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

GameUpdateOne is the builder for updating a single Game entity.

func (*GameUpdateOne) Exec

func (guo *GameUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*GameUpdateOne) ExecX

func (guo *GameUpdateOne) ExecX(ctx context.Context)

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

func (*GameUpdateOne) Mutation

func (guo *GameUpdateOne) Mutation() *GameMutation

Mutation returns the GameMutation object of the builder.

func (*GameUpdateOne) Save

func (guo *GameUpdateOne) Save(ctx context.Context) (*Game, error)

Save executes the query and returns the updated Game entity.

func (*GameUpdateOne) SaveX

func (guo *GameUpdateOne) SaveX(ctx context.Context) *Game

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

func (*GameUpdateOne) Select

func (guo *GameUpdateOne) Select(field string, fields ...string) *GameUpdateOne

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

func (*GameUpdateOne) SetName

func (guo *GameUpdateOne) SetName(s string) *GameUpdateOne

SetName sets the "name" field.

func (*GameUpdateOne) SetNillableName

func (guo *GameUpdateOne) SetNillableName(s *string) *GameUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*GameUpdateOne) Where

func (guo *GameUpdateOne) Where(ps ...predicate.Game) *GameUpdateOne

Where appends a list predicates to the GameUpdate builder.

type GameWhereInput

type GameWhereInput struct {
	Predicates []predicate.Game  `json:"-"`
	Not        *GameWhereInput   `json:"not,omitempty"`
	Or         []*GameWhereInput `json:"or,omitempty"`
	And        []*GameWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID             *string  `json:"id,omitempty"`
	IDNEQ          *string  `json:"idNEQ,omitempty"`
	IDIn           []string `json:"idIn,omitempty"`
	IDNotIn        []string `json:"idNotIn,omitempty"`
	IDGT           *string  `json:"idGT,omitempty"`
	IDGTE          *string  `json:"idGTE,omitempty"`
	IDLT           *string  `json:"idLT,omitempty"`
	IDLTE          *string  `json:"idLTE,omitempty"`
	IDEqualFold    *string  `json:"idEqualFold,omitempty"`
	IDContainsFold *string  `json:"idContainsFold,omitempty"`

	// "name" field predicates.
	Name             *string  `json:"name,omitempty"`
	NameNEQ          *string  `json:"nameNEQ,omitempty"`
	NameIn           []string `json:"nameIn,omitempty"`
	NameNotIn        []string `json:"nameNotIn,omitempty"`
	NameGT           *string  `json:"nameGT,omitempty"`
	NameGTE          *string  `json:"nameGTE,omitempty"`
	NameLT           *string  `json:"nameLT,omitempty"`
	NameLTE          *string  `json:"nameLTE,omitempty"`
	NameContains     *string  `json:"nameContains,omitempty"`
	NameHasPrefix    *string  `json:"nameHasPrefix,omitempty"`
	NameHasSuffix    *string  `json:"nameHasSuffix,omitempty"`
	NameEqualFold    *string  `json:"nameEqualFold,omitempty"`
	NameContainsFold *string  `json:"nameContainsFold,omitempty"`
}

GameWhereInput represents a where input for filtering Game queries.

func (*GameWhereInput) AddPredicates

func (i *GameWhereInput) AddPredicates(predicates ...predicate.Game)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*GameWhereInput) Filter

func (i *GameWhereInput) Filter(q *GameQuery) (*GameQuery, error)

Filter applies the GameWhereInput filter on the GameQuery builder.

func (*GameWhereInput) P

func (i *GameWhereInput) P() (predicate.Game, error)

P returns a predicate for filtering games. An error is returned if the input is empty or invalid.

type Games

type Games []*Game

Games is a parsable slice of Game.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Location

type Location struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// DeduplicationKey holds the value of the "deduplication_key" field.
	DeduplicationKey string `json:"deduplication_key,omitempty"`
	// RawAddress holds the value of the "raw_address" field.
	RawAddress string `json:"raw_address,omitempty"`
	// Coordinate holds the value of the "coordinate" field.
	Coordinate *postgis.PointS `json:"coordinate,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the LocationQuery when eager-loading is set.
	Edges LocationEdges `json:"edges"`
	// contains filtered or unexported fields
}

Location is the model entity for the Location schema.

func (*Location) Cabinets

func (l *Location) Cabinets(ctx context.Context) (result []*Cabinet, err error)

func (*Location) IsNode

func (*Location) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Location) NamedCabinets

func (l *Location) NamedCabinets(name string) ([]*Cabinet, error)

NamedCabinets returns the Cabinets named value or an error if the edge was not loaded in eager-loading with this name.

func (*Location) QueryCabinets

func (l *Location) QueryCabinets() *CabinetQuery

QueryCabinets queries the "cabinets" edge of the Location entity.

func (*Location) String

func (l *Location) String() string

String implements the fmt.Stringer.

func (*Location) ToEdge

func (l *Location) ToEdge(order *LocationOrder) *LocationEdge

ToEdge converts Location into LocationEdge.

func (*Location) Unwrap

func (l *Location) Unwrap() *Location

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

func (l *Location) Update() *LocationUpdateOne

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

func (*Location) Value

func (l *Location) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Location. This includes values selected through modifiers, order, etc.

type LocationClient

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

LocationClient is a client for the Location schema.

func NewLocationClient

func NewLocationClient(c config) *LocationClient

NewLocationClient returns a client for the Location from the given config.

func (*LocationClient) Create

func (c *LocationClient) Create() *LocationCreate

Create returns a builder for creating a Location entity.

func (*LocationClient) CreateBulk

func (c *LocationClient) CreateBulk(builders ...*LocationCreate) *LocationCreateBulk

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

func (*LocationClient) Delete

func (c *LocationClient) Delete() *LocationDelete

Delete returns a delete builder for Location.

func (*LocationClient) DeleteOne

func (c *LocationClient) DeleteOne(l *Location) *LocationDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*LocationClient) DeleteOneID

func (c *LocationClient) DeleteOneID(id string) *LocationDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*LocationClient) Get

func (c *LocationClient) Get(ctx context.Context, id string) (*Location, error)

Get returns a Location entity by its id.

func (*LocationClient) GetX

func (c *LocationClient) GetX(ctx context.Context, id string) *Location

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

func (*LocationClient) Hooks

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

Hooks returns the client hooks.

func (*LocationClient) Intercept

func (c *LocationClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `location.Intercept(f(g(h())))`.

func (*LocationClient) Interceptors

func (c *LocationClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*LocationClient) MapCreateBulk

func (c *LocationClient) MapCreateBulk(slice any, setFunc func(*LocationCreate, int)) *LocationCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*LocationClient) Query

func (c *LocationClient) Query() *LocationQuery

Query returns a query builder for Location.

func (*LocationClient) QueryCabinets

func (c *LocationClient) QueryCabinets(l *Location) *CabinetQuery

QueryCabinets queries the cabinets edge of a Location.

func (*LocationClient) Update

func (c *LocationClient) Update() *LocationUpdate

Update returns an update builder for Location.

func (*LocationClient) UpdateOne

func (c *LocationClient) UpdateOne(l *Location) *LocationUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LocationClient) UpdateOneID

func (c *LocationClient) UpdateOneID(id string) *LocationUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LocationClient) Use

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

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

type LocationConnection

type LocationConnection struct {
	Edges      []*LocationEdge `json:"edges"`
	PageInfo   PageInfo        `json:"pageInfo"`
	TotalCount int             `json:"totalCount"`
}

LocationConnection is the connection containing edges to Location.

type LocationCreate

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

LocationCreate is the builder for creating a Location entity.

func (*LocationCreate) AddCabinetIDs

func (lc *LocationCreate) AddCabinetIDs(ids ...string) *LocationCreate

AddCabinetIDs adds the "cabinets" edge to the Cabinet entity by IDs.

func (*LocationCreate) AddCabinets

func (lc *LocationCreate) AddCabinets(c ...*Cabinet) *LocationCreate

AddCabinets adds the "cabinets" edges to the Cabinet entity.

func (*LocationCreate) Exec

func (lc *LocationCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LocationCreate) ExecX

func (lc *LocationCreate) ExecX(ctx context.Context)

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

func (*LocationCreate) Mutation

func (lc *LocationCreate) Mutation() *LocationMutation

Mutation returns the LocationMutation object of the builder.

func (*LocationCreate) Save

func (lc *LocationCreate) Save(ctx context.Context) (*Location, error)

Save creates the Location in the database.

func (*LocationCreate) SaveX

func (lc *LocationCreate) SaveX(ctx context.Context) *Location

SaveX calls Save and panics if Save returns an error.

func (*LocationCreate) SetCoordinate

func (lc *LocationCreate) SetCoordinate(po *postgis.PointS) *LocationCreate

SetCoordinate sets the "coordinate" field.

func (*LocationCreate) SetDeduplicationKey

func (lc *LocationCreate) SetDeduplicationKey(s string) *LocationCreate

SetDeduplicationKey sets the "deduplication_key" field.

func (*LocationCreate) SetID

func (lc *LocationCreate) SetID(s string) *LocationCreate

SetID sets the "id" field.

func (*LocationCreate) SetInput

SetInput applies the change-set in the CreateLocationInput on the LocationCreate builder.

func (*LocationCreate) SetName

func (lc *LocationCreate) SetName(s string) *LocationCreate

SetName sets the "name" field.

func (*LocationCreate) SetNillableID

func (lc *LocationCreate) SetNillableID(s *string) *LocationCreate

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

func (*LocationCreate) SetNillableRawAddress

func (lc *LocationCreate) SetNillableRawAddress(s *string) *LocationCreate

SetNillableRawAddress sets the "raw_address" field if the given value is not nil.

func (*LocationCreate) SetRawAddress

func (lc *LocationCreate) SetRawAddress(s string) *LocationCreate

SetRawAddress sets the "raw_address" field.

type LocationCreateBulk

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

LocationCreateBulk is the builder for creating many Location entities in bulk.

func (*LocationCreateBulk) Exec

func (lcb *LocationCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LocationCreateBulk) ExecX

func (lcb *LocationCreateBulk) ExecX(ctx context.Context)

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

func (*LocationCreateBulk) Save

func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error)

Save creates the Location entities in the database.

func (*LocationCreateBulk) SaveX

func (lcb *LocationCreateBulk) SaveX(ctx context.Context) []*Location

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

type LocationDelete

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

LocationDelete is the builder for deleting a Location entity.

func (*LocationDelete) Exec

func (ld *LocationDelete) Exec(ctx context.Context) (int, error)

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

func (*LocationDelete) ExecX

func (ld *LocationDelete) ExecX(ctx context.Context) int

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

func (*LocationDelete) Where

func (ld *LocationDelete) Where(ps ...predicate.Location) *LocationDelete

Where appends a list predicates to the LocationDelete builder.

type LocationDeleteOne

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

LocationDeleteOne is the builder for deleting a single Location entity.

func (*LocationDeleteOne) Exec

func (ldo *LocationDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LocationDeleteOne) ExecX

func (ldo *LocationDeleteOne) ExecX(ctx context.Context)

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

func (*LocationDeleteOne) Where

Where appends a list predicates to the LocationDelete builder.

type LocationEdge

type LocationEdge struct {
	Node   *Location `json:"node"`
	Cursor Cursor    `json:"cursor"`
}

LocationEdge is the edge representation of Location.

type LocationEdges

type LocationEdges struct {
	// Cabinets holds the value of the cabinets edge.
	Cabinets []*Cabinet `json:"cabinets,omitempty"`
	// contains filtered or unexported fields
}

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

func (LocationEdges) CabinetsOrErr

func (e LocationEdges) CabinetsOrErr() ([]*Cabinet, error)

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

type LocationGroupBy

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

LocationGroupBy is the group-by builder for Location entities.

func (*LocationGroupBy) Aggregate

func (lgb *LocationGroupBy) Aggregate(fns ...AggregateFunc) *LocationGroupBy

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

func (*LocationGroupBy) Bool

func (s *LocationGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*LocationGroupBy) BoolX

func (s *LocationGroupBy) BoolX(ctx context.Context) bool

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

func (*LocationGroupBy) Bools

func (s *LocationGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*LocationGroupBy) BoolsX

func (s *LocationGroupBy) BoolsX(ctx context.Context) []bool

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

func (*LocationGroupBy) Float64

func (s *LocationGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*LocationGroupBy) Float64X

func (s *LocationGroupBy) Float64X(ctx context.Context) float64

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

func (*LocationGroupBy) Float64s

func (s *LocationGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*LocationGroupBy) Float64sX

func (s *LocationGroupBy) Float64sX(ctx context.Context) []float64

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

func (*LocationGroupBy) Int

func (s *LocationGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*LocationGroupBy) IntX

func (s *LocationGroupBy) IntX(ctx context.Context) int

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

func (*LocationGroupBy) Ints

func (s *LocationGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*LocationGroupBy) IntsX

func (s *LocationGroupBy) IntsX(ctx context.Context) []int

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

func (*LocationGroupBy) Scan

func (lgb *LocationGroupBy) Scan(ctx context.Context, v any) error

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

func (*LocationGroupBy) ScanX

func (s *LocationGroupBy) ScanX(ctx context.Context, v any)

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

func (*LocationGroupBy) String

func (s *LocationGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*LocationGroupBy) StringX

func (s *LocationGroupBy) StringX(ctx context.Context) string

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

func (*LocationGroupBy) Strings

func (s *LocationGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*LocationGroupBy) StringsX

func (s *LocationGroupBy) StringsX(ctx context.Context) []string

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

type LocationMutation

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

LocationMutation represents an operation that mutates the Location nodes in the graph.

func (*LocationMutation) AddCabinetIDs

func (m *LocationMutation) AddCabinetIDs(ids ...string)

AddCabinetIDs adds the "cabinets" edge to the Cabinet entity by ids.

func (*LocationMutation) AddField

func (m *LocationMutation) 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 (*LocationMutation) AddedEdges

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

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

func (*LocationMutation) AddedField

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

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

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

func (*LocationMutation) AddedIDs

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

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

func (*LocationMutation) CabinetsCleared

func (m *LocationMutation) CabinetsCleared() bool

CabinetsCleared reports if the "cabinets" edge to the Cabinet entity was cleared.

func (*LocationMutation) CabinetsIDs

func (m *LocationMutation) CabinetsIDs() (ids []string)

CabinetsIDs returns the "cabinets" edge IDs in the mutation.

func (*LocationMutation) ClearCabinets

func (m *LocationMutation) ClearCabinets()

ClearCabinets clears the "cabinets" edge to the Cabinet entity.

func (*LocationMutation) ClearCoordinate

func (m *LocationMutation) ClearCoordinate()

ClearCoordinate clears the value of the "coordinate" field.

func (*LocationMutation) ClearEdge

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

func (m *LocationMutation) 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 (*LocationMutation) ClearRawAddress

func (m *LocationMutation) ClearRawAddress()

ClearRawAddress clears the value of the "raw_address" field.

func (*LocationMutation) ClearedEdges

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

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

func (*LocationMutation) ClearedFields

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

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

func (LocationMutation) Client

func (m LocationMutation) 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 (*LocationMutation) Coordinate

func (m *LocationMutation) Coordinate() (r *postgis.PointS, exists bool)

Coordinate returns the value of the "coordinate" field in the mutation.

func (*LocationMutation) CoordinateCleared

func (m *LocationMutation) CoordinateCleared() bool

CoordinateCleared returns if the "coordinate" field was cleared in this mutation.

func (*LocationMutation) DeduplicationKey

func (m *LocationMutation) DeduplicationKey() (r string, exists bool)

DeduplicationKey returns the value of the "deduplication_key" field in the mutation.

func (*LocationMutation) EdgeCleared

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

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

func (*LocationMutation) Field

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

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

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

func (*LocationMutation) Fields

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

func (m *LocationMutation) ID() (id string, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*LocationMutation) IDs

func (m *LocationMutation) IDs(ctx context.Context) ([]string, 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 (*LocationMutation) Name

func (m *LocationMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*LocationMutation) OldCoordinate

func (m *LocationMutation) OldCoordinate(ctx context.Context) (v *postgis.PointS, err error)

OldCoordinate returns the old "coordinate" field's value of the Location entity. If the Location 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 (*LocationMutation) OldDeduplicationKey

func (m *LocationMutation) OldDeduplicationKey(ctx context.Context) (v string, err error)

OldDeduplicationKey returns the old "deduplication_key" field's value of the Location entity. If the Location 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 (*LocationMutation) OldField

func (m *LocationMutation) 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 (*LocationMutation) OldName

func (m *LocationMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Location entity. If the Location 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 (*LocationMutation) OldRawAddress

func (m *LocationMutation) OldRawAddress(ctx context.Context) (v string, err error)

OldRawAddress returns the old "raw_address" field's value of the Location entity. If the Location 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 (*LocationMutation) Op

func (m *LocationMutation) Op() Op

Op returns the operation name.

func (*LocationMutation) RawAddress

func (m *LocationMutation) RawAddress() (r string, exists bool)

RawAddress returns the value of the "raw_address" field in the mutation.

func (*LocationMutation) RawAddressCleared

func (m *LocationMutation) RawAddressCleared() bool

RawAddressCleared returns if the "raw_address" field was cleared in this mutation.

func (*LocationMutation) RemoveCabinetIDs

func (m *LocationMutation) RemoveCabinetIDs(ids ...string)

RemoveCabinetIDs removes the "cabinets" edge to the Cabinet entity by IDs.

func (*LocationMutation) RemovedCabinetsIDs

func (m *LocationMutation) RemovedCabinetsIDs() (ids []string)

RemovedCabinets returns the removed IDs of the "cabinets" edge to the Cabinet entity.

func (*LocationMutation) RemovedEdges

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

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

func (*LocationMutation) RemovedIDs

func (m *LocationMutation) 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 (*LocationMutation) ResetCabinets

func (m *LocationMutation) ResetCabinets()

ResetCabinets resets all changes to the "cabinets" edge.

func (*LocationMutation) ResetCoordinate

func (m *LocationMutation) ResetCoordinate()

ResetCoordinate resets all changes to the "coordinate" field.

func (*LocationMutation) ResetDeduplicationKey

func (m *LocationMutation) ResetDeduplicationKey()

ResetDeduplicationKey resets all changes to the "deduplication_key" field.

func (*LocationMutation) ResetEdge

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

func (m *LocationMutation) 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 (*LocationMutation) ResetName

func (m *LocationMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*LocationMutation) ResetRawAddress

func (m *LocationMutation) ResetRawAddress()

ResetRawAddress resets all changes to the "raw_address" field.

func (*LocationMutation) SetCoordinate

func (m *LocationMutation) SetCoordinate(po *postgis.PointS)

SetCoordinate sets the "coordinate" field.

func (*LocationMutation) SetDeduplicationKey

func (m *LocationMutation) SetDeduplicationKey(s string)

SetDeduplicationKey sets the "deduplication_key" field.

func (*LocationMutation) SetField

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

func (m *LocationMutation) SetID(id string)

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

func (*LocationMutation) SetName

func (m *LocationMutation) SetName(s string)

SetName sets the "name" field.

func (*LocationMutation) SetOp

func (m *LocationMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*LocationMutation) SetRawAddress

func (m *LocationMutation) SetRawAddress(s string)

SetRawAddress sets the "raw_address" field.

func (LocationMutation) Tx

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

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

func (*LocationMutation) Type

func (m *LocationMutation) Type() string

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

func (*LocationMutation) Where

func (m *LocationMutation) Where(ps ...predicate.Location)

Where appends a list predicates to the LocationMutation builder.

func (*LocationMutation) WhereP

func (m *LocationMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the LocationMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type LocationOrder

type LocationOrder struct {
	Direction OrderDirection      `json:"direction"`
	Field     *LocationOrderField `json:"field"`
}

LocationOrder defines the ordering of Location.

type LocationOrderField

type LocationOrderField struct {
	// Value extracts the ordering value from the given Location.
	Value func(*Location) (ent.Value, error)
	// contains filtered or unexported fields
}

LocationOrderField defines the ordering field of Location.

type LocationPaginateOption

type LocationPaginateOption func(*locationPager) error

LocationPaginateOption enables pagination customization.

func WithLocationFilter

func WithLocationFilter(filter func(*LocationQuery) (*LocationQuery, error)) LocationPaginateOption

WithLocationFilter configures pagination filter.

func WithLocationOrder

func WithLocationOrder(order []*LocationOrder) LocationPaginateOption

WithLocationOrder configures pagination ordering.

type LocationQuery

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

LocationQuery is the builder for querying Location entities.

func (*LocationQuery) Aggregate

func (lq *LocationQuery) Aggregate(fns ...AggregateFunc) *LocationSelect

Aggregate returns a LocationSelect configured with the given aggregations.

func (*LocationQuery) All

func (lq *LocationQuery) All(ctx context.Context) ([]*Location, error)

All executes the query and returns a list of Locations.

func (*LocationQuery) AllX

func (lq *LocationQuery) AllX(ctx context.Context) []*Location

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

func (*LocationQuery) Clone

func (lq *LocationQuery) Clone() *LocationQuery

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

func (*LocationQuery) CollectFields

func (l *LocationQuery) CollectFields(ctx context.Context, satisfies ...string) (*LocationQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*LocationQuery) Count

func (lq *LocationQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LocationQuery) CountX

func (lq *LocationQuery) CountX(ctx context.Context) int

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

func (*LocationQuery) Exist

func (lq *LocationQuery) Exist(ctx context.Context) (bool, error)

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

func (*LocationQuery) ExistX

func (lq *LocationQuery) ExistX(ctx context.Context) bool

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

func (*LocationQuery) First

func (lq *LocationQuery) First(ctx context.Context) (*Location, error)

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

func (*LocationQuery) FirstID

func (lq *LocationQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*LocationQuery) FirstIDX

func (lq *LocationQuery) FirstIDX(ctx context.Context) string

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

func (*LocationQuery) FirstX

func (lq *LocationQuery) FirstX(ctx context.Context) *Location

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

func (*LocationQuery) GroupBy

func (lq *LocationQuery) GroupBy(field string, fields ...string) *LocationGroupBy

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Location.Query().
	GroupBy(location.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*LocationQuery) IDs

func (lq *LocationQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*LocationQuery) IDsX

func (lq *LocationQuery) IDsX(ctx context.Context) []string

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

func (*LocationQuery) Limit

func (lq *LocationQuery) Limit(limit int) *LocationQuery

Limit the number of records to be returned by this query.

func (*LocationQuery) Offset

func (lq *LocationQuery) Offset(offset int) *LocationQuery

Offset to start from.

func (*LocationQuery) Only

func (lq *LocationQuery) Only(ctx context.Context) (*Location, error)

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

func (*LocationQuery) OnlyID

func (lq *LocationQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*LocationQuery) OnlyIDX

func (lq *LocationQuery) OnlyIDX(ctx context.Context) string

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

func (*LocationQuery) OnlyX

func (lq *LocationQuery) OnlyX(ctx context.Context) *Location

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

func (*LocationQuery) Order

Order specifies how the records should be ordered.

func (*LocationQuery) Paginate

func (l *LocationQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...LocationPaginateOption,
) (*LocationConnection, error)

Paginate executes the query and returns a relay based cursor connection to Location.

func (*LocationQuery) QueryCabinets

func (lq *LocationQuery) QueryCabinets() *CabinetQuery

QueryCabinets chains the current query on the "cabinets" edge.

func (*LocationQuery) Select

func (lq *LocationQuery) Select(fields ...string) *LocationSelect

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Location.Query().
	Select(location.FieldName).
	Scan(ctx, &v)

func (*LocationQuery) Unique

func (lq *LocationQuery) Unique(unique bool) *LocationQuery

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

func (lq *LocationQuery) Where(ps ...predicate.Location) *LocationQuery

Where adds a new predicate for the LocationQuery builder.

func (*LocationQuery) WithCabinets

func (lq *LocationQuery) WithCabinets(opts ...func(*CabinetQuery)) *LocationQuery

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

func (*LocationQuery) WithNamedCabinets

func (lq *LocationQuery) WithNamedCabinets(name string, opts ...func(*CabinetQuery)) *LocationQuery

WithNamedCabinets tells the query-builder to eager-load the nodes that are connected to the "cabinets" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type LocationSelect

type LocationSelect struct {
	*LocationQuery
	// contains filtered or unexported fields
}

LocationSelect is the builder for selecting fields of Location entities.

func (*LocationSelect) Aggregate

func (ls *LocationSelect) Aggregate(fns ...AggregateFunc) *LocationSelect

Aggregate adds the given aggregation functions to the selector query.

func (*LocationSelect) Bool

func (s *LocationSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*LocationSelect) BoolX

func (s *LocationSelect) BoolX(ctx context.Context) bool

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

func (*LocationSelect) Bools

func (s *LocationSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*LocationSelect) BoolsX

func (s *LocationSelect) BoolsX(ctx context.Context) []bool

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

func (*LocationSelect) Float64

func (s *LocationSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*LocationSelect) Float64X

func (s *LocationSelect) Float64X(ctx context.Context) float64

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

func (*LocationSelect) Float64s

func (s *LocationSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*LocationSelect) Float64sX

func (s *LocationSelect) Float64sX(ctx context.Context) []float64

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

func (*LocationSelect) Int

func (s *LocationSelect) Int(ctx context.Context) (_ int, err error)

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

func (*LocationSelect) IntX

func (s *LocationSelect) IntX(ctx context.Context) int

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

func (*LocationSelect) Ints

func (s *LocationSelect) Ints(ctx context.Context) ([]int, error)

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

func (*LocationSelect) IntsX

func (s *LocationSelect) IntsX(ctx context.Context) []int

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

func (*LocationSelect) Scan

func (ls *LocationSelect) Scan(ctx context.Context, v any) error

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

func (*LocationSelect) ScanX

func (s *LocationSelect) ScanX(ctx context.Context, v any)

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

func (*LocationSelect) String

func (s *LocationSelect) String(ctx context.Context) (_ string, err error)

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

func (*LocationSelect) StringX

func (s *LocationSelect) StringX(ctx context.Context) string

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

func (*LocationSelect) Strings

func (s *LocationSelect) Strings(ctx context.Context) ([]string, error)

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

func (*LocationSelect) StringsX

func (s *LocationSelect) StringsX(ctx context.Context) []string

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

type LocationUpdate

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

LocationUpdate is the builder for updating Location entities.

func (*LocationUpdate) AddCabinetIDs

func (lu *LocationUpdate) AddCabinetIDs(ids ...string) *LocationUpdate

AddCabinetIDs adds the "cabinets" edge to the Cabinet entity by IDs.

func (*LocationUpdate) AddCabinets

func (lu *LocationUpdate) AddCabinets(c ...*Cabinet) *LocationUpdate

AddCabinets adds the "cabinets" edges to the Cabinet entity.

func (*LocationUpdate) ClearCabinets

func (lu *LocationUpdate) ClearCabinets() *LocationUpdate

ClearCabinets clears all "cabinets" edges to the Cabinet entity.

func (*LocationUpdate) ClearCoordinate

func (lu *LocationUpdate) ClearCoordinate() *LocationUpdate

ClearCoordinate clears the value of the "coordinate" field.

func (*LocationUpdate) ClearRawAddress

func (lu *LocationUpdate) ClearRawAddress() *LocationUpdate

ClearRawAddress clears the value of the "raw_address" field.

func (*LocationUpdate) Exec

func (lu *LocationUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LocationUpdate) ExecX

func (lu *LocationUpdate) ExecX(ctx context.Context)

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

func (*LocationUpdate) Mutation

func (lu *LocationUpdate) Mutation() *LocationMutation

Mutation returns the LocationMutation object of the builder.

func (*LocationUpdate) RemoveCabinetIDs

func (lu *LocationUpdate) RemoveCabinetIDs(ids ...string) *LocationUpdate

RemoveCabinetIDs removes the "cabinets" edge to Cabinet entities by IDs.

func (*LocationUpdate) RemoveCabinets

func (lu *LocationUpdate) RemoveCabinets(c ...*Cabinet) *LocationUpdate

RemoveCabinets removes "cabinets" edges to Cabinet entities.

func (*LocationUpdate) Save

func (lu *LocationUpdate) Save(ctx context.Context) (int, error)

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

func (*LocationUpdate) SaveX

func (lu *LocationUpdate) SaveX(ctx context.Context) int

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

func (*LocationUpdate) SetCoordinate

func (lu *LocationUpdate) SetCoordinate(po *postgis.PointS) *LocationUpdate

SetCoordinate sets the "coordinate" field.

func (*LocationUpdate) SetDeduplicationKey

func (lu *LocationUpdate) SetDeduplicationKey(s string) *LocationUpdate

SetDeduplicationKey sets the "deduplication_key" field.

func (*LocationUpdate) SetName

func (lu *LocationUpdate) SetName(s string) *LocationUpdate

SetName sets the "name" field.

func (*LocationUpdate) SetNillableDeduplicationKey

func (lu *LocationUpdate) SetNillableDeduplicationKey(s *string) *LocationUpdate

SetNillableDeduplicationKey sets the "deduplication_key" field if the given value is not nil.

func (*LocationUpdate) SetNillableName

func (lu *LocationUpdate) SetNillableName(s *string) *LocationUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*LocationUpdate) SetNillableRawAddress

func (lu *LocationUpdate) SetNillableRawAddress(s *string) *LocationUpdate

SetNillableRawAddress sets the "raw_address" field if the given value is not nil.

func (*LocationUpdate) SetRawAddress

func (lu *LocationUpdate) SetRawAddress(s string) *LocationUpdate

SetRawAddress sets the "raw_address" field.

func (*LocationUpdate) Where

func (lu *LocationUpdate) Where(ps ...predicate.Location) *LocationUpdate

Where appends a list predicates to the LocationUpdate builder.

type LocationUpdateOne

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

LocationUpdateOne is the builder for updating a single Location entity.

func (*LocationUpdateOne) AddCabinetIDs

func (luo *LocationUpdateOne) AddCabinetIDs(ids ...string) *LocationUpdateOne

AddCabinetIDs adds the "cabinets" edge to the Cabinet entity by IDs.

func (*LocationUpdateOne) AddCabinets

func (luo *LocationUpdateOne) AddCabinets(c ...*Cabinet) *LocationUpdateOne

AddCabinets adds the "cabinets" edges to the Cabinet entity.

func (*LocationUpdateOne) ClearCabinets

func (luo *LocationUpdateOne) ClearCabinets() *LocationUpdateOne

ClearCabinets clears all "cabinets" edges to the Cabinet entity.

func (*LocationUpdateOne) ClearCoordinate

func (luo *LocationUpdateOne) ClearCoordinate() *LocationUpdateOne

ClearCoordinate clears the value of the "coordinate" field.

func (*LocationUpdateOne) ClearRawAddress

func (luo *LocationUpdateOne) ClearRawAddress() *LocationUpdateOne

ClearRawAddress clears the value of the "raw_address" field.

func (*LocationUpdateOne) Exec

func (luo *LocationUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LocationUpdateOne) ExecX

func (luo *LocationUpdateOne) ExecX(ctx context.Context)

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

func (*LocationUpdateOne) Mutation

func (luo *LocationUpdateOne) Mutation() *LocationMutation

Mutation returns the LocationMutation object of the builder.

func (*LocationUpdateOne) RemoveCabinetIDs

func (luo *LocationUpdateOne) RemoveCabinetIDs(ids ...string) *LocationUpdateOne

RemoveCabinetIDs removes the "cabinets" edge to Cabinet entities by IDs.

func (*LocationUpdateOne) RemoveCabinets

func (luo *LocationUpdateOne) RemoveCabinets(c ...*Cabinet) *LocationUpdateOne

RemoveCabinets removes "cabinets" edges to Cabinet entities.

func (*LocationUpdateOne) Save

func (luo *LocationUpdateOne) Save(ctx context.Context) (*Location, error)

Save executes the query and returns the updated Location entity.

func (*LocationUpdateOne) SaveX

func (luo *LocationUpdateOne) SaveX(ctx context.Context) *Location

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

func (*LocationUpdateOne) Select

func (luo *LocationUpdateOne) Select(field string, fields ...string) *LocationUpdateOne

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

func (*LocationUpdateOne) SetCoordinate

func (luo *LocationUpdateOne) SetCoordinate(po *postgis.PointS) *LocationUpdateOne

SetCoordinate sets the "coordinate" field.

func (*LocationUpdateOne) SetDeduplicationKey

func (luo *LocationUpdateOne) SetDeduplicationKey(s string) *LocationUpdateOne

SetDeduplicationKey sets the "deduplication_key" field.

func (*LocationUpdateOne) SetName

func (luo *LocationUpdateOne) SetName(s string) *LocationUpdateOne

SetName sets the "name" field.

func (*LocationUpdateOne) SetNillableDeduplicationKey

func (luo *LocationUpdateOne) SetNillableDeduplicationKey(s *string) *LocationUpdateOne

SetNillableDeduplicationKey sets the "deduplication_key" field if the given value is not nil.

func (*LocationUpdateOne) SetNillableName

func (luo *LocationUpdateOne) SetNillableName(s *string) *LocationUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*LocationUpdateOne) SetNillableRawAddress

func (luo *LocationUpdateOne) SetNillableRawAddress(s *string) *LocationUpdateOne

SetNillableRawAddress sets the "raw_address" field if the given value is not nil.

func (*LocationUpdateOne) SetRawAddress

func (luo *LocationUpdateOne) SetRawAddress(s string) *LocationUpdateOne

SetRawAddress sets the "raw_address" field.

func (*LocationUpdateOne) Where

Where appends a list predicates to the LocationUpdate builder.

type LocationWhereInput

type LocationWhereInput struct {
	Predicates []predicate.Location  `json:"-"`
	Not        *LocationWhereInput   `json:"not,omitempty"`
	Or         []*LocationWhereInput `json:"or,omitempty"`
	And        []*LocationWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID             *string  `json:"id,omitempty"`
	IDNEQ          *string  `json:"idNEQ,omitempty"`
	IDIn           []string `json:"idIn,omitempty"`
	IDNotIn        []string `json:"idNotIn,omitempty"`
	IDGT           *string  `json:"idGT,omitempty"`
	IDGTE          *string  `json:"idGTE,omitempty"`
	IDLT           *string  `json:"idLT,omitempty"`
	IDLTE          *string  `json:"idLTE,omitempty"`
	IDEqualFold    *string  `json:"idEqualFold,omitempty"`
	IDContainsFold *string  `json:"idContainsFold,omitempty"`

	// "name" field predicates.
	Name             *string  `json:"name,omitempty"`
	NameNEQ          *string  `json:"nameNEQ,omitempty"`
	NameIn           []string `json:"nameIn,omitempty"`
	NameNotIn        []string `json:"nameNotIn,omitempty"`
	NameGT           *string  `json:"nameGT,omitempty"`
	NameGTE          *string  `json:"nameGTE,omitempty"`
	NameLT           *string  `json:"nameLT,omitempty"`
	NameLTE          *string  `json:"nameLTE,omitempty"`
	NameContains     *string  `json:"nameContains,omitempty"`
	NameHasPrefix    *string  `json:"nameHasPrefix,omitempty"`
	NameHasSuffix    *string  `json:"nameHasSuffix,omitempty"`
	NameEqualFold    *string  `json:"nameEqualFold,omitempty"`
	NameContainsFold *string  `json:"nameContainsFold,omitempty"`

	// "cabinets" edge predicates.
	HasCabinets     *bool                `json:"hasCabinets,omitempty"`
	HasCabinetsWith []*CabinetWhereInput `json:"hasCabinetsWith,omitempty"`
}

LocationWhereInput represents a where input for filtering Location queries.

func (*LocationWhereInput) AddPredicates

func (i *LocationWhereInput) AddPredicates(predicates ...predicate.Location)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*LocationWhereInput) Filter

Filter applies the LocationWhereInput filter on the LocationQuery builder.

func (*LocationWhereInput) P

P returns a predicate for filtering locations. An error is returned if the input is empty or invalid.

type Locations

type Locations []*Location

Locations is a parsable slice of Location.

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 NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, string) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	IsNode()
}

Noder wraps the basic Node method.

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(...any)) Option

Log sets the logging function for debug mode.

type OrderDirection

type OrderDirection = entgql.OrderDirection

Common entgql types.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type PageInfo

type PageInfo = entgql.PageInfo[string]

Common entgql types.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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 QueryContext

type QueryContext = ent.QueryContext

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 TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Cabinet is the client for interacting with the Cabinet builders.
	Cabinet *CabinetClient
	// Game is the client for interacting with the Game builders.
	Game *GameClient
	// Location is the client for interacting with the Location builders.
	Location *LocationClient
	// 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