ent

package
v0.0.0-...-bfcbe3c Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeEntUser     = "EntUser"
	TypeEntUserName = "EntUserName"
)

Variables

This section is empty.

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 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
	// EntUser is the client for interacting with the EntUser builders.
	EntUser *EntUserClient
	// EntUserName is the client for interacting with the EntUserName builders.
	EntUserName *EntUserNameClient
	// 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().
	EntUser.
	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 EntUser

type EntUser struct {

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

EntUser is the model entity for the EntUser schema.

func (*EntUser) QueryEntUserNames

func (eu *EntUser) QueryEntUserNames() *EntUserNameQuery

QueryEntUserNames queries the "ent_user_names" edge of the EntUser entity.

func (*EntUser) String

func (eu *EntUser) String() string

String implements the fmt.Stringer.

func (*EntUser) Unwrap

func (eu *EntUser) Unwrap() *EntUser

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

func (eu *EntUser) Update() *EntUserUpdateOne

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

func (*EntUser) Value

func (eu *EntUser) Value(name string) (ent.Value, error)

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

type EntUserClient

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

EntUserClient is a client for the EntUser schema.

func NewEntUserClient

func NewEntUserClient(c config) *EntUserClient

NewEntUserClient returns a client for the EntUser from the given config.

func (*EntUserClient) Create

func (c *EntUserClient) Create() *EntUserCreate

Create returns a builder for creating a EntUser entity.

func (*EntUserClient) CreateBulk

func (c *EntUserClient) CreateBulk(builders ...*EntUserCreate) *EntUserCreateBulk

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

func (*EntUserClient) Delete

func (c *EntUserClient) Delete() *EntUserDelete

Delete returns a delete builder for EntUser.

func (*EntUserClient) DeleteOne

func (c *EntUserClient) DeleteOne(eu *EntUser) *EntUserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*EntUserClient) DeleteOneID

func (c *EntUserClient) DeleteOneID(id uuid.UUID) *EntUserDeleteOne

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

func (*EntUserClient) Get

func (c *EntUserClient) Get(ctx context.Context, id uuid.UUID) (*EntUser, error)

Get returns a EntUser entity by its id.

func (*EntUserClient) GetX

func (c *EntUserClient) GetX(ctx context.Context, id uuid.UUID) *EntUser

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

func (*EntUserClient) Hooks

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

Hooks returns the client hooks.

func (*EntUserClient) Intercept

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

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

func (*EntUserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*EntUserClient) Query

func (c *EntUserClient) Query() *EntUserQuery

Query returns a query builder for EntUser.

func (*EntUserClient) QueryEntUserNames

func (c *EntUserClient) QueryEntUserNames(eu *EntUser) *EntUserNameQuery

QueryEntUserNames queries the ent_user_names edge of a EntUser.

func (*EntUserClient) Update

func (c *EntUserClient) Update() *EntUserUpdate

Update returns an update builder for EntUser.

func (*EntUserClient) UpdateOne

func (c *EntUserClient) UpdateOne(eu *EntUser) *EntUserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EntUserClient) UpdateOneID

func (c *EntUserClient) UpdateOneID(id uuid.UUID) *EntUserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EntUserClient) Use

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

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

type EntUserCreate

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

EntUserCreate is the builder for creating a EntUser entity.

func (*EntUserCreate) AddEntUserNameIDs

func (euc *EntUserCreate) AddEntUserNameIDs(ids ...uuid.UUID) *EntUserCreate

AddEntUserNameIDs adds the "ent_user_names" edge to the EntUserName entity by IDs.

func (*EntUserCreate) AddEntUserNames

func (euc *EntUserCreate) AddEntUserNames(e ...*EntUserName) *EntUserCreate

AddEntUserNames adds the "ent_user_names" edges to the EntUserName entity.

func (*EntUserCreate) Exec

func (euc *EntUserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserCreate) ExecX

func (euc *EntUserCreate) ExecX(ctx context.Context)

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

func (*EntUserCreate) Mutation

func (euc *EntUserCreate) Mutation() *EntUserMutation

Mutation returns the EntUserMutation object of the builder.

func (*EntUserCreate) Save

func (euc *EntUserCreate) Save(ctx context.Context) (*EntUser, error)

Save creates the EntUser in the database.

func (*EntUserCreate) SaveX

func (euc *EntUserCreate) SaveX(ctx context.Context) *EntUser

SaveX calls Save and panics if Save returns an error.

func (*EntUserCreate) SetCreatedAt

func (euc *EntUserCreate) SetCreatedAt(t time.Time) *EntUserCreate

SetCreatedAt sets the "created_at" field.

func (*EntUserCreate) SetDeleted

func (euc *EntUserCreate) SetDeleted(b bool) *EntUserCreate

SetDeleted sets the "deleted" field.

func (*EntUserCreate) SetID

func (euc *EntUserCreate) SetID(u uuid.UUID) *EntUserCreate

SetID sets the "id" field.

func (*EntUserCreate) SetNillableCreatedAt

func (euc *EntUserCreate) SetNillableCreatedAt(t *time.Time) *EntUserCreate

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

func (*EntUserCreate) SetNillableDeleted

func (euc *EntUserCreate) SetNillableDeleted(b *bool) *EntUserCreate

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserCreate) SetNillableID

func (euc *EntUserCreate) SetNillableID(u *uuid.UUID) *EntUserCreate

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

func (*EntUserCreate) SetNillableUpdatedAt

func (euc *EntUserCreate) SetNillableUpdatedAt(t *time.Time) *EntUserCreate

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

func (*EntUserCreate) SetUpdatedAt

func (euc *EntUserCreate) SetUpdatedAt(t time.Time) *EntUserCreate

SetUpdatedAt sets the "updated_at" field.

type EntUserCreateBulk

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

EntUserCreateBulk is the builder for creating many EntUser entities in bulk.

func (*EntUserCreateBulk) Exec

func (eucb *EntUserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserCreateBulk) ExecX

func (eucb *EntUserCreateBulk) ExecX(ctx context.Context)

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

func (*EntUserCreateBulk) Save

func (eucb *EntUserCreateBulk) Save(ctx context.Context) ([]*EntUser, error)

Save creates the EntUser entities in the database.

func (*EntUserCreateBulk) SaveX

func (eucb *EntUserCreateBulk) SaveX(ctx context.Context) []*EntUser

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

