ent

package
v0.0.0-...-320a802 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 19 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.
	TypeGuild = "Guild"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Guild is the client for interacting with the Guild builders.
	Guild *GuildClient
	// 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().
	Guild.
	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) Ping

func (c *Client) Ping() error

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 Guild

type Guild struct {

	// ID of the ent.
	ID snowflake.ID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// PlayerChannelID holds the value of the "player_channel_id" field.
	PlayerChannelID *snowflake.ID `json:"player_channel_id,omitempty"`
	// PlayerMessageID holds the value of the "player_message_id" field.
	PlayerMessageID *snowflake.ID `json:"player_message_id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

Guild is the model entity for the Guild schema.

func (*Guild) String

func (gu *Guild) String() string

String implements the fmt.Stringer.

func (*Guild) Unwrap

func (gu *Guild) Unwrap() *Guild

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

func (gu *Guild) Update() *GuildUpdateOne

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

type GuildClient

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

GuildClient is a client for the Guild schema.

func NewGuildClient

func NewGuildClient(c config) *GuildClient

NewGuildClient returns a client for the Guild from the given config.

func (*GuildClient) Create

func (c *GuildClient) Create() *GuildCreate

Create returns a builder for creating a Guild entity.

func (*GuildClient) CreateBulk

func (c *GuildClient) CreateBulk(builders ...*GuildCreate) *GuildCreateBulk

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

func (*GuildClient) Delete

func (c *GuildClient) Delete() *GuildDelete

Delete returns a delete builder for Guild.

func (*GuildClient) DeleteOne

func (c *GuildClient) DeleteOne(gu *Guild) *GuildDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*GuildClient) DeleteOneID

func (c *GuildClient) DeleteOneID(id snowflake.ID) *GuildDeleteOne

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

func (*GuildClient) Get

func (c *GuildClient) Get(ctx context.Context, id snowflake.ID) (*Guild, error)

Get returns a Guild entity by its id.

func (*GuildClient) GetX

func (c *GuildClient) GetX(ctx context.Context, id snowflake.ID) *Guild

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

func (*GuildClient) Hooks

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

Hooks returns the client hooks.

func (*GuildClient) Intercept

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

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

func (*GuildClient) Interceptors

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

Interceptors returns the client interceptors.

func (*GuildClient) Query

func (c *GuildClient) Query() *GuildQuery

Query returns a query builder for Guild.

func (*GuildClient) Update

func (c *GuildClient) Update() *GuildUpdate

Update returns an update builder for Guild.

func (*GuildClient) UpdateOne

func (c *GuildClient) UpdateOne(gu *Guild) *GuildUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GuildClient) UpdateOneID

func (c *GuildClient) UpdateOneID(id snowflake.ID) *GuildUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GuildClient) Use

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

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

type GuildCreate

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

GuildCreate is the builder for creating a Guild entity.

func (*GuildCreate) Exec

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

Exec executes the query.

func (*GuildCreate) ExecX

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

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

func (*GuildCreate) Mutation

func (gc *GuildCreate) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildCreate) OnConflict

func (gc *GuildCreate) OnConflict(opts ...sql.ConflictOption) *GuildUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Guild.Create().
	SetName(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.GuildUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*GuildCreate) OnConflictColumns

func (gc *GuildCreate) OnConflictColumns(columns ...string) *GuildUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Guild.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*GuildCreate) Save

func (gc *GuildCreate) Save(ctx context.Context) (*Guild, error)

Save creates the Guild in the database.

func (*GuildCreate) SaveX

func (gc *GuildCreate) SaveX(ctx context.Context) *Guild

SaveX calls Save and panics if Save returns an error.

func (*GuildCreate) SetCreatedAt

func (gc *GuildCreate) SetCreatedAt(t time.Time) *GuildCreate

SetCreatedAt sets the "created_at" field.

func (*GuildCreate) SetID

func (gc *GuildCreate) SetID(s snowflake.ID) *GuildCreate

SetID sets the "id" field.

func (*GuildCreate) SetName

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

SetName sets the "name" field.

func (*GuildCreate) SetNillableCreatedAt

func (gc *GuildCreate) SetNillableCreatedAt(t *time.Time) *GuildCreate

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

func (*GuildCreate) SetNillablePlayerChannelID

func (gc *GuildCreate) SetNillablePlayerChannelID(s *snowflake.ID) *GuildCreate

SetNillablePlayerChannelID sets the "player_channel_id" field if the given value is not nil.

func (*GuildCreate) SetNillablePlayerMessageID

func (gc *GuildCreate) SetNillablePlayerMessageID(s *snowflake.ID) *GuildCreate

SetNillablePlayerMessageID sets the "player_message_id" field if the given value is not nil.

func (*GuildCreate) SetNillableUpdatedAt

func (gc *GuildCreate) SetNillableUpdatedAt(t *time.Time) *GuildCreate

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

func (*GuildCreate) SetPlayerChannelID

func (gc *GuildCreate) SetPlayerChannelID(s snowflake.ID) *GuildCreate

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildCreate) SetPlayerMessageID

func (gc *GuildCreate) SetPlayerMessageID(s snowflake.ID) *GuildCreate

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildCreate) SetUpdatedAt

func (gc *GuildCreate) SetUpdatedAt(t time.Time) *GuildCreate

SetUpdatedAt sets the "updated_at" field.

type GuildCreateBulk

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

GuildCreateBulk is the builder for creating many Guild entities in bulk.

func (*GuildCreateBulk) Exec

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

Exec executes the query.

func (*GuildCreateBulk) ExecX

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

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

func (*GuildCreateBulk) OnConflict

func (gcb *GuildCreateBulk) OnConflict(opts ...sql.ConflictOption) *GuildUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Guild.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.GuildUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*GuildCreateBulk) OnConflictColumns

func (gcb *GuildCreateBulk) OnConflictColumns(columns ...string) *GuildUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Guild.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*GuildCreateBulk) Save

func (gcb *GuildCreateBulk) Save(ctx context.Context) ([]*Guild, error)

Save creates the Guild entities in the database.

func (*GuildCreateBulk) SaveX

func (gcb *GuildCreateBulk) SaveX(ctx context.Context) []*Guild

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

type GuildDelete

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

GuildDelete is the builder for deleting a Guild entity.

func (*GuildDelete) Exec

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

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

func (*GuildDelete) ExecX

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

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

func (*GuildDelete) Where

func (gd *GuildDelete) Where(ps ...predicate.Guild) *GuildDelete

Where appends a list predicates to the GuildDelete builder.

type GuildDeleteOne

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

GuildDeleteOne is the builder for deleting a single Guild entity.

func (*GuildDeleteOne) Exec

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

Exec executes the deletion query.

func (*GuildDeleteOne) ExecX

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

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

func (*GuildDeleteOne) Where

func (gdo *GuildDeleteOne) Where(ps ...predicate.Guild) *GuildDeleteOne

Where appends a list predicates to the GuildDelete builder.

type GuildGroupBy

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

GuildGroupBy is the group-by builder for Guild entities.

func (*GuildGroupBy) Aggregate

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

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

func (*GuildGroupBy) Bool

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

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

func (*GuildGroupBy) BoolX

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

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

func (*GuildGroupBy) Bools

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

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

func (*GuildGroupBy) BoolsX

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

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

func (*GuildGroupBy) Float64

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

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

func (*GuildGroupBy) Float64X

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

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

func (*GuildGroupBy) Float64s

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

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

func (*GuildGroupBy) Float64sX

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

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

func (*GuildGroupBy) Int

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

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

func (*GuildGroupBy) IntX

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

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

func (*GuildGroupBy) Ints

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

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

func (*GuildGroupBy) IntsX

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

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

func (*GuildGroupBy) Scan

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

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

func (*GuildGroupBy) ScanX

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

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

func (*GuildGroupBy) String

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

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

func (*GuildGroupBy) StringX

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

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

func (*GuildGroupBy) Strings

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

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

func (*GuildGroupBy) StringsX

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

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

type GuildMutation

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

GuildMutation represents an operation that mutates the Guild nodes in the graph.

func (*GuildMutation) AddField

func (m *GuildMutation) 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 (*GuildMutation) AddPlayerChannelID

func (m *GuildMutation) AddPlayerChannelID(s snowflake.ID)

AddPlayerChannelID adds s to the "player_channel_id" field.

func (*GuildMutation) AddPlayerMessageID

func (m *GuildMutation) AddPlayerMessageID(s snowflake.ID)

AddPlayerMessageID adds s to the "player_message_id" field.

func (*GuildMutation) AddedEdges

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

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

func (*GuildMutation) AddedField

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

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

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

func (*GuildMutation) AddedIDs

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

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

func (*GuildMutation) AddedPlayerChannelID

func (m *GuildMutation) AddedPlayerChannelID() (r snowflake.ID, exists bool)

AddedPlayerChannelID returns the value that was added to the "player_channel_id" field in this mutation.

func (*GuildMutation) AddedPlayerMessageID

func (m *GuildMutation) AddedPlayerMessageID() (r snowflake.ID, exists bool)

AddedPlayerMessageID returns the value that was added to the "player_message_id" field in this mutation.

func (*GuildMutation) ClearEdge

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

func (m *GuildMutation) 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 (*GuildMutation) ClearPlayerChannelID

func (m *GuildMutation) ClearPlayerChannelID()

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildMutation) ClearPlayerMessageID

func (m *GuildMutation) ClearPlayerMessageID()

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildMutation) ClearedEdges

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

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

func (*GuildMutation) ClearedFields

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

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

func (GuildMutation) Client

func (m GuildMutation) 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 (*GuildMutation) CreatedAt

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

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

func (*GuildMutation) EdgeCleared

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

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

func (*GuildMutation) Field

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

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

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

func (*GuildMutation) Fields

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

func (m *GuildMutation) ID() (id snowflake.ID, 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 (*GuildMutation) IDs

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

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

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

func (*GuildMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Guild entity. If the Guild 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 (*GuildMutation) OldField

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

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

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

func (m *GuildMutation) OldPlayerChannelID(ctx context.Context) (v *snowflake.ID, err error)

OldPlayerChannelID returns the old "player_channel_id" field's value of the Guild entity. If the Guild 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 (*GuildMutation) OldPlayerMessageID

func (m *GuildMutation) OldPlayerMessageID(ctx context.Context) (v *snowflake.ID, err error)

OldPlayerMessageID returns the old "player_message_id" field's value of the Guild entity. If the Guild 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 (*GuildMutation) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" field's value of the Guild entity. If the Guild 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 (*GuildMutation) Op

func (m *GuildMutation) Op() Op

Op returns the operation name.

func (*GuildMutation) PlayerChannelID

func (m *GuildMutation) PlayerChannelID() (r snowflake.ID, exists bool)

PlayerChannelID returns the value of the "player_channel_id" field in the mutation.

func (*GuildMutation) PlayerChannelIDCleared

func (m *GuildMutation) PlayerChannelIDCleared() bool

PlayerChannelIDCleared returns if the "player_channel_id" field was cleared in this mutation.

func (*GuildMutation) PlayerMessageID

func (m *GuildMutation) PlayerMessageID() (r snowflake.ID, exists bool)

PlayerMessageID returns the value of the "player_message_id" field in the mutation.

func (*GuildMutation) PlayerMessageIDCleared

func (m *GuildMutation) PlayerMessageIDCleared() bool

PlayerMessageIDCleared returns if the "player_message_id" field was cleared in this mutation.

func (*GuildMutation) RemovedEdges

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

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

func (*GuildMutation) RemovedIDs

func (m *GuildMutation) 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 (*GuildMutation) ResetCreatedAt

func (m *GuildMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*GuildMutation) ResetEdge

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

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

func (m *GuildMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*GuildMutation) ResetPlayerChannelID

func (m *GuildMutation) ResetPlayerChannelID()

ResetPlayerChannelID resets all changes to the "player_channel_id" field.

func (*GuildMutation) ResetPlayerMessageID

func (m *GuildMutation) ResetPlayerMessageID()

ResetPlayerMessageID resets all changes to the "player_message_id" field.

func (*GuildMutation) ResetUpdatedAt

func (m *GuildMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*GuildMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*GuildMutation) SetField

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

func (m *GuildMutation) SetID(id snowflake.ID)

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

func (*GuildMutation) SetName

func (m *GuildMutation) SetName(s string)

SetName sets the "name" field.

func (*GuildMutation) SetOp

func (m *GuildMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*GuildMutation) SetPlayerChannelID

func (m *GuildMutation) SetPlayerChannelID(s snowflake.ID)

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildMutation) SetPlayerMessageID

func (m *GuildMutation) SetPlayerMessageID(s snowflake.ID)

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (GuildMutation) Tx

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

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

func (*GuildMutation) Type

func (m *GuildMutation) Type() string

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

func (*GuildMutation) UpdatedAt

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

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

func (*GuildMutation) Where

func (m *GuildMutation) Where(ps ...predicate.Guild)

Where appends a list predicates to the GuildMutation builder.

func (*GuildMutation) WhereP

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

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

type GuildQuery

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

GuildQuery is the builder for querying Guild entities.

func (*GuildQuery) Aggregate

func (gq *GuildQuery) Aggregate(fns ...AggregateFunc) *GuildSelect

Aggregate returns a GuildSelect configured with the given aggregations.

func (*GuildQuery) All

func (gq *GuildQuery) All(ctx context.Context) ([]*Guild, error)

All executes the query and returns a list of Guilds.

func (*GuildQuery) AllX

func (gq *GuildQuery) AllX(ctx context.Context) []*Guild

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

func (*GuildQuery) Clone

func (gq *GuildQuery) Clone() *GuildQuery

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

func (*GuildQuery) Count

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

Count returns the count of the given query.

func (*GuildQuery) CountX

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

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

func (*GuildQuery) Exist

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

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

func (*GuildQuery) ExistX

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

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

func (*GuildQuery) First

func (gq *GuildQuery) First(ctx context.Context) (*Guild, error)

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

func (*GuildQuery) FirstID

func (gq *GuildQuery) FirstID(ctx context.Context) (id snowflake.ID, err error)

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

func (*GuildQuery) FirstIDX

func (gq *GuildQuery) FirstIDX(ctx context.Context) snowflake.ID

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

func (*GuildQuery) FirstX

func (gq *GuildQuery) FirstX(ctx context.Context) *Guild

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

func (*GuildQuery) GroupBy

func (gq *GuildQuery) GroupBy(field string, fields ...string) *GuildGroupBy

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

Example:

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

client.Guild.Query().
	GroupBy(guild.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GuildQuery) IDs

func (gq *GuildQuery) IDs(ctx context.Context) (ids []snowflake.ID, err error)

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

func (*GuildQuery) IDsX

func (gq *GuildQuery) IDsX(ctx context.Context) []snowflake.ID

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

func (*GuildQuery) Limit

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

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

func (*GuildQuery) Offset

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

Offset to start from.

func (*GuildQuery) Only

func (gq *GuildQuery) Only(ctx context.Context) (*Guild, error)

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

func (*GuildQuery) OnlyID

func (gq *GuildQuery) OnlyID(ctx context.Context) (id snowflake.ID, err error)

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

func (*GuildQuery) OnlyIDX

func (gq *GuildQuery) OnlyIDX(ctx context.Context) snowflake.ID

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

func (*GuildQuery) OnlyX

func (gq *GuildQuery) OnlyX(ctx context.Context) *Guild

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

func (*GuildQuery) Order

func (gq *GuildQuery) Order(o ...OrderFunc) *GuildQuery

Order specifies how the records should be ordered.

func (*GuildQuery) Select

func (gq *GuildQuery) Select(fields ...string) *GuildSelect

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

Example:

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

client.Guild.Query().
	Select(guild.FieldName).
	Scan(ctx, &v)

func (*GuildQuery) Unique

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

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

func (gq *GuildQuery) Where(ps ...predicate.Guild) *GuildQuery

Where adds a new predicate for the GuildQuery builder.

type GuildSelect

type GuildSelect struct {
	*GuildQuery
	// contains filtered or unexported fields
}

GuildSelect is the builder for selecting fields of Guild entities.

func (*GuildSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*GuildSelect) Bool

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

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

func (*GuildSelect) BoolX

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

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

func (*GuildSelect) Bools

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

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

func (*GuildSelect) BoolsX

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

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

func (*GuildSelect) Float64

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

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

func (*GuildSelect) Float64X

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

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

func (*GuildSelect) Float64s

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

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

func (*GuildSelect) Float64sX

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

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

func (*GuildSelect) Int

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

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

func (*GuildSelect) IntX

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

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

func (*GuildSelect) Ints

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

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

func (*GuildSelect) IntsX

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

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

func (*GuildSelect) Scan

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

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

func (*GuildSelect) ScanX

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

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

func (*GuildSelect) String

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

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

func (*GuildSelect) StringX

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

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

func (*GuildSelect) Strings

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

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

func (*GuildSelect) StringsX

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

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

type GuildUpdate

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

GuildUpdate is the builder for updating Guild entities.

func (*GuildUpdate) AddPlayerChannelID

func (gu *GuildUpdate) AddPlayerChannelID(s snowflake.ID) *GuildUpdate

AddPlayerChannelID adds s to the "player_channel_id" field.

func (*GuildUpdate) AddPlayerMessageID

func (gu *GuildUpdate) AddPlayerMessageID(s snowflake.ID) *GuildUpdate

AddPlayerMessageID adds s to the "player_message_id" field.

func (*GuildUpdate) ClearPlayerChannelID

func (gu *GuildUpdate) ClearPlayerChannelID() *GuildUpdate

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildUpdate) ClearPlayerMessageID

func (gu *GuildUpdate) ClearPlayerMessageID() *GuildUpdate

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildUpdate) Exec

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

Exec executes the query.

func (*GuildUpdate) ExecX

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

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

func (*GuildUpdate) Mutation

func (gu *GuildUpdate) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildUpdate) Save

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

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

func (*GuildUpdate) SaveX

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

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

func (*GuildUpdate) SetCreatedAt

func (gu *GuildUpdate) SetCreatedAt(t time.Time) *GuildUpdate

SetCreatedAt sets the "created_at" field.

func (*GuildUpdate) SetName

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

SetName sets the "name" field.

func (*GuildUpdate) SetNillableCreatedAt

func (gu *GuildUpdate) SetNillableCreatedAt(t *time.Time) *GuildUpdate

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

func (*GuildUpdate) SetNillablePlayerChannelID

func (gu *GuildUpdate) SetNillablePlayerChannelID(s *snowflake.ID) *GuildUpdate

SetNillablePlayerChannelID sets the "player_channel_id" field if the given value is not nil.

func (*GuildUpdate) SetNillablePlayerMessageID

func (gu *GuildUpdate) SetNillablePlayerMessageID(s *snowflake.ID) *GuildUpdate

SetNillablePlayerMessageID sets the "player_message_id" field if the given value is not nil.

func (*GuildUpdate) SetPlayerChannelID

func (gu *GuildUpdate) SetPlayerChannelID(s snowflake.ID) *GuildUpdate

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildUpdate) SetPlayerMessageID

func (gu *GuildUpdate) SetPlayerMessageID(s snowflake.ID) *GuildUpdate

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildUpdate) SetUpdatedAt

func (gu *GuildUpdate) SetUpdatedAt(t time.Time) *GuildUpdate

SetUpdatedAt sets the "updated_at" field.

func (*GuildUpdate) Where

func (gu *GuildUpdate) Where(ps ...predicate.Guild) *GuildUpdate

Where appends a list predicates to the GuildUpdate builder.

type GuildUpdateOne

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

GuildUpdateOne is the builder for updating a single Guild entity.

func (*GuildUpdateOne) AddPlayerChannelID

func (guo *GuildUpdateOne) AddPlayerChannelID(s snowflake.ID) *GuildUpdateOne

AddPlayerChannelID adds s to the "player_channel_id" field.

func (*GuildUpdateOne) AddPlayerMessageID

func (guo *GuildUpdateOne) AddPlayerMessageID(s snowflake.ID) *GuildUpdateOne

AddPlayerMessageID adds s to the "player_message_id" field.

func (*GuildUpdateOne) ClearPlayerChannelID

func (guo *GuildUpdateOne) ClearPlayerChannelID() *GuildUpdateOne

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildUpdateOne) ClearPlayerMessageID

func (guo *GuildUpdateOne) ClearPlayerMessageID() *GuildUpdateOne

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildUpdateOne) Exec

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

Exec executes the query on the entity.

func (*GuildUpdateOne) ExecX

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

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

func (*GuildUpdateOne) Mutation

func (guo *GuildUpdateOne) Mutation() *GuildMutation

Mutation returns the GuildMutation object of the builder.

func (*GuildUpdateOne) Save

func (guo *GuildUpdateOne) Save(ctx context.Context) (*Guild, error)

Save executes the query and returns the updated Guild entity.

func (*GuildUpdateOne) SaveX

func (guo *GuildUpdateOne) SaveX(ctx context.Context) *Guild

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

func (*GuildUpdateOne) Select

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

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

func (*GuildUpdateOne) SetCreatedAt

func (guo *GuildUpdateOne) SetCreatedAt(t time.Time) *GuildUpdateOne

SetCreatedAt sets the "created_at" field.

func (*GuildUpdateOne) SetName

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

SetName sets the "name" field.

func (*GuildUpdateOne) SetNillableCreatedAt

func (guo *GuildUpdateOne) SetNillableCreatedAt(t *time.Time) *GuildUpdateOne

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

func (*GuildUpdateOne) SetNillablePlayerChannelID

func (guo *GuildUpdateOne) SetNillablePlayerChannelID(s *snowflake.ID) *GuildUpdateOne

SetNillablePlayerChannelID sets the "player_channel_id" field if the given value is not nil.

func (*GuildUpdateOne) SetNillablePlayerMessageID

func (guo *GuildUpdateOne) SetNillablePlayerMessageID(s *snowflake.ID) *GuildUpdateOne

SetNillablePlayerMessageID sets the "player_message_id" field if the given value is not nil.

func (*GuildUpdateOne) SetPlayerChannelID

func (guo *GuildUpdateOne) SetPlayerChannelID(s snowflake.ID) *GuildUpdateOne

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildUpdateOne) SetPlayerMessageID

func (guo *GuildUpdateOne) SetPlayerMessageID(s snowflake.ID) *GuildUpdateOne

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildUpdateOne) SetUpdatedAt

func (guo *GuildUpdateOne) SetUpdatedAt(t time.Time) *GuildUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*GuildUpdateOne) Where

func (guo *GuildUpdateOne) Where(ps ...predicate.Guild) *GuildUpdateOne

Where appends a list predicates to the GuildUpdate builder.

type GuildUpsert

type GuildUpsert struct {
	*sql.UpdateSet
}

GuildUpsert is the "OnConflict" setter.

func (*GuildUpsert) AddPlayerChannelID

func (u *GuildUpsert) AddPlayerChannelID(v snowflake.ID) *GuildUpsert

AddPlayerChannelID adds v to the "player_channel_id" field.

func (*GuildUpsert) AddPlayerMessageID

func (u *GuildUpsert) AddPlayerMessageID(v snowflake.ID) *GuildUpsert

AddPlayerMessageID adds v to the "player_message_id" field.

func (*GuildUpsert) ClearPlayerChannelID

func (u *GuildUpsert) ClearPlayerChannelID() *GuildUpsert

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildUpsert) ClearPlayerMessageID

func (u *GuildUpsert) ClearPlayerMessageID() *GuildUpsert

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildUpsert) SetCreatedAt

func (u *GuildUpsert) SetCreatedAt(v time.Time) *GuildUpsert

SetCreatedAt sets the "created_at" field.

func (*GuildUpsert) SetName

func (u *GuildUpsert) SetName(v string) *GuildUpsert

SetName sets the "name" field.

func (*GuildUpsert) SetPlayerChannelID

func (u *GuildUpsert) SetPlayerChannelID(v snowflake.ID) *GuildUpsert

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildUpsert) SetPlayerMessageID

func (u *GuildUpsert) SetPlayerMessageID(v snowflake.ID) *GuildUpsert

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildUpsert) SetUpdatedAt

func (u *GuildUpsert) SetUpdatedAt(v time.Time) *GuildUpsert

SetUpdatedAt sets the "updated_at" field.

func (*GuildUpsert) UpdateCreatedAt

func (u *GuildUpsert) UpdateCreatedAt() *GuildUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*GuildUpsert) UpdateName

func (u *GuildUpsert) UpdateName() *GuildUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*GuildUpsert) UpdatePlayerChannelID

func (u *GuildUpsert) UpdatePlayerChannelID() *GuildUpsert

UpdatePlayerChannelID sets the "player_channel_id" field to the value that was provided on create.

func (*GuildUpsert) UpdatePlayerMessageID

func (u *GuildUpsert) UpdatePlayerMessageID() *GuildUpsert

UpdatePlayerMessageID sets the "player_message_id" field to the value that was provided on create.

func (*GuildUpsert) UpdateUpdatedAt

func (u *GuildUpsert) UpdateUpdatedAt() *GuildUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type GuildUpsertBulk

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

GuildUpsertBulk is the builder for "upsert"-ing a bulk of Guild nodes.

func (*GuildUpsertBulk) AddPlayerChannelID

func (u *GuildUpsertBulk) AddPlayerChannelID(v snowflake.ID) *GuildUpsertBulk

AddPlayerChannelID adds v to the "player_channel_id" field.

func (*GuildUpsertBulk) AddPlayerMessageID

func (u *GuildUpsertBulk) AddPlayerMessageID(v snowflake.ID) *GuildUpsertBulk

AddPlayerMessageID adds v to the "player_message_id" field.

func (*GuildUpsertBulk) ClearPlayerChannelID

func (u *GuildUpsertBulk) ClearPlayerChannelID() *GuildUpsertBulk

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildUpsertBulk) ClearPlayerMessageID

func (u *GuildUpsertBulk) ClearPlayerMessageID() *GuildUpsertBulk

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildUpsertBulk) DoNothing

func (u *GuildUpsertBulk) DoNothing() *GuildUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*GuildUpsertBulk) Exec

func (u *GuildUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*GuildUpsertBulk) ExecX

func (u *GuildUpsertBulk) ExecX(ctx context.Context)

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

func (*GuildUpsertBulk) Ignore

func (u *GuildUpsertBulk) Ignore() *GuildUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Guild.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*GuildUpsertBulk) SetCreatedAt

func (u *GuildUpsertBulk) SetCreatedAt(v time.Time) *GuildUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*GuildUpsertBulk) SetName

func (u *GuildUpsertBulk) SetName(v string) *GuildUpsertBulk

SetName sets the "name" field.

func (*GuildUpsertBulk) SetPlayerChannelID

func (u *GuildUpsertBulk) SetPlayerChannelID(v snowflake.ID) *GuildUpsertBulk

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildUpsertBulk) SetPlayerMessageID

func (u *GuildUpsertBulk) SetPlayerMessageID(v snowflake.ID) *GuildUpsertBulk

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildUpsertBulk) SetUpdatedAt

func (u *GuildUpsertBulk) SetUpdatedAt(v time.Time) *GuildUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*GuildUpsertBulk) Update

func (u *GuildUpsertBulk) Update(set func(*GuildUpsert)) *GuildUpsertBulk

Update allows overriding fields `UPDATE` values. See the GuildCreateBulk.OnConflict documentation for more info.

func (*GuildUpsertBulk) UpdateCreatedAt

func (u *GuildUpsertBulk) UpdateCreatedAt() *GuildUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*GuildUpsertBulk) UpdateName

func (u *GuildUpsertBulk) UpdateName() *GuildUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*GuildUpsertBulk) UpdateNewValues

func (u *GuildUpsertBulk) UpdateNewValues() *GuildUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Guild.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(guild.FieldID)
		}),
	).
	Exec(ctx)

func (*GuildUpsertBulk) UpdatePlayerChannelID

func (u *GuildUpsertBulk) UpdatePlayerChannelID() *GuildUpsertBulk

UpdatePlayerChannelID sets the "player_channel_id" field to the value that was provided on create.

func (*GuildUpsertBulk) UpdatePlayerMessageID

func (u *GuildUpsertBulk) UpdatePlayerMessageID() *GuildUpsertBulk

UpdatePlayerMessageID sets the "player_message_id" field to the value that was provided on create.

func (*GuildUpsertBulk) UpdateUpdatedAt

func (u *GuildUpsertBulk) UpdateUpdatedAt() *GuildUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type GuildUpsertOne

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

GuildUpsertOne is the builder for "upsert"-ing

one Guild node.

func (*GuildUpsertOne) AddPlayerChannelID

func (u *GuildUpsertOne) AddPlayerChannelID(v snowflake.ID) *GuildUpsertOne

AddPlayerChannelID adds v to the "player_channel_id" field.

func (*GuildUpsertOne) AddPlayerMessageID

func (u *GuildUpsertOne) AddPlayerMessageID(v snowflake.ID) *GuildUpsertOne

AddPlayerMessageID adds v to the "player_message_id" field.

func (*GuildUpsertOne) ClearPlayerChannelID

func (u *GuildUpsertOne) ClearPlayerChannelID() *GuildUpsertOne

ClearPlayerChannelID clears the value of the "player_channel_id" field.

func (*GuildUpsertOne) ClearPlayerMessageID

func (u *GuildUpsertOne) ClearPlayerMessageID() *GuildUpsertOne

ClearPlayerMessageID clears the value of the "player_message_id" field.

func (*GuildUpsertOne) DoNothing

func (u *GuildUpsertOne) DoNothing() *GuildUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*GuildUpsertOne) Exec

func (u *GuildUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*GuildUpsertOne) ExecX

func (u *GuildUpsertOne) ExecX(ctx context.Context)

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

func (*GuildUpsertOne) ID

func (u *GuildUpsertOne) ID(ctx context.Context) (id snowflake.ID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*GuildUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*GuildUpsertOne) Ignore

func (u *GuildUpsertOne) Ignore() *GuildUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Guild.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*GuildUpsertOne) SetCreatedAt

func (u *GuildUpsertOne) SetCreatedAt(v time.Time) *GuildUpsertOne

SetCreatedAt sets the "created_at" field.

func (*GuildUpsertOne) SetName

func (u *GuildUpsertOne) SetName(v string) *GuildUpsertOne

SetName sets the "name" field.

func (*GuildUpsertOne) SetPlayerChannelID

func (u *GuildUpsertOne) SetPlayerChannelID(v snowflake.ID) *GuildUpsertOne

SetPlayerChannelID sets the "player_channel_id" field.

func (*GuildUpsertOne) SetPlayerMessageID

func (u *GuildUpsertOne) SetPlayerMessageID(v snowflake.ID) *GuildUpsertOne

SetPlayerMessageID sets the "player_message_id" field.

func (*GuildUpsertOne) SetUpdatedAt

func (u *GuildUpsertOne) SetUpdatedAt(v time.Time) *GuildUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*GuildUpsertOne) Update

func (u *GuildUpsertOne) Update(set func(*GuildUpsert)) *GuildUpsertOne

Update allows overriding fields `UPDATE` values. See the GuildCreate.OnConflict documentation for more info.

func (*GuildUpsertOne) UpdateCreatedAt

func (u *GuildUpsertOne) UpdateCreatedAt() *GuildUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*GuildUpsertOne) UpdateName

func (u *GuildUpsertOne) UpdateName() *GuildUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*GuildUpsertOne) UpdateNewValues

func (u *GuildUpsertOne) UpdateNewValues() *GuildUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Guild.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(guild.FieldID)
		}),
	).
	Exec(ctx)

func (*GuildUpsertOne) UpdatePlayerChannelID

func (u *GuildUpsertOne) UpdatePlayerChannelID() *GuildUpsertOne

UpdatePlayerChannelID sets the "player_channel_id" field to the value that was provided on create.

func (*GuildUpsertOne) UpdatePlayerMessageID

func (u *GuildUpsertOne) UpdatePlayerMessageID() *GuildUpsertOne

UpdatePlayerMessageID sets the "player_message_id" field to the value that was provided on create.

func (*GuildUpsertOne) UpdateUpdatedAt

func (u *GuildUpsertOne) UpdateUpdatedAt() *GuildUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Guilds

type Guilds []*Guild

Guilds is a parsable slice of Guild.

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

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Guild is the client for interacting with the Guild builders.
	Guild *GuildClient
	// 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