ent

package
v0.0.0-...-2db6053 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: BSD-3-Clause Imports: 25 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.
	TypeAccessControl = "AccessControl"
	TypeAudit         = "Audit"
	TypeRole          = "Role"
	TypeTodo          = "Todo"
	TypeUser          = "User"
	TypeUserSession   = "UserSession"
	TypeVerifyToken   = "VerifyToken"
)

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 AccessControl

type AccessControl struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updatedAt"`
	// Ptype holds the value of the "ptype" field.
	Ptype string `json:"ptype,omitempty"`
	// V0 holds the value of the "v0" field.
	V0 string `json:"v0,omitempty"`
	// V1 holds the value of the "v1" field.
	V1 string `json:"v1,omitempty"`
	// V2 holds the value of the "v2" field.
	V2 string `json:"v2,omitempty"`
	// V3 holds the value of the "v3" field.
	V3 string `json:"v3,omitempty"`
	// V4 holds the value of the "v4" field.
	V4 string `json:"v4,omitempty"`
	// V5 holds the value of the "v5" field.
	V5 string `json:"v5,omitempty"`
	// contains filtered or unexported fields
}

AccessControl is the model entity for the AccessControl schema.

func (*AccessControl) String

func (ac *AccessControl) String() string

String implements the fmt.Stringer.

func (*AccessControl) Unwrap

func (ac *AccessControl) Unwrap() *AccessControl

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

func (ac *AccessControl) Update() *AccessControlUpdateOne

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

func (*AccessControl) Value

func (ac *AccessControl) Value(name string) (ent.Value, error)

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

type AccessControlClient

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

AccessControlClient is a client for the AccessControl schema.

func NewAccessControlClient

func NewAccessControlClient(c config) *AccessControlClient

NewAccessControlClient returns a client for the AccessControl from the given config.

func (*AccessControlClient) Create

Create returns a builder for creating a AccessControl entity.

func (*AccessControlClient) CreateBulk

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

func (*AccessControlClient) Delete

Delete returns a delete builder for AccessControl.

func (*AccessControlClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccessControlClient) DeleteOneID

func (c *AccessControlClient) DeleteOneID(id int64) *AccessControlDeleteOne

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

func (*AccessControlClient) Get

Get returns a AccessControl entity by its id.

func (*AccessControlClient) GetX

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

func (*AccessControlClient) Hooks

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

Hooks returns the client hooks.

func (*AccessControlClient) Intercept

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

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

func (*AccessControlClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AccessControlClient) MapCreateBulk

func (c *AccessControlClient) MapCreateBulk(slice any, setFunc func(*AccessControlCreate, int)) *AccessControlCreateBulk

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

Query returns a query builder for AccessControl.

func (*AccessControlClient) Update

Update returns an update builder for AccessControl.

func (*AccessControlClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccessControlClient) UpdateOneID

func (c *AccessControlClient) UpdateOneID(id int64) *AccessControlUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccessControlClient) Use

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

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

type AccessControlCreate

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

AccessControlCreate is the builder for creating a AccessControl entity.

func (*AccessControlCreate) Exec

func (acc *AccessControlCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessControlCreate) ExecX

func (acc *AccessControlCreate) ExecX(ctx context.Context)

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

func (*AccessControlCreate) Mutation

func (acc *AccessControlCreate) Mutation() *AccessControlMutation

Mutation returns the AccessControlMutation object of the builder.

func (*AccessControlCreate) Save

Save creates the AccessControl in the database.

func (*AccessControlCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*AccessControlCreate) SetCreatedAt

func (acc *AccessControlCreate) SetCreatedAt(t time.Time) *AccessControlCreate

SetCreatedAt sets the "created_at" field.

func (*AccessControlCreate) SetID

SetID sets the "id" field.

func (*AccessControlCreate) SetNillableCreatedAt

func (acc *AccessControlCreate) SetNillableCreatedAt(t *time.Time) *AccessControlCreate

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

func (*AccessControlCreate) SetNillablePtype

func (acc *AccessControlCreate) SetNillablePtype(s *string) *AccessControlCreate

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*AccessControlCreate) SetNillableUpdatedAt

func (acc *AccessControlCreate) SetNillableUpdatedAt(t *time.Time) *AccessControlCreate

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

func (*AccessControlCreate) SetNillableV0

func (acc *AccessControlCreate) SetNillableV0(s *string) *AccessControlCreate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*AccessControlCreate) SetNillableV1

func (acc *AccessControlCreate) SetNillableV1(s *string) *AccessControlCreate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*AccessControlCreate) SetNillableV2

func (acc *AccessControlCreate) SetNillableV2(s *string) *AccessControlCreate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*AccessControlCreate) SetNillableV3

func (acc *AccessControlCreate) SetNillableV3(s *string) *AccessControlCreate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*AccessControlCreate) SetNillableV4

func (acc *AccessControlCreate) SetNillableV4(s *string) *AccessControlCreate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*AccessControlCreate) SetNillableV5

func (acc *AccessControlCreate) SetNillableV5(s *string) *AccessControlCreate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*AccessControlCreate) SetPtype

SetPtype sets the "ptype" field.

func (*AccessControlCreate) SetUpdatedAt

func (acc *AccessControlCreate) SetUpdatedAt(t time.Time) *AccessControlCreate

SetUpdatedAt sets the "updated_at" field.

func (*AccessControlCreate) SetV0

SetV0 sets the "v0" field.

func (*AccessControlCreate) SetV1

SetV1 sets the "v1" field.

func (*AccessControlCreate) SetV2

SetV2 sets the "v2" field.

func (*AccessControlCreate) SetV3

SetV3 sets the "v3" field.

func (*AccessControlCreate) SetV4

SetV4 sets the "v4" field.

func (*AccessControlCreate) SetV5

SetV5 sets the "v5" field.

type AccessControlCreateBulk

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

AccessControlCreateBulk is the builder for creating many AccessControl entities in bulk.

func (*AccessControlCreateBulk) Exec

func (accb *AccessControlCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessControlCreateBulk) ExecX

func (accb *AccessControlCreateBulk) ExecX(ctx context.Context)

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

func (*AccessControlCreateBulk) Save

Save creates the AccessControl entities in the database.

func (*AccessControlCreateBulk) SaveX

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

type AccessControlDelete

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

AccessControlDelete is the builder for deleting a AccessControl entity.

func (*AccessControlDelete) Exec

func (acd *AccessControlDelete) Exec(ctx context.Context) (int, error)

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

func (*AccessControlDelete) ExecX

func (acd *AccessControlDelete) ExecX(ctx context.Context) int

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

func (*AccessControlDelete) Where

Where appends a list predicates to the AccessControlDelete builder.

type AccessControlDeleteOne

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

AccessControlDeleteOne is the builder for deleting a single AccessControl entity.

func (*AccessControlDeleteOne) Exec

func (acdo *AccessControlDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccessControlDeleteOne) ExecX

func (acdo *AccessControlDeleteOne) ExecX(ctx context.Context)

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

func (*AccessControlDeleteOne) Where

Where appends a list predicates to the AccessControlDelete builder.

type AccessControlGroupBy

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

AccessControlGroupBy is the group-by builder for AccessControl entities.

func (*AccessControlGroupBy) Aggregate

func (acgb *AccessControlGroupBy) Aggregate(fns ...AggregateFunc) *AccessControlGroupBy

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

func (*AccessControlGroupBy) Bool

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

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

func (*AccessControlGroupBy) BoolX

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

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

func (*AccessControlGroupBy) Bools

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

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

func (*AccessControlGroupBy) BoolsX

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

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

func (*AccessControlGroupBy) Float64

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

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

func (*AccessControlGroupBy) Float64X

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

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

func (*AccessControlGroupBy) Float64s

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

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

func (*AccessControlGroupBy) Float64sX

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

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

func (*AccessControlGroupBy) Int

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

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

func (*AccessControlGroupBy) IntX

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

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

func (*AccessControlGroupBy) Ints

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

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

func (*AccessControlGroupBy) IntsX

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

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

func (*AccessControlGroupBy) Scan

func (acgb *AccessControlGroupBy) Scan(ctx context.Context, v any) error

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

func (*AccessControlGroupBy) ScanX

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

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

func (*AccessControlGroupBy) String

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

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

func (*AccessControlGroupBy) StringX

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

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

func (*AccessControlGroupBy) Strings

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

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

func (*AccessControlGroupBy) StringsX

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

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

type AccessControlMutation

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

AccessControlMutation represents an operation that mutates the AccessControl nodes in the graph.

func (*AccessControlMutation) AddField

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

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

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

func (*AccessControlMutation) AddedField

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

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

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

func (*AccessControlMutation) AddedIDs

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

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

func (*AccessControlMutation) ClearEdge

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

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

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

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

func (*AccessControlMutation) ClearedFields

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

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

func (AccessControlMutation) Client

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

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

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

func (*AccessControlMutation) EdgeCleared

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

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

func (*AccessControlMutation) Field

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

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

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

func (*AccessControlMutation) Fields

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

func (m *AccessControlMutation) ID() (id int64, 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 (*AccessControlMutation) IDs

func (m *AccessControlMutation) IDs(ctx context.Context) ([]int64, 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 (*AccessControlMutation) OldCreatedAt

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

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

func (m *AccessControlMutation) 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 (*AccessControlMutation) OldPtype

func (m *AccessControlMutation) OldPtype(ctx context.Context) (v string, err error)

OldPtype returns the old "ptype" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldUpdatedAt

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

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

func (m *AccessControlMutation) OldV0(ctx context.Context) (v string, err error)

OldV0 returns the old "v0" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldV1

func (m *AccessControlMutation) OldV1(ctx context.Context) (v string, err error)

OldV1 returns the old "v1" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldV2

func (m *AccessControlMutation) OldV2(ctx context.Context) (v string, err error)

OldV2 returns the old "v2" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldV3

func (m *AccessControlMutation) OldV3(ctx context.Context) (v string, err error)

OldV3 returns the old "v3" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldV4

func (m *AccessControlMutation) OldV4(ctx context.Context) (v string, err error)

OldV4 returns the old "v4" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) OldV5

func (m *AccessControlMutation) OldV5(ctx context.Context) (v string, err error)

OldV5 returns the old "v5" field's value of the AccessControl entity. If the AccessControl 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 (*AccessControlMutation) Op

func (m *AccessControlMutation) Op() Op

Op returns the operation name.

func (*AccessControlMutation) Ptype

func (m *AccessControlMutation) Ptype() (r string, exists bool)

Ptype returns the value of the "ptype" field in the mutation.

func (*AccessControlMutation) RemovedEdges

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

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

func (*AccessControlMutation) RemovedIDs

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

func (m *AccessControlMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AccessControlMutation) ResetEdge

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

func (m *AccessControlMutation) 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 (*AccessControlMutation) ResetPtype

func (m *AccessControlMutation) ResetPtype()

ResetPtype resets all changes to the "ptype" field.

func (*AccessControlMutation) ResetUpdatedAt

func (m *AccessControlMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AccessControlMutation) ResetV0

func (m *AccessControlMutation) ResetV0()

ResetV0 resets all changes to the "v0" field.

func (*AccessControlMutation) ResetV1

func (m *AccessControlMutation) ResetV1()

ResetV1 resets all changes to the "v1" field.

func (*AccessControlMutation) ResetV2

func (m *AccessControlMutation) ResetV2()

ResetV2 resets all changes to the "v2" field.

func (*AccessControlMutation) ResetV3

func (m *AccessControlMutation) ResetV3()

ResetV3 resets all changes to the "v3" field.

func (*AccessControlMutation) ResetV4

func (m *AccessControlMutation) ResetV4()

ResetV4 resets all changes to the "v4" field.

func (*AccessControlMutation) ResetV5

func (m *AccessControlMutation) ResetV5()

ResetV5 resets all changes to the "v5" field.

func (*AccessControlMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AccessControlMutation) SetField

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

func (m *AccessControlMutation) SetID(id int64)

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

func (*AccessControlMutation) SetOp

func (m *AccessControlMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AccessControlMutation) SetPtype

func (m *AccessControlMutation) SetPtype(s string)

SetPtype sets the "ptype" field.

func (*AccessControlMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AccessControlMutation) SetV0

func (m *AccessControlMutation) SetV0(s string)

SetV0 sets the "v0" field.

func (*AccessControlMutation) SetV1

func (m *AccessControlMutation) SetV1(s string)

SetV1 sets the "v1" field.

func (*AccessControlMutation) SetV2

func (m *AccessControlMutation) SetV2(s string)

SetV2 sets the "v2" field.

func (*AccessControlMutation) SetV3

func (m *AccessControlMutation) SetV3(s string)

SetV3 sets the "v3" field.

func (*AccessControlMutation) SetV4

func (m *AccessControlMutation) SetV4(s string)

SetV4 sets the "v4" field.

func (*AccessControlMutation) SetV5

func (m *AccessControlMutation) SetV5(s string)

SetV5 sets the "v5" field.

func (AccessControlMutation) Tx

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

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

func (*AccessControlMutation) Type

func (m *AccessControlMutation) Type() string

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

func (*AccessControlMutation) UpdatedAt

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

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

func (*AccessControlMutation) V0

func (m *AccessControlMutation) V0() (r string, exists bool)

V0 returns the value of the "v0" field in the mutation.

func (*AccessControlMutation) V1

func (m *AccessControlMutation) V1() (r string, exists bool)

V1 returns the value of the "v1" field in the mutation.

func (*AccessControlMutation) V2

func (m *AccessControlMutation) V2() (r string, exists bool)

V2 returns the value of the "v2" field in the mutation.

func (*AccessControlMutation) V3

func (m *AccessControlMutation) V3() (r string, exists bool)

V3 returns the value of the "v3" field in the mutation.

func (*AccessControlMutation) V4

func (m *AccessControlMutation) V4() (r string, exists bool)

V4 returns the value of the "v4" field in the mutation.

func (*AccessControlMutation) V5

func (m *AccessControlMutation) V5() (r string, exists bool)

V5 returns the value of the "v5" field in the mutation.

func (*AccessControlMutation) Where

Where appends a list predicates to the AccessControlMutation builder.

func (*AccessControlMutation) WhereP

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

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

type AccessControlQuery

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

AccessControlQuery is the builder for querying AccessControl entities.

func (*AccessControlQuery) Aggregate

func (acq *AccessControlQuery) Aggregate(fns ...AggregateFunc) *AccessControlSelect

Aggregate returns a AccessControlSelect configured with the given aggregations.

func (*AccessControlQuery) All

All executes the query and returns a list of AccessControls.

func (*AccessControlQuery) AllX

func (acq *AccessControlQuery) AllX(ctx context.Context) []*AccessControl

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

func (*AccessControlQuery) Clone

func (acq *AccessControlQuery) Clone() *AccessControlQuery

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

func (*AccessControlQuery) Count

func (acq *AccessControlQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccessControlQuery) CountX

func (acq *AccessControlQuery) CountX(ctx context.Context) int

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

func (*AccessControlQuery) Exist

func (acq *AccessControlQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccessControlQuery) ExistX

func (acq *AccessControlQuery) ExistX(ctx context.Context) bool

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

func (*AccessControlQuery) First

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

func (*AccessControlQuery) FirstID

func (acq *AccessControlQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*AccessControlQuery) FirstIDX

func (acq *AccessControlQuery) FirstIDX(ctx context.Context) int64

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

func (*AccessControlQuery) FirstX

func (acq *AccessControlQuery) FirstX(ctx context.Context) *AccessControl

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

func (*AccessControlQuery) GroupBy

func (acq *AccessControlQuery) GroupBy(field string, fields ...string) *AccessControlGroupBy

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

Example:

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

client.AccessControl.Query().
	GroupBy(accesscontrol.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccessControlQuery) IDs

func (acq *AccessControlQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*AccessControlQuery) IDsX

func (acq *AccessControlQuery) IDsX(ctx context.Context) []int64

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

func (*AccessControlQuery) Limit

func (acq *AccessControlQuery) Limit(limit int) *AccessControlQuery

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

func (*AccessControlQuery) Offset

func (acq *AccessControlQuery) Offset(offset int) *AccessControlQuery

Offset to start from.

func (*AccessControlQuery) Only

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

func (*AccessControlQuery) OnlyID

func (acq *AccessControlQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*AccessControlQuery) OnlyIDX

func (acq *AccessControlQuery) OnlyIDX(ctx context.Context) int64

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

func (*AccessControlQuery) OnlyX

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

func (*AccessControlQuery) Order

Order specifies how the records should be ordered.

func (*AccessControlQuery) Select

func (acq *AccessControlQuery) Select(fields ...string) *AccessControlSelect

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

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt"`
}

client.AccessControl.Query().
	Select(accesscontrol.FieldCreatedAt).
	Scan(ctx, &v)

func (*AccessControlQuery) Unique

func (acq *AccessControlQuery) Unique(unique bool) *AccessControlQuery

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

Where adds a new predicate for the AccessControlQuery builder.

type AccessControlSelect

type AccessControlSelect struct {
	*AccessControlQuery
	// contains filtered or unexported fields
}

AccessControlSelect is the builder for selecting fields of AccessControl entities.

func (*AccessControlSelect) Aggregate

func (acs *AccessControlSelect) Aggregate(fns ...AggregateFunc) *AccessControlSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AccessControlSelect) Bool

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

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

func (*AccessControlSelect) BoolX

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

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

func (*AccessControlSelect) Bools

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

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

func (*AccessControlSelect) BoolsX

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

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

func (*AccessControlSelect) Float64

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

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

func (*AccessControlSelect) Float64X

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

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

func (*AccessControlSelect) Float64s

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

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

func (*AccessControlSelect) Float64sX

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

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

func (*AccessControlSelect) Int

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

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

func (*AccessControlSelect) IntX

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

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

func (*AccessControlSelect) Ints

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

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

func (*AccessControlSelect) IntsX

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

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

func (*AccessControlSelect) Scan

func (acs *AccessControlSelect) Scan(ctx context.Context, v any) error

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

func (*AccessControlSelect) ScanX

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

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

func (*AccessControlSelect) String

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

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

func (*AccessControlSelect) StringX

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

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

func (*AccessControlSelect) Strings

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

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

func (*AccessControlSelect) StringsX

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

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

type AccessControlUpdate

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

AccessControlUpdate is the builder for updating AccessControl entities.

func (*AccessControlUpdate) Exec

func (acu *AccessControlUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessControlUpdate) ExecX

func (acu *AccessControlUpdate) ExecX(ctx context.Context)

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

func (*AccessControlUpdate) Mutation

func (acu *AccessControlUpdate) Mutation() *AccessControlMutation

Mutation returns the AccessControlMutation object of the builder.

func (*AccessControlUpdate) Save

func (acu *AccessControlUpdate) Save(ctx context.Context) (int, error)

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

func (*AccessControlUpdate) SaveX

func (acu *AccessControlUpdate) SaveX(ctx context.Context) int

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

func (*AccessControlUpdate) SetNillablePtype

func (acu *AccessControlUpdate) SetNillablePtype(s *string) *AccessControlUpdate

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV0

func (acu *AccessControlUpdate) SetNillableV0(s *string) *AccessControlUpdate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV1

func (acu *AccessControlUpdate) SetNillableV1(s *string) *AccessControlUpdate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV2

func (acu *AccessControlUpdate) SetNillableV2(s *string) *AccessControlUpdate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV3

func (acu *AccessControlUpdate) SetNillableV3(s *string) *AccessControlUpdate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV4

func (acu *AccessControlUpdate) SetNillableV4(s *string) *AccessControlUpdate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*AccessControlUpdate) SetNillableV5

func (acu *AccessControlUpdate) SetNillableV5(s *string) *AccessControlUpdate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*AccessControlUpdate) SetPtype

SetPtype sets the "ptype" field.

func (*AccessControlUpdate) SetUpdatedAt

func (acu *AccessControlUpdate) SetUpdatedAt(t time.Time) *AccessControlUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AccessControlUpdate) SetV0

SetV0 sets the "v0" field.

func (*AccessControlUpdate) SetV1

SetV1 sets the "v1" field.

func (*AccessControlUpdate) SetV2

SetV2 sets the "v2" field.

func (*AccessControlUpdate) SetV3

SetV3 sets the "v3" field.

func (*AccessControlUpdate) SetV4

SetV4 sets the "v4" field.

func (*AccessControlUpdate) SetV5

SetV5 sets the "v5" field.

func (*AccessControlUpdate) Where

Where appends a list predicates to the AccessControlUpdate builder.

type AccessControlUpdateOne

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

AccessControlUpdateOne is the builder for updating a single AccessControl entity.