type EntUserDelete

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

EntUserDelete is the builder for deleting a EntUser entity.

func (*EntUserDelete) Exec

func (eud *EntUserDelete) Exec(ctx context.Context) (int, error)

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

func (*EntUserDelete) ExecX

func (eud *EntUserDelete) ExecX(ctx context.Context) int

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

func (*EntUserDelete) Where

func (eud *EntUserDelete) Where(ps ...predicate.EntUser) *EntUserDelete

Where appends a list predicates to the EntUserDelete builder.

type EntUserDeleteOne

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

EntUserDeleteOne is the builder for deleting a single EntUser entity.

func (*EntUserDeleteOne) Exec

func (eudo *EntUserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EntUserDeleteOne) ExecX

func (eudo *EntUserDeleteOne) ExecX(ctx context.Context)

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

func (*EntUserDeleteOne) Where

func (eudo *EntUserDeleteOne) Where(ps ...predicate.EntUser) *EntUserDeleteOne

Where appends a list predicates to the EntUserDelete builder.

type EntUserEdges

type EntUserEdges struct {
	// EntUserNames holds the value of the ent_user_names edge.
	EntUserNames []*EntUserName `json:"ent_user_names,omitempty"`
	// contains filtered or unexported fields
}

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

func (EntUserEdges) EntUserNamesOrErr

func (e EntUserEdges) EntUserNamesOrErr() ([]*EntUserName, error)

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

type EntUserGroupBy

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

EntUserGroupBy is the group-by builder for EntUser entities.

func (*EntUserGroupBy) Aggregate

func (eugb *EntUserGroupBy) Aggregate(fns ...AggregateFunc) *EntUserGroupBy

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

func (*EntUserGroupBy) Bool

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

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

func (*EntUserGroupBy) BoolX

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

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

func (*EntUserGroupBy) Bools

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

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

func (*EntUserGroupBy) BoolsX

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

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

func (*EntUserGroupBy) Float64

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

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

func (*EntUserGroupBy) Float64X

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

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

func (*EntUserGroupBy) Float64s

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

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

func (*EntUserGroupBy) Float64sX

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

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

func (*EntUserGroupBy) Int

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

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

func (*EntUserGroupBy) IntX

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

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

func (*EntUserGroupBy) Ints

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

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

func (*EntUserGroupBy) IntsX

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

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

func (*EntUserGroupBy) Scan

func (eugb *EntUserGroupBy) Scan(ctx context.Context, v any) error

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

func (*EntUserGroupBy) ScanX

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

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

func (*EntUserGroupBy) String

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

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

func (*EntUserGroupBy) StringX

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

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

func (*EntUserGroupBy) Strings

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

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

func (*EntUserGroupBy) StringsX

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

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

type EntUserMutation

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

EntUserMutation represents an operation that mutates the EntUser nodes in the graph.

func (*EntUserMutation) AddEntUserNameIDs

func (m *EntUserMutation) AddEntUserNameIDs(ids ...uuid.UUID)

AddEntUserNameIDs adds the "ent_user_names" edge to the EntUserName entity by ids.

func (*EntUserMutation) AddField

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

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

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

func (*EntUserMutation) AddedField

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

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

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

func (*EntUserMutation) AddedIDs

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

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

func (*EntUserMutation) ClearEdge

func (m *EntUserMutation) 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 (*EntUserMutation) ClearEntUserNames

func (m *EntUserMutation) ClearEntUserNames()

ClearEntUserNames clears the "ent_user_names" edge to the EntUserName entity.

func (*EntUserMutation) ClearField

func (m *EntUserMutation) 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 (*EntUserMutation) ClearedEdges

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

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

func (*EntUserMutation) ClearedFields

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

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

func (EntUserMutation) Client

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

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

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

func (*EntUserMutation) Deleted

func (m *EntUserMutation) Deleted() (r bool, exists bool)

Deleted returns the value of the "deleted" field in the mutation.

func (*EntUserMutation) EdgeCleared

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

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

func (*EntUserMutation) EntUserNamesCleared

func (m *EntUserMutation) EntUserNamesCleared() bool

EntUserNamesCleared reports if the "ent_user_names" edge to the EntUserName entity was cleared.

func (*EntUserMutation) EntUserNamesIDs

func (m *EntUserMutation) EntUserNamesIDs() (ids []uuid.UUID)

EntUserNamesIDs returns the "ent_user_names" edge IDs in the mutation.

func (*EntUserMutation) Field

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

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

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

func (*EntUserMutation) Fields

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

func (m *EntUserMutation) ID() (id uuid.UUID, exists bool)

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

func (*EntUserMutation) IDs

func (m *EntUserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*EntUserMutation) OldCreatedAt

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

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

func (m *EntUserMutation) OldDeleted(ctx context.Context) (v bool, err error)

OldDeleted returns the old "deleted" field's value of the EntUser entity. If the EntUser 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 (*EntUserMutation) OldField

func (m *EntUserMutation) 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 (*EntUserMutation) OldUpdatedAt

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

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

func (m *EntUserMutation) Op() Op

Op returns the operation name.

func (*EntUserMutation) RemoveEntUserNameIDs

func (m *EntUserMutation) RemoveEntUserNameIDs(ids ...uuid.UUID)

RemoveEntUserNameIDs removes the "ent_user_names" edge to the EntUserName entity by IDs.

func (*EntUserMutation) RemovedEdges

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

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

func (*EntUserMutation) RemovedEntUserNamesIDs

func (m *EntUserMutation) RemovedEntUserNamesIDs() (ids []uuid.UUID)

RemovedEntUserNames returns the removed IDs of the "ent_user_names" edge to the EntUserName entity.

func (*EntUserMutation) RemovedIDs

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

func (m *EntUserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*EntUserMutation) ResetDeleted

func (m *EntUserMutation) ResetDeleted()

ResetDeleted resets all changes to the "deleted" field.

func (*EntUserMutation) ResetEdge

func (m *EntUserMutation) 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 (*EntUserMutation) ResetEntUserNames

func (m *EntUserMutation) ResetEntUserNames()

ResetEntUserNames resets all changes to the "ent_user_names" edge.

func (*EntUserMutation) ResetField

func (m *EntUserMutation) 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 (*EntUserMutation) ResetUpdatedAt

func (m *EntUserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*EntUserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*EntUserMutation) SetDeleted

