ent

package
v0.0.0-...-6b37c95 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 23 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.
	TypeAccessToken = "AccessToken"
	TypeCode        = "Code"
	TypeGroup       = "Group"
	TypeUser        = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AccessToken

type AccessToken struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Token holds the value of the "token" field.
	Token string `json:"token,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccessTokenQuery when eager-loading is set.
	Edges AccessTokenEdges `json:"edges"`
	// contains filtered or unexported fields
}

AccessToken is the model entity for the AccessToken schema.

func (*AccessToken) QueryGroups

func (at *AccessToken) QueryGroups() *GroupQuery

QueryGroups queries the "groups" edge of the AccessToken entity.

func (*AccessToken) QueryUser

func (at *AccessToken) QueryUser() *UserQuery

QueryUser queries the "user" edge of the AccessToken entity.

func (*AccessToken) String

func (at *AccessToken) String() string

String implements the fmt.Stringer.

func (*AccessToken) Unwrap

func (at *AccessToken) Unwrap() *AccessToken

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

func (at *AccessToken) Update() *AccessTokenUpdateOne

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

func (*AccessToken) Value

func (at *AccessToken) Value(name string) (ent.Value, error)

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

type AccessTokenClient

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

AccessTokenClient is a client for the AccessToken schema.

func NewAccessTokenClient

func NewAccessTokenClient(c config) *AccessTokenClient

NewAccessTokenClient returns a client for the AccessToken from the given config.

func (*AccessTokenClient) Create

func (c *AccessTokenClient) Create() *AccessTokenCreate

Create returns a builder for creating a AccessToken entity.

func (*AccessTokenClient) CreateBulk

func (c *AccessTokenClient) CreateBulk(builders ...*AccessTokenCreate) *AccessTokenCreateBulk

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

func (*AccessTokenClient) Delete

func (c *AccessTokenClient) Delete() *AccessTokenDelete

Delete returns a delete builder for AccessToken.

func (*AccessTokenClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccessTokenClient) DeleteOneID

func (c *AccessTokenClient) DeleteOneID(id uuid.UUID) *AccessTokenDeleteOne

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

func (*AccessTokenClient) Get

Get returns a AccessToken entity by its id.

func (*AccessTokenClient) GetX

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

func (*AccessTokenClient) Hooks

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

Hooks returns the client hooks.

func (*AccessTokenClient) Intercept

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

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

func (*AccessTokenClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AccessTokenClient) MapCreateBulk

func (c *AccessTokenClient) MapCreateBulk(slice any, setFunc func(*AccessTokenCreate, int)) *AccessTokenCreateBulk

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

func (*AccessTokenClient) Query

func (c *AccessTokenClient) Query() *AccessTokenQuery

Query returns a query builder for AccessToken.

func (*AccessTokenClient) QueryGroups

func (c *AccessTokenClient) QueryGroups(at *AccessToken) *GroupQuery

QueryGroups queries the groups edge of a AccessToken.

func (*AccessTokenClient) QueryUser

func (c *AccessTokenClient) QueryUser(at *AccessToken) *UserQuery

QueryUser queries the user edge of a AccessToken.

func (*AccessTokenClient) Update

func (c *AccessTokenClient) Update() *AccessTokenUpdate

Update returns an update builder for AccessToken.

func (*AccessTokenClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccessTokenClient) UpdateOneID

func (c *AccessTokenClient) UpdateOneID(id uuid.UUID) *AccessTokenUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccessTokenClient) Use

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

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

type AccessTokenCreate

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

AccessTokenCreate is the builder for creating a AccessToken entity.

func (*AccessTokenCreate) AddGroupIDs

func (atc *AccessTokenCreate) AddGroupIDs(ids ...uuid.UUID) *AccessTokenCreate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*AccessTokenCreate) AddGroups

func (atc *AccessTokenCreate) AddGroups(g ...*Group) *AccessTokenCreate

AddGroups adds the "groups" edges to the Group entity.

func (*AccessTokenCreate) Exec

func (atc *AccessTokenCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessTokenCreate) ExecX

func (atc *AccessTokenCreate) ExecX(ctx context.Context)

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

func (*AccessTokenCreate) Mutation

func (atc *AccessTokenCreate) Mutation() *AccessTokenMutation

Mutation returns the AccessTokenMutation object of the builder.

func (*AccessTokenCreate) OnConflict

func (atc *AccessTokenCreate) OnConflict(opts ...sql.ConflictOption) *AccessTokenUpsertOne

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

client.AccessToken.Create().
	SetToken(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.AccessTokenUpsert) {
		SetToken(v+v).
	}).
	Exec(ctx)

func (*AccessTokenCreate) OnConflictColumns

func (atc *AccessTokenCreate) OnConflictColumns(columns ...string) *AccessTokenUpsertOne

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

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

func (*AccessTokenCreate) Save

func (atc *AccessTokenCreate) Save(ctx context.Context) (*AccessToken, error)

Save creates the AccessToken in the database.

func (*AccessTokenCreate) SaveX

func (atc *AccessTokenCreate) SaveX(ctx context.Context) *AccessToken

SaveX calls Save and panics if Save returns an error.

func (*AccessTokenCreate) SetExpiresAt

func (atc *AccessTokenCreate) SetExpiresAt(t time.Time) *AccessTokenCreate

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenCreate) SetID

SetID sets the "id" field.

func (*AccessTokenCreate) SetNillableID

func (atc *AccessTokenCreate) SetNillableID(u *uuid.UUID) *AccessTokenCreate

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

func (*AccessTokenCreate) SetNillableUserID

func (atc *AccessTokenCreate) SetNillableUserID(id *uuid.UUID) *AccessTokenCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AccessTokenCreate) SetToken

func (atc *AccessTokenCreate) SetToken(s string) *AccessTokenCreate

SetToken sets the "token" field.

func (*AccessTokenCreate) SetUser

func (atc *AccessTokenCreate) SetUser(u *User) *AccessTokenCreate

SetUser sets the "user" edge to the User entity.

func (*AccessTokenCreate) SetUserID

func (atc *AccessTokenCreate) SetUserID(id uuid.UUID) *AccessTokenCreate

SetUserID sets the "user" edge to the User entity by ID.

type AccessTokenCreateBulk

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

AccessTokenCreateBulk is the builder for creating many AccessToken entities in bulk.

func (*AccessTokenCreateBulk) Exec

func (atcb *AccessTokenCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessTokenCreateBulk) ExecX

func (atcb *AccessTokenCreateBulk) ExecX(ctx context.Context)

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

func (*AccessTokenCreateBulk) OnConflict

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

client.AccessToken.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.AccessTokenUpsert) {
		SetToken(v+v).
	}).
	Exec(ctx)

func (*AccessTokenCreateBulk) OnConflictColumns

func (atcb *AccessTokenCreateBulk) OnConflictColumns(columns ...string) *AccessTokenUpsertBulk

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

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

func (*AccessTokenCreateBulk) Save

func (atcb *AccessTokenCreateBulk) Save(ctx context.Context) ([]*AccessToken, error)

Save creates the AccessToken entities in the database.

func (*AccessTokenCreateBulk) SaveX

func (atcb *AccessTokenCreateBulk) SaveX(ctx context.Context) []*AccessToken

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

type AccessTokenDelete

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

AccessTokenDelete is the builder for deleting a AccessToken entity.

func (*AccessTokenDelete) Exec

func (atd *AccessTokenDelete) Exec(ctx context.Context) (int, error)

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

func (*AccessTokenDelete) ExecX

func (atd *AccessTokenDelete) ExecX(ctx context.Context) int

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

func (*AccessTokenDelete) Where

Where appends a list predicates to the AccessTokenDelete builder.

type AccessTokenDeleteOne

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

AccessTokenDeleteOne is the builder for deleting a single AccessToken entity.

func (*AccessTokenDeleteOne) Exec

func (atdo *AccessTokenDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccessTokenDeleteOne) ExecX

func (atdo *AccessTokenDeleteOne) ExecX(ctx context.Context)

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

func (*AccessTokenDeleteOne) Where

Where appends a list predicates to the AccessTokenDelete builder.

type AccessTokenEdges

type AccessTokenEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Groups holds the value of the groups edge.
	Groups []*Group `json:"groups,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccessTokenEdges) GroupsOrErr

func (e AccessTokenEdges) GroupsOrErr() ([]*Group, error)

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

func (AccessTokenEdges) UserOrErr

func (e AccessTokenEdges) UserOrErr() (*User, error)

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

type AccessTokenGroupBy

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

AccessTokenGroupBy is the group-by builder for AccessToken entities.

func (*AccessTokenGroupBy) Aggregate

func (atgb *AccessTokenGroupBy) Aggregate(fns ...AggregateFunc) *AccessTokenGroupBy

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

func (*AccessTokenGroupBy) Bool

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

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

func (*AccessTokenGroupBy) BoolX

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

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

func (*AccessTokenGroupBy) Bools

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

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

func (*AccessTokenGroupBy) BoolsX

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

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

func (*AccessTokenGroupBy) Float64

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

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

func (*AccessTokenGroupBy) Float64X

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

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

func (*AccessTokenGroupBy) Float64s

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

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

func (*AccessTokenGroupBy) Float64sX

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

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

func (*AccessTokenGroupBy) Int

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

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

func (*AccessTokenGroupBy) IntX

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

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

func (*AccessTokenGroupBy) Ints

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

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

func (*AccessTokenGroupBy) IntsX

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

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

func (*AccessTokenGroupBy) Scan

func (atgb *AccessTokenGroupBy) Scan(ctx context.Context, v any) error

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

func (*AccessTokenGroupBy) ScanX

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

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

func (*AccessTokenGroupBy) String

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

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

func (*AccessTokenGroupBy) StringX

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

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

func (*AccessTokenGroupBy) Strings

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

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

func (*AccessTokenGroupBy) StringsX

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

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

type AccessTokenMutation

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

AccessTokenMutation represents an operation that mutates the AccessToken nodes in the graph.

func (*AccessTokenMutation) AddField

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) AddGroupIDs

func (m *AccessTokenMutation) AddGroupIDs(ids ...uuid.UUID)

AddGroupIDs adds the "groups" edge to the Group entity by ids.

func (*AccessTokenMutation) AddedEdges

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

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

func (*AccessTokenMutation) AddedField

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

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

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

func (*AccessTokenMutation) AddedIDs

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

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

func (*AccessTokenMutation) ClearEdge

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

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) ClearGroups

func (m *AccessTokenMutation) ClearGroups()

ClearGroups clears the "groups" edge to the Group entity.

func (*AccessTokenMutation) ClearUser

func (m *AccessTokenMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*AccessTokenMutation) ClearedEdges

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

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

func (*AccessTokenMutation) ClearedFields

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

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

func (AccessTokenMutation) Client

func (m AccessTokenMutation) 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 (*AccessTokenMutation) EdgeCleared

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

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

func (*AccessTokenMutation) ExpiresAt

func (m *AccessTokenMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*AccessTokenMutation) Field

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

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

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

func (*AccessTokenMutation) Fields

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) GroupsCleared

func (m *AccessTokenMutation) GroupsCleared() bool

GroupsCleared reports if the "groups" edge to the Group entity was cleared.

func (*AccessTokenMutation) GroupsIDs

func (m *AccessTokenMutation) GroupsIDs() (ids []uuid.UUID)

GroupsIDs returns the "groups" edge IDs in the mutation.

func (*AccessTokenMutation) ID

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) IDs

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) OldExpiresAt

func (m *AccessTokenMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the AccessToken entity. If the AccessToken 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 (*AccessTokenMutation) OldField

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) OldToken

func (m *AccessTokenMutation) OldToken(ctx context.Context) (v string, err error)

OldToken returns the old "token" field's value of the AccessToken entity. If the AccessToken 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 (*AccessTokenMutation) Op

func (m *AccessTokenMutation) Op() Op

Op returns the operation name.

func (*AccessTokenMutation) RemoveGroupIDs

func (m *AccessTokenMutation) RemoveGroupIDs(ids ...uuid.UUID)

RemoveGroupIDs removes the "groups" edge to the Group entity by IDs.

func (*AccessTokenMutation) RemovedEdges

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

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

func (*AccessTokenMutation) RemovedGroupsIDs

func (m *AccessTokenMutation) RemovedGroupsIDs() (ids []uuid.UUID)

RemovedGroups returns the removed IDs of the "groups" edge to the Group entity.

func (*AccessTokenMutation) RemovedIDs

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) ResetEdge

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) ResetExpiresAt

func (m *AccessTokenMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*AccessTokenMutation) ResetField

func (m *AccessTokenMutation) 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 (*AccessTokenMutation) ResetGroups

func (m *AccessTokenMutation) ResetGroups()

ResetGroups resets all changes to the "groups" edge.

func (*AccessTokenMutation) ResetToken

func (m *AccessTokenMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*AccessTokenMutation) ResetUser

func (m *AccessTokenMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*AccessTokenMutation) SetExpiresAt

func (m *AccessTokenMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenMutation) SetField

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

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

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

func (*AccessTokenMutation) SetOp

func (m *AccessTokenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AccessTokenMutation) SetToken

func (m *AccessTokenMutation) SetToken(s string)

SetToken sets the "token" field.

func (*AccessTokenMutation) SetUserID

func (m *AccessTokenMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (*AccessTokenMutation) Token

func (m *AccessTokenMutation) Token() (r string, exists bool)

Token returns the value of the "token" field in the mutation.

func (AccessTokenMutation) Tx

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

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

func (*AccessTokenMutation) Type

func (m *AccessTokenMutation) Type() string

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

func (*AccessTokenMutation) UserCleared

func (m *AccessTokenMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*AccessTokenMutation) UserID

func (m *AccessTokenMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*AccessTokenMutation) UserIDs

func (m *AccessTokenMutation) UserIDs() (ids []uuid.UUID)

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

func (*AccessTokenMutation) Where

func (m *AccessTokenMutation) Where(ps ...predicate.AccessToken)

Where appends a list predicates to the AccessTokenMutation builder.

func (*AccessTokenMutation) WhereP

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

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

type AccessTokenQuery

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

AccessTokenQuery is the builder for querying AccessToken entities.

func (*AccessTokenQuery) Aggregate

func (atq *AccessTokenQuery) Aggregate(fns ...AggregateFunc) *AccessTokenSelect

Aggregate returns a AccessTokenSelect configured with the given aggregations.

func (*AccessTokenQuery) All

func (atq *AccessTokenQuery) All(ctx context.Context) ([]*AccessToken, error)

All executes the query and returns a list of AccessTokens.

func (*AccessTokenQuery) AllX

func (atq *AccessTokenQuery) AllX(ctx context.Context) []*AccessToken

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

func (*AccessTokenQuery) Clone

func (atq *AccessTokenQuery) Clone() *AccessTokenQuery

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

func (*AccessTokenQuery) Count

func (atq *AccessTokenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccessTokenQuery) CountX

func (atq *AccessTokenQuery) CountX(ctx context.Context) int

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

func (*AccessTokenQuery) Exist

func (atq *AccessTokenQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccessTokenQuery) ExistX

func (atq *AccessTokenQuery) ExistX(ctx context.Context) bool

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

func (*AccessTokenQuery) First

func (atq *AccessTokenQuery) First(ctx context.Context) (*AccessToken, error)

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

func (*AccessTokenQuery) FirstID

func (atq *AccessTokenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccessTokenQuery) FirstIDX

func (atq *AccessTokenQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*AccessTokenQuery) FirstX

func (atq *AccessTokenQuery) FirstX(ctx context.Context) *AccessToken

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

func (*AccessTokenQuery) GroupBy

func (atq *AccessTokenQuery) GroupBy(field string, fields ...string) *AccessTokenGroupBy

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

client.AccessToken.Query().
	GroupBy(accesstoken.FieldToken).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccessTokenQuery) IDs

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

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

func (*AccessTokenQuery) IDsX

func (atq *AccessTokenQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AccessTokenQuery) Limit

func (atq *AccessTokenQuery) Limit(limit int) *AccessTokenQuery

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

func (*AccessTokenQuery) Offset

func (atq *AccessTokenQuery) Offset(offset int) *AccessTokenQuery

Offset to start from.

func (*AccessTokenQuery) Only

func (atq *AccessTokenQuery) Only(ctx context.Context) (*AccessToken, error)

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

func (*AccessTokenQuery) OnlyID

func (atq *AccessTokenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccessTokenQuery) OnlyIDX

func (atq *AccessTokenQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AccessTokenQuery) OnlyX

func (atq *AccessTokenQuery) OnlyX(ctx context.Context) *AccessToken

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

func (*AccessTokenQuery) Order

Order specifies how the records should be ordered.

func (*AccessTokenQuery) QueryGroups

func (atq *AccessTokenQuery) QueryGroups() *GroupQuery

QueryGroups chains the current query on the "groups" edge.

func (*AccessTokenQuery) QueryUser

func (atq *AccessTokenQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*AccessTokenQuery) Select

func (atq *AccessTokenQuery) Select(fields ...string) *AccessTokenSelect

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

client.AccessToken.Query().
	Select(accesstoken.FieldToken).
	Scan(ctx, &v)

func (*AccessTokenQuery) Unique

func (atq *AccessTokenQuery) Unique(unique bool) *AccessTokenQuery

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

Where adds a new predicate for the AccessTokenQuery builder.

func (*AccessTokenQuery) WithGroups

func (atq *AccessTokenQuery) WithGroups(opts ...func(*GroupQuery)) *AccessTokenQuery

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

func (*AccessTokenQuery) WithUser

func (atq *AccessTokenQuery) WithUser(opts ...func(*UserQuery)) *AccessTokenQuery

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

type AccessTokenSelect

type AccessTokenSelect struct {
	*AccessTokenQuery
	// contains filtered or unexported fields
}

AccessTokenSelect is the builder for selecting fields of AccessToken entities.

func (*AccessTokenSelect) Aggregate

func (ats *AccessTokenSelect) Aggregate(fns ...AggregateFunc) *AccessTokenSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AccessTokenSelect) Bool

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

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

func (*AccessTokenSelect) BoolX

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

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

func (*AccessTokenSelect) Bools

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

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

func (*AccessTokenSelect) BoolsX

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

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

func (*AccessTokenSelect) Float64

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

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

func (*AccessTokenSelect) Float64X

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

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

func (*AccessTokenSelect) Float64s

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

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

func (*AccessTokenSelect) Float64sX

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

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

func (*AccessTokenSelect) Int

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

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

func (*AccessTokenSelect) IntX

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

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

func (*AccessTokenSelect) Ints

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

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

func (*AccessTokenSelect) IntsX

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

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

func (*AccessTokenSelect) Scan

func (ats *AccessTokenSelect) Scan(ctx context.Context, v any) error

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

func (*AccessTokenSelect) ScanX

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

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

func (*AccessTokenSelect) String

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

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

func (*AccessTokenSelect) StringX

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

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

func (*AccessTokenSelect) Strings

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

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

func (*AccessTokenSelect) StringsX

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

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

type AccessTokenUpdate

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

AccessTokenUpdate is the builder for updating AccessToken entities.

func (*AccessTokenUpdate) AddGroupIDs

func (atu *AccessTokenUpdate) AddGroupIDs(ids ...uuid.UUID) *AccessTokenUpdate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*AccessTokenUpdate) AddGroups

func (atu *AccessTokenUpdate) AddGroups(g ...*Group) *AccessTokenUpdate

AddGroups adds the "groups" edges to the Group entity.

func (*AccessTokenUpdate) ClearGroups

func (atu *AccessTokenUpdate) ClearGroups() *AccessTokenUpdate

ClearGroups clears all "groups" edges to the Group entity.

func (*AccessTokenUpdate) ClearUser

func (atu *AccessTokenUpdate) ClearUser() *AccessTokenUpdate

ClearUser clears the "user" edge to the User entity.

func (*AccessTokenUpdate) Exec

func (atu *AccessTokenUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessTokenUpdate) ExecX

func (atu *AccessTokenUpdate) ExecX(ctx context.Context)

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

func (*AccessTokenUpdate) Mutation

func (atu *AccessTokenUpdate) Mutation() *AccessTokenMutation

Mutation returns the AccessTokenMutation object of the builder.

func (*AccessTokenUpdate) RemoveGroupIDs

func (atu *AccessTokenUpdate) RemoveGroupIDs(ids ...uuid.UUID) *AccessTokenUpdate

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*AccessTokenUpdate) RemoveGroups

func (atu *AccessTokenUpdate) RemoveGroups(g ...*Group) *AccessTokenUpdate

RemoveGroups removes "groups" edges to Group entities.

func (*AccessTokenUpdate) Save

func (atu *AccessTokenUpdate) Save(ctx context.Context) (int, error)

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

func (*AccessTokenUpdate) SaveX

func (atu *AccessTokenUpdate) SaveX(ctx context.Context) int

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

func (*AccessTokenUpdate) SetExpiresAt

func (atu *AccessTokenUpdate) SetExpiresAt(t time.Time) *AccessTokenUpdate

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenUpdate) SetNillableExpiresAt

func (atu *AccessTokenUpdate) SetNillableExpiresAt(t *time.Time) *AccessTokenUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*AccessTokenUpdate) SetNillableToken

func (atu *AccessTokenUpdate) SetNillableToken(s *string) *AccessTokenUpdate

SetNillableToken sets the "token" field if the given value is not nil.

func (*AccessTokenUpdate) SetNillableUserID

func (atu *AccessTokenUpdate) SetNillableUserID(id *uuid.UUID) *AccessTokenUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AccessTokenUpdate) SetToken

func (atu *AccessTokenUpdate) SetToken(s string) *AccessTokenUpdate

SetToken sets the "token" field.

func (*AccessTokenUpdate) SetUser

func (atu *AccessTokenUpdate) SetUser(u *User) *AccessTokenUpdate

SetUser sets the "user" edge to the User entity.

func (*AccessTokenUpdate) SetUserID

func (atu *AccessTokenUpdate) SetUserID(id uuid.UUID) *AccessTokenUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*AccessTokenUpdate) Where

Where appends a list predicates to the AccessTokenUpdate builder.

type AccessTokenUpdateOne

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

AccessTokenUpdateOne is the builder for updating a single AccessToken entity.

func (*AccessTokenUpdateOne) AddGroupIDs

func (atuo *AccessTokenUpdateOne) AddGroupIDs(ids ...uuid.UUID) *AccessTokenUpdateOne

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*AccessTokenUpdateOne) AddGroups

func (atuo *AccessTokenUpdateOne) AddGroups(g ...*Group) *AccessTokenUpdateOne

AddGroups adds the "groups" edges to the Group entity.

func (*AccessTokenUpdateOne) ClearGroups

func (atuo *AccessTokenUpdateOne) ClearGroups() *AccessTokenUpdateOne

ClearGroups clears all "groups" edges to the Group entity.

func (*AccessTokenUpdateOne) ClearUser

func (atuo *AccessTokenUpdateOne) ClearUser() *AccessTokenUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*AccessTokenUpdateOne) Exec

func (atuo *AccessTokenUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccessTokenUpdateOne) ExecX

func (atuo *AccessTokenUpdateOne) ExecX(ctx context.Context)

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

func (*AccessTokenUpdateOne) Mutation

func (atuo *AccessTokenUpdateOne) Mutation() *AccessTokenMutation

Mutation returns the AccessTokenMutation object of the builder.

func (*AccessTokenUpdateOne) RemoveGroupIDs

func (atuo *AccessTokenUpdateOne) RemoveGroupIDs(ids ...uuid.UUID) *AccessTokenUpdateOne

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*AccessTokenUpdateOne) RemoveGroups

func (atuo *AccessTokenUpdateOne) RemoveGroups(g ...*Group) *AccessTokenUpdateOne

RemoveGroups removes "groups" edges to Group entities.

func (*AccessTokenUpdateOne) Save

Save executes the query and returns the updated AccessToken entity.

func (*AccessTokenUpdateOne) SaveX

func (atuo *AccessTokenUpdateOne) SaveX(ctx context.Context) *AccessToken

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

func (*AccessTokenUpdateOne) Select

func (atuo *AccessTokenUpdateOne) Select(field string, fields ...string) *AccessTokenUpdateOne

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

func (*AccessTokenUpdateOne) SetExpiresAt

func (atuo *AccessTokenUpdateOne) SetExpiresAt(t time.Time) *AccessTokenUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenUpdateOne) SetNillableExpiresAt

func (atuo *AccessTokenUpdateOne) SetNillableExpiresAt(t *time.Time) *AccessTokenUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*AccessTokenUpdateOne) SetNillableToken

func (atuo *AccessTokenUpdateOne) SetNillableToken(s *string) *AccessTokenUpdateOne

SetNillableToken sets the "token" field if the given value is not nil.

func (*AccessTokenUpdateOne) SetNillableUserID

func (atuo *AccessTokenUpdateOne) SetNillableUserID(id *uuid.UUID) *AccessTokenUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*AccessTokenUpdateOne) SetToken

SetToken sets the "token" field.

func (*AccessTokenUpdateOne) SetUser

func (atuo *AccessTokenUpdateOne) SetUser(u *User) *AccessTokenUpdateOne

SetUser sets the "user" edge to the User entity.

func (*AccessTokenUpdateOne) SetUserID

func (atuo *AccessTokenUpdateOne) SetUserID(id uuid.UUID) *AccessTokenUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*AccessTokenUpdateOne) Where

Where appends a list predicates to the AccessTokenUpdate builder.

type AccessTokenUpsert

type AccessTokenUpsert struct {
	*sql.UpdateSet
}

AccessTokenUpsert is the "OnConflict" setter.

func (*AccessTokenUpsert) SetExpiresAt

func (u *AccessTokenUpsert) SetExpiresAt(v time.Time) *AccessTokenUpsert

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenUpsert) SetToken

func (u *AccessTokenUpsert) SetToken(v string) *AccessTokenUpsert

SetToken sets the "token" field.

func (*AccessTokenUpsert) UpdateExpiresAt

func (u *AccessTokenUpsert) UpdateExpiresAt() *AccessTokenUpsert

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*AccessTokenUpsert) UpdateToken

func (u *AccessTokenUpsert) UpdateToken() *AccessTokenUpsert

UpdateToken sets the "token" field to the value that was provided on create.

type AccessTokenUpsertBulk

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

AccessTokenUpsertBulk is the builder for "upsert"-ing a bulk of AccessToken nodes.

func (*AccessTokenUpsertBulk) DoNothing

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

func (*AccessTokenUpsertBulk) Exec

Exec executes the query.

func (*AccessTokenUpsertBulk) ExecX

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

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

func (*AccessTokenUpsertBulk) Ignore

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

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

func (*AccessTokenUpsertBulk) SetExpiresAt

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenUpsertBulk) SetToken

SetToken sets the "token" field.

func (*AccessTokenUpsertBulk) Update

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

func (*AccessTokenUpsertBulk) UpdateExpiresAt

func (u *AccessTokenUpsertBulk) UpdateExpiresAt() *AccessTokenUpsertBulk

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*AccessTokenUpsertBulk) UpdateNewValues

func (u *AccessTokenUpsertBulk) UpdateNewValues() *AccessTokenUpsertBulk

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

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

func (*AccessTokenUpsertBulk) UpdateToken

func (u *AccessTokenUpsertBulk) UpdateToken() *AccessTokenUpsertBulk

UpdateToken sets the "token" field to the value that was provided on create.

type AccessTokenUpsertOne

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

AccessTokenUpsertOne is the builder for "upsert"-ing

one AccessToken node.

func (*AccessTokenUpsertOne) DoNothing

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

func (*AccessTokenUpsertOne) Exec

Exec executes the query.

func (*AccessTokenUpsertOne) ExecX

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

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

func (*AccessTokenUpsertOne) ID

func (u *AccessTokenUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccessTokenUpsertOne) IDX

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

func (*AccessTokenUpsertOne) Ignore

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

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

func (*AccessTokenUpsertOne) SetExpiresAt

func (u *AccessTokenUpsertOne) SetExpiresAt(v time.Time) *AccessTokenUpsertOne

SetExpiresAt sets the "expires_at" field.

func (*AccessTokenUpsertOne) SetToken

SetToken sets the "token" field.

func (*AccessTokenUpsertOne) Update

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

func (*AccessTokenUpsertOne) UpdateExpiresAt

func (u *AccessTokenUpsertOne) UpdateExpiresAt() *AccessTokenUpsertOne

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*AccessTokenUpsertOne) UpdateNewValues

func (u *AccessTokenUpsertOne) UpdateNewValues() *AccessTokenUpsertOne

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.AccessToken.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(accesstoken.FieldID)
		}),
	).
	Exec(ctx)

func (*AccessTokenUpsertOne) UpdateToken

func (u *AccessTokenUpsertOne) UpdateToken() *AccessTokenUpsertOne

UpdateToken sets the "token" field to the value that was provided on create.

type AccessTokens

type AccessTokens []*AccessToken

AccessTokens is a parsable slice of AccessToken.

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
	// AccessToken is the client for interacting with the AccessToken builders.
	AccessToken *AccessTokenClient
	// Code is the client for interacting with the Code builders.
	Code *CodeClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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().
	AccessToken.
	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 Code

type Code struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Code holds the value of the "code" field.
	Code string `json:"code,omitempty"`
	// ClientID holds the value of the "client_id" field.
	ClientID string `json:"client_id,omitempty"`
	// Scope holds the value of the "scope" field.
	Scope string `json:"scope,omitempty"`
	// RedirectURI holds the value of the "redirect_uri" field.
	RedirectURI string `json:"redirect_uri,omitempty"`
	// CodeChallenge holds the value of the "code_challenge" field.
	CodeChallenge string `json:"code_challenge,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CodeQuery when eager-loading is set.
	Edges CodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Code is the model entity for the Code schema.

func (*Code) QueryGroups

func (c *Code) QueryGroups() *GroupQuery

QueryGroups queries the "groups" edge of the Code entity.

func (*Code) QueryUser

func (c *Code) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Code entity.

func (*Code) String

func (c *Code) String() string

String implements the fmt.Stringer.

func (*Code) Unwrap

func (c *Code) Unwrap() *Code

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

func (c *Code) Update() *CodeUpdateOne

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

func (*Code) Value

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

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

type CodeClient

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

CodeClient is a client for the Code schema.

func NewCodeClient

func NewCodeClient(c config) *CodeClient

NewCodeClient returns a client for the Code from the given config.

func (*CodeClient) Create

func (c *CodeClient) Create() *CodeCreate

Create returns a builder for creating a Code entity.

func (*CodeClient) CreateBulk

func (c *CodeClient) CreateBulk(builders ...*CodeCreate) *CodeCreateBulk

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

func (*CodeClient) Delete

func (c *CodeClient) Delete() *CodeDelete

Delete returns a delete builder for Code.

func (*CodeClient) DeleteOne

func (c *CodeClient) DeleteOne(co *Code) *CodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CodeClient) DeleteOneID

func (c *CodeClient) DeleteOneID(id uuid.UUID) *CodeDeleteOne

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

func (*CodeClient) Get

func (c *CodeClient) Get(ctx context.Context, id uuid.UUID) (*Code, error)

Get returns a Code entity by its id.

func (*CodeClient) GetX

func (c *CodeClient) GetX(ctx context.Context, id uuid.UUID) *Code

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

func (*CodeClient) Hooks

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

Hooks returns the client hooks.

func (*CodeClient) Intercept

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

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

func (*CodeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CodeClient) MapCreateBulk

func (c *CodeClient) MapCreateBulk(slice any, setFunc func(*CodeCreate, int)) *CodeCreateBulk

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

func (*CodeClient) Query

func (c *CodeClient) Query() *CodeQuery

Query returns a query builder for Code.

func (*CodeClient) QueryGroups

func (c *CodeClient) QueryGroups(co *Code) *GroupQuery

QueryGroups queries the groups edge of a Code.

func (*CodeClient) QueryUser

func (c *CodeClient) QueryUser(co *Code) *UserQuery

QueryUser queries the user edge of a Code.

func (*CodeClient) Update

func (c *CodeClient) Update() *CodeUpdate

Update returns an update builder for Code.

func (*CodeClient) UpdateOne

func (c *CodeClient) UpdateOne(co *Code) *CodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CodeClient) UpdateOneID

func (c *CodeClient) UpdateOneID(id uuid.UUID) *CodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CodeClient) Use

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

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

type CodeCreate

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

CodeCreate is the builder for creating a Code entity.

func (*CodeCreate) AddGroupIDs

func (cc *CodeCreate) AddGroupIDs(ids ...uuid.UUID) *CodeCreate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*CodeCreate) AddGroups

func (cc *CodeCreate) AddGroups(g ...*Group) *CodeCreate

AddGroups adds the "groups" edges to the Group entity.

func (*CodeCreate) Exec

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

Exec executes the query.

func (*CodeCreate) ExecX

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

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

func (*CodeCreate) Mutation

func (cc *CodeCreate) Mutation() *CodeMutation

Mutation returns the CodeMutation object of the builder.

func (*CodeCreate) OnConflict

func (cc *CodeCreate) OnConflict(opts ...sql.ConflictOption) *CodeUpsertOne

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

client.Code.Create().
	SetCode(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.CodeUpsert) {
		SetCode(v+v).
	}).
	Exec(ctx)

func (*CodeCreate) OnConflictColumns

func (cc *CodeCreate) OnConflictColumns(columns ...string) *CodeUpsertOne

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

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

func (*CodeCreate) Save

func (cc *CodeCreate) Save(ctx context.Context) (*Code, error)

Save creates the Code in the database.

func (*CodeCreate) SaveX

func (cc *CodeCreate) SaveX(ctx context.Context) *Code

SaveX calls Save and panics if Save returns an error.

func (*CodeCreate) SetClientID

func (cc *CodeCreate) SetClientID(s string) *CodeCreate

SetClientID sets the "client_id" field.

func (*CodeCreate) SetCode

func (cc *CodeCreate) SetCode(s string) *CodeCreate

SetCode sets the "code" field.

func (*CodeCreate) SetCodeChallenge

func (cc *CodeCreate) SetCodeChallenge(s string) *CodeCreate

SetCodeChallenge sets the "code_challenge" field.

func (*CodeCreate) SetExpiresAt

func (cc *CodeCreate) SetExpiresAt(t time.Time) *CodeCreate

SetExpiresAt sets the "expires_at" field.

func (*CodeCreate) SetID

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

SetID sets the "id" field.

func (*CodeCreate) SetNillableClientID

func (cc *CodeCreate) SetNillableClientID(s *string) *CodeCreate

SetNillableClientID sets the "client_id" field if the given value is not nil.

func (*CodeCreate) SetNillableCodeChallenge

func (cc *CodeCreate) SetNillableCodeChallenge(s *string) *CodeCreate

SetNillableCodeChallenge sets the "code_challenge" field if the given value is not nil.

func (*CodeCreate) SetNillableID

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

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

func (*CodeCreate) SetNillableRedirectURI

func (cc *CodeCreate) SetNillableRedirectURI(s *string) *CodeCreate

SetNillableRedirectURI sets the "redirect_uri" field if the given value is not nil.

func (*CodeCreate) SetNillableScope

func (cc *CodeCreate) SetNillableScope(s *string) *CodeCreate

SetNillableScope sets the "scope" field if the given value is not nil.

func (*CodeCreate) SetNillableUserID

func (cc *CodeCreate) SetNillableUserID(id *uuid.UUID) *CodeCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*CodeCreate) SetRedirectURI

func (cc *CodeCreate) SetRedirectURI(s string) *CodeCreate

SetRedirectURI sets the "redirect_uri" field.

func (*CodeCreate) SetScope

func (cc *CodeCreate) SetScope(s string) *CodeCreate

SetScope sets the "scope" field.

func (*CodeCreate) SetUser

func (cc *CodeCreate) SetUser(u *User) *CodeCreate

SetUser sets the "user" edge to the User entity.

func (*CodeCreate) SetUserID

func (cc *CodeCreate) SetUserID(id uuid.UUID) *CodeCreate

SetUserID sets the "user" edge to the User entity by ID.

type CodeCreateBulk

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

CodeCreateBulk is the builder for creating many Code entities in bulk.

func (*CodeCreateBulk) Exec

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

Exec executes the query.

func (*CodeCreateBulk) ExecX

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

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

func (*CodeCreateBulk) OnConflict

func (ccb *CodeCreateBulk) OnConflict(opts ...sql.ConflictOption) *CodeUpsertBulk

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

client.Code.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.CodeUpsert) {
		SetCode(v+v).
	}).
	Exec(ctx)

func (*CodeCreateBulk) OnConflictColumns

func (ccb *CodeCreateBulk) OnConflictColumns(columns ...string) *CodeUpsertBulk

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

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

func (*CodeCreateBulk) Save

func (ccb *CodeCreateBulk) Save(ctx context.Context) ([]*Code, error)

Save creates the Code entities in the database.

func (*CodeCreateBulk) SaveX

func (ccb *CodeCreateBulk) SaveX(ctx context.Context) []*Code

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

type CodeDelete

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

CodeDelete is the builder for deleting a Code entity.

func (*CodeDelete) Exec

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

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

func (*CodeDelete) ExecX

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

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

func (*CodeDelete) Where

func (cd *CodeDelete) Where(ps ...predicate.Code) *CodeDelete

Where appends a list predicates to the CodeDelete builder.

type CodeDeleteOne

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

CodeDeleteOne is the builder for deleting a single Code entity.

func (*CodeDeleteOne) Exec

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

Exec executes the deletion query.

func (*CodeDeleteOne) ExecX

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

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

func (*CodeDeleteOne) Where

func (cdo *CodeDeleteOne) Where(ps ...predicate.Code) *CodeDeleteOne

Where appends a list predicates to the CodeDelete builder.

type CodeEdges

type CodeEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Groups holds the value of the groups edge.
	Groups []*Group `json:"groups,omitempty"`
	// contains filtered or unexported fields
}

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

func (CodeEdges) GroupsOrErr

func (e CodeEdges) GroupsOrErr() ([]*Group, error)

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

func (CodeEdges) UserOrErr

func (e CodeEdges) UserOrErr() (*User, error)

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

type CodeGroupBy

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

CodeGroupBy is the group-by builder for Code entities.

func (*CodeGroupBy) Aggregate

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

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

func (*CodeGroupBy) Bool

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

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

func (*CodeGroupBy) BoolX

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

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

func (*CodeGroupBy) Bools

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

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

func (*CodeGroupBy) BoolsX

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

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

func (*CodeGroupBy) Float64

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

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

func (*CodeGroupBy) Float64X

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

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

func (*CodeGroupBy) Float64s

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

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

func (*CodeGroupBy) Float64sX

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

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

func (*CodeGroupBy) Int

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

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

func (*CodeGroupBy) IntX

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

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

func (*CodeGroupBy) Ints

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

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

func (*CodeGroupBy) IntsX

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

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

func (*CodeGroupBy) Scan

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

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

func (*CodeGroupBy) ScanX

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

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

func (*CodeGroupBy) String

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

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

func (*CodeGroupBy) StringX

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

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

func (*CodeGroupBy) Strings

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

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

func (*CodeGroupBy) StringsX

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

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

type CodeMutation

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

CodeMutation represents an operation that mutates the Code nodes in the graph.

func (*CodeMutation) AddField

func (m *CodeMutation) 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 (*CodeMutation) AddGroupIDs

func (m *CodeMutation) AddGroupIDs(ids ...uuid.UUID)

AddGroupIDs adds the "groups" edge to the Group entity by ids.

func (*CodeMutation) AddedEdges

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

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

func (*CodeMutation) AddedField

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

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

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

func (*CodeMutation) AddedIDs

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

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

func (*CodeMutation) ClearEdge

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

func (m *CodeMutation) 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 (*CodeMutation) ClearGroups

func (m *CodeMutation) ClearGroups()

ClearGroups clears the "groups" edge to the Group entity.

func (*CodeMutation) ClearUser

func (m *CodeMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*CodeMutation) ClearedEdges

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

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

func (*CodeMutation) ClearedFields

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

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

func (CodeMutation) Client

func (m CodeMutation) 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 (*CodeMutation) ClientID

func (m *CodeMutation) ClientID() (r string, exists bool)

ClientID returns the value of the "client_id" field in the mutation.

func (*CodeMutation) Code

func (m *CodeMutation) Code() (r string, exists bool)

Code returns the value of the "code" field in the mutation.

func (*CodeMutation) CodeChallenge

func (m *CodeMutation) CodeChallenge() (r string, exists bool)

CodeChallenge returns the value of the "code_challenge" field in the mutation.

func (*CodeMutation) EdgeCleared

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

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

func (*CodeMutation) ExpiresAt

func (m *CodeMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*CodeMutation) Field

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

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

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

func (*CodeMutation) Fields

func (m *CodeMutation) 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 (*CodeMutation) GroupsCleared

func (m *CodeMutation) GroupsCleared() bool

GroupsCleared reports if the "groups" edge to the Group entity was cleared.

func (*CodeMutation) GroupsIDs

func (m *CodeMutation) GroupsIDs() (ids []uuid.UUID)

GroupsIDs returns the "groups" edge IDs in the mutation.

func (*CodeMutation) ID

func (m *CodeMutation) 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 (*CodeMutation) IDs

func (m *CodeMutation) 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 (*CodeMutation) OldClientID

func (m *CodeMutation) OldClientID(ctx context.Context) (v string, err error)

OldClientID returns the old "client_id" field's value of the Code entity. If the Code 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 (*CodeMutation) OldCode

func (m *CodeMutation) OldCode(ctx context.Context) (v string, err error)

OldCode returns the old "code" field's value of the Code entity. If the Code 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 (*CodeMutation) OldCodeChallenge

func (m *CodeMutation) OldCodeChallenge(ctx context.Context) (v string, err error)

OldCodeChallenge returns the old "code_challenge" field's value of the Code entity. If the Code 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 (*CodeMutation) OldExpiresAt

func (m *CodeMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the Code entity. If the Code 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 (*CodeMutation) OldField

func (m *CodeMutation) 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 (*CodeMutation) OldRedirectURI

func (m *CodeMutation) OldRedirectURI(ctx context.Context) (v string, err error)

OldRedirectURI returns the old "redirect_uri" field's value of the Code entity. If the Code 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 (*CodeMutation) OldScope

func (m *CodeMutation) OldScope(ctx context.Context) (v string, err error)

OldScope returns the old "scope" field's value of the Code entity. If the Code 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 (*CodeMutation) Op

func (m *CodeMutation) Op() Op

Op returns the operation name.

func (*CodeMutation) RedirectURI

func (m *CodeMutation) RedirectURI() (r string, exists bool)

RedirectURI returns the value of the "redirect_uri" field in the mutation.

func (*CodeMutation) RemoveGroupIDs

func (m *CodeMutation) RemoveGroupIDs(ids ...uuid.UUID)

RemoveGroupIDs removes the "groups" edge to the Group entity by IDs.

func (*CodeMutation) RemovedEdges

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

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

func (*CodeMutation) RemovedGroupsIDs

func (m *CodeMutation) RemovedGroupsIDs() (ids []uuid.UUID)

RemovedGroups returns the removed IDs of the "groups" edge to the Group entity.

func (*CodeMutation) RemovedIDs

func (m *CodeMutation) 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 (*CodeMutation) ResetClientID

func (m *CodeMutation) ResetClientID()

ResetClientID resets all changes to the "client_id" field.

func (*CodeMutation) ResetCode

func (m *CodeMutation) ResetCode()

ResetCode resets all changes to the "code" field.

func (*CodeMutation) ResetCodeChallenge

func (m *CodeMutation) ResetCodeChallenge()

ResetCodeChallenge resets all changes to the "code_challenge" field.

func (*CodeMutation) ResetEdge

func (m *CodeMutation) 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 (*CodeMutation) ResetExpiresAt

func (m *CodeMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*CodeMutation) ResetField

func (m *CodeMutation) 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 (*CodeMutation) ResetGroups

func (m *CodeMutation) ResetGroups()

ResetGroups resets all changes to the "groups" edge.

func (*CodeMutation) ResetRedirectURI

func (m *CodeMutation) ResetRedirectURI()

ResetRedirectURI resets all changes to the "redirect_uri" field.

func (*CodeMutation) ResetScope

func (m *CodeMutation) ResetScope()

ResetScope resets all changes to the "scope" field.

func (*CodeMutation) ResetUser

func (m *CodeMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*CodeMutation) Scope

func (m *CodeMutation) Scope() (r string, exists bool)

Scope returns the value of the "scope" field in the mutation.

func (*CodeMutation) SetClientID

func (m *CodeMutation) SetClientID(s string)

SetClientID sets the "client_id" field.

func (*CodeMutation) SetCode

func (m *CodeMutation) SetCode(s string)

SetCode sets the "code" field.

func (*CodeMutation) SetCodeChallenge

func (m *CodeMutation) SetCodeChallenge(s string)

SetCodeChallenge sets the "code_challenge" field.

func (*CodeMutation) SetExpiresAt

func (m *CodeMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*CodeMutation) SetField

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

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

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

func (*CodeMutation) SetOp

func (m *CodeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CodeMutation) SetRedirectURI

func (m *CodeMutation) SetRedirectURI(s string)

SetRedirectURI sets the "redirect_uri" field.

func (*CodeMutation) SetScope

func (m *CodeMutation) SetScope(s string)

SetScope sets the "scope" field.

func (*CodeMutation) SetUserID

func (m *CodeMutation) SetUserID(id uuid.UUID)

SetUserID sets the "user" edge to the User entity by id.

func (CodeMutation) Tx

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

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

func (*CodeMutation) Type

func (m *CodeMutation) Type() string

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

func (*CodeMutation) UserCleared

func (m *CodeMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*CodeMutation) UserID

func (m *CodeMutation) UserID() (id uuid.UUID, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*CodeMutation) UserIDs

func (m *CodeMutation) UserIDs() (ids []uuid.UUID)

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

func (*CodeMutation) Where

func (m *CodeMutation) Where(ps ...predicate.Code)

Where appends a list predicates to the CodeMutation builder.

func (*CodeMutation) WhereP

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

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

type CodeQuery

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

CodeQuery is the builder for querying Code entities.

func (*CodeQuery) Aggregate

func (cq *CodeQuery) Aggregate(fns ...AggregateFunc) *CodeSelect

Aggregate returns a CodeSelect configured with the given aggregations.

func (*CodeQuery) All

func (cq *CodeQuery) All(ctx context.Context) ([]*Code, error)

All executes the query and returns a list of Codes.

func (*CodeQuery) AllX

func (cq *CodeQuery) AllX(ctx context.Context) []*Code

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

func (*CodeQuery) Clone

func (cq *CodeQuery) Clone() *CodeQuery

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

func (*CodeQuery) Count

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

Count returns the count of the given query.

func (*CodeQuery) CountX

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

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

func (*CodeQuery) Exist

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

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

func (*CodeQuery) ExistX

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

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

func (*CodeQuery) First

func (cq *CodeQuery) First(ctx context.Context) (*Code, error)

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

func (*CodeQuery) FirstID

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

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

func (*CodeQuery) FirstIDX

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

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

func (*CodeQuery) FirstX

func (cq *CodeQuery) FirstX(ctx context.Context) *Code

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

func (*CodeQuery) GroupBy

func (cq *CodeQuery) GroupBy(field string, fields ...string) *CodeGroupBy

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

client.Code.Query().
	GroupBy(code.FieldCode).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CodeQuery) IDs

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

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

func (*CodeQuery) IDsX

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

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

func (*CodeQuery) Limit

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

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

func (*CodeQuery) Offset

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

Offset to start from.

func (*CodeQuery) Only

func (cq *CodeQuery) Only(ctx context.Context) (*Code, error)

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

func (*CodeQuery) OnlyID

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

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

func (*CodeQuery) OnlyIDX

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

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

func (*CodeQuery) OnlyX

func (cq *CodeQuery) OnlyX(ctx context.Context) *Code

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

func (*CodeQuery) Order

func (cq *CodeQuery) Order(o ...code.OrderOption) *CodeQuery

Order specifies how the records should be ordered.

func (*CodeQuery) QueryGroups

func (cq *CodeQuery) QueryGroups() *GroupQuery

QueryGroups chains the current query on the "groups" edge.

func (*CodeQuery) QueryUser

func (cq *CodeQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*CodeQuery) Select

func (cq *CodeQuery) Select(fields ...string) *CodeSelect

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

client.Code.Query().
	Select(code.FieldCode).
	Scan(ctx, &v)

func (*CodeQuery) Unique

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

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

func (cq *CodeQuery) Where(ps ...predicate.Code) *CodeQuery

Where adds a new predicate for the CodeQuery builder.

func (*CodeQuery) WithGroups

func (cq *CodeQuery) WithGroups(opts ...func(*GroupQuery)) *CodeQuery

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

func (*CodeQuery) WithUser

func (cq *CodeQuery) WithUser(opts ...func(*UserQuery)) *CodeQuery

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

type CodeSelect

type CodeSelect struct {
	*CodeQuery
	// contains filtered or unexported fields
}

CodeSelect is the builder for selecting fields of Code entities.

func (*CodeSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*CodeSelect) Bool

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

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

func (*CodeSelect) BoolX

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

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

func (*CodeSelect) Bools

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

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

func (*CodeSelect) BoolsX

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

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

func (*CodeSelect) Float64

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

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

func (*CodeSelect) Float64X

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

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

func (*CodeSelect) Float64s

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

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

func (*CodeSelect) Float64sX

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

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

func (*CodeSelect) Int

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

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

func (*CodeSelect) IntX

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

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

func (*CodeSelect) Ints

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

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

func (*CodeSelect) IntsX

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

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

func (*CodeSelect) Scan

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

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

func (*CodeSelect) ScanX

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

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

func (*CodeSelect) String

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

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

func (*CodeSelect) StringX

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

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

func (*CodeSelect) Strings

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

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

func (*CodeSelect) StringsX

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

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

type CodeUpdate

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

CodeUpdate is the builder for updating Code entities.

func (*CodeUpdate) AddGroupIDs

func (cu *CodeUpdate) AddGroupIDs(ids ...uuid.UUID) *CodeUpdate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*CodeUpdate) AddGroups

func (cu *CodeUpdate) AddGroups(g ...*Group) *CodeUpdate

AddGroups adds the "groups" edges to the Group entity.

func (*CodeUpdate) ClearGroups

func (cu *CodeUpdate) ClearGroups() *CodeUpdate

ClearGroups clears all "groups" edges to the Group entity.

func (*CodeUpdate) ClearUser

func (cu *CodeUpdate) ClearUser() *CodeUpdate

ClearUser clears the "user" edge to the User entity.

func (*CodeUpdate) Exec

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

Exec executes the query.

func (*CodeUpdate) ExecX

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

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

func (*CodeUpdate) Mutation

func (cu *CodeUpdate) Mutation() *CodeMutation

Mutation returns the CodeMutation object of the builder.

func (*CodeUpdate) RemoveGroupIDs

func (cu *CodeUpdate) RemoveGroupIDs(ids ...uuid.UUID) *CodeUpdate

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*CodeUpdate) RemoveGroups

func (cu *CodeUpdate) RemoveGroups(g ...*Group) *CodeUpdate

RemoveGroups removes "groups" edges to Group entities.

func (*CodeUpdate) Save

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

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

func (*CodeUpdate) SaveX

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

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

func (*CodeUpdate) SetClientID

func (cu *CodeUpdate) SetClientID(s string) *CodeUpdate

SetClientID sets the "client_id" field.

func (*CodeUpdate) SetCode

func (cu *CodeUpdate) SetCode(s string) *CodeUpdate

SetCode sets the "code" field.

func (*CodeUpdate) SetCodeChallenge

func (cu *CodeUpdate) SetCodeChallenge(s string) *CodeUpdate

SetCodeChallenge sets the "code_challenge" field.

func (*CodeUpdate) SetExpiresAt

func (cu *CodeUpdate) SetExpiresAt(t time.Time) *CodeUpdate

SetExpiresAt sets the "expires_at" field.

func (*CodeUpdate) SetNillableClientID

func (cu *CodeUpdate) SetNillableClientID(s *string) *CodeUpdate

SetNillableClientID sets the "client_id" field if the given value is not nil.

func (*CodeUpdate) SetNillableCode

func (cu *CodeUpdate) SetNillableCode(s *string) *CodeUpdate

SetNillableCode sets the "code" field if the given value is not nil.

func (*CodeUpdate) SetNillableCodeChallenge

func (cu *CodeUpdate) SetNillableCodeChallenge(s *string) *CodeUpdate

SetNillableCodeChallenge sets the "code_challenge" field if the given value is not nil.

func (*CodeUpdate) SetNillableExpiresAt

func (cu *CodeUpdate) SetNillableExpiresAt(t *time.Time) *CodeUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*CodeUpdate) SetNillableRedirectURI

func (cu *CodeUpdate) SetNillableRedirectURI(s *string) *CodeUpdate

SetNillableRedirectURI sets the "redirect_uri" field if the given value is not nil.

func (*CodeUpdate) SetNillableScope

func (cu *CodeUpdate) SetNillableScope(s *string) *CodeUpdate

SetNillableScope sets the "scope" field if the given value is not nil.

func (*CodeUpdate) SetNillableUserID

func (cu *CodeUpdate) SetNillableUserID(id *uuid.UUID) *CodeUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*CodeUpdate) SetRedirectURI

func (cu *CodeUpdate) SetRedirectURI(s string) *CodeUpdate

SetRedirectURI sets the "redirect_uri" field.

func (*CodeUpdate) SetScope

func (cu *CodeUpdate) SetScope(s string) *CodeUpdate

SetScope sets the "scope" field.

func (*CodeUpdate) SetUser

func (cu *CodeUpdate) SetUser(u *User) *CodeUpdate

SetUser sets the "user" edge to the User entity.

func (*CodeUpdate) SetUserID

func (cu *CodeUpdate) SetUserID(id uuid.UUID) *CodeUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*CodeUpdate) Where

func (cu *CodeUpdate) Where(ps ...predicate.Code) *CodeUpdate

Where appends a list predicates to the CodeUpdate builder.

type CodeUpdateOne

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

CodeUpdateOne is the builder for updating a single Code entity.

func (*CodeUpdateOne) AddGroupIDs

func (cuo *CodeUpdateOne) AddGroupIDs(ids ...uuid.UUID) *CodeUpdateOne

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*CodeUpdateOne) AddGroups

func (cuo *CodeUpdateOne) AddGroups(g ...*Group) *CodeUpdateOne

AddGroups adds the "groups" edges to the Group entity.

func (*CodeUpdateOne) ClearGroups

func (cuo *CodeUpdateOne) ClearGroups() *CodeUpdateOne

ClearGroups clears all "groups" edges to the Group entity.

func (*CodeUpdateOne) ClearUser

func (cuo *CodeUpdateOne) ClearUser() *CodeUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*CodeUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CodeUpdateOne) ExecX

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

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

func (*CodeUpdateOne) Mutation

func (cuo *CodeUpdateOne) Mutation() *CodeMutation

Mutation returns the CodeMutation object of the builder.

func (*CodeUpdateOne) RemoveGroupIDs

func (cuo *CodeUpdateOne) RemoveGroupIDs(ids ...uuid.UUID) *CodeUpdateOne

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*CodeUpdateOne) RemoveGroups

func (cuo *CodeUpdateOne) RemoveGroups(g ...*Group) *CodeUpdateOne

RemoveGroups removes "groups" edges to Group entities.

func (*CodeUpdateOne) Save

func (cuo *CodeUpdateOne) Save(ctx context.Context) (*Code, error)

Save executes the query and returns the updated Code entity.

func (*CodeUpdateOne) SaveX

func (cuo *CodeUpdateOne) SaveX(ctx context.Context) *Code

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

func (*CodeUpdateOne) Select

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

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

func (*CodeUpdateOne) SetClientID

func (cuo *CodeUpdateOne) SetClientID(s string) *CodeUpdateOne

SetClientID sets the "client_id" field.

func (*CodeUpdateOne) SetCode

func (cuo *CodeUpdateOne) SetCode(s string) *CodeUpdateOne

SetCode sets the "code" field.

func (*CodeUpdateOne) SetCodeChallenge

func (cuo *CodeUpdateOne) SetCodeChallenge(s string) *CodeUpdateOne

SetCodeChallenge sets the "code_challenge" field.

func (*CodeUpdateOne) SetExpiresAt

func (cuo *CodeUpdateOne) SetExpiresAt(t time.Time) *CodeUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*CodeUpdateOne) SetNillableClientID

func (cuo *CodeUpdateOne) SetNillableClientID(s *string) *CodeUpdateOne

SetNillableClientID sets the "client_id" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableCode

func (cuo *CodeUpdateOne) SetNillableCode(s *string) *CodeUpdateOne

SetNillableCode sets the "code" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableCodeChallenge

func (cuo *CodeUpdateOne) SetNillableCodeChallenge(s *string) *CodeUpdateOne

SetNillableCodeChallenge sets the "code_challenge" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableExpiresAt

func (cuo *CodeUpdateOne) SetNillableExpiresAt(t *time.Time) *CodeUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableRedirectURI

func (cuo *CodeUpdateOne) SetNillableRedirectURI(s *string) *CodeUpdateOne

SetNillableRedirectURI sets the "redirect_uri" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableScope

func (cuo *CodeUpdateOne) SetNillableScope(s *string) *CodeUpdateOne

SetNillableScope sets the "scope" field if the given value is not nil.

func (*CodeUpdateOne) SetNillableUserID

func (cuo *CodeUpdateOne) SetNillableUserID(id *uuid.UUID) *CodeUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*CodeUpdateOne) SetRedirectURI

func (cuo *CodeUpdateOne) SetRedirectURI(s string) *CodeUpdateOne

SetRedirectURI sets the "redirect_uri" field.

func (*CodeUpdateOne) SetScope

func (cuo *CodeUpdateOne) SetScope(s string) *CodeUpdateOne

SetScope sets the "scope" field.

func (*CodeUpdateOne) SetUser

func (cuo *CodeUpdateOne) SetUser(u *User) *CodeUpdateOne

SetUser sets the "user" edge to the User entity.

func (*CodeUpdateOne) SetUserID

func (cuo *CodeUpdateOne) SetUserID(id uuid.UUID) *CodeUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*CodeUpdateOne) Where

func (cuo *CodeUpdateOne) Where(ps ...predicate.Code) *CodeUpdateOne

Where appends a list predicates to the CodeUpdate builder.

type CodeUpsert

type CodeUpsert struct {
	*sql.UpdateSet
}

CodeUpsert is the "OnConflict" setter.

func (*CodeUpsert) SetClientID

func (u *CodeUpsert) SetClientID(v string) *CodeUpsert

SetClientID sets the "client_id" field.

func (*CodeUpsert) SetCode

func (u *CodeUpsert) SetCode(v string) *CodeUpsert

SetCode sets the "code" field.

func (*CodeUpsert) SetCodeChallenge

func (u *CodeUpsert) SetCodeChallenge(v string) *CodeUpsert

SetCodeChallenge sets the "code_challenge" field.

func (*CodeUpsert) SetExpiresAt

func (u *CodeUpsert) SetExpiresAt(v time.Time) *CodeUpsert

SetExpiresAt sets the "expires_at" field.

func (*CodeUpsert) SetRedirectURI

func (u *CodeUpsert) SetRedirectURI(v string) *CodeUpsert

SetRedirectURI sets the "redirect_uri" field.

func (*CodeUpsert) SetScope

func (u *CodeUpsert) SetScope(v string) *CodeUpsert

SetScope sets the "scope" field.

func (*CodeUpsert) UpdateClientID

func (u *CodeUpsert) UpdateClientID() *CodeUpsert

UpdateClientID sets the "client_id" field to the value that was provided on create.

func (*CodeUpsert) UpdateCode

func (u *CodeUpsert) UpdateCode() *CodeUpsert

UpdateCode sets the "code" field to the value that was provided on create.

func (*CodeUpsert) UpdateCodeChallenge

func (u *CodeUpsert) UpdateCodeChallenge() *CodeUpsert

UpdateCodeChallenge sets the "code_challenge" field to the value that was provided on create.

func (*CodeUpsert) UpdateExpiresAt

func (u *CodeUpsert) UpdateExpiresAt() *CodeUpsert

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*CodeUpsert) UpdateRedirectURI

func (u *CodeUpsert) UpdateRedirectURI() *CodeUpsert

UpdateRedirectURI sets the "redirect_uri" field to the value that was provided on create.

func (*CodeUpsert) UpdateScope

func (u *CodeUpsert) UpdateScope() *CodeUpsert

UpdateScope sets the "scope" field to the value that was provided on create.

type CodeUpsertBulk

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

CodeUpsertBulk is the builder for "upsert"-ing a bulk of Code nodes.

func (*CodeUpsertBulk) DoNothing

func (u *CodeUpsertBulk) DoNothing() *CodeUpsertBulk

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

func (*CodeUpsertBulk) Exec

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

Exec executes the query.

func (*CodeUpsertBulk) ExecX

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

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

func (*CodeUpsertBulk) Ignore

func (u *CodeUpsertBulk) Ignore() *CodeUpsertBulk

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

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

func (*CodeUpsertBulk) SetClientID

func (u *CodeUpsertBulk) SetClientID(v string) *CodeUpsertBulk

SetClientID sets the "client_id" field.

func (*CodeUpsertBulk) SetCode

func (u *CodeUpsertBulk) SetCode(v string) *CodeUpsertBulk

SetCode sets the "code" field.

func (*CodeUpsertBulk) SetCodeChallenge

func (u *CodeUpsertBulk) SetCodeChallenge(v string) *CodeUpsertBulk

SetCodeChallenge sets the "code_challenge" field.

func (*CodeUpsertBulk) SetExpiresAt

func (u *CodeUpsertBulk) SetExpiresAt(v time.Time) *CodeUpsertBulk

SetExpiresAt sets the "expires_at" field.

func (*CodeUpsertBulk) SetRedirectURI

func (u *CodeUpsertBulk) SetRedirectURI(v string) *CodeUpsertBulk

SetRedirectURI sets the "redirect_uri" field.

func (*CodeUpsertBulk) SetScope

func (u *CodeUpsertBulk) SetScope(v string) *CodeUpsertBulk

SetScope sets the "scope" field.

func (*CodeUpsertBulk) Update

func (u *CodeUpsertBulk) Update(set func(*CodeUpsert)) *CodeUpsertBulk

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

func (*CodeUpsertBulk) UpdateClientID

func (u *CodeUpsertBulk) UpdateClientID() *CodeUpsertBulk

UpdateClientID sets the "client_id" field to the value that was provided on create.

func (*CodeUpsertBulk) UpdateCode

func (u *CodeUpsertBulk) UpdateCode() *CodeUpsertBulk

UpdateCode sets the "code" field to the value that was provided on create.

func (*CodeUpsertBulk) UpdateCodeChallenge

func (u *CodeUpsertBulk) UpdateCodeChallenge() *CodeUpsertBulk

UpdateCodeChallenge sets the "code_challenge" field to the value that was provided on create.

func (*CodeUpsertBulk) UpdateExpiresAt

func (u *CodeUpsertBulk) UpdateExpiresAt() *CodeUpsertBulk

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*CodeUpsertBulk) UpdateNewValues

func (u *CodeUpsertBulk) UpdateNewValues() *CodeUpsertBulk

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

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

func (*CodeUpsertBulk) UpdateRedirectURI

func (u *CodeUpsertBulk) UpdateRedirectURI() *CodeUpsertBulk

UpdateRedirectURI sets the "redirect_uri" field to the value that was provided on create.

func (*CodeUpsertBulk) UpdateScope

func (u *CodeUpsertBulk) UpdateScope() *CodeUpsertBulk

UpdateScope sets the "scope" field to the value that was provided on create.

type CodeUpsertOne

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

CodeUpsertOne is the builder for "upsert"-ing

one Code node.

func (*CodeUpsertOne) DoNothing

func (u *CodeUpsertOne) DoNothing() *CodeUpsertOne

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

func (*CodeUpsertOne) Exec

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

Exec executes the query.

func (*CodeUpsertOne) ExecX

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

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

func (*CodeUpsertOne) ID

func (u *CodeUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*CodeUpsertOne) IDX

func (u *CodeUpsertOne) IDX(ctx context.Context) uuid.UUID

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

func (*CodeUpsertOne) Ignore

func (u *CodeUpsertOne) Ignore() *CodeUpsertOne

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

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

func (*CodeUpsertOne) SetClientID

func (u *CodeUpsertOne) SetClientID(v string) *CodeUpsertOne

SetClientID sets the "client_id" field.

func (*CodeUpsertOne) SetCode

func (u *CodeUpsertOne) SetCode(v string) *CodeUpsertOne

SetCode sets the "code" field.

func (*CodeUpsertOne) SetCodeChallenge

func (u *CodeUpsertOne) SetCodeChallenge(v string) *CodeUpsertOne

SetCodeChallenge sets the "code_challenge" field.

func (*CodeUpsertOne) SetExpiresAt

func (u *CodeUpsertOne) SetExpiresAt(v time.Time) *CodeUpsertOne

SetExpiresAt sets the "expires_at" field.

func (*CodeUpsertOne) SetRedirectURI

func (u *CodeUpsertOne) SetRedirectURI(v string) *CodeUpsertOne

SetRedirectURI sets the "redirect_uri" field.

func (*CodeUpsertOne) SetScope

func (u *CodeUpsertOne) SetScope(v string) *CodeUpsertOne

SetScope sets the "scope" field.

func (*CodeUpsertOne) Update

func (u *CodeUpsertOne) Update(set func(*CodeUpsert)) *CodeUpsertOne

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

func (*CodeUpsertOne) UpdateClientID

func (u *CodeUpsertOne) UpdateClientID() *CodeUpsertOne

UpdateClientID sets the "client_id" field to the value that was provided on create.

func (*CodeUpsertOne) UpdateCode

func (u *CodeUpsertOne) UpdateCode() *CodeUpsertOne

UpdateCode sets the "code" field to the value that was provided on create.

func (*CodeUpsertOne) UpdateCodeChallenge

func (u *CodeUpsertOne) UpdateCodeChallenge() *CodeUpsertOne

UpdateCodeChallenge sets the "code_challenge" field to the value that was provided on create.

func (*CodeUpsertOne) UpdateExpiresAt

func (u *CodeUpsertOne) UpdateExpiresAt() *CodeUpsertOne

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*CodeUpsertOne) UpdateNewValues

func (u *CodeUpsertOne) UpdateNewValues() *CodeUpsertOne

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.Code.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(code.FieldID)
		}),
	).
	Exec(ctx)

func (*CodeUpsertOne) UpdateRedirectURI

func (u *CodeUpsertOne) UpdateRedirectURI() *CodeUpsertOne

UpdateRedirectURI sets the "redirect_uri" field to the value that was provided on create.

func (*CodeUpsertOne) UpdateScope

func (u *CodeUpsertOne) UpdateScope() *CodeUpsertOne

UpdateScope sets the "scope" field to the value that was provided on create.

type Codes

type Codes []*Code

Codes is a parsable slice of Code.

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 Group

type Group struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the GroupQuery when eager-loading is set.
	Edges GroupEdges `json:"edges"`
	// contains filtered or unexported fields
}

Group is the model entity for the Group schema.

func (*Group) QueryAccessTokens

func (gr *Group) QueryAccessTokens() *AccessTokenQuery

QueryAccessTokens queries the "access_tokens" edge of the Group entity.

func (*Group) QueryCodes

func (gr *Group) QueryCodes() *CodeQuery

QueryCodes queries the "codes" edge of the Group entity.

func (*Group) QueryUsers

func (gr *Group) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Group entity.

func (*Group) String

func (gr *Group) String() string

String implements the fmt.Stringer.

func (*Group) Unwrap

func (gr *Group) Unwrap() *Group

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

func (gr *Group) Update() *GroupUpdateOne

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

func (*Group) Value

func (gr *Group) Value(name string) (ent.Value, error)

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

type GroupClient

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

GroupClient is a client for the Group schema.

func NewGroupClient

func NewGroupClient(c config) *GroupClient

NewGroupClient returns a client for the Group from the given config.

func (*GroupClient) Create

func (c *GroupClient) Create() *GroupCreate

Create returns a builder for creating a Group entity.

func (*GroupClient) CreateBulk

func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk

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

func (*GroupClient) Delete

func (c *GroupClient) Delete() *GroupDelete

Delete returns a delete builder for Group.

func (*GroupClient) DeleteOne

func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*GroupClient) DeleteOneID

func (c *GroupClient) DeleteOneID(id uuid.UUID) *GroupDeleteOne

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

func (*GroupClient) Get

func (c *GroupClient) Get(ctx context.Context, id uuid.UUID) (*Group, error)

Get returns a Group entity by its id.

func (*GroupClient) GetX

func (c *GroupClient) GetX(ctx context.Context, id uuid.UUID) *Group

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

func (*GroupClient) Hooks

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

Hooks returns the client hooks.

func (*GroupClient) Intercept

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

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

func (*GroupClient) Interceptors

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

Interceptors returns the client interceptors.

func (*GroupClient) MapCreateBulk

func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk

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

func (*GroupClient) Query

func (c *GroupClient) Query() *GroupQuery

Query returns a query builder for Group.

func (*GroupClient) QueryAccessTokens

func (c *GroupClient) QueryAccessTokens(gr *Group) *AccessTokenQuery

QueryAccessTokens queries the access_tokens edge of a Group.

func (*GroupClient) QueryCodes

func (c *GroupClient) QueryCodes(gr *Group) *CodeQuery

QueryCodes queries the codes edge of a Group.

func (*GroupClient) QueryUsers

func (c *GroupClient) QueryUsers(gr *Group) *UserQuery

QueryUsers queries the users edge of a Group.

func (*GroupClient) Update

func (c *GroupClient) Update() *GroupUpdate

Update returns an update builder for Group.

func (*GroupClient) UpdateOne

func (c *GroupClient) UpdateOne(gr *Group) *GroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*GroupClient) UpdateOneID

func (c *GroupClient) UpdateOneID(id uuid.UUID) *GroupUpdateOne

UpdateOneID returns an update builder for the given id.

func (*GroupClient) Use

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

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

type GroupCreate

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

GroupCreate is the builder for creating a Group entity.

func (*GroupCreate) AddAccessTokenIDs

func (gc *GroupCreate) AddAccessTokenIDs(ids ...uuid.UUID) *GroupCreate

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*GroupCreate) AddAccessTokens

func (gc *GroupCreate) AddAccessTokens(a ...*AccessToken) *GroupCreate

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*GroupCreate) AddCodeIDs

func (gc *GroupCreate) AddCodeIDs(ids ...uuid.UUID) *GroupCreate

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*GroupCreate) AddCodes

func (gc *GroupCreate) AddCodes(c ...*Code) *GroupCreate

AddCodes adds the "codes" edges to the Code entity.

func (*GroupCreate) AddUserIDs

func (gc *GroupCreate) AddUserIDs(ids ...uuid.UUID) *GroupCreate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*GroupCreate) AddUsers

func (gc *GroupCreate) AddUsers(u ...*User) *GroupCreate

AddUsers adds the "users" edges to the User entity.

func (*GroupCreate) Exec

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

Exec executes the query.

func (*GroupCreate) ExecX

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

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

func (*GroupCreate) Mutation

func (gc *GroupCreate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupCreate) OnConflict

func (gc *GroupCreate) OnConflict(opts ...sql.ConflictOption) *GroupUpsertOne

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

client.Group.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.GroupUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*GroupCreate) OnConflictColumns

func (gc *GroupCreate) OnConflictColumns(columns ...string) *GroupUpsertOne

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

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

func (*GroupCreate) Save

func (gc *GroupCreate) Save(ctx context.Context) (*Group, error)

Save creates the Group in the database.

func (*GroupCreate) SaveX

func (gc *GroupCreate) SaveX(ctx context.Context) *Group

SaveX calls Save and panics if Save returns an error.

func (*GroupCreate) SetID

func (gc *GroupCreate) SetID(u uuid.UUID) *GroupCreate

SetID sets the "id" field.

func (*GroupCreate) SetName

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

SetName sets the "name" field.

func (*GroupCreate) SetNillableID

func (gc *GroupCreate) SetNillableID(u *uuid.UUID) *GroupCreate

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

type GroupCreateBulk

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

GroupCreateBulk is the builder for creating many Group entities in bulk.

func (*GroupCreateBulk) Exec

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

Exec executes the query.

func (*GroupCreateBulk) ExecX

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

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

func (*GroupCreateBulk) OnConflict

func (gcb *GroupCreateBulk) OnConflict(opts ...sql.ConflictOption) *GroupUpsertBulk

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

client.Group.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.GroupUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*GroupCreateBulk) OnConflictColumns

func (gcb *GroupCreateBulk) OnConflictColumns(columns ...string) *GroupUpsertBulk

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

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

func (*GroupCreateBulk) Save

func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error)

Save creates the Group entities in the database.

func (*GroupCreateBulk) SaveX

func (gcb *GroupCreateBulk) SaveX(ctx context.Context) []*Group

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

type GroupDelete

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

GroupDelete is the builder for deleting a Group entity.

func (*GroupDelete) Exec

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

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

func (*GroupDelete) ExecX

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

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

func (*GroupDelete) Where

func (gd *GroupDelete) Where(ps ...predicate.Group) *GroupDelete

Where appends a list predicates to the GroupDelete builder.

type GroupDeleteOne

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

GroupDeleteOne is the builder for deleting a single Group entity.

func (*GroupDeleteOne) Exec

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

Exec executes the deletion query.

func (*GroupDeleteOne) ExecX

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

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

func (*GroupDeleteOne) Where

func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne

Where appends a list predicates to the GroupDelete builder.

type GroupEdges

type GroupEdges struct {
	// Users holds the value of the users edge.
	Users []*User `json:"users,omitempty"`
	// Codes holds the value of the codes edge.
	Codes []*Code `json:"codes,omitempty"`
	// AccessTokens holds the value of the access_tokens edge.
	AccessTokens []*AccessToken `json:"access_tokens,omitempty"`
	// contains filtered or unexported fields
}

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

func (GroupEdges) AccessTokensOrErr

func (e GroupEdges) AccessTokensOrErr() ([]*AccessToken, error)

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

func (GroupEdges) CodesOrErr

func (e GroupEdges) CodesOrErr() ([]*Code, error)

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

func (GroupEdges) UsersOrErr

func (e GroupEdges) UsersOrErr() ([]*User, error)

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

type GroupGroupBy

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

GroupGroupBy is the group-by builder for Group entities.

func (*GroupGroupBy) Aggregate

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

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

func (*GroupGroupBy) Bool

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

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

func (*GroupGroupBy) BoolX

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

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

func (*GroupGroupBy) Bools

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

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

func (*GroupGroupBy) BoolsX

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

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

func (*GroupGroupBy) Float64

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

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

func (*GroupGroupBy) Float64X

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

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

func (*GroupGroupBy) Float64s

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

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

func (*GroupGroupBy) Float64sX

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

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

func (*GroupGroupBy) Int

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

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

func (*GroupGroupBy) IntX

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

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

func (*GroupGroupBy) Ints

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

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

func (*GroupGroupBy) IntsX

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

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

func (*GroupGroupBy) Scan

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

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

func (*GroupGroupBy) ScanX

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

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

func (*GroupGroupBy) String

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

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

func (*GroupGroupBy) StringX

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

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

func (*GroupGroupBy) Strings

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

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

func (*GroupGroupBy) StringsX

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

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

type GroupMutation

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

GroupMutation represents an operation that mutates the Group nodes in the graph.

func (*GroupMutation) AccessTokensCleared

func (m *GroupMutation) AccessTokensCleared() bool

AccessTokensCleared reports if the "access_tokens" edge to the AccessToken entity was cleared.

func (*GroupMutation) AccessTokensIDs

func (m *GroupMutation) AccessTokensIDs() (ids []uuid.UUID)

AccessTokensIDs returns the "access_tokens" edge IDs in the mutation.

func (*GroupMutation) AddAccessTokenIDs

func (m *GroupMutation) AddAccessTokenIDs(ids ...uuid.UUID)

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by ids.

func (*GroupMutation) AddCodeIDs

func (m *GroupMutation) AddCodeIDs(ids ...uuid.UUID)

AddCodeIDs adds the "codes" edge to the Code entity by ids.

func (*GroupMutation) AddField

func (m *GroupMutation) 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 (*GroupMutation) AddUserIDs

func (m *GroupMutation) AddUserIDs(ids ...uuid.UUID)

AddUserIDs adds the "users" edge to the User entity by ids.

func (*GroupMutation) AddedEdges

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

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

func (*GroupMutation) AddedField

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

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

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

func (*GroupMutation) AddedIDs

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

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

func (*GroupMutation) ClearAccessTokens

func (m *GroupMutation) ClearAccessTokens()

ClearAccessTokens clears the "access_tokens" edge to the AccessToken entity.

func (*GroupMutation) ClearCodes

func (m *GroupMutation) ClearCodes()

ClearCodes clears the "codes" edge to the Code entity.

func (*GroupMutation) ClearEdge

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

func (m *GroupMutation) 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 (*GroupMutation) ClearUsers

func (m *GroupMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*GroupMutation) ClearedEdges

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

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

func (*GroupMutation) ClearedFields

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

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

func (GroupMutation) Client

func (m GroupMutation) 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 (*GroupMutation) CodesCleared

func (m *GroupMutation) CodesCleared() bool

CodesCleared reports if the "codes" edge to the Code entity was cleared.

func (*GroupMutation) CodesIDs

func (m *GroupMutation) CodesIDs() (ids []uuid.UUID)

CodesIDs returns the "codes" edge IDs in the mutation.

func (*GroupMutation) EdgeCleared

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

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

func (*GroupMutation) Field

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

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

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

func (*GroupMutation) Fields

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

func (m *GroupMutation) 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 (*GroupMutation) IDs

func (m *GroupMutation) 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 (*GroupMutation) Name

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

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

func (*GroupMutation) OldField

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

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

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

func (m *GroupMutation) Op() Op

Op returns the operation name.

func (*GroupMutation) RemoveAccessTokenIDs

func (m *GroupMutation) RemoveAccessTokenIDs(ids ...uuid.UUID)

RemoveAccessTokenIDs removes the "access_tokens" edge to the AccessToken entity by IDs.

func (*GroupMutation) RemoveCodeIDs

func (m *GroupMutation) RemoveCodeIDs(ids ...uuid.UUID)

RemoveCodeIDs removes the "codes" edge to the Code entity by IDs.

func (*GroupMutation) RemoveUserIDs

func (m *GroupMutation) RemoveUserIDs(ids ...uuid.UUID)

RemoveUserIDs removes the "users" edge to the User entity by IDs.

func (*GroupMutation) RemovedAccessTokensIDs

func (m *GroupMutation) RemovedAccessTokensIDs() (ids []uuid.UUID)

RemovedAccessTokens returns the removed IDs of the "access_tokens" edge to the AccessToken entity.

func (*GroupMutation) RemovedCodesIDs

func (m *GroupMutation) RemovedCodesIDs() (ids []uuid.UUID)

RemovedCodes returns the removed IDs of the "codes" edge to the Code entity.

func (*GroupMutation) RemovedEdges

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

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

func (*GroupMutation) RemovedIDs

func (m *GroupMutation) 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 (*GroupMutation) RemovedUsersIDs

func (m *GroupMutation) RemovedUsersIDs() (ids []uuid.UUID)

RemovedUsers returns the removed IDs of the "users" edge to the User entity.

func (*GroupMutation) ResetAccessTokens

func (m *GroupMutation) ResetAccessTokens()

ResetAccessTokens resets all changes to the "access_tokens" edge.

func (*GroupMutation) ResetCodes

func (m *GroupMutation) ResetCodes()

ResetCodes resets all changes to the "codes" edge.

func (*GroupMutation) ResetEdge

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

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

func (m *GroupMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*GroupMutation) ResetUsers

func (m *GroupMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*GroupMutation) SetField

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

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

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

func (*GroupMutation) SetName

func (m *GroupMutation) SetName(s string)

SetName sets the "name" field.

func (*GroupMutation) SetOp

func (m *GroupMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (GroupMutation) Tx

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

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

func (*GroupMutation) Type

func (m *GroupMutation) Type() string

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

func (*GroupMutation) UsersCleared

func (m *GroupMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*GroupMutation) UsersIDs

func (m *GroupMutation) UsersIDs() (ids []uuid.UUID)

UsersIDs returns the "users" edge IDs in the mutation.

func (*GroupMutation) Where

func (m *GroupMutation) Where(ps ...predicate.Group)

Where appends a list predicates to the GroupMutation builder.

func (*GroupMutation) WhereP

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

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

type GroupQuery

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

GroupQuery is the builder for querying Group entities.

func (*GroupQuery) Aggregate

func (gq *GroupQuery) Aggregate(fns ...AggregateFunc) *GroupSelect

Aggregate returns a GroupSelect configured with the given aggregations.

func (*GroupQuery) All

func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error)

All executes the query and returns a list of Groups.

func (*GroupQuery) AllX

func (gq *GroupQuery) AllX(ctx context.Context) []*Group

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

func (*GroupQuery) Clone

func (gq *GroupQuery) Clone() *GroupQuery

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

func (*GroupQuery) Count

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

Count returns the count of the given query.

func (*GroupQuery) CountX

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

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

func (*GroupQuery) Exist

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

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

func (*GroupQuery) ExistX

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

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

func (*GroupQuery) First

func (gq *GroupQuery) First(ctx context.Context) (*Group, error)

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

func (*GroupQuery) FirstID

func (gq *GroupQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*GroupQuery) FirstIDX

func (gq *GroupQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*GroupQuery) FirstX

func (gq *GroupQuery) FirstX(ctx context.Context) *Group

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

func (*GroupQuery) GroupBy

func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy

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.Group.Query().
	GroupBy(group.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*GroupQuery) IDs

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

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

func (*GroupQuery) IDsX

func (gq *GroupQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*GroupQuery) Limit

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

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

func (*GroupQuery) Offset

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

Offset to start from.

func (*GroupQuery) Only

func (gq *GroupQuery) Only(ctx context.Context) (*Group, error)

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

func (*GroupQuery) OnlyID

func (gq *GroupQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*GroupQuery) OnlyIDX

func (gq *GroupQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*GroupQuery) OnlyX

func (gq *GroupQuery) OnlyX(ctx context.Context) *Group

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

func (*GroupQuery) Order

func (gq *GroupQuery) Order(o ...group.OrderOption) *GroupQuery

Order specifies how the records should be ordered.

func (*GroupQuery) QueryAccessTokens

func (gq *GroupQuery) QueryAccessTokens() *AccessTokenQuery

QueryAccessTokens chains the current query on the "access_tokens" edge.

func (*GroupQuery) QueryCodes

func (gq *GroupQuery) QueryCodes() *CodeQuery

QueryCodes chains the current query on the "codes" edge.

func (*GroupQuery) QueryUsers

func (gq *GroupQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*GroupQuery) Select

func (gq *GroupQuery) Select(fields ...string) *GroupSelect

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.Group.Query().
	Select(group.FieldName).
	Scan(ctx, &v)

func (*GroupQuery) Unique

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

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

func (gq *GroupQuery) Where(ps ...predicate.Group) *GroupQuery

Where adds a new predicate for the GroupQuery builder.

func (*GroupQuery) WithAccessTokens

func (gq *GroupQuery) WithAccessTokens(opts ...func(*AccessTokenQuery)) *GroupQuery

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

func (*GroupQuery) WithCodes

func (gq *GroupQuery) WithCodes(opts ...func(*CodeQuery)) *GroupQuery

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

func (*GroupQuery) WithUsers

func (gq *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery

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

type GroupSelect

type GroupSelect struct {
	*GroupQuery
	// contains filtered or unexported fields
}

GroupSelect is the builder for selecting fields of Group entities.

func (*GroupSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*GroupSelect) Bool

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

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

func (*GroupSelect) BoolX

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

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

func (*GroupSelect) Bools

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

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

func (*GroupSelect) BoolsX

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

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

func (*GroupSelect) Float64

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

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

func (*GroupSelect) Float64X

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

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

func (*GroupSelect) Float64s

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

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

func (*GroupSelect) Float64sX

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

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

func (*GroupSelect) Int

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

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

func (*GroupSelect) IntX

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

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

func (*GroupSelect) Ints

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

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

func (*GroupSelect) IntsX

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

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

func (*GroupSelect) Scan

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

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

func (*GroupSelect) ScanX

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

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

func (*GroupSelect) String

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

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

func (*GroupSelect) StringX

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

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

func (*GroupSelect) Strings

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

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

func (*GroupSelect) StringsX

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

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

type GroupUpdate

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

GroupUpdate is the builder for updating Group entities.

func (*GroupUpdate) AddAccessTokenIDs

func (gu *GroupUpdate) AddAccessTokenIDs(ids ...uuid.UUID) *GroupUpdate

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*GroupUpdate) AddAccessTokens

func (gu *GroupUpdate) AddAccessTokens(a ...*AccessToken) *GroupUpdate

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*GroupUpdate) AddCodeIDs

func (gu *GroupUpdate) AddCodeIDs(ids ...uuid.UUID) *GroupUpdate

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*GroupUpdate) AddCodes

func (gu *GroupUpdate) AddCodes(c ...*Code) *GroupUpdate

AddCodes adds the "codes" edges to the Code entity.

func (*GroupUpdate) AddUserIDs

func (gu *GroupUpdate) AddUserIDs(ids ...uuid.UUID) *GroupUpdate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*GroupUpdate) AddUsers

func (gu *GroupUpdate) AddUsers(u ...*User) *GroupUpdate

AddUsers adds the "users" edges to the User entity.

func (*GroupUpdate) ClearAccessTokens

func (gu *GroupUpdate) ClearAccessTokens() *GroupUpdate

ClearAccessTokens clears all "access_tokens" edges to the AccessToken entity.

func (*GroupUpdate) ClearCodes

func (gu *GroupUpdate) ClearCodes() *GroupUpdate

ClearCodes clears all "codes" edges to the Code entity.

func (*GroupUpdate) ClearUsers

func (gu *GroupUpdate) ClearUsers() *GroupUpdate

ClearUsers clears all "users" edges to the User entity.

func (*GroupUpdate) Exec

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

Exec executes the query.

func (*GroupUpdate) ExecX

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

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

func (*GroupUpdate) Mutation

func (gu *GroupUpdate) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdate) RemoveAccessTokenIDs

func (gu *GroupUpdate) RemoveAccessTokenIDs(ids ...uuid.UUID) *GroupUpdate

RemoveAccessTokenIDs removes the "access_tokens" edge to AccessToken entities by IDs.

func (*GroupUpdate) RemoveAccessTokens

func (gu *GroupUpdate) RemoveAccessTokens(a ...*AccessToken) *GroupUpdate

RemoveAccessTokens removes "access_tokens" edges to AccessToken entities.

func (*GroupUpdate) RemoveCodeIDs

func (gu *GroupUpdate) RemoveCodeIDs(ids ...uuid.UUID) *GroupUpdate

RemoveCodeIDs removes the "codes" edge to Code entities by IDs.

func (*GroupUpdate) RemoveCodes

func (gu *GroupUpdate) RemoveCodes(c ...*Code) *GroupUpdate

RemoveCodes removes "codes" edges to Code entities.

func (*GroupUpdate) RemoveUserIDs

func (gu *GroupUpdate) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdate

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*GroupUpdate) RemoveUsers

func (gu *GroupUpdate) RemoveUsers(u ...*User) *GroupUpdate

RemoveUsers removes "users" edges to User entities.

func (*GroupUpdate) Save

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

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

func (*GroupUpdate) SaveX

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

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

func (*GroupUpdate) SetName

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

SetName sets the "name" field.

func (*GroupUpdate) SetNillableName

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

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

func (*GroupUpdate) Where

func (gu *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate

Where appends a list predicates to the GroupUpdate builder.

type GroupUpdateOne

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

GroupUpdateOne is the builder for updating a single Group entity.

func (*GroupUpdateOne) AddAccessTokenIDs

func (guo *GroupUpdateOne) AddAccessTokenIDs(ids ...uuid.UUID) *GroupUpdateOne

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*GroupUpdateOne) AddAccessTokens

func (guo *GroupUpdateOne) AddAccessTokens(a ...*AccessToken) *GroupUpdateOne

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*GroupUpdateOne) AddCodeIDs

func (guo *GroupUpdateOne) AddCodeIDs(ids ...uuid.UUID) *GroupUpdateOne

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*GroupUpdateOne) AddCodes

func (guo *GroupUpdateOne) AddCodes(c ...*Code) *GroupUpdateOne

AddCodes adds the "codes" edges to the Code entity.

func (*GroupUpdateOne) AddUserIDs

func (guo *GroupUpdateOne) AddUserIDs(ids ...uuid.UUID) *GroupUpdateOne

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*GroupUpdateOne) AddUsers

func (guo *GroupUpdateOne) AddUsers(u ...*User) *GroupUpdateOne

AddUsers adds the "users" edges to the User entity.

func (*GroupUpdateOne) ClearAccessTokens

func (guo *GroupUpdateOne) ClearAccessTokens() *GroupUpdateOne

ClearAccessTokens clears all "access_tokens" edges to the AccessToken entity.

func (*GroupUpdateOne) ClearCodes

func (guo *GroupUpdateOne) ClearCodes() *GroupUpdateOne

ClearCodes clears all "codes" edges to the Code entity.

func (*GroupUpdateOne) ClearUsers

func (guo *GroupUpdateOne) ClearUsers() *GroupUpdateOne

ClearUsers clears all "users" edges to the User entity.

func (*GroupUpdateOne) Exec

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

Exec executes the query on the entity.

func (*GroupUpdateOne) ExecX

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

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

func (*GroupUpdateOne) Mutation

func (guo *GroupUpdateOne) Mutation() *GroupMutation

Mutation returns the GroupMutation object of the builder.

func (*GroupUpdateOne) RemoveAccessTokenIDs

func (guo *GroupUpdateOne) RemoveAccessTokenIDs(ids ...uuid.UUID) *GroupUpdateOne

RemoveAccessTokenIDs removes the "access_tokens" edge to AccessToken entities by IDs.

func (*GroupUpdateOne) RemoveAccessTokens

func (guo *GroupUpdateOne) RemoveAccessTokens(a ...*AccessToken) *GroupUpdateOne

RemoveAccessTokens removes "access_tokens" edges to AccessToken entities.

func (*GroupUpdateOne) RemoveCodeIDs

func (guo *GroupUpdateOne) RemoveCodeIDs(ids ...uuid.UUID) *GroupUpdateOne

RemoveCodeIDs removes the "codes" edge to Code entities by IDs.

func (*GroupUpdateOne) RemoveCodes

func (guo *GroupUpdateOne) RemoveCodes(c ...*Code) *GroupUpdateOne

RemoveCodes removes "codes" edges to Code entities.

func (*GroupUpdateOne) RemoveUserIDs

func (guo *GroupUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *GroupUpdateOne

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*GroupUpdateOne) RemoveUsers

func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*GroupUpdateOne) Save

func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error)

Save executes the query and returns the updated Group entity.

func (*GroupUpdateOne) SaveX

func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group

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

func (*GroupUpdateOne) Select

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

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

func (*GroupUpdateOne) SetName

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

SetName sets the "name" field.

func (*GroupUpdateOne) SetNillableName

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

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

func (*GroupUpdateOne) Where

func (guo *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne

Where appends a list predicates to the GroupUpdate builder.

type GroupUpsert

type GroupUpsert struct {
	*sql.UpdateSet
}

GroupUpsert is the "OnConflict" setter.

func (*GroupUpsert) SetName

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

SetName sets the "name" field.

func (*GroupUpsert) UpdateName

func (u *GroupUpsert) UpdateName() *GroupUpsert

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

type GroupUpsertBulk

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

GroupUpsertBulk is the builder for "upsert"-ing a bulk of Group nodes.

func (*GroupUpsertBulk) DoNothing

func (u *GroupUpsertBulk) DoNothing() *GroupUpsertBulk

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

func (*GroupUpsertBulk) Exec

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

Exec executes the query.

func (*GroupUpsertBulk) ExecX

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

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

func (*GroupUpsertBulk) Ignore

func (u *GroupUpsertBulk) Ignore() *GroupUpsertBulk

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

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

func (*GroupUpsertBulk) SetName

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

SetName sets the "name" field.

func (*GroupUpsertBulk) Update

func (u *GroupUpsertBulk) Update(set func(*GroupUpsert)) *GroupUpsertBulk

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

func (*GroupUpsertBulk) UpdateName

func (u *GroupUpsertBulk) UpdateName() *GroupUpsertBulk

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

func (*GroupUpsertBulk) UpdateNewValues

func (u *GroupUpsertBulk) UpdateNewValues() *GroupUpsertBulk

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

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

type GroupUpsertOne

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

GroupUpsertOne is the builder for "upsert"-ing

one Group node.

func (*GroupUpsertOne) DoNothing

func (u *GroupUpsertOne) DoNothing() *GroupUpsertOne

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

func (*GroupUpsertOne) Exec

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

Exec executes the query.

func (*GroupUpsertOne) ExecX

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

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

func (*GroupUpsertOne) ID

func (u *GroupUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*GroupUpsertOne) IDX

func (u *GroupUpsertOne) IDX(ctx context.Context) uuid.UUID

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

func (*GroupUpsertOne) Ignore

func (u *GroupUpsertOne) Ignore() *GroupUpsertOne

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

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

func (*GroupUpsertOne) SetName

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

SetName sets the "name" field.

func (*GroupUpsertOne) Update

func (u *GroupUpsertOne) Update(set func(*GroupUpsert)) *GroupUpsertOne

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

func (*GroupUpsertOne) UpdateName

func (u *GroupUpsertOne) UpdateName() *GroupUpsertOne

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

func (*GroupUpsertOne) UpdateNewValues

func (u *GroupUpsertOne) UpdateNewValues() *GroupUpsertOne

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.Group.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(group.FieldID)
		}),
	).
	Exec(ctx)

type Groups

type Groups []*Group

Groups is a parsable slice of Group.

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 {

	// AccessToken is the client for interacting with the AccessToken builders.
	AccessToken *AccessTokenClient
	// Code is the client for interacting with the Code builders.
	Code *CodeClient
	// Group is the client for interacting with the Group builders.
	Group *GroupClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAccessTokens

func (u *User) QueryAccessTokens() *AccessTokenQuery

QueryAccessTokens queries the "access_tokens" edge of the User entity.

func (*User) QueryCodes

func (u *User) QueryCodes() *CodeQuery

QueryCodes queries the "codes" edge of the User entity.

func (*User) QueryGroups

func (u *User) QueryGroups() *GroupQuery

QueryGroups queries the "groups" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (u *User) Update() *UserUpdateOne

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

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAccessTokens

func (c *UserClient) QueryAccessTokens(u *User) *AccessTokenQuery

QueryAccessTokens queries the access_tokens edge of a User.

func (*UserClient) QueryCodes

func (c *UserClient) QueryCodes(u *User) *CodeQuery

QueryCodes queries the codes edge of a User.

func (*UserClient) QueryGroups

func (c *UserClient) QueryGroups(u *User) *GroupQuery

QueryGroups queries the groups edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAccessTokenIDs

func (uc *UserCreate) AddAccessTokenIDs(ids ...uuid.UUID) *UserCreate

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*UserCreate) AddAccessTokens

func (uc *UserCreate) AddAccessTokens(a ...*AccessToken) *UserCreate

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*UserCreate) AddCodeIDs

func (uc *UserCreate) AddCodeIDs(ids ...uuid.UUID) *UserCreate

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*UserCreate) AddCodes

func (uc *UserCreate) AddCodes(c ...*Code) *UserCreate

AddCodes adds the "codes" edges to the Code entity.

func (*UserCreate) AddGroupIDs

func (uc *UserCreate) AddGroupIDs(ids ...uuid.UUID) *UserCreate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*UserCreate) AddGroups

func (uc *UserCreate) AddGroups(g ...*Group) *UserCreate

AddGroups adds the "groups" edges to the Group entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

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

client.User.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.UserUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

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

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

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

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

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) OnConflict

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

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

client.User.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.UserUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

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

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Groups holds the value of the groups edge.
	Groups []*Group `json:"groups,omitempty"`
	// Codes holds the value of the codes edge.
	Codes []*Code `json:"codes,omitempty"`
	// AccessTokens holds the value of the access_tokens edge.
	AccessTokens []*AccessToken `json:"access_tokens,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) AccessTokensOrErr

func (e UserEdges) AccessTokensOrErr() ([]*AccessToken, error)

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

func (UserEdges) CodesOrErr

func (e UserEdges) CodesOrErr() ([]*Code, error)

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

func (UserEdges) GroupsOrErr

func (e UserEdges) GroupsOrErr() ([]*Group, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AccessTokensCleared

func (m *UserMutation) AccessTokensCleared() bool

AccessTokensCleared reports if the "access_tokens" edge to the AccessToken entity was cleared.

func (*UserMutation) AccessTokensIDs

func (m *UserMutation) AccessTokensIDs() (ids []uuid.UUID)

AccessTokensIDs returns the "access_tokens" edge IDs in the mutation.

func (*UserMutation) AddAccessTokenIDs

func (m *UserMutation) AddAccessTokenIDs(ids ...uuid.UUID)

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by ids.

func (*UserMutation) AddCodeIDs

func (m *UserMutation) AddCodeIDs(ids ...uuid.UUID)

AddCodeIDs adds the "codes" edge to the Code entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) 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 (*UserMutation) AddGroupIDs

func (m *UserMutation) AddGroupIDs(ids ...uuid.UUID)

AddGroupIDs adds the "groups" edge to the Group entity by ids.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) ClearAccessTokens

func (m *UserMutation) ClearAccessTokens()

ClearAccessTokens clears the "access_tokens" edge to the AccessToken entity.

func (*UserMutation) ClearCodes

func (m *UserMutation) ClearCodes()

ClearCodes clears the "codes" edge to the Code entity.

func (*UserMutation) ClearEdge

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

func (m *UserMutation) 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 (*UserMutation) ClearGroups

func (m *UserMutation) ClearGroups()

ClearGroups clears the "groups" edge to the Group entity.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) 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 (*UserMutation) CodesCleared

func (m *UserMutation) CodesCleared() bool

CodesCleared reports if the "codes" edge to the Code entity was cleared.

func (*UserMutation) CodesIDs

func (m *UserMutation) CodesIDs() (ids []uuid.UUID)

CodesIDs returns the "codes" edge IDs in the mutation.

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

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

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

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

func (*UserMutation) Fields

func (m *UserMutation) 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 (*UserMutation) GroupsCleared

func (m *UserMutation) GroupsCleared() bool

GroupsCleared reports if the "groups" edge to the Group entity was cleared.

func (*UserMutation) GroupsIDs

func (m *UserMutation) GroupsIDs() (ids []uuid.UUID)

GroupsIDs returns the "groups" edge IDs in the mutation.

func (*UserMutation) ID

func (m *UserMutation) 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 (*UserMutation) IDs

func (m *UserMutation) 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 (*UserMutation) Name

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

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

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User 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 (*UserMutation) OldField

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

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

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

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveAccessTokenIDs

func (m *UserMutation) RemoveAccessTokenIDs(ids ...uuid.UUID)

RemoveAccessTokenIDs removes the "access_tokens" edge to the AccessToken entity by IDs.

func (*UserMutation) RemoveCodeIDs

func (m *UserMutation) RemoveCodeIDs(ids ...uuid.UUID)

RemoveCodeIDs removes the "codes" edge to the Code entity by IDs.

func (*UserMutation) RemoveGroupIDs

func (m *UserMutation) RemoveGroupIDs(ids ...uuid.UUID)

RemoveGroupIDs removes the "groups" edge to the Group entity by IDs.

func (*UserMutation) RemovedAccessTokensIDs

func (m *UserMutation) RemovedAccessTokensIDs() (ids []uuid.UUID)

RemovedAccessTokens returns the removed IDs of the "access_tokens" edge to the AccessToken entity.

func (*UserMutation) RemovedCodesIDs

func (m *UserMutation) RemovedCodesIDs() (ids []uuid.UUID)

RemovedCodes returns the removed IDs of the "codes" edge to the Code entity.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedGroupsIDs

func (m *UserMutation) RemovedGroupsIDs() (ids []uuid.UUID)

RemovedGroups returns the removed IDs of the "groups" edge to the Group entity.

func (*UserMutation) RemovedIDs

func (m *UserMutation) 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 (*UserMutation) ResetAccessTokens

func (m *UserMutation) ResetAccessTokens()

ResetAccessTokens resets all changes to the "access_tokens" edge.

func (*UserMutation) ResetCodes

func (m *UserMutation) ResetCodes()

ResetCodes resets all changes to the "codes" edge.

func (*UserMutation) ResetEdge

func (m *UserMutation) 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 (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) 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 (*UserMutation) ResetGroups

func (m *UserMutation) ResetGroups()

ResetGroups resets all changes to the "groups" edge.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

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

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

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

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

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

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAccessTokens

func (uq *UserQuery) QueryAccessTokens() *AccessTokenQuery

QueryAccessTokens chains the current query on the "access_tokens" edge.

func (*UserQuery) QueryCodes

func (uq *UserQuery) QueryCodes() *CodeQuery

QueryCodes chains the current query on the "codes" edge.

func (*UserQuery) QueryGroups

func (uq *UserQuery) QueryGroups() *GroupQuery

QueryGroups chains the current query on the "groups" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

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

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAccessTokens

func (uq *UserQuery) WithAccessTokens(opts ...func(*AccessTokenQuery)) *UserQuery

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

func (*UserQuery) WithCodes

func (uq *UserQuery) WithCodes(opts ...func(*CodeQuery)) *UserQuery

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

func (*UserQuery) WithGroups

func (uq *UserQuery) WithGroups(opts ...func(*GroupQuery)) *UserQuery

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

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAccessTokenIDs

func (uu *UserUpdate) AddAccessTokenIDs(ids ...uuid.UUID) *UserUpdate

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*UserUpdate) AddAccessTokens

func (uu *UserUpdate) AddAccessTokens(a ...*AccessToken) *UserUpdate

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*UserUpdate) AddCodeIDs

func (uu *UserUpdate) AddCodeIDs(ids ...uuid.UUID) *UserUpdate

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*UserUpdate) AddCodes

func (uu *UserUpdate) AddCodes(c ...*Code) *UserUpdate

AddCodes adds the "codes" edges to the Code entity.

func (*UserUpdate) AddGroupIDs

func (uu *UserUpdate) AddGroupIDs(ids ...uuid.UUID) *UserUpdate

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*UserUpdate) AddGroups

func (uu *UserUpdate) AddGroups(g ...*Group) *UserUpdate

AddGroups adds the "groups" edges to the Group entity.

func (*UserUpdate) ClearAccessTokens

func (uu *UserUpdate) ClearAccessTokens() *UserUpdate

ClearAccessTokens clears all "access_tokens" edges to the AccessToken entity.

func (*UserUpdate) ClearCodes

func (uu *UserUpdate) ClearCodes() *UserUpdate

ClearCodes clears all "codes" edges to the Code entity.

func (*UserUpdate) ClearGroups

func (uu *UserUpdate) ClearGroups() *UserUpdate

ClearGroups clears all "groups" edges to the Group entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAccessTokenIDs

func (uu *UserUpdate) RemoveAccessTokenIDs(ids ...uuid.UUID) *UserUpdate

RemoveAccessTokenIDs removes the "access_tokens" edge to AccessToken entities by IDs.

func (*UserUpdate) RemoveAccessTokens

func (uu *UserUpdate) RemoveAccessTokens(a ...*AccessToken) *UserUpdate

RemoveAccessTokens removes "access_tokens" edges to AccessToken entities.

func (*UserUpdate) RemoveCodeIDs

func (uu *UserUpdate) RemoveCodeIDs(ids ...uuid.UUID) *UserUpdate

RemoveCodeIDs removes the "codes" edge to Code entities by IDs.

func (*UserUpdate) RemoveCodes

func (uu *UserUpdate) RemoveCodes(c ...*Code) *UserUpdate

RemoveCodes removes "codes" edges to Code entities.

func (*UserUpdate) RemoveGroupIDs

func (uu *UserUpdate) RemoveGroupIDs(ids ...uuid.UUID) *UserUpdate

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*UserUpdate) RemoveGroups

func (uu *UserUpdate) RemoveGroups(g ...*Group) *UserUpdate

RemoveGroups removes "groups" edges to Group entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAccessTokenIDs

func (uuo *UserUpdateOne) AddAccessTokenIDs(ids ...uuid.UUID) *UserUpdateOne

AddAccessTokenIDs adds the "access_tokens" edge to the AccessToken entity by IDs.

func (*UserUpdateOne) AddAccessTokens

func (uuo *UserUpdateOne) AddAccessTokens(a ...*AccessToken) *UserUpdateOne

AddAccessTokens adds the "access_tokens" edges to the AccessToken entity.

func (*UserUpdateOne) AddCodeIDs

func (uuo *UserUpdateOne) AddCodeIDs(ids ...uuid.UUID) *UserUpdateOne

AddCodeIDs adds the "codes" edge to the Code entity by IDs.

func (*UserUpdateOne) AddCodes

func (uuo *UserUpdateOne) AddCodes(c ...*Code) *UserUpdateOne

AddCodes adds the "codes" edges to the Code entity.

func (*UserUpdateOne) AddGroupIDs

func (uuo *UserUpdateOne) AddGroupIDs(ids ...uuid.UUID) *UserUpdateOne

AddGroupIDs adds the "groups" edge to the Group entity by IDs.

func (*UserUpdateOne) AddGroups

func (uuo *UserUpdateOne) AddGroups(g ...*Group) *UserUpdateOne

AddGroups adds the "groups" edges to the Group entity.

func (*UserUpdateOne) ClearAccessTokens

func (uuo *UserUpdateOne) ClearAccessTokens() *UserUpdateOne

ClearAccessTokens clears all "access_tokens" edges to the AccessToken entity.

func (*UserUpdateOne) ClearCodes

func (uuo *UserUpdateOne) ClearCodes() *UserUpdateOne

ClearCodes clears all "codes" edges to the Code entity.

func (*UserUpdateOne) ClearGroups

func (uuo *UserUpdateOne) ClearGroups() *UserUpdateOne

ClearGroups clears all "groups" edges to the Group entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAccessTokenIDs

func (uuo *UserUpdateOne) RemoveAccessTokenIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveAccessTokenIDs removes the "access_tokens" edge to AccessToken entities by IDs.

func (*UserUpdateOne) RemoveAccessTokens

func (uuo *UserUpdateOne) RemoveAccessTokens(a ...*AccessToken) *UserUpdateOne

RemoveAccessTokens removes "access_tokens" edges to AccessToken entities.

func (*UserUpdateOne) RemoveCodeIDs

func (uuo *UserUpdateOne) RemoveCodeIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveCodeIDs removes the "codes" edge to Code entities by IDs.

func (*UserUpdateOne) RemoveCodes

func (uuo *UserUpdateOne) RemoveCodes(c ...*Code) *UserUpdateOne

RemoveCodes removes "codes" edges to Code entities.

func (*UserUpdateOne) RemoveGroupIDs

func (uuo *UserUpdateOne) RemoveGroupIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveGroupIDs removes the "groups" edge to Group entities by IDs.

func (*UserUpdateOne) RemoveGroups

func (uuo *UserUpdateOne) RemoveGroups(g ...*Group) *UserUpdateOne

RemoveGroups removes "groups" edges to Group entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) SetEmail

func (u *UserUpsert) SetEmail(v string) *UserUpsert

SetEmail sets the "email" field.

func (*UserUpsert) SetName

func (u *UserUpsert) SetName(v string) *UserUpsert

SetName sets the "name" field.

func (*UserUpsert) UpdateEmail

func (u *UserUpsert) UpdateEmail() *UserUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsert) UpdateName

func (u *UserUpsert) UpdateName() *UserUpsert

UpdateName sets the "name" field to the value that was provided on create.

type UserUpsertBulk

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX

func (u *UserUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetEmail

func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk

SetEmail sets the "email" field.

func (*UserUpsertBulk) SetName

func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk

SetName sets the "name" field.

func (*UserUpsertBulk) Update

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateEmail

func (u *UserUpsertBulk) UpdateEmail() *UserUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateName

func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

type UserUpsertOne

type UserUpsertOne struct {
	// contains filtered or unexported fields
}

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX

func (u *UserUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertOne) ID

func (u *UserUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) uuid.UUID

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetEmail

func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne

SetEmail sets the "email" field.

func (*UserUpsertOne) SetName

func (u *UserUpsertOne) SetName(v string) *UserUpsertOne

SetName sets the "name" field.

func (*UserUpsertOne) Update

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateEmail

func (u *UserUpsertOne) UpdateEmail() *UserUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertOne) UpdateName

func (u *UserUpsertOne) UpdateName() *UserUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

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.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

type Users

type Users []*User

Users is a parsable slice of User.

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