ent

package
v0.0.0-...-ed7a308 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypePermissions = "Permissions"
	TypeRoles       = "Roles"
	TypeUsers       = "Users"
)

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 AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Permissions is the client for interacting with the Permissions builders.
	Permissions *PermissionsClient
	// Roles is the client for interacting with the Roles builders.
	Roles *RolesClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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().
	Permissions.
	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 Permissions

type Permissions struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PermissionsQuery when eager-loading is set.
	Edges PermissionsEdges `json:"edges"`
	// contains filtered or unexported fields
}

Permissions is the model entity for the Permissions schema.

func (*Permissions) QueryRoles

func (pe *Permissions) QueryRoles() *RolesQuery

QueryRoles queries the "roles" edge of the Permissions entity.

func (*Permissions) String

func (pe *Permissions) String() string

String implements the fmt.Stringer.

func (*Permissions) Unwrap

func (pe *Permissions) Unwrap() *Permissions

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

func (pe *Permissions) Update() *PermissionsUpdateOne

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

func (*Permissions) Value

func (pe *Permissions) Value(name string) (ent.Value, error)

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

type PermissionsClient

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

PermissionsClient is a client for the Permissions schema.

func NewPermissionsClient

func NewPermissionsClient(c config) *PermissionsClient

NewPermissionsClient returns a client for the Permissions from the given config.

func (*PermissionsClient) Create

func (c *PermissionsClient) Create() *PermissionsCreate

Create returns a builder for creating a Permissions entity.

func (*PermissionsClient) CreateBulk

func (c *PermissionsClient) CreateBulk(builders ...*PermissionsCreate) *PermissionsCreateBulk

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

func (*PermissionsClient) Delete

func (c *PermissionsClient) Delete() *PermissionsDelete

Delete returns a delete builder for Permissions.

func (*PermissionsClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PermissionsClient) DeleteOneID

func (c *PermissionsClient) DeleteOneID(id int) *PermissionsDeleteOne

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

func (*PermissionsClient) Get

func (c *PermissionsClient) Get(ctx context.Context, id int) (*Permissions, error)

Get returns a Permissions entity by its id.

func (*PermissionsClient) GetX

func (c *PermissionsClient) GetX(ctx context.Context, id int) *Permissions

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

func (*PermissionsClient) Hooks

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

Hooks returns the client hooks.

func (*PermissionsClient) Intercept

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

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

func (*PermissionsClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PermissionsClient) MapCreateBulk

func (c *PermissionsClient) MapCreateBulk(slice any, setFunc func(*PermissionsCreate, int)) *PermissionsCreateBulk

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

func (c *PermissionsClient) Query() *PermissionsQuery

Query returns a query builder for Permissions.

func (*PermissionsClient) QueryRoles

func (c *PermissionsClient) QueryRoles(pe *Permissions) *RolesQuery

QueryRoles queries the roles edge of a Permissions.

func (*PermissionsClient) Update

func (c *PermissionsClient) Update() *PermissionsUpdate

Update returns an update builder for Permissions.

func (*PermissionsClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*PermissionsClient) UpdateOneID

func (c *PermissionsClient) UpdateOneID(id int) *PermissionsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PermissionsClient) Use

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

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

type PermissionsCreate

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

PermissionsCreate is the builder for creating a Permissions entity.

func (*PermissionsCreate) AddRoleIDs

func (pc *PermissionsCreate) AddRoleIDs(ids ...int) *PermissionsCreate

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*PermissionsCreate) AddRoles

func (pc *PermissionsCreate) AddRoles(r ...*Roles) *PermissionsCreate

AddRoles adds the "roles" edges to the Roles entity.

func (*PermissionsCreate) Exec

func (pc *PermissionsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionsCreate) ExecX

func (pc *PermissionsCreate) ExecX(ctx context.Context)

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

func (*PermissionsCreate) Mutation

func (pc *PermissionsCreate) Mutation() *PermissionsMutation

Mutation returns the PermissionsMutation object of the builder.

func (*PermissionsCreate) Save

Save creates the Permissions in the database.

func (*PermissionsCreate) SaveX

func (pc *PermissionsCreate) SaveX(ctx context.Context) *Permissions

SaveX calls Save and panics if Save returns an error.

func (*PermissionsCreate) SetCreatedAt

func (pc *PermissionsCreate) SetCreatedAt(t time.Time) *PermissionsCreate

SetCreatedAt sets the "created_at" field.

func (*PermissionsCreate) SetDescription

func (pc *PermissionsCreate) SetDescription(s string) *PermissionsCreate

SetDescription sets the "description" field.

func (*PermissionsCreate) SetID

func (pc *PermissionsCreate) SetID(i int) *PermissionsCreate

SetID sets the "id" field.

func (*PermissionsCreate) SetName

func (pc *PermissionsCreate) SetName(s string) *PermissionsCreate

SetName sets the "name" field.

func (*PermissionsCreate) SetNillableCreatedAt

func (pc *PermissionsCreate) SetNillableCreatedAt(t *time.Time) *PermissionsCreate

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

func (*PermissionsCreate) SetNillableDescription

func (pc *PermissionsCreate) SetNillableDescription(s *string) *PermissionsCreate

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

type PermissionsCreateBulk

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

PermissionsCreateBulk is the builder for creating many Permissions entities in bulk.

func (*PermissionsCreateBulk) Exec

func (pcb *PermissionsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionsCreateBulk) ExecX

func (pcb *PermissionsCreateBulk) ExecX(ctx context.Context)

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

func (*PermissionsCreateBulk) Save

func (pcb *PermissionsCreateBulk) Save(ctx context.Context) ([]*Permissions, error)

Save creates the Permissions entities in the database.

func (*PermissionsCreateBulk) SaveX

func (pcb *PermissionsCreateBulk) SaveX(ctx context.Context) []*Permissions

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

type PermissionsDelete

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

PermissionsDelete is the builder for deleting a Permissions entity.

func (*PermissionsDelete) Exec

func (pd *PermissionsDelete) Exec(ctx context.Context) (int, error)

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

func (*PermissionsDelete) ExecX

func (pd *PermissionsDelete) ExecX(ctx context.Context) int

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

func (*PermissionsDelete) Where

Where appends a list predicates to the PermissionsDelete builder.

type PermissionsDeleteOne

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

PermissionsDeleteOne is the builder for deleting a single Permissions entity.

func (*PermissionsDeleteOne) Exec

func (pdo *PermissionsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PermissionsDeleteOne) ExecX

func (pdo *PermissionsDeleteOne) ExecX(ctx context.Context)

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

func (*PermissionsDeleteOne) Where

Where appends a list predicates to the PermissionsDelete builder.

type PermissionsEdges