func (m *EntUserMutation) SetDeleted(b bool)

SetDeleted sets the "deleted" field.

func (*EntUserMutation) SetField

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

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

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

func (*EntUserMutation) SetOp

func (m *EntUserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*EntUserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (EntUserMutation) Tx

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

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

func (*EntUserMutation) Type

func (m *EntUserMutation) Type() string

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

func (*EntUserMutation) UpdatedAt

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

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

func (*EntUserMutation) Where

func (m *EntUserMutation) Where(ps ...predicate.EntUser)

Where appends a list predicates to the EntUserMutation builder.

func (*EntUserMutation) WhereP

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

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

type EntUserName

type EntUserName struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID uuid.UUID `json:"user_id,omitempty"`
	// Value holds the value of the "value" field.
	Value string `json:"value,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"`
	// Deleted holds the value of the "deleted" field.
	Deleted bool `json:"deleted,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the EntUserNameQuery when eager-loading is set.
	Edges EntUserNameEdges `json:"edges"`
	// contains filtered or unexported fields
}

EntUserName is the model entity for the EntUserName schema.

func (*EntUserName) GetValue

func (eun *EntUserName) GetValue(name string) (ent.Value, error)

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

func (*EntUserName) QueryEntUser

func (eun *EntUserName) QueryEntUser() *EntUserQuery

QueryEntUser queries the "ent_user" edge of the EntUserName entity.

func (*EntUserName) String

func (eun *EntUserName) String() string

String implements the fmt.Stringer.

func (*EntUserName) Unwrap

func (eun *EntUserName) Unwrap() *EntUserName

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

func (eun *EntUserName) Update() *EntUserNameUpdateOne

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

type EntUserNameClient

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

EntUserNameClient is a client for the EntUserName schema.

func NewEntUserNameClient

func NewEntUserNameClient(c config) *EntUserNameClient

NewEntUserNameClient returns a client for the EntUserName from the given config.

func (*EntUserNameClient) Create

func (c *EntUserNameClient) Create() *EntUserNameCreate

Create returns a builder for creating a EntUserName entity.

func (*EntUserNameClient) CreateBulk

func (c *EntUserNameClient) CreateBulk(builders ...*EntUserNameCreate) *EntUserNameCreateBulk

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

func (*EntUserNameClient) Delete

func (c *EntUserNameClient) Delete() *EntUserNameDelete

Delete returns a delete builder for EntUserName.

func (*EntUserNameClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*EntUserNameClient) DeleteOneID

func (c *EntUserNameClient) DeleteOneID(id uuid.UUID) *EntUserNameDeleteOne

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

func (*EntUserNameClient) Get

Get returns a EntUserName entity by its id.

func (*EntUserNameClient) GetX

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

func (*EntUserNameClient) Hooks

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

Hooks returns the client hooks.

func (*EntUserNameClient) Intercept

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

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

func (*EntUserNameClient) Interceptors

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

Interceptors returns the client interceptors.

func (*EntUserNameClient) Query

func (c *EntUserNameClient) Query() *EntUserNameQuery

Query returns a query builder for EntUserName.

func (*EntUserNameClient) QueryEntUser

func (c *EntUserNameClient) QueryEntUser(eun *EntUserName) *EntUserQuery

QueryEntUser queries the ent_user edge of a EntUserName.

func (*EntUserNameClient) Update

func (c *EntUserNameClient) Update() *EntUserNameUpdate

Update returns an update builder for EntUserName.

func (*EntUserNameClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*EntUserNameClient) UpdateOneID

func (c *EntUserNameClient) UpdateOneID(id uuid.UUID) *EntUserNameUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EntUserNameClient) Use

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

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

type EntUserNameCreate

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

EntUserNameCreate is the builder for creating a EntUserName entity.

func (*EntUserNameCreate) Exec

func (eunc *EntUserNameCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserNameCreate) ExecX

func (eunc *EntUserNameCreate) ExecX(ctx context.Context)

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

func (*EntUserNameCreate) Mutation

func (eunc *EntUserNameCreate) Mutation() *EntUserNameMutation

Mutation returns the EntUserNameMutation object of the builder.

func (*EntUserNameCreate) Save

func (eunc *EntUserNameCreate) Save(ctx context.Context) (*EntUserName, error)

Save creates the EntUserName in the database.

func (*EntUserNameCreate) SaveX

func (eunc *EntUserNameCreate) SaveX(ctx context.Context) *EntUserName

SaveX calls Save and panics if Save returns an error.

func (*EntUserNameCreate) SetCreatedAt

func (eunc *EntUserNameCreate) SetCreatedAt(t time.Time) *EntUserNameCreate

SetCreatedAt sets the "created_at" field.

func (*EntUserNameCreate) SetDeleted

func (eunc *EntUserNameCreate) SetDeleted(b bool) *EntUserNameCreate

SetDeleted sets the "deleted" field.

func (*EntUserNameCreate) SetEntUser

func (eunc *EntUserNameCreate) SetEntUser(e *EntUser) *EntUserNameCreate

SetEntUser sets the "ent_user" edge to the EntUser entity.

func (*EntUserNameCreate) SetEntUserID

func (eunc *EntUserNameCreate) SetEntUserID(id uuid.UUID) *EntUserNameCreate

SetEntUserID sets the "ent_user" edge to the EntUser entity by ID.

func (*EntUserNameCreate) SetID

func (eunc *EntUserNameCreate) SetID(u uuid.UUID) *EntUserNameCreate

SetID sets the "id" field.

func (*EntUserNameCreate) SetNillableCreatedAt

func (eunc *EntUserNameCreate) SetNillableCreatedAt(t *time.Time) *EntUserNameCreate

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

func (*EntUserNameCreate) SetNillableDeleted

func (eunc *EntUserNameCreate) SetNillableDeleted(b *bool) *EntUserNameCreate

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserNameCreate) SetNillableID

func (eunc *EntUserNameCreate) SetNillableID(u *uuid.UUID) *EntUserNameCreate

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

func (*EntUserNameCreate) SetNillableUpdatedAt

func (eunc *EntUserNameCreate) SetNillableUpdatedAt(t *time.Time) *EntUserNameCreate

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

func (*EntUserNameCreate) SetUpdatedAt

func (eunc *EntUserNameCreate) SetUpdatedAt(t time.Time) *EntUserNameCreate

SetUpdatedAt sets the "updated_at" field.

func (*EntUserNameCreate) SetUserID

func (eunc *EntUserNameCreate) SetUserID(u uuid.UUID) *EntUserNameCreate

SetUserID sets the "user_id" field.

func (*EntUserNameCreate) SetValue

func (eunc *EntUserNameCreate) SetValue(s string) *EntUserNameCreate

SetValue sets the "value" field.

type EntUserNameCreateBulk

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

EntUserNameCreateBulk is the builder for creating many EntUserName entities in bulk.

func (*EntUserNameCreateBulk) Exec

func (euncb *EntUserNameCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserNameCreateBulk) ExecX

func (euncb *EntUserNameCreateBulk) ExecX(ctx context.Context)

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

func (*EntUserNameCreateBulk) Save

func (euncb *EntUserNameCreateBulk) Save(ctx context.Context) ([]*EntUserName, error)

Save creates the EntUserName entities in the database.

func (*EntUserNameCreateBulk) SaveX

func (euncb *EntUserNameCreateBulk) SaveX(ctx context.Context) []*EntUserName

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

type EntUserNameDelete

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

EntUserNameDelete is the builder for deleting a EntUserName entity.

func (*EntUserNameDelete) Exec

func (eund *EntUserNameDelete) Exec(ctx context.Context) (int, error)

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

func (*EntUserNameDelete) ExecX

func (eund *EntUserNameDelete) ExecX(ctx context.Context) int

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

func (*EntUserNameDelete) Where

Where appends a list predicates to the EntUserNameDelete builder.

type EntUserNameDeleteOne

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

EntUserNameDeleteOne is the builder for deleting a single EntUserName entity.

func (*EntUserNameDeleteOne) Exec

func (eundo *EntUserNameDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EntUserNameDeleteOne) ExecX

func (eundo *EntUserNameDeleteOne) ExecX(ctx context.Context)

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

func (*EntUserNameDeleteOne) Where

Where appends a list predicates to the EntUserNameDelete builder.

type EntUserNameEdges

type EntUserNameEdges struct {
	// EntUser holds the value of the ent_user edge.
	EntUser *EntUser `json:"ent_user,omitempty"`
	// contains filtered or unexported fields
}

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

func (EntUserNameEdges) EntUserOrErr

func (e EntUserNameEdges) EntUserOrErr() (*EntUser, error)

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

type EntUserNameGroupBy

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

EntUserNameGroupBy is the group-by builder for EntUserName entities.

func (*EntUserNameGroupBy) Aggregate

func (eungb *EntUserNameGroupBy) Aggregate(fns ...AggregateFunc) *EntUserNameGroupBy

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

func (*EntUserNameGroupBy) Bool

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

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

func (*EntUserNameGroupBy) BoolX

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

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

func (*EntUserNameGroupBy) Bools

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

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

func (*EntUserNameGroupBy) BoolsX

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

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

func (*EntUserNameGroupBy) Float64

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

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

func (*EntUserNameGroupBy) Float64X

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

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

func (*EntUserNameGroupBy) Float64s

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

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

func (*EntUserNameGroupBy) Float64sX

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

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

func (*EntUserNameGroupBy) Int

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

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

func (*EntUserNameGroupBy) IntX

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

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

func (*EntUserNameGroupBy) Ints

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

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

func (*EntUserNameGroupBy) IntsX

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

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

func (*EntUserNameGroupBy) Scan

func (eungb *EntUserNameGroupBy) Scan(ctx context.Context, v any) error

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

func (*EntUserNameGroupBy) ScanX

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

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

func (*EntUserNameGroupBy) String

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

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

func (*EntUserNameGroupBy) StringX

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

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

func (*EntUserNameGroupBy) Strings

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

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

func (*EntUserNameGroupBy) StringsX

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

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

type EntUserNameMutation

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

EntUserNameMutation represents an operation that mutates the EntUserName nodes in the graph.

func (*EntUserNameMutation) AddField

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

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

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

func (*EntUserNameMutation) AddedField

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

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

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

func (*EntUserNameMutation) AddedIDs

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

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

func (*EntUserNameMutation) ClearEdge

func (m *EntUserNameMutation) 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 (*EntUserNameMutation) ClearEntUser

func (m *EntUserNameMutation) ClearEntUser()

ClearEntUser clears the "ent_user" edge to the EntUser entity.

func (*EntUserNameMutation) ClearField

func (m *EntUserNameMutation) 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 (*EntUserNameMutation) ClearedEdges

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

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

func (*EntUserNameMutation) ClearedFields

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

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

func (EntUserNameMutation) Client

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

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

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

func (*EntUserNameMutation) Deleted

func (m *EntUserNameMutation) Deleted() (r bool, exists bool)

Deleted returns the value of the "deleted" field in the mutation.

func (*EntUserNameMutation) EdgeCleared

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

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

func (*EntUserNameMutation) EntUserCleared

func (m *EntUserNameMutation) EntUserCleared() bool

EntUserCleared reports if the "ent_user" edge to the EntUser entity was cleared.

func (*EntUserNameMutation) EntUserID

func (m *EntUserNameMutation) EntUserID() (id uuid.UUID, exists bool)

EntUserID returns the "ent_user" edge ID in the mutation.

func (*EntUserNameMutation) EntUserIDs

func (m *EntUserNameMutation) EntUserIDs() (ids []uuid.UUID)

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

func (*EntUserNameMutation) Field

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

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

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

func (*EntUserNameMutation) Fields

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

func (m *EntUserNameMutation) ID() (id uuid.UUID, exists bool)

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

func (*EntUserNameMutation) IDs

func (m *EntUserNameMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*EntUserNameMutation) OldCreatedAt

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

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

func (m *EntUserNameMutation) OldDeleted(ctx context.Context) (v bool, err error)

OldDeleted returns the old "deleted" field's value of the EntUserName entity. If the EntUserName 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 (*EntUserNameMutation) OldField

func (m *EntUserNameMutation) 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 (*EntUserNameMutation) OldUpdatedAt

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

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

func (m *EntUserNameMutation) OldUserID(ctx context.Context) (v uuid.UUID, err error)

OldUserID returns the old "user_id" field's value of the EntUserName entity. If the EntUserName 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 (*EntUserNameMutation) OldValue

func (m *EntUserNameMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the EntUserName entity. If the EntUserName 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 (*EntUserNameMutation) Op

func (m *EntUserNameMutation) Op() Op

Op returns the operation name.

func (*EntUserNameMutation) RemovedEdges

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

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

func (*EntUserNameMutation) RemovedIDs

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

func (m *EntUserNameMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*EntUserNameMutation) ResetDeleted

func (m *EntUserNameMutation) ResetDeleted()

ResetDeleted resets all changes to the "deleted" field.

func (*EntUserNameMutation) ResetEdge

func (m *EntUserNameMutation) 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 (*EntUserNameMutation) ResetEntUser

func (m *EntUserNameMutation) ResetEntUser()

ResetEntUser resets all changes to the "ent_user" edge.

func (*EntUserNameMutation) ResetField

func (m *EntUserNameMutation) 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 (*EntUserNameMutation) ResetUpdatedAt

func (m *EntUserNameMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*EntUserNameMutation) ResetUserID

func (m *EntUserNameMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*EntUserNameMutation) ResetValue

func (m *EntUserNameMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*EntUserNameMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*EntUserNameMutation) SetDeleted

func (m *EntUserNameMutation) SetDeleted(b bool)

SetDeleted sets the "deleted" field.

func (*EntUserNameMutation) SetEntUserID

func (m *EntUserNameMutation) SetEntUserID(id uuid.UUID)

SetEntUserID sets the "ent_user" edge to the EntUser entity by id.

func (*EntUserNameMutation) SetField

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

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

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

func (*EntUserNameMutation) SetOp

func (m *EntUserNameMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*EntUserNameMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*EntUserNameMutation) SetUserID

func (m *EntUserNameMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (*EntUserNameMutation) SetValue

func (m *EntUserNameMutation) SetValue(s string)

SetValue sets the "value" field.

func (EntUserNameMutation) Tx

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

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

func (*EntUserNameMutation) Type

func (m *EntUserNameMutation) Type() string

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

func (*EntUserNameMutation) UpdatedAt

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

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

func (*EntUserNameMutation) UserID

func (m *EntUserNameMutation) UserID() (r uuid.UUID, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*EntUserNameMutation) Value

func (m *EntUserNameMutation) Value() (r string, exists bool)

Value returns the value of the "value" field in the mutation.

func (*EntUserNameMutation) Where

func (m *EntUserNameMutation) Where(ps ...predicate.EntUserName)

Where appends a list predicates to the EntUserNameMutation builder.

func (*EntUserNameMutation) WhereP

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

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

type EntUserNameQuery

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

EntUserNameQuery is the builder for querying EntUserName entities.

func (*EntUserNameQuery) Aggregate

func (eunq *EntUserNameQuery) Aggregate(fns ...AggregateFunc) *EntUserNameSelect

Aggregate returns a EntUserNameSelect configured with the given aggregations.

func (*EntUserNameQuery) All

func (eunq *EntUserNameQuery) All(ctx context.Context) ([]*EntUserName, error)

All executes the query and returns a list of EntUserNames.

func (*EntUserNameQuery) AllX

func (eunq *EntUserNameQuery) AllX(ctx context.Context) []*EntUserName

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

func (*EntUserNameQuery) Clone

func (eunq *EntUserNameQuery) Clone() *EntUserNameQuery

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

func (*EntUserNameQuery) Count

func (eunq *EntUserNameQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EntUserNameQuery) CountX

func (eunq *EntUserNameQuery) CountX(ctx context.Context) int

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

func (*EntUserNameQuery) Exist

func (eunq *EntUserNameQuery) Exist(ctx context.Context) (bool, error)

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

func (*EntUserNameQuery) ExistX

func (eunq *EntUserNameQuery) ExistX(ctx context.Context) bool

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

func (*EntUserNameQuery) First

func (eunq *EntUserNameQuery) First(ctx context.Context) (*EntUserName, error)

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

func (*EntUserNameQuery) FirstID

func (eunq *EntUserNameQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*EntUserNameQuery) FirstIDX

func (eunq *EntUserNameQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*EntUserNameQuery) FirstX

func (eunq *EntUserNameQuery) FirstX(ctx context.Context) *EntUserName

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

func (*EntUserNameQuery) GroupBy

func (eunq *EntUserNameQuery) GroupBy(field string, fields ...string) *EntUserNameGroupBy

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 {
	UserID uuid.UUID `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.EntUserName.Query().
	GroupBy(entusername.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EntUserNameQuery) IDs

func (eunq *EntUserNameQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*EntUserNameQuery) IDsX

func (eunq *EntUserNameQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*EntUserNameQuery) Limit

func (eunq *EntUserNameQuery) Limit(limit int) *EntUserNameQuery

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

func (*EntUserNameQuery) Offset

func (eunq *EntUserNameQuery) Offset(offset int) *EntUserNameQuery

Offset to start from.

func (*EntUserNameQuery) Only

func (eunq *EntUserNameQuery) Only(ctx context.Context) (*EntUserName, error)

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

func (*EntUserNameQuery) OnlyID

func (eunq *EntUserNameQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*EntUserNameQuery) OnlyIDX

func (eunq *EntUserNameQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*EntUserNameQuery) OnlyX

func (eunq *EntUserNameQuery) OnlyX(ctx context.Context) *EntUserName

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

func (*EntUserNameQuery) Order

Order specifies how the records should be ordered.

func (*EntUserNameQuery) QueryEntUser

func (eunq *EntUserNameQuery) QueryEntUser() *EntUserQuery

QueryEntUser chains the current query on the "ent_user" edge.

func (*EntUserNameQuery) Select

func (eunq *EntUserNameQuery) Select(fields ...string) *EntUserNameSelect

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 {
	UserID uuid.UUID `json:"user_id,omitempty"`
}

client.EntUserName.Query().
	Select(entusername.FieldUserID).
	Scan(ctx, &v)

func (*EntUserNameQuery) Unique

func (eunq *EntUserNameQuery) Unique(unique bool) *EntUserNameQuery

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

Where adds a new predicate for the EntUserNameQuery builder.

func (*EntUserNameQuery) WithEntUser

func (eunq *EntUserNameQuery) WithEntUser(opts ...func(*EntUserQuery)) *EntUserNameQuery

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

type EntUserNameSelect

type EntUserNameSelect struct {
	*EntUserNameQuery
	// contains filtered or unexported fields
}

EntUserNameSelect is the builder for selecting fields of EntUserName entities.

func (*EntUserNameSelect) Aggregate

func (euns *EntUserNameSelect) Aggregate(fns ...AggregateFunc) *EntUserNameSelect

Aggregate adds the given aggregation functions to the selector query.

func (*EntUserNameSelect) Bool

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

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

func (*EntUserNameSelect) BoolX

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

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

func (*EntUserNameSelect) Bools

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

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

func (*EntUserNameSelect) BoolsX

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

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

func (*EntUserNameSelect) Float64

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

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

func (*EntUserNameSelect) Float64X

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

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

func (*EntUserNameSelect) Float64s

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

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

func (*EntUserNameSelect) Float64sX

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

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

func (*EntUserNameSelect) Int

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

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

func (*EntUserNameSelect) IntX

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

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

func (*EntUserNameSelect) Ints

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

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

func (*EntUserNameSelect) IntsX

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

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

func (*EntUserNameSelect) Scan

func (euns *EntUserNameSelect) Scan(ctx context.Context, v any) error

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

func (*EntUserNameSelect) ScanX

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

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

func (*EntUserNameSelect) String

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

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

func (*EntUserNameSelect) StringX

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

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

func (*EntUserNameSelect) Strings

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

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

func (*EntUserNameSelect) StringsX

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

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

type EntUserNameUpdate

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

EntUserNameUpdate is the builder for updating EntUserName entities.

func (*EntUserNameUpdate) ClearEntUser

func (eunu *EntUserNameUpdate) ClearEntUser() *EntUserNameUpdate

ClearEntUser clears the "ent_user" edge to the EntUser entity.

func (*EntUserNameUpdate) Exec

func (eunu *EntUserNameUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserNameUpdate) ExecX

func (eunu *EntUserNameUpdate) ExecX(ctx context.Context)

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

func (*EntUserNameUpdate) Mutation

func (eunu *EntUserNameUpdate) Mutation() *EntUserNameMutation

Mutation returns the EntUserNameMutation object of the builder.

func (*EntUserNameUpdate) Save

func (eunu *EntUserNameUpdate) Save(ctx context.Context) (int, error)

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

func (*EntUserNameUpdate) SaveX

func (eunu *EntUserNameUpdate) SaveX(ctx context.Context) int

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

func (*EntUserNameUpdate) SetCreatedAt

func (eunu *EntUserNameUpdate) SetCreatedAt(t time.Time) *EntUserNameUpdate

SetCreatedAt sets the "created_at" field.

func (*EntUserNameUpdate) SetDeleted

func (eunu *EntUserNameUpdate) SetDeleted(b bool) *EntUserNameUpdate

SetDeleted sets the "deleted" field.

func (*EntUserNameUpdate) SetEntUser

func (eunu *EntUserNameUpdate) SetEntUser(e *EntUser) *EntUserNameUpdate

SetEntUser sets the "ent_user" edge to the EntUser entity.

func (*EntUserNameUpdate) SetEntUserID

func (eunu *EntUserNameUpdate) SetEntUserID(id uuid.UUID) *EntUserNameUpdate

SetEntUserID sets the "ent_user" edge to the EntUser entity by ID.

func (*EntUserNameUpdate) SetNillableCreatedAt

func (eunu *EntUserNameUpdate) SetNillableCreatedAt(t *time.Time) *EntUserNameUpdate

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

func (*EntUserNameUpdate) SetNillableDeleted

func (eunu *EntUserNameUpdate) SetNillableDeleted(b *bool) *EntUserNameUpdate

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserNameUpdate) SetUpdatedAt

func (eunu *EntUserNameUpdate) SetUpdatedAt(t time.Time) *EntUserNameUpdate

SetUpdatedAt sets the "updated_at" field.

func (*EntUserNameUpdate) SetUserID

func (eunu *EntUserNameUpdate) SetUserID(u uuid.UUID) *EntUserNameUpdate

SetUserID sets the "user_id" field.

func (*EntUserNameUpdate) SetValue

func (eunu *EntUserNameUpdate) SetValue(s string) *EntUserNameUpdate

SetValue sets the "value" field.

func (*EntUserNameUpdate) Where

Where appends a list predicates to the EntUserNameUpdate builder.

type EntUserNameUpdateOne

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

EntUserNameUpdateOne is the builder for updating a single EntUserName entity.

func (*EntUserNameUpdateOne) ClearEntUser

func (eunuo *EntUserNameUpdateOne) ClearEntUser() *EntUserNameUpdateOne

ClearEntUser clears the "ent_user" edge to the EntUser entity.

func (*EntUserNameUpdateOne) Exec

func (eunuo *EntUserNameUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EntUserNameUpdateOne) ExecX

func (eunuo *EntUserNameUpdateOne) ExecX(ctx context.Context)

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

func (*EntUserNameUpdateOne) Mutation

func (eunuo *EntUserNameUpdateOne) Mutation() *EntUserNameMutation