func (*AccessControlUpdateOne) Exec

func (acuo *AccessControlUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccessControlUpdateOne) ExecX

func (acuo *AccessControlUpdateOne) ExecX(ctx context.Context)

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

func (*AccessControlUpdateOne) Mutation

Mutation returns the AccessControlMutation object of the builder.

func (*AccessControlUpdateOne) Save

Save executes the query and returns the updated AccessControl entity.

func (*AccessControlUpdateOne) SaveX

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

func (*AccessControlUpdateOne) Select

func (acuo *AccessControlUpdateOne) Select(field string, fields ...string) *AccessControlUpdateOne

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

func (*AccessControlUpdateOne) SetNillablePtype

func (acuo *AccessControlUpdateOne) SetNillablePtype(s *string) *AccessControlUpdateOne

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV0

func (acuo *AccessControlUpdateOne) SetNillableV0(s *string) *AccessControlUpdateOne

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV1

func (acuo *AccessControlUpdateOne) SetNillableV1(s *string) *AccessControlUpdateOne

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV2

func (acuo *AccessControlUpdateOne) SetNillableV2(s *string) *AccessControlUpdateOne

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV3

func (acuo *AccessControlUpdateOne) SetNillableV3(s *string) *AccessControlUpdateOne

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV4

func (acuo *AccessControlUpdateOne) SetNillableV4(s *string) *AccessControlUpdateOne

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*AccessControlUpdateOne) SetNillableV5

func (acuo *AccessControlUpdateOne) SetNillableV5(s *string) *AccessControlUpdateOne

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*AccessControlUpdateOne) SetPtype

SetPtype sets the "ptype" field.

func (*AccessControlUpdateOne) SetUpdatedAt

func (acuo *AccessControlUpdateOne) SetUpdatedAt(t time.Time) *AccessControlUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AccessControlUpdateOne) SetV0

SetV0 sets the "v0" field.

func (*AccessControlUpdateOne) SetV1

SetV1 sets the "v1" field.

func (*AccessControlUpdateOne) SetV2

SetV2 sets the "v2" field.

func (*AccessControlUpdateOne) SetV3

SetV3 sets the "v3" field.

func (*AccessControlUpdateOne) SetV4

SetV4 sets the "v4" field.

func (*AccessControlUpdateOne) SetV5

SetV5 sets the "v5" field.

func (*AccessControlUpdateOne) Where

Where appends a list predicates to the AccessControlUpdate builder.

type AccessControls

type AccessControls []*AccessControl

AccessControls is a parsable slice of AccessControl.

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 Audit

type Audit struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt"`
	// EntName holds the value of the "ent_name" field.
	EntName string `json:"ent_name,omitempty"`
	// EntID holds the value of the "ent_id" field.
	EntID int64 `json:"ent_id,omitempty"`
	// Operation holds the value of the "operation" field.
	Operation audit.Operation `json:"operation,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// IP holds the value of the "ip" field.
	IP string `json:"ip,omitempty"`
	// UserName holds the value of the "user_name" field.
	UserName string `json:"user_name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuditQuery when eager-loading is set.
	Edges AuditEdges `json:"edges"`
	// contains filtered or unexported fields
}

Audit is the model entity for the Audit schema.

func (*Audit) QueryUser

func (a *Audit) QueryUser() *UserQuery

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

func (*Audit) String

func (a *Audit) String() string

String implements the fmt.Stringer.

func (*Audit) Unwrap

func (a *Audit) Unwrap() *Audit

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

func (a *Audit) Update() *AuditUpdateOne

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

func (*Audit) Value

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

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

type AuditClient

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

AuditClient is a client for the Audit schema.

func NewAuditClient

func NewAuditClient(c config) *AuditClient

NewAuditClient returns a client for the Audit from the given config.

func (*AuditClient) Create

func (c *AuditClient) Create() *AuditCreate

Create returns a builder for creating a Audit entity.

func (*AuditClient) CreateBulk

func (c *AuditClient) CreateBulk(builders ...*AuditCreate) *AuditCreateBulk

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

func (*AuditClient) Delete

func (c *AuditClient) Delete() *AuditDelete

Delete returns a delete builder for Audit.

func (*AuditClient) DeleteOne

func (c *AuditClient) DeleteOne(a *Audit) *AuditDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AuditClient) DeleteOneID

func (c *AuditClient) DeleteOneID(id int64) *AuditDeleteOne

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

func (*AuditClient) Get

func (c *AuditClient) Get(ctx context.Context, id int64) (*Audit, error)

Get returns a Audit entity by its id.

func (*AuditClient) GetX

func (c *AuditClient) GetX(ctx context.Context, id int64) *Audit

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

func (*AuditClient) Hooks

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

Hooks returns the client hooks.

func (*AuditClient) Intercept

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

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

func (*AuditClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AuditClient) MapCreateBulk

func (c *AuditClient) MapCreateBulk(slice any, setFunc func(*AuditCreate, int)) *AuditCreateBulk

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

func (c *AuditClient) Query() *AuditQuery

Query returns a query builder for Audit.

func (*AuditClient) QueryUser

func (c *AuditClient) QueryUser(a *Audit) *UserQuery

QueryUser queries the user edge of a Audit.

func (*AuditClient) Update

func (c *AuditClient) Update() *AuditUpdate

Update returns an update builder for Audit.

func (*AuditClient) UpdateOne

func (c *AuditClient) UpdateOne(a *Audit) *AuditUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuditClient) UpdateOneID

func (c *AuditClient) UpdateOneID(id int64) *AuditUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuditClient) Use

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

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

type AuditCreate

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

AuditCreate is the builder for creating a Audit entity.

func (*AuditCreate) Exec

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

Exec executes the query.

func (*AuditCreate) ExecX

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

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

func (*AuditCreate) Mutation

func (ac *AuditCreate) Mutation() *AuditMutation

Mutation returns the AuditMutation object of the builder.

func (*AuditCreate) Save

func (ac *AuditCreate) Save(ctx context.Context) (*Audit, error)

Save creates the Audit in the database.

func (*AuditCreate) SaveX

func (ac *AuditCreate) SaveX(ctx context.Context) *Audit

SaveX calls Save and panics if Save returns an error.

func (*AuditCreate) SetCreatedAt

func (ac *AuditCreate) SetCreatedAt(t time.Time) *AuditCreate

SetCreatedAt sets the "created_at" field.

func (*AuditCreate) SetDescription

func (ac *AuditCreate) SetDescription(s string) *AuditCreate

SetDescription sets the "description" field.

func (*AuditCreate) SetEntID

func (ac *AuditCreate) SetEntID(i int64) *AuditCreate

SetEntID sets the "ent_id" field.

func (*AuditCreate) SetEntName

func (ac *AuditCreate) SetEntName(s string) *AuditCreate

SetEntName sets the "ent_name" field.

func (*AuditCreate) SetID

func (ac *AuditCreate) SetID(i int64) *AuditCreate

SetID sets the "id" field.

func (*AuditCreate) SetIP

func (ac *AuditCreate) SetIP(s string) *AuditCreate

SetIP sets the "ip" field.

func (*AuditCreate) SetNillableCreatedAt

func (ac *AuditCreate) SetNillableCreatedAt(t *time.Time) *AuditCreate

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

func (*AuditCreate) SetNillableIP

func (ac *AuditCreate) SetNillableIP(s *string) *AuditCreate

SetNillableIP sets the "ip" field if the given value is not nil.

func (*AuditCreate) SetNillableUserID

func (ac *AuditCreate) SetNillableUserID(id *int64) *AuditCreate

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

func (*AuditCreate) SetNillableUserName

func (ac *AuditCreate) SetNillableUserName(s *string) *AuditCreate

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*AuditCreate) SetOperation

func (ac *AuditCreate) SetOperation(a audit.Operation) *AuditCreate

SetOperation sets the "operation" field.

func (*AuditCreate) SetUser

func (ac *AuditCreate) SetUser(u *User) *AuditCreate

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

func (*AuditCreate) SetUserID

func (ac *AuditCreate) SetUserID(id int64) *AuditCreate

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

func (*AuditCreate) SetUserName

func (ac *AuditCreate) SetUserName(s string) *AuditCreate

SetUserName sets the "user_name" field.

type AuditCreateBulk

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

AuditCreateBulk is the builder for creating many Audit entities in bulk.

func (*AuditCreateBulk) Exec

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

Exec executes the query.

func (*AuditCreateBulk) ExecX

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

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

func (*AuditCreateBulk) Save

func (acb *AuditCreateBulk) Save(ctx context.Context) ([]*Audit, error)

Save creates the Audit entities in the database.

func (*AuditCreateBulk) SaveX

func (acb *AuditCreateBulk) SaveX(ctx context.Context) []*Audit

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

type AuditDelete

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

AuditDelete is the builder for deleting a Audit entity.

func (*AuditDelete) Exec

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

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

func (*AuditDelete) ExecX

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

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

func (*AuditDelete) Where

func (ad *AuditDelete) Where(ps ...predicate.Audit) *AuditDelete

Where appends a list predicates to the AuditDelete builder.

type AuditDeleteOne

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

AuditDeleteOne is the builder for deleting a single Audit entity.

func (*AuditDeleteOne) Exec

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

Exec executes the deletion query.

func (*AuditDeleteOne) ExecX

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

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

func (*AuditDeleteOne) Where

func (ado *AuditDeleteOne) Where(ps ...predicate.Audit) *AuditDeleteOne

Where appends a list predicates to the AuditDelete builder.

type AuditEdges

type AuditEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (AuditEdges) UserOrErr

func (e AuditEdges) 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 AuditGroupBy

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

AuditGroupBy is the group-by builder for Audit entities.

func (*AuditGroupBy) Aggregate

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

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

func (*AuditGroupBy) Bool

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

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

func (*AuditGroupBy) BoolX

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

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

func (*AuditGroupBy) Bools

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

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

func (*AuditGroupBy) BoolsX

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

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

func (*AuditGroupBy) Float64

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

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

func (*AuditGroupBy) Float64X

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

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

func (*AuditGroupBy) Float64s

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

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

func (*AuditGroupBy) Float64sX

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

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

func (*AuditGroupBy) Int

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

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

func (*AuditGroupBy) IntX

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

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

func (*AuditGroupBy) Ints

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

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

func (*AuditGroupBy) IntsX

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

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

func (*AuditGroupBy) Scan

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

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

func (*AuditGroupBy) ScanX

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

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

func (*AuditGroupBy) String

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

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

func (*AuditGroupBy) StringX

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

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

func (*AuditGroupBy) Strings

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

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

func (*AuditGroupBy) StringsX

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

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

type AuditMutation

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

AuditMutation represents an operation that mutates the Audit nodes in the graph.

func (*AuditMutation) AddEntID

func (m *AuditMutation) AddEntID(i int64)

AddEntID adds i to the "ent_id" field.

func (*AuditMutation) AddField

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

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

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

func (*AuditMutation) AddedEntID

func (m *AuditMutation) AddedEntID() (r int64, exists bool)

AddedEntID returns the value that was added to the "ent_id" field in this mutation.

func (*AuditMutation) AddedField

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

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

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

func (*AuditMutation) AddedIDs

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

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

func (*AuditMutation) ClearEdge

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

func (m *AuditMutation) 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 (*AuditMutation) ClearIP

func (m *AuditMutation) ClearIP()

ClearIP clears the value of the "ip" field.

func (*AuditMutation) ClearUser

func (m *AuditMutation) ClearUser()

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

func (*AuditMutation) ClearUserName

func (m *AuditMutation) ClearUserName()

ClearUserName clears the value of the "user_name" field.

func (*AuditMutation) ClearedEdges

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

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

func (*AuditMutation) ClearedFields

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

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

func (AuditMutation) Client

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

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

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

func (*AuditMutation) Description

func (m *AuditMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*AuditMutation) EdgeCleared

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

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

func (*AuditMutation) EntID

func (m *AuditMutation) EntID() (r int64, exists bool)

EntID returns the value of the "ent_id" field in the mutation.

func (*AuditMutation) EntName

func (m *AuditMutation) EntName() (r string, exists bool)

EntName returns the value of the "ent_name" field in the mutation.

func (*AuditMutation) Field

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

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

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

func (*AuditMutation) Fields

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

func (m *AuditMutation) ID() (id int64, 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 (*AuditMutation) IDs

func (m *AuditMutation) IDs(ctx context.Context) ([]int64, 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 (*AuditMutation) IP

func (m *AuditMutation) IP() (r string, exists bool)

IP returns the value of the "ip" field in the mutation.

func (*AuditMutation) IPCleared

func (m *AuditMutation) IPCleared() bool

IPCleared returns if the "ip" field was cleared in this mutation.

func (*AuditMutation) OldCreatedAt

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

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

func (m *AuditMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Audit entity. If the Audit 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 (*AuditMutation) OldEntID

func (m *AuditMutation) OldEntID(ctx context.Context) (v int64, err error)

OldEntID returns the old "ent_id" field's value of the Audit entity. If the Audit 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 (*AuditMutation) OldEntName

func (m *AuditMutation) OldEntName(ctx context.Context) (v string, err error)

OldEntName returns the old "ent_name" field's value of the Audit entity. If the Audit 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 (*AuditMutation) OldField

func (m *AuditMutation) 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 (*AuditMutation) OldIP

func (m *AuditMutation) OldIP(ctx context.Context) (v string, err error)

OldIP returns the old "ip" field's value of the Audit entity. If the Audit 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 (*AuditMutation) OldOperation

func (m *AuditMutation) OldOperation(ctx context.Context) (v audit.Operation, err error)

OldOperation returns the old "operation" field's value of the Audit entity. If the Audit 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 (*AuditMutation) OldUserName

func (m *AuditMutation) OldUserName(ctx context.Context) (v string, err error)

OldUserName returns the old "user_name" field's value of the Audit entity. If the Audit 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 (*AuditMutation) Op

func (m *AuditMutation) Op() Op

Op returns the operation name.

func (*AuditMutation) Operation

func (m *AuditMutation) Operation() (r audit.Operation, exists bool)

Operation returns the value of the "operation" field in the mutation.

func (*AuditMutation) RemovedEdges

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

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

func (*AuditMutation) RemovedIDs

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

func (m *AuditMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AuditMutation) ResetDescription

func (m *AuditMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*AuditMutation) ResetEdge

func (m *AuditMutation) 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 (*AuditMutation) ResetEntID

func (m *AuditMutation) ResetEntID()

ResetEntID resets all changes to the "ent_id" field.

func (*AuditMutation) ResetEntName

func (m *AuditMutation) ResetEntName()

ResetEntName resets all changes to the "ent_name" field.

func (*AuditMutation) ResetField

func (m *AuditMutation) 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 (*AuditMutation) ResetIP

func (m *AuditMutation) ResetIP()

ResetIP resets all changes to the "ip" field.

func (*AuditMutation) ResetOperation

func (m *AuditMutation) ResetOperation()

ResetOperation resets all changes to the "operation" field.

func (*AuditMutation) ResetUser

func (m *AuditMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*AuditMutation) ResetUserName

func (m *AuditMutation) ResetUserName()

ResetUserName resets all changes to the "user_name" field.

func (*AuditMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AuditMutation) SetDescription

func (m *AuditMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*AuditMutation) SetEntID

func (m *AuditMutation) SetEntID(i int64)

SetEntID sets the "ent_id" field.

func (*AuditMutation) SetEntName

func (m *AuditMutation) SetEntName(s string)

SetEntName sets the "ent_name" field.

func (*AuditMutation) SetField

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

func (m *AuditMutation) SetID(id int64)

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

func (*AuditMutation) SetIP

func (m *AuditMutation) SetIP(s string)

SetIP sets the "ip" field.

func (*AuditMutation) SetOp

func (m *AuditMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AuditMutation) SetOperation

func (m *AuditMutation) SetOperation(a audit.Operation)

SetOperation sets the "operation" field.

func (*AuditMutation) SetUserID

func (m *AuditMutation) SetUserID(id int64)

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

func (*AuditMutation) SetUserName

func (m *AuditMutation) SetUserName(s string)

SetUserName sets the "user_name" field.

func (AuditMutation) Tx

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

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

func (*AuditMutation) Type

func (m *AuditMutation) Type() string

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

func (*AuditMutation) UserCleared

func (m *AuditMutation) UserCleared() bool

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

func (*AuditMutation) UserID

func (m *AuditMutation) UserID() (id int64, exists bool)

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

func (*AuditMutation) UserIDs

func (m *AuditMutation) UserIDs() (ids []int64)

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 (*AuditMutation) UserName

func (m *AuditMutation) UserName() (r string, exists bool)

UserName returns the value of the "user_name" field in the mutation.

func (*AuditMutation) UserNameCleared

func (m *AuditMutation) UserNameCleared() bool

UserNameCleared returns if the "user_name" field was cleared in this mutation.

func (*AuditMutation) Where

func (m *AuditMutation) Where(ps ...predicate.Audit)

Where appends a list predicates to the AuditMutation builder.

func (*AuditMutation) WhereP

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

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

type AuditQuery

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

AuditQuery is the builder for querying Audit entities.

func (*AuditQuery) Aggregate

func (aq *AuditQuery) Aggregate(fns ...AggregateFunc) *AuditSelect

Aggregate returns a AuditSelect configured with the given aggregations.

func (*AuditQuery) All

func (aq *AuditQuery) All(ctx context.Context) ([]*Audit, error)

All executes the query and returns a list of Audits.

func (*AuditQuery) AllX

func (aq *AuditQuery) AllX(ctx context.Context) []*Audit

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

func (*AuditQuery) Clone

func (aq *AuditQuery) Clone() *AuditQuery

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

func (*AuditQuery) Count

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

Count returns the count of the given query.

func (*AuditQuery) CountX

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

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

func (*AuditQuery) Exist

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

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

func (*AuditQuery) ExistX

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

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

func (*AuditQuery) First

func (aq *AuditQuery) First(ctx context.Context) (*Audit, error)

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

func (*AuditQuery) FirstID

func (aq *AuditQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*AuditQuery) FirstIDX

func (aq *AuditQuery) FirstIDX(ctx context.Context) int64

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

func (*AuditQuery) FirstX

func (aq *AuditQuery) FirstX(ctx context.Context) *Audit

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

func (*AuditQuery) GroupBy

func (aq *AuditQuery) GroupBy(field string, fields ...string) *AuditGroupBy

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

Example:

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

client.Audit.Query().
	GroupBy(audit.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AuditQuery) IDs

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

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

func (*AuditQuery) IDsX

func (aq *AuditQuery) IDsX(ctx context.Context) []int64

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

func (*AuditQuery) Limit

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

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

func (*AuditQuery) Offset

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

Offset to start from.

func (*AuditQuery) Only

func (aq *AuditQuery) Only(ctx context.Context) (*Audit, error)

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

func (*AuditQuery) OnlyID

func (aq *AuditQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*AuditQuery) OnlyIDX

func (aq *AuditQuery) OnlyIDX(ctx context.Context) int64

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

func (*AuditQuery) OnlyX

func (aq *AuditQuery) OnlyX(ctx context.Context) *Audit

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

func (*AuditQuery) Order

func (aq *AuditQuery) Order(o ...audit.OrderOption) *AuditQuery

Order specifies how the records should be ordered.

func (*AuditQuery) QueryUser

func (aq *AuditQuery) QueryUser() *UserQuery

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

func (*AuditQuery) Select

func (aq *AuditQuery) Select(fields ...string) *AuditSelect

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

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt"`
}

client.Audit.Query().
	Select(audit.FieldCreatedAt).
	Scan(ctx, &v)

func (*AuditQuery) Unique

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

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

func (aq *AuditQuery) Where(ps ...predicate.Audit) *AuditQuery

Where adds a new predicate for the AuditQuery builder.

func (*AuditQuery) WithUser

func (aq *AuditQuery) WithUser(opts ...func(*UserQuery)) *AuditQuery

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 AuditSelect

type AuditSelect struct {
	*AuditQuery
	// contains filtered or unexported fields
}

AuditSelect is the builder for selecting fields of Audit entities.

func (*AuditSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*AuditSelect) Bool

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

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

func (*AuditSelect) BoolX

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

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

func (*AuditSelect) Bools

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

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

func (*AuditSelect) BoolsX

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

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

func (*AuditSelect) Float64

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

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

func (*AuditSelect) Float64X

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

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

func (*AuditSelect) Float64s

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

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

func (*AuditSelect) Float64sX

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

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

func (*AuditSelect) Int

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

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

func (*AuditSelect) IntX

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

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

func (*AuditSelect) Ints

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

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

func (*AuditSelect) IntsX

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

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

func (*AuditSelect) Scan

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

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

func (*AuditSelect) ScanX

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

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

func (*AuditSelect) String

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

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

func (*AuditSelect) StringX

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

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

func (*AuditSelect) Strings

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

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

func (*AuditSelect) StringsX

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

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

type AuditUpdate

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

AuditUpdate is the builder for updating Audit entities.

func (*AuditUpdate) AddEntID

func (au *AuditUpdate) AddEntID(i int64) *AuditUpdate

AddEntID adds i to the "ent_id" field.

func (*AuditUpdate) ClearIP

func (au *AuditUpdate) ClearIP() *AuditUpdate

ClearIP clears the value of the "ip" field.

func (*AuditUpdate) ClearUser

func (au *AuditUpdate) ClearUser() *AuditUpdate

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

func (*AuditUpdate) ClearUserName

func (au *AuditUpdate) ClearUserName() *AuditUpdate

ClearUserName clears the value of the "user_name" field.

func (*AuditUpdate) Exec

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

Exec executes the query.

func (*AuditUpdate) ExecX

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

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

func (*AuditUpdate) Mutation

func (au *AuditUpdate) Mutation() *AuditMutation

Mutation returns the AuditMutation object of the builder.

func (*AuditUpdate) Save

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

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

func (*AuditUpdate) SaveX

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

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

func (*AuditUpdate) SetDescription

func (au *AuditUpdate) SetDescription(s string) *AuditUpdate

SetDescription sets the "description" field.

func (*AuditUpdate) SetEntID

func (au *AuditUpdate) SetEntID(i int64) *AuditUpdate

SetEntID sets the "ent_id" field.

func (*AuditUpdate) SetEntName

func (au *AuditUpdate) SetEntName(s string) *AuditUpdate

SetEntName sets the "ent_name" field.

func (*AuditUpdate) SetIP

func (au *AuditUpdate) SetIP(s string) *AuditUpdate

SetIP sets the "ip" field.

func (*AuditUpdate) SetNillableDescription

func (au *AuditUpdate) SetNillableDescription(s *string) *AuditUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*AuditUpdate) SetNillableEntID

func (au *AuditUpdate) SetNillableEntID(i *int64) *AuditUpdate

SetNillableEntID sets the "ent_id" field if the given value is not nil.

func (*AuditUpdate) SetNillableEntName

func (au *AuditUpdate) SetNillableEntName(s *string) *AuditUpdate

SetNillableEntName sets the "ent_name" field if the given value is not nil.

func (*AuditUpdate) SetNillableIP

func (au *AuditUpdate) SetNillableIP(s *string) *AuditUpdate

SetNillableIP sets the "ip" field if the given value is not nil.

func (*AuditUpdate) SetNillableOperation

func (au *AuditUpdate) SetNillableOperation(a *audit.Operation) *AuditUpdate

SetNillableOperation sets the "operation" field if the given value is not nil.

func (*AuditUpdate) SetNillableUserID

func (au *AuditUpdate) SetNillableUserID(id *int64) *AuditUpdate

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

func (*AuditUpdate) SetNillableUserName

func (au *AuditUpdate) SetNillableUserName(s *string) *AuditUpdate

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*AuditUpdate) SetOperation

func (au *AuditUpdate) SetOperation(a audit.Operation) *AuditUpdate

SetOperation sets the "operation" field.

func (*AuditUpdate) SetUser

func (au *AuditUpdate) SetUser(u *User) *AuditUpdate

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

func (*AuditUpdate) SetUserID

func (au *AuditUpdate) SetUserID(id int64) *AuditUpdate

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

func (*AuditUpdate) SetUserName

func (au *AuditUpdate) SetUserName(s string) *AuditUpdate

SetUserName sets the "user_name" field.

func (*AuditUpdate) Where

func (au *AuditUpdate) Where(ps ...predicate.Audit) *AuditUpdate

Where appends a list predicates to the AuditUpdate builder.

type AuditUpdateOne

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

AuditUpdateOne is the builder for updating a single Audit entity.

func (*AuditUpdateOne) AddEntID

func (auo *AuditUpdateOne) AddEntID(i int64) *AuditUpdateOne

AddEntID adds i to the "ent_id" field.

func (*AuditUpdateOne) ClearIP

func (auo *AuditUpdateOne) ClearIP() *AuditUpdateOne

ClearIP clears the value of the "ip" field.

func (*AuditUpdateOne) ClearUser

func (auo *AuditUpdateOne) ClearUser() *AuditUpdateOne

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

func (*AuditUpdateOne) ClearUserName

func (auo *AuditUpdateOne) ClearUserName() *AuditUpdateOne

ClearUserName clears the value of the "user_name" field.

func (*AuditUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AuditUpdateOne) ExecX

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

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

func (*AuditUpdateOne) Mutation

func (auo *AuditUpdateOne) Mutation() *AuditMutation

Mutation returns the AuditMutation object of the builder.

func (*AuditUpdateOne) Save

func (auo *AuditUpdateOne) Save(ctx context.Context) (*Audit, error)

Save executes the query and returns the updated Audit entity.

func (*AuditUpdateOne) SaveX

func (auo *AuditUpdateOne) SaveX(ctx context.Context) *Audit

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

func (*AuditUpdateOne) Select

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

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

func (*AuditUpdateOne) SetDescription

func (auo *AuditUpdateOne) SetDescription(s string) *AuditUpdateOne

SetDescription sets the "description" field.

func (*AuditUpdateOne) SetEntID

func (auo *AuditUpdateOne) SetEntID(i int64) *AuditUpdateOne

SetEntID sets the "ent_id" field.

func (*AuditUpdateOne) SetEntName

func (auo *AuditUpdateOne) SetEntName(s string) *AuditUpdateOne

SetEntName sets the "ent_name" field.

func (*AuditUpdateOne) SetIP

func (auo *AuditUpdateOne) SetIP(s string) *AuditUpdateOne

SetIP sets the "ip" field.

func (*AuditUpdateOne) SetNillableDescription

func (auo *AuditUpdateOne) SetNillableDescription(s *string) *AuditUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*AuditUpdateOne) SetNillableEntID

func (auo *AuditUpdateOne) SetNillableEntID(i *int64) *AuditUpdateOne

SetNillableEntID sets the "ent_id" field if the given value is not nil.

func (*AuditUpdateOne) SetNillableEntName

func (auo *AuditUpdateOne) SetNillableEntName(s *string) *AuditUpdateOne

SetNillableEntName sets the "ent_name" field if the given value is not nil.

func (*AuditUpdateOne) SetNillableIP

func (auo *AuditUpdateOne) SetNillableIP(s *string) *AuditUpdateOne

SetNillableIP sets the "ip" field if the given value is not nil.

func (*AuditUpdateOne) SetNillableOperation

func (auo *AuditUpdateOne) SetNillableOperation(a *audit.Operation) *AuditUpdateOne

SetNillableOperation sets the "operation" field if the given value is not nil.

func (*AuditUpdateOne) SetNillableUserID

func (auo *AuditUpdateOne) SetNillableUserID(id *int64) *AuditUpdateOne

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

func (*AuditUpdateOne) SetNillableUserName

func (auo *AuditUpdateOne) SetNillableUserName(s *string) *AuditUpdateOne

SetNillableUserName sets the "user_name" field if the given value is not nil.

func (*AuditUpdateOne) SetOperation

func (auo *AuditUpdateOne) SetOperation(a audit.Operation) *AuditUpdateOne

SetOperation sets the "operation" field.

func (*AuditUpdateOne) SetUser

func (auo *AuditUpdateOne) SetUser(u *User) *AuditUpdateOne

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

func (*AuditUpdateOne) SetUserID

func (auo *AuditUpdateOne) SetUserID(id int64) *AuditUpdateOne

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

func (*AuditUpdateOne) SetUserName

func (auo *AuditUpdateOne) SetUserName(s string) *AuditUpdateOne

SetUserName sets the "user_name" field.

func (*AuditUpdateOne) Where

func (auo *AuditUpdateOne) Where(ps ...predicate.Audit) *AuditUpdateOne

Where appends a list predicates to the AuditUpdate builder.

type Audits

type Audits []*Audit

Audits is a parsable slice of Audit.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AccessControl is the client for interacting with the AccessControl builders.
	AccessControl *AccessControlClient
	// Audit is the client for interacting with the Audit builders.
	Audit *AuditClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Todo is the client for interacting with the Todo builders.
	Todo *TodoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserSession is the client for interacting with the UserSession builders.
	UserSession *UserSessionClient
	// VerifyToken is the client for interacting with the VerifyToken builders.
	VerifyToken *VerifyTokenClient
	// 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().
	AccessControl.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

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

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

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

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

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type 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 Role

type Role struct {

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

Role is the model entity for the Role schema.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

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

func (r *Role) Update() *RoleUpdateOne

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

func (*Role) Value

func (r *Role) Value(name string) (ent.Value, error)

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

type RoleClient

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

RoleClient is a client for the Role schema.

func NewRoleClient

func NewRoleClient(c config) *RoleClient

NewRoleClient returns a client for the Role from the given config.

func (*RoleClient) Create

func (c *RoleClient) Create() *RoleCreate

Create returns a builder for creating a Role entity.

func (*RoleClient) CreateBulk

func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk

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

func (*RoleClient) Delete

func (c *RoleClient) Delete() *RoleDelete

Delete returns a delete builder for Role.

func (*RoleClient) DeleteOne

func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RoleClient) DeleteOneID

func (c *RoleClient) DeleteOneID(id int64) *RoleDeleteOne

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

func (*RoleClient) Get

func (c *RoleClient) Get(ctx context.Context, id int64) (*Role, error)

Get returns a Role entity by its id.

func (*RoleClient) GetX

func (c *RoleClient) GetX(ctx context.Context, id int64) *Role

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

func (*RoleClient) Hooks

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

Hooks returns the client hooks.

func (*RoleClient) Intercept

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

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

func (*RoleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RoleClient) MapCreateBulk

func (c *RoleClient) MapCreateBulk(slice any, setFunc func(*RoleCreate, int)) *RoleCreateBulk

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

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) Update

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

func (c *RoleClient) UpdateOneID(id int64) *RoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) Exec

func (rc *RoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreate) ExecX

func (rc *RoleCreate) ExecX(ctx context.Context)

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

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) Save

func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)

Save creates the Role in the database.

func (*RoleCreate) SaveX

func (rc *RoleCreate) SaveX(ctx context.Context) *Role

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetID

func (rc *RoleCreate) SetID(i int64) *RoleCreate

SetID sets the "id" field.

func (*RoleCreate) SetName

func (rc *RoleCreate) SetName(s string) *RoleCreate

SetName sets the "name" field.

type RoleCreateBulk

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

RoleCreateBulk is the builder for creating many Role entities in bulk.

func (*RoleCreateBulk) Exec

func (rcb *RoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreateBulk) ExecX

func (rcb *RoleCreateBulk) ExecX(ctx context.Context)

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

func (*RoleCreateBulk) Save

func (rcb *RoleCreateBulk) Save(ctx context.Context) ([]*Role, error)

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

func (rcb *RoleCreateBulk) SaveX(ctx context.Context) []*Role

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

type RoleDelete

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

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

func (rd *RoleDelete) Exec(ctx context.Context) (int, error)

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

func (*RoleDelete) ExecX

func (rd *RoleDelete) ExecX(ctx context.Context) int

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

func (*RoleDelete) Where

func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

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

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

func (rdo *RoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

func (rdo *RoleDeleteOne) ExecX(ctx context.Context)

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

func (*RoleDeleteOne) Where

func (rdo *RoleDeleteOne) Where(ps ...predicate.Role) *RoleDeleteOne

Where appends a list predicates to the RoleDelete builder.

type RoleGroupBy

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

RoleGroupBy is the group-by builder for Role entities.

func (*RoleGroupBy) Aggregate

func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy

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

func (*RoleGroupBy) Bool

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

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

func (*RoleGroupBy) BoolX

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

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

func (*RoleGroupBy) Bools

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

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

func (*RoleGroupBy) BoolsX

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

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

func (*RoleGroupBy) Float64

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

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

func (*RoleGroupBy) Float64X

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

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

func (*RoleGroupBy) Float64s

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

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

func (*RoleGroupBy) Float64sX

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

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

func (*RoleGroupBy) Int

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

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

func (*RoleGroupBy) IntX

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

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

func (*RoleGroupBy) Ints

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

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

func (*RoleGroupBy) IntsX

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

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

func (*RoleGroupBy) Scan

func (rgb *RoleGroupBy) Scan(ctx context.Context, v any) error

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

func (*RoleGroupBy) ScanX

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

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

func (*RoleGroupBy) String

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

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

func (*RoleGroupBy) StringX

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

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

func (*RoleGroupBy) Strings

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

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

func (*RoleGroupBy) StringsX

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

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

type RoleMutation

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

RoleMutation represents an operation that mutates the Role nodes in the graph.

func (*RoleMutation) AddField

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

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

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

func (*RoleMutation) AddedField

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

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

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

func (*RoleMutation) AddedIDs

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

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

func (*RoleMutation) ClearEdge

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

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

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

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

func (*RoleMutation) ClearedFields

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

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

func (RoleMutation) Client

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

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

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

func (*RoleMutation) Field

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

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

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

func (*RoleMutation) Fields

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

func (m *RoleMutation) ID() (id int64, 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 (*RoleMutation) IDs

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

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

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

func (*RoleMutation) OldField

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

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

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

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) RemovedEdges

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

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

func (*RoleMutation) RemovedIDs

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

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

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

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) SetField

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

func (m *RoleMutation) SetID(id int64)

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

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetOp

func (m *RoleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (RoleMutation) Tx

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

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

func (*RoleMutation) Type

func (m *RoleMutation) Type() string

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

func (*RoleMutation) Where

func (m *RoleMutation) Where(ps ...predicate.Role)

Where appends a list predicates to the RoleMutation builder.

func (*RoleMutation) WhereP

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

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

type RoleQuery

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

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) Aggregate

func (rq *RoleQuery) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate returns a RoleSelect configured with the given aggregations.

func (*RoleQuery) All

func (rq *RoleQuery) All(ctx context.Context) ([]*Role, error)

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

func (rq *RoleQuery) AllX(ctx context.Context) []*Role

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

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

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

func (*RoleQuery) Count

func (rq *RoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RoleQuery) CountX

func (rq *RoleQuery) CountX(ctx context.Context) int

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

func (*RoleQuery) Exist

func (rq *RoleQuery) Exist(ctx context.Context) (bool, error)

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

func (*RoleQuery) ExistX

func (rq *RoleQuery) ExistX(ctx context.Context) bool

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

func (*RoleQuery) First

func (rq *RoleQuery) First(ctx context.Context) (*Role, error)

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

func (*RoleQuery) FirstID

func (rq *RoleQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*RoleQuery) FirstIDX

func (rq *RoleQuery) FirstIDX(ctx context.Context) int64

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

func (*RoleQuery) FirstX

func (rq *RoleQuery) FirstX(ctx context.Context) *Role

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

func (*RoleQuery) GroupBy

func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy

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.Role.Query().
	GroupBy(role.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*RoleQuery) IDsX

func (rq *RoleQuery) IDsX(ctx context.Context) []int64

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

func (*RoleQuery) Limit

func (rq *RoleQuery) Limit(limit int) *RoleQuery

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

func (*RoleQuery) Offset

func (rq *RoleQuery) Offset(offset int) *RoleQuery

Offset to start from.

func (*RoleQuery) Only

func (rq *RoleQuery) Only(ctx context.Context) (*Role, error)

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

func (*RoleQuery) OnlyID

func (rq *RoleQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*RoleQuery) OnlyIDX

func (rq *RoleQuery) OnlyIDX(ctx context.Context) int64

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

func (*RoleQuery) OnlyX

func (rq *RoleQuery) OnlyX(ctx context.Context) *Role

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

func (*RoleQuery) Order

func (rq *RoleQuery) Order(o ...role.OrderOption) *RoleQuery

Order specifies how the records should be ordered.

func (*RoleQuery) Select

func (rq *RoleQuery) Select(fields ...string) *RoleSelect

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.Role.Query().
	Select(role.FieldName).
	Scan(ctx, &v)

func (*RoleQuery) Unique

func (rq *RoleQuery) Unique(unique bool) *RoleQuery

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

func (rq *RoleQuery) Where(ps ...predicate.Role) *RoleQuery

Where adds a new predicate for the RoleQuery builder.

type RoleSelect

type RoleSelect struct {
	*RoleQuery
	// contains filtered or unexported fields
}

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Aggregate

func (rs *RoleSelect) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RoleSelect) Bool

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

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

func (*RoleSelect) BoolX

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

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

func (*RoleSelect) Bools

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

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

func (*RoleSelect) BoolsX

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

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

func (*RoleSelect) Float64

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

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

func (*RoleSelect) Float64X

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

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

func (*RoleSelect) Float64s

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

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

func (*RoleSelect) Float64sX

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

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

func (*RoleSelect) Int

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

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

func (*RoleSelect) IntX

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

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

func (*RoleSelect) Ints

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

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

func (*RoleSelect) IntsX

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

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

func (*RoleSelect) Scan

func (rs *RoleSelect) Scan(ctx context.Context, v any) error

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

func (*RoleSelect) ScanX

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

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

func (*RoleSelect) String

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

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

func (*RoleSelect) StringX

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

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

func (*RoleSelect) Strings

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

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

func (*RoleSelect) StringsX

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

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

type RoleUpdate

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

RoleUpdate is the builder for updating Role entities.

func (*RoleUpdate) Exec

func (ru *RoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpdate) ExecX

func (ru *RoleUpdate) ExecX(ctx context.Context)

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

func (*RoleUpdate) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) Save

func (ru *RoleUpdate) Save(ctx context.Context) (int, error)

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

func (*RoleUpdate) SaveX

func (ru *RoleUpdate) SaveX(ctx context.Context) int

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

func (*RoleUpdate) SetName

func (ru *RoleUpdate) SetName(s string) *RoleUpdate

SetName sets the "name" field.

func (*RoleUpdate) SetNillableName

func (ru *RoleUpdate) SetNillableName(s *string) *RoleUpdate

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

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

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

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) Exec

func (ruo *RoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RoleUpdateOne) ExecX

func (ruo *RoleUpdateOne) ExecX(ctx context.Context)

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

func (*RoleUpdateOne) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) Save

func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role

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

func (*RoleUpdateOne) Select

func (ruo *RoleUpdateOne) Select(field string, fields ...string) *RoleUpdateOne

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

func (*RoleUpdateOne) SetName

func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableName

func (ruo *RoleUpdateOne) SetNillableName(s *string) *RoleUpdateOne

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

func (*RoleUpdateOne) Where

func (ruo *RoleUpdateOne) Where(ps ...predicate.Role) *RoleUpdateOne

Where appends a list predicates to the RoleUpdate builder.

type Roles

type Roles []*Role

Roles is a parsable slice of Role.

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 Todo

type Todo struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// contains filtered or unexported fields
}

Todo is the model entity for the Todo schema.

func (*Todo) String

func (t *Todo) String() string

String implements the fmt.Stringer.

func (*Todo) Unwrap

func (t *Todo) Unwrap() *Todo

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

func (t *Todo) Update() *TodoUpdateOne

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

func (*Todo) Value

func (t *Todo) Value(name string) (ent.Value, error)

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

type TodoClient

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

TodoClient is a client for the Todo schema.

func NewTodoClient

func NewTodoClient(c config) *TodoClient

NewTodoClient returns a client for the Todo from the given config.

func (*TodoClient) Create

func (c *TodoClient) Create() *TodoCreate

Create returns a builder for creating a Todo entity.

func (*TodoClient) CreateBulk

func (c *TodoClient) CreateBulk(builders ...*TodoCreate) *TodoCreateBulk

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

func (*TodoClient) Delete

func (c *TodoClient) Delete() *TodoDelete

Delete returns a delete builder for Todo.

func (*TodoClient) DeleteOne

func (c *TodoClient) DeleteOne(t *Todo) *TodoDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TodoClient) DeleteOneID

func (c *TodoClient) DeleteOneID(id int) *TodoDeleteOne

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

func (*TodoClient) Get

func (c *TodoClient) Get(ctx context.Context, id int) (*Todo, error)

Get returns a Todo entity by its id.

func (*TodoClient) GetX

func (c *TodoClient) GetX(ctx context.Context, id int) *Todo

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

func (*TodoClient) Hooks

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

Hooks returns the client hooks.

func (*TodoClient) Intercept

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

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

func (*TodoClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TodoClient) MapCreateBulk

func (c *TodoClient) MapCreateBulk(slice any, setFunc func(*TodoCreate, int)) *TodoCreateBulk

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

func (c *TodoClient) Query() *TodoQuery

Query returns a query builder for Todo.

func (*TodoClient) Update

func (c *TodoClient) Update() *TodoUpdate

Update returns an update builder for Todo.

func (*TodoClient) UpdateOne

func (c *TodoClient) UpdateOne(t *Todo) *TodoUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TodoClient) UpdateOneID

func (c *TodoClient) UpdateOneID(id int) *TodoUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TodoClient) Use

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

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

type TodoCreate

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

TodoCreate is the builder for creating a Todo entity.

func (*TodoCreate) Exec

func (tc *TodoCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoCreate) ExecX

func (tc *TodoCreate) ExecX(ctx context.Context)

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

func (*TodoCreate) Mutation

func (tc *TodoCreate) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoCreate) Save

func (tc *TodoCreate) Save(ctx context.Context) (*Todo, error)

Save creates the Todo in the database.

func (*TodoCreate) SaveX

func (tc *TodoCreate) SaveX(ctx context.Context) *Todo

SaveX calls Save and panics if Save returns an error.

type TodoCreateBulk

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

TodoCreateBulk is the builder for creating many Todo entities in bulk.

func (*TodoCreateBulk) Exec

func (tcb *TodoCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoCreateBulk) ExecX

func (tcb *TodoCreateBulk) ExecX(ctx context.Context)

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

func (*TodoCreateBulk) Save

func (tcb *TodoCreateBulk) Save(ctx context.Context) ([]*Todo, error)

Save creates the Todo entities in the database.

func (*TodoCreateBulk) SaveX

func (tcb *TodoCreateBulk) SaveX(ctx context.Context) []*Todo

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

type TodoDelete

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

TodoDelete is the builder for deleting a Todo entity.

func (*TodoDelete) Exec

func (td *TodoDelete) Exec(ctx context.Context) (int, error)

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

func (*TodoDelete) ExecX

func (td *TodoDelete) ExecX(ctx context.Context) int

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

func (*TodoDelete) Where

func (td *TodoDelete) Where(ps ...predicate.Todo) *TodoDelete

Where appends a list predicates to the TodoDelete builder.

type TodoDeleteOne

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

TodoDeleteOne is the builder for deleting a single Todo entity.

func (*TodoDeleteOne) Exec

func (tdo *TodoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TodoDeleteOne) ExecX

func (tdo *TodoDeleteOne) ExecX(ctx context.Context)

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

func (*TodoDeleteOne) Where

func (tdo *TodoDeleteOne) Where(ps ...predicate.Todo) *TodoDeleteOne

Where appends a list predicates to the TodoDelete builder.

type TodoGroupBy

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

TodoGroupBy is the group-by builder for Todo entities.

func (*TodoGroupBy) Aggregate

func (tgb *TodoGroupBy) Aggregate(fns ...AggregateFunc) *TodoGroupBy

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

func (*TodoGroupBy) Bool

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

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

func (*TodoGroupBy) BoolX

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

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

func (*TodoGroupBy) Bools

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

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

func (*TodoGroupBy) BoolsX

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

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

func (*TodoGroupBy) Float64

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

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

func (*TodoGroupBy) Float64X

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

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

func (*TodoGroupBy) Float64s

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

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

func (*TodoGroupBy) Float64sX

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

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

func (*TodoGroupBy) Int

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

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

func (*TodoGroupBy) IntX

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

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

func (*TodoGroupBy) Ints

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

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

func (*TodoGroupBy) IntsX

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

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

func (*TodoGroupBy) Scan

func (tgb *TodoGroupBy) Scan(ctx context.Context, v any) error

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

func (*TodoGroupBy) ScanX

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

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

func (*TodoGroupBy) String

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

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

func (*TodoGroupBy) StringX

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

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

func (*TodoGroupBy) Strings

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

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

func (*TodoGroupBy) StringsX

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

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

type TodoMutation

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

TodoMutation represents an operation that mutates the Todo nodes in the graph.

func (*TodoMutation) AddField

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

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

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

func (*TodoMutation) AddedField

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

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

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

func (*TodoMutation) AddedIDs

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

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

func (*TodoMutation) ClearEdge

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

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

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

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

func (*TodoMutation) ClearedFields

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

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

func (TodoMutation) Client

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

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

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

func (*TodoMutation) Field

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

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

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

func (*TodoMutation) Fields

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

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

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

func (*TodoMutation) IDs

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

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

func (*TodoMutation) OldField

func (m *TodoMutation) 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 (*TodoMutation) Op

func (m *TodoMutation) Op() Op

Op returns the operation name.

func (*TodoMutation) RemovedEdges

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

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

func (*TodoMutation) RemovedIDs

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

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

func (m *TodoMutation) 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 (*TodoMutation) SetField

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

func (m *TodoMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (TodoMutation) Tx

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

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

func (*TodoMutation) Type

func (m *TodoMutation) Type() string

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

func (*TodoMutation) Where

func (m *TodoMutation) Where(ps ...predicate.Todo)

Where appends a list predicates to the TodoMutation builder.

func (*TodoMutation) WhereP

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

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

type TodoQuery

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

TodoQuery is the builder for querying Todo entities.

func (*TodoQuery) Aggregate

func (tq *TodoQuery) Aggregate(fns ...AggregateFunc) *TodoSelect

Aggregate returns a TodoSelect configured with the given aggregations.

func (*TodoQuery) All

func (tq *TodoQuery) All(ctx context.Context) ([]*Todo, error)

All executes the query and returns a list of Todos.

func (*TodoQuery) AllX

func (tq *TodoQuery) AllX(ctx context.Context) []*Todo

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

func (*TodoQuery) Clone

func (tq *TodoQuery) Clone() *TodoQuery

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

func (*TodoQuery) Count

func (tq *TodoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TodoQuery) CountX

func (tq *TodoQuery) CountX(ctx context.Context) int

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

func (*TodoQuery) Exist

func (tq *TodoQuery) Exist(ctx context.Context) (bool, error)

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

func (*TodoQuery) ExistX

func (tq *TodoQuery) ExistX(ctx context.Context) bool

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

func (*TodoQuery) First

func (tq *TodoQuery) First(ctx context.Context) (*Todo, error)

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

func (*TodoQuery) FirstID

func (tq *TodoQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TodoQuery) FirstIDX

func (tq *TodoQuery) FirstIDX(ctx context.Context) int

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

func (*TodoQuery) FirstX

func (tq *TodoQuery) FirstX(ctx context.Context) *Todo

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

func (*TodoQuery) GroupBy

func (tq *TodoQuery) GroupBy(field string, fields ...string) *TodoGroupBy

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.

func (*TodoQuery) IDs

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

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

func (*TodoQuery) IDsX

func (tq *TodoQuery) IDsX(ctx context.Context) []int

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

func (*TodoQuery) Limit

func (tq *TodoQuery) Limit(limit int) *TodoQuery

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

func (*TodoQuery) Offset

func (tq *TodoQuery) Offset(offset int) *TodoQuery

Offset to start from.

func (*TodoQuery) Only

func (tq *TodoQuery) Only(ctx context.Context) (*Todo, error)

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

func (*TodoQuery) OnlyID

func (tq *TodoQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TodoQuery) OnlyIDX

func (tq *TodoQuery) OnlyIDX(ctx context.Context) int

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

func (*TodoQuery) OnlyX

func (tq *TodoQuery) OnlyX(ctx context.Context) *Todo

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

func (*TodoQuery) Order

func (tq *TodoQuery) Order(o ...todo.OrderOption) *TodoQuery

Order specifies how the records should be ordered.

func (*TodoQuery) Select

func (tq *TodoQuery) Select(fields ...string) *TodoSelect

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

func (*TodoQuery) Unique

func (tq *TodoQuery) Unique(unique bool) *TodoQuery

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

func (tq *TodoQuery) Where(ps ...predicate.Todo) *TodoQuery

Where adds a new predicate for the TodoQuery builder.

type TodoSelect

type TodoSelect struct {
	*TodoQuery
	// contains filtered or unexported fields
}

TodoSelect is the builder for selecting fields of Todo entities.

func (*TodoSelect) Aggregate

func (ts *TodoSelect) Aggregate(fns ...AggregateFunc) *TodoSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TodoSelect) Bool

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

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

func (*TodoSelect) BoolX

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

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

func (*TodoSelect) Bools

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

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

func (*TodoSelect) BoolsX

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

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

func (*TodoSelect) Float64

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

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

func (*TodoSelect) Float64X

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

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

func (*TodoSelect) Float64s

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

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

func (*TodoSelect) Float64sX

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

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

func (*TodoSelect) Int

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

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

func (*TodoSelect) IntX

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

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

func (*TodoSelect) Ints

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

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

func (*TodoSelect) IntsX

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

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

func (*TodoSelect) Scan

func (ts *TodoSelect) Scan(ctx context.Context, v any) error

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

func (*TodoSelect) ScanX

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

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

func (*TodoSelect) String

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

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

func (*TodoSelect) StringX

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

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

func (*TodoSelect) Strings

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

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

func (*TodoSelect) StringsX

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

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

type TodoUpdate

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

TodoUpdate is the builder for updating Todo entities.

func (*TodoUpdate) Exec

func (tu *TodoUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoUpdate) ExecX

func (tu *TodoUpdate) ExecX(ctx context.Context)

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

func (*TodoUpdate) Mutation

func (tu *TodoUpdate) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoUpdate) Save

func (tu *TodoUpdate) Save(ctx context.Context) (int, error)

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

func (*TodoUpdate) SaveX

func (tu *TodoUpdate) SaveX(ctx context.Context) int

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

func (*TodoUpdate) Where

func (tu *TodoUpdate) Where(ps ...predicate.Todo) *TodoUpdate

Where appends a list predicates to the TodoUpdate builder.

type TodoUpdateOne

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

TodoUpdateOne is the builder for updating a single Todo entity.

func (*TodoUpdateOne) Exec

func (tuo *TodoUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TodoUpdateOne) ExecX

func (tuo *TodoUpdateOne) ExecX(ctx context.Context)

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

func (*TodoUpdateOne) Mutation

func (tuo *TodoUpdateOne) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoUpdateOne) Save

func (tuo *TodoUpdateOne) Save(ctx context.Context) (*Todo, error)

Save executes the query and returns the updated Todo entity.

func (*TodoUpdateOne) SaveX

func (tuo *TodoUpdateOne) SaveX(ctx context.Context) *Todo

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

func (*TodoUpdateOne) Select

func (tuo *TodoUpdateOne) Select(field string, fields ...string) *TodoUpdateOne

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

func (*TodoUpdateOne) Where

func (tuo *TodoUpdateOne) Where(ps ...predicate.Todo) *TodoUpdateOne

Where appends a list predicates to the TodoUpdate builder.

type Todos

type Todos []*Todo

Todos is a parsable slice of Todo.

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 {

	// AccessControl is the client for interacting with the AccessControl builders.
	AccessControl *AccessControlClient
	// Audit is the client for interacting with the Audit builders.
	Audit *AuditClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Todo is the client for interacting with the Todo builders.
	Todo *TodoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserSession is the client for interacting with the UserSession builders.
	UserSession *UserSessionClient
	// VerifyToken is the client for interacting with the VerifyToken builders.
	VerifyToken *VerifyTokenClient
	// 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 int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updatedAt"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// EmailVerified holds the value of the "email_verified" field.
	EmailVerified bool `json:"email_verified,omitempty"`
	// Phone holds the value of the "phone" field.
	Phone string `json:"phone,omitempty"`
	// PhoneVerified holds the value of the "phone_verified" field.
	PhoneVerified bool `json:"phone_verified,omitempty"`
	// PwdSalt holds the value of the "pwd_salt" field.
	PwdSalt string `json:"pwd_salt,omitempty"`
	// PwdHash holds the value of the "pwd_hash" field.
	PwdHash string `json:"pwd_hash,omitempty"`
	// LoginFailedCount holds the value of the "login_failed_count" field.
	LoginFailedCount uint8 `json:"login_failed_count,omitempty"`
	// LoginAttemptOn holds the value of the "login_attempt_on" field.
	LoginAttemptOn *time.Time `json:"login_attempt_on,omitempty"`
	// LoginLockedUntil holds the value of the "login_locked_until" field.
	LoginLockedUntil *time.Time `json:"login_locked_until,omitempty"`
	// FirstName holds the value of the "first_name" field.
	FirstName string `json:"first_name,omitempty"`
	// MiddleName holds the value of the "middle_name" field.
	MiddleName *string `json:"middle_name,omitempty"`
	// LastName holds the value of the "last_name" field.
	LastName string `json:"last_name,omitempty"`
	// Status holds the value of the "status" field.
	Status user.Status `json:"status,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) QueryAuditLogs

func (u *User) QueryAuditLogs() *AuditQuery

QueryAuditLogs queries the "audit_logs" edge of the User entity.

func (*User) QuerySessions

func (u *User) QuerySessions() *UserSessionQuery

QuerySessions queries the "sessions" edge of the User entity.

func (*User) QueryVerifyTokens

func (u *User) QueryVerifyTokens() *VerifyTokenQuery

QueryVerifyTokens queries the "verify_tokens" 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 int64) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int64) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int64) *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) QueryAuditLogs

func (c *UserClient) QueryAuditLogs(u *User) *AuditQuery

QueryAuditLogs queries the audit_logs edge of a User.

func (*UserClient) QuerySessions

func (c *UserClient) QuerySessions(u *User) *UserSessionQuery

QuerySessions queries the sessions edge of a User.

func (*UserClient) QueryVerifyTokens

func (c *UserClient) QueryVerifyTokens(u *User) *VerifyTokenQuery

QueryVerifyTokens queries the verify_tokens 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 int64) *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) AddAuditLogIDs

func (uc *UserCreate) AddAuditLogIDs(ids ...int64) *UserCreate

AddAuditLogIDs adds the "audit_logs" edge to the Audit entity by IDs.

func (*UserCreate) AddAuditLogs

func (uc *UserCreate) AddAuditLogs(a ...*Audit) *UserCreate

AddAuditLogs adds the "audit_logs" edges to the Audit entity.

func (*UserCreate) AddSessionIDs

func (uc *UserCreate) AddSessionIDs(ids ...int64) *UserCreate

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserCreate) AddSessions

func (uc *UserCreate) AddSessions(u ...*UserSession) *UserCreate

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserCreate) AddVerifyTokenIDs

func (uc *UserCreate) AddVerifyTokenIDs(ids ...int64) *UserCreate

AddVerifyTokenIDs adds the "verify_tokens" edge to the VerifyToken entity by IDs.

func (*UserCreate) AddVerifyTokens

func (uc *UserCreate) AddVerifyTokens(v ...*VerifyToken) *UserCreate

AddVerifyTokens adds the "verify_tokens" edges to the VerifyToken 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) 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) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetEmailVerified

func (uc *UserCreate) SetEmailVerified(b bool) *UserCreate

SetEmailVerified sets the "email_verified" field.

func (*UserCreate) SetFirstName

func (uc *UserCreate) SetFirstName(s string) *UserCreate

SetFirstName sets the "first_name" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int64) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetLastName

func (uc *UserCreate) SetLastName(s string) *UserCreate

SetLastName sets the "last_name" field.

func (*UserCreate) SetLoginAttemptOn

func (uc *UserCreate) SetLoginAttemptOn(t time.Time) *UserCreate

SetLoginAttemptOn sets the "login_attempt_on" field.

func (*UserCreate) SetLoginFailedCount

func (uc *UserCreate) SetLoginFailedCount(u uint8) *UserCreate

SetLoginFailedCount sets the "login_failed_count" field.

func (*UserCreate) SetLoginLockedUntil

func (uc *UserCreate) SetLoginLockedUntil(t time.Time) *UserCreate

SetLoginLockedUntil sets the "login_locked_until" field.

func (*UserCreate) SetMiddleName

func (uc *UserCreate) SetMiddleName(s string) *UserCreate

SetMiddleName sets the "middle_name" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableEmailVerified

func (uc *UserCreate) SetNillableEmailVerified(b *bool) *UserCreate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserCreate) SetNillableLoginAttemptOn

func (uc *UserCreate) SetNillableLoginAttemptOn(t *time.Time) *UserCreate

SetNillableLoginAttemptOn sets the "login_attempt_on" field if the given value is not nil.

func (*UserCreate) SetNillableLoginFailedCount

func (uc *UserCreate) SetNillableLoginFailedCount(u *uint8) *UserCreate

SetNillableLoginFailedCount sets the "login_failed_count" field if the given value is not nil.

func (*UserCreate) SetNillableLoginLockedUntil

func (uc *UserCreate) SetNillableLoginLockedUntil(t *time.Time) *UserCreate

SetNillableLoginLockedUntil sets the "login_locked_until" field if the given value is not nil.

func (*UserCreate) SetNillablePhone

func (uc *UserCreate) SetNillablePhone(s *string) *UserCreate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserCreate) SetNillablePhoneVerified

func (uc *UserCreate) SetNillablePhoneVerified(b *bool) *UserCreate

SetNillablePhoneVerified sets the "phone_verified" field if the given value is not nil.

func (*UserCreate) SetNillableStatus

func (uc *UserCreate) SetNillableStatus(u *user.Status) *UserCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetPhone

func (uc *UserCreate) SetPhone(s string) *UserCreate

SetPhone sets the "phone" field.

func (*UserCreate) SetPhoneVerified

func (uc *UserCreate) SetPhoneVerified(b bool) *UserCreate

SetPhoneVerified sets the "phone_verified" field.

func (*UserCreate) SetPwdHash

func (uc *UserCreate) SetPwdHash(s string) *UserCreate

SetPwdHash sets the "pwd_hash" field.

func (*UserCreate) SetPwdSalt

func (uc *UserCreate) SetPwdSalt(s string) *UserCreate

SetPwdSalt sets the "pwd_salt" field.

func (*UserCreate) SetStatus

func (uc *UserCreate) SetStatus(u user.Status) *UserCreate

SetStatus sets the "status" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

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) 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 {
	// Sessions holds the value of the sessions edge.
	Sessions []*UserSession `json:"sessions,omitempty"`
	// AuditLogs holds the value of the audit_logs edge.
	AuditLogs []*Audit `json:"audit_logs,omitempty"`
	// VerifyTokens holds the value of the verify_tokens edge.
	VerifyTokens []*VerifyToken `json:"verify_tokens,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) AuditLogsOrErr

func (e UserEdges) AuditLogsOrErr() ([]*Audit, error)

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

func (UserEdges) SessionsOrErr

func (e UserEdges) SessionsOrErr() ([]*UserSession, error)

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

func (UserEdges) VerifyTokensOrErr

func (e UserEdges) VerifyTokensOrErr() ([]*VerifyToken, error)

VerifyTokensOrErr returns the VerifyTokens 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) AddAuditLogIDs

func (m *UserMutation) AddAuditLogIDs(ids ...int64)

AddAuditLogIDs adds the "audit_logs" edge to the Audit 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) AddLoginFailedCount

func (m *UserMutation) AddLoginFailedCount(u int8)

AddLoginFailedCount adds u to the "login_failed_count" field.

func (*UserMutation) AddSessionIDs

func (m *UserMutation) AddSessionIDs(ids ...int64)

AddSessionIDs adds the "sessions" edge to the UserSession entity by ids.

func (*UserMutation) AddVerifyTokenIDs

func (m *UserMutation) AddVerifyTokenIDs(ids ...int64)

AddVerifyTokenIDs adds the "verify_tokens" edge to the VerifyToken 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) AddedLoginFailedCount

func (m *UserMutation) AddedLoginFailedCount() (r int8, exists bool)

AddedLoginFailedCount returns the value that was added to the "login_failed_count" field in this mutation.

func (*UserMutation) AuditLogsCleared

func (m *UserMutation) AuditLogsCleared() bool

AuditLogsCleared reports if the "audit_logs" edge to the Audit entity was cleared.

func (*UserMutation) AuditLogsIDs

func (m *UserMutation) AuditLogsIDs() (ids []int64)

AuditLogsIDs returns the "audit_logs" edge IDs in the mutation.

func (*UserMutation) ClearAuditLogs

func (m *UserMutation) ClearAuditLogs()

ClearAuditLogs clears the "audit_logs" edge to the Audit 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) ClearLoginAttemptOn

func (m *UserMutation) ClearLoginAttemptOn()

ClearLoginAttemptOn clears the value of the "login_attempt_on" field.

func (*UserMutation) ClearLoginFailedCount

func (m *UserMutation) ClearLoginFailedCount()

ClearLoginFailedCount clears the value of the "login_failed_count" field.

func (*UserMutation) ClearLoginLockedUntil

func (m *UserMutation) ClearLoginLockedUntil()

ClearLoginLockedUntil clears the value of the "login_locked_until" field.

func (*UserMutation) ClearPhone

func (m *UserMutation) ClearPhone()

ClearPhone clears the value of the "phone" field.

func (*UserMutation) ClearSessions

func (m *UserMutation) ClearSessions()

ClearSessions clears the "sessions" edge to the UserSession entity.

func (*UserMutation) ClearVerifyTokens

func (m *UserMutation) ClearVerifyTokens()

ClearVerifyTokens clears the "verify_tokens" edge to the VerifyToken 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) CreatedAt

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

CreatedAt returns the value of the "created_at" field 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) EmailVerified

func (m *UserMutation) EmailVerified() (r bool, exists bool)

EmailVerified returns the value of the "email_verified" 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) FirstName

func (m *UserMutation) FirstName() (r string, exists bool)

FirstName returns the value of the "first_name" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int64, 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) ([]int64, 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) LastName

func (m *UserMutation) LastName() (r string, exists bool)

LastName returns the value of the "last_name" field in the mutation.

func (*UserMutation) LoginAttemptOn

func (m *UserMutation) LoginAttemptOn() (r time.Time, exists bool)

LoginAttemptOn returns the value of the "login_attempt_on" field in the mutation.

func (*UserMutation) LoginAttemptOnCleared

func (m *UserMutation) LoginAttemptOnCleared() bool

LoginAttemptOnCleared returns if the "login_attempt_on" field was cleared in this mutation.

func (*UserMutation) LoginFailedCount

func (m *UserMutation) LoginFailedCount() (r uint8, exists bool)

LoginFailedCount returns the value of the "login_failed_count" field in the mutation.

func (*UserMutation) LoginFailedCountCleared

func (m *UserMutation) LoginFailedCountCleared() bool

LoginFailedCountCleared returns if the "login_failed_count" field was cleared in this mutation.

func (*UserMutation) LoginLockedUntil

func (m *UserMutation) LoginLockedUntil() (r time.Time, exists bool)

LoginLockedUntil returns the value of the "login_locked_until" field in the mutation.

func (*UserMutation) LoginLockedUntilCleared

func (m *UserMutation) LoginLockedUntilCleared() bool

LoginLockedUntilCleared returns if the "login_locked_until" field was cleared in this mutation.

func (*UserMutation) MiddleName

func (m *UserMutation) MiddleName() (r string, exists bool)

MiddleName returns the value of the "middle_name" field in the mutation.

func (*UserMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" 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) 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) OldEmailVerified

func (m *UserMutation) OldEmailVerified(ctx context.Context) (v bool, err error)

OldEmailVerified returns the old "email_verified" 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) OldFirstName

func (m *UserMutation) OldFirstName(ctx context.Context) (v string, err error)

OldFirstName returns the old "first_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) OldLastName

func (m *UserMutation) OldLastName(ctx context.Context) (v string, err error)

OldLastName returns the old "last_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) OldLoginAttemptOn

func (m *UserMutation) OldLoginAttemptOn(ctx context.Context) (v *time.Time, err error)

OldLoginAttemptOn returns the old "login_attempt_on" 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) OldLoginFailedCount

func (m *UserMutation) OldLoginFailedCount(ctx context.Context) (v uint8, err error)

OldLoginFailedCount returns the old "login_failed_count" 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) OldLoginLockedUntil

func (m *UserMutation) OldLoginLockedUntil(ctx context.Context) (v *time.Time, err error)

OldLoginLockedUntil returns the old "login_locked_until" 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) OldMiddleName

func (m *UserMutation) OldMiddleName(ctx context.Context) (v *string, err error)

OldMiddleName returns the old "middle_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) OldPhone

func (m *UserMutation) OldPhone(ctx context.Context) (v string, err error)

OldPhone returns the old "phone" 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) OldPhoneVerified

func (m *UserMutation) OldPhoneVerified(ctx context.Context) (v bool, err error)

OldPhoneVerified returns the old "phone_verified" 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) OldPwdHash

func (m *UserMutation) OldPwdHash(ctx context.Context) (v string, err error)

OldPwdHash returns the old "pwd_hash" 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) OldPwdSalt

func (m *UserMutation) OldPwdSalt(ctx context.Context) (v string, err error)

OldPwdSalt returns the old "pwd_salt" 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) OldStatus

func (m *UserMutation) OldStatus(ctx context.Context) (v user.Status, err error)

OldStatus returns the old "status" 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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" 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) Phone

func (m *UserMutation) Phone() (r string, exists bool)

Phone returns the value of the "phone" field in the mutation.

func (*UserMutation) PhoneCleared

func (m *UserMutation) PhoneCleared() bool

PhoneCleared returns if the "phone" field was cleared in this mutation.

func (*UserMutation) PhoneVerified

func (m *UserMutation) PhoneVerified() (r bool, exists bool)

PhoneVerified returns the value of the "phone_verified" field in the mutation.

func (*UserMutation) PwdHash

func (m *UserMutation) PwdHash() (r string, exists bool)

PwdHash returns the value of the "pwd_hash" field in the mutation.

func (*UserMutation) PwdSalt

func (m *UserMutation) PwdSalt() (r string, exists bool)

PwdSalt returns the value of the "pwd_salt" field in the mutation.

func (*UserMutation) RemoveAuditLogIDs

func (m *UserMutation) RemoveAuditLogIDs(ids ...int64)

RemoveAuditLogIDs removes the "audit_logs" edge to the Audit entity by IDs.

func (*UserMutation) RemoveSessionIDs

func (m *UserMutation) RemoveSessionIDs(ids ...int64)

RemoveSessionIDs removes the "sessions" edge to the UserSession entity by IDs.

func (*UserMutation) RemoveVerifyTokenIDs

func (m *UserMutation) RemoveVerifyTokenIDs(ids ...int64)

RemoveVerifyTokenIDs removes the "verify_tokens" edge to the VerifyToken entity by IDs.

func (*UserMutation) RemovedAuditLogsIDs

func (m *UserMutation) RemovedAuditLogsIDs() (ids []int64)

RemovedAuditLogs returns the removed IDs of the "audit_logs" edge to the Audit entity.

func (*UserMutation) RemovedEdges

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

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

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) RemovedSessionsIDs

func (m *UserMutation) RemovedSessionsIDs() (ids []int64)

RemovedSessions returns the removed IDs of the "sessions" edge to the UserSession entity.

func (*UserMutation) RemovedVerifyTokensIDs

func (m *UserMutation) RemovedVerifyTokensIDs() (ids []int64)

RemovedVerifyTokens returns the removed IDs of the "verify_tokens" edge to the VerifyToken entity.

func (*UserMutation) ResetAuditLogs

func (m *UserMutation) ResetAuditLogs()

ResetAuditLogs resets all changes to the "audit_logs" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

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) ResetEmailVerified

func (m *UserMutation) ResetEmailVerified()

ResetEmailVerified resets all changes to the "email_verified" 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) ResetFirstName

func (m *UserMutation) ResetFirstName()

ResetFirstName resets all changes to the "first_name" field.

func (*UserMutation) ResetLastName

func (m *UserMutation) ResetLastName()

ResetLastName resets all changes to the "last_name" field.

func (*UserMutation) ResetLoginAttemptOn

func (m *UserMutation) ResetLoginAttemptOn()

ResetLoginAttemptOn resets all changes to the "login_attempt_on" field.

func (*UserMutation) ResetLoginFailedCount

func (m *UserMutation) ResetLoginFailedCount()

ResetLoginFailedCount resets all changes to the "login_failed_count" field.

func (*UserMutation) ResetLoginLockedUntil

func (m *UserMutation) ResetLoginLockedUntil()

ResetLoginLockedUntil resets all changes to the "login_locked_until" field.

func (*UserMutation) ResetMiddleName

func (m *UserMutation) ResetMiddleName()

ResetMiddleName resets all changes to the "middle_name" field.

func (*UserMutation) ResetPhone

func (m *UserMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*UserMutation) ResetPhoneVerified

func (m *UserMutation) ResetPhoneVerified()

ResetPhoneVerified resets all changes to the "phone_verified" field.

func (*UserMutation) ResetPwdHash

func (m *UserMutation) ResetPwdHash()

ResetPwdHash resets all changes to the "pwd_hash" field.

func (*UserMutation) ResetPwdSalt

func (m *UserMutation) ResetPwdSalt()

ResetPwdSalt resets all changes to the "pwd_salt" field.

func (*UserMutation) ResetSessions

func (m *UserMutation) ResetSessions()

ResetSessions resets all changes to the "sessions" edge.

func (*UserMutation) ResetStatus

func (m *UserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetVerifyTokens

func (m *UserMutation) ResetVerifyTokens()

ResetVerifyTokens resets all changes to the "verify_tokens" edge.

func (*UserMutation) SessionsCleared

func (m *UserMutation) SessionsCleared() bool

SessionsCleared reports if the "sessions" edge to the UserSession entity was cleared.

func (*UserMutation) SessionsIDs

func (m *UserMutation) SessionsIDs() (ids []int64)

SessionsIDs returns the "sessions" edge IDs in the mutation.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetEmailVerified

func (m *UserMutation) SetEmailVerified(b bool)

SetEmailVerified sets the "email_verified" 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) SetFirstName

func (m *UserMutation) SetFirstName(s string)

SetFirstName sets the "first_name" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id int64)

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

func (*UserMutation) SetLastName

func (m *UserMutation) SetLastName(s string)

SetLastName sets the "last_name" field.

func (*UserMutation) SetLoginAttemptOn

func (m *UserMutation) SetLoginAttemptOn(t time.Time)

SetLoginAttemptOn sets the "login_attempt_on" field.

func (*UserMutation) SetLoginFailedCount

func (m *UserMutation) SetLoginFailedCount(u uint8)

SetLoginFailedCount sets the "login_failed_count" field.

func (*UserMutation) SetLoginLockedUntil

func (m *UserMutation) SetLoginLockedUntil(t time.Time)

SetLoginLockedUntil sets the "login_locked_until" field.

func (*UserMutation) SetMiddleName

func (m *UserMutation) SetMiddleName(s string)

SetMiddleName sets the "middle_name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPhone

func (m *UserMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*UserMutation) SetPhoneVerified

func (m *UserMutation) SetPhoneVerified(b bool)

SetPhoneVerified sets the "phone_verified" field.

func (*UserMutation) SetPwdHash

func (m *UserMutation) SetPwdHash(s string)

SetPwdHash sets the "pwd_hash" field.

func (*UserMutation) SetPwdSalt

func (m *UserMutation) SetPwdSalt(s string)

SetPwdSalt sets the "pwd_salt" field.

func (*UserMutation) SetStatus

func (m *UserMutation) SetStatus(u user.Status)

SetStatus sets the "status" field.

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) Status

func (m *UserMutation) Status() (r user.Status, exists bool)

Status returns the value of the "status" field in the mutation.

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) UpdatedAt

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

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

func (*UserMutation) VerifyTokensCleared

func (m *UserMutation) VerifyTokensCleared() bool

VerifyTokensCleared reports if the "verify_tokens" edge to the VerifyToken entity was cleared.

func (*UserMutation) VerifyTokensIDs

func (m *UserMutation) VerifyTokensIDs() (ids []int64)

VerifyTokensIDs returns the "verify_tokens" edge IDs in the mutation.

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 int64, 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) int64

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

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int64

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 int64, 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) int64

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) QueryAuditLogs

func (uq *UserQuery) QueryAuditLogs() *AuditQuery

QueryAuditLogs chains the current query on the "audit_logs" edge.

func (*UserQuery) QuerySessions

func (uq *UserQuery) QuerySessions() *UserSessionQuery

QuerySessions chains the current query on the "sessions" edge.

func (*UserQuery) QueryVerifyTokens

func (uq *UserQuery) QueryVerifyTokens() *VerifyTokenQuery

QueryVerifyTokens chains the current query on the "verify_tokens" 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 {
	CreatedAt time.Time `json:"createdAt"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	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) WithAuditLogs

func (uq *UserQuery) WithAuditLogs(opts ...func(*AuditQuery)) *UserQuery

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

func (*UserQuery) WithSessions

func (uq *UserQuery) WithSessions(opts ...func(*UserSessionQuery)) *UserQuery

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

func (*UserQuery) WithVerifyTokens

func (uq *UserQuery) WithVerifyTokens(opts ...func(*VerifyTokenQuery)) *UserQuery

WithVerifyTokens tells the query-builder to eager-load the nodes that are connected to the "verify_tokens" 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 UserSession

type UserSession struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// IssuedAt holds the value of the "issued_at" field.
	IssuedAt time.Time `json:"issued_at,omitempty"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Invalidated holds the value of the "invalidated" field.
	Invalidated bool `json:"invalidated,omitempty"`
	// UserAgent holds the value of the "user_agent" field.
	UserAgent string `json:"user_agent,omitempty"`
	// IP holds the value of the "ip" field.
	IP string `json:"ip,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserSessionQuery when eager-loading is set.
	Edges UserSessionEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserSession is the model entity for the UserSession schema.

func (*UserSession) QueryUser

func (us *UserSession) QueryUser() *UserQuery

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

func (*UserSession) String

func (us *UserSession) String() string

String implements the fmt.Stringer.

func (*UserSession) Unwrap

func (us *UserSession) Unwrap() *UserSession

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

func (us *UserSession) Update() *UserSessionUpdateOne

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

func (*UserSession) Value

func (us *UserSession) Value(name string) (ent.Value, error)

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

type UserSessionClient

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

UserSessionClient is a client for the UserSession schema.

func NewUserSessionClient

func NewUserSessionClient(c config) *UserSessionClient

NewUserSessionClient returns a client for the UserSession from the given config.

func (*UserSessionClient) Create

func (c *UserSessionClient) Create() *UserSessionCreate

Create returns a builder for creating a UserSession entity.

func (*UserSessionClient) CreateBulk

func (c *UserSessionClient) CreateBulk(builders ...*UserSessionCreate) *UserSessionCreateBulk

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

func (*UserSessionClient) Delete

func (c *UserSessionClient) Delete() *UserSessionDelete

Delete returns a delete builder for UserSession.

func (*UserSessionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserSessionClient) DeleteOneID

func (c *UserSessionClient) DeleteOneID(id int64) *UserSessionDeleteOne

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

func (*UserSessionClient) Get

Get returns a UserSession entity by its id.

func (*UserSessionClient) GetX

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

func (*UserSessionClient) Hooks

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

Hooks returns the client hooks.

func (*UserSessionClient) Intercept

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

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

func (*UserSessionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserSessionClient) MapCreateBulk

func (c *UserSessionClient) MapCreateBulk(slice any, setFunc func(*UserSessionCreate, int)) *UserSessionCreateBulk

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

func (c *UserSessionClient) Query() *UserSessionQuery

Query returns a query builder for UserSession.

func (*UserSessionClient) QueryUser

func (c *UserSessionClient) QueryUser(us *UserSession) *UserQuery

QueryUser queries the user edge of a UserSession.

func (*UserSessionClient) Update

func (c *UserSessionClient) Update() *UserSessionUpdate

Update returns an update builder for UserSession.

func (*UserSessionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserSessionClient) UpdateOneID

func (c *UserSessionClient) UpdateOneID(id int64) *UserSessionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserSessionClient) Use

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

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

type UserSessionCreate

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

UserSessionCreate is the builder for creating a UserSession entity.

func (*UserSessionCreate) Exec

func (usc *UserSessionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionCreate) ExecX

func (usc *UserSessionCreate) ExecX(ctx context.Context)

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

func (*UserSessionCreate) Mutation

func (usc *UserSessionCreate) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionCreate) Save

func (usc *UserSessionCreate) Save(ctx context.Context) (*UserSession, error)

Save creates the UserSession in the database.

func (*UserSessionCreate) SaveX

func (usc *UserSessionCreate) SaveX(ctx context.Context) *UserSession

SaveX calls Save and panics if Save returns an error.

func (*UserSessionCreate) SetExpiresAt

func (usc *UserSessionCreate) SetExpiresAt(t time.Time) *UserSessionCreate

SetExpiresAt sets the "expires_at" field.

func (*UserSessionCreate) SetID

func (usc *UserSessionCreate) SetID(i int64) *UserSessionCreate

SetID sets the "id" field.

func (*UserSessionCreate) SetIP

SetIP sets the "ip" field.

func (*UserSessionCreate) SetInvalidated

func (usc *UserSessionCreate) SetInvalidated(b bool) *UserSessionCreate

SetInvalidated sets the "invalidated" field.

func (*UserSessionCreate) SetIssuedAt

func (usc *UserSessionCreate) SetIssuedAt(t time.Time) *UserSessionCreate

SetIssuedAt sets the "issued_at" field.

func (*UserSessionCreate) SetNillableInvalidated

func (usc *UserSessionCreate) SetNillableInvalidated(b *bool) *UserSessionCreate

SetNillableInvalidated sets the "invalidated" field if the given value is not nil.

func (*UserSessionCreate) SetUser

func (usc *UserSessionCreate) SetUser(u *User) *UserSessionCreate

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

func (*UserSessionCreate) SetUserAgent

func (usc *UserSessionCreate) SetUserAgent(s string) *UserSessionCreate

SetUserAgent sets the "user_agent" field.

func (*UserSessionCreate) SetUserID

func (usc *UserSessionCreate) SetUserID(id int64) *UserSessionCreate

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

type UserSessionCreateBulk

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

UserSessionCreateBulk is the builder for creating many UserSession entities in bulk.

func (*UserSessionCreateBulk) Exec

func (uscb *UserSessionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionCreateBulk) ExecX

func (uscb *UserSessionCreateBulk) ExecX(ctx context.Context)

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

func (*UserSessionCreateBulk) Save

func (uscb *UserSessionCreateBulk) Save(ctx context.Context) ([]*UserSession, error)

Save creates the UserSession entities in the database.

func (*UserSessionCreateBulk) SaveX

func (uscb *UserSessionCreateBulk) SaveX(ctx context.Context) []*UserSession

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

type UserSessionDelete

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

UserSessionDelete is the builder for deleting a UserSession entity.

func (*UserSessionDelete) Exec

func (usd *UserSessionDelete) Exec(ctx context.Context) (int, error)

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

func (*UserSessionDelete) ExecX

func (usd *UserSessionDelete) ExecX(ctx context.Context) int

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

func (*UserSessionDelete) Where

Where appends a list predicates to the UserSessionDelete builder.

type UserSessionDeleteOne

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

UserSessionDeleteOne is the builder for deleting a single UserSession entity.

func (*UserSessionDeleteOne) Exec

func (usdo *UserSessionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserSessionDeleteOne) ExecX

func (usdo *UserSessionDeleteOne) ExecX(ctx context.Context)

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

func (*UserSessionDeleteOne) Where

Where appends a list predicates to the UserSessionDelete builder.

type UserSessionEdges

type UserSessionEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserSessionEdges) UserOrErr

func (e UserSessionEdges) 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 UserSessionGroupBy

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

UserSessionGroupBy is the group-by builder for UserSession entities.

func (*UserSessionGroupBy) Aggregate

func (usgb *UserSessionGroupBy) Aggregate(fns ...AggregateFunc) *UserSessionGroupBy

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

func (*UserSessionGroupBy) Bool

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

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

func (*UserSessionGroupBy) BoolX

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

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

func (*UserSessionGroupBy) Bools

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

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

func (*UserSessionGroupBy) BoolsX

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

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

func (*UserSessionGroupBy) Float64

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

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

func (*UserSessionGroupBy) Float64X

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

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

func (*UserSessionGroupBy) Float64s

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

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

func (*UserSessionGroupBy) Float64sX

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

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

func (*UserSessionGroupBy) Int

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

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

func (*UserSessionGroupBy) IntX

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

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

func (*UserSessionGroupBy) Ints

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

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

func (*UserSessionGroupBy) IntsX

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

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

func (*UserSessionGroupBy) Scan

func (usgb *UserSessionGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserSessionGroupBy) ScanX

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

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

func (*UserSessionGroupBy) String

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

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

func (*UserSessionGroupBy) StringX

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

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

func (*UserSessionGroupBy) Strings

func (s *UserSessionGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSessionGroupBy) StringsX

func (s *UserSessionGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserSessionMutation

type UserSessionMutation struct {
	// contains filtered or unexported fields
}

UserSessionMutation represents an operation that mutates the UserSession nodes in the graph.

func (*UserSessionMutation) AddField

func (m *UserSessionMutation) 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 (*UserSessionMutation) AddedEdges

func (m *UserSessionMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserSessionMutation) AddedField

func (m *UserSessionMutation) 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 (*UserSessionMutation) AddedFields

func (m *UserSessionMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserSessionMutation) AddedIDs

func (m *UserSessionMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserSessionMutation) ClearEdge

func (m *UserSessionMutation) 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 (*UserSessionMutation) ClearField

func (m *UserSessionMutation) 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 (*UserSessionMutation) ClearInvalidated

func (m *UserSessionMutation) ClearInvalidated()

ClearInvalidated clears the value of the "invalidated" field.

func (*UserSessionMutation) ClearUser

func (m *UserSessionMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserSessionMutation) ClearedEdges

func (m *UserSessionMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserSessionMutation) ClearedFields

func (m *UserSessionMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserSessionMutation) Client

func (m UserSessionMutation) 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 (*UserSessionMutation) EdgeCleared

func (m *UserSessionMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserSessionMutation) ExpiresAt

func (m *UserSessionMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*UserSessionMutation) Field

func (m *UserSessionMutation) 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 (*UserSessionMutation) FieldCleared

func (m *UserSessionMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserSessionMutation) Fields

func (m *UserSessionMutation) 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 (*UserSessionMutation) ID

func (m *UserSessionMutation) ID() (id int64, 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 (*UserSessionMutation) IDs

func (m *UserSessionMutation) IDs(ctx context.Context) ([]int64, 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 (*UserSessionMutation) IP

func (m *UserSessionMutation) IP() (r string, exists bool)

IP returns the value of the "ip" field in the mutation.

func (*UserSessionMutation) Invalidated

func (m *UserSessionMutation) Invalidated() (r bool, exists bool)

Invalidated returns the value of the "invalidated" field in the mutation.

func (*UserSessionMutation) InvalidatedCleared

func (m *UserSessionMutation) InvalidatedCleared() bool

InvalidatedCleared returns if the "invalidated" field was cleared in this mutation.

func (*UserSessionMutation) IssuedAt

func (m *UserSessionMutation) IssuedAt() (r time.Time, exists bool)

IssuedAt returns the value of the "issued_at" field in the mutation.

func (*UserSessionMutation) OldExpiresAt

func (m *UserSessionMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the UserSession entity. If the UserSession 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 (*UserSessionMutation) OldField

func (m *UserSessionMutation) 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 (*UserSessionMutation) OldIP

func (m *UserSessionMutation) OldIP(ctx context.Context) (v string, err error)

OldIP returns the old "ip" field's value of the UserSession entity. If the UserSession 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 (*UserSessionMutation) OldInvalidated

func (m *UserSessionMutation) OldInvalidated(ctx context.Context) (v bool, err error)

OldInvalidated returns the old "invalidated" field's value of the UserSession entity. If the UserSession 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 (*UserSessionMutation) OldIssuedAt

func (m *UserSessionMutation) OldIssuedAt(ctx context.Context) (v time.Time, err error)

OldIssuedAt returns the old "issued_at" field's value of the UserSession entity. If the UserSession 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 (*UserSessionMutation) OldUserAgent

func (m *UserSessionMutation) OldUserAgent(ctx context.Context) (v string, err error)

OldUserAgent returns the old "user_agent" field's value of the UserSession entity. If the UserSession 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 (*UserSessionMutation) Op

func (m *UserSessionMutation) Op() Op

Op returns the operation name.

func (*UserSessionMutation) RemovedEdges

func (m *UserSessionMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserSessionMutation) RemovedIDs

func (m *UserSessionMutation) 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 (*UserSessionMutation) ResetEdge

func (m *UserSessionMutation) 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 (*UserSessionMutation) ResetExpiresAt

func (m *UserSessionMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*UserSessionMutation) ResetField

func (m *UserSessionMutation) 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 (*UserSessionMutation) ResetIP

func (m *UserSessionMutation) ResetIP()

ResetIP resets all changes to the "ip" field.

func (*UserSessionMutation) ResetInvalidated

func (m *UserSessionMutation) ResetInvalidated()

ResetInvalidated resets all changes to the "invalidated" field.

func (*UserSessionMutation) ResetIssuedAt

func (m *UserSessionMutation) ResetIssuedAt()

ResetIssuedAt resets all changes to the "issued_at" field.

func (*UserSessionMutation) ResetUser

func (m *UserSessionMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserSessionMutation) ResetUserAgent

func (m *UserSessionMutation) ResetUserAgent()

ResetUserAgent resets all changes to the "user_agent" field.

func (*UserSessionMutation) SetExpiresAt

func (m *UserSessionMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*UserSessionMutation) SetField

func (m *UserSessionMutation) 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 (*UserSessionMutation) SetID

func (m *UserSessionMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of UserSession entities.

func (*UserSessionMutation) SetIP

func (m *UserSessionMutation) SetIP(s string)

SetIP sets the "ip" field.

func (*UserSessionMutation) SetInvalidated

func (m *UserSessionMutation) SetInvalidated(b bool)

SetInvalidated sets the "invalidated" field.

func (*UserSessionMutation) SetIssuedAt

func (m *UserSessionMutation) SetIssuedAt(t time.Time)

SetIssuedAt sets the "issued_at" field.

func (*UserSessionMutation) SetOp

func (m *UserSessionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserSessionMutation) SetUserAgent

func (m *UserSessionMutation) SetUserAgent(s string)

SetUserAgent sets the "user_agent" field.

func (*UserSessionMutation) SetUserID

func (m *UserSessionMutation) SetUserID(id int64)

SetUserID sets the "user" edge to the User entity by id.

func (UserSessionMutation) Tx

func (m UserSessionMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserSessionMutation) Type

func (m *UserSessionMutation) Type() string

Type returns the node type of this mutation (UserSession).

func (*UserSessionMutation) UserAgent

func (m *UserSessionMutation) UserAgent() (r string, exists bool)

UserAgent returns the value of the "user_agent" field in the mutation.

func (*UserSessionMutation) UserCleared

func (m *UserSessionMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserSessionMutation) UserID

func (m *UserSessionMutation) UserID() (id int64, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*UserSessionMutation) UserIDs

func (m *UserSessionMutation) UserIDs() (ids []int64)

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 (*UserSessionMutation) Where

func (m *UserSessionMutation) Where(ps ...predicate.UserSession)

Where appends a list predicates to the UserSessionMutation builder.

func (*UserSessionMutation) WhereP

func (m *UserSessionMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserSessionMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserSessionQuery

type UserSessionQuery struct {
	// contains filtered or unexported fields
}

UserSessionQuery is the builder for querying UserSession entities.

func (*UserSessionQuery) Aggregate

func (usq *UserSessionQuery) Aggregate(fns ...AggregateFunc) *UserSessionSelect

Aggregate returns a UserSessionSelect configured with the given aggregations.

func (*UserSessionQuery) All

func (usq *UserSessionQuery) All(ctx context.Context) ([]*UserSession, error)

All executes the query and returns a list of UserSessions.

func (*UserSessionQuery) AllX

func (usq *UserSessionQuery) AllX(ctx context.Context) []*UserSession

AllX is like All, but panics if an error occurs.

func (*UserSessionQuery) Clone

func (usq *UserSessionQuery) Clone() *UserSessionQuery

Clone returns a duplicate of the UserSessionQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserSessionQuery) Count

func (usq *UserSessionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserSessionQuery) CountX

func (usq *UserSessionQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserSessionQuery) Exist

func (usq *UserSessionQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserSessionQuery) ExistX

func (usq *UserSessionQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserSessionQuery) First

func (usq *UserSessionQuery) First(ctx context.Context) (*UserSession, error)

First returns the first UserSession entity from the query. Returns a *NotFoundError when no UserSession was found.

func (*UserSessionQuery) FirstID

func (usq *UserSessionQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first UserSession ID from the query. Returns a *NotFoundError when no UserSession ID was found.

func (*UserSessionQuery) FirstIDX

func (usq *UserSessionQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserSessionQuery) FirstX

func (usq *UserSessionQuery) FirstX(ctx context.Context) *UserSession

FirstX is like First, but panics if an error occurs.

func (*UserSessionQuery) GroupBy

func (usq *UserSessionQuery) GroupBy(field string, fields ...string) *UserSessionGroupBy

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 {
	IssuedAt time.Time `json:"issued_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserSession.Query().
	GroupBy(usersession.FieldIssuedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserSessionQuery) IDs

func (usq *UserSessionQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of UserSession IDs.

func (*UserSessionQuery) IDsX

func (usq *UserSessionQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*UserSessionQuery) Limit

func (usq *UserSessionQuery) Limit(limit int) *UserSessionQuery

Limit the number of records to be returned by this query.

func (*UserSessionQuery) Offset

func (usq *UserSessionQuery) Offset(offset int) *UserSessionQuery

Offset to start from.

func (*UserSessionQuery) Only

func (usq *UserSessionQuery) Only(ctx context.Context) (*UserSession, error)

Only returns a single UserSession entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserSession entity is found. Returns a *NotFoundError when no UserSession entities are found.

func (*UserSessionQuery) OnlyID

func (usq *UserSessionQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only UserSession ID in the query. Returns a *NotSingularError when more than one UserSession ID is found. Returns a *NotFoundError when no entities are found.

func (*UserSessionQuery) OnlyIDX

func (usq *UserSessionQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserSessionQuery) OnlyX

func (usq *UserSessionQuery) OnlyX(ctx context.Context) *UserSession

OnlyX is like Only, but panics if an error occurs.

func (*UserSessionQuery) Order

Order specifies how the records should be ordered.

func (*UserSessionQuery) QueryUser

func (usq *UserSessionQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserSessionQuery) Select

func (usq *UserSessionQuery) Select(fields ...string) *UserSessionSelect

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 {
	IssuedAt time.Time `json:"issued_at,omitempty"`
}

client.UserSession.Query().
	Select(usersession.FieldIssuedAt).
	Scan(ctx, &v)

func (*UserSessionQuery) Unique

func (usq *UserSessionQuery) Unique(unique bool) *UserSessionQuery

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 (*UserSessionQuery) Where

Where adds a new predicate for the UserSessionQuery builder.

func (*UserSessionQuery) WithUser

func (usq *UserSessionQuery) WithUser(opts ...func(*UserQuery)) *UserSessionQuery

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 UserSessionSelect

type UserSessionSelect struct {
	*UserSessionQuery
	// contains filtered or unexported fields
}

UserSessionSelect is the builder for selecting fields of UserSession entities.

func (*UserSessionSelect) Aggregate

func (uss *UserSessionSelect) Aggregate(fns ...AggregateFunc) *UserSessionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSessionSelect) Bool

func (s *UserSessionSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) BoolX

func (s *UserSessionSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSessionSelect) Bools

func (s *UserSessionSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) BoolsX

func (s *UserSessionSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSessionSelect) Float64

func (s *UserSessionSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) Float64X

func (s *UserSessionSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSessionSelect) Float64s

func (s *UserSessionSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) Float64sX

func (s *UserSessionSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSessionSelect) Int

func (s *UserSessionSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) IntX

func (s *UserSessionSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSessionSelect) Ints

func (s *UserSessionSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) IntsX

func (s *UserSessionSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSessionSelect) Scan

func (uss *UserSessionSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSessionSelect) ScanX

func (s *UserSessionSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSessionSelect) String

func (s *UserSessionSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) StringX

func (s *UserSessionSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSessionSelect) Strings

func (s *UserSessionSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSessionSelect) StringsX

func (s *UserSessionSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserSessionUpdate

type UserSessionUpdate struct {
	// contains filtered or unexported fields
}

UserSessionUpdate is the builder for updating UserSession entities.

func (*UserSessionUpdate) ClearInvalidated

func (usu *UserSessionUpdate) ClearInvalidated() *UserSessionUpdate

ClearInvalidated clears the value of the "invalidated" field.

func (*UserSessionUpdate) ClearUser

func (usu *UserSessionUpdate) ClearUser() *UserSessionUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserSessionUpdate) Exec

func (usu *UserSessionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserSessionUpdate) ExecX

func (usu *UserSessionUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionUpdate) Mutation

func (usu *UserSessionUpdate) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionUpdate) Save

func (usu *UserSessionUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserSessionUpdate) SaveX

func (usu *UserSessionUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserSessionUpdate) SetExpiresAt

func (usu *UserSessionUpdate) SetExpiresAt(t time.Time) *UserSessionUpdate

SetExpiresAt sets the "expires_at" field.

func (*UserSessionUpdate) SetIP

SetIP sets the "ip" field.

func (*UserSessionUpdate) SetInvalidated

func (usu *UserSessionUpdate) SetInvalidated(b bool) *UserSessionUpdate

SetInvalidated sets the "invalidated" field.

func (*UserSessionUpdate) SetIssuedAt

func (usu *UserSessionUpdate) SetIssuedAt(t time.Time) *UserSessionUpdate

SetIssuedAt sets the "issued_at" field.

func (*UserSessionUpdate) SetNillableExpiresAt

func (usu *UserSessionUpdate) SetNillableExpiresAt(t *time.Time) *UserSessionUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*UserSessionUpdate) SetNillableIP

func (usu *UserSessionUpdate) SetNillableIP(s *string) *UserSessionUpdate

SetNillableIP sets the "ip" field if the given value is not nil.

func (*UserSessionUpdate) SetNillableInvalidated

func (usu *UserSessionUpdate) SetNillableInvalidated(b *bool) *UserSessionUpdate

SetNillableInvalidated sets the "invalidated" field if the given value is not nil.

func (*UserSessionUpdate) SetNillableIssuedAt

func (usu *UserSessionUpdate) SetNillableIssuedAt(t *time.Time) *UserSessionUpdate

SetNillableIssuedAt sets the "issued_at" field if the given value is not nil.

func (*UserSessionUpdate) SetNillableUserAgent

func (usu *UserSessionUpdate) SetNillableUserAgent(s *string) *UserSessionUpdate

SetNillableUserAgent sets the "user_agent" field if the given value is not nil.

func (*UserSessionUpdate) SetUser

func (usu *UserSessionUpdate) SetUser(u *User) *UserSessionUpdate

SetUser sets the "user" edge to the User entity.

func (*UserSessionUpdate) SetUserAgent

func (usu *UserSessionUpdate) SetUserAgent(s string) *UserSessionUpdate

SetUserAgent sets the "user_agent" field.

func (*UserSessionUpdate) SetUserID

func (usu *UserSessionUpdate) SetUserID(id int64) *UserSessionUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*UserSessionUpdate) Where

Where appends a list predicates to the UserSessionUpdate builder.

type UserSessionUpdateOne

type UserSessionUpdateOne struct {
	// contains filtered or unexported fields
}

UserSessionUpdateOne is the builder for updating a single UserSession entity.

func (*UserSessionUpdateOne) ClearInvalidated

func (usuo *UserSessionUpdateOne) ClearInvalidated() *UserSessionUpdateOne

ClearInvalidated clears the value of the "invalidated" field.

func (*UserSessionUpdateOne) ClearUser

func (usuo *UserSessionUpdateOne) ClearUser() *UserSessionUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserSessionUpdateOne) Exec

func (usuo *UserSessionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserSessionUpdateOne) ExecX

func (usuo *UserSessionUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserSessionUpdateOne) Mutation

func (usuo *UserSessionUpdateOne) Mutation() *UserSessionMutation

Mutation returns the UserSessionMutation object of the builder.

func (*UserSessionUpdateOne) Save

Save executes the query and returns the updated UserSession entity.

func (*UserSessionUpdateOne) SaveX

func (usuo *UserSessionUpdateOne) SaveX(ctx context.Context) *UserSession

SaveX is like Save, but panics if an error occurs.

func (*UserSessionUpdateOne) Select

func (usuo *UserSessionUpdateOne) Select(field string, fields ...string) *UserSessionUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserSessionUpdateOne) SetExpiresAt

func (usuo *UserSessionUpdateOne) SetExpiresAt(t time.Time) *UserSessionUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*UserSessionUpdateOne) SetIP

SetIP sets the "ip" field.

func (*UserSessionUpdateOne) SetInvalidated

func (usuo *UserSessionUpdateOne) SetInvalidated(b bool) *UserSessionUpdateOne

SetInvalidated sets the "invalidated" field.

func (*UserSessionUpdateOne) SetIssuedAt

func (usuo *UserSessionUpdateOne) SetIssuedAt(t time.Time) *UserSessionUpdateOne

SetIssuedAt sets the "issued_at" field.

func (*UserSessionUpdateOne) SetNillableExpiresAt

func (usuo *UserSessionUpdateOne) SetNillableExpiresAt(t *time.Time) *UserSessionUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*UserSessionUpdateOne) SetNillableIP

func (usuo *UserSessionUpdateOne) SetNillableIP(s *string) *UserSessionUpdateOne

SetNillableIP sets the "ip" field if the given value is not nil.

func (*UserSessionUpdateOne) SetNillableInvalidated

func (usuo *UserSessionUpdateOne) SetNillableInvalidated(b *bool) *UserSessionUpdateOne

SetNillableInvalidated sets the "invalidated" field if the given value is not nil.

func (*UserSessionUpdateOne) SetNillableIssuedAt

func (usuo *UserSessionUpdateOne) SetNillableIssuedAt(t *time.Time) *UserSessionUpdateOne

SetNillableIssuedAt sets the "issued_at" field if the given value is not nil.

func (*UserSessionUpdateOne) SetNillableUserAgent

func (usuo *UserSessionUpdateOne) SetNillableUserAgent(s *string) *UserSessionUpdateOne

SetNillableUserAgent sets the "user_agent" field if the given value is not nil.

func (*UserSessionUpdateOne) SetUser

func (usuo *UserSessionUpdateOne) SetUser(u *User) *UserSessionUpdateOne

SetUser sets the "user" edge to the User entity.

func (*UserSessionUpdateOne) SetUserAgent

func (usuo *UserSessionUpdateOne) SetUserAgent(s string) *UserSessionUpdateOne

SetUserAgent sets the "user_agent" field.

func (*UserSessionUpdateOne) SetUserID

func (usuo *UserSessionUpdateOne) SetUserID(id int64) *UserSessionUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*UserSessionUpdateOne) Where

Where appends a list predicates to the UserSessionUpdate builder.

type UserSessions

type UserSessions []*UserSession

UserSessions is a parsable slice of UserSession.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAuditLogIDs

func (uu *UserUpdate) AddAuditLogIDs(ids ...int64) *UserUpdate

AddAuditLogIDs adds the "audit_logs" edge to the Audit entity by IDs.

func (*UserUpdate) AddAuditLogs

func (uu *UserUpdate) AddAuditLogs(a ...*Audit) *UserUpdate

AddAuditLogs adds the "audit_logs" edges to the Audit entity.

func (*UserUpdate) AddLoginFailedCount

func (uu *UserUpdate) AddLoginFailedCount(u int8) *UserUpdate

AddLoginFailedCount adds u to the "login_failed_count" field.

func (*UserUpdate) AddSessionIDs

func (uu *UserUpdate) AddSessionIDs(ids ...int64) *UserUpdate

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserUpdate) AddSessions

func (uu *UserUpdate) AddSessions(u ...*UserSession) *UserUpdate

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserUpdate) AddVerifyTokenIDs

func (uu *UserUpdate) AddVerifyTokenIDs(ids ...int64) *UserUpdate

AddVerifyTokenIDs adds the "verify_tokens" edge to the VerifyToken entity by IDs.

func (*UserUpdate) AddVerifyTokens

func (uu *UserUpdate) AddVerifyTokens(v ...*VerifyToken) *UserUpdate

AddVerifyTokens adds the "verify_tokens" edges to the VerifyToken entity.

func (*UserUpdate) ClearAuditLogs

func (uu *UserUpdate) ClearAuditLogs() *UserUpdate

ClearAuditLogs clears all "audit_logs" edges to the Audit entity.

func (*UserUpdate) ClearLoginAttemptOn

func (uu *UserUpdate) ClearLoginAttemptOn() *UserUpdate

ClearLoginAttemptOn clears the value of the "login_attempt_on" field.

func (*UserUpdate) ClearLoginFailedCount

func (uu *UserUpdate) ClearLoginFailedCount() *UserUpdate

ClearLoginFailedCount clears the value of the "login_failed_count" field.

func (*UserUpdate) ClearLoginLockedUntil

func (uu *UserUpdate) ClearLoginLockedUntil() *UserUpdate

ClearLoginLockedUntil clears the value of the "login_locked_until" field.

func (*UserUpdate) ClearPhone

func (uu *UserUpdate) ClearPhone() *UserUpdate

ClearPhone clears the value of the "phone" field.

func (*UserUpdate) ClearSessions

func (uu *UserUpdate) ClearSessions() *UserUpdate

ClearSessions clears all "sessions" edges to the UserSession entity.

func (*UserUpdate) ClearVerifyTokens

func (uu *UserUpdate) ClearVerifyTokens() *UserUpdate

ClearVerifyTokens clears all "verify_tokens" edges to the VerifyToken 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) RemoveAuditLogIDs

func (uu *UserUpdate) RemoveAuditLogIDs(ids ...int64) *UserUpdate

RemoveAuditLogIDs removes the "audit_logs" edge to Audit entities by IDs.

func (*UserUpdate) RemoveAuditLogs

func (uu *UserUpdate) RemoveAuditLogs(a ...*Audit) *UserUpdate

RemoveAuditLogs removes "audit_logs" edges to Audit entities.

func (*UserUpdate) RemoveSessionIDs

func (uu *UserUpdate) RemoveSessionIDs(ids ...int64) *UserUpdate

RemoveSessionIDs removes the "sessions" edge to UserSession entities by IDs.

func (*UserUpdate) RemoveSessions

func (uu *UserUpdate) RemoveSessions(u ...*UserSession) *UserUpdate

RemoveSessions removes "sessions" edges to UserSession entities.

func (*UserUpdate) RemoveVerifyTokenIDs

func (uu *UserUpdate) RemoveVerifyTokenIDs(ids ...int64) *UserUpdate

RemoveVerifyTokenIDs removes the "verify_tokens" edge to VerifyToken entities by IDs.

func (*UserUpdate) RemoveVerifyTokens

func (uu *UserUpdate) RemoveVerifyTokens(v ...*VerifyToken) *UserUpdate

RemoveVerifyTokens removes "verify_tokens" edges to VerifyToken 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) SetEmailVerified

func (uu *UserUpdate) SetEmailVerified(b bool) *UserUpdate

SetEmailVerified sets the "email_verified" field.

func (*UserUpdate) SetFirstName

func (uu *UserUpdate) SetFirstName(s string) *UserUpdate

SetFirstName sets the "first_name" field.

func (*UserUpdate) SetLastName

func (uu *UserUpdate) SetLastName(s string) *UserUpdate

SetLastName sets the "last_name" field.

func (*UserUpdate) SetLoginAttemptOn

func (uu *UserUpdate) SetLoginAttemptOn(t time.Time) *UserUpdate

SetLoginAttemptOn sets the "login_attempt_on" field.

func (*UserUpdate) SetLoginFailedCount

func (uu *UserUpdate) SetLoginFailedCount(u uint8) *UserUpdate

SetLoginFailedCount sets the "login_failed_count" field.

func (*UserUpdate) SetLoginLockedUntil

func (uu *UserUpdate) SetLoginLockedUntil(t time.Time) *UserUpdate

SetLoginLockedUntil sets the "login_locked_until" field.

func (*UserUpdate) SetMiddleName

func (uu *UserUpdate) SetMiddleName(s string) *UserUpdate

SetMiddleName sets the "middle_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) SetNillableEmailVerified

func (uu *UserUpdate) SetNillableEmailVerified(b *bool) *UserUpdate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserUpdate) SetNillableFirstName

func (uu *UserUpdate) SetNillableFirstName(s *string) *UserUpdate

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*UserUpdate) SetNillableLastName

func (uu *UserUpdate) SetNillableLastName(s *string) *UserUpdate

SetNillableLastName sets the "last_name" field if the given value is not nil.

func (*UserUpdate) SetNillableLoginAttemptOn

func (uu *UserUpdate) SetNillableLoginAttemptOn(t *time.Time) *UserUpdate

SetNillableLoginAttemptOn sets the "login_attempt_on" field if the given value is not nil.

func (*UserUpdate) SetNillableLoginFailedCount

func (uu *UserUpdate) SetNillableLoginFailedCount(u *uint8) *UserUpdate

SetNillableLoginFailedCount sets the "login_failed_count" field if the given value is not nil.

func (*UserUpdate) SetNillableLoginLockedUntil

func (uu *UserUpdate) SetNillableLoginLockedUntil(t *time.Time) *UserUpdate

SetNillableLoginLockedUntil sets the "login_locked_until" field if the given value is not nil.

func (*UserUpdate) SetNillableMiddleName

func (uu *UserUpdate) SetNillableMiddleName(s *string) *UserUpdate

SetNillableMiddleName sets the "middle_name" field if the given value is not nil.

func (*UserUpdate) SetNillablePhone

func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdate) SetNillablePhoneVerified

func (uu *UserUpdate) SetNillablePhoneVerified(b *bool) *UserUpdate

SetNillablePhoneVerified sets the "phone_verified" field if the given value is not nil.

func (*UserUpdate) SetNillablePwdHash

func (uu *UserUpdate) SetNillablePwdHash(s *string) *UserUpdate

SetNillablePwdHash sets the "pwd_hash" field if the given value is not nil.

func (*UserUpdate) SetNillablePwdSalt

func (uu *UserUpdate) SetNillablePwdSalt(s *string) *UserUpdate

SetNillablePwdSalt sets the "pwd_salt" field if the given value is not nil.

func (*UserUpdate) SetNillableStatus

func (uu *UserUpdate) SetNillableStatus(u *user.Status) *UserUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdate) SetPhone

func (uu *UserUpdate) SetPhone(s string) *UserUpdate

SetPhone sets the "phone" field.

func (*UserUpdate) SetPhoneVerified

func (uu *UserUpdate) SetPhoneVerified(b bool) *UserUpdate

SetPhoneVerified sets the "phone_verified" field.

func (*UserUpdate) SetPwdHash

func (uu *UserUpdate) SetPwdHash(s string) *UserUpdate

SetPwdHash sets the "pwd_hash" field.

func (*UserUpdate) SetPwdSalt

func (uu *UserUpdate) SetPwdSalt(s string) *UserUpdate

SetPwdSalt sets the "pwd_salt" field.

func (*UserUpdate) SetStatus

func (uu *UserUpdate) SetStatus(u user.Status) *UserUpdate

SetStatus sets the "status" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

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) AddAuditLogIDs

func (uuo *UserUpdateOne) AddAuditLogIDs(ids ...int64) *UserUpdateOne

AddAuditLogIDs adds the "audit_logs" edge to the Audit entity by IDs.

func (*UserUpdateOne) AddAuditLogs

func (uuo *UserUpdateOne) AddAuditLogs(a ...*Audit) *UserUpdateOne

AddAuditLogs adds the "audit_logs" edges to the Audit entity.

func (*UserUpdateOne) AddLoginFailedCount

func (uuo *UserUpdateOne) AddLoginFailedCount(u int8) *UserUpdateOne

AddLoginFailedCount adds u to the "login_failed_count" field.

func (*UserUpdateOne) AddSessionIDs

func (uuo *UserUpdateOne) AddSessionIDs(ids ...int64) *UserUpdateOne

AddSessionIDs adds the "sessions" edge to the UserSession entity by IDs.

func (*UserUpdateOne) AddSessions

func (uuo *UserUpdateOne) AddSessions(u ...*UserSession) *UserUpdateOne

AddSessions adds the "sessions" edges to the UserSession entity.

func (*UserUpdateOne) AddVerifyTokenIDs

func (uuo *UserUpdateOne) AddVerifyTokenIDs(ids ...int64) *UserUpdateOne

AddVerifyTokenIDs adds the "verify_tokens" edge to the VerifyToken entity by IDs.

func (*UserUpdateOne) AddVerifyTokens

func (uuo *UserUpdateOne) AddVerifyTokens(v ...*VerifyToken) *UserUpdateOne

AddVerifyTokens adds the "verify_tokens" edges to the VerifyToken entity.

func (*UserUpdateOne) ClearAuditLogs

func (uuo *UserUpdateOne) ClearAuditLogs() *UserUpdateOne

ClearAuditLogs clears all "audit_logs" edges to the Audit entity.

func (*UserUpdateOne) ClearLoginAttemptOn

func (uuo *UserUpdateOne) ClearLoginAttemptOn() *UserUpdateOne

ClearLoginAttemptOn clears the value of the "login_attempt_on" field.

func (*UserUpdateOne) ClearLoginFailedCount

func (uuo *UserUpdateOne) ClearLoginFailedCount() *UserUpdateOne

ClearLoginFailedCount clears the value of the "login_failed_count" field.

func (*UserUpdateOne) ClearLoginLockedUntil

func (uuo *UserUpdateOne) ClearLoginLockedUntil() *UserUpdateOne

ClearLoginLockedUntil clears the value of the "login_locked_until" field.

func (*UserUpdateOne) ClearPhone

func (uuo *UserUpdateOne) ClearPhone() *UserUpdateOne

ClearPhone clears the value of the "phone" field.

func (*UserUpdateOne) ClearSessions

func (uuo *UserUpdateOne) ClearSessions() *UserUpdateOne

ClearSessions clears all "sessions" edges to the UserSession entity.

func (*UserUpdateOne) ClearVerifyTokens

func (uuo *UserUpdateOne) ClearVerifyTokens() *UserUpdateOne

ClearVerifyTokens clears all "verify_tokens" edges to the VerifyToken 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) RemoveAuditLogIDs

func (uuo *UserUpdateOne) RemoveAuditLogIDs(ids ...int64) *UserUpdateOne

RemoveAuditLogIDs removes the "audit_logs" edge to Audit entities by IDs.

func (*UserUpdateOne) RemoveAuditLogs

func (uuo *UserUpdateOne) RemoveAuditLogs(a ...*Audit) *UserUpdateOne

RemoveAuditLogs removes "audit_logs" edges to Audit entities.

func (*UserUpdateOne) RemoveSessionIDs

func (uuo *UserUpdateOne) RemoveSessionIDs(ids ...int64) *UserUpdateOne

RemoveSessionIDs removes the "sessions" edge to UserSession entities by IDs.

func (*UserUpdateOne) RemoveSessions

func (uuo *UserUpdateOne) RemoveSessions(u ...*UserSession) *UserUpdateOne

RemoveSessions removes "sessions" edges to UserSession entities.

func (*UserUpdateOne) RemoveVerifyTokenIDs

func (uuo *UserUpdateOne) RemoveVerifyTokenIDs(ids ...int64) *UserUpdateOne

RemoveVerifyTokenIDs removes the "verify_tokens" edge to VerifyToken entities by IDs.

func (*UserUpdateOne) RemoveVerifyTokens

func (uuo *UserUpdateOne) RemoveVerifyTokens(v ...*VerifyToken) *UserUpdateOne

RemoveVerifyTokens removes "verify_tokens" edges to VerifyToken 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) SetEmailVerified

func (uuo *UserUpdateOne) SetEmailVerified(b bool) *UserUpdateOne

SetEmailVerified sets the "email_verified" field.

func (*UserUpdateOne) SetFirstName

func (uuo *UserUpdateOne) SetFirstName(s string) *UserUpdateOne

SetFirstName sets the "first_name" field.

func (*UserUpdateOne) SetLastName

func (uuo *UserUpdateOne) SetLastName(s string) *UserUpdateOne

SetLastName sets the "last_name" field.

func (*UserUpdateOne) SetLoginAttemptOn

func (uuo *UserUpdateOne) SetLoginAttemptOn(t time.Time) *UserUpdateOne

SetLoginAttemptOn sets the "login_attempt_on" field.

func (*UserUpdateOne) SetLoginFailedCount

func (uuo *UserUpdateOne) SetLoginFailedCount(u uint8) *UserUpdateOne

SetLoginFailedCount sets the "login_failed_count" field.

func (*UserUpdateOne) SetLoginLockedUntil

func (uuo *UserUpdateOne) SetLoginLockedUntil(t time.Time) *UserUpdateOne

SetLoginLockedUntil sets the "login_locked_until" field.

func (*UserUpdateOne) SetMiddleName

func (uuo *UserUpdateOne) SetMiddleName(s string) *UserUpdateOne

SetMiddleName sets the "middle_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) SetNillableEmailVerified

func (uuo *UserUpdateOne) SetNillableEmailVerified(b *bool) *UserUpdateOne

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserUpdateOne) SetNillableFirstName

func (uuo *UserUpdateOne) SetNillableFirstName(s *string) *UserUpdateOne

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLastName

func (uuo *UserUpdateOne) SetNillableLastName(s *string) *UserUpdateOne

SetNillableLastName sets the "last_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLoginAttemptOn

func (uuo *UserUpdateOne) SetNillableLoginAttemptOn(t *time.Time) *UserUpdateOne

SetNillableLoginAttemptOn sets the "login_attempt_on" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLoginFailedCount

func (uuo *UserUpdateOne) SetNillableLoginFailedCount(u *uint8) *UserUpdateOne

SetNillableLoginFailedCount sets the "login_failed_count" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLoginLockedUntil

func (uuo *UserUpdateOne) SetNillableLoginLockedUntil(t *time.Time) *UserUpdateOne

SetNillableLoginLockedUntil sets the "login_locked_until" field if the given value is not nil.

func (*UserUpdateOne) SetNillableMiddleName

func (uuo *UserUpdateOne) SetNillableMiddleName(s *string) *UserUpdateOne

SetNillableMiddleName sets the "middle_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhone

func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhoneVerified

func (uuo *UserUpdateOne) SetNillablePhoneVerified(b *bool) *UserUpdateOne

SetNillablePhoneVerified sets the "phone_verified" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePwdHash

func (uuo *UserUpdateOne) SetNillablePwdHash(s *string) *UserUpdateOne

SetNillablePwdHash sets the "pwd_hash" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePwdSalt

func (uuo *UserUpdateOne) SetNillablePwdSalt(s *string) *UserUpdateOne

SetNillablePwdSalt sets the "pwd_salt" field if the given value is not nil.

func (*UserUpdateOne) SetNillableStatus

func (uuo *UserUpdateOne) SetNillableStatus(u *user.Status) *UserUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdateOne) SetPhone

func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne

SetPhone sets the "phone" field.

func (*UserUpdateOne) SetPhoneVerified

func (uuo *UserUpdateOne) SetPhoneVerified(b bool) *UserUpdateOne

SetPhoneVerified sets the "phone_verified" field.

func (*UserUpdateOne) SetPwdHash

func (uuo *UserUpdateOne) SetPwdHash(s string) *UserUpdateOne

SetPwdHash sets the "pwd_hash" field.

func (*UserUpdateOne) SetPwdSalt

func (uuo *UserUpdateOne) SetPwdSalt(s string) *UserUpdateOne

SetPwdSalt sets the "pwd_salt" field.

func (*UserUpdateOne) SetStatus

func (uuo *UserUpdateOne) SetStatus(u user.Status) *UserUpdateOne

SetStatus sets the "status" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

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.

type VerifyToken

type VerifyToken struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt"`
	// ExpiresAt holds the value of the "expires_at" field.
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Token holds the value of the "token" field.
	Token string `json:"token,omitempty"`
	// Purpose holds the value of the "purpose" field.
	Purpose string `json:"purpose,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the VerifyTokenQuery when eager-loading is set.
	Edges VerifyTokenEdges `json:"edges"`
	// contains filtered or unexported fields
}

VerifyToken is the model entity for the VerifyToken schema.

func (*VerifyToken) QueryUser

func (vt *VerifyToken) QueryUser() *UserQuery

QueryUser queries the "user" edge of the VerifyToken entity.

func (*VerifyToken) String

func (vt *VerifyToken) String() string

String implements the fmt.Stringer.

func (*VerifyToken) Unwrap

func (vt *VerifyToken) Unwrap() *VerifyToken

Unwrap unwraps the VerifyToken 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 (*VerifyToken) Update

func (vt *VerifyToken) Update() *VerifyTokenUpdateOne

Update returns a builder for updating this VerifyToken. Note that you need to call VerifyToken.Unwrap() before calling this method if this VerifyToken was returned from a transaction, and the transaction was committed or rolled back.

func (*VerifyToken) Value

func (vt *VerifyToken) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the VerifyToken. This includes values selected through modifiers, order, etc.

type VerifyTokenClient

type VerifyTokenClient struct {
	// contains filtered or unexported fields
}

VerifyTokenClient is a client for the VerifyToken schema.

func NewVerifyTokenClient

func NewVerifyTokenClient(c config) *VerifyTokenClient

NewVerifyTokenClient returns a client for the VerifyToken from the given config.

func (*VerifyTokenClient) Create

func (c *VerifyTokenClient) Create() *VerifyTokenCreate

Create returns a builder for creating a VerifyToken entity.

func (*VerifyTokenClient) CreateBulk

func (c *VerifyTokenClient) CreateBulk(builders ...*VerifyTokenCreate) *VerifyTokenCreateBulk

CreateBulk returns a builder for creating a bulk of VerifyToken entities.

func (*VerifyTokenClient) Delete

func (c *VerifyTokenClient) Delete() *VerifyTokenDelete

Delete returns a delete builder for VerifyToken.

func (*VerifyTokenClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*VerifyTokenClient) DeleteOneID

func (c *VerifyTokenClient) DeleteOneID(id int64) *VerifyTokenDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*VerifyTokenClient) Get

Get returns a VerifyToken entity by its id.

func (*VerifyTokenClient) GetX

GetX is like Get, but panics if an error occurs.

func (*VerifyTokenClient) Hooks

func (c *VerifyTokenClient) Hooks() []Hook

Hooks returns the client hooks.

func (*VerifyTokenClient) Intercept

func (c *VerifyTokenClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `verifytoken.Intercept(f(g(h())))`.

func (*VerifyTokenClient) Interceptors

func (c *VerifyTokenClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*VerifyTokenClient) MapCreateBulk

func (c *VerifyTokenClient) MapCreateBulk(slice any, setFunc func(*VerifyTokenCreate, int)) *VerifyTokenCreateBulk

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 (*VerifyTokenClient) Query

func (c *VerifyTokenClient) Query() *VerifyTokenQuery

Query returns a query builder for VerifyToken.

func (*VerifyTokenClient) QueryUser

func (c *VerifyTokenClient) QueryUser(vt *VerifyToken) *UserQuery

QueryUser queries the user edge of a VerifyToken.

func (*VerifyTokenClient) Update

func (c *VerifyTokenClient) Update() *VerifyTokenUpdate

Update returns an update builder for VerifyToken.

func (*VerifyTokenClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*VerifyTokenClient) UpdateOneID

func (c *VerifyTokenClient) UpdateOneID(id int64) *VerifyTokenUpdateOne

UpdateOneID returns an update builder for the given id.

func (*VerifyTokenClient) Use

func (c *VerifyTokenClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `verifytoken.Hooks(f(g(h())))`.

type VerifyTokenCreate

type VerifyTokenCreate struct {
	// contains filtered or unexported fields
}

VerifyTokenCreate is the builder for creating a VerifyToken entity.

func (*VerifyTokenCreate) Exec

func (vtc *VerifyTokenCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*VerifyTokenCreate) ExecX

func (vtc *VerifyTokenCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenCreate) Mutation

func (vtc *VerifyTokenCreate) Mutation() *VerifyTokenMutation

Mutation returns the VerifyTokenMutation object of the builder.

func (*VerifyTokenCreate) Save

func (vtc *VerifyTokenCreate) Save(ctx context.Context) (*VerifyToken, error)

Save creates the VerifyToken in the database.

func (*VerifyTokenCreate) SaveX

func (vtc *VerifyTokenCreate) SaveX(ctx context.Context) *VerifyToken

SaveX calls Save and panics if Save returns an error.

func (*VerifyTokenCreate) SetCreatedAt

func (vtc *VerifyTokenCreate) SetCreatedAt(t time.Time) *VerifyTokenCreate

SetCreatedAt sets the "created_at" field.

func (*VerifyTokenCreate) SetExpiresAt

func (vtc *VerifyTokenCreate) SetExpiresAt(t time.Time) *VerifyTokenCreate

SetExpiresAt sets the "expires_at" field.

func (*VerifyTokenCreate) SetID

func (vtc *VerifyTokenCreate) SetID(i int64) *VerifyTokenCreate

SetID sets the "id" field.

func (*VerifyTokenCreate) SetNillableCreatedAt

func (vtc *VerifyTokenCreate) SetNillableCreatedAt(t *time.Time) *VerifyTokenCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*VerifyTokenCreate) SetNillablePurpose

func (vtc *VerifyTokenCreate) SetNillablePurpose(s *string) *VerifyTokenCreate

SetNillablePurpose sets the "purpose" field if the given value is not nil.

func (*VerifyTokenCreate) SetNillableUserID

func (vtc *VerifyTokenCreate) SetNillableUserID(id *int64) *VerifyTokenCreate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VerifyTokenCreate) SetPurpose

func (vtc *VerifyTokenCreate) SetPurpose(s string) *VerifyTokenCreate

SetPurpose sets the "purpose" field.

func (*VerifyTokenCreate) SetToken

func (vtc *VerifyTokenCreate) SetToken(s string) *VerifyTokenCreate

SetToken sets the "token" field.

func (*VerifyTokenCreate) SetUser

func (vtc *VerifyTokenCreate) SetUser(u *User) *VerifyTokenCreate

SetUser sets the "user" edge to the User entity.

func (*VerifyTokenCreate) SetUserID

func (vtc *VerifyTokenCreate) SetUserID(id int64) *VerifyTokenCreate

SetUserID sets the "user" edge to the User entity by ID.

type VerifyTokenCreateBulk

type VerifyTokenCreateBulk struct {
	// contains filtered or unexported fields
}

VerifyTokenCreateBulk is the builder for creating many VerifyToken entities in bulk.

func (*VerifyTokenCreateBulk) Exec

func (vtcb *VerifyTokenCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*VerifyTokenCreateBulk) ExecX

func (vtcb *VerifyTokenCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenCreateBulk) Save

func (vtcb *VerifyTokenCreateBulk) Save(ctx context.Context) ([]*VerifyToken, error)

Save creates the VerifyToken entities in the database.

func (*VerifyTokenCreateBulk) SaveX

func (vtcb *VerifyTokenCreateBulk) SaveX(ctx context.Context) []*VerifyToken

SaveX is like Save, but panics if an error occurs.

type VerifyTokenDelete

type VerifyTokenDelete struct {
	// contains filtered or unexported fields
}

VerifyTokenDelete is the builder for deleting a VerifyToken entity.

func (*VerifyTokenDelete) Exec

func (vtd *VerifyTokenDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*VerifyTokenDelete) ExecX

func (vtd *VerifyTokenDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenDelete) Where

Where appends a list predicates to the VerifyTokenDelete builder.

type VerifyTokenDeleteOne

type VerifyTokenDeleteOne struct {
	// contains filtered or unexported fields
}

VerifyTokenDeleteOne is the builder for deleting a single VerifyToken entity.

func (*VerifyTokenDeleteOne) Exec

func (vtdo *VerifyTokenDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*VerifyTokenDeleteOne) ExecX

func (vtdo *VerifyTokenDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenDeleteOne) Where

Where appends a list predicates to the VerifyTokenDelete builder.

type VerifyTokenEdges

type VerifyTokenEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

VerifyTokenEdges holds the relations/edges for other nodes in the graph.

func (VerifyTokenEdges) UserOrErr

func (e VerifyTokenEdges) 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 VerifyTokenGroupBy

type VerifyTokenGroupBy struct {
	// contains filtered or unexported fields
}

VerifyTokenGroupBy is the group-by builder for VerifyToken entities.

func (*VerifyTokenGroupBy) Aggregate

func (vtgb *VerifyTokenGroupBy) Aggregate(fns ...AggregateFunc) *VerifyTokenGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*VerifyTokenGroupBy) Bool

func (s *VerifyTokenGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) BoolX

func (s *VerifyTokenGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VerifyTokenGroupBy) Bools

func (s *VerifyTokenGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) BoolsX

func (s *VerifyTokenGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VerifyTokenGroupBy) Float64

func (s *VerifyTokenGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) Float64X

func (s *VerifyTokenGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VerifyTokenGroupBy) Float64s

func (s *VerifyTokenGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) Float64sX

func (s *VerifyTokenGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VerifyTokenGroupBy) Int

func (s *VerifyTokenGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) IntX

func (s *VerifyTokenGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VerifyTokenGroupBy) Ints

func (s *VerifyTokenGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) IntsX

func (s *VerifyTokenGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VerifyTokenGroupBy) Scan

func (vtgb *VerifyTokenGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VerifyTokenGroupBy) ScanX

func (s *VerifyTokenGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VerifyTokenGroupBy) String

func (s *VerifyTokenGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) StringX

func (s *VerifyTokenGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VerifyTokenGroupBy) Strings

func (s *VerifyTokenGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VerifyTokenGroupBy) StringsX

func (s *VerifyTokenGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VerifyTokenMutation

type VerifyTokenMutation struct {
	// contains filtered or unexported fields
}

VerifyTokenMutation represents an operation that mutates the VerifyToken nodes in the graph.

func (*VerifyTokenMutation) AddField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) AddedEdges

func (m *VerifyTokenMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*VerifyTokenMutation) AddedField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) AddedFields

func (m *VerifyTokenMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*VerifyTokenMutation) AddedIDs

func (m *VerifyTokenMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*VerifyTokenMutation) ClearEdge

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ClearField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ClearPurpose

func (m *VerifyTokenMutation) ClearPurpose()

ClearPurpose clears the value of the "purpose" field.

func (*VerifyTokenMutation) ClearUser

func (m *VerifyTokenMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*VerifyTokenMutation) ClearedEdges

func (m *VerifyTokenMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*VerifyTokenMutation) ClearedFields

func (m *VerifyTokenMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (VerifyTokenMutation) Client

func (m VerifyTokenMutation) 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 (*VerifyTokenMutation) CreatedAt

func (m *VerifyTokenMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*VerifyTokenMutation) EdgeCleared

func (m *VerifyTokenMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*VerifyTokenMutation) ExpiresAt

func (m *VerifyTokenMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*VerifyTokenMutation) Field

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) FieldCleared

func (m *VerifyTokenMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*VerifyTokenMutation) Fields

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ID

func (m *VerifyTokenMutation) ID() (id int64, 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 (*VerifyTokenMutation) IDs

func (m *VerifyTokenMutation) IDs(ctx context.Context) ([]int64, 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 (*VerifyTokenMutation) OldCreatedAt

func (m *VerifyTokenMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the VerifyToken entity. If the VerifyToken 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 (*VerifyTokenMutation) OldExpiresAt

func (m *VerifyTokenMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the VerifyToken entity. If the VerifyToken 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 (*VerifyTokenMutation) OldField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) OldPurpose

func (m *VerifyTokenMutation) OldPurpose(ctx context.Context) (v string, err error)

OldPurpose returns the old "purpose" field's value of the VerifyToken entity. If the VerifyToken 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 (*VerifyTokenMutation) OldToken

func (m *VerifyTokenMutation) OldToken(ctx context.Context) (v string, err error)

OldToken returns the old "token" field's value of the VerifyToken entity. If the VerifyToken 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 (*VerifyTokenMutation) Op

func (m *VerifyTokenMutation) Op() Op

Op returns the operation name.

func (*VerifyTokenMutation) Purpose

func (m *VerifyTokenMutation) Purpose() (r string, exists bool)

Purpose returns the value of the "purpose" field in the mutation.

func (*VerifyTokenMutation) PurposeCleared

func (m *VerifyTokenMutation) PurposeCleared() bool

PurposeCleared returns if the "purpose" field was cleared in this mutation.

func (*VerifyTokenMutation) RemovedEdges

func (m *VerifyTokenMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*VerifyTokenMutation) RemovedIDs

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ResetCreatedAt

func (m *VerifyTokenMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*VerifyTokenMutation) ResetEdge

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ResetExpiresAt

func (m *VerifyTokenMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*VerifyTokenMutation) ResetField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) ResetPurpose

func (m *VerifyTokenMutation) ResetPurpose()

ResetPurpose resets all changes to the "purpose" field.

func (*VerifyTokenMutation) ResetToken

func (m *VerifyTokenMutation) ResetToken()

ResetToken resets all changes to the "token" field.

func (*VerifyTokenMutation) ResetUser

func (m *VerifyTokenMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*VerifyTokenMutation) SetCreatedAt

func (m *VerifyTokenMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*VerifyTokenMutation) SetExpiresAt

func (m *VerifyTokenMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*VerifyTokenMutation) SetField

func (m *VerifyTokenMutation) 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 (*VerifyTokenMutation) SetID

func (m *VerifyTokenMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of VerifyToken entities.

func (*VerifyTokenMutation) SetOp

func (m *VerifyTokenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*VerifyTokenMutation) SetPurpose

func (m *VerifyTokenMutation) SetPurpose(s string)

SetPurpose sets the "purpose" field.

func (*VerifyTokenMutation) SetToken

func (m *VerifyTokenMutation) SetToken(s string)

SetToken sets the "token" field.

func (*VerifyTokenMutation) SetUserID

func (m *VerifyTokenMutation) SetUserID(id int64)

SetUserID sets the "user" edge to the User entity by id.

func (*VerifyTokenMutation) Token

func (m *VerifyTokenMutation) Token() (r string, exists bool)

Token returns the value of the "token" field in the mutation.

func (VerifyTokenMutation) Tx

func (m VerifyTokenMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*VerifyTokenMutation) Type

func (m *VerifyTokenMutation) Type() string

Type returns the node type of this mutation (VerifyToken).

func (*VerifyTokenMutation) UserCleared

func (m *VerifyTokenMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*VerifyTokenMutation) UserID

func (m *VerifyTokenMutation) UserID() (id int64, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*VerifyTokenMutation) UserIDs

func (m *VerifyTokenMutation) UserIDs() (ids []int64)

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 (*VerifyTokenMutation) Where

func (m *VerifyTokenMutation) Where(ps ...predicate.VerifyToken)

Where appends a list predicates to the VerifyTokenMutation builder.

func (*VerifyTokenMutation) WhereP

func (m *VerifyTokenMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the VerifyTokenMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type VerifyTokenQuery

type VerifyTokenQuery struct {
	// contains filtered or unexported fields
}

VerifyTokenQuery is the builder for querying VerifyToken entities.

func (*VerifyTokenQuery) Aggregate

func (vtq *VerifyTokenQuery) Aggregate(fns ...AggregateFunc) *VerifyTokenSelect

Aggregate returns a VerifyTokenSelect configured with the given aggregations.

func (*VerifyTokenQuery) All

func (vtq *VerifyTokenQuery) All(ctx context.Context) ([]*VerifyToken, error)

All executes the query and returns a list of VerifyTokens.

func (*VerifyTokenQuery) AllX

func (vtq *VerifyTokenQuery) AllX(ctx context.Context) []*VerifyToken

AllX is like All, but panics if an error occurs.

func (*VerifyTokenQuery) Clone

func (vtq *VerifyTokenQuery) Clone() *VerifyTokenQuery

Clone returns a duplicate of the VerifyTokenQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*VerifyTokenQuery) Count

func (vtq *VerifyTokenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*VerifyTokenQuery) CountX

func (vtq *VerifyTokenQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*VerifyTokenQuery) Exist

func (vtq *VerifyTokenQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*VerifyTokenQuery) ExistX

func (vtq *VerifyTokenQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*VerifyTokenQuery) First

func (vtq *VerifyTokenQuery) First(ctx context.Context) (*VerifyToken, error)

First returns the first VerifyToken entity from the query. Returns a *NotFoundError when no VerifyToken was found.

func (*VerifyTokenQuery) FirstID

func (vtq *VerifyTokenQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first VerifyToken ID from the query. Returns a *NotFoundError when no VerifyToken ID was found.

func (*VerifyTokenQuery) FirstIDX

func (vtq *VerifyTokenQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*VerifyTokenQuery) FirstX

func (vtq *VerifyTokenQuery) FirstX(ctx context.Context) *VerifyToken

FirstX is like First, but panics if an error occurs.

func (*VerifyTokenQuery) GroupBy

func (vtq *VerifyTokenQuery) GroupBy(field string, fields ...string) *VerifyTokenGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt"`
	Count int `json:"count,omitempty"`
}

client.VerifyToken.Query().
	GroupBy(verifytoken.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*VerifyTokenQuery) IDs

func (vtq *VerifyTokenQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of VerifyToken IDs.

func (*VerifyTokenQuery) IDsX

func (vtq *VerifyTokenQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*VerifyTokenQuery) Limit

func (vtq *VerifyTokenQuery) Limit(limit int) *VerifyTokenQuery

Limit the number of records to be returned by this query.

func (*VerifyTokenQuery) Offset

func (vtq *VerifyTokenQuery) Offset(offset int) *VerifyTokenQuery

Offset to start from.

func (*VerifyTokenQuery) Only

func (vtq *VerifyTokenQuery) Only(ctx context.Context) (*VerifyToken, error)

Only returns a single VerifyToken entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one VerifyToken entity is found. Returns a *NotFoundError when no VerifyToken entities are found.

func (*VerifyTokenQuery) OnlyID

func (vtq *VerifyTokenQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only VerifyToken ID in the query. Returns a *NotSingularError when more than one VerifyToken ID is found. Returns a *NotFoundError when no entities are found.

func (*VerifyTokenQuery) OnlyIDX

func (vtq *VerifyTokenQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*VerifyTokenQuery) OnlyX

func (vtq *VerifyTokenQuery) OnlyX(ctx context.Context) *VerifyToken

OnlyX is like Only, but panics if an error occurs.

func (*VerifyTokenQuery) Order

Order specifies how the records should be ordered.

func (*VerifyTokenQuery) QueryUser

func (vtq *VerifyTokenQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*VerifyTokenQuery) Select

func (vtq *VerifyTokenQuery) Select(fields ...string) *VerifyTokenSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt"`
}

client.VerifyToken.Query().
	Select(verifytoken.FieldCreatedAt).
	Scan(ctx, &v)

func (*VerifyTokenQuery) Unique

func (vtq *VerifyTokenQuery) Unique(unique bool) *VerifyTokenQuery

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 (*VerifyTokenQuery) Where

Where adds a new predicate for the VerifyTokenQuery builder.

func (*VerifyTokenQuery) WithUser

func (vtq *VerifyTokenQuery) WithUser(opts ...func(*UserQuery)) *VerifyTokenQuery

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 VerifyTokenSelect

type VerifyTokenSelect struct {
	*VerifyTokenQuery
	// contains filtered or unexported fields
}

VerifyTokenSelect is the builder for selecting fields of VerifyToken entities.

func (*VerifyTokenSelect) Aggregate

func (vts *VerifyTokenSelect) Aggregate(fns ...AggregateFunc) *VerifyTokenSelect

Aggregate adds the given aggregation functions to the selector query.

func (*VerifyTokenSelect) Bool

func (s *VerifyTokenSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) BoolX

func (s *VerifyTokenSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*VerifyTokenSelect) Bools

func (s *VerifyTokenSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) BoolsX

func (s *VerifyTokenSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*VerifyTokenSelect) Float64

func (s *VerifyTokenSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) Float64X

func (s *VerifyTokenSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*VerifyTokenSelect) Float64s

func (s *VerifyTokenSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) Float64sX

func (s *VerifyTokenSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*VerifyTokenSelect) Int

func (s *VerifyTokenSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) IntX

func (s *VerifyTokenSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*VerifyTokenSelect) Ints

func (s *VerifyTokenSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) IntsX

func (s *VerifyTokenSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*VerifyTokenSelect) Scan

func (vts *VerifyTokenSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*VerifyTokenSelect) ScanX

func (s *VerifyTokenSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*VerifyTokenSelect) String

func (s *VerifyTokenSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) StringX

func (s *VerifyTokenSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*VerifyTokenSelect) Strings

func (s *VerifyTokenSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*VerifyTokenSelect) StringsX

func (s *VerifyTokenSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type VerifyTokenUpdate

type VerifyTokenUpdate struct {
	// contains filtered or unexported fields
}

VerifyTokenUpdate is the builder for updating VerifyToken entities.

func (*VerifyTokenUpdate) ClearPurpose

func (vtu *VerifyTokenUpdate) ClearPurpose() *VerifyTokenUpdate

ClearPurpose clears the value of the "purpose" field.

func (*VerifyTokenUpdate) ClearUser

func (vtu *VerifyTokenUpdate) ClearUser() *VerifyTokenUpdate

ClearUser clears the "user" edge to the User entity.

func (*VerifyTokenUpdate) Exec

func (vtu *VerifyTokenUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*VerifyTokenUpdate) ExecX

func (vtu *VerifyTokenUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenUpdate) Mutation

func (vtu *VerifyTokenUpdate) Mutation() *VerifyTokenMutation

Mutation returns the VerifyTokenMutation object of the builder.

func (*VerifyTokenUpdate) Save

func (vtu *VerifyTokenUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*VerifyTokenUpdate) SaveX

func (vtu *VerifyTokenUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*VerifyTokenUpdate) SetNillablePurpose

func (vtu *VerifyTokenUpdate) SetNillablePurpose(s *string) *VerifyTokenUpdate

SetNillablePurpose sets the "purpose" field if the given value is not nil.

func (*VerifyTokenUpdate) SetNillableToken

func (vtu *VerifyTokenUpdate) SetNillableToken(s *string) *VerifyTokenUpdate

SetNillableToken sets the "token" field if the given value is not nil.

func (*VerifyTokenUpdate) SetNillableUserID

func (vtu *VerifyTokenUpdate) SetNillableUserID(id *int64) *VerifyTokenUpdate

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VerifyTokenUpdate) SetPurpose

func (vtu *VerifyTokenUpdate) SetPurpose(s string) *VerifyTokenUpdate

SetPurpose sets the "purpose" field.

func (*VerifyTokenUpdate) SetToken

func (vtu *VerifyTokenUpdate) SetToken(s string) *VerifyTokenUpdate

SetToken sets the "token" field.

func (*VerifyTokenUpdate) SetUser

func (vtu *VerifyTokenUpdate) SetUser(u *User) *VerifyTokenUpdate

SetUser sets the "user" edge to the User entity.

func (*VerifyTokenUpdate) SetUserID

func (vtu *VerifyTokenUpdate) SetUserID(id int64) *VerifyTokenUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*VerifyTokenUpdate) Where

Where appends a list predicates to the VerifyTokenUpdate builder.

type VerifyTokenUpdateOne

type VerifyTokenUpdateOne struct {
	// contains filtered or unexported fields
}

VerifyTokenUpdateOne is the builder for updating a single VerifyToken entity.

func (*VerifyTokenUpdateOne) ClearPurpose

func (vtuo *VerifyTokenUpdateOne) ClearPurpose() *VerifyTokenUpdateOne

ClearPurpose clears the value of the "purpose" field.

func (*VerifyTokenUpdateOne) ClearUser

func (vtuo *VerifyTokenUpdateOne) ClearUser() *VerifyTokenUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*VerifyTokenUpdateOne) Exec

func (vtuo *VerifyTokenUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*VerifyTokenUpdateOne) ExecX

func (vtuo *VerifyTokenUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*VerifyTokenUpdateOne) Mutation

func (vtuo *VerifyTokenUpdateOne) Mutation() *VerifyTokenMutation

Mutation returns the VerifyTokenMutation object of the builder.

func (*VerifyTokenUpdateOne) Save

Save executes the query and returns the updated VerifyToken entity.

func (*VerifyTokenUpdateOne) SaveX

func (vtuo *VerifyTokenUpdateOne) SaveX(ctx context.Context) *VerifyToken

SaveX is like Save, but panics if an error occurs.

func (*VerifyTokenUpdateOne) Select

func (vtuo *VerifyTokenUpdateOne) Select(field string, fields ...string) *VerifyTokenUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*VerifyTokenUpdateOne) SetNillablePurpose

func (vtuo *VerifyTokenUpdateOne) SetNillablePurpose(s *string) *VerifyTokenUpdateOne

SetNillablePurpose sets the "purpose" field if the given value is not nil.

func (*VerifyTokenUpdateOne) SetNillableToken

func (vtuo *VerifyTokenUpdateOne) SetNillableToken(s *string) *VerifyTokenUpdateOne

SetNillableToken sets the "token" field if the given value is not nil.

func (*VerifyTokenUpdateOne) SetNillableUserID

func (vtuo *VerifyTokenUpdateOne) SetNillableUserID(id *int64) *VerifyTokenUpdateOne

SetNillableUserID sets the "user" edge to the User entity by ID if the given value is not nil.

func (*VerifyTokenUpdateOne) SetPurpose

func (vtuo *VerifyTokenUpdateOne) SetPurpose(s string) *VerifyTokenUpdateOne

SetPurpose sets the "purpose" field.

func (*VerifyTokenUpdateOne) SetToken

SetToken sets the "token" field.

func (*VerifyTokenUpdateOne) SetUser

func (vtuo *VerifyTokenUpdateOne) SetUser(u *User) *VerifyTokenUpdateOne

SetUser sets the "user" edge to the User entity.

func (*VerifyTokenUpdateOne) SetUserID

func (vtuo *VerifyTokenUpdateOne) SetUserID(id int64) *VerifyTokenUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*VerifyTokenUpdateOne) Where

Where appends a list predicates to the VerifyTokenUpdate builder.

type VerifyTokens

type VerifyTokens []*VerifyToken

VerifyTokens is a parsable slice of VerifyToken.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL