ent

package
v0.0.0-...-9cf1cd8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 22 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.
	TypeAccount           = "Account"
	TypeNode              = "Node"
	TypeRegistrationToken = "RegistrationToken"
	TypeServer            = "Server"
)

Variables

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.

Types

type Account

type Account struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Username is the unique username of the account.
	Username string `json:"username,omitempty"`
	// AccessToken is the token used to access the account.
	AccessToken []byte `json:"access_token,omitempty"`
	// RefreshToken is the token used to refresh the account.
	RefreshToken []byte `json:"refresh_token,omitempty"`
	// RegistrationTokenID is the ID of the registration token.
	RegistrationTokenID int `json:"registration_token_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccountQuery when eager-loading is set.
	Edges AccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

Account is the model entity for the Account schema.

func (*Account) QueryNodes

func (a *Account) QueryNodes() *NodeQuery

QueryNodes queries the "nodes" edge of the Account entity.

func (*Account) QueryRegistrationToken

func (a *Account) QueryRegistrationToken() *RegistrationTokenQuery

QueryRegistrationToken queries the "registration_token" edge of the Account entity.

func (*Account) QueryServers

func (a *Account) QueryServers() *ServerQuery

QueryServers queries the "servers" edge of the Account entity.

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer.

func (*Account) Unwrap

func (a *Account) Unwrap() *Account

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

func (a *Account) Update() *AccountUpdateOne

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

func (*Account) Value

func (a *Account) Value(name string) (ent.Value, error)

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

type AccountClient

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

AccountClient is a client for the Account schema.

func NewAccountClient

func NewAccountClient(c config) *AccountClient

NewAccountClient returns a client for the Account from the given config.

func (*AccountClient) Create

func (c *AccountClient) Create() *AccountCreate

Create returns a builder for creating a Account entity.

func (*AccountClient) CreateBulk

func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk

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

func (*AccountClient) Delete

func (c *AccountClient) Delete() *AccountDelete

Delete returns a delete builder for Account.

func (*AccountClient) DeleteOne

func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccountClient) DeleteOneID

func (c *AccountClient) DeleteOneID(id int) *AccountDeleteOne

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

func (*AccountClient) Get

func (c *AccountClient) Get(ctx context.Context, id int) (*Account, error)

Get returns a Account entity by its id.

func (*AccountClient) GetX

func (c *AccountClient) GetX(ctx context.Context, id int) *Account

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

func (*AccountClient) Hooks

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

Hooks returns the client hooks.

func (*AccountClient) Intercept

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

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

func (*AccountClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AccountClient) MapCreateBulk

func (c *AccountClient) MapCreateBulk(slice any, setFunc func(*AccountCreate, int)) *AccountCreateBulk

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 (*AccountClient) Query

func (c *AccountClient) Query() *AccountQuery

Query returns a query builder for Account.

func (*AccountClient) QueryNodes

func (c *AccountClient) QueryNodes(a *Account) *NodeQuery

QueryNodes queries the nodes edge of a Account.

func (*AccountClient) QueryRegistrationToken

func (c *AccountClient) QueryRegistrationToken(a *Account) *RegistrationTokenQuery

QueryRegistrationToken queries the registration_token edge of a Account.

func (*AccountClient) QueryServers

func (c *AccountClient) QueryServers(a *Account) *ServerQuery

QueryServers queries the servers edge of a Account.

func (*AccountClient) Update

func (c *AccountClient) Update() *AccountUpdate

Update returns an update builder for Account.

func (*AccountClient) UpdateOne

func (c *AccountClient) UpdateOne(a *Account) *AccountUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountClient) UpdateOneID

func (c *AccountClient) UpdateOneID(id int) *AccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountClient) Use

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

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

type AccountCreate

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

AccountCreate is the builder for creating a Account entity.

func (*AccountCreate) AddNodeIDs

func (ac *AccountCreate) AddNodeIDs(ids ...int) *AccountCreate

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*AccountCreate) AddNodes

func (ac *AccountCreate) AddNodes(n ...*Node) *AccountCreate

AddNodes adds the "nodes" edges to the Node entity.

func (*AccountCreate) AddServerIDs

func (ac *AccountCreate) AddServerIDs(ids ...int) *AccountCreate

AddServerIDs adds the "servers" edge to the Server entity by IDs.

func (*AccountCreate) AddServers

func (ac *AccountCreate) AddServers(s ...*Server) *AccountCreate

AddServers adds the "servers" edges to the Server entity.

func (*AccountCreate) Exec

func (ac *AccountCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountCreate) ExecX

func (ac *AccountCreate) ExecX(ctx context.Context)

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

func (*AccountCreate) Mutation

func (ac *AccountCreate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountCreate) Save

func (ac *AccountCreate) Save(ctx context.Context) (*Account, error)

Save creates the Account in the database.

func (*AccountCreate) SaveX

func (ac *AccountCreate) SaveX(ctx context.Context) *Account

SaveX calls Save and panics if Save returns an error.

func (*AccountCreate) SetAccessToken

func (ac *AccountCreate) SetAccessToken(b []byte) *AccountCreate

SetAccessToken sets the "access_token" field.

func (*AccountCreate) SetCreateTime

func (ac *AccountCreate) SetCreateTime(t time.Time) *AccountCreate

SetCreateTime sets the "create_time" field.

func (*AccountCreate) SetNillableCreateTime

func (ac *AccountCreate) SetNillableCreateTime(t *time.Time) *AccountCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*AccountCreate) SetNillableRegistrationTokenID

func (ac *AccountCreate) SetNillableRegistrationTokenID(i *int) *AccountCreate

SetNillableRegistrationTokenID sets the "registration_token_id" field if the given value is not nil.

func (*AccountCreate) SetNillableUpdateTime

func (ac *AccountCreate) SetNillableUpdateTime(t *time.Time) *AccountCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*AccountCreate) SetRefreshToken

func (ac *AccountCreate) SetRefreshToken(b []byte) *AccountCreate

SetRefreshToken sets the "refresh_token" field.

func (*AccountCreate) SetRegistrationToken

func (ac *AccountCreate) SetRegistrationToken(r *RegistrationToken) *AccountCreate

SetRegistrationToken sets the "registration_token" edge to the RegistrationToken entity.

func (*AccountCreate) SetRegistrationTokenID

func (ac *AccountCreate) SetRegistrationTokenID(i int) *AccountCreate

SetRegistrationTokenID sets the "registration_token_id" field.

func (*AccountCreate) SetUpdateTime

func (ac *AccountCreate) SetUpdateTime(t time.Time) *AccountCreate

SetUpdateTime sets the "update_time" field.

func (*AccountCreate) SetUsername

func (ac *AccountCreate) SetUsername(s string) *AccountCreate

SetUsername sets the "username" field.

type AccountCreateBulk

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

AccountCreateBulk is the builder for creating many Account entities in bulk.

func (*AccountCreateBulk) Exec

func (acb *AccountCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountCreateBulk) ExecX

func (acb *AccountCreateBulk) ExecX(ctx context.Context)

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

func (*AccountCreateBulk) Save

func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error)

Save creates the Account entities in the database.

func (*AccountCreateBulk) SaveX

func (acb *AccountCreateBulk) SaveX(ctx context.Context) []*Account

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

type AccountDelete

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

AccountDelete is the builder for deleting a Account entity.

func (*AccountDelete) Exec

func (ad *AccountDelete) Exec(ctx context.Context) (int, error)

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

func (*AccountDelete) ExecX

func (ad *AccountDelete) ExecX(ctx context.Context) int

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

func (*AccountDelete) Where

func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete

Where appends a list predicates to the AccountDelete builder.

type AccountDeleteOne

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

AccountDeleteOne is the builder for deleting a single Account entity.

func (*AccountDeleteOne) Exec

func (ado *AccountDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccountDeleteOne) ExecX

func (ado *AccountDeleteOne) ExecX(ctx context.Context)

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

func (*AccountDeleteOne) Where

Where appends a list predicates to the AccountDelete builder.

type AccountEdges

type AccountEdges struct {
	// Servers holds the value of the servers edge.
	Servers []*Server `json:"servers,omitempty"`
	// Nodes holds the value of the nodes edge.
	Nodes []*Node `json:"nodes,omitempty"`
	// RegistrationToken holds the value of the registration_token edge.
	RegistrationToken *RegistrationToken `json:"registration_token,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccountEdges) NodesOrErr

func (e AccountEdges) NodesOrErr() ([]*Node, error)

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

func (AccountEdges) RegistrationTokenOrErr

func (e AccountEdges) RegistrationTokenOrErr() (*RegistrationToken, error)

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

func (AccountEdges) ServersOrErr

func (e AccountEdges) ServersOrErr() ([]*Server, error)

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

type AccountGroupBy

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

AccountGroupBy is the group-by builder for Account entities.

func (*AccountGroupBy) Aggregate

func (agb *AccountGroupBy) Aggregate(fns ...AggregateFunc) *AccountGroupBy

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

func (*AccountGroupBy) Bool

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

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

func (*AccountGroupBy) BoolX

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

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

func (*AccountGroupBy) Bools

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

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

func (*AccountGroupBy) BoolsX

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

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

func (*AccountGroupBy) Float64

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

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

func (*AccountGroupBy) Float64X

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

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

func (*AccountGroupBy) Float64s

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

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

func (*AccountGroupBy) Float64sX

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

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

func (*AccountGroupBy) Int

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

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

func (*AccountGroupBy) IntX

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

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

func (*AccountGroupBy) Ints

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

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

func (*AccountGroupBy) IntsX

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

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

func (*AccountGroupBy) Scan

func (agb *AccountGroupBy) Scan(ctx context.Context, v any) error

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

func (*AccountGroupBy) ScanX

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

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

func (*AccountGroupBy) String

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

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

func (*AccountGroupBy) StringX

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

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

func (*AccountGroupBy) Strings

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

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

func (*AccountGroupBy) StringsX

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

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

type AccountMutation

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

AccountMutation represents an operation that mutates the Account nodes in the graph.

func (*AccountMutation) AccessToken

func (m *AccountMutation) AccessToken() (r []byte, exists bool)

AccessToken returns the value of the "access_token" field in the mutation.

func (*AccountMutation) AddField

func (m *AccountMutation) 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 (*AccountMutation) AddNodeIDs

func (m *AccountMutation) AddNodeIDs(ids ...int)

AddNodeIDs adds the "nodes" edge to the Node entity by ids.

func (*AccountMutation) AddServerIDs

func (m *AccountMutation) AddServerIDs(ids ...int)

AddServerIDs adds the "servers" edge to the Server entity by ids.

func (*AccountMutation) AddedEdges

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

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

func (*AccountMutation) AddedField

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

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

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

func (*AccountMutation) AddedIDs

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

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

func (*AccountMutation) ClearEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ClearNodes

func (m *AccountMutation) ClearNodes()

ClearNodes clears the "nodes" edge to the Node entity.

func (*AccountMutation) ClearRegistrationToken

func (m *AccountMutation) ClearRegistrationToken()

ClearRegistrationToken clears the "registration_token" edge to the RegistrationToken entity.

func (*AccountMutation) ClearRegistrationTokenID

func (m *AccountMutation) ClearRegistrationTokenID()

ClearRegistrationTokenID clears the value of the "registration_token_id" field.

func (*AccountMutation) ClearServers

func (m *AccountMutation) ClearServers()

ClearServers clears the "servers" edge to the Server entity.

func (*AccountMutation) ClearedEdges

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

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

func (*AccountMutation) ClearedFields

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

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

func (AccountMutation) Client

func (m AccountMutation) 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 (*AccountMutation) CreateTime

func (m *AccountMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*AccountMutation) EdgeCleared

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

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

func (*AccountMutation) Field

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

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

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

func (*AccountMutation) Fields

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

func (m *AccountMutation) ID() (id int, exists bool)

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

func (*AccountMutation) IDs

func (m *AccountMutation) IDs(ctx context.Context) ([]int, error)

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

func (*AccountMutation) NodesCleared

func (m *AccountMutation) NodesCleared() bool

NodesCleared reports if the "nodes" edge to the Node entity was cleared.

func (*AccountMutation) NodesIDs

func (m *AccountMutation) NodesIDs() (ids []int)

NodesIDs returns the "nodes" edge IDs in the mutation.

func (*AccountMutation) OldAccessToken

func (m *AccountMutation) OldAccessToken(ctx context.Context) (v []byte, err error)

OldAccessToken returns the old "access_token" field's value of the Account entity. If the Account 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 (*AccountMutation) OldCreateTime

func (m *AccountMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Account entity. If the Account 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 (*AccountMutation) OldField

func (m *AccountMutation) 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 (*AccountMutation) OldRefreshToken

func (m *AccountMutation) OldRefreshToken(ctx context.Context) (v []byte, err error)

OldRefreshToken returns the old "refresh_token" field's value of the Account entity. If the Account 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 (*AccountMutation) OldRegistrationTokenID

func (m *AccountMutation) OldRegistrationTokenID(ctx context.Context) (v int, err error)

OldRegistrationTokenID returns the old "registration_token_id" field's value of the Account entity. If the Account 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 (*AccountMutation) OldUpdateTime

func (m *AccountMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Account entity. If the Account 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 (*AccountMutation) OldUsername

func (m *AccountMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the Account entity. If the Account 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 (*AccountMutation) Op

func (m *AccountMutation) Op() Op

Op returns the operation name.

func (*AccountMutation) RefreshToken

func (m *AccountMutation) RefreshToken() (r []byte, exists bool)

RefreshToken returns the value of the "refresh_token" field in the mutation.

func (*AccountMutation) RegistrationTokenCleared

func (m *AccountMutation) RegistrationTokenCleared() bool

RegistrationTokenCleared reports if the "registration_token" edge to the RegistrationToken entity was cleared.

func (*AccountMutation) RegistrationTokenID

func (m *AccountMutation) RegistrationTokenID() (r int, exists bool)

RegistrationTokenID returns the value of the "registration_token_id" field in the mutation.

func (*AccountMutation) RegistrationTokenIDCleared

func (m *AccountMutation) RegistrationTokenIDCleared() bool

RegistrationTokenIDCleared returns if the "registration_token_id" field was cleared in this mutation.

func (*AccountMutation) RegistrationTokenIDs

func (m *AccountMutation) RegistrationTokenIDs() (ids []int)

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

func (*AccountMutation) RemoveNodeIDs

func (m *AccountMutation) RemoveNodeIDs(ids ...int)

RemoveNodeIDs removes the "nodes" edge to the Node entity by IDs.

func (*AccountMutation) RemoveServerIDs

func (m *AccountMutation) RemoveServerIDs(ids ...int)

RemoveServerIDs removes the "servers" edge to the Server entity by IDs.

func (*AccountMutation) RemovedEdges

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

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

func (*AccountMutation) RemovedIDs

func (m *AccountMutation) 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 (*AccountMutation) RemovedNodesIDs

func (m *AccountMutation) RemovedNodesIDs() (ids []int)

RemovedNodes returns the removed IDs of the "nodes" edge to the Node entity.

func (*AccountMutation) RemovedServersIDs

func (m *AccountMutation) RemovedServersIDs() (ids []int)

RemovedServers returns the removed IDs of the "servers" edge to the Server entity.

func (*AccountMutation) ResetAccessToken

func (m *AccountMutation) ResetAccessToken()

ResetAccessToken resets all changes to the "access_token" field.

func (*AccountMutation) ResetCreateTime

func (m *AccountMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*AccountMutation) ResetEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ResetNodes

func (m *AccountMutation) ResetNodes()

ResetNodes resets all changes to the "nodes" edge.

func (*AccountMutation) ResetRefreshToken

func (m *AccountMutation) ResetRefreshToken()

ResetRefreshToken resets all changes to the "refresh_token" field.

func (*AccountMutation) ResetRegistrationToken

func (m *AccountMutation) ResetRegistrationToken()

ResetRegistrationToken resets all changes to the "registration_token" edge.

func (*AccountMutation) ResetRegistrationTokenID

func (m *AccountMutation) ResetRegistrationTokenID()

ResetRegistrationTokenID resets all changes to the "registration_token_id" field.

func (*AccountMutation) ResetServers

func (m *AccountMutation) ResetServers()

ResetServers resets all changes to the "servers" edge.

func (*AccountMutation) ResetUpdateTime

func (m *AccountMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*AccountMutation) ResetUsername

func (m *AccountMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*AccountMutation) ServersCleared

func (m *AccountMutation) ServersCleared() bool

ServersCleared reports if the "servers" edge to the Server entity was cleared.

func (*AccountMutation) ServersIDs

func (m *AccountMutation) ServersIDs() (ids []int)

ServersIDs returns the "servers" edge IDs in the mutation.

func (*AccountMutation) SetAccessToken

func (m *AccountMutation) SetAccessToken(b []byte)

SetAccessToken sets the "access_token" field.

func (*AccountMutation) SetCreateTime

func (m *AccountMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*AccountMutation) SetField

func (m *AccountMutation) 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 (*AccountMutation) SetOp

func (m *AccountMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AccountMutation) SetRefreshToken

func (m *AccountMutation) SetRefreshToken(b []byte)

SetRefreshToken sets the "refresh_token" field.

func (*AccountMutation) SetRegistrationTokenID

func (m *AccountMutation) SetRegistrationTokenID(i int)

SetRegistrationTokenID sets the "registration_token_id" field.

func (*AccountMutation) SetUpdateTime

func (m *AccountMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*AccountMutation) SetUsername

func (m *AccountMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (AccountMutation) Tx

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

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

func (*AccountMutation) Type

func (m *AccountMutation) Type() string

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

func (*AccountMutation) UpdateTime

func (m *AccountMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*AccountMutation) Username

func (m *AccountMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*AccountMutation) Where

func (m *AccountMutation) Where(ps ...predicate.Account)

Where appends a list predicates to the AccountMutation builder.

func (*AccountMutation) WhereP

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

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

type AccountQuery

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

AccountQuery is the builder for querying Account entities.

func (*AccountQuery) Aggregate

func (aq *AccountQuery) Aggregate(fns ...AggregateFunc) *AccountSelect

Aggregate returns a AccountSelect configured with the given aggregations.

func (*AccountQuery) All

func (aq *AccountQuery) All(ctx context.Context) ([]*Account, error)

All executes the query and returns a list of Accounts.

func (*AccountQuery) AllX

func (aq *AccountQuery) AllX(ctx context.Context) []*Account

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

func (*AccountQuery) Clone

func (aq *AccountQuery) Clone() *AccountQuery

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

func (*AccountQuery) Count

func (aq *AccountQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccountQuery) CountX

func (aq *AccountQuery) CountX(ctx context.Context) int

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

func (*AccountQuery) Exist

func (aq *AccountQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccountQuery) ExistX

func (aq *AccountQuery) ExistX(ctx context.Context) bool

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

func (*AccountQuery) First

func (aq *AccountQuery) First(ctx context.Context) (*Account, error)

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

func (*AccountQuery) FirstID

func (aq *AccountQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AccountQuery) FirstIDX

func (aq *AccountQuery) FirstIDX(ctx context.Context) int

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

func (*AccountQuery) FirstX

func (aq *AccountQuery) FirstX(ctx context.Context) *Account

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

func (*AccountQuery) GroupBy

func (aq *AccountQuery) GroupBy(field string, fields ...string) *AccountGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Account.Query().
	GroupBy(account.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccountQuery) IDs

func (aq *AccountQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*AccountQuery) IDsX

func (aq *AccountQuery) IDsX(ctx context.Context) []int

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

func (*AccountQuery) Limit

func (aq *AccountQuery) Limit(limit int) *AccountQuery

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

func (*AccountQuery) Offset

func (aq *AccountQuery) Offset(offset int) *AccountQuery

Offset to start from.

func (*AccountQuery) Only

func (aq *AccountQuery) Only(ctx context.Context) (*Account, error)

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

func (*AccountQuery) OnlyID

func (aq *AccountQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AccountQuery) OnlyIDX

func (aq *AccountQuery) OnlyIDX(ctx context.Context) int

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

func (*AccountQuery) OnlyX

func (aq *AccountQuery) OnlyX(ctx context.Context) *Account

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

func (*AccountQuery) Order

func (aq *AccountQuery) Order(o ...account.OrderOption) *AccountQuery

Order specifies how the records should be ordered.

func (*AccountQuery) QueryNodes

func (aq *AccountQuery) QueryNodes() *NodeQuery

QueryNodes chains the current query on the "nodes" edge.

func (*AccountQuery) QueryRegistrationToken

func (aq *AccountQuery) QueryRegistrationToken() *RegistrationTokenQuery

QueryRegistrationToken chains the current query on the "registration_token" edge.

func (*AccountQuery) QueryServers

func (aq *AccountQuery) QueryServers() *ServerQuery

QueryServers chains the current query on the "servers" edge.

func (*AccountQuery) Select

func (aq *AccountQuery) Select(fields ...string) *AccountSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Account.Query().
	Select(account.FieldCreateTime).
	Scan(ctx, &v)

func (*AccountQuery) Unique

func (aq *AccountQuery) Unique(unique bool) *AccountQuery

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

func (aq *AccountQuery) Where(ps ...predicate.Account) *AccountQuery

Where adds a new predicate for the AccountQuery builder.

func (*AccountQuery) WithNodes

func (aq *AccountQuery) WithNodes(opts ...func(*NodeQuery)) *AccountQuery

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

func (*AccountQuery) WithRegistrationToken

func (aq *AccountQuery) WithRegistrationToken(opts ...func(*RegistrationTokenQuery)) *AccountQuery

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

func (*AccountQuery) WithServers

func (aq *AccountQuery) WithServers(opts ...func(*ServerQuery)) *AccountQuery

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

type AccountSelect

type AccountSelect struct {
	*AccountQuery
	// contains filtered or unexported fields
}

AccountSelect is the builder for selecting fields of Account entities.

func (*AccountSelect) Aggregate

func (as *AccountSelect) Aggregate(fns ...AggregateFunc) *AccountSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AccountSelect) Bool

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

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

func (*AccountSelect) BoolX

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

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

func (*AccountSelect) Bools

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

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

func (*AccountSelect) BoolsX

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

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

func (*AccountSelect) Float64

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

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

func (*AccountSelect) Float64X

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

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

func (*AccountSelect) Float64s

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

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

func (*AccountSelect) Float64sX

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

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

func (*AccountSelect) Int

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

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

func (*AccountSelect) IntX

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

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

func (*AccountSelect) Ints

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

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

func (*AccountSelect) IntsX

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

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

func (*AccountSelect) Scan

func (as *AccountSelect) Scan(ctx context.Context, v any) error

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

func (*AccountSelect) ScanX

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

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

func (*AccountSelect) String

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

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

func (*AccountSelect) StringX

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

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

func (*AccountSelect) Strings

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

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

func (*AccountSelect) StringsX

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

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

type AccountUpdate

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

AccountUpdate is the builder for updating Account entities.

func (*AccountUpdate) AddNodeIDs

func (au *AccountUpdate) AddNodeIDs(ids ...int) *AccountUpdate

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*AccountUpdate) AddNodes

func (au *AccountUpdate) AddNodes(n ...*Node) *AccountUpdate

AddNodes adds the "nodes" edges to the Node entity.

func (*AccountUpdate) AddServerIDs

func (au *AccountUpdate) AddServerIDs(ids ...int) *AccountUpdate

AddServerIDs adds the "servers" edge to the Server entity by IDs.

func (*AccountUpdate) AddServers

func (au *AccountUpdate) AddServers(s ...*Server) *AccountUpdate

AddServers adds the "servers" edges to the Server entity.

func (*AccountUpdate) ClearNodes

func (au *AccountUpdate) ClearNodes() *AccountUpdate

ClearNodes clears all "nodes" edges to the Node entity.

func (*AccountUpdate) ClearRegistrationToken

func (au *AccountUpdate) ClearRegistrationToken() *AccountUpdate

ClearRegistrationToken clears the "registration_token" edge to the RegistrationToken entity.

func (*AccountUpdate) ClearRegistrationTokenID

func (au *AccountUpdate) ClearRegistrationTokenID() *AccountUpdate

ClearRegistrationTokenID clears the value of the "registration_token_id" field.

func (*AccountUpdate) ClearServers

func (au *AccountUpdate) ClearServers() *AccountUpdate

ClearServers clears all "servers" edges to the Server entity.

func (*AccountUpdate) Exec

func (au *AccountUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUpdate) ExecX

func (au *AccountUpdate) ExecX(ctx context.Context)

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

func (*AccountUpdate) Mutation

func (au *AccountUpdate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdate) RemoveNodeIDs

func (au *AccountUpdate) RemoveNodeIDs(ids ...int) *AccountUpdate

RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.

func (*AccountUpdate) RemoveNodes

func (au *AccountUpdate) RemoveNodes(n ...*Node) *AccountUpdate

RemoveNodes removes "nodes" edges to Node entities.

func (*AccountUpdate) RemoveServerIDs

func (au *AccountUpdate) RemoveServerIDs(ids ...int) *AccountUpdate

RemoveServerIDs removes the "servers" edge to Server entities by IDs.

func (*AccountUpdate) RemoveServers

func (au *AccountUpdate) RemoveServers(s ...*Server) *AccountUpdate

RemoveServers removes "servers" edges to Server entities.

func (*AccountUpdate) Save

func (au *AccountUpdate) Save(ctx context.Context) (int, error)

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

func (*AccountUpdate) SaveX

func (au *AccountUpdate) SaveX(ctx context.Context) int

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

func (*AccountUpdate) SetAccessToken

func (au *AccountUpdate) SetAccessToken(b []byte) *AccountUpdate

SetAccessToken sets the "access_token" field.

func (*AccountUpdate) SetNillableRegistrationTokenID

func (au *AccountUpdate) SetNillableRegistrationTokenID(i *int) *AccountUpdate

SetNillableRegistrationTokenID sets the "registration_token_id" field if the given value is not nil.

func (*AccountUpdate) SetNillableUsername

func (au *AccountUpdate) SetNillableUsername(s *string) *AccountUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AccountUpdate) SetRefreshToken

func (au *AccountUpdate) SetRefreshToken(b []byte) *AccountUpdate

SetRefreshToken sets the "refresh_token" field.

func (*AccountUpdate) SetRegistrationToken

func (au *AccountUpdate) SetRegistrationToken(r *RegistrationToken) *AccountUpdate

SetRegistrationToken sets the "registration_token" edge to the RegistrationToken entity.

func (*AccountUpdate) SetRegistrationTokenID

func (au *AccountUpdate) SetRegistrationTokenID(i int) *AccountUpdate

SetRegistrationTokenID sets the "registration_token_id" field.

func (*AccountUpdate) SetUpdateTime

func (au *AccountUpdate) SetUpdateTime(t time.Time) *AccountUpdate

SetUpdateTime sets the "update_time" field.

func (*AccountUpdate) SetUsername

func (au *AccountUpdate) SetUsername(s string) *AccountUpdate

SetUsername sets the "username" field.

func (*AccountUpdate) Where

func (au *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate

Where appends a list predicates to the AccountUpdate builder.

type AccountUpdateOne

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

AccountUpdateOne is the builder for updating a single Account entity.

func (*AccountUpdateOne) AddNodeIDs

func (auo *AccountUpdateOne) AddNodeIDs(ids ...int) *AccountUpdateOne

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*AccountUpdateOne) AddNodes

func (auo *AccountUpdateOne) AddNodes(n ...*Node) *AccountUpdateOne

AddNodes adds the "nodes" edges to the Node entity.

func (*AccountUpdateOne) AddServerIDs

func (auo *AccountUpdateOne) AddServerIDs(ids ...int) *AccountUpdateOne

AddServerIDs adds the "servers" edge to the Server entity by IDs.

func (*AccountUpdateOne) AddServers

func (auo *AccountUpdateOne) AddServers(s ...*Server) *AccountUpdateOne

AddServers adds the "servers" edges to the Server entity.

func (*AccountUpdateOne) ClearNodes

func (auo *AccountUpdateOne) ClearNodes() *AccountUpdateOne

ClearNodes clears all "nodes" edges to the Node entity.

func (*AccountUpdateOne) ClearRegistrationToken

func (auo *AccountUpdateOne) ClearRegistrationToken() *AccountUpdateOne

ClearRegistrationToken clears the "registration_token" edge to the RegistrationToken entity.

func (*AccountUpdateOne) ClearRegistrationTokenID

func (auo *AccountUpdateOne) ClearRegistrationTokenID() *AccountUpdateOne

ClearRegistrationTokenID clears the value of the "registration_token_id" field.

func (*AccountUpdateOne) ClearServers

func (auo *AccountUpdateOne) ClearServers() *AccountUpdateOne

ClearServers clears all "servers" edges to the Server entity.

func (*AccountUpdateOne) Exec

func (auo *AccountUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccountUpdateOne) ExecX

func (auo *AccountUpdateOne) ExecX(ctx context.Context)

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

func (*AccountUpdateOne) Mutation

func (auo *AccountUpdateOne) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdateOne) RemoveNodeIDs

func (auo *AccountUpdateOne) RemoveNodeIDs(ids ...int) *AccountUpdateOne

RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.

func (*AccountUpdateOne) RemoveNodes

func (auo *AccountUpdateOne) RemoveNodes(n ...*Node) *AccountUpdateOne

RemoveNodes removes "nodes" edges to Node entities.

func (*AccountUpdateOne) RemoveServerIDs

func (auo *AccountUpdateOne) RemoveServerIDs(ids ...int) *AccountUpdateOne

RemoveServerIDs removes the "servers" edge to Server entities by IDs.

func (*AccountUpdateOne) RemoveServers

func (auo *AccountUpdateOne) RemoveServers(s ...*Server) *AccountUpdateOne

RemoveServers removes "servers" edges to Server entities.

func (*AccountUpdateOne) Save

func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error)

Save executes the query and returns the updated Account entity.

func (*AccountUpdateOne) SaveX

func (auo *AccountUpdateOne) SaveX(ctx context.Context) *Account

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

func (*AccountUpdateOne) Select

func (auo *AccountUpdateOne) Select(field string, fields ...string) *AccountUpdateOne

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

func (*AccountUpdateOne) SetAccessToken

func (auo *AccountUpdateOne) SetAccessToken(b []byte) *AccountUpdateOne

SetAccessToken sets the "access_token" field.

func (*AccountUpdateOne) SetNillableRegistrationTokenID

func (auo *AccountUpdateOne) SetNillableRegistrationTokenID(i *int) *AccountUpdateOne

SetNillableRegistrationTokenID sets the "registration_token_id" field if the given value is not nil.

func (*AccountUpdateOne) SetNillableUsername

func (auo *AccountUpdateOne) SetNillableUsername(s *string) *AccountUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AccountUpdateOne) SetRefreshToken

func (auo *AccountUpdateOne) SetRefreshToken(b []byte) *AccountUpdateOne

SetRefreshToken sets the "refresh_token" field.

func (*AccountUpdateOne) SetRegistrationToken

func (auo *AccountUpdateOne) SetRegistrationToken(r *RegistrationToken) *AccountUpdateOne

SetRegistrationToken sets the "registration_token" edge to the RegistrationToken entity.

func (*AccountUpdateOne) SetRegistrationTokenID

func (auo *AccountUpdateOne) SetRegistrationTokenID(i int) *AccountUpdateOne

SetRegistrationTokenID sets the "registration_token_id" field.

func (*AccountUpdateOne) SetUpdateTime

func (auo *AccountUpdateOne) SetUpdateTime(t time.Time) *AccountUpdateOne

SetUpdateTime sets the "update_time" field.

func (*AccountUpdateOne) SetUsername

func (auo *AccountUpdateOne) SetUsername(s string) *AccountUpdateOne

SetUsername sets the "username" field.

func (*AccountUpdateOne) Where

Where appends a list predicates to the AccountUpdate builder.

type Accounts

type Accounts []*Account

Accounts is a parsable slice of Account.

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// RegistrationToken is the client for interacting with the RegistrationToken builders.
	RegistrationToken *RegistrationTokenClient
	// Server is the client for interacting with the Server builders.
	Server *ServerClient
	// 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().
	Account.
	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) 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 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 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 Node

type Node struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name is the unique name of the node.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NodeQuery when eager-loading is set.
	Edges NodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Node is the model entity for the Node schema.

func (*Node) QueryAccount

func (n *Node) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Node entity.

func (*Node) QueryServer

func (n *Node) QueryServer() *ServerQuery

QueryServer queries the "server" edge of the Node entity.

func (*Node) String

func (n *Node) String() string

String implements the fmt.Stringer.

func (*Node) Unwrap

func (n *Node) Unwrap() *Node

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

func (n *Node) Update() *NodeUpdateOne

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

func (*Node) Value

func (n *Node) Value(name string) (ent.Value, error)

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

type NodeClient

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

NodeClient is a client for the Node schema.

func NewNodeClient

func NewNodeClient(c config) *NodeClient

NewNodeClient returns a client for the Node from the given config.

func (*NodeClient) Create

func (c *NodeClient) Create() *NodeCreate

Create returns a builder for creating a Node entity.

func (*NodeClient) CreateBulk

func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk

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

func (*NodeClient) Delete

func (c *NodeClient) Delete() *NodeDelete

Delete returns a delete builder for Node.

func (*NodeClient) DeleteOne

func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*NodeClient) DeleteOneID

func (c *NodeClient) DeleteOneID(id int) *NodeDeleteOne

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

func (*NodeClient) Get

func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error)

Get returns a Node entity by its id.

func (*NodeClient) GetX

func (c *NodeClient) GetX(ctx context.Context, id int) *Node

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

func (*NodeClient) Hooks

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

Hooks returns the client hooks.

func (*NodeClient) Intercept

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

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

func (*NodeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*NodeClient) MapCreateBulk

func (c *NodeClient) MapCreateBulk(slice any, setFunc func(*NodeCreate, int)) *NodeCreateBulk

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 (*NodeClient) Query

func (c *NodeClient) Query() *NodeQuery

Query returns a query builder for Node.

func (*NodeClient) QueryAccount

func (c *NodeClient) QueryAccount(n *Node) *AccountQuery

QueryAccount queries the account edge of a Node.

func (*NodeClient) QueryServer

func (c *NodeClient) QueryServer(n *Node) *ServerQuery

QueryServer queries the server edge of a Node.

func (*NodeClient) Update

func (c *NodeClient) Update() *NodeUpdate

Update returns an update builder for Node.

func (*NodeClient) UpdateOne

func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NodeClient) UpdateOneID

func (c *NodeClient) UpdateOneID(id int) *NodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NodeClient) Use

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

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

type NodeCreate

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

NodeCreate is the builder for creating a Node entity.

func (*NodeCreate) Exec

func (nc *NodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreate) ExecX

func (nc *NodeCreate) ExecX(ctx context.Context)

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

func (*NodeCreate) Mutation

func (nc *NodeCreate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeCreate) Save

func (nc *NodeCreate) Save(ctx context.Context) (*Node, error)

Save creates the Node in the database.

func (*NodeCreate) SaveX

func (nc *NodeCreate) SaveX(ctx context.Context) *Node

SaveX calls Save and panics if Save returns an error.

func (*NodeCreate) SetAccount

func (nc *NodeCreate) SetAccount(a *Account) *NodeCreate

SetAccount sets the "account" edge to the Account entity.

func (*NodeCreate) SetAccountID

func (nc *NodeCreate) SetAccountID(id int) *NodeCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*NodeCreate) SetCreateTime

func (nc *NodeCreate) SetCreateTime(t time.Time) *NodeCreate

SetCreateTime sets the "create_time" field.

func (*NodeCreate) SetName

func (nc *NodeCreate) SetName(s string) *NodeCreate

SetName sets the "name" field.

func (*NodeCreate) SetNillableCreateTime

func (nc *NodeCreate) SetNillableCreateTime(t *time.Time) *NodeCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*NodeCreate) SetNillableUpdateTime

func (nc *NodeCreate) SetNillableUpdateTime(t *time.Time) *NodeCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*NodeCreate) SetServer

func (nc *NodeCreate) SetServer(s *Server) *NodeCreate

SetServer sets the "server" edge to the Server entity.

func (*NodeCreate) SetServerID

func (nc *NodeCreate) SetServerID(id int) *NodeCreate

SetServerID sets the "server" edge to the Server entity by ID.

func (*NodeCreate) SetUpdateTime

func (nc *NodeCreate) SetUpdateTime(t time.Time) *NodeCreate

SetUpdateTime sets the "update_time" field.

type NodeCreateBulk

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

NodeCreateBulk is the builder for creating many Node entities in bulk.

func (*NodeCreateBulk) Exec

func (ncb *NodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreateBulk) ExecX

func (ncb *NodeCreateBulk) ExecX(ctx context.Context)

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

func (*NodeCreateBulk) Save

func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)

Save creates the Node entities in the database.

func (*NodeCreateBulk) SaveX

func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node

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

type NodeDelete

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

NodeDelete is the builder for deleting a Node entity.

func (*NodeDelete) Exec

func (nd *NodeDelete) Exec(ctx context.Context) (int, error)

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

func (*NodeDelete) ExecX

func (nd *NodeDelete) ExecX(ctx context.Context) int

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

func (*NodeDelete) Where

func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete

Where appends a list predicates to the NodeDelete builder.

type NodeDeleteOne

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

NodeDeleteOne is the builder for deleting a single Node entity.

func (*NodeDeleteOne) Exec

func (ndo *NodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NodeDeleteOne) ExecX

func (ndo *NodeDeleteOne) ExecX(ctx context.Context)

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

func (*NodeDeleteOne) Where

func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne

Where appends a list predicates to the NodeDelete builder.

type NodeEdges

type NodeEdges struct {
	// Account holds the value of the account edge.
	Account *Account `json:"account,omitempty"`
	// Server holds the value of the server edge.
	Server *Server `json:"server,omitempty"`
	// contains filtered or unexported fields
}

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

func (NodeEdges) AccountOrErr

func (e NodeEdges) AccountOrErr() (*Account, error)

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

func (NodeEdges) ServerOrErr

func (e NodeEdges) ServerOrErr() (*Server, error)

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

type NodeGroupBy

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

NodeGroupBy is the group-by builder for Node entities.

func (*NodeGroupBy) Aggregate

func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy

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

func (*NodeGroupBy) Bool

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

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

func (*NodeGroupBy) BoolX

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

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

func (*NodeGroupBy) Bools

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

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

func (*NodeGroupBy) BoolsX

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

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

func (*NodeGroupBy) Float64

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

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

func (*NodeGroupBy) Float64X

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

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

func (*NodeGroupBy) Float64s

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

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

func (*NodeGroupBy) Float64sX

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

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

func (*NodeGroupBy) Int

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

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

func (*NodeGroupBy) IntX

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

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

func (*NodeGroupBy) Ints

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

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

func (*NodeGroupBy) IntsX

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

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

func (*NodeGroupBy) Scan

func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error

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

func (*NodeGroupBy) ScanX

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

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

func (*NodeGroupBy) String

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

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

func (*NodeGroupBy) StringX

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

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

func (*NodeGroupBy) Strings

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

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

func (*NodeGroupBy) StringsX

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

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

type NodeMutation

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

NodeMutation represents an operation that mutates the Node nodes in the graph.

func (*NodeMutation) AccountCleared

func (m *NodeMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*NodeMutation) AccountID

func (m *NodeMutation) AccountID() (id int, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*NodeMutation) AccountIDs

func (m *NodeMutation) AccountIDs() (ids []int)

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

func (*NodeMutation) AddField

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

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

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

func (*NodeMutation) AddedField

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

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

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

func (*NodeMutation) AddedIDs

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

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

func (*NodeMutation) ClearAccount

func (m *NodeMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*NodeMutation) ClearEdge

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

func (m *NodeMutation) 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 (*NodeMutation) ClearServer

func (m *NodeMutation) ClearServer()

ClearServer clears the "server" edge to the Server entity.

func (*NodeMutation) ClearedEdges

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

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

func (*NodeMutation) ClearedFields

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

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

func (NodeMutation) Client

func (m NodeMutation) 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 (*NodeMutation) CreateTime

func (m *NodeMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*NodeMutation) EdgeCleared

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

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

func (*NodeMutation) Field

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

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

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

func (*NodeMutation) Fields

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

func (m *NodeMutation) ID() (id int, exists bool)

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

func (*NodeMutation) IDs

func (m *NodeMutation) IDs(ctx context.Context) ([]int, error)

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

func (*NodeMutation) Name

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

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

func (*NodeMutation) OldCreateTime

func (m *NodeMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Node entity. If the Node 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 (*NodeMutation) OldField

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

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

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

func (m *NodeMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Node entity. If the Node 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 (*NodeMutation) Op

func (m *NodeMutation) Op() Op

Op returns the operation name.

func (*NodeMutation) RemovedEdges

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

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

func (*NodeMutation) RemovedIDs

func (m *NodeMutation) 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 (*NodeMutation) ResetAccount

func (m *NodeMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*NodeMutation) ResetCreateTime

func (m *NodeMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*NodeMutation) ResetEdge

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

func (m *NodeMutation) 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 (*NodeMutation) ResetName

func (m *NodeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*NodeMutation) ResetServer

func (m *NodeMutation) ResetServer()

ResetServer resets all changes to the "server" edge.

func (*NodeMutation) ResetUpdateTime

func (m *NodeMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*NodeMutation) ServerCleared

func (m *NodeMutation) ServerCleared() bool

ServerCleared reports if the "server" edge to the Server entity was cleared.

func (*NodeMutation) ServerID

func (m *NodeMutation) ServerID() (id int, exists bool)

ServerID returns the "server" edge ID in the mutation.

func (*NodeMutation) ServerIDs

func (m *NodeMutation) ServerIDs() (ids []int)

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

func (*NodeMutation) SetAccountID

func (m *NodeMutation) SetAccountID(id int)

SetAccountID sets the "account" edge to the Account entity by id.

func (*NodeMutation) SetCreateTime

func (m *NodeMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*NodeMutation) SetField

func (m *NodeMutation) 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 (*NodeMutation) SetName

func (m *NodeMutation) SetName(s string)

SetName sets the "name" field.

func (*NodeMutation) SetOp

func (m *NodeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*NodeMutation) SetServerID

func (m *NodeMutation) SetServerID(id int)

SetServerID sets the "server" edge to the Server entity by id.

func (*NodeMutation) SetUpdateTime

func (m *NodeMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (NodeMutation) Tx

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

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

func (*NodeMutation) Type

func (m *NodeMutation) Type() string

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

func (*NodeMutation) UpdateTime

func (m *NodeMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*NodeMutation) Where

func (m *NodeMutation) Where(ps ...predicate.Node)

Where appends a list predicates to the NodeMutation builder.

func (*NodeMutation) WhereP

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

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

type NodeQuery

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

NodeQuery is the builder for querying Node entities.

func (*NodeQuery) Aggregate

func (nq *NodeQuery) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate returns a NodeSelect configured with the given aggregations.

func (*NodeQuery) All

func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error)

All executes the query and returns a list of Nodes.

func (*NodeQuery) AllX

func (nq *NodeQuery) AllX(ctx context.Context) []*Node

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

func (*NodeQuery) Clone

func (nq *NodeQuery) Clone() *NodeQuery

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

func (*NodeQuery) Count

func (nq *NodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NodeQuery) CountX

func (nq *NodeQuery) CountX(ctx context.Context) int

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

func (*NodeQuery) Exist

func (nq *NodeQuery) Exist(ctx context.Context) (bool, error)

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

func (*NodeQuery) ExistX

func (nq *NodeQuery) ExistX(ctx context.Context) bool

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

func (*NodeQuery) First

func (nq *NodeQuery) First(ctx context.Context) (*Node, error)

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

func (*NodeQuery) FirstID

func (nq *NodeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*NodeQuery) FirstIDX

func (nq *NodeQuery) FirstIDX(ctx context.Context) int

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

func (*NodeQuery) FirstX

func (nq *NodeQuery) FirstX(ctx context.Context) *Node

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

func (*NodeQuery) GroupBy

func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Node.Query().
	GroupBy(node.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*NodeQuery) IDs

func (nq *NodeQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*NodeQuery) IDsX

func (nq *NodeQuery) IDsX(ctx context.Context) []int

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

func (*NodeQuery) Limit

func (nq *NodeQuery) Limit(limit int) *NodeQuery

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

func (*NodeQuery) Offset

func (nq *NodeQuery) Offset(offset int) *NodeQuery

Offset to start from.

func (*NodeQuery) Only

func (nq *NodeQuery) Only(ctx context.Context) (*Node, error)

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

func (*NodeQuery) OnlyID

func (nq *NodeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*NodeQuery) OnlyIDX

func (nq *NodeQuery) OnlyIDX(ctx context.Context) int

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

func (*NodeQuery) OnlyX

func (nq *NodeQuery) OnlyX(ctx context.Context) *Node

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

func (*NodeQuery) Order

func (nq *NodeQuery) Order(o ...node.OrderOption) *NodeQuery

Order specifies how the records should be ordered.

func (*NodeQuery) QueryAccount

func (nq *NodeQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*NodeQuery) QueryServer

func (nq *NodeQuery) QueryServer() *ServerQuery

QueryServer chains the current query on the "server" edge.

func (*NodeQuery) Select

func (nq *NodeQuery) Select(fields ...string) *NodeSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Node.Query().
	Select(node.FieldCreateTime).
	Scan(ctx, &v)

func (*NodeQuery) Unique

func (nq *NodeQuery) Unique(unique bool) *NodeQuery

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

func (nq *NodeQuery) Where(ps ...predicate.Node) *NodeQuery

Where adds a new predicate for the NodeQuery builder.

func (*NodeQuery) WithAccount

func (nq *NodeQuery) WithAccount(opts ...func(*AccountQuery)) *NodeQuery

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

func (*NodeQuery) WithServer

func (nq *NodeQuery) WithServer(opts ...func(*ServerQuery)) *NodeQuery

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

type NodeSelect

type NodeSelect struct {
	*NodeQuery
	// contains filtered or unexported fields
}

NodeSelect is the builder for selecting fields of Node entities.

func (*NodeSelect) Aggregate

func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*NodeSelect) Bool

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

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

func (*NodeSelect) BoolX

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

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

func (*NodeSelect) Bools

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

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

func (*NodeSelect) BoolsX

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

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

func (*NodeSelect) Float64

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

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

func (*NodeSelect) Float64X

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

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

func (*NodeSelect) Float64s

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

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

func (*NodeSelect) Float64sX

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

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

func (*NodeSelect) Int

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

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

func (*NodeSelect) IntX

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

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

func (*NodeSelect) Ints

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

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

func (*NodeSelect) IntsX

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

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

func (*NodeSelect) Scan

func (ns *NodeSelect) Scan(ctx context.Context, v any) error

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

func (*NodeSelect) ScanX

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

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

func (*NodeSelect) String

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

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

func (*NodeSelect) StringX

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

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

func (*NodeSelect) Strings

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

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

func (*NodeSelect) StringsX

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

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

type NodeUpdate

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

NodeUpdate is the builder for updating Node entities.

func (*NodeUpdate) ClearAccount

func (nu *NodeUpdate) ClearAccount() *NodeUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*NodeUpdate) ClearServer

func (nu *NodeUpdate) ClearServer() *NodeUpdate

ClearServer clears the "server" edge to the Server entity.

func (*NodeUpdate) Exec

func (nu *NodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeUpdate) ExecX

func (nu *NodeUpdate) ExecX(ctx context.Context)

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

func (*NodeUpdate) Mutation

func (nu *NodeUpdate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdate) Save

func (nu *NodeUpdate) Save(ctx context.Context) (int, error)

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

func (*NodeUpdate) SaveX

func (nu *NodeUpdate) SaveX(ctx context.Context) int

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

func (*NodeUpdate) SetAccount

func (nu *NodeUpdate) SetAccount(a *Account) *NodeUpdate

SetAccount sets the "account" edge to the Account entity.

func (*NodeUpdate) SetAccountID

func (nu *NodeUpdate) SetAccountID(id int) *NodeUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*NodeUpdate) SetName

func (nu *NodeUpdate) SetName(s string) *NodeUpdate

SetName sets the "name" field.

func (*NodeUpdate) SetNillableName

func (nu *NodeUpdate) SetNillableName(s *string) *NodeUpdate

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

func (*NodeUpdate) SetServer

func (nu *NodeUpdate) SetServer(s *Server) *NodeUpdate

SetServer sets the "server" edge to the Server entity.

func (*NodeUpdate) SetServerID

func (nu *NodeUpdate) SetServerID(id int) *NodeUpdate

SetServerID sets the "server" edge to the Server entity by ID.

func (*NodeUpdate) SetUpdateTime

func (nu *NodeUpdate) SetUpdateTime(t time.Time) *NodeUpdate

SetUpdateTime sets the "update_time" field.

func (*NodeUpdate) Where

func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate

Where appends a list predicates to the NodeUpdate builder.

type NodeUpdateOne

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

NodeUpdateOne is the builder for updating a single Node entity.

func (*NodeUpdateOne) ClearAccount

func (nuo *NodeUpdateOne) ClearAccount() *NodeUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*NodeUpdateOne) ClearServer

func (nuo *NodeUpdateOne) ClearServer() *NodeUpdateOne

ClearServer clears the "server" edge to the Server entity.

func (*NodeUpdateOne) Exec

func (nuo *NodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NodeUpdateOne) ExecX

func (nuo *NodeUpdateOne) ExecX(ctx context.Context)

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

func (*NodeUpdateOne) Mutation

func (nuo *NodeUpdateOne) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdateOne) Save

func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error)

Save executes the query and returns the updated Node entity.

func (*NodeUpdateOne) SaveX

func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node

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

func (*NodeUpdateOne) Select

func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne

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

func (*NodeUpdateOne) SetAccount

func (nuo *NodeUpdateOne) SetAccount(a *Account) *NodeUpdateOne

SetAccount sets the "account" edge to the Account entity.

func (*NodeUpdateOne) SetAccountID

func (nuo *NodeUpdateOne) SetAccountID(id int) *NodeUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*NodeUpdateOne) SetName

func (nuo *NodeUpdateOne) SetName(s string) *NodeUpdateOne

SetName sets the "name" field.

func (*NodeUpdateOne) SetNillableName

func (nuo *NodeUpdateOne) SetNillableName(s *string) *NodeUpdateOne

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

func (*NodeUpdateOne) SetServer

func (nuo *NodeUpdateOne) SetServer(s *Server) *NodeUpdateOne

SetServer sets the "server" edge to the Server entity.

func (*NodeUpdateOne) SetServerID

func (nuo *NodeUpdateOne) SetServerID(id int) *NodeUpdateOne

SetServerID sets the "server" edge to the Server entity by ID.

func (*NodeUpdateOne) SetUpdateTime

func (nuo *NodeUpdateOne) SetUpdateTime(t time.Time) *NodeUpdateOne

SetUpdateTime sets the "update_time" field.

func (*NodeUpdateOne) Where

func (nuo *NodeUpdateOne) Where(ps ...predicate.Node) *NodeUpdateOne

Where appends a list predicates to the NodeUpdate builder.

type Nodes

type Nodes []*Node

Nodes is a parsable slice of Node.

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 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 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 RegistrationToken

type RegistrationToken struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name is the unique name of the registration token.
	Name string `json:"name,omitempty"`
	// Token is the registration token.
	Token []byte `json:"token,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RegistrationTokenQuery when eager-loading is set.
	Edges RegistrationTokenEdges `json:"edges"`
	// contains filtered or unexported fields
}

RegistrationToken is the model entity for the RegistrationToken schema.

func (*RegistrationToken) QueryRegistrations

func (rt *RegistrationToken) QueryRegistrations() *AccountQuery

QueryRegistrations queries the "registrations" edge of the RegistrationToken entity.

func (*RegistrationToken) String

func (rt *RegistrationToken) String() string

String implements the fmt.Stringer.

func (*RegistrationToken) Unwrap

func (rt *RegistrationToken) Unwrap() *RegistrationToken

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

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

func (*RegistrationToken) Value

func (rt *RegistrationToken) Value(name string) (ent.Value, error)

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

type RegistrationTokenClient

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

RegistrationTokenClient is a client for the RegistrationToken schema.

func NewRegistrationTokenClient

func NewRegistrationTokenClient(c config) *RegistrationTokenClient

NewRegistrationTokenClient returns a client for the RegistrationToken from the given config.

func (*RegistrationTokenClient) Create

Create returns a builder for creating a RegistrationToken entity.

func (*RegistrationTokenClient) CreateBulk

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

func (*RegistrationTokenClient) Delete

Delete returns a delete builder for RegistrationToken.

func (*RegistrationTokenClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RegistrationTokenClient) DeleteOneID

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

func (*RegistrationTokenClient) Get

Get returns a RegistrationToken entity by its id.

func (*RegistrationTokenClient) GetX

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

func (*RegistrationTokenClient) Hooks

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

Hooks returns the client hooks.

func (*RegistrationTokenClient) Intercept

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

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

func (*RegistrationTokenClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RegistrationTokenClient) MapCreateBulk

func (c *RegistrationTokenClient) MapCreateBulk(slice any, setFunc func(*RegistrationTokenCreate, int)) *RegistrationTokenCreateBulk

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 (*RegistrationTokenClient) Query

Query returns a query builder for RegistrationToken.

func (*RegistrationTokenClient) QueryRegistrations

func (c *RegistrationTokenClient) QueryRegistrations(rt *RegistrationToken) *AccountQuery

QueryRegistrations queries the registrations edge of a RegistrationToken.

func (*RegistrationTokenClient) Update

Update returns an update builder for RegistrationToken.

func (*RegistrationTokenClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*RegistrationTokenClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*RegistrationTokenClient) Use

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

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

type RegistrationTokenCreate

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

RegistrationTokenCreate is the builder for creating a RegistrationToken entity.

func (*RegistrationTokenCreate) AddRegistrationIDs

func (rtc *RegistrationTokenCreate) AddRegistrationIDs(ids ...int) *RegistrationTokenCreate

AddRegistrationIDs adds the "registrations" edge to the Account entity by IDs.

func (*RegistrationTokenCreate) AddRegistrations

func (rtc *RegistrationTokenCreate) AddRegistrations(a ...*Account) *RegistrationTokenCreate

AddRegistrations adds the "registrations" edges to the Account entity.

func (*RegistrationTokenCreate) Exec

Exec executes the query.

func (*RegistrationTokenCreate) ExecX

func (rtc *RegistrationTokenCreate) ExecX(ctx context.Context)

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

func (*RegistrationTokenCreate) Mutation

Mutation returns the RegistrationTokenMutation object of the builder.

func (*RegistrationTokenCreate) Save

Save creates the RegistrationToken in the database.

func (*RegistrationTokenCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*RegistrationTokenCreate) SetCreateTime

SetCreateTime sets the "create_time" field.

func (*RegistrationTokenCreate) SetName

SetName sets the "name" field.

func (*RegistrationTokenCreate) SetNillableCreateTime

func (rtc *RegistrationTokenCreate) SetNillableCreateTime(t *time.Time) *RegistrationTokenCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*RegistrationTokenCreate) SetNillableUpdateTime

func (rtc *RegistrationTokenCreate) SetNillableUpdateTime(t *time.Time) *RegistrationTokenCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*RegistrationTokenCreate) SetToken

SetToken sets the "token" field.

func (*RegistrationTokenCreate) SetUpdateTime

SetUpdateTime sets the "update_time" field.

type RegistrationTokenCreateBulk

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

RegistrationTokenCreateBulk is the builder for creating many RegistrationToken entities in bulk.

func (*RegistrationTokenCreateBulk) Exec

Exec executes the query.

func (*RegistrationTokenCreateBulk) ExecX

func (rtcb *RegistrationTokenCreateBulk) ExecX(ctx context.Context)

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

func (*RegistrationTokenCreateBulk) Save

Save creates the RegistrationToken entities in the database.

func (*RegistrationTokenCreateBulk) SaveX

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

type RegistrationTokenDelete

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

RegistrationTokenDelete is the builder for deleting a RegistrationToken entity.

func (*RegistrationTokenDelete) Exec

func (rtd *RegistrationTokenDelete) Exec(ctx context.Context) (int, error)

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

func (*RegistrationTokenDelete) ExecX

func (rtd *RegistrationTokenDelete) ExecX(ctx context.Context) int

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

func (*RegistrationTokenDelete) Where

Where appends a list predicates to the RegistrationTokenDelete builder.

type RegistrationTokenDeleteOne

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

RegistrationTokenDeleteOne is the builder for deleting a single RegistrationToken entity.

func (*RegistrationTokenDeleteOne) Exec

Exec executes the deletion query.

func (*RegistrationTokenDeleteOne) ExecX

func (rtdo *RegistrationTokenDeleteOne) ExecX(ctx context.Context)

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

func (*RegistrationTokenDeleteOne) Where

Where appends a list predicates to the RegistrationTokenDelete builder.

type RegistrationTokenEdges

type RegistrationTokenEdges struct {
	// Registrations holds the value of the registrations edge.
	Registrations []*Account `json:"registrations,omitempty"`
	// contains filtered or unexported fields
}

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

func (RegistrationTokenEdges) RegistrationsOrErr

func (e RegistrationTokenEdges) RegistrationsOrErr() ([]*Account, error)

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

type RegistrationTokenGroupBy

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

RegistrationTokenGroupBy is the group-by builder for RegistrationToken entities.

func (*RegistrationTokenGroupBy) Aggregate

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

func (*RegistrationTokenGroupBy) Bool

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

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

func (*RegistrationTokenGroupBy) BoolX

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

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

func (*RegistrationTokenGroupBy) Bools

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

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

func (*RegistrationTokenGroupBy) BoolsX

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

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

func (*RegistrationTokenGroupBy) Float64

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

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

func (*RegistrationTokenGroupBy) Float64X

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

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

func (*RegistrationTokenGroupBy) Float64s

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

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

func (*RegistrationTokenGroupBy) Float64sX

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

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

func (*RegistrationTokenGroupBy) Int

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

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

func (*RegistrationTokenGroupBy) IntX

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

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

func (*RegistrationTokenGroupBy) Ints

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

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

func (*RegistrationTokenGroupBy) IntsX

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

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

func (*RegistrationTokenGroupBy) Scan

func (rtgb *RegistrationTokenGroupBy) Scan(ctx context.Context, v any) error

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

func (*RegistrationTokenGroupBy) ScanX

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

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

func (*RegistrationTokenGroupBy) String

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

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

func (*RegistrationTokenGroupBy) StringX

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

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

func (*RegistrationTokenGroupBy) Strings

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

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

func (*RegistrationTokenGroupBy) StringsX

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

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

type RegistrationTokenMutation

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

RegistrationTokenMutation represents an operation that mutates the RegistrationToken nodes in the graph.

func (*RegistrationTokenMutation) AddField

func (m *RegistrationTokenMutation) 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 (*RegistrationTokenMutation) AddRegistrationIDs

func (m *RegistrationTokenMutation) AddRegistrationIDs(ids ...int)

AddRegistrationIDs adds the "registrations" edge to the Account entity by ids.

func (*RegistrationTokenMutation) AddedEdges

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

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

func (*RegistrationTokenMutation) AddedField

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

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

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

func (*RegistrationTokenMutation) AddedIDs

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

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

func (*RegistrationTokenMutation) ClearEdge

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

func (m *RegistrationTokenMutation) 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 (*RegistrationTokenMutation) ClearRegistrations

func (m *RegistrationTokenMutation) ClearRegistrations()

ClearRegistrations clears the "registrations" edge to the Account entity.

func (*RegistrationTokenMutation) ClearedEdges

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

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

func (*RegistrationTokenMutation) ClearedFields

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

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

func (RegistrationTokenMutation) Client

func (m RegistrationTokenMutation) 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 (*RegistrationTokenMutation) CreateTime

func (m *RegistrationTokenMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*RegistrationTokenMutation) EdgeCleared

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

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

func (*RegistrationTokenMutation) Field

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

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

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

func (*RegistrationTokenMutation) Fields

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

func (m *RegistrationTokenMutation) ID() (id int, exists bool)

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

func (*RegistrationTokenMutation) IDs

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 (*RegistrationTokenMutation) Name

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

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

func (*RegistrationTokenMutation) OldCreateTime

func (m *RegistrationTokenMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the RegistrationToken entity. If the RegistrationToken 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 (*RegistrationTokenMutation) OldField

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

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

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

func (m *RegistrationTokenMutation) OldToken(ctx context.Context) (v []byte, err error)

OldToken returns the old "token" field's value of the RegistrationToken entity. If the RegistrationToken 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 (*RegistrationTokenMutation) OldUpdateTime

func (m *RegistrationTokenMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the RegistrationToken entity. If the RegistrationToken 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 (*RegistrationTokenMutation) Op

func (m *RegistrationTokenMutation) Op() Op

Op returns the operation name.

func (*RegistrationTokenMutation) RegistrationsCleared

func (m *RegistrationTokenMutation) RegistrationsCleared() bool

RegistrationsCleared reports if the "registrations" edge to the Account entity was cleared.

func (*RegistrationTokenMutation) RegistrationsIDs

func (m *RegistrationTokenMutation) RegistrationsIDs() (ids []int)

RegistrationsIDs returns the "registrations" edge IDs in the mutation.

func (*RegistrationTokenMutation) RemoveRegistrationIDs

func (m *RegistrationTokenMutation) RemoveRegistrationIDs(ids ...int)

RemoveRegistrationIDs removes the "registrations" edge to the Account entity by IDs.

func (*RegistrationTokenMutation) RemovedEdges

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

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

func (*RegistrationTokenMutation) RemovedIDs

func (m *RegistrationTokenMutation) 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 (*RegistrationTokenMutation) RemovedRegistrationsIDs

func (m *RegistrationTokenMutation) RemovedRegistrationsIDs() (ids []int)

RemovedRegistrations returns the removed IDs of the "registrations" edge to the Account entity.

func (*RegistrationTokenMutation) ResetCreateTime

func (m *RegistrationTokenMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*RegistrationTokenMutation) ResetEdge

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

func (m *RegistrationTokenMutation) 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 (*RegistrationTokenMutation) ResetName

func (m *RegistrationTokenMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RegistrationTokenMutation) ResetRegistrations

func (m *RegistrationTokenMutation) ResetRegistrations()

ResetRegistrations resets all changes to the "registrations" edge.

func (*RegistrationTokenMutation) ResetToken

func (m *RegistrationTokenMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*RegistrationTokenMutation) ResetUpdateTime

func (m *RegistrationTokenMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*RegistrationTokenMutation) SetCreateTime

func (m *RegistrationTokenMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*RegistrationTokenMutation) SetField

func (m *RegistrationTokenMutation) 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 (*RegistrationTokenMutation) SetName

func (m *RegistrationTokenMutation) SetName(s string)

SetName sets the "name" field.

func (*RegistrationTokenMutation) SetOp

func (m *RegistrationTokenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RegistrationTokenMutation) SetToken

func (m *RegistrationTokenMutation) SetToken(b []byte)

SetToken sets the "token" field.

func (*RegistrationTokenMutation) SetUpdateTime

func (m *RegistrationTokenMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*RegistrationTokenMutation) Token

func (m *RegistrationTokenMutation) Token() (r []byte, exists bool)

Token returns the value of the "token" field in the mutation.

func (RegistrationTokenMutation) Tx

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

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

func (*RegistrationTokenMutation) Type

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

func (*RegistrationTokenMutation) UpdateTime

func (m *RegistrationTokenMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*RegistrationTokenMutation) Where

Where appends a list predicates to the RegistrationTokenMutation builder.

func (*RegistrationTokenMutation) WhereP

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

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

type RegistrationTokenQuery

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

RegistrationTokenQuery is the builder for querying RegistrationToken entities.

func (*RegistrationTokenQuery) Aggregate

Aggregate returns a RegistrationTokenSelect configured with the given aggregations.

func (*RegistrationTokenQuery) All

All executes the query and returns a list of RegistrationTokens.

func (*RegistrationTokenQuery) AllX

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

func (*RegistrationTokenQuery) Clone

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

func (*RegistrationTokenQuery) Count

func (rtq *RegistrationTokenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RegistrationTokenQuery) CountX

func (rtq *RegistrationTokenQuery) CountX(ctx context.Context) int

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

func (*RegistrationTokenQuery) Exist

func (rtq *RegistrationTokenQuery) Exist(ctx context.Context) (bool, error)

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

func (*RegistrationTokenQuery) ExistX

func (rtq *RegistrationTokenQuery) ExistX(ctx context.Context) bool

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

func (*RegistrationTokenQuery) First

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

func (*RegistrationTokenQuery) FirstID

func (rtq *RegistrationTokenQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*RegistrationTokenQuery) FirstIDX

func (rtq *RegistrationTokenQuery) FirstIDX(ctx context.Context) int

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

func (*RegistrationTokenQuery) FirstX

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

func (*RegistrationTokenQuery) GroupBy

func (rtq *RegistrationTokenQuery) GroupBy(field string, fields ...string) *RegistrationTokenGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.RegistrationToken.Query().
	GroupBy(registrationtoken.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RegistrationTokenQuery) IDs

func (rtq *RegistrationTokenQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*RegistrationTokenQuery) IDsX

func (rtq *RegistrationTokenQuery) IDsX(ctx context.Context) []int

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

func (*RegistrationTokenQuery) Limit

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

func (*RegistrationTokenQuery) Offset

func (rtq *RegistrationTokenQuery) Offset(offset int) *RegistrationTokenQuery

Offset to start from.

func (*RegistrationTokenQuery) Only

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

func (*RegistrationTokenQuery) OnlyID

func (rtq *RegistrationTokenQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*RegistrationTokenQuery) OnlyIDX

func (rtq *RegistrationTokenQuery) OnlyIDX(ctx context.Context) int

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

func (*RegistrationTokenQuery) OnlyX

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

func (*RegistrationTokenQuery) Order

Order specifies how the records should be ordered.

func (*RegistrationTokenQuery) QueryRegistrations

func (rtq *RegistrationTokenQuery) QueryRegistrations() *AccountQuery

QueryRegistrations chains the current query on the "registrations" edge.

func (*RegistrationTokenQuery) Select

func (rtq *RegistrationTokenQuery) Select(fields ...string) *RegistrationTokenSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.RegistrationToken.Query().
	Select(registrationtoken.FieldCreateTime).
	Scan(ctx, &v)

func (*RegistrationTokenQuery) Unique

func (rtq *RegistrationTokenQuery) Unique(unique bool) *RegistrationTokenQuery

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

Where adds a new predicate for the RegistrationTokenQuery builder.

func (*RegistrationTokenQuery) WithRegistrations

func (rtq *RegistrationTokenQuery) WithRegistrations(opts ...func(*AccountQuery)) *RegistrationTokenQuery

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

type RegistrationTokenSelect

type RegistrationTokenSelect struct {
	*RegistrationTokenQuery
	// contains filtered or unexported fields
}

RegistrationTokenSelect is the builder for selecting fields of RegistrationToken entities.

func (*RegistrationTokenSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*RegistrationTokenSelect) Bool

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

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

func (*RegistrationTokenSelect) BoolX

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

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

func (*RegistrationTokenSelect) Bools

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

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

func (*RegistrationTokenSelect) BoolsX

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

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

func (*RegistrationTokenSelect) Float64

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

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

func (*RegistrationTokenSelect) Float64X

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

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

func (*RegistrationTokenSelect) Float64s

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

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

func (*RegistrationTokenSelect) Float64sX

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

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

func (*RegistrationTokenSelect) Int

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

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

func (*RegistrationTokenSelect) IntX

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

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

func (*RegistrationTokenSelect) Ints

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

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

func (*RegistrationTokenSelect) IntsX

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

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

func (*RegistrationTokenSelect) Scan

func (rts *RegistrationTokenSelect) Scan(ctx context.Context, v any) error

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

func (*RegistrationTokenSelect) ScanX

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

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

func (*RegistrationTokenSelect) String

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

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

func (*RegistrationTokenSelect) StringX

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

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

func (*RegistrationTokenSelect) Strings

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

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

func (*RegistrationTokenSelect) StringsX

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

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

type RegistrationTokenUpdate

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

RegistrationTokenUpdate is the builder for updating RegistrationToken entities.

func (*RegistrationTokenUpdate) AddRegistrationIDs

func (rtu *RegistrationTokenUpdate) AddRegistrationIDs(ids ...int) *RegistrationTokenUpdate

AddRegistrationIDs adds the "registrations" edge to the Account entity by IDs.

func (*RegistrationTokenUpdate) AddRegistrations

func (rtu *RegistrationTokenUpdate) AddRegistrations(a ...*Account) *RegistrationTokenUpdate

AddRegistrations adds the "registrations" edges to the Account entity.

func (*RegistrationTokenUpdate) ClearRegistrations

func (rtu *RegistrationTokenUpdate) ClearRegistrations() *RegistrationTokenUpdate

ClearRegistrations clears all "registrations" edges to the Account entity.

func (*RegistrationTokenUpdate) Exec

Exec executes the query.

func (*RegistrationTokenUpdate) ExecX

func (rtu *RegistrationTokenUpdate) ExecX(ctx context.Context)

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

func (*RegistrationTokenUpdate) Mutation

Mutation returns the RegistrationTokenMutation object of the builder.

func (*RegistrationTokenUpdate) RemoveRegistrationIDs

func (rtu *RegistrationTokenUpdate) RemoveRegistrationIDs(ids ...int) *RegistrationTokenUpdate

RemoveRegistrationIDs removes the "registrations" edge to Account entities by IDs.

func (*RegistrationTokenUpdate) RemoveRegistrations

func (rtu *RegistrationTokenUpdate) RemoveRegistrations(a ...*Account) *RegistrationTokenUpdate

RemoveRegistrations removes "registrations" edges to Account entities.

func (*RegistrationTokenUpdate) Save

func (rtu *RegistrationTokenUpdate) Save(ctx context.Context) (int, error)

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

func (*RegistrationTokenUpdate) SaveX

func (rtu *RegistrationTokenUpdate) SaveX(ctx context.Context) int

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

func (*RegistrationTokenUpdate) SetName

SetName sets the "name" field.

func (*RegistrationTokenUpdate) SetNillableName

func (rtu *RegistrationTokenUpdate) SetNillableName(s *string) *RegistrationTokenUpdate

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

func (*RegistrationTokenUpdate) SetToken

SetToken sets the "token" field.

func (*RegistrationTokenUpdate) SetUpdateTime

SetUpdateTime sets the "update_time" field.

func (*RegistrationTokenUpdate) Where

Where appends a list predicates to the RegistrationTokenUpdate builder.

type RegistrationTokenUpdateOne

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

RegistrationTokenUpdateOne is the builder for updating a single RegistrationToken entity.

func (*RegistrationTokenUpdateOne) AddRegistrationIDs

func (rtuo *RegistrationTokenUpdateOne) AddRegistrationIDs(ids ...int) *RegistrationTokenUpdateOne

AddRegistrationIDs adds the "registrations" edge to the Account entity by IDs.

func (*RegistrationTokenUpdateOne) AddRegistrations

func (rtuo *RegistrationTokenUpdateOne) AddRegistrations(a ...*Account) *RegistrationTokenUpdateOne

AddRegistrations adds the "registrations" edges to the Account entity.

func (*RegistrationTokenUpdateOne) ClearRegistrations

func (rtuo *RegistrationTokenUpdateOne) ClearRegistrations() *RegistrationTokenUpdateOne

ClearRegistrations clears all "registrations" edges to the Account entity.

func (*RegistrationTokenUpdateOne) Exec

Exec executes the query on the entity.

func (*RegistrationTokenUpdateOne) ExecX

func (rtuo *RegistrationTokenUpdateOne) ExecX(ctx context.Context)

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

func (*RegistrationTokenUpdateOne) Mutation

Mutation returns the RegistrationTokenMutation object of the builder.

func (*RegistrationTokenUpdateOne) RemoveRegistrationIDs

func (rtuo *RegistrationTokenUpdateOne) RemoveRegistrationIDs(ids ...int) *RegistrationTokenUpdateOne

RemoveRegistrationIDs removes the "registrations" edge to Account entities by IDs.

func (*RegistrationTokenUpdateOne) RemoveRegistrations

func (rtuo *RegistrationTokenUpdateOne) RemoveRegistrations(a ...*Account) *RegistrationTokenUpdateOne

RemoveRegistrations removes "registrations" edges to Account entities.

func (*RegistrationTokenUpdateOne) Save

Save executes the query and returns the updated RegistrationToken entity.

func (*RegistrationTokenUpdateOne) SaveX

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

func (*RegistrationTokenUpdateOne) Select

func (rtuo *RegistrationTokenUpdateOne) Select(field string, fields ...string) *RegistrationTokenUpdateOne

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

func (*RegistrationTokenUpdateOne) SetName

SetName sets the "name" field.

func (*RegistrationTokenUpdateOne) SetNillableName

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

func (*RegistrationTokenUpdateOne) SetToken

SetToken sets the "token" field.

func (*RegistrationTokenUpdateOne) SetUpdateTime

SetUpdateTime sets the "update_time" field.

func (*RegistrationTokenUpdateOne) Where

Where appends a list predicates to the RegistrationTokenUpdate builder.

type RegistrationTokens

type RegistrationTokens []*RegistrationToken

RegistrationTokens is a parsable slice of RegistrationToken.

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 Server

type Server struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name is the unique name of the server.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ServerQuery when eager-loading is set.
	Edges ServerEdges `json:"edges"`
	// contains filtered or unexported fields
}

Server is the model entity for the Server schema.

func (*Server) QueryAccount

func (s *Server) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Server entity.

func (*Server) QueryNodes

func (s *Server) QueryNodes() *NodeQuery

QueryNodes queries the "nodes" edge of the Server entity.

func (*Server) String

func (s *Server) String() string

String implements the fmt.Stringer.

func (*Server) Unwrap

func (s *Server) Unwrap() *Server

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

func (s *Server) Update() *ServerUpdateOne

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

func (*Server) Value

func (s *Server) Value(name string) (ent.Value, error)

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

type ServerClient

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

ServerClient is a client for the Server schema.

func NewServerClient

func NewServerClient(c config) *ServerClient

NewServerClient returns a client for the Server from the given config.

func (*ServerClient) Create

func (c *ServerClient) Create() *ServerCreate

Create returns a builder for creating a Server entity.

func (*ServerClient) CreateBulk

func (c *ServerClient) CreateBulk(builders ...*ServerCreate) *ServerCreateBulk

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

func (*ServerClient) Delete

func (c *ServerClient) Delete() *ServerDelete

Delete returns a delete builder for Server.

func (*ServerClient) DeleteOne

func (c *ServerClient) DeleteOne(s *Server) *ServerDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ServerClient) DeleteOneID

func (c *ServerClient) DeleteOneID(id int) *ServerDeleteOne

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

func (*ServerClient) Get

func (c *ServerClient) Get(ctx context.Context, id int) (*Server, error)

Get returns a Server entity by its id.

func (*ServerClient) GetX

func (c *ServerClient) GetX(ctx context.Context, id int) *Server

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

func (*ServerClient) Hooks

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

Hooks returns the client hooks.

func (*ServerClient) Intercept

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

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

func (*ServerClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ServerClient) MapCreateBulk

func (c *ServerClient) MapCreateBulk(slice any, setFunc func(*ServerCreate, int)) *ServerCreateBulk

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 (*ServerClient) Query

func (c *ServerClient) Query() *ServerQuery

Query returns a query builder for Server.

func (*ServerClient) QueryAccount

func (c *ServerClient) QueryAccount(s *Server) *AccountQuery

QueryAccount queries the account edge of a Server.

func (*ServerClient) QueryNodes

func (c *ServerClient) QueryNodes(s *Server) *NodeQuery

QueryNodes queries the nodes edge of a Server.

func (*ServerClient) Update

func (c *ServerClient) Update() *ServerUpdate

Update returns an update builder for Server.

func (*ServerClient) UpdateOne

func (c *ServerClient) UpdateOne(s *Server) *ServerUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ServerClient) UpdateOneID

func (c *ServerClient) UpdateOneID(id int) *ServerUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ServerClient) Use

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

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

type ServerCreate

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

ServerCreate is the builder for creating a Server entity.

func (*ServerCreate) AddNodeIDs

func (sc *ServerCreate) AddNodeIDs(ids ...int) *ServerCreate

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*ServerCreate) AddNodes

func (sc *ServerCreate) AddNodes(n ...*Node) *ServerCreate

AddNodes adds the "nodes" edges to the Node entity.

func (*ServerCreate) Exec

func (sc *ServerCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ServerCreate) ExecX

func (sc *ServerCreate) ExecX(ctx context.Context)

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

func (*ServerCreate) Mutation

func (sc *ServerCreate) Mutation() *ServerMutation

Mutation returns the ServerMutation object of the builder.

func (*ServerCreate) Save

func (sc *ServerCreate) Save(ctx context.Context) (*Server, error)

Save creates the Server in the database.

func (*ServerCreate) SaveX

func (sc *ServerCreate) SaveX(ctx context.Context) *Server

SaveX calls Save and panics if Save returns an error.

func (*ServerCreate) SetAccount

func (sc *ServerCreate) SetAccount(a *Account) *ServerCreate

SetAccount sets the "account" edge to the Account entity.

func (*ServerCreate) SetAccountID

func (sc *ServerCreate) SetAccountID(id int) *ServerCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ServerCreate) SetCreateTime

func (sc *ServerCreate) SetCreateTime(t time.Time) *ServerCreate

SetCreateTime sets the "create_time" field.

func (*ServerCreate) SetName

func (sc *ServerCreate) SetName(s string) *ServerCreate

SetName sets the "name" field.

func (*ServerCreate) SetNillableCreateTime

func (sc *ServerCreate) SetNillableCreateTime(t *time.Time) *ServerCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*ServerCreate) SetNillableUpdateTime

func (sc *ServerCreate) SetNillableUpdateTime(t *time.Time) *ServerCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*ServerCreate) SetUpdateTime

func (sc *ServerCreate) SetUpdateTime(t time.Time) *ServerCreate

SetUpdateTime sets the "update_time" field.

type ServerCreateBulk

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

ServerCreateBulk is the builder for creating many Server entities in bulk.

func (*ServerCreateBulk) Exec

func (scb *ServerCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ServerCreateBulk) ExecX

func (scb *ServerCreateBulk) ExecX(ctx context.Context)

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

func (*ServerCreateBulk) Save

func (scb *ServerCreateBulk) Save(ctx context.Context) ([]*Server, error)

Save creates the Server entities in the database.

func (*ServerCreateBulk) SaveX

func (scb *ServerCreateBulk) SaveX(ctx context.Context) []*Server

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

type ServerDelete

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

ServerDelete is the builder for deleting a Server entity.

func (*ServerDelete) Exec

func (sd *ServerDelete) Exec(ctx context.Context) (int, error)

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

func (*ServerDelete) ExecX

func (sd *ServerDelete) ExecX(ctx context.Context) int

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

func (*ServerDelete) Where

func (sd *ServerDelete) Where(ps ...predicate.Server) *ServerDelete

Where appends a list predicates to the ServerDelete builder.

type ServerDeleteOne

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

ServerDeleteOne is the builder for deleting a single Server entity.

func (*ServerDeleteOne) Exec

func (sdo *ServerDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ServerDeleteOne) ExecX

func (sdo *ServerDeleteOne) ExecX(ctx context.Context)

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

func (*ServerDeleteOne) Where

func (sdo *ServerDeleteOne) Where(ps ...predicate.Server) *ServerDeleteOne

Where appends a list predicates to the ServerDelete builder.

type ServerEdges

type ServerEdges struct {
	// Nodes holds the value of the nodes edge.
	Nodes []*Node `json:"nodes,omitempty"`
	// Account holds the value of the account edge.
	Account *Account `json:"account,omitempty"`
	// contains filtered or unexported fields
}

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

func (ServerEdges) AccountOrErr

func (e ServerEdges) AccountOrErr() (*Account, error)

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

func (ServerEdges) NodesOrErr

func (e ServerEdges) NodesOrErr() ([]*Node, error)

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

type ServerGroupBy

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

ServerGroupBy is the group-by builder for Server entities.

func (*ServerGroupBy) Aggregate

func (sgb *ServerGroupBy) Aggregate(fns ...AggregateFunc) *ServerGroupBy

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

func (*ServerGroupBy) Bool

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

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

func (*ServerGroupBy) BoolX

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

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

func (*ServerGroupBy) Bools

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

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

func (*ServerGroupBy) BoolsX

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

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

func (*ServerGroupBy) Float64

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

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

func (*ServerGroupBy) Float64X

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

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

func (*ServerGroupBy) Float64s

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

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

func (*ServerGroupBy) Float64sX

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

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

func (*ServerGroupBy) Int

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

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

func (*ServerGroupBy) IntX

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

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

func (*ServerGroupBy) Ints

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

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

func (*ServerGroupBy) IntsX

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

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

func (*ServerGroupBy) Scan

func (sgb *ServerGroupBy) Scan(ctx context.Context, v any) error

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

func (*ServerGroupBy) ScanX

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

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

func (*ServerGroupBy) String

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

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

func (*ServerGroupBy) StringX

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

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

func (*ServerGroupBy) Strings

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

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

func (*ServerGroupBy) StringsX

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

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

type ServerMutation

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

ServerMutation represents an operation that mutates the Server nodes in the graph.

func (*ServerMutation) AccountCleared

func (m *ServerMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*ServerMutation) AccountID

func (m *ServerMutation) AccountID() (id int, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*ServerMutation) AccountIDs

func (m *ServerMutation) AccountIDs() (ids []int)

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

func (*ServerMutation) AddField

func (m *ServerMutation) 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 (*ServerMutation) AddNodeIDs

func (m *ServerMutation) AddNodeIDs(ids ...int)

AddNodeIDs adds the "nodes" edge to the Node entity by ids.

func (*ServerMutation) AddedEdges

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

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

func (*ServerMutation) AddedField

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

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

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

func (*ServerMutation) AddedIDs

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

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

func (*ServerMutation) ClearAccount

func (m *ServerMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*ServerMutation) ClearEdge

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

func (m *ServerMutation) 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 (*ServerMutation) ClearNodes

func (m *ServerMutation) ClearNodes()

ClearNodes clears the "nodes" edge to the Node entity.

func (*ServerMutation) ClearedEdges

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

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

func (*ServerMutation) ClearedFields

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

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

func (ServerMutation) Client

func (m ServerMutation) 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 (*ServerMutation) CreateTime

func (m *ServerMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*ServerMutation) EdgeCleared

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

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

func (*ServerMutation) Field

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

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

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

func (*ServerMutation) Fields

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

func (m *ServerMutation) ID() (id int, exists bool)

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

func (*ServerMutation) IDs

func (m *ServerMutation) IDs(ctx context.Context) ([]int, error)

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

func (*ServerMutation) Name

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

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

func (*ServerMutation) NodesCleared

func (m *ServerMutation) NodesCleared() bool

NodesCleared reports if the "nodes" edge to the Node entity was cleared.

func (*ServerMutation) NodesIDs

func (m *ServerMutation) NodesIDs() (ids []int)

NodesIDs returns the "nodes" edge IDs in the mutation.

func (*ServerMutation) OldCreateTime

func (m *ServerMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Server entity. If the Server 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 (*ServerMutation) OldField

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

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

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

func (m *ServerMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Server entity. If the Server 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 (*ServerMutation) Op

func (m *ServerMutation) Op() Op

Op returns the operation name.

func (*ServerMutation) RemoveNodeIDs

func (m *ServerMutation) RemoveNodeIDs(ids ...int)

RemoveNodeIDs removes the "nodes" edge to the Node entity by IDs.

func (*ServerMutation) RemovedEdges

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

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

func (*ServerMutation) RemovedIDs

func (m *ServerMutation) 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 (*ServerMutation) RemovedNodesIDs

func (m *ServerMutation) RemovedNodesIDs() (ids []int)

RemovedNodes returns the removed IDs of the "nodes" edge to the Node entity.

func (*ServerMutation) ResetAccount

func (m *ServerMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*ServerMutation) ResetCreateTime

func (m *ServerMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*ServerMutation) ResetEdge

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

func (m *ServerMutation) 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 (*ServerMutation) ResetName

func (m *ServerMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ServerMutation) ResetNodes

func (m *ServerMutation) ResetNodes()

ResetNodes resets all changes to the "nodes" edge.

func (*ServerMutation) ResetUpdateTime

func (m *ServerMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*ServerMutation) SetAccountID

func (m *ServerMutation) SetAccountID(id int)

SetAccountID sets the "account" edge to the Account entity by id.

func (*ServerMutation) SetCreateTime

func (m *ServerMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*ServerMutation) SetField

func (m *ServerMutation) 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 (*ServerMutation) SetName

func (m *ServerMutation) SetName(s string)

SetName sets the "name" field.

func (*ServerMutation) SetOp

func (m *ServerMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ServerMutation) SetUpdateTime

func (m *ServerMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (ServerMutation) Tx

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

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

func (*ServerMutation) Type

func (m *ServerMutation) Type() string

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

func (*ServerMutation) UpdateTime

func (m *ServerMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*ServerMutation) Where

func (m *ServerMutation) Where(ps ...predicate.Server)

Where appends a list predicates to the ServerMutation builder.

func (*ServerMutation) WhereP

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

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

type ServerQuery

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

ServerQuery is the builder for querying Server entities.

func (*ServerQuery) Aggregate

func (sq *ServerQuery) Aggregate(fns ...AggregateFunc) *ServerSelect

Aggregate returns a ServerSelect configured with the given aggregations.

func (*ServerQuery) All

func (sq *ServerQuery) All(ctx context.Context) ([]*Server, error)

All executes the query and returns a list of Servers.

func (*ServerQuery) AllX

func (sq *ServerQuery) AllX(ctx context.Context) []*Server

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

func (*ServerQuery) Clone

func (sq *ServerQuery) Clone() *ServerQuery

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

func (*ServerQuery) Count

func (sq *ServerQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ServerQuery) CountX

func (sq *ServerQuery) CountX(ctx context.Context) int

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

func (*ServerQuery) Exist

func (sq *ServerQuery) Exist(ctx context.Context) (bool, error)

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

func (*ServerQuery) ExistX

func (sq *ServerQuery) ExistX(ctx context.Context) bool

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

func (*ServerQuery) First

func (sq *ServerQuery) First(ctx context.Context) (*Server, error)

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

func (*ServerQuery) FirstID

func (sq *ServerQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ServerQuery) FirstIDX

func (sq *ServerQuery) FirstIDX(ctx context.Context) int

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

func (*ServerQuery) FirstX

func (sq *ServerQuery) FirstX(ctx context.Context) *Server

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

func (*ServerQuery) GroupBy

func (sq *ServerQuery) GroupBy(field string, fields ...string) *ServerGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Server.Query().
	GroupBy(server.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ServerQuery) IDs

func (sq *ServerQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*ServerQuery) IDsX

func (sq *ServerQuery) IDsX(ctx context.Context) []int

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

func (*ServerQuery) Limit

func (sq *ServerQuery) Limit(limit int) *ServerQuery

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

func (*ServerQuery) Offset

func (sq *ServerQuery) Offset(offset int) *ServerQuery

Offset to start from.

func (*ServerQuery) Only

func (sq *ServerQuery) Only(ctx context.Context) (*Server, error)

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

func (*ServerQuery) OnlyID

func (sq *ServerQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ServerQuery) OnlyIDX

func (sq *ServerQuery) OnlyIDX(ctx context.Context) int

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

func (*ServerQuery) OnlyX

func (sq *ServerQuery) OnlyX(ctx context.Context) *Server

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

func (*ServerQuery) Order

func (sq *ServerQuery) Order(o ...server.OrderOption) *ServerQuery

Order specifies how the records should be ordered.

func (*ServerQuery) QueryAccount

func (sq *ServerQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*ServerQuery) QueryNodes

func (sq *ServerQuery) QueryNodes() *NodeQuery

QueryNodes chains the current query on the "nodes" edge.

func (*ServerQuery) Select

func (sq *ServerQuery) Select(fields ...string) *ServerSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Server.Query().
	Select(server.FieldCreateTime).
	Scan(ctx, &v)

func (*ServerQuery) Unique

func (sq *ServerQuery) Unique(unique bool) *ServerQuery

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

func (sq *ServerQuery) Where(ps ...predicate.Server) *ServerQuery

Where adds a new predicate for the ServerQuery builder.

func (*ServerQuery) WithAccount

func (sq *ServerQuery) WithAccount(opts ...func(*AccountQuery)) *ServerQuery

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

func (*ServerQuery) WithNodes

func (sq *ServerQuery) WithNodes(opts ...func(*NodeQuery)) *ServerQuery

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

type ServerSelect

type ServerSelect struct {
	*ServerQuery
	// contains filtered or unexported fields
}

ServerSelect is the builder for selecting fields of Server entities.

func (*ServerSelect) Aggregate

func (ss *ServerSelect) Aggregate(fns ...AggregateFunc) *ServerSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ServerSelect) Bool

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

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

func (*ServerSelect) BoolX

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

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

func (*ServerSelect) Bools

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

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

func (*ServerSelect) BoolsX

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

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

func (*ServerSelect) Float64

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

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

func (*ServerSelect) Float64X

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

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

func (*ServerSelect) Float64s

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

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

func (*ServerSelect) Float64sX

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

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

func (*ServerSelect) Int

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

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

func (*ServerSelect) IntX

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

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

func (*ServerSelect) Ints

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

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

func (*ServerSelect) IntsX

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

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

func (*ServerSelect) Scan

func (ss *ServerSelect) Scan(ctx context.Context, v any) error

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

func (*ServerSelect) ScanX

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

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

func (*ServerSelect) String

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

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

func (*ServerSelect) StringX

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

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

func (*ServerSelect) Strings

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

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

func (*ServerSelect) StringsX

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

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

type ServerUpdate

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

ServerUpdate is the builder for updating Server entities.

func (*ServerUpdate) AddNodeIDs

func (su *ServerUpdate) AddNodeIDs(ids ...int) *ServerUpdate

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*ServerUpdate) AddNodes

func (su *ServerUpdate) AddNodes(n ...*Node) *ServerUpdate

AddNodes adds the "nodes" edges to the Node entity.

func (*ServerUpdate) ClearAccount

func (su *ServerUpdate) ClearAccount() *ServerUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*ServerUpdate) ClearNodes

func (su *ServerUpdate) ClearNodes() *ServerUpdate

ClearNodes clears all "nodes" edges to the Node entity.

func (*ServerUpdate) Exec

func (su *ServerUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ServerUpdate) ExecX

func (su *ServerUpdate) ExecX(ctx context.Context)

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

func (*ServerUpdate) Mutation

func (su *ServerUpdate) Mutation() *ServerMutation

Mutation returns the ServerMutation object of the builder.

func (*ServerUpdate) RemoveNodeIDs

func (su *ServerUpdate) RemoveNodeIDs(ids ...int) *ServerUpdate

RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.

func (*ServerUpdate) RemoveNodes

func (su *ServerUpdate) RemoveNodes(n ...*Node) *ServerUpdate

RemoveNodes removes "nodes" edges to Node entities.

func (*ServerUpdate) Save

func (su *ServerUpdate) Save(ctx context.Context) (int, error)

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

func (*ServerUpdate) SaveX

func (su *ServerUpdate) SaveX(ctx context.Context) int

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

func (*ServerUpdate) SetAccount

func (su *ServerUpdate) SetAccount(a *Account) *ServerUpdate

SetAccount sets the "account" edge to the Account entity.

func (*ServerUpdate) SetAccountID

func (su *ServerUpdate) SetAccountID(id int) *ServerUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ServerUpdate) SetName

func (su *ServerUpdate) SetName(s string) *ServerUpdate

SetName sets the "name" field.

func (*ServerUpdate) SetNillableName

func (su *ServerUpdate) SetNillableName(s *string) *ServerUpdate

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

func (*ServerUpdate) SetUpdateTime

func (su *ServerUpdate) SetUpdateTime(t time.Time) *ServerUpdate

SetUpdateTime sets the "update_time" field.

func (*ServerUpdate) Where

func (su *ServerUpdate) Where(ps ...predicate.Server) *ServerUpdate

Where appends a list predicates to the ServerUpdate builder.

type ServerUpdateOne

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

ServerUpdateOne is the builder for updating a single Server entity.

func (*ServerUpdateOne) AddNodeIDs

func (suo *ServerUpdateOne) AddNodeIDs(ids ...int) *ServerUpdateOne

AddNodeIDs adds the "nodes" edge to the Node entity by IDs.

func (*ServerUpdateOne) AddNodes

func (suo *ServerUpdateOne) AddNodes(n ...*Node) *ServerUpdateOne

AddNodes adds the "nodes" edges to the Node entity.

func (*ServerUpdateOne) ClearAccount

func (suo *ServerUpdateOne) ClearAccount() *ServerUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*ServerUpdateOne) ClearNodes

func (suo *ServerUpdateOne) ClearNodes() *ServerUpdateOne

ClearNodes clears all "nodes" edges to the Node entity.

func (*ServerUpdateOne) Exec

func (suo *ServerUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ServerUpdateOne) ExecX

func (suo *ServerUpdateOne) ExecX(ctx context.Context)

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

func (*ServerUpdateOne) Mutation

func (suo *ServerUpdateOne) Mutation() *ServerMutation

Mutation returns the ServerMutation object of the builder.

func (*ServerUpdateOne) RemoveNodeIDs

func (suo *ServerUpdateOne) RemoveNodeIDs(ids ...int) *ServerUpdateOne

RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.

func (*ServerUpdateOne) RemoveNodes

func (suo *ServerUpdateOne) RemoveNodes(n ...*Node) *ServerUpdateOne

RemoveNodes removes "nodes" edges to Node entities.

func (*ServerUpdateOne) Save

func (suo *ServerUpdateOne) Save(ctx context.Context) (*Server, error)

Save executes the query and returns the updated Server entity.

func (*ServerUpdateOne) SaveX

func (suo *ServerUpdateOne) SaveX(ctx context.Context) *Server

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

func (*ServerUpdateOne) Select

func (suo *ServerUpdateOne) Select(field string, fields ...string) *ServerUpdateOne

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

func (*ServerUpdateOne) SetAccount

func (suo *ServerUpdateOne) SetAccount(a *Account) *ServerUpdateOne

SetAccount sets the "account" edge to the Account entity.

func (*ServerUpdateOne) SetAccountID

func (suo *ServerUpdateOne) SetAccountID(id int) *ServerUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*ServerUpdateOne) SetName

func (suo *ServerUpdateOne) SetName(s string) *ServerUpdateOne

SetName sets the "name" field.

func (*ServerUpdateOne) SetNillableName

func (suo *ServerUpdateOne) SetNillableName(s *string) *ServerUpdateOne

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

func (*ServerUpdateOne) SetUpdateTime

func (suo *ServerUpdateOne) SetUpdateTime(t time.Time) *ServerUpdateOne

SetUpdateTime sets the "update_time" field.

func (*ServerUpdateOne) Where

func (suo *ServerUpdateOne) Where(ps ...predicate.Server) *ServerUpdateOne

Where appends a list predicates to the ServerUpdate builder.

type Servers

type Servers []*Server

Servers is a parsable slice of Server.

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 {

	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// RegistrationToken is the client for interacting with the RegistrationToken builders.
	RegistrationToken *RegistrationTokenClient
	// Server is the client for interacting with the Server builders.
	Server *ServerClient
	// 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