Mutation returns the EntUserNameMutation object of the builder.

func (*EntUserNameUpdateOne) Save

func (eunuo *EntUserNameUpdateOne) Save(ctx context.Context) (*EntUserName, error)

Save executes the query and returns the updated EntUserName entity.

func (*EntUserNameUpdateOne) SaveX

func (eunuo *EntUserNameUpdateOne) SaveX(ctx context.Context) *EntUserName

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

func (*EntUserNameUpdateOne) Select

func (eunuo *EntUserNameUpdateOne) Select(field string, fields ...string) *EntUserNameUpdateOne

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

func (*EntUserNameUpdateOne) SetCreatedAt

func (eunuo *EntUserNameUpdateOne) SetCreatedAt(t time.Time) *EntUserNameUpdateOne

SetCreatedAt sets the "created_at" field.

func (*EntUserNameUpdateOne) SetDeleted

func (eunuo *EntUserNameUpdateOne) SetDeleted(b bool) *EntUserNameUpdateOne

SetDeleted sets the "deleted" field.

func (*EntUserNameUpdateOne) SetEntUser

func (eunuo *EntUserNameUpdateOne) SetEntUser(e *EntUser) *EntUserNameUpdateOne

SetEntUser sets the "ent_user" edge to the EntUser entity.

func (*EntUserNameUpdateOne) SetEntUserID

func (eunuo *EntUserNameUpdateOne) SetEntUserID(id uuid.UUID) *EntUserNameUpdateOne

SetEntUserID sets the "ent_user" edge to the EntUser entity by ID.

func (*EntUserNameUpdateOne) SetNillableCreatedAt

func (eunuo *EntUserNameUpdateOne) SetNillableCreatedAt(t *time.Time) *EntUserNameUpdateOne

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

func (*EntUserNameUpdateOne) SetNillableDeleted

func (eunuo *EntUserNameUpdateOne) SetNillableDeleted(b *bool) *EntUserNameUpdateOne

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserNameUpdateOne) SetUpdatedAt

func (eunuo *EntUserNameUpdateOne) SetUpdatedAt(t time.Time) *EntUserNameUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*EntUserNameUpdateOne) SetUserID

func (eunuo *EntUserNameUpdateOne) SetUserID(u uuid.UUID) *EntUserNameUpdateOne

SetUserID sets the "user_id" field.

func (*EntUserNameUpdateOne) SetValue

func (eunuo *EntUserNameUpdateOne) SetValue(s string) *EntUserNameUpdateOne

SetValue sets the "value" field.

func (*EntUserNameUpdateOne) Where

Where appends a list predicates to the EntUserNameUpdate builder.

type EntUserNames

type EntUserNames []*EntUserName

EntUserNames is a parsable slice of EntUserName.

type EntUserQuery

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

EntUserQuery is the builder for querying EntUser entities.

func (*EntUserQuery) Aggregate

func (euq *EntUserQuery) Aggregate(fns ...AggregateFunc) *EntUserSelect

Aggregate returns a EntUserSelect configured with the given aggregations.

func (*EntUserQuery) All

func (euq *EntUserQuery) All(ctx context.Context) ([]*EntUser, error)

All executes the query and returns a list of EntUsers.

func (*EntUserQuery) AllX

func (euq *EntUserQuery) AllX(ctx context.Context) []*EntUser

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

func (*EntUserQuery) Clone

func (euq *EntUserQuery) Clone() *EntUserQuery

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

func (*EntUserQuery) Count

func (euq *EntUserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EntUserQuery) CountX

func (euq *EntUserQuery) CountX(ctx context.Context) int

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

func (*EntUserQuery) Exist

func (euq *EntUserQuery) Exist(ctx context.Context) (bool, error)

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

func (*EntUserQuery) ExistX

func (euq *EntUserQuery) ExistX(ctx context.Context) bool

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

func (*EntUserQuery) First

func (euq *EntUserQuery) First(ctx context.Context) (*EntUser, error)

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

func (*EntUserQuery) FirstID

func (euq *EntUserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*EntUserQuery) FirstIDX

func (euq *EntUserQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*EntUserQuery) FirstX

func (euq *EntUserQuery) FirstX(ctx context.Context) *EntUser

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

func (*EntUserQuery) GroupBy

func (euq *EntUserQuery) GroupBy(field string, fields ...string) *EntUserGroupBy

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

Example:

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

client.EntUser.Query().
	GroupBy(entuser.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EntUserQuery) IDs

func (euq *EntUserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*EntUserQuery) IDsX

func (euq *EntUserQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*EntUserQuery) Limit

func (euq *EntUserQuery) Limit(limit int) *EntUserQuery

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

func (*EntUserQuery) Offset

func (euq *EntUserQuery) Offset(offset int) *EntUserQuery

Offset to start from.

func (*EntUserQuery) Only

func (euq *EntUserQuery) Only(ctx context.Context) (*EntUser, error)

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

func (*EntUserQuery) OnlyID

func (euq *EntUserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*EntUserQuery) OnlyIDX

func (euq *EntUserQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*EntUserQuery) OnlyX

func (euq *EntUserQuery) OnlyX(ctx context.Context) *EntUser

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

func (*EntUserQuery) Order

func (euq *EntUserQuery) Order(o ...entuser.OrderOption) *EntUserQuery

Order specifies how the records should be ordered.

func (*EntUserQuery) QueryEntUserNames

func (euq *EntUserQuery) QueryEntUserNames() *EntUserNameQuery

QueryEntUserNames chains the current query on the "ent_user_names" edge.

func (*EntUserQuery) Select

func (euq *EntUserQuery) Select(fields ...string) *EntUserSelect

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

Example:

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

client.EntUser.Query().
	Select(entuser.FieldCreatedAt).
	Scan(ctx, &v)

func (*EntUserQuery) Unique

func (euq *EntUserQuery) Unique(unique bool) *EntUserQuery

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

func (euq *EntUserQuery) Where(ps ...predicate.EntUser) *EntUserQuery

Where adds a new predicate for the EntUserQuery builder.

func (*EntUserQuery) WithEntUserNames

func (euq *EntUserQuery) WithEntUserNames(opts ...func(*EntUserNameQuery)) *EntUserQuery

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

type EntUserSelect

type EntUserSelect struct {
	*EntUserQuery
	// contains filtered or unexported fields
}

EntUserSelect is the builder for selecting fields of EntUser entities.

func (*EntUserSelect) Aggregate

func (eus *EntUserSelect) Aggregate(fns ...AggregateFunc) *EntUserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*EntUserSelect) Bool

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

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

func (*EntUserSelect) BoolX

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

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

func (*EntUserSelect) Bools

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

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

func (*EntUserSelect) BoolsX

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

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

func (*EntUserSelect) Float64

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

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

func (*EntUserSelect) Float64X

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

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

func (*EntUserSelect) Float64s

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

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

func (*EntUserSelect) Float64sX

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

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

func (*EntUserSelect) Int

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

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

func (*EntUserSelect) IntX

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

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

func (*EntUserSelect) Ints

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

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

func (*EntUserSelect) IntsX

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

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

func (*EntUserSelect) Scan

func (eus *EntUserSelect) Scan(ctx context.Context, v any) error

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

func (*EntUserSelect) ScanX

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

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

func (*EntUserSelect) String

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

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

func (*EntUserSelect) StringX

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

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

func (*EntUserSelect) Strings

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

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

func (*EntUserSelect) StringsX

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

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

type EntUserUpdate

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

EntUserUpdate is the builder for updating EntUser entities.

func (*EntUserUpdate) AddEntUserNameIDs

func (euu *EntUserUpdate) AddEntUserNameIDs(ids ...uuid.UUID) *EntUserUpdate

AddEntUserNameIDs adds the "ent_user_names" edge to the EntUserName entity by IDs.

func (*EntUserUpdate) AddEntUserNames

func (euu *EntUserUpdate) AddEntUserNames(e ...*EntUserName) *EntUserUpdate

AddEntUserNames adds the "ent_user_names" edges to the EntUserName entity.

func (*EntUserUpdate) ClearEntUserNames

func (euu *EntUserUpdate) ClearEntUserNames() *EntUserUpdate

ClearEntUserNames clears all "ent_user_names" edges to the EntUserName entity.

func (*EntUserUpdate) Exec

func (euu *EntUserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EntUserUpdate) ExecX

func (euu *EntUserUpdate) ExecX(ctx context.Context)

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

func (*EntUserUpdate) Mutation

func (euu *EntUserUpdate) Mutation() *EntUserMutation

Mutation returns the EntUserMutation object of the builder.

func (*EntUserUpdate) RemoveEntUserNameIDs

func (euu *EntUserUpdate) RemoveEntUserNameIDs(ids ...uuid.UUID) *EntUserUpdate

RemoveEntUserNameIDs removes the "ent_user_names" edge to EntUserName entities by IDs.

func (*EntUserUpdate) RemoveEntUserNames

func (euu *EntUserUpdate) RemoveEntUserNames(e ...*EntUserName) *EntUserUpdate

RemoveEntUserNames removes "ent_user_names" edges to EntUserName entities.

func (*EntUserUpdate) Save

func (euu *EntUserUpdate) Save(ctx context.Context) (int, error)

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

func (*EntUserUpdate) SaveX

func (euu *EntUserUpdate) SaveX(ctx context.Context) int

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

func (*EntUserUpdate) SetCreatedAt

func (euu *EntUserUpdate) SetCreatedAt(t time.Time) *EntUserUpdate

SetCreatedAt sets the "created_at" field.

func (*EntUserUpdate) SetDeleted

func (euu *EntUserUpdate) SetDeleted(b bool) *EntUserUpdate

SetDeleted sets the "deleted" field.

func (*EntUserUpdate) SetNillableCreatedAt

func (euu *EntUserUpdate) SetNillableCreatedAt(t *time.Time) *EntUserUpdate

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

func (*EntUserUpdate) SetNillableDeleted

func (euu *EntUserUpdate) SetNillableDeleted(b *bool) *EntUserUpdate

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserUpdate) SetUpdatedAt

func (euu *EntUserUpdate) SetUpdatedAt(t time.Time) *EntUserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*EntUserUpdate) Where

func (euu *EntUserUpdate) Where(ps ...predicate.EntUser) *EntUserUpdate

Where appends a list predicates to the EntUserUpdate builder.

type EntUserUpdateOne

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

EntUserUpdateOne is the builder for updating a single EntUser entity.

func (*EntUserUpdateOne) AddEntUserNameIDs

func (euuo *EntUserUpdateOne) AddEntUserNameIDs(ids ...uuid.UUID) *EntUserUpdateOne

AddEntUserNameIDs adds the "ent_user_names" edge to the EntUserName entity by IDs.

func (*EntUserUpdateOne) AddEntUserNames

func (euuo *EntUserUpdateOne) AddEntUserNames(e ...*EntUserName) *EntUserUpdateOne

AddEntUserNames adds the "ent_user_names" edges to the EntUserName entity.

func (*EntUserUpdateOne) ClearEntUserNames

func (euuo *EntUserUpdateOne) ClearEntUserNames() *EntUserUpdateOne

ClearEntUserNames clears all "ent_user_names" edges to the EntUserName entity.

func (*EntUserUpdateOne) Exec

func (euuo *EntUserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EntUserUpdateOne) ExecX

func (euuo *EntUserUpdateOne) ExecX(ctx context.Context)

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

func (*EntUserUpdateOne) Mutation

func (euuo *EntUserUpdateOne) Mutation() *EntUserMutation

Mutation returns the EntUserMutation object of the builder.

func (*EntUserUpdateOne) RemoveEntUserNameIDs

func (euuo *EntUserUpdateOne) RemoveEntUserNameIDs(ids ...uuid.UUID) *EntUserUpdateOne

RemoveEntUserNameIDs removes the "ent_user_names" edge to EntUserName entities by IDs.

func (*EntUserUpdateOne) RemoveEntUserNames

func (euuo *EntUserUpdateOne) RemoveEntUserNames(e ...*EntUserName) *EntUserUpdateOne

RemoveEntUserNames removes "ent_user_names" edges to EntUserName entities.

func (*EntUserUpdateOne) Save

func (euuo *EntUserUpdateOne) Save(ctx context.Context) (*EntUser, error)

Save executes the query and returns the updated EntUser entity.

func (*EntUserUpdateOne) SaveX

func (euuo *EntUserUpdateOne) SaveX(ctx context.Context) *EntUser

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

func (*EntUserUpdateOne) Select

func (euuo *EntUserUpdateOne) Select(field string, fields ...string) *EntUserUpdateOne

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

func (*EntUserUpdateOne) SetCreatedAt

func (euuo *EntUserUpdateOne) SetCreatedAt(t time.Time) *EntUserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*EntUserUpdateOne) SetDeleted

func (euuo *EntUserUpdateOne) SetDeleted(b bool) *EntUserUpdateOne

SetDeleted sets the "deleted" field.

func (*EntUserUpdateOne) SetNillableCreatedAt

func (euuo *EntUserUpdateOne) SetNillableCreatedAt(t *time.Time) *EntUserUpdateOne

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

func (*EntUserUpdateOne) SetNillableDeleted

func (euuo *EntUserUpdateOne) SetNillableDeleted(b *bool) *EntUserUpdateOne

SetNillableDeleted sets the "deleted" field if the given value is not nil.

func (*EntUserUpdateOne) SetUpdatedAt

func (euuo *EntUserUpdateOne) SetUpdatedAt(t time.Time) *EntUserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*EntUserUpdateOne) Where

func (euuo *EntUserUpdateOne) Where(ps ...predicate.EntUser) *EntUserUpdateOne

Where appends a list predicates to the EntUserUpdate builder.

type EntUsers

type EntUsers []*EntUser

EntUsers is a parsable slice of EntUser.

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

	// EntUser is the client for interacting with the EntUser builders.
	EntUser *EntUserClient
	// EntUserName is the client for interacting with the EntUserName builders.
	EntUserName *EntUserNameClient
	// 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