type PermissionsEdges struct {
	// Roles holds the value of the roles edge.
	Roles []*Roles `json:"roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (PermissionsEdges) RolesOrErr

func (e PermissionsEdges) RolesOrErr() ([]*Roles, error)

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

type PermissionsGroupBy

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

PermissionsGroupBy is the group-by builder for Permissions entities.

func (*PermissionsGroupBy) Aggregate

func (pgb *PermissionsGroupBy) Aggregate(fns ...AggregateFunc) *PermissionsGroupBy

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

func (*PermissionsGroupBy) Bool

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

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

func (*PermissionsGroupBy) BoolX

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

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

func (*PermissionsGroupBy) Bools

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

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

func (*PermissionsGroupBy) BoolsX

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

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

func (*PermissionsGroupBy) Float64

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

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

func (*PermissionsGroupBy) Float64X

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

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

func (*PermissionsGroupBy) Float64s

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

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

func (*PermissionsGroupBy) Float64sX

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

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

func (*PermissionsGroupBy) Int

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

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

func (*PermissionsGroupBy) IntX

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

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

func (*PermissionsGroupBy) Ints

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

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

func (*PermissionsGroupBy) IntsX

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

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

func (*PermissionsGroupBy) Scan

func (pgb *PermissionsGroupBy) Scan(ctx context.Context, v any) error

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

func (*PermissionsGroupBy) ScanX

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

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

func (*PermissionsGroupBy) String

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

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

func (*PermissionsGroupBy) StringX

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

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

func (*PermissionsGroupBy) Strings

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

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

func (*PermissionsGroupBy) StringsX

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

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

type PermissionsMutation

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

PermissionsMutation represents an operation that mutates the Permissions nodes in the graph.

func (*PermissionsMutation) AddField

func (m *PermissionsMutation) 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 (*PermissionsMutation) AddRoleIDs

func (m *PermissionsMutation) AddRoleIDs(ids ...int)

AddRoleIDs adds the "roles" edge to the Roles entity by ids.

func (*PermissionsMutation) AddedEdges

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

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

func (*PermissionsMutation) AddedField

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

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

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

func (*PermissionsMutation) AddedIDs

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

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

func (*PermissionsMutation) ClearDescription

func (m *PermissionsMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PermissionsMutation) ClearEdge

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

func (m *PermissionsMutation) 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 (*PermissionsMutation) ClearRoles

func (m *PermissionsMutation) ClearRoles()

ClearRoles clears the "roles" edge to the Roles entity.

func (*PermissionsMutation) ClearedEdges

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

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

func (*PermissionsMutation) ClearedFields

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

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

func (PermissionsMutation) Client

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

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

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

func (*PermissionsMutation) Description

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

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

func (*PermissionsMutation) DescriptionCleared

func (m *PermissionsMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PermissionsMutation) EdgeCleared

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

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

func (*PermissionsMutation) Field

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

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

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

func (*PermissionsMutation) Fields

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

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

func (m *PermissionsMutation) 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 (*PermissionsMutation) Name

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

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

func (*PermissionsMutation) OldCreatedAt

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

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

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

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

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

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

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

func (m *PermissionsMutation) Op() Op

Op returns the operation name.

func (*PermissionsMutation) RemoveRoleIDs

func (m *PermissionsMutation) RemoveRoleIDs(ids ...int)

RemoveRoleIDs removes the "roles" edge to the Roles entity by IDs.

func (*PermissionsMutation) RemovedEdges

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

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

func (*PermissionsMutation) RemovedIDs

func (m *PermissionsMutation) 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 (*PermissionsMutation) RemovedRolesIDs

func (m *PermissionsMutation) RemovedRolesIDs() (ids []int)

RemovedRoles returns the removed IDs of the "roles" edge to the Roles entity.

func (*PermissionsMutation) ResetCreatedAt

func (m *PermissionsMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PermissionsMutation) ResetDescription

func (m *PermissionsMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PermissionsMutation) ResetEdge

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

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

func (m *PermissionsMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PermissionsMutation) ResetRoles

func (m *PermissionsMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*PermissionsMutation) RolesCleared

func (m *PermissionsMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Roles entity was cleared.

func (*PermissionsMutation) RolesIDs

func (m *PermissionsMutation) RolesIDs() (ids []int)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*PermissionsMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PermissionsMutation) SetDescription

func (m *PermissionsMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PermissionsMutation) SetField

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

func (m *PermissionsMutation) SetID(id int)

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

func (*PermissionsMutation) SetName

func (m *PermissionsMutation) SetName(s string)

SetName sets the "name" field.

func (*PermissionsMutation) SetOp

func (m *PermissionsMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (PermissionsMutation) Tx

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

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

func (*PermissionsMutation) Type

func (m *PermissionsMutation) Type() string

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

func (*PermissionsMutation) Where

func (m *PermissionsMutation) Where(ps ...predicate.Permissions)

Where appends a list predicates to the PermissionsMutation builder.

func (*PermissionsMutation) WhereP

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

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

type PermissionsQuery

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

PermissionsQuery is the builder for querying Permissions entities.

func (*PermissionsQuery) Aggregate

func (pq *PermissionsQuery) Aggregate(fns ...AggregateFunc) *PermissionsSelect

Aggregate returns a PermissionsSelect configured with the given aggregations.

func (*PermissionsQuery) All

func (pq *PermissionsQuery) All(ctx context.Context) ([]*Permissions, error)

All executes the query and returns a list of PermissionsSlice.

func (*PermissionsQuery) AllX

func (pq *PermissionsQuery) AllX(ctx context.Context) []*Permissions

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

func (*PermissionsQuery) Clone

func (pq *PermissionsQuery) Clone() *PermissionsQuery

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

func (*PermissionsQuery) Count

func (pq *PermissionsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PermissionsQuery) CountX

func (pq *PermissionsQuery) CountX(ctx context.Context) int

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

func (*PermissionsQuery) Exist

func (pq *PermissionsQuery) Exist(ctx context.Context) (bool, error)

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

func (*PermissionsQuery) ExistX

func (pq *PermissionsQuery) ExistX(ctx context.Context) bool

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

func (*PermissionsQuery) First

func (pq *PermissionsQuery) First(ctx context.Context) (*Permissions, error)

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

func (*PermissionsQuery) FirstID

func (pq *PermissionsQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PermissionsQuery) FirstIDX

func (pq *PermissionsQuery) FirstIDX(ctx context.Context) int

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

func (*PermissionsQuery) FirstX

func (pq *PermissionsQuery) FirstX(ctx context.Context) *Permissions

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

func (*PermissionsQuery) GroupBy

func (pq *PermissionsQuery) GroupBy(field string, fields ...string) *PermissionsGroupBy

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.Permissions.Query().
	GroupBy(permissions.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PermissionsQuery) IDs

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

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

func (*PermissionsQuery) IDsX

func (pq *PermissionsQuery) IDsX(ctx context.Context) []int

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

func (*PermissionsQuery) Limit

func (pq *PermissionsQuery) Limit(limit int) *PermissionsQuery

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

func (*PermissionsQuery) Offset

func (pq *PermissionsQuery) Offset(offset int) *PermissionsQuery

Offset to start from.

func (*PermissionsQuery) Only

func (pq *PermissionsQuery) Only(ctx context.Context) (*Permissions, error)

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

func (*PermissionsQuery) OnlyID

func (pq *PermissionsQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PermissionsQuery) OnlyIDX

func (pq *PermissionsQuery) OnlyIDX(ctx context.Context) int

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

func (*PermissionsQuery) OnlyX

func (pq *PermissionsQuery) OnlyX(ctx context.Context) *Permissions

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

func (*PermissionsQuery) Order

Order specifies how the records should be ordered.

func (*PermissionsQuery) QueryRoles

func (pq *PermissionsQuery) QueryRoles() *RolesQuery

QueryRoles chains the current query on the "roles" edge.

func (*PermissionsQuery) Select

func (pq *PermissionsQuery) Select(fields ...string) *PermissionsSelect

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.Permissions.Query().
	Select(permissions.FieldName).
	Scan(ctx, &v)

func (*PermissionsQuery) Unique

func (pq *PermissionsQuery) Unique(unique bool) *PermissionsQuery

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

Where adds a new predicate for the PermissionsQuery builder.

func (*PermissionsQuery) WithRoles

func (pq *PermissionsQuery) WithRoles(opts ...func(*RolesQuery)) *PermissionsQuery

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

type PermissionsSelect

type PermissionsSelect struct {
	*PermissionsQuery
	// contains filtered or unexported fields
}

PermissionsSelect is the builder for selecting fields of Permissions entities.

func (*PermissionsSelect) Aggregate

func (ps *PermissionsSelect) Aggregate(fns ...AggregateFunc) *PermissionsSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PermissionsSelect) Bool

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

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

func (*PermissionsSelect) BoolX

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

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

func (*PermissionsSelect) Bools

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

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

func (*PermissionsSelect) BoolsX

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

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

func (*PermissionsSelect) Float64

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

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

func (*PermissionsSelect) Float64X

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

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

func (*PermissionsSelect) Float64s

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

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

func (*PermissionsSelect) Float64sX

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

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

func (*PermissionsSelect) Int

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

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

func (*PermissionsSelect) IntX

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

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

func (*PermissionsSelect) Ints

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

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

func (*PermissionsSelect) IntsX

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

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

func (*PermissionsSelect) Scan

func (ps *PermissionsSelect) Scan(ctx context.Context, v any) error

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

func (*PermissionsSelect) ScanX

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

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

func (*PermissionsSelect) String

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

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

func (*PermissionsSelect) StringX

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

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

func (*PermissionsSelect) Strings

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

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

func (*PermissionsSelect) StringsX

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

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

type PermissionsSlice

type PermissionsSlice []*Permissions

PermissionsSlice is a parsable slice of Permissions.

type PermissionsUpdate

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

PermissionsUpdate is the builder for updating Permissions entities.

func (*PermissionsUpdate) AddRoleIDs

func (pu *PermissionsUpdate) AddRoleIDs(ids ...int) *PermissionsUpdate

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*PermissionsUpdate) AddRoles

func (pu *PermissionsUpdate) AddRoles(r ...*Roles) *PermissionsUpdate

AddRoles adds the "roles" edges to the Roles entity.

func (*PermissionsUpdate) ClearDescription

func (pu *PermissionsUpdate) ClearDescription() *PermissionsUpdate

ClearDescription clears the value of the "description" field.

func (*PermissionsUpdate) ClearRoles

func (pu *PermissionsUpdate) ClearRoles() *PermissionsUpdate

ClearRoles clears all "roles" edges to the Roles entity.

func (*PermissionsUpdate) Exec

func (pu *PermissionsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionsUpdate) ExecX

func (pu *PermissionsUpdate) ExecX(ctx context.Context)

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

func (*PermissionsUpdate) Mutation

func (pu *PermissionsUpdate) Mutation() *PermissionsMutation

Mutation returns the PermissionsMutation object of the builder.

func (*PermissionsUpdate) RemoveRoleIDs

func (pu *PermissionsUpdate) RemoveRoleIDs(ids ...int) *PermissionsUpdate

RemoveRoleIDs removes the "roles" edge to Roles entities by IDs.

func (*PermissionsUpdate) RemoveRoles

func (pu *PermissionsUpdate) RemoveRoles(r ...*Roles) *PermissionsUpdate

RemoveRoles removes "roles" edges to Roles entities.

func (*PermissionsUpdate) Save

func (pu *PermissionsUpdate) Save(ctx context.Context) (int, error)

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

func (*PermissionsUpdate) SaveX

func (pu *PermissionsUpdate) SaveX(ctx context.Context) int

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

func (*PermissionsUpdate) SetDescription

func (pu *PermissionsUpdate) SetDescription(s string) *PermissionsUpdate

SetDescription sets the "description" field.

func (*PermissionsUpdate) SetName

func (pu *PermissionsUpdate) SetName(s string) *PermissionsUpdate

SetName sets the "name" field.

func (*PermissionsUpdate) SetNillableDescription

func (pu *PermissionsUpdate) SetNillableDescription(s *string) *PermissionsUpdate

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

func (*PermissionsUpdate) SetNillableName

func (pu *PermissionsUpdate) SetNillableName(s *string) *PermissionsUpdate

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

func (*PermissionsUpdate) Where

Where appends a list predicates to the PermissionsUpdate builder.

type PermissionsUpdateOne

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

PermissionsUpdateOne is the builder for updating a single Permissions entity.

func (*PermissionsUpdateOne) AddRoleIDs

func (puo *PermissionsUpdateOne) AddRoleIDs(ids ...int) *PermissionsUpdateOne

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*PermissionsUpdateOne) AddRoles

func (puo *PermissionsUpdateOne) AddRoles(r ...*Roles) *PermissionsUpdateOne

AddRoles adds the "roles" edges to the Roles entity.

func (*PermissionsUpdateOne) ClearDescription

func (puo *PermissionsUpdateOne) ClearDescription() *PermissionsUpdateOne

ClearDescription clears the value of the "description" field.

func (*PermissionsUpdateOne) ClearRoles

func (puo *PermissionsUpdateOne) ClearRoles() *PermissionsUpdateOne

ClearRoles clears all "roles" edges to the Roles entity.

func (*PermissionsUpdateOne) Exec

func (puo *PermissionsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PermissionsUpdateOne) ExecX

func (puo *PermissionsUpdateOne) ExecX(ctx context.Context)

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

func (*PermissionsUpdateOne) Mutation

func (puo *PermissionsUpdateOne) Mutation() *PermissionsMutation

Mutation returns the PermissionsMutation object of the builder.

func (*PermissionsUpdateOne) RemoveRoleIDs

func (puo *PermissionsUpdateOne) RemoveRoleIDs(ids ...int) *PermissionsUpdateOne

RemoveRoleIDs removes the "roles" edge to Roles entities by IDs.

func (*PermissionsUpdateOne) RemoveRoles

func (puo *PermissionsUpdateOne) RemoveRoles(r ...*Roles) *PermissionsUpdateOne

RemoveRoles removes "roles" edges to Roles entities.

func (*PermissionsUpdateOne) Save

Save executes the query and returns the updated Permissions entity.

func (*PermissionsUpdateOne) SaveX

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

func (*PermissionsUpdateOne) Select

func (puo *PermissionsUpdateOne) Select(field string, fields ...string) *PermissionsUpdateOne

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

func (*PermissionsUpdateOne) SetDescription

func (puo *PermissionsUpdateOne) SetDescription(s string) *PermissionsUpdateOne

SetDescription sets the "description" field.

func (*PermissionsUpdateOne) SetName

SetName sets the "name" field.

func (*PermissionsUpdateOne) SetNillableDescription

func (puo *PermissionsUpdateOne) SetNillableDescription(s *string) *PermissionsUpdateOne

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

func (*PermissionsUpdateOne) SetNillableName

func (puo *PermissionsUpdateOne) SetNillableName(s *string) *PermissionsUpdateOne

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

func (*PermissionsUpdateOne) Where

Where appends a list predicates to the PermissionsUpdate builder.

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 Roles

type Roles struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RolesQuery when eager-loading is set.
	Edges RolesEdges `json:"edges"`
	// contains filtered or unexported fields
}

Roles is the model entity for the Roles schema.

func (*Roles) QueryPermissions

func (r *Roles) QueryPermissions() *PermissionsQuery

QueryPermissions queries the "permissions" edge of the Roles entity.

func (*Roles) QueryUsers

func (r *Roles) QueryUsers() *UsersQuery

QueryUsers queries the "users" edge of the Roles entity.

func (*Roles) String

func (r *Roles) String() string

String implements the fmt.Stringer.

func (*Roles) Unwrap

func (r *Roles) Unwrap() *Roles

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

func (r *Roles) Update() *RolesUpdateOne

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

func (*Roles) Value

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

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

type RolesClient

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

RolesClient is a client for the Roles schema.

func NewRolesClient

func NewRolesClient(c config) *RolesClient

NewRolesClient returns a client for the Roles from the given config.

func (*RolesClient) Create

func (c *RolesClient) Create() *RolesCreate

Create returns a builder for creating a Roles entity.

func (*RolesClient) CreateBulk

func (c *RolesClient) CreateBulk(builders ...*RolesCreate) *RolesCreateBulk

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

func (*RolesClient) Delete

func (c *RolesClient) Delete() *RolesDelete

Delete returns a delete builder for Roles.

func (*RolesClient) DeleteOne

func (c *RolesClient) DeleteOne(r *Roles) *RolesDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RolesClient) DeleteOneID

func (c *RolesClient) DeleteOneID(id int) *RolesDeleteOne

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

func (*RolesClient) Get

func (c *RolesClient) Get(ctx context.Context, id int) (*Roles, error)

Get returns a Roles entity by its id.

func (*RolesClient) GetX

func (c *RolesClient) GetX(ctx context.Context, id int) *Roles

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

func (*RolesClient) Hooks

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

Hooks returns the client hooks.

func (*RolesClient) Intercept

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

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

func (*RolesClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RolesClient) MapCreateBulk

func (c *RolesClient) MapCreateBulk(slice any, setFunc func(*RolesCreate, int)) *RolesCreateBulk

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

func (c *RolesClient) Query() *RolesQuery

Query returns a query builder for Roles.

func (*RolesClient) QueryPermissions

func (c *RolesClient) QueryPermissions(r *Roles) *PermissionsQuery

QueryPermissions queries the permissions edge of a Roles.

func (*RolesClient) QueryUsers

func (c *RolesClient) QueryUsers(r *Roles) *UsersQuery

QueryUsers queries the users edge of a Roles.

func (*RolesClient) Update

func (c *RolesClient) Update() *RolesUpdate

Update returns an update builder for Roles.

func (*RolesClient) UpdateOne

func (c *RolesClient) UpdateOne(r *Roles) *RolesUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RolesClient) UpdateOneID

func (c *RolesClient) UpdateOneID(id int) *RolesUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RolesClient) Use

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

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

type RolesCreate

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

RolesCreate is the builder for creating a Roles entity.

func (*RolesCreate) AddPermissionIDs

func (rc *RolesCreate) AddPermissionIDs(ids ...int) *RolesCreate

AddPermissionIDs adds the "permissions" edge to the Permissions entity by IDs.

func (*RolesCreate) AddPermissions

func (rc *RolesCreate) AddPermissions(p ...*Permissions) *RolesCreate

AddPermissions adds the "permissions" edges to the Permissions entity.

func (*RolesCreate) AddUserIDs

func (rc *RolesCreate) AddUserIDs(ids ...uuid.UUID) *RolesCreate

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*RolesCreate) AddUsers

func (rc *RolesCreate) AddUsers(u ...*Users) *RolesCreate

AddUsers adds the "users" edges to the Users entity.

func (*RolesCreate) Exec

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

Exec executes the query.

func (*RolesCreate) ExecX

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

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

func (*RolesCreate) Mutation

func (rc *RolesCreate) Mutation() *RolesMutation

Mutation returns the RolesMutation object of the builder.

func (*RolesCreate) Save

func (rc *RolesCreate) Save(ctx context.Context) (*Roles, error)

Save creates the Roles in the database.

func (*RolesCreate) SaveX

func (rc *RolesCreate) SaveX(ctx context.Context) *Roles

SaveX calls Save and panics if Save returns an error.

func (*RolesCreate) SetCreatedAt

func (rc *RolesCreate) SetCreatedAt(t time.Time) *RolesCreate

SetCreatedAt sets the "created_at" field.

func (*RolesCreate) SetDescription

func (rc *RolesCreate) SetDescription(s string) *RolesCreate

SetDescription sets the "description" field.

func (*RolesCreate) SetID

func (rc *RolesCreate) SetID(i int) *RolesCreate

SetID sets the "id" field.

func (*RolesCreate) SetName

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

SetName sets the "name" field.

func (*RolesCreate) SetNillableCreatedAt

func (rc *RolesCreate) SetNillableCreatedAt(t *time.Time) *RolesCreate

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

func (*RolesCreate) SetNillableDescription

func (rc *RolesCreate) SetNillableDescription(s *string) *RolesCreate

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

type RolesCreateBulk

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

RolesCreateBulk is the builder for creating many Roles entities in bulk.

func (*RolesCreateBulk) Exec

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

Exec executes the query.

func (*RolesCreateBulk) ExecX

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

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

func (*RolesCreateBulk) Save

func (rcb *RolesCreateBulk) Save(ctx context.Context) ([]*Roles, error)

Save creates the Roles entities in the database.

func (*RolesCreateBulk) SaveX

func (rcb *RolesCreateBulk) SaveX(ctx context.Context) []*Roles

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

type RolesDelete

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

RolesDelete is the builder for deleting a Roles entity.

func (*RolesDelete) Exec

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

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

func (*RolesDelete) ExecX

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

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

func (*RolesDelete) Where

func (rd *RolesDelete) Where(ps ...predicate.Roles) *RolesDelete

Where appends a list predicates to the RolesDelete builder.

type RolesDeleteOne

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

RolesDeleteOne is the builder for deleting a single Roles entity.

func (*RolesDeleteOne) Exec

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

Exec executes the deletion query.

func (*RolesDeleteOne) ExecX

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

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

func (*RolesDeleteOne) Where

func (rdo *RolesDeleteOne) Where(ps ...predicate.Roles) *RolesDeleteOne

Where appends a list predicates to the RolesDelete builder.

type RolesEdges

type RolesEdges struct {
	// Users holds the value of the users edge.
	Users []*Users `json:"users,omitempty"`
	// Permissions holds the value of the permissions edge.
	Permissions []*Permissions `json:"permissions,omitempty"`
	// contains filtered or unexported fields
}

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

func (RolesEdges) PermissionsOrErr

func (e RolesEdges) PermissionsOrErr() ([]*Permissions, error)

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

func (RolesEdges) UsersOrErr

func (e RolesEdges) UsersOrErr() ([]*Users, error)

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

type RolesGroupBy

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

RolesGroupBy is the group-by builder for Roles entities.

func (*RolesGroupBy) Aggregate

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

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

func (*RolesGroupBy) Bool

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

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

func (*RolesGroupBy) BoolX

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

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

func (*RolesGroupBy) Bools

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

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

func (*RolesGroupBy) BoolsX

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

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

func (*RolesGroupBy) Float64

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

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

func (*RolesGroupBy) Float64X

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

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

func (*RolesGroupBy) Float64s

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

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

func (*RolesGroupBy) Float64sX

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

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

func (*RolesGroupBy) Int

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

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

func (*RolesGroupBy) IntX

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

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

func (*RolesGroupBy) Ints

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

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

func (*RolesGroupBy) IntsX

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

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

func (*RolesGroupBy) Scan

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

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

func (*RolesGroupBy) ScanX

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

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

func (*RolesGroupBy) String

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

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

func (*RolesGroupBy) StringX

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

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

func (*RolesGroupBy) Strings

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

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

func (*RolesGroupBy) StringsX

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

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

type RolesMutation

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

RolesMutation represents an operation that mutates the Roles nodes in the graph.

func (*RolesMutation) AddField

func (m *RolesMutation) 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 (*RolesMutation) AddPermissionIDs

func (m *RolesMutation) AddPermissionIDs(ids ...int)

AddPermissionIDs adds the "permissions" edge to the Permissions entity by ids.

func (*RolesMutation) AddUserIDs

func (m *RolesMutation) AddUserIDs(ids ...uuid.UUID)

AddUserIDs adds the "users" edge to the Users entity by ids.

func (*RolesMutation) AddedEdges

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

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

func (*RolesMutation) AddedField

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

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

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

func (*RolesMutation) AddedIDs

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

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

func (*RolesMutation) ClearDescription

func (m *RolesMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*RolesMutation) ClearEdge

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

func (m *RolesMutation) 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 (*RolesMutation) ClearPermissions

func (m *RolesMutation) ClearPermissions()

ClearPermissions clears the "permissions" edge to the Permissions entity.

func (*RolesMutation) ClearUsers

func (m *RolesMutation) ClearUsers()

ClearUsers clears the "users" edge to the Users entity.

func (*RolesMutation) ClearedEdges

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

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

func (*RolesMutation) ClearedFields

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

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

func (RolesMutation) Client

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

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

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

func (*RolesMutation) Description

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

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

func (*RolesMutation) DescriptionCleared

func (m *RolesMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*RolesMutation) EdgeCleared

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

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

func (*RolesMutation) Field

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

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

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

func (*RolesMutation) Fields

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

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

func (m *RolesMutation) 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 (*RolesMutation) Name

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

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

func (*RolesMutation) OldCreatedAt

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

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

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

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

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

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

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

func (m *RolesMutation) Op() Op

Op returns the operation name.

func (*RolesMutation) PermissionsCleared

func (m *RolesMutation) PermissionsCleared() bool

PermissionsCleared reports if the "permissions" edge to the Permissions entity was cleared.

func (*RolesMutation) PermissionsIDs

func (m *RolesMutation) PermissionsIDs() (ids []int)

PermissionsIDs returns the "permissions" edge IDs in the mutation.

func (*RolesMutation) RemovePermissionIDs

func (m *RolesMutation) RemovePermissionIDs(ids ...int)

RemovePermissionIDs removes the "permissions" edge to the Permissions entity by IDs.

func (*RolesMutation) RemoveUserIDs

func (m *RolesMutation) RemoveUserIDs(ids ...uuid.UUID)

RemoveUserIDs removes the "users" edge to the Users entity by IDs.

func (*RolesMutation) RemovedEdges

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

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

func (*RolesMutation) RemovedIDs

func (m *RolesMutation) 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 (*RolesMutation) RemovedPermissionsIDs

func (m *RolesMutation) RemovedPermissionsIDs() (ids []int)

RemovedPermissions returns the removed IDs of the "permissions" edge to the Permissions entity.

func (*RolesMutation) RemovedUsersIDs

func (m *RolesMutation) RemovedUsersIDs() (ids []uuid.UUID)

RemovedUsers returns the removed IDs of the "users" edge to the Users entity.

func (*RolesMutation) ResetCreatedAt

func (m *RolesMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RolesMutation) ResetDescription

func (m *RolesMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RolesMutation) ResetEdge

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

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

func (m *RolesMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RolesMutation) ResetPermissions

func (m *RolesMutation) ResetPermissions()

ResetPermissions resets all changes to the "permissions" edge.

func (*RolesMutation) ResetUsers

func (m *RolesMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*RolesMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RolesMutation) SetDescription

func (m *RolesMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RolesMutation) SetField

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

func (m *RolesMutation) SetID(id int)

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

func (*RolesMutation) SetName

func (m *RolesMutation) SetName(s string)

SetName sets the "name" field.

func (*RolesMutation) SetOp

func (m *RolesMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (RolesMutation) Tx

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

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

func (*RolesMutation) Type

func (m *RolesMutation) Type() string

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

func (*RolesMutation) UsersCleared

func (m *RolesMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the Users entity was cleared.

func (*RolesMutation) UsersIDs

func (m *RolesMutation) UsersIDs() (ids []uuid.UUID)

UsersIDs returns the "users" edge IDs in the mutation.

func (*RolesMutation) Where

func (m *RolesMutation) Where(ps ...predicate.Roles)

Where appends a list predicates to the RolesMutation builder.

func (*RolesMutation) WhereP

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

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

type RolesQuery

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

RolesQuery is the builder for querying Roles entities.

func (*RolesQuery) Aggregate

func (rq *RolesQuery) Aggregate(fns ...AggregateFunc) *RolesSelect

Aggregate returns a RolesSelect configured with the given aggregations.

func (*RolesQuery) All

func (rq *RolesQuery) All(ctx context.Context) ([]*Roles, error)

All executes the query and returns a list of RolesSlice.

func (*RolesQuery) AllX

func (rq *RolesQuery) AllX(ctx context.Context) []*Roles

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

func (*RolesQuery) Clone

func (rq *RolesQuery) Clone() *RolesQuery

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

func (*RolesQuery) Count

func (rq *RolesQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RolesQuery) CountX

func (rq *RolesQuery) CountX(ctx context.Context) int

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

func (*RolesQuery) Exist

func (rq *RolesQuery) Exist(ctx context.Context) (bool, error)

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

func (*RolesQuery) ExistX

func (rq *RolesQuery) ExistX(ctx context.Context) bool

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

func (*RolesQuery) First

func (rq *RolesQuery) First(ctx context.Context) (*Roles, error)

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

func (*RolesQuery) FirstID

func (rq *RolesQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*RolesQuery) FirstIDX

func (rq *RolesQuery) FirstIDX(ctx context.Context) int

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

func (*RolesQuery) FirstX

func (rq *RolesQuery) FirstX(ctx context.Context) *Roles

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

func (*RolesQuery) GroupBy

func (rq *RolesQuery) GroupBy(field string, fields ...string) *RolesGroupBy

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.Roles.Query().
	GroupBy(roles.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RolesQuery) IDs

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

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

func (*RolesQuery) IDsX

func (rq *RolesQuery) IDsX(ctx context.Context) []int

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

func (*RolesQuery) Limit

func (rq *RolesQuery) Limit(limit int) *RolesQuery

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

func (*RolesQuery) Offset

func (rq *RolesQuery) Offset(offset int) *RolesQuery

Offset to start from.

func (*RolesQuery) Only

func (rq *RolesQuery) Only(ctx context.Context) (*Roles, error)

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

func (*RolesQuery) OnlyID

func (rq *RolesQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*RolesQuery) OnlyIDX

func (rq *RolesQuery) OnlyIDX(ctx context.Context) int

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

func (*RolesQuery) OnlyX

func (rq *RolesQuery) OnlyX(ctx context.Context) *Roles

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

func (*RolesQuery) Order

func (rq *RolesQuery) Order(o ...roles.OrderOption) *RolesQuery

Order specifies how the records should be ordered.

func (*RolesQuery) QueryPermissions

func (rq *RolesQuery) QueryPermissions() *PermissionsQuery

QueryPermissions chains the current query on the "permissions" edge.

func (*RolesQuery) QueryUsers

func (rq *RolesQuery) QueryUsers() *UsersQuery

QueryUsers chains the current query on the "users" edge.

func (*RolesQuery) Select

func (rq *RolesQuery) Select(fields ...string) *RolesSelect

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.Roles.Query().
	Select(roles.FieldName).
	Scan(ctx, &v)

func (*RolesQuery) Unique

func (rq *RolesQuery) Unique(unique bool) *RolesQuery

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

func (rq *RolesQuery) Where(ps ...predicate.Roles) *RolesQuery

Where adds a new predicate for the RolesQuery builder.

func (*RolesQuery) WithPermissions

func (rq *RolesQuery) WithPermissions(opts ...func(*PermissionsQuery)) *RolesQuery

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

func (*RolesQuery) WithUsers

func (rq *RolesQuery) WithUsers(opts ...func(*UsersQuery)) *RolesQuery

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

type RolesSelect

type RolesSelect struct {
	*RolesQuery
	// contains filtered or unexported fields
}

RolesSelect is the builder for selecting fields of Roles entities.

func (*RolesSelect) Aggregate

func (rs *RolesSelect) Aggregate(fns ...AggregateFunc) *RolesSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RolesSelect) Bool

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

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

func (*RolesSelect) BoolX

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

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

func (*RolesSelect) Bools

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

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

func (*RolesSelect) BoolsX

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

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

func (*RolesSelect) Float64

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

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

func (*RolesSelect) Float64X

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

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

func (*RolesSelect) Float64s

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

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

func (*RolesSelect) Float64sX

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

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

func (*RolesSelect) Int

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

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

func (*RolesSelect) IntX

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

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

func (*RolesSelect) Ints

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

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

func (*RolesSelect) IntsX

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

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

func (*RolesSelect) Scan

func (rs *RolesSelect) Scan(ctx context.Context, v any) error

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

func (*RolesSelect) ScanX

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

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

func (*RolesSelect) String

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

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

func (*RolesSelect) StringX

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

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

func (*RolesSelect) Strings

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

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

func (*RolesSelect) StringsX

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

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

type RolesSlice

type RolesSlice []*Roles

RolesSlice is a parsable slice of Roles.

type RolesUpdate

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

RolesUpdate is the builder for updating Roles entities.

func (*RolesUpdate) AddPermissionIDs

func (ru *RolesUpdate) AddPermissionIDs(ids ...int) *RolesUpdate

AddPermissionIDs adds the "permissions" edge to the Permissions entity by IDs.

func (*RolesUpdate) AddPermissions

func (ru *RolesUpdate) AddPermissions(p ...*Permissions) *RolesUpdate

AddPermissions adds the "permissions" edges to the Permissions entity.

func (*RolesUpdate) AddUserIDs

func (ru *RolesUpdate) AddUserIDs(ids ...uuid.UUID) *RolesUpdate

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*RolesUpdate) AddUsers

func (ru *RolesUpdate) AddUsers(u ...*Users) *RolesUpdate

AddUsers adds the "users" edges to the Users entity.

func (*RolesUpdate) ClearDescription

func (ru *RolesUpdate) ClearDescription() *RolesUpdate

ClearDescription clears the value of the "description" field.

func (*RolesUpdate) ClearPermissions

func (ru *RolesUpdate) ClearPermissions() *RolesUpdate

ClearPermissions clears all "permissions" edges to the Permissions entity.

func (*RolesUpdate) ClearUsers

func (ru *RolesUpdate) ClearUsers() *RolesUpdate

ClearUsers clears all "users" edges to the Users entity.

func (*RolesUpdate) Exec

func (ru *RolesUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RolesUpdate) ExecX

func (ru *RolesUpdate) ExecX(ctx context.Context)

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

func (*RolesUpdate) Mutation

func (ru *RolesUpdate) Mutation() *RolesMutation

Mutation returns the RolesMutation object of the builder.

func (*RolesUpdate) RemovePermissionIDs

func (ru *RolesUpdate) RemovePermissionIDs(ids ...int) *RolesUpdate

RemovePermissionIDs removes the "permissions" edge to Permissions entities by IDs.

func (*RolesUpdate) RemovePermissions

func (ru *RolesUpdate) RemovePermissions(p ...*Permissions) *RolesUpdate

RemovePermissions removes "permissions" edges to Permissions entities.

func (*RolesUpdate) RemoveUserIDs

func (ru *RolesUpdate) RemoveUserIDs(ids ...uuid.UUID) *RolesUpdate

RemoveUserIDs removes the "users" edge to Users entities by IDs.

func (*RolesUpdate) RemoveUsers

func (ru *RolesUpdate) RemoveUsers(u ...*Users) *RolesUpdate

RemoveUsers removes "users" edges to Users entities.

func (*RolesUpdate) Save

func (ru *RolesUpdate) Save(ctx context.Context) (int, error)

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

func (*RolesUpdate) SaveX

func (ru *RolesUpdate) SaveX(ctx context.Context) int

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

func (*RolesUpdate) SetDescription

func (ru *RolesUpdate) SetDescription(s string) *RolesUpdate

SetDescription sets the "description" field.

func (*RolesUpdate) SetName

func (ru *RolesUpdate) SetName(s string) *RolesUpdate

SetName sets the "name" field.

func (*RolesUpdate) SetNillableDescription

func (ru *RolesUpdate) SetNillableDescription(s *string) *RolesUpdate

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

func (*RolesUpdate) SetNillableName

func (ru *RolesUpdate) SetNillableName(s *string) *RolesUpdate

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

func (*RolesUpdate) Where

func (ru *RolesUpdate) Where(ps ...predicate.Roles) *RolesUpdate

Where appends a list predicates to the RolesUpdate builder.

type RolesUpdateOne

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

RolesUpdateOne is the builder for updating a single Roles entity.

func (*RolesUpdateOne) AddPermissionIDs

func (ruo *RolesUpdateOne) AddPermissionIDs(ids ...int) *RolesUpdateOne

AddPermissionIDs adds the "permissions" edge to the Permissions entity by IDs.

func (*RolesUpdateOne) AddPermissions

func (ruo *RolesUpdateOne) AddPermissions(p ...*Permissions) *RolesUpdateOne

AddPermissions adds the "permissions" edges to the Permissions entity.

func (*RolesUpdateOne) AddUserIDs

func (ruo *RolesUpdateOne) AddUserIDs(ids ...uuid.UUID) *RolesUpdateOne

AddUserIDs adds the "users" edge to the Users entity by IDs.

func (*RolesUpdateOne) AddUsers

func (ruo *RolesUpdateOne) AddUsers(u ...*Users) *RolesUpdateOne

AddUsers adds the "users" edges to the Users entity.

func (*RolesUpdateOne) ClearDescription

func (ruo *RolesUpdateOne) ClearDescription() *RolesUpdateOne

ClearDescription clears the value of the "description" field.

func (*RolesUpdateOne) ClearPermissions

func (ruo *RolesUpdateOne) ClearPermissions() *RolesUpdateOne

ClearPermissions clears all "permissions" edges to the Permissions entity.

func (*RolesUpdateOne) ClearUsers

func (ruo *RolesUpdateOne) ClearUsers() *RolesUpdateOne

ClearUsers clears all "users" edges to the Users entity.

func (*RolesUpdateOne) Exec

func (ruo *RolesUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RolesUpdateOne) ExecX

func (ruo *RolesUpdateOne) ExecX(ctx context.Context)

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

func (*RolesUpdateOne) Mutation

func (ruo *RolesUpdateOne) Mutation() *RolesMutation

Mutation returns the RolesMutation object of the builder.

func (*RolesUpdateOne) RemovePermissionIDs

func (ruo *RolesUpdateOne) RemovePermissionIDs(ids ...int) *RolesUpdateOne

RemovePermissionIDs removes the "permissions" edge to Permissions entities by IDs.

func (*RolesUpdateOne) RemovePermissions

func (ruo *RolesUpdateOne) RemovePermissions(p ...*Permissions) *RolesUpdateOne

RemovePermissions removes "permissions" edges to Permissions entities.

func (*RolesUpdateOne) RemoveUserIDs

func (ruo *RolesUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *RolesUpdateOne

RemoveUserIDs removes the "users" edge to Users entities by IDs.

func (*RolesUpdateOne) RemoveUsers

func (ruo *RolesUpdateOne) RemoveUsers(u ...*Users) *RolesUpdateOne

RemoveUsers removes "users" edges to Users entities.

func (*RolesUpdateOne) Save

func (ruo *RolesUpdateOne) Save(ctx context.Context) (*Roles, error)

Save executes the query and returns the updated Roles entity.

func (*RolesUpdateOne) SaveX

func (ruo *RolesUpdateOne) SaveX(ctx context.Context) *Roles

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

func (*RolesUpdateOne) Select

func (ruo *RolesUpdateOne) Select(field string, fields ...string) *RolesUpdateOne

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

func (*RolesUpdateOne) SetDescription

func (ruo *RolesUpdateOne) SetDescription(s string) *RolesUpdateOne

SetDescription sets the "description" field.

func (*RolesUpdateOne) SetName

func (ruo *RolesUpdateOne) SetName(s string) *RolesUpdateOne

SetName sets the "name" field.

func (*RolesUpdateOne) SetNillableDescription

func (ruo *RolesUpdateOne) SetNillableDescription(s *string) *RolesUpdateOne

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

func (*RolesUpdateOne) SetNillableName

func (ruo *RolesUpdateOne) SetNillableName(s *string) *RolesUpdateOne

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

func (*RolesUpdateOne) Where

func (ruo *RolesUpdateOne) Where(ps ...predicate.Roles) *RolesUpdateOne

Where appends a list predicates to the RolesUpdate builder.

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Permissions is the client for interacting with the Permissions builders.
	Permissions *PermissionsClient
	// Roles is the client for interacting with the Roles builders.
	Roles *RolesClient
	// Users is the client for interacting with the Users builders.
	Users *UsersClient
	// 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 Users

type Users struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// PasswordHash holds the value of the "password_hash" field.
	PasswordHash string `json:"password_hash,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// LastLogin holds the value of the "last_login" field.
	LastLogin time.Time `json:"last_login,omitempty"`
	// IsActive holds the value of the "is_active" field.
	IsActive bool `json:"is_active,omitempty"`
	// EmailVerified holds the value of the "email_verified" field.
	EmailVerified bool `json:"email_verified,omitempty"`
	// VerificationToken holds the value of the "verification_token" field.
	VerificationToken *string `json:"verification_token,omitempty"`
	// VerificationTokenExpiry holds the value of the "verification_token_expiry" field.
	VerificationTokenExpiry *time.Time `json:"verification_token_expiry,omitempty"`
	// PasswordResetToken holds the value of the "password_reset_token" field.
	PasswordResetToken *string `json:"password_reset_token,omitempty"`
	// PasswordResetTokenExpiry holds the value of the "password_reset_token_expiry" field.
	PasswordResetTokenExpiry *time.Time `json:"password_reset_token_expiry,omitempty"`
	// Metadata holds the value of the "metadata" field.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UsersQuery when eager-loading is set.
	Edges UsersEdges `json:"edges"`
	// contains filtered or unexported fields
}

Users is the model entity for the Users schema.

func (*Users) QueryRoles

func (u *Users) QueryRoles() *RolesQuery

QueryRoles queries the "roles" edge of the Users entity.

func (*Users) String

func (u *Users) String() string

String implements the fmt.Stringer.

func (*Users) Unwrap

func (u *Users) Unwrap() *Users

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

func (u *Users) Update() *UsersUpdateOne

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

func (*Users) Value

func (u *Users) Value(name string) (ent.Value, error)

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

type UsersClient

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

UsersClient is a client for the Users schema.

func NewUsersClient

func NewUsersClient(c config) *UsersClient

NewUsersClient returns a client for the Users from the given config.

func (*UsersClient) Create

func (c *UsersClient) Create() *UsersCreate

Create returns a builder for creating a Users entity.

func (*UsersClient) CreateBulk

func (c *UsersClient) CreateBulk(builders ...*UsersCreate) *UsersCreateBulk

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

func (*UsersClient) Delete

func (c *UsersClient) Delete() *UsersDelete

Delete returns a delete builder for Users.

func (*UsersClient) DeleteOne

func (c *UsersClient) DeleteOne(u *Users) *UsersDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UsersClient) DeleteOneID

func (c *UsersClient) DeleteOneID(id uuid.UUID) *UsersDeleteOne

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

func (*UsersClient) Get

func (c *UsersClient) Get(ctx context.Context, id uuid.UUID) (*Users, error)

Get returns a Users entity by its id.

func (*UsersClient) GetX

func (c *UsersClient) GetX(ctx context.Context, id uuid.UUID) *Users

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

func (*UsersClient) Hooks

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

Hooks returns the client hooks.

func (*UsersClient) Intercept

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

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

func (*UsersClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UsersClient) MapCreateBulk

func (c *UsersClient) MapCreateBulk(slice any, setFunc func(*UsersCreate, int)) *UsersCreateBulk

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

func (c *UsersClient) Query() *UsersQuery

Query returns a query builder for Users.

func (*UsersClient) QueryRoles

func (c *UsersClient) QueryRoles(u *Users) *RolesQuery

QueryRoles queries the roles edge of a Users.

func (*UsersClient) Update

func (c *UsersClient) Update() *UsersUpdate

Update returns an update builder for Users.

func (*UsersClient) UpdateOne

func (c *UsersClient) UpdateOne(u *Users) *UsersUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UsersClient) UpdateOneID

func (c *UsersClient) UpdateOneID(id uuid.UUID) *UsersUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UsersClient) Use

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

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

type UsersCreate

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

UsersCreate is the builder for creating a Users entity.

func (*UsersCreate) AddRoleIDs

func (uc *UsersCreate) AddRoleIDs(ids ...int) *UsersCreate

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*UsersCreate) AddRoles

func (uc *UsersCreate) AddRoles(r ...*Roles) *UsersCreate

AddRoles adds the "roles" edges to the Roles entity.

func (*UsersCreate) Exec

func (uc *UsersCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersCreate) ExecX

func (uc *UsersCreate) ExecX(ctx context.Context)

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

func (*UsersCreate) Mutation

func (uc *UsersCreate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersCreate) Save

func (uc *UsersCreate) Save(ctx context.Context) (*Users, error)

Save creates the Users in the database.

func (*UsersCreate) SaveX

func (uc *UsersCreate) SaveX(ctx context.Context) *Users

SaveX calls Save and panics if Save returns an error.

func (*UsersCreate) SetCreatedAt

func (uc *UsersCreate) SetCreatedAt(t time.Time) *UsersCreate

SetCreatedAt sets the "created_at" field.

func (*UsersCreate) SetEmail

func (uc *UsersCreate) SetEmail(s string) *UsersCreate

SetEmail sets the "email" field.

func (*UsersCreate) SetEmailVerified

func (uc *UsersCreate) SetEmailVerified(b bool) *UsersCreate

SetEmailVerified sets the "email_verified" field.

func (*UsersCreate) SetID

func (uc *UsersCreate) SetID(u uuid.UUID) *UsersCreate

SetID sets the "id" field.

func (*UsersCreate) SetIsActive

func (uc *UsersCreate) SetIsActive(b bool) *UsersCreate

SetIsActive sets the "is_active" field.

func (*UsersCreate) SetLastLogin

func (uc *UsersCreate) SetLastLogin(t time.Time) *UsersCreate

SetLastLogin sets the "last_login" field.

func (*UsersCreate) SetMetadata

func (uc *UsersCreate) SetMetadata(m map[string]interface{}) *UsersCreate

SetMetadata sets the "metadata" field.

func (*UsersCreate) SetNillableCreatedAt

func (uc *UsersCreate) SetNillableCreatedAt(t *time.Time) *UsersCreate

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

func (*UsersCreate) SetNillableEmailVerified

func (uc *UsersCreate) SetNillableEmailVerified(b *bool) *UsersCreate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UsersCreate) SetNillableID

func (uc *UsersCreate) SetNillableID(u *uuid.UUID) *UsersCreate

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

func (*UsersCreate) SetNillableIsActive

func (uc *UsersCreate) SetNillableIsActive(b *bool) *UsersCreate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*UsersCreate) SetNillableLastLogin

func (uc *UsersCreate) SetNillableLastLogin(t *time.Time) *UsersCreate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UsersCreate) SetNillablePasswordResetToken

func (uc *UsersCreate) SetNillablePasswordResetToken(s *string) *UsersCreate

SetNillablePasswordResetToken sets the "password_reset_token" field if the given value is not nil.

func (*UsersCreate) SetNillablePasswordResetTokenExpiry

func (uc *UsersCreate) SetNillablePasswordResetTokenExpiry(t *time.Time) *UsersCreate

SetNillablePasswordResetTokenExpiry sets the "password_reset_token_expiry" field if the given value is not nil.

func (*UsersCreate) SetNillableUpdatedAt

func (uc *UsersCreate) SetNillableUpdatedAt(t *time.Time) *UsersCreate

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

func (*UsersCreate) SetNillableVerificationToken

func (uc *UsersCreate) SetNillableVerificationToken(s *string) *UsersCreate

SetNillableVerificationToken sets the "verification_token" field if the given value is not nil.

func (*UsersCreate) SetNillableVerificationTokenExpiry

func (uc *UsersCreate) SetNillableVerificationTokenExpiry(t *time.Time) *UsersCreate

SetNillableVerificationTokenExpiry sets the "verification_token_expiry" field if the given value is not nil.

func (*UsersCreate) SetPasswordHash

func (uc *UsersCreate) SetPasswordHash(s string) *UsersCreate

SetPasswordHash sets the "password_hash" field.

func (*UsersCreate) SetPasswordResetToken

func (uc *UsersCreate) SetPasswordResetToken(s string) *UsersCreate

SetPasswordResetToken sets the "password_reset_token" field.

func (*UsersCreate) SetPasswordResetTokenExpiry

func (uc *UsersCreate) SetPasswordResetTokenExpiry(t time.Time) *UsersCreate

SetPasswordResetTokenExpiry sets the "password_reset_token_expiry" field.

func (*UsersCreate) SetUpdatedAt

func (uc *UsersCreate) SetUpdatedAt(t time.Time) *UsersCreate

SetUpdatedAt sets the "updated_at" field.

func (*UsersCreate) SetVerificationToken

func (uc *UsersCreate) SetVerificationToken(s string) *UsersCreate

SetVerificationToken sets the "verification_token" field.

func (*UsersCreate) SetVerificationTokenExpiry

func (uc *UsersCreate) SetVerificationTokenExpiry(t time.Time) *UsersCreate

SetVerificationTokenExpiry sets the "verification_token_expiry" field.

type UsersCreateBulk

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

UsersCreateBulk is the builder for creating many Users entities in bulk.

func (*UsersCreateBulk) Exec

func (ucb *UsersCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersCreateBulk) ExecX

func (ucb *UsersCreateBulk) ExecX(ctx context.Context)

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

func (*UsersCreateBulk) Save

func (ucb *UsersCreateBulk) Save(ctx context.Context) ([]*Users, error)

Save creates the Users entities in the database.

func (*UsersCreateBulk) SaveX

func (ucb *UsersCreateBulk) SaveX(ctx context.Context) []*Users

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

type UsersDelete

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

UsersDelete is the builder for deleting a Users entity.

func (*UsersDelete) Exec

func (ud *UsersDelete) Exec(ctx context.Context) (int, error)

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

func (*UsersDelete) ExecX

func (ud *UsersDelete) ExecX(ctx context.Context) int

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

func (*UsersDelete) Where

func (ud *UsersDelete) Where(ps ...predicate.Users) *UsersDelete

Where appends a list predicates to the UsersDelete builder.

type UsersDeleteOne

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

UsersDeleteOne is the builder for deleting a single Users entity.

func (*UsersDeleteOne) Exec

func (udo *UsersDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UsersDeleteOne) ExecX

func (udo *UsersDeleteOne) ExecX(ctx context.Context)

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

func (*UsersDeleteOne) Where

func (udo *UsersDeleteOne) Where(ps ...predicate.Users) *UsersDeleteOne

Where appends a list predicates to the UsersDelete builder.

type UsersEdges

type UsersEdges struct {
	// Roles holds the value of the roles edge.
	Roles []*Roles `json:"roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (UsersEdges) RolesOrErr

func (e UsersEdges) RolesOrErr() ([]*Roles, error)

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

type UsersGroupBy

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

UsersGroupBy is the group-by builder for Users entities.

func (*UsersGroupBy) Aggregate

func (ugb *UsersGroupBy) Aggregate(fns ...AggregateFunc) *UsersGroupBy

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

func (*UsersGroupBy) Bool

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

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

func (*UsersGroupBy) BoolX

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

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

func (*UsersGroupBy) Bools

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

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

func (*UsersGroupBy) BoolsX

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

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

func (*UsersGroupBy) Float64

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

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

func (*UsersGroupBy) Float64X

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

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

func (*UsersGroupBy) Float64s

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

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

func (*UsersGroupBy) Float64sX

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

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

func (*UsersGroupBy) Int

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

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

func (*UsersGroupBy) IntX

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

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

func (*UsersGroupBy) Ints

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

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

func (*UsersGroupBy) IntsX

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

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

func (*UsersGroupBy) Scan

func (ugb *UsersGroupBy) Scan(ctx context.Context, v any) error

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

func (*UsersGroupBy) ScanX

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

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

func (*UsersGroupBy) String

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

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

func (*UsersGroupBy) StringX

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

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

func (*UsersGroupBy) Strings

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

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

func (*UsersGroupBy) StringsX

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

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

type UsersMutation

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

UsersMutation represents an operation that mutates the Users nodes in the graph.

func (*UsersMutation) AddField

func (m *UsersMutation) 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 (*UsersMutation) AddRoleIDs

func (m *UsersMutation) AddRoleIDs(ids ...int)

AddRoleIDs adds the "roles" edge to the Roles entity by ids.

func (*UsersMutation) AddedEdges

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

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

func (*UsersMutation) AddedField

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

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

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

func (*UsersMutation) AddedIDs

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

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

func (*UsersMutation) ClearEdge

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

func (m *UsersMutation) 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 (*UsersMutation) ClearLastLogin

func (m *UsersMutation) ClearLastLogin()

ClearLastLogin clears the value of the "last_login" field.

func (*UsersMutation) ClearMetadata

func (m *UsersMutation) ClearMetadata()

ClearMetadata clears the value of the "metadata" field.

func (*UsersMutation) ClearPasswordResetToken

func (m *UsersMutation) ClearPasswordResetToken()

ClearPasswordResetToken clears the value of the "password_reset_token" field.

func (*UsersMutation) ClearPasswordResetTokenExpiry

func (m *UsersMutation) ClearPasswordResetTokenExpiry()

ClearPasswordResetTokenExpiry clears the value of the "password_reset_token_expiry" field.

func (*UsersMutation) ClearRoles

func (m *UsersMutation) ClearRoles()

ClearRoles clears the "roles" edge to the Roles entity.

func (*UsersMutation) ClearVerificationToken

func (m *UsersMutation) ClearVerificationToken()

ClearVerificationToken clears the value of the "verification_token" field.

func (*UsersMutation) ClearVerificationTokenExpiry

func (m *UsersMutation) ClearVerificationTokenExpiry()

ClearVerificationTokenExpiry clears the value of the "verification_token_expiry" field.

func (*UsersMutation) ClearedEdges

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

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

func (*UsersMutation) ClearedFields

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

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

func (UsersMutation) Client

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

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

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

func (*UsersMutation) EdgeCleared

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

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

func (*UsersMutation) Email

func (m *UsersMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UsersMutation) EmailVerified

func (m *UsersMutation) EmailVerified() (r bool, exists bool)

EmailVerified returns the value of the "email_verified" field in the mutation.

func (*UsersMutation) Field

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

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

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

func (*UsersMutation) Fields

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

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

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

func (*UsersMutation) IDs

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

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

func (*UsersMutation) IsActive

func (m *UsersMutation) IsActive() (r bool, exists bool)

IsActive returns the value of the "is_active" field in the mutation.

func (*UsersMutation) LastLogin

func (m *UsersMutation) LastLogin() (r time.Time, exists bool)

LastLogin returns the value of the "last_login" field in the mutation.

func (*UsersMutation) LastLoginCleared

func (m *UsersMutation) LastLoginCleared() bool

LastLoginCleared returns if the "last_login" field was cleared in this mutation.

func (*UsersMutation) Metadata

func (m *UsersMutation) Metadata() (r map[string]interface{}, exists bool)

Metadata returns the value of the "metadata" field in the mutation.

func (*UsersMutation) MetadataCleared

func (m *UsersMutation) MetadataCleared() bool

MetadataCleared returns if the "metadata" field was cleared in this mutation.

func (*UsersMutation) OldCreatedAt

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

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

func (m *UsersMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the Users entity. If the Users 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 (*UsersMutation) OldEmailVerified

func (m *UsersMutation) OldEmailVerified(ctx context.Context) (v bool, err error)

OldEmailVerified returns the old "email_verified" field's value of the Users entity. If the Users 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 (*UsersMutation) OldField

func (m *UsersMutation) 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 (*UsersMutation) OldIsActive

func (m *UsersMutation) OldIsActive(ctx context.Context) (v bool, err error)

OldIsActive returns the old "is_active" field's value of the Users entity. If the Users 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 (*UsersMutation) OldLastLogin

func (m *UsersMutation) OldLastLogin(ctx context.Context) (v time.Time, err error)

OldLastLogin returns the old "last_login" field's value of the Users entity. If the Users 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 (*UsersMutation) OldMetadata

func (m *UsersMutation) OldMetadata(ctx context.Context) (v map[string]interface{}, err error)

OldMetadata returns the old "metadata" field's value of the Users entity. If the Users 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 (*UsersMutation) OldPasswordHash

func (m *UsersMutation) OldPasswordHash(ctx context.Context) (v string, err error)

OldPasswordHash returns the old "password_hash" field's value of the Users entity. If the Users 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 (*UsersMutation) OldPasswordResetToken

func (m *UsersMutation) OldPasswordResetToken(ctx context.Context) (v *string, err error)

OldPasswordResetToken returns the old "password_reset_token" field's value of the Users entity. If the Users 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 (*UsersMutation) OldPasswordResetTokenExpiry

func (m *UsersMutation) OldPasswordResetTokenExpiry(ctx context.Context) (v *time.Time, err error)

OldPasswordResetTokenExpiry returns the old "password_reset_token_expiry" field's value of the Users entity. If the Users 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 (*UsersMutation) OldUpdatedAt

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

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

func (m *UsersMutation) OldVerificationToken(ctx context.Context) (v *string, err error)

OldVerificationToken returns the old "verification_token" field's value of the Users entity. If the Users 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 (*UsersMutation) OldVerificationTokenExpiry

func (m *UsersMutation) OldVerificationTokenExpiry(ctx context.Context) (v *time.Time, err error)

OldVerificationTokenExpiry returns the old "verification_token_expiry" field's value of the Users entity. If the Users 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 (*UsersMutation) Op

func (m *UsersMutation) Op() Op

Op returns the operation name.

func (*UsersMutation) PasswordHash

func (m *UsersMutation) PasswordHash() (r string, exists bool)

PasswordHash returns the value of the "password_hash" field in the mutation.

func (*UsersMutation) PasswordResetToken

func (m *UsersMutation) PasswordResetToken() (r string, exists bool)

PasswordResetToken returns the value of the "password_reset_token" field in the mutation.

func (*UsersMutation) PasswordResetTokenCleared

func (m *UsersMutation) PasswordResetTokenCleared() bool

PasswordResetTokenCleared returns if the "password_reset_token" field was cleared in this mutation.

func (*UsersMutation) PasswordResetTokenExpiry

func (m *UsersMutation) PasswordResetTokenExpiry() (r time.Time, exists bool)

PasswordResetTokenExpiry returns the value of the "password_reset_token_expiry" field in the mutation.

func (*UsersMutation) PasswordResetTokenExpiryCleared

func (m *UsersMutation) PasswordResetTokenExpiryCleared() bool

PasswordResetTokenExpiryCleared returns if the "password_reset_token_expiry" field was cleared in this mutation.

func (*UsersMutation) RemoveRoleIDs

func (m *UsersMutation) RemoveRoleIDs(ids ...int)

RemoveRoleIDs removes the "roles" edge to the Roles entity by IDs.

func (*UsersMutation) RemovedEdges

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

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

func (*UsersMutation) RemovedIDs

func (m *UsersMutation) 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 (*UsersMutation) RemovedRolesIDs

func (m *UsersMutation) RemovedRolesIDs() (ids []int)

RemovedRoles returns the removed IDs of the "roles" edge to the Roles entity.

func (*UsersMutation) ResetCreatedAt

func (m *UsersMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UsersMutation) ResetEdge

func (m *UsersMutation) 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 (*UsersMutation) ResetEmail

func (m *UsersMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UsersMutation) ResetEmailVerified

func (m *UsersMutation) ResetEmailVerified()

ResetEmailVerified resets all changes to the "email_verified" field.

func (*UsersMutation) ResetField

func (m *UsersMutation) 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 (*UsersMutation) ResetIsActive

func (m *UsersMutation) ResetIsActive()

ResetIsActive resets all changes to the "is_active" field.

func (*UsersMutation) ResetLastLogin

func (m *UsersMutation) ResetLastLogin()

ResetLastLogin resets all changes to the "last_login" field.

func (*UsersMutation) ResetMetadata

func (m *UsersMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" field.

func (*UsersMutation) ResetPasswordHash

func (m *UsersMutation) ResetPasswordHash()

ResetPasswordHash resets all changes to the "password_hash" field.

func (*UsersMutation) ResetPasswordResetToken

func (m *UsersMutation) ResetPasswordResetToken()

ResetPasswordResetToken resets all changes to the "password_reset_token" field.

func (*UsersMutation) ResetPasswordResetTokenExpiry

func (m *UsersMutation) ResetPasswordResetTokenExpiry()

ResetPasswordResetTokenExpiry resets all changes to the "password_reset_token_expiry" field.

func (*UsersMutation) ResetRoles

func (m *UsersMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*UsersMutation) ResetUpdatedAt

func (m *UsersMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UsersMutation) ResetVerificationToken

func (m *UsersMutation) ResetVerificationToken()

ResetVerificationToken resets all changes to the "verification_token" field.

func (*UsersMutation) ResetVerificationTokenExpiry

func (m *UsersMutation) ResetVerificationTokenExpiry()

ResetVerificationTokenExpiry resets all changes to the "verification_token_expiry" field.

func (*UsersMutation) RolesCleared

func (m *UsersMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Roles entity was cleared.

func (*UsersMutation) RolesIDs

func (m *UsersMutation) RolesIDs() (ids []int)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*UsersMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UsersMutation) SetEmail

func (m *UsersMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UsersMutation) SetEmailVerified

func (m *UsersMutation) SetEmailVerified(b bool)

SetEmailVerified sets the "email_verified" field.

func (*UsersMutation) SetField

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

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

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

func (*UsersMutation) SetIsActive

func (m *UsersMutation) SetIsActive(b bool)

SetIsActive sets the "is_active" field.

func (*UsersMutation) SetLastLogin

func (m *UsersMutation) SetLastLogin(t time.Time)

SetLastLogin sets the "last_login" field.

func (*UsersMutation) SetMetadata

func (m *UsersMutation) SetMetadata(value map[string]interface{})

SetMetadata sets the "metadata" field.

func (*UsersMutation) SetOp

func (m *UsersMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UsersMutation) SetPasswordHash

func (m *UsersMutation) SetPasswordHash(s string)

SetPasswordHash sets the "password_hash" field.

func (*UsersMutation) SetPasswordResetToken

func (m *UsersMutation) SetPasswordResetToken(s string)

SetPasswordResetToken sets the "password_reset_token" field.

func (*UsersMutation) SetPasswordResetTokenExpiry

func (m *UsersMutation) SetPasswordResetTokenExpiry(t time.Time)

SetPasswordResetTokenExpiry sets the "password_reset_token_expiry" field.

func (*UsersMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UsersMutation) SetVerificationToken

func (m *UsersMutation) SetVerificationToken(s string)

SetVerificationToken sets the "verification_token" field.

func (*UsersMutation) SetVerificationTokenExpiry

func (m *UsersMutation) SetVerificationTokenExpiry(t time.Time)

SetVerificationTokenExpiry sets the "verification_token_expiry" field.

func (UsersMutation) Tx

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

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

func (*UsersMutation) Type

func (m *UsersMutation) Type() string

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

func (*UsersMutation) UpdatedAt

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

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

func (*UsersMutation) VerificationToken

func (m *UsersMutation) VerificationToken() (r string, exists bool)

VerificationToken returns the value of the "verification_token" field in the mutation.

func (*UsersMutation) VerificationTokenCleared

func (m *UsersMutation) VerificationTokenCleared() bool

VerificationTokenCleared returns if the "verification_token" field was cleared in this mutation.

func (*UsersMutation) VerificationTokenExpiry

func (m *UsersMutation) VerificationTokenExpiry() (r time.Time, exists bool)

VerificationTokenExpiry returns the value of the "verification_token_expiry" field in the mutation.

func (*UsersMutation) VerificationTokenExpiryCleared

func (m *UsersMutation) VerificationTokenExpiryCleared() bool

VerificationTokenExpiryCleared returns if the "verification_token_expiry" field was cleared in this mutation.

func (*UsersMutation) Where

func (m *UsersMutation) Where(ps ...predicate.Users)

Where appends a list predicates to the UsersMutation builder.

func (*UsersMutation) WhereP

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

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

type UsersQuery

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

UsersQuery is the builder for querying Users entities.

func (*UsersQuery) Aggregate

func (uq *UsersQuery) Aggregate(fns ...AggregateFunc) *UsersSelect

Aggregate returns a UsersSelect configured with the given aggregations.

func (*UsersQuery) All

func (uq *UsersQuery) All(ctx context.Context) ([]*Users, error)

All executes the query and returns a list of UsersSlice.

func (*UsersQuery) AllX

func (uq *UsersQuery) AllX(ctx context.Context) []*Users

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

func (*UsersQuery) Clone

func (uq *UsersQuery) Clone() *UsersQuery

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

func (*UsersQuery) Count

func (uq *UsersQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UsersQuery) CountX

func (uq *UsersQuery) CountX(ctx context.Context) int

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

func (*UsersQuery) Exist

func (uq *UsersQuery) Exist(ctx context.Context) (bool, error)

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

func (*UsersQuery) ExistX

func (uq *UsersQuery) ExistX(ctx context.Context) bool

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

func (*UsersQuery) First

func (uq *UsersQuery) First(ctx context.Context) (*Users, error)

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

func (*UsersQuery) FirstID

func (uq *UsersQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UsersQuery) FirstIDX

func (uq *UsersQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UsersQuery) FirstX

func (uq *UsersQuery) FirstX(ctx context.Context) *Users

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

func (*UsersQuery) GroupBy

func (uq *UsersQuery) GroupBy(field string, fields ...string) *UsersGroupBy

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

client.Users.Query().
	GroupBy(users.FieldEmail).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UsersQuery) IDs

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

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

func (*UsersQuery) IDsX

func (uq *UsersQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UsersQuery) Limit

func (uq *UsersQuery) Limit(limit int) *UsersQuery

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

func (*UsersQuery) Offset

func (uq *UsersQuery) Offset(offset int) *UsersQuery

Offset to start from.

func (*UsersQuery) Only

func (uq *UsersQuery) Only(ctx context.Context) (*Users, error)

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

func (*UsersQuery) OnlyID

func (uq *UsersQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UsersQuery) OnlyIDX

func (uq *UsersQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UsersQuery) OnlyX

func (uq *UsersQuery) OnlyX(ctx context.Context) *Users

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

func (*UsersQuery) Order

func (uq *UsersQuery) Order(o ...users.OrderOption) *UsersQuery

Order specifies how the records should be ordered.

func (*UsersQuery) QueryRoles

func (uq *UsersQuery) QueryRoles() *RolesQuery

QueryRoles chains the current query on the "roles" edge.

func (*UsersQuery) Select

func (uq *UsersQuery) Select(fields ...string) *UsersSelect

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

client.Users.Query().
	Select(users.FieldEmail).
	Scan(ctx, &v)

func (*UsersQuery) Unique

func (uq *UsersQuery) Unique(unique bool) *UsersQuery

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

func (uq *UsersQuery) Where(ps ...predicate.Users) *UsersQuery

Where adds a new predicate for the UsersQuery builder.

func (*UsersQuery) WithRoles

func (uq *UsersQuery) WithRoles(opts ...func(*RolesQuery)) *UsersQuery

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

type UsersSelect

type UsersSelect struct {
	*UsersQuery
	// contains filtered or unexported fields
}

UsersSelect is the builder for selecting fields of Users entities.

func (*UsersSelect) Aggregate

func (us *UsersSelect) Aggregate(fns ...AggregateFunc) *UsersSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UsersSelect) Bool

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

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

func (*UsersSelect) BoolX

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

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

func (*UsersSelect) Bools

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

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

func (*UsersSelect) BoolsX

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

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

func (*UsersSelect) Float64

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

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

func (*UsersSelect) Float64X

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

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

func (*UsersSelect) Float64s

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

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

func (*UsersSelect) Float64sX

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

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

func (*UsersSelect) Int

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

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

func (*UsersSelect) IntX

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

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

func (*UsersSelect) Ints

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

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

func (*UsersSelect) IntsX

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

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

func (*UsersSelect) Scan

func (us *UsersSelect) Scan(ctx context.Context, v any) error

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

func (*UsersSelect) ScanX

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

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

func (*UsersSelect) String

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

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

func (*UsersSelect) StringX

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

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

func (*UsersSelect) Strings

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

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

func (*UsersSelect) StringsX

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

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

type UsersSlice

type UsersSlice []*Users

UsersSlice is a parsable slice of Users.

type UsersUpdate

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

UsersUpdate is the builder for updating Users entities.

func (*UsersUpdate) AddRoleIDs

func (uu *UsersUpdate) AddRoleIDs(ids ...int) *UsersUpdate

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*UsersUpdate) AddRoles

func (uu *UsersUpdate) AddRoles(r ...*Roles) *UsersUpdate

AddRoles adds the "roles" edges to the Roles entity.

func (*UsersUpdate) ClearLastLogin

func (uu *UsersUpdate) ClearLastLogin() *UsersUpdate

ClearLastLogin clears the value of the "last_login" field.

func (*UsersUpdate) ClearMetadata

func (uu *UsersUpdate) ClearMetadata() *UsersUpdate

ClearMetadata clears the value of the "metadata" field.

func (*UsersUpdate) ClearPasswordResetToken

func (uu *UsersUpdate) ClearPasswordResetToken() *UsersUpdate

ClearPasswordResetToken clears the value of the "password_reset_token" field.

func (*UsersUpdate) ClearPasswordResetTokenExpiry

func (uu *UsersUpdate) ClearPasswordResetTokenExpiry() *UsersUpdate

ClearPasswordResetTokenExpiry clears the value of the "password_reset_token_expiry" field.

func (*UsersUpdate) ClearRoles

func (uu *UsersUpdate) ClearRoles() *UsersUpdate

ClearRoles clears all "roles" edges to the Roles entity.

func (*UsersUpdate) ClearVerificationToken

func (uu *UsersUpdate) ClearVerificationToken() *UsersUpdate

ClearVerificationToken clears the value of the "verification_token" field.

func (*UsersUpdate) ClearVerificationTokenExpiry

func (uu *UsersUpdate) ClearVerificationTokenExpiry() *UsersUpdate

ClearVerificationTokenExpiry clears the value of the "verification_token_expiry" field.

func (*UsersUpdate) Exec

func (uu *UsersUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UsersUpdate) ExecX

func (uu *UsersUpdate) ExecX(ctx context.Context)

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

func (*UsersUpdate) Mutation

func (uu *UsersUpdate) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdate) RemoveRoleIDs

func (uu *UsersUpdate) RemoveRoleIDs(ids ...int) *UsersUpdate

RemoveRoleIDs removes the "roles" edge to Roles entities by IDs.

func (*UsersUpdate) RemoveRoles

func (uu *UsersUpdate) RemoveRoles(r ...*Roles) *UsersUpdate

RemoveRoles removes "roles" edges to Roles entities.

func (*UsersUpdate) Save

func (uu *UsersUpdate) Save(ctx context.Context) (int, error)

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

func (*UsersUpdate) SaveX

func (uu *UsersUpdate) SaveX(ctx context.Context) int

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

func (*UsersUpdate) SetCreatedAt

func (uu *UsersUpdate) SetCreatedAt(t time.Time) *UsersUpdate

SetCreatedAt sets the "created_at" field.

func (*UsersUpdate) SetEmail

func (uu *UsersUpdate) SetEmail(s string) *UsersUpdate

SetEmail sets the "email" field.

func (*UsersUpdate) SetEmailVerified

func (uu *UsersUpdate) SetEmailVerified(b bool) *UsersUpdate

SetEmailVerified sets the "email_verified" field.

func (*UsersUpdate) SetIsActive

func (uu *UsersUpdate) SetIsActive(b bool) *UsersUpdate

SetIsActive sets the "is_active" field.

func (*UsersUpdate) SetLastLogin

func (uu *UsersUpdate) SetLastLogin(t time.Time) *UsersUpdate

SetLastLogin sets the "last_login" field.

func (*UsersUpdate) SetMetadata

func (uu *UsersUpdate) SetMetadata(m map[string]interface{}) *UsersUpdate

SetMetadata sets the "metadata" field.

func (*UsersUpdate) SetNillableCreatedAt

func (uu *UsersUpdate) SetNillableCreatedAt(t *time.Time) *UsersUpdate

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

func (*UsersUpdate) SetNillableEmail

func (uu *UsersUpdate) SetNillableEmail(s *string) *UsersUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UsersUpdate) SetNillableEmailVerified

func (uu *UsersUpdate) SetNillableEmailVerified(b *bool) *UsersUpdate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UsersUpdate) SetNillableIsActive

func (uu *UsersUpdate) SetNillableIsActive(b *bool) *UsersUpdate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*UsersUpdate) SetNillableLastLogin

func (uu *UsersUpdate) SetNillableLastLogin(t *time.Time) *UsersUpdate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UsersUpdate) SetNillablePasswordHash

func (uu *UsersUpdate) SetNillablePasswordHash(s *string) *UsersUpdate

SetNillablePasswordHash sets the "password_hash" field if the given value is not nil.

func (*UsersUpdate) SetNillablePasswordResetToken

func (uu *UsersUpdate) SetNillablePasswordResetToken(s *string) *UsersUpdate

SetNillablePasswordResetToken sets the "password_reset_token" field if the given value is not nil.

func (*UsersUpdate) SetNillablePasswordResetTokenExpiry

func (uu *UsersUpdate) SetNillablePasswordResetTokenExpiry(t *time.Time) *UsersUpdate

SetNillablePasswordResetTokenExpiry sets the "password_reset_token_expiry" field if the given value is not nil.

func (*UsersUpdate) SetNillableUpdatedAt

func (uu *UsersUpdate) SetNillableUpdatedAt(t *time.Time) *UsersUpdate

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

func (*UsersUpdate) SetNillableVerificationToken

func (uu *UsersUpdate) SetNillableVerificationToken(s *string) *UsersUpdate

SetNillableVerificationToken sets the "verification_token" field if the given value is not nil.

func (*UsersUpdate) SetNillableVerificationTokenExpiry

func (uu *UsersUpdate) SetNillableVerificationTokenExpiry(t *time.Time) *UsersUpdate

SetNillableVerificationTokenExpiry sets the "verification_token_expiry" field if the given value is not nil.

func (*UsersUpdate) SetPasswordHash

func (uu *UsersUpdate) SetPasswordHash(s string) *UsersUpdate

SetPasswordHash sets the "password_hash" field.

func (*UsersUpdate) SetPasswordResetToken

func (uu *UsersUpdate) SetPasswordResetToken(s string) *UsersUpdate

SetPasswordResetToken sets the "password_reset_token" field.

func (*UsersUpdate) SetPasswordResetTokenExpiry

func (uu *UsersUpdate) SetPasswordResetTokenExpiry(t time.Time) *UsersUpdate

SetPasswordResetTokenExpiry sets the "password_reset_token_expiry" field.

func (*UsersUpdate) SetUpdatedAt

func (uu *UsersUpdate) SetUpdatedAt(t time.Time) *UsersUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UsersUpdate) SetVerificationToken

func (uu *UsersUpdate) SetVerificationToken(s string) *UsersUpdate

SetVerificationToken sets the "verification_token" field.

func (*UsersUpdate) SetVerificationTokenExpiry

func (uu *UsersUpdate) SetVerificationTokenExpiry(t time.Time) *UsersUpdate

SetVerificationTokenExpiry sets the "verification_token_expiry" field.

func (*UsersUpdate) Where

func (uu *UsersUpdate) Where(ps ...predicate.Users) *UsersUpdate

Where appends a list predicates to the UsersUpdate builder.

type UsersUpdateOne

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

UsersUpdateOne is the builder for updating a single Users entity.

func (*UsersUpdateOne) AddRoleIDs

func (uuo *UsersUpdateOne) AddRoleIDs(ids ...int) *UsersUpdateOne

AddRoleIDs adds the "roles" edge to the Roles entity by IDs.

func (*UsersUpdateOne) AddRoles

func (uuo *UsersUpdateOne) AddRoles(r ...*Roles) *UsersUpdateOne

AddRoles adds the "roles" edges to the Roles entity.

func (*UsersUpdateOne) ClearLastLogin

func (uuo *UsersUpdateOne) ClearLastLogin() *UsersUpdateOne

ClearLastLogin clears the value of the "last_login" field.

func (*UsersUpdateOne) ClearMetadata

func (uuo *UsersUpdateOne) ClearMetadata() *UsersUpdateOne

ClearMetadata clears the value of the "metadata" field.

func (*UsersUpdateOne) ClearPasswordResetToken

func (uuo *UsersUpdateOne) ClearPasswordResetToken() *UsersUpdateOne

ClearPasswordResetToken clears the value of the "password_reset_token" field.

func (*UsersUpdateOne) ClearPasswordResetTokenExpiry

func (uuo *UsersUpdateOne) ClearPasswordResetTokenExpiry() *UsersUpdateOne

ClearPasswordResetTokenExpiry clears the value of the "password_reset_token_expiry" field.

func (*UsersUpdateOne) ClearRoles

func (uuo *UsersUpdateOne) ClearRoles() *UsersUpdateOne

ClearRoles clears all "roles" edges to the Roles entity.

func (*UsersUpdateOne) ClearVerificationToken

func (uuo *UsersUpdateOne) ClearVerificationToken() *UsersUpdateOne

ClearVerificationToken clears the value of the "verification_token" field.

func (*UsersUpdateOne) ClearVerificationTokenExpiry

func (uuo *UsersUpdateOne) ClearVerificationTokenExpiry() *UsersUpdateOne

ClearVerificationTokenExpiry clears the value of the "verification_token_expiry" field.

func (*UsersUpdateOne) Exec

func (uuo *UsersUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UsersUpdateOne) ExecX

func (uuo *UsersUpdateOne) ExecX(ctx context.Context)

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

func (*UsersUpdateOne) Mutation

func (uuo *UsersUpdateOne) Mutation() *UsersMutation

Mutation returns the UsersMutation object of the builder.

func (*UsersUpdateOne) RemoveRoleIDs

func (uuo *UsersUpdateOne) RemoveRoleIDs(ids ...int) *UsersUpdateOne

RemoveRoleIDs removes the "roles" edge to Roles entities by IDs.

func (*UsersUpdateOne) RemoveRoles

func (uuo *UsersUpdateOne) RemoveRoles(r ...*Roles) *UsersUpdateOne

RemoveRoles removes "roles" edges to Roles entities.

func (*UsersUpdateOne) Save

func (uuo *UsersUpdateOne) Save(ctx context.Context) (*Users, error)

Save executes the query and returns the updated Users entity.

func (*UsersUpdateOne) SaveX

func (uuo *UsersUpdateOne) SaveX(ctx context.Context) *Users

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

func (*UsersUpdateOne) Select

func (uuo *UsersUpdateOne) Select(field string, fields ...string) *UsersUpdateOne

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

func (*UsersUpdateOne) SetCreatedAt

func (uuo *UsersUpdateOne) SetCreatedAt(t time.Time) *UsersUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UsersUpdateOne) SetEmail

func (uuo *UsersUpdateOne) SetEmail(s string) *UsersUpdateOne

SetEmail sets the "email" field.

func (*UsersUpdateOne) SetEmailVerified

func (uuo *UsersUpdateOne) SetEmailVerified(b bool) *UsersUpdateOne

SetEmailVerified sets the "email_verified" field.

func (*UsersUpdateOne) SetIsActive

func (uuo *UsersUpdateOne) SetIsActive(b bool) *UsersUpdateOne

SetIsActive sets the "is_active" field.

func (*UsersUpdateOne) SetLastLogin

func (uuo *UsersUpdateOne) SetLastLogin(t time.Time) *UsersUpdateOne

SetLastLogin sets the "last_login" field.

func (*UsersUpdateOne) SetMetadata

func (uuo *UsersUpdateOne) SetMetadata(m map[string]interface{}) *UsersUpdateOne

SetMetadata sets the "metadata" field.

func (*UsersUpdateOne) SetNillableCreatedAt

func (uuo *UsersUpdateOne) SetNillableCreatedAt(t *time.Time) *UsersUpdateOne

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

func (*UsersUpdateOne) SetNillableEmail

func (uuo *UsersUpdateOne) SetNillableEmail(s *string) *UsersUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableEmailVerified

func (uuo *UsersUpdateOne) SetNillableEmailVerified(b *bool) *UsersUpdateOne

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableIsActive

func (uuo *UsersUpdateOne) SetNillableIsActive(b *bool) *UsersUpdateOne

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableLastLogin

func (uuo *UsersUpdateOne) SetNillableLastLogin(t *time.Time) *UsersUpdateOne

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UsersUpdateOne) SetNillablePasswordHash

func (uuo *UsersUpdateOne) SetNillablePasswordHash(s *string) *UsersUpdateOne

SetNillablePasswordHash sets the "password_hash" field if the given value is not nil.

func (*UsersUpdateOne) SetNillablePasswordResetToken

func (uuo *UsersUpdateOne) SetNillablePasswordResetToken(s *string) *UsersUpdateOne

SetNillablePasswordResetToken sets the "password_reset_token" field if the given value is not nil.

func (*UsersUpdateOne) SetNillablePasswordResetTokenExpiry

func (uuo *UsersUpdateOne) SetNillablePasswordResetTokenExpiry(t *time.Time) *UsersUpdateOne

SetNillablePasswordResetTokenExpiry sets the "password_reset_token_expiry" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableUpdatedAt

func (uuo *UsersUpdateOne) SetNillableUpdatedAt(t *time.Time) *UsersUpdateOne

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

func (*UsersUpdateOne) SetNillableVerificationToken

func (uuo *UsersUpdateOne) SetNillableVerificationToken(s *string) *UsersUpdateOne

SetNillableVerificationToken sets the "verification_token" field if the given value is not nil.

func (*UsersUpdateOne) SetNillableVerificationTokenExpiry

func (uuo *UsersUpdateOne) SetNillableVerificationTokenExpiry(t *time.Time) *UsersUpdateOne

SetNillableVerificationTokenExpiry sets the "verification_token_expiry" field if the given value is not nil.

func (*UsersUpdateOne) SetPasswordHash

func (uuo *UsersUpdateOne) SetPasswordHash(s string) *UsersUpdateOne

SetPasswordHash sets the "password_hash" field.

func (*UsersUpdateOne) SetPasswordResetToken

func (uuo *UsersUpdateOne) SetPasswordResetToken(s string) *UsersUpdateOne

SetPasswordResetToken sets the "password_reset_token" field.

func (*UsersUpdateOne) SetPasswordResetTokenExpiry

func (uuo *UsersUpdateOne) SetPasswordResetTokenExpiry(t time.Time) *UsersUpdateOne

SetPasswordResetTokenExpiry sets the "password_reset_token_expiry" field.

func (*UsersUpdateOne) SetUpdatedAt

func (uuo *UsersUpdateOne) SetUpdatedAt(t time.Time) *UsersUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UsersUpdateOne) SetVerificationToken

func (uuo *UsersUpdateOne) SetVerificationToken(s string) *UsersUpdateOne

SetVerificationToken sets the "verification_token" field.

func (*UsersUpdateOne) SetVerificationTokenExpiry

func (uuo *UsersUpdateOne) SetVerificationTokenExpiry(t time.Time) *UsersUpdateOne

SetVerificationTokenExpiry sets the "verification_token_expiry" field.

func (*UsersUpdateOne) Where

func (uuo *UsersUpdateOne) Where(ps ...predicate.Users) *UsersUpdateOne

Where appends a list predicates to the UsersUpdate builder.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL