ent

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 29 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.
	TypeAccessPolicy = "AccessPolicy"
	TypeAccount      = "Account"
	TypeAuditLog     = "AuditLog"
	TypePlatform     = "Platform"
	TypeResource     = "Resource"
	TypeRole         = "Role"
	TypeTenant       = "Tenant"
	TypeUser         = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AccessPolicies

type AccessPolicies []*AccessPolicy

AccessPolicies is a parsable slice of AccessPolicy.

type AccessPolicy

type AccessPolicy struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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"`
	// Statements holds the value of the "statements" field.
	Statements []schema.PolicyStatement `json:"statements,omitempty"`
	// Immutable holds the value of the "immutable" field.
	Immutable bool `json:"immutable,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccessPolicyQuery when eager-loading is set.
	Edges AccessPolicyEdges `json:"edges"`
	// contains filtered or unexported fields
}

AccessPolicy is the model entity for the AccessPolicy schema.

func (*AccessPolicy) QueryAccount

func (ap *AccessPolicy) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the AccessPolicy entity.

func (*AccessPolicy) QueryRoles

func (ap *AccessPolicy) QueryRoles() *RoleQuery

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

func (*AccessPolicy) String

func (ap *AccessPolicy) String() string

String implements the fmt.Stringer.

func (*AccessPolicy) Unwrap

func (ap *AccessPolicy) Unwrap() *AccessPolicy

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

func (ap *AccessPolicy) Update() *AccessPolicyUpdateOne

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

func (*AccessPolicy) Value

func (ap *AccessPolicy) Value(name string) (ent.Value, error)

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

type AccessPolicyClient

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

AccessPolicyClient is a client for the AccessPolicy schema.

func NewAccessPolicyClient

func NewAccessPolicyClient(c config) *AccessPolicyClient

NewAccessPolicyClient returns a client for the AccessPolicy from the given config.

func (*AccessPolicyClient) Create

Create returns a builder for creating a AccessPolicy entity.

func (*AccessPolicyClient) CreateBulk

func (c *AccessPolicyClient) CreateBulk(builders ...*AccessPolicyCreate) *AccessPolicyCreateBulk

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

func (*AccessPolicyClient) Delete

Delete returns a delete builder for AccessPolicy.

func (*AccessPolicyClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccessPolicyClient) DeleteOneID

func (c *AccessPolicyClient) DeleteOneID(id uuid.UUID) *AccessPolicyDeleteOne

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

func (*AccessPolicyClient) Get

Get returns a AccessPolicy entity by its id.

func (*AccessPolicyClient) GetX

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

func (*AccessPolicyClient) Hooks

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

Hooks returns the client hooks.

func (*AccessPolicyClient) Intercept

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

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

func (*AccessPolicyClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AccessPolicyClient) MapCreateBulk

func (c *AccessPolicyClient) MapCreateBulk(slice any, setFunc func(*AccessPolicyCreate, int)) *AccessPolicyCreateBulk

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

Query returns a query builder for AccessPolicy.

func (*AccessPolicyClient) QueryAccount

func (c *AccessPolicyClient) QueryAccount(ap *AccessPolicy) *AccountQuery

QueryAccount queries the account edge of a AccessPolicy.

func (*AccessPolicyClient) QueryRoles

func (c *AccessPolicyClient) QueryRoles(ap *AccessPolicy) *RoleQuery

QueryRoles queries the roles edge of a AccessPolicy.

func (*AccessPolicyClient) Update

Update returns an update builder for AccessPolicy.

func (*AccessPolicyClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccessPolicyClient) UpdateOneID

func (c *AccessPolicyClient) UpdateOneID(id uuid.UUID) *AccessPolicyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccessPolicyClient) Use

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

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

type AccessPolicyCreate

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

AccessPolicyCreate is the builder for creating a AccessPolicy entity.

func (*AccessPolicyCreate) AddAccount

func (apc *AccessPolicyCreate) AddAccount(a ...*Account) *AccessPolicyCreate

AddAccount adds the "account" edges to the Account entity.

func (*AccessPolicyCreate) AddAccountIDs

func (apc *AccessPolicyCreate) AddAccountIDs(ids ...uuid.UUID) *AccessPolicyCreate

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*AccessPolicyCreate) AddRoleIDs

func (apc *AccessPolicyCreate) AddRoleIDs(ids ...uuid.UUID) *AccessPolicyCreate

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

func (*AccessPolicyCreate) AddRoles

func (apc *AccessPolicyCreate) AddRoles(r ...*Role) *AccessPolicyCreate

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

func (*AccessPolicyCreate) Exec

func (apc *AccessPolicyCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessPolicyCreate) ExecX

func (apc *AccessPolicyCreate) ExecX(ctx context.Context)

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

func (*AccessPolicyCreate) Mutation

func (apc *AccessPolicyCreate) Mutation() *AccessPolicyMutation

Mutation returns the AccessPolicyMutation object of the builder.

func (*AccessPolicyCreate) Save

Save creates the AccessPolicy in the database.

func (*AccessPolicyCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*AccessPolicyCreate) SetCreatedAt

func (apc *AccessPolicyCreate) SetCreatedAt(t time.Time) *AccessPolicyCreate

SetCreatedAt sets the "created_at" field.

func (*AccessPolicyCreate) SetDescription

func (apc *AccessPolicyCreate) SetDescription(s string) *AccessPolicyCreate

SetDescription sets the "description" field.

func (*AccessPolicyCreate) SetID

SetID sets the "id" field.

func (*AccessPolicyCreate) SetImmutable

func (apc *AccessPolicyCreate) SetImmutable(b bool) *AccessPolicyCreate

SetImmutable sets the "immutable" field.

func (*AccessPolicyCreate) SetName

func (apc *AccessPolicyCreate) SetName(s string) *AccessPolicyCreate

SetName sets the "name" field.

func (*AccessPolicyCreate) SetNillableCreatedAt

func (apc *AccessPolicyCreate) SetNillableCreatedAt(t *time.Time) *AccessPolicyCreate

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

func (*AccessPolicyCreate) SetNillableDescription

func (apc *AccessPolicyCreate) SetNillableDescription(s *string) *AccessPolicyCreate

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

func (*AccessPolicyCreate) SetNillableID

func (apc *AccessPolicyCreate) SetNillableID(u *uuid.UUID) *AccessPolicyCreate

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

func (*AccessPolicyCreate) SetNillableImmutable

func (apc *AccessPolicyCreate) SetNillableImmutable(b *bool) *AccessPolicyCreate

SetNillableImmutable sets the "immutable" field if the given value is not nil.

func (*AccessPolicyCreate) SetNillableUpdatedAt

func (apc *AccessPolicyCreate) SetNillableUpdatedAt(t *time.Time) *AccessPolicyCreate

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

func (*AccessPolicyCreate) SetStatements

func (apc *AccessPolicyCreate) SetStatements(ss []schema.PolicyStatement) *AccessPolicyCreate

SetStatements sets the "statements" field.

func (*AccessPolicyCreate) SetUpdatedAt

func (apc *AccessPolicyCreate) SetUpdatedAt(t time.Time) *AccessPolicyCreate

SetUpdatedAt sets the "updated_at" field.

type AccessPolicyCreateBulk

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

AccessPolicyCreateBulk is the builder for creating many AccessPolicy entities in bulk.

func (*AccessPolicyCreateBulk) Exec

func (apcb *AccessPolicyCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessPolicyCreateBulk) ExecX

func (apcb *AccessPolicyCreateBulk) ExecX(ctx context.Context)

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

func (*AccessPolicyCreateBulk) Save

Save creates the AccessPolicy entities in the database.

func (*AccessPolicyCreateBulk) SaveX

func (apcb *AccessPolicyCreateBulk) SaveX(ctx context.Context) []*AccessPolicy

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

type AccessPolicyDelete

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

AccessPolicyDelete is the builder for deleting a AccessPolicy entity.

func (*AccessPolicyDelete) Exec

func (apd *AccessPolicyDelete) Exec(ctx context.Context) (int, error)

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

func (*AccessPolicyDelete) ExecX

func (apd *AccessPolicyDelete) ExecX(ctx context.Context) int

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

func (*AccessPolicyDelete) Where

Where appends a list predicates to the AccessPolicyDelete builder.

type AccessPolicyDeleteOne

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

AccessPolicyDeleteOne is the builder for deleting a single AccessPolicy entity.

func (*AccessPolicyDeleteOne) Exec

func (apdo *AccessPolicyDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccessPolicyDeleteOne) ExecX

func (apdo *AccessPolicyDeleteOne) ExecX(ctx context.Context)

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

func (*AccessPolicyDeleteOne) Where

Where appends a list predicates to the AccessPolicyDelete builder.

type AccessPolicyEdges

type AccessPolicyEdges struct {
	// 应用此策略的账户
	Account []*Account `json:"account,omitempty"`
	// 分配此策略的角色
	Roles []*Role `json:"roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccessPolicyEdges) AccountOrErr

func (e AccessPolicyEdges) AccountOrErr() ([]*Account, error)

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

func (AccessPolicyEdges) RolesOrErr

func (e AccessPolicyEdges) RolesOrErr() ([]*Role, error)

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

type AccessPolicyGroupBy

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

AccessPolicyGroupBy is the group-by builder for AccessPolicy entities.

func (*AccessPolicyGroupBy) Aggregate

func (apgb *AccessPolicyGroupBy) Aggregate(fns ...AggregateFunc) *AccessPolicyGroupBy

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

func (*AccessPolicyGroupBy) Bool

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

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

func (*AccessPolicyGroupBy) BoolX

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

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

func (*AccessPolicyGroupBy) Bools

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

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

func (*AccessPolicyGroupBy) BoolsX

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

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

func (*AccessPolicyGroupBy) Float64

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

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

func (*AccessPolicyGroupBy) Float64X

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

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

func (*AccessPolicyGroupBy) Float64s

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

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

func (*AccessPolicyGroupBy) Float64sX

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

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

func (*AccessPolicyGroupBy) Int

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

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

func (*AccessPolicyGroupBy) IntX

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

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

func (*AccessPolicyGroupBy) Ints

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

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

func (*AccessPolicyGroupBy) IntsX

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

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

func (*AccessPolicyGroupBy) Scan

func (apgb *AccessPolicyGroupBy) Scan(ctx context.Context, v any) error

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

func (*AccessPolicyGroupBy) ScanX

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

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

func (*AccessPolicyGroupBy) String

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

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

func (*AccessPolicyGroupBy) StringX

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

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

func (*AccessPolicyGroupBy) Strings

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

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

func (*AccessPolicyGroupBy) StringsX

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

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

type AccessPolicyMutation

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

AccessPolicyMutation represents an operation that mutates the AccessPolicy nodes in the graph.

func (*AccessPolicyMutation) AccountCleared

func (m *AccessPolicyMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*AccessPolicyMutation) AccountIDs

func (m *AccessPolicyMutation) AccountIDs() (ids []uuid.UUID)

AccountIDs returns the "account" edge IDs in the mutation.

func (*AccessPolicyMutation) AddAccountIDs

func (m *AccessPolicyMutation) AddAccountIDs(ids ...uuid.UUID)

AddAccountIDs adds the "account" edge to the Account entity by ids.

func (*AccessPolicyMutation) AddField

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

func (m *AccessPolicyMutation) AddRoleIDs(ids ...uuid.UUID)

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

func (*AccessPolicyMutation) AddedEdges

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

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

func (*AccessPolicyMutation) AddedField

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

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

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

func (*AccessPolicyMutation) AddedIDs

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

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

func (*AccessPolicyMutation) AppendStatements

func (m *AccessPolicyMutation) AppendStatements(ss []schema.PolicyStatement)

AppendStatements adds ss to the "statements" field.

func (*AccessPolicyMutation) AppendedStatements

func (m *AccessPolicyMutation) AppendedStatements() ([]schema.PolicyStatement, bool)

AppendedStatements returns the list of values that were appended to the "statements" field in this mutation.

func (*AccessPolicyMutation) ClearAccount

func (m *AccessPolicyMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*AccessPolicyMutation) ClearDescription

func (m *AccessPolicyMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*AccessPolicyMutation) ClearEdge

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

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

func (m *AccessPolicyMutation) ClearRoles()

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

func (*AccessPolicyMutation) ClearedEdges

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

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

func (*AccessPolicyMutation) ClearedFields

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

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

func (AccessPolicyMutation) Client

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

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

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

func (*AccessPolicyMutation) Description

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

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

func (*AccessPolicyMutation) DescriptionCleared

func (m *AccessPolicyMutation) DescriptionCleared() bool

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

func (*AccessPolicyMutation) EdgeCleared

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

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

func (*AccessPolicyMutation) Field

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

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

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

func (*AccessPolicyMutation) Fields

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

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

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 (*AccessPolicyMutation) Immutable

func (m *AccessPolicyMutation) Immutable() (r bool, exists bool)

Immutable returns the value of the "immutable" field in the mutation.

func (*AccessPolicyMutation) Name

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

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

func (*AccessPolicyMutation) OldCreatedAt

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

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

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

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

func (m *AccessPolicyMutation) 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 (*AccessPolicyMutation) OldImmutable

func (m *AccessPolicyMutation) OldImmutable(ctx context.Context) (v bool, err error)

OldImmutable returns the old "immutable" field's value of the AccessPolicy entity. If the AccessPolicy 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 (*AccessPolicyMutation) OldName

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

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

func (m *AccessPolicyMutation) OldStatements(ctx context.Context) (v []schema.PolicyStatement, err error)

OldStatements returns the old "statements" field's value of the AccessPolicy entity. If the AccessPolicy 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 (*AccessPolicyMutation) OldUpdatedAt

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

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

func (m *AccessPolicyMutation) Op() Op

Op returns the operation name.

func (*AccessPolicyMutation) RemoveAccountIDs

func (m *AccessPolicyMutation) RemoveAccountIDs(ids ...uuid.UUID)

RemoveAccountIDs removes the "account" edge to the Account entity by IDs.

func (*AccessPolicyMutation) RemoveRoleIDs

func (m *AccessPolicyMutation) RemoveRoleIDs(ids ...uuid.UUID)

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

func (*AccessPolicyMutation) RemovedAccountIDs

func (m *AccessPolicyMutation) RemovedAccountIDs() (ids []uuid.UUID)

RemovedAccount returns the removed IDs of the "account" edge to the Account entity.

func (*AccessPolicyMutation) RemovedEdges

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

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

func (*AccessPolicyMutation) RemovedIDs

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

func (m *AccessPolicyMutation) RemovedRolesIDs() (ids []uuid.UUID)

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

func (*AccessPolicyMutation) ResetAccount

func (m *AccessPolicyMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*AccessPolicyMutation) ResetCreatedAt

func (m *AccessPolicyMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AccessPolicyMutation) ResetDescription

func (m *AccessPolicyMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*AccessPolicyMutation) ResetEdge

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

func (m *AccessPolicyMutation) 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 (*AccessPolicyMutation) ResetImmutable

func (m *AccessPolicyMutation) ResetImmutable()

ResetImmutable resets all changes to the "immutable" field.

func (*AccessPolicyMutation) ResetName

func (m *AccessPolicyMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AccessPolicyMutation) ResetRoles

func (m *AccessPolicyMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*AccessPolicyMutation) ResetStatements

func (m *AccessPolicyMutation) ResetStatements()

ResetStatements resets all changes to the "statements" field.

func (*AccessPolicyMutation) ResetUpdatedAt

func (m *AccessPolicyMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AccessPolicyMutation) RolesCleared

func (m *AccessPolicyMutation) RolesCleared() bool

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

func (*AccessPolicyMutation) RolesIDs

func (m *AccessPolicyMutation) RolesIDs() (ids []uuid.UUID)

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

func (*AccessPolicyMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AccessPolicyMutation) SetDescription

func (m *AccessPolicyMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*AccessPolicyMutation) SetField

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

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

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

func (*AccessPolicyMutation) SetImmutable

func (m *AccessPolicyMutation) SetImmutable(b bool)

SetImmutable sets the "immutable" field.

func (*AccessPolicyMutation) SetName

func (m *AccessPolicyMutation) SetName(s string)

SetName sets the "name" field.

func (*AccessPolicyMutation) SetOp

func (m *AccessPolicyMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AccessPolicyMutation) SetStatements

func (m *AccessPolicyMutation) SetStatements(ss []schema.PolicyStatement)

SetStatements sets the "statements" field.

func (*AccessPolicyMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AccessPolicyMutation) Statements

func (m *AccessPolicyMutation) Statements() (r []schema.PolicyStatement, exists bool)

Statements returns the value of the "statements" field in the mutation.

func (AccessPolicyMutation) Tx

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

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

func (*AccessPolicyMutation) Type

func (m *AccessPolicyMutation) Type() string

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

func (*AccessPolicyMutation) UpdatedAt

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

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

func (*AccessPolicyMutation) Where

Where appends a list predicates to the AccessPolicyMutation builder.

func (*AccessPolicyMutation) WhereP

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

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

type AccessPolicyQuery

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

AccessPolicyQuery is the builder for querying AccessPolicy entities.

func (*AccessPolicyQuery) Aggregate

func (apq *AccessPolicyQuery) Aggregate(fns ...AggregateFunc) *AccessPolicySelect

Aggregate returns a AccessPolicySelect configured with the given aggregations.

func (*AccessPolicyQuery) All

func (apq *AccessPolicyQuery) All(ctx context.Context) ([]*AccessPolicy, error)

All executes the query and returns a list of AccessPolicies.

func (*AccessPolicyQuery) AllX

func (apq *AccessPolicyQuery) AllX(ctx context.Context) []*AccessPolicy

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

func (*AccessPolicyQuery) Clone

func (apq *AccessPolicyQuery) Clone() *AccessPolicyQuery

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

func (*AccessPolicyQuery) Count

func (apq *AccessPolicyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccessPolicyQuery) CountX

func (apq *AccessPolicyQuery) CountX(ctx context.Context) int

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

func (*AccessPolicyQuery) Exist

func (apq *AccessPolicyQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccessPolicyQuery) ExistX

func (apq *AccessPolicyQuery) ExistX(ctx context.Context) bool

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

func (*AccessPolicyQuery) First

func (apq *AccessPolicyQuery) First(ctx context.Context) (*AccessPolicy, error)

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

func (*AccessPolicyQuery) FirstID

func (apq *AccessPolicyQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccessPolicyQuery) FirstIDX

func (apq *AccessPolicyQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*AccessPolicyQuery) FirstX

func (apq *AccessPolicyQuery) FirstX(ctx context.Context) *AccessPolicy

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

func (*AccessPolicyQuery) GroupBy

func (apq *AccessPolicyQuery) GroupBy(field string, fields ...string) *AccessPolicyGroupBy

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

Example:

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

client.AccessPolicy.Query().
	GroupBy(accesspolicy.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccessPolicyQuery) IDs

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

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

func (*AccessPolicyQuery) IDsX

func (apq *AccessPolicyQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AccessPolicyQuery) Limit

func (apq *AccessPolicyQuery) Limit(limit int) *AccessPolicyQuery

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

func (*AccessPolicyQuery) Offset

func (apq *AccessPolicyQuery) Offset(offset int) *AccessPolicyQuery

Offset to start from.

func (*AccessPolicyQuery) Only

func (apq *AccessPolicyQuery) Only(ctx context.Context) (*AccessPolicy, error)

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

func (*AccessPolicyQuery) OnlyID

func (apq *AccessPolicyQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccessPolicyQuery) OnlyIDX

func (apq *AccessPolicyQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AccessPolicyQuery) OnlyX

func (apq *AccessPolicyQuery) OnlyX(ctx context.Context) *AccessPolicy

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

func (*AccessPolicyQuery) Order

Order specifies how the records should be ordered.

func (*AccessPolicyQuery) QueryAccount

func (apq *AccessPolicyQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*AccessPolicyQuery) QueryRoles

func (apq *AccessPolicyQuery) QueryRoles() *RoleQuery

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

func (*AccessPolicyQuery) Select

func (apq *AccessPolicyQuery) Select(fields ...string) *AccessPolicySelect

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

Example:

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

client.AccessPolicy.Query().
	Select(accesspolicy.FieldCreatedAt).
	Scan(ctx, &v)

func (*AccessPolicyQuery) Unique

func (apq *AccessPolicyQuery) Unique(unique bool) *AccessPolicyQuery

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

Where adds a new predicate for the AccessPolicyQuery builder.

func (*AccessPolicyQuery) WithAccount

func (apq *AccessPolicyQuery) WithAccount(opts ...func(*AccountQuery)) *AccessPolicyQuery

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

func (*AccessPolicyQuery) WithRoles

func (apq *AccessPolicyQuery) WithRoles(opts ...func(*RoleQuery)) *AccessPolicyQuery

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 AccessPolicySelect

type AccessPolicySelect struct {
	*AccessPolicyQuery
	// contains filtered or unexported fields
}

AccessPolicySelect is the builder for selecting fields of AccessPolicy entities.

func (*AccessPolicySelect) Aggregate

func (aps *AccessPolicySelect) Aggregate(fns ...AggregateFunc) *AccessPolicySelect

Aggregate adds the given aggregation functions to the selector query.

func (*AccessPolicySelect) Bool

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

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

func (*AccessPolicySelect) BoolX

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

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

func (*AccessPolicySelect) Bools

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

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

func (*AccessPolicySelect) BoolsX

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

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

func (*AccessPolicySelect) Float64

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

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

func (*AccessPolicySelect) Float64X

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

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

func (*AccessPolicySelect) Float64s

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

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

func (*AccessPolicySelect) Float64sX

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

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

func (*AccessPolicySelect) Int

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

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

func (*AccessPolicySelect) IntX

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

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

func (*AccessPolicySelect) Ints

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

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

func (*AccessPolicySelect) IntsX

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

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

func (*AccessPolicySelect) Scan

func (aps *AccessPolicySelect) Scan(ctx context.Context, v any) error

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

func (*AccessPolicySelect) ScanX

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

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

func (*AccessPolicySelect) String

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

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

func (*AccessPolicySelect) StringX

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

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

func (*AccessPolicySelect) Strings

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

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

func (*AccessPolicySelect) StringsX

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

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

type AccessPolicyUpdate

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

AccessPolicyUpdate is the builder for updating AccessPolicy entities.

func (*AccessPolicyUpdate) AddAccount

func (apu *AccessPolicyUpdate) AddAccount(a ...*Account) *AccessPolicyUpdate

AddAccount adds the "account" edges to the Account entity.

func (*AccessPolicyUpdate) AddAccountIDs

func (apu *AccessPolicyUpdate) AddAccountIDs(ids ...uuid.UUID) *AccessPolicyUpdate

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*AccessPolicyUpdate) AddRoleIDs

func (apu *AccessPolicyUpdate) AddRoleIDs(ids ...uuid.UUID) *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) AddRoles

func (apu *AccessPolicyUpdate) AddRoles(r ...*Role) *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) AppendStatements

func (apu *AccessPolicyUpdate) AppendStatements(ss []schema.PolicyStatement) *AccessPolicyUpdate

AppendStatements appends ss to the "statements" field.

func (*AccessPolicyUpdate) ClearAccount

func (apu *AccessPolicyUpdate) ClearAccount() *AccessPolicyUpdate

ClearAccount clears all "account" edges to the Account entity.

func (*AccessPolicyUpdate) ClearDescription

func (apu *AccessPolicyUpdate) ClearDescription() *AccessPolicyUpdate

ClearDescription clears the value of the "description" field.

func (*AccessPolicyUpdate) ClearRoles

func (apu *AccessPolicyUpdate) ClearRoles() *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) Exec

func (apu *AccessPolicyUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccessPolicyUpdate) ExecX

func (apu *AccessPolicyUpdate) ExecX(ctx context.Context)

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

func (*AccessPolicyUpdate) Mutation

func (apu *AccessPolicyUpdate) Mutation() *AccessPolicyMutation

Mutation returns the AccessPolicyMutation object of the builder.

func (*AccessPolicyUpdate) RemoveAccount

func (apu *AccessPolicyUpdate) RemoveAccount(a ...*Account) *AccessPolicyUpdate

RemoveAccount removes "account" edges to Account entities.

func (*AccessPolicyUpdate) RemoveAccountIDs

func (apu *AccessPolicyUpdate) RemoveAccountIDs(ids ...uuid.UUID) *AccessPolicyUpdate

RemoveAccountIDs removes the "account" edge to Account entities by IDs.

func (*AccessPolicyUpdate) RemoveRoleIDs

func (apu *AccessPolicyUpdate) RemoveRoleIDs(ids ...uuid.UUID) *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) RemoveRoles

func (apu *AccessPolicyUpdate) RemoveRoles(r ...*Role) *AccessPolicyUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*AccessPolicyUpdate) Save

func (apu *AccessPolicyUpdate) Save(ctx context.Context) (int, error)

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

func (*AccessPolicyUpdate) SaveX

func (apu *AccessPolicyUpdate) SaveX(ctx context.Context) int

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

func (*AccessPolicyUpdate) SetDescription

func (apu *AccessPolicyUpdate) SetDescription(s string) *AccessPolicyUpdate

SetDescription sets the "description" field.

func (*AccessPolicyUpdate) SetImmutable

func (apu *AccessPolicyUpdate) SetImmutable(b bool) *AccessPolicyUpdate

SetImmutable sets the "immutable" field.

func (*AccessPolicyUpdate) SetName

func (apu *AccessPolicyUpdate) SetName(s string) *AccessPolicyUpdate

SetName sets the "name" field.

func (*AccessPolicyUpdate) SetNillableDescription

func (apu *AccessPolicyUpdate) SetNillableDescription(s *string) *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) SetNillableImmutable

func (apu *AccessPolicyUpdate) SetNillableImmutable(b *bool) *AccessPolicyUpdate

SetNillableImmutable sets the "immutable" field if the given value is not nil.

func (*AccessPolicyUpdate) SetNillableName

func (apu *AccessPolicyUpdate) SetNillableName(s *string) *AccessPolicyUpdate

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

func (*AccessPolicyUpdate) SetStatements

func (apu *AccessPolicyUpdate) SetStatements(ss []schema.PolicyStatement) *AccessPolicyUpdate

SetStatements sets the "statements" field.

func (*AccessPolicyUpdate) SetUpdatedAt

func (apu *AccessPolicyUpdate) SetUpdatedAt(t time.Time) *AccessPolicyUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AccessPolicyUpdate) Where

Where appends a list predicates to the AccessPolicyUpdate builder.

type AccessPolicyUpdateOne

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

AccessPolicyUpdateOne is the builder for updating a single AccessPolicy entity.

func (*AccessPolicyUpdateOne) AddAccount

func (apuo *AccessPolicyUpdateOne) AddAccount(a ...*Account) *AccessPolicyUpdateOne

AddAccount adds the "account" edges to the Account entity.

func (*AccessPolicyUpdateOne) AddAccountIDs

func (apuo *AccessPolicyUpdateOne) AddAccountIDs(ids ...uuid.UUID) *AccessPolicyUpdateOne

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*AccessPolicyUpdateOne) AddRoleIDs

func (apuo *AccessPolicyUpdateOne) AddRoleIDs(ids ...uuid.UUID) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) AddRoles

func (apuo *AccessPolicyUpdateOne) AddRoles(r ...*Role) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) AppendStatements

func (apuo *AccessPolicyUpdateOne) AppendStatements(ss []schema.PolicyStatement) *AccessPolicyUpdateOne

AppendStatements appends ss to the "statements" field.

func (*AccessPolicyUpdateOne) ClearAccount

func (apuo *AccessPolicyUpdateOne) ClearAccount() *AccessPolicyUpdateOne

ClearAccount clears all "account" edges to the Account entity.

func (*AccessPolicyUpdateOne) ClearDescription

func (apuo *AccessPolicyUpdateOne) ClearDescription() *AccessPolicyUpdateOne

ClearDescription clears the value of the "description" field.

func (*AccessPolicyUpdateOne) ClearRoles

func (apuo *AccessPolicyUpdateOne) ClearRoles() *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) Exec

func (apuo *AccessPolicyUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccessPolicyUpdateOne) ExecX

func (apuo *AccessPolicyUpdateOne) ExecX(ctx context.Context)

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

func (*AccessPolicyUpdateOne) Mutation

func (apuo *AccessPolicyUpdateOne) Mutation() *AccessPolicyMutation

Mutation returns the AccessPolicyMutation object of the builder.

func (*AccessPolicyUpdateOne) RemoveAccount

func (apuo *AccessPolicyUpdateOne) RemoveAccount(a ...*Account) *AccessPolicyUpdateOne

RemoveAccount removes "account" edges to Account entities.

func (*AccessPolicyUpdateOne) RemoveAccountIDs

func (apuo *AccessPolicyUpdateOne) RemoveAccountIDs(ids ...uuid.UUID) *AccessPolicyUpdateOne

RemoveAccountIDs removes the "account" edge to Account entities by IDs.

func (*AccessPolicyUpdateOne) RemoveRoleIDs

func (apuo *AccessPolicyUpdateOne) RemoveRoleIDs(ids ...uuid.UUID) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) RemoveRoles

func (apuo *AccessPolicyUpdateOne) RemoveRoles(r ...*Role) *AccessPolicyUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*AccessPolicyUpdateOne) Save

Save executes the query and returns the updated AccessPolicy entity.

func (*AccessPolicyUpdateOne) SaveX

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

func (*AccessPolicyUpdateOne) Select

func (apuo *AccessPolicyUpdateOne) Select(field string, fields ...string) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) SetDescription

func (apuo *AccessPolicyUpdateOne) SetDescription(s string) *AccessPolicyUpdateOne

SetDescription sets the "description" field.

func (*AccessPolicyUpdateOne) SetImmutable

func (apuo *AccessPolicyUpdateOne) SetImmutable(b bool) *AccessPolicyUpdateOne

SetImmutable sets the "immutable" field.

func (*AccessPolicyUpdateOne) SetName

SetName sets the "name" field.

func (*AccessPolicyUpdateOne) SetNillableDescription

func (apuo *AccessPolicyUpdateOne) SetNillableDescription(s *string) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) SetNillableImmutable

func (apuo *AccessPolicyUpdateOne) SetNillableImmutable(b *bool) *AccessPolicyUpdateOne

SetNillableImmutable sets the "immutable" field if the given value is not nil.

func (*AccessPolicyUpdateOne) SetNillableName

func (apuo *AccessPolicyUpdateOne) SetNillableName(s *string) *AccessPolicyUpdateOne

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

func (*AccessPolicyUpdateOne) SetStatements

SetStatements sets the "statements" field.

func (*AccessPolicyUpdateOne) SetUpdatedAt

func (apuo *AccessPolicyUpdateOne) SetUpdatedAt(t time.Time) *AccessPolicyUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AccessPolicyUpdateOne) Where

Where appends a list predicates to the AccessPolicyUpdate builder.

type Account

type Account struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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"`
	// Status holds the value of the "status" field.
	Status account.Status `json:"status,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccountQuery when eager-loading is set.
	Edges AccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

Account is the model entity for the Account schema.

func (*Account) QueryAccessPolicies

func (a *Account) QueryAccessPolicies() *AccessPolicyQuery

QueryAccessPolicies queries the "access_policies" edge of the Account entity.

func (*Account) QueryResources

func (a *Account) QueryResources() *ResourceQuery

QueryResources queries the "resources" edge of the Account entity.

func (*Account) QueryRoles

func (a *Account) QueryRoles() *RoleQuery

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

func (*Account) QueryTenant

func (a *Account) QueryTenant() *TenantQuery

QueryTenant queries the "tenant" edge of the Account entity.

func (*Account) QueryUsers

func (a *Account) QueryUsers() *UserQuery

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

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer.

func (*Account) Unwrap

func (a *Account) Unwrap() *Account

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

func (a *Account) Update() *AccountUpdateOne

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

func (*Account) Value

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

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

type AccountClient

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

AccountClient is a client for the Account schema.

func NewAccountClient

func NewAccountClient(c config) *AccountClient

NewAccountClient returns a client for the Account from the given config.

func (*AccountClient) Create

func (c *AccountClient) Create() *AccountCreate

Create returns a builder for creating a Account entity.

func (*AccountClient) CreateBulk

func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk

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

func (*AccountClient) Delete

func (c *AccountClient) Delete() *AccountDelete

Delete returns a delete builder for Account.

func (*AccountClient) DeleteOne

func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccountClient) DeleteOneID

func (c *AccountClient) DeleteOneID(id uuid.UUID) *AccountDeleteOne

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

func (*AccountClient) Get

func (c *AccountClient) Get(ctx context.Context, id uuid.UUID) (*Account, error)

Get returns a Account entity by its id.

func (*AccountClient) GetX

func (c *AccountClient) GetX(ctx context.Context, id uuid.UUID) *Account

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

func (*AccountClient) Hooks

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

Hooks returns the client hooks.

func (*AccountClient) Intercept

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

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

func (*AccountClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AccountClient) MapCreateBulk

func (c *AccountClient) MapCreateBulk(slice any, setFunc func(*AccountCreate, int)) *AccountCreateBulk

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

func (c *AccountClient) Query() *AccountQuery

Query returns a query builder for Account.

func (*AccountClient) QueryAccessPolicies

func (c *AccountClient) QueryAccessPolicies(a *Account) *AccessPolicyQuery

QueryAccessPolicies queries the access_policies edge of a Account.

func (*AccountClient) QueryResources

func (c *AccountClient) QueryResources(a *Account) *ResourceQuery

QueryResources queries the resources edge of a Account.

func (*AccountClient) QueryRoles

func (c *AccountClient) QueryRoles(a *Account) *RoleQuery

QueryRoles queries the roles edge of a Account.

func (*AccountClient) QueryTenant

func (c *AccountClient) QueryTenant(a *Account) *TenantQuery

QueryTenant queries the tenant edge of a Account.

func (*AccountClient) QueryUsers

func (c *AccountClient) QueryUsers(a *Account) *UserQuery

QueryUsers queries the users edge of a Account.

func (*AccountClient) Update

func (c *AccountClient) Update() *AccountUpdate

Update returns an update builder for Account.

func (*AccountClient) UpdateOne

func (c *AccountClient) UpdateOne(a *Account) *AccountUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountClient) UpdateOneID

func (c *AccountClient) UpdateOneID(id uuid.UUID) *AccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountClient) Use

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

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

type AccountCreate

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

AccountCreate is the builder for creating a Account entity.

func (*AccountCreate) AddAccessPolicies

func (ac *AccountCreate) AddAccessPolicies(a ...*AccessPolicy) *AccountCreate

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*AccountCreate) AddAccessPolicyIDs

func (ac *AccountCreate) AddAccessPolicyIDs(ids ...uuid.UUID) *AccountCreate

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*AccountCreate) AddResourceIDs

func (ac *AccountCreate) AddResourceIDs(ids ...uuid.UUID) *AccountCreate

AddResourceIDs adds the "resources" edge to the Resource entity by IDs.

func (*AccountCreate) AddResources

func (ac *AccountCreate) AddResources(r ...*Resource) *AccountCreate

AddResources adds the "resources" edges to the Resource entity.

func (*AccountCreate) AddRoleIDs

func (ac *AccountCreate) AddRoleIDs(ids ...uuid.UUID) *AccountCreate

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

func (*AccountCreate) AddRoles

func (ac *AccountCreate) AddRoles(r ...*Role) *AccountCreate

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

func (*AccountCreate) AddUserIDs

func (ac *AccountCreate) AddUserIDs(ids ...uuid.UUID) *AccountCreate

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

func (*AccountCreate) AddUsers

func (ac *AccountCreate) AddUsers(u ...*User) *AccountCreate

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

func (*AccountCreate) Exec

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

Exec executes the query.

func (*AccountCreate) ExecX

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

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

func (*AccountCreate) Mutation

func (ac *AccountCreate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountCreate) Save

func (ac *AccountCreate) Save(ctx context.Context) (*Account, error)

Save creates the Account in the database.

func (*AccountCreate) SaveX

func (ac *AccountCreate) SaveX(ctx context.Context) *Account

SaveX calls Save and panics if Save returns an error.

func (*AccountCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AccountCreate) SetDescription

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

SetDescription sets the "description" field.

func (*AccountCreate) SetID

func (ac *AccountCreate) SetID(u uuid.UUID) *AccountCreate

SetID sets the "id" field.

func (*AccountCreate) SetName

func (ac *AccountCreate) SetName(s string) *AccountCreate

SetName sets the "name" field.

func (*AccountCreate) SetNillableCreatedAt

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

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

func (*AccountCreate) SetNillableDescription

func (ac *AccountCreate) SetNillableDescription(s *string) *AccountCreate

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

func (*AccountCreate) SetNillableID

func (ac *AccountCreate) SetNillableID(u *uuid.UUID) *AccountCreate

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

func (*AccountCreate) SetNillableStatus

func (ac *AccountCreate) SetNillableStatus(a *account.Status) *AccountCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AccountCreate) SetNillableUpdatedAt

func (ac *AccountCreate) SetNillableUpdatedAt(t *time.Time) *AccountCreate

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

func (*AccountCreate) SetStatus

func (ac *AccountCreate) SetStatus(a account.Status) *AccountCreate

SetStatus sets the "status" field.

func (*AccountCreate) SetTenant

func (ac *AccountCreate) SetTenant(t *Tenant) *AccountCreate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*AccountCreate) SetTenantID

func (ac *AccountCreate) SetTenantID(id uuid.UUID) *AccountCreate

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

func (*AccountCreate) SetUpdatedAt

func (ac *AccountCreate) SetUpdatedAt(t time.Time) *AccountCreate

SetUpdatedAt sets the "updated_at" field.

type AccountCreateBulk

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

AccountCreateBulk is the builder for creating many Account entities in bulk.

func (*AccountCreateBulk) Exec

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

Exec executes the query.

func (*AccountCreateBulk) ExecX

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

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

func (*AccountCreateBulk) Save

func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error)

Save creates the Account entities in the database.

func (*AccountCreateBulk) SaveX

func (acb *AccountCreateBulk) SaveX(ctx context.Context) []*Account

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

type AccountDelete

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

AccountDelete is the builder for deleting a Account entity.

func (*AccountDelete) Exec

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

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

func (*AccountDelete) ExecX

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

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

func (*AccountDelete) Where

func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete

Where appends a list predicates to the AccountDelete builder.

type AccountDeleteOne

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

AccountDeleteOne is the builder for deleting a single Account entity.

func (*AccountDeleteOne) Exec

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

Exec executes the deletion query.

func (*AccountDeleteOne) ExecX

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

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

func (*AccountDeleteOne) Where

Where appends a list predicates to the AccountDelete builder.

type AccountEdges

type AccountEdges struct {
	// 账户所属的租户
	Tenant *Tenant `json:"tenant,omitempty"`
	// 账户下的所有用户
	Users []*User `json:"users,omitempty"`
	// 账户下的所有角色
	Roles []*Role `json:"roles,omitempty"`
	// 账户下的所有资源
	Resources []*Resource `json:"resources,omitempty"`
	// 直接关联到账户的策略
	AccessPolicies []*AccessPolicy `json:"access_policies,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccountEdges) AccessPoliciesOrErr

func (e AccountEdges) AccessPoliciesOrErr() ([]*AccessPolicy, error)

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

func (AccountEdges) ResourcesOrErr

func (e AccountEdges) ResourcesOrErr() ([]*Resource, error)

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

func (AccountEdges) RolesOrErr

func (e AccountEdges) RolesOrErr() ([]*Role, error)

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

func (AccountEdges) TenantOrErr

func (e AccountEdges) TenantOrErr() (*Tenant, error)

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

func (AccountEdges) UsersOrErr

func (e AccountEdges) UsersOrErr() ([]*User, error)

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

type AccountGroupBy

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

AccountGroupBy is the group-by builder for Account entities.

func (*AccountGroupBy) Aggregate

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

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

func (*AccountGroupBy) Bool

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

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

func (*AccountGroupBy) BoolX

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

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

func (*AccountGroupBy) Bools

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

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

func (*AccountGroupBy) BoolsX

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

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

func (*AccountGroupBy) Float64

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

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

func (*AccountGroupBy) Float64X

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

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

func (*AccountGroupBy) Float64s

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

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

func (*AccountGroupBy) Float64sX

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

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

func (*AccountGroupBy) Int

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

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

func (*AccountGroupBy) IntX

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

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

func (*AccountGroupBy) Ints

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

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

func (*AccountGroupBy) IntsX

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

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

func (*AccountGroupBy) Scan

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

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

func (*AccountGroupBy) ScanX

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

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

func (*AccountGroupBy) String

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

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

func (*AccountGroupBy) StringX

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

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

func (*AccountGroupBy) Strings

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

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

func (*AccountGroupBy) StringsX

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

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

type AccountMutation

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

AccountMutation represents an operation that mutates the Account nodes in the graph.

func (*AccountMutation) AccessPoliciesCleared

func (m *AccountMutation) AccessPoliciesCleared() bool

AccessPoliciesCleared reports if the "access_policies" edge to the AccessPolicy entity was cleared.

func (*AccountMutation) AccessPoliciesIDs

func (m *AccountMutation) AccessPoliciesIDs() (ids []uuid.UUID)

AccessPoliciesIDs returns the "access_policies" edge IDs in the mutation.

func (*AccountMutation) AddAccessPolicyIDs

func (m *AccountMutation) AddAccessPolicyIDs(ids ...uuid.UUID)

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by ids.

func (*AccountMutation) AddField

func (m *AccountMutation) 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 (*AccountMutation) AddResourceIDs

func (m *AccountMutation) AddResourceIDs(ids ...uuid.UUID)

AddResourceIDs adds the "resources" edge to the Resource entity by ids.

func (*AccountMutation) AddRoleIDs

func (m *AccountMutation) AddRoleIDs(ids ...uuid.UUID)

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

func (*AccountMutation) AddUserIDs

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

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

func (*AccountMutation) AddedEdges

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

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

func (*AccountMutation) AddedField

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

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

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

func (*AccountMutation) AddedIDs

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

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

func (*AccountMutation) ClearAccessPolicies

func (m *AccountMutation) ClearAccessPolicies()

ClearAccessPolicies clears the "access_policies" edge to the AccessPolicy entity.

func (*AccountMutation) ClearDescription

func (m *AccountMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*AccountMutation) ClearEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ClearResources

func (m *AccountMutation) ClearResources()

ClearResources clears the "resources" edge to the Resource entity.

func (*AccountMutation) ClearRoles

func (m *AccountMutation) ClearRoles()

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

func (*AccountMutation) ClearTenant

func (m *AccountMutation) ClearTenant()

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*AccountMutation) ClearUsers

func (m *AccountMutation) ClearUsers()

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

func (*AccountMutation) ClearedEdges

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

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

func (*AccountMutation) ClearedFields

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

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

func (AccountMutation) Client

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

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

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

func (*AccountMutation) Description

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

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

func (*AccountMutation) DescriptionCleared

func (m *AccountMutation) DescriptionCleared() bool

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

func (*AccountMutation) EdgeCleared

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

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

func (*AccountMutation) Field

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

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

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

func (*AccountMutation) Fields

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

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

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

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

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

func (*AccountMutation) OldCreatedAt

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

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

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

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

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

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

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

func (m *AccountMutation) OldStatus(ctx context.Context) (v account.Status, err error)

OldStatus returns the old "status" field's value of the Account entity. If the Account 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 (*AccountMutation) OldUpdatedAt

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

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

func (m *AccountMutation) Op() Op

Op returns the operation name.

func (*AccountMutation) RemoveAccessPolicyIDs

func (m *AccountMutation) RemoveAccessPolicyIDs(ids ...uuid.UUID)

RemoveAccessPolicyIDs removes the "access_policies" edge to the AccessPolicy entity by IDs.

func (*AccountMutation) RemoveResourceIDs

func (m *AccountMutation) RemoveResourceIDs(ids ...uuid.UUID)

RemoveResourceIDs removes the "resources" edge to the Resource entity by IDs.

func (*AccountMutation) RemoveRoleIDs

func (m *AccountMutation) RemoveRoleIDs(ids ...uuid.UUID)

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

func (*AccountMutation) RemoveUserIDs

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

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

func (*AccountMutation) RemovedAccessPoliciesIDs

func (m *AccountMutation) RemovedAccessPoliciesIDs() (ids []uuid.UUID)

RemovedAccessPolicies returns the removed IDs of the "access_policies" edge to the AccessPolicy entity.

func (*AccountMutation) RemovedEdges

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

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

func (*AccountMutation) RemovedIDs

func (m *AccountMutation) 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 (*AccountMutation) RemovedResourcesIDs

func (m *AccountMutation) RemovedResourcesIDs() (ids []uuid.UUID)

RemovedResources returns the removed IDs of the "resources" edge to the Resource entity.

func (*AccountMutation) RemovedRolesIDs

func (m *AccountMutation) RemovedRolesIDs() (ids []uuid.UUID)

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

func (*AccountMutation) RemovedUsersIDs

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

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

func (*AccountMutation) ResetAccessPolicies

func (m *AccountMutation) ResetAccessPolicies()

ResetAccessPolicies resets all changes to the "access_policies" edge.

func (*AccountMutation) ResetCreatedAt

func (m *AccountMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AccountMutation) ResetDescription

func (m *AccountMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*AccountMutation) ResetEdge

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

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

func (m *AccountMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*AccountMutation) ResetResources

func (m *AccountMutation) ResetResources()

ResetResources resets all changes to the "resources" edge.

func (*AccountMutation) ResetRoles

func (m *AccountMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*AccountMutation) ResetStatus

func (m *AccountMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*AccountMutation) ResetTenant

func (m *AccountMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*AccountMutation) ResetUpdatedAt

func (m *AccountMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AccountMutation) ResetUsers

func (m *AccountMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*AccountMutation) ResourcesCleared

func (m *AccountMutation) ResourcesCleared() bool

ResourcesCleared reports if the "resources" edge to the Resource entity was cleared.

func (*AccountMutation) ResourcesIDs

func (m *AccountMutation) ResourcesIDs() (ids []uuid.UUID)

ResourcesIDs returns the "resources" edge IDs in the mutation.

func (*AccountMutation) RolesCleared

func (m *AccountMutation) RolesCleared() bool

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

func (*AccountMutation) RolesIDs

func (m *AccountMutation) RolesIDs() (ids []uuid.UUID)

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

func (*AccountMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AccountMutation) SetDescription

func (m *AccountMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*AccountMutation) SetField

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

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

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

func (*AccountMutation) SetName

func (m *AccountMutation) SetName(s string)

SetName sets the "name" field.

func (*AccountMutation) SetOp

func (m *AccountMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AccountMutation) SetStatus

func (m *AccountMutation) SetStatus(a account.Status)

SetStatus sets the "status" field.

func (*AccountMutation) SetTenantID

func (m *AccountMutation) SetTenantID(id uuid.UUID)

SetTenantID sets the "tenant" edge to the Tenant entity by id.

func (*AccountMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AccountMutation) Status

func (m *AccountMutation) Status() (r account.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*AccountMutation) TenantCleared

func (m *AccountMutation) TenantCleared() bool

TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.

func (*AccountMutation) TenantID

func (m *AccountMutation) TenantID() (id uuid.UUID, exists bool)

TenantID returns the "tenant" edge ID in the mutation.

func (*AccountMutation) TenantIDs

func (m *AccountMutation) TenantIDs() (ids []uuid.UUID)

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

func (AccountMutation) Tx

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

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

func (*AccountMutation) Type

func (m *AccountMutation) Type() string

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

func (*AccountMutation) UpdatedAt

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

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

func (*AccountMutation) UsersCleared

func (m *AccountMutation) UsersCleared() bool

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

func (*AccountMutation) UsersIDs

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

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

func (*AccountMutation) Where

func (m *AccountMutation) Where(ps ...predicate.Account)

Where appends a list predicates to the AccountMutation builder.

func (*AccountMutation) WhereP

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

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

type AccountQuery

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

AccountQuery is the builder for querying Account entities.

func (*AccountQuery) Aggregate

func (aq *AccountQuery) Aggregate(fns ...AggregateFunc) *AccountSelect

Aggregate returns a AccountSelect configured with the given aggregations.

func (*AccountQuery) All

func (aq *AccountQuery) All(ctx context.Context) ([]*Account, error)

All executes the query and returns a list of Accounts.

func (*AccountQuery) AllX

func (aq *AccountQuery) AllX(ctx context.Context) []*Account

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

func (*AccountQuery) Clone

func (aq *AccountQuery) Clone() *AccountQuery

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

func (*AccountQuery) Count

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

Count returns the count of the given query.

func (*AccountQuery) CountX

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

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

func (*AccountQuery) Exist

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

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

func (*AccountQuery) ExistX

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

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

func (*AccountQuery) First

func (aq *AccountQuery) First(ctx context.Context) (*Account, error)

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

func (*AccountQuery) FirstID

func (aq *AccountQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccountQuery) FirstIDX

func (aq *AccountQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*AccountQuery) FirstX

func (aq *AccountQuery) FirstX(ctx context.Context) *Account

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

func (*AccountQuery) GroupBy

func (aq *AccountQuery) GroupBy(field string, fields ...string) *AccountGroupBy

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

Example:

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

client.Account.Query().
	GroupBy(account.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccountQuery) IDs

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

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

func (*AccountQuery) IDsX

func (aq *AccountQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AccountQuery) Limit

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

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

func (*AccountQuery) Offset

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

Offset to start from.

func (*AccountQuery) Only

func (aq *AccountQuery) Only(ctx context.Context) (*Account, error)

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

func (*AccountQuery) OnlyID

func (aq *AccountQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AccountQuery) OnlyIDX

func (aq *AccountQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AccountQuery) OnlyX

func (aq *AccountQuery) OnlyX(ctx context.Context) *Account

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

func (*AccountQuery) Order

func (aq *AccountQuery) Order(o ...account.OrderOption) *AccountQuery

Order specifies how the records should be ordered.

func (*AccountQuery) QueryAccessPolicies

func (aq *AccountQuery) QueryAccessPolicies() *AccessPolicyQuery

QueryAccessPolicies chains the current query on the "access_policies" edge.

func (*AccountQuery) QueryResources

func (aq *AccountQuery) QueryResources() *ResourceQuery

QueryResources chains the current query on the "resources" edge.

func (*AccountQuery) QueryRoles

func (aq *AccountQuery) QueryRoles() *RoleQuery

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

func (*AccountQuery) QueryTenant

func (aq *AccountQuery) QueryTenant() *TenantQuery

QueryTenant chains the current query on the "tenant" edge.

func (*AccountQuery) QueryUsers

func (aq *AccountQuery) QueryUsers() *UserQuery

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

func (*AccountQuery) Select

func (aq *AccountQuery) Select(fields ...string) *AccountSelect

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

Example:

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

client.Account.Query().
	Select(account.FieldCreatedAt).
	Scan(ctx, &v)

func (*AccountQuery) Unique

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

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

func (aq *AccountQuery) Where(ps ...predicate.Account) *AccountQuery

Where adds a new predicate for the AccountQuery builder.

func (*AccountQuery) WithAccessPolicies

func (aq *AccountQuery) WithAccessPolicies(opts ...func(*AccessPolicyQuery)) *AccountQuery

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

func (*AccountQuery) WithResources

func (aq *AccountQuery) WithResources(opts ...func(*ResourceQuery)) *AccountQuery

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

func (*AccountQuery) WithRoles

func (aq *AccountQuery) WithRoles(opts ...func(*RoleQuery)) *AccountQuery

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.

func (*AccountQuery) WithTenant

func (aq *AccountQuery) WithTenant(opts ...func(*TenantQuery)) *AccountQuery

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

func (*AccountQuery) WithUsers

func (aq *AccountQuery) WithUsers(opts ...func(*UserQuery)) *AccountQuery

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 AccountSelect

type AccountSelect struct {
	*AccountQuery
	// contains filtered or unexported fields
}

AccountSelect is the builder for selecting fields of Account entities.

func (*AccountSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*AccountSelect) Bool

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

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

func (*AccountSelect) BoolX

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

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

func (*AccountSelect) Bools

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

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

func (*AccountSelect) BoolsX

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

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

func (*AccountSelect) Float64

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

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

func (*AccountSelect) Float64X

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

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

func (*AccountSelect) Float64s

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

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

func (*AccountSelect) Float64sX

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

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

func (*AccountSelect) Int

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

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

func (*AccountSelect) IntX

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

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

func (*AccountSelect) Ints

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

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

func (*AccountSelect) IntsX

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

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

func (*AccountSelect) Scan

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

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

func (*AccountSelect) ScanX

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

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

func (*AccountSelect) String

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

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

func (*AccountSelect) StringX

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

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

func (*AccountSelect) Strings

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

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

func (*AccountSelect) StringsX

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

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

type AccountUpdate

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

AccountUpdate is the builder for updating Account entities.

func (*AccountUpdate) AddAccessPolicies

func (au *AccountUpdate) AddAccessPolicies(a ...*AccessPolicy) *AccountUpdate

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*AccountUpdate) AddAccessPolicyIDs

func (au *AccountUpdate) AddAccessPolicyIDs(ids ...uuid.UUID) *AccountUpdate

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*AccountUpdate) AddResourceIDs

func (au *AccountUpdate) AddResourceIDs(ids ...uuid.UUID) *AccountUpdate

AddResourceIDs adds the "resources" edge to the Resource entity by IDs.

func (*AccountUpdate) AddResources

func (au *AccountUpdate) AddResources(r ...*Resource) *AccountUpdate

AddResources adds the "resources" edges to the Resource entity.

func (*AccountUpdate) AddRoleIDs

func (au *AccountUpdate) AddRoleIDs(ids ...uuid.UUID) *AccountUpdate

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

func (*AccountUpdate) AddRoles

func (au *AccountUpdate) AddRoles(r ...*Role) *AccountUpdate

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

func (*AccountUpdate) AddUserIDs

func (au *AccountUpdate) AddUserIDs(ids ...uuid.UUID) *AccountUpdate

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

func (*AccountUpdate) AddUsers

func (au *AccountUpdate) AddUsers(u ...*User) *AccountUpdate

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

func (*AccountUpdate) ClearAccessPolicies

func (au *AccountUpdate) ClearAccessPolicies() *AccountUpdate

ClearAccessPolicies clears all "access_policies" edges to the AccessPolicy entity.

func (*AccountUpdate) ClearDescription

func (au *AccountUpdate) ClearDescription() *AccountUpdate

ClearDescription clears the value of the "description" field.

func (*AccountUpdate) ClearResources

func (au *AccountUpdate) ClearResources() *AccountUpdate

ClearResources clears all "resources" edges to the Resource entity.

func (*AccountUpdate) ClearRoles

func (au *AccountUpdate) ClearRoles() *AccountUpdate

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

func (*AccountUpdate) ClearTenant

func (au *AccountUpdate) ClearTenant() *AccountUpdate

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*AccountUpdate) ClearUsers

func (au *AccountUpdate) ClearUsers() *AccountUpdate

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

func (*AccountUpdate) Exec

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

Exec executes the query.

func (*AccountUpdate) ExecX

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

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

func (*AccountUpdate) Mutation

func (au *AccountUpdate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdate) RemoveAccessPolicies

func (au *AccountUpdate) RemoveAccessPolicies(a ...*AccessPolicy) *AccountUpdate

RemoveAccessPolicies removes "access_policies" edges to AccessPolicy entities.

func (*AccountUpdate) RemoveAccessPolicyIDs

func (au *AccountUpdate) RemoveAccessPolicyIDs(ids ...uuid.UUID) *AccountUpdate

RemoveAccessPolicyIDs removes the "access_policies" edge to AccessPolicy entities by IDs.

func (*AccountUpdate) RemoveResourceIDs

func (au *AccountUpdate) RemoveResourceIDs(ids ...uuid.UUID) *AccountUpdate

RemoveResourceIDs removes the "resources" edge to Resource entities by IDs.

func (*AccountUpdate) RemoveResources

func (au *AccountUpdate) RemoveResources(r ...*Resource) *AccountUpdate

RemoveResources removes "resources" edges to Resource entities.

func (*AccountUpdate) RemoveRoleIDs

func (au *AccountUpdate) RemoveRoleIDs(ids ...uuid.UUID) *AccountUpdate

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

func (*AccountUpdate) RemoveRoles

func (au *AccountUpdate) RemoveRoles(r ...*Role) *AccountUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*AccountUpdate) RemoveUserIDs

func (au *AccountUpdate) RemoveUserIDs(ids ...uuid.UUID) *AccountUpdate

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

func (*AccountUpdate) RemoveUsers

func (au *AccountUpdate) RemoveUsers(u ...*User) *AccountUpdate

RemoveUsers removes "users" edges to User entities.

func (*AccountUpdate) Save

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

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

func (*AccountUpdate) SaveX

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

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

func (*AccountUpdate) SetDescription

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

SetDescription sets the "description" field.

func (*AccountUpdate) SetName

func (au *AccountUpdate) SetName(s string) *AccountUpdate

SetName sets the "name" field.

func (*AccountUpdate) SetNillableDescription

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

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

func (*AccountUpdate) SetNillableName

func (au *AccountUpdate) SetNillableName(s *string) *AccountUpdate

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

func (*AccountUpdate) SetNillableStatus

func (au *AccountUpdate) SetNillableStatus(a *account.Status) *AccountUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AccountUpdate) SetStatus

func (au *AccountUpdate) SetStatus(a account.Status) *AccountUpdate

SetStatus sets the "status" field.

func (*AccountUpdate) SetTenant

func (au *AccountUpdate) SetTenant(t *Tenant) *AccountUpdate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*AccountUpdate) SetTenantID

func (au *AccountUpdate) SetTenantID(id uuid.UUID) *AccountUpdate

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

func (*AccountUpdate) SetUpdatedAt

func (au *AccountUpdate) SetUpdatedAt(t time.Time) *AccountUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpdate) Where

func (au *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate

Where appends a list predicates to the AccountUpdate builder.

type AccountUpdateOne

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

AccountUpdateOne is the builder for updating a single Account entity.

func (*AccountUpdateOne) AddAccessPolicies

func (auo *AccountUpdateOne) AddAccessPolicies(a ...*AccessPolicy) *AccountUpdateOne

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*AccountUpdateOne) AddAccessPolicyIDs

func (auo *AccountUpdateOne) AddAccessPolicyIDs(ids ...uuid.UUID) *AccountUpdateOne

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*AccountUpdateOne) AddResourceIDs

func (auo *AccountUpdateOne) AddResourceIDs(ids ...uuid.UUID) *AccountUpdateOne

AddResourceIDs adds the "resources" edge to the Resource entity by IDs.

func (*AccountUpdateOne) AddResources

func (auo *AccountUpdateOne) AddResources(r ...*Resource) *AccountUpdateOne

AddResources adds the "resources" edges to the Resource entity.

func (*AccountUpdateOne) AddRoleIDs

func (auo *AccountUpdateOne) AddRoleIDs(ids ...uuid.UUID) *AccountUpdateOne

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

func (*AccountUpdateOne) AddRoles

func (auo *AccountUpdateOne) AddRoles(r ...*Role) *AccountUpdateOne

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

func (*AccountUpdateOne) AddUserIDs

func (auo *AccountUpdateOne) AddUserIDs(ids ...uuid.UUID) *AccountUpdateOne

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

func (*AccountUpdateOne) AddUsers

func (auo *AccountUpdateOne) AddUsers(u ...*User) *AccountUpdateOne

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

func (*AccountUpdateOne) ClearAccessPolicies

func (auo *AccountUpdateOne) ClearAccessPolicies() *AccountUpdateOne

ClearAccessPolicies clears all "access_policies" edges to the AccessPolicy entity.

func (*AccountUpdateOne) ClearDescription

func (auo *AccountUpdateOne) ClearDescription() *AccountUpdateOne

ClearDescription clears the value of the "description" field.

func (*AccountUpdateOne) ClearResources

func (auo *AccountUpdateOne) ClearResources() *AccountUpdateOne

ClearResources clears all "resources" edges to the Resource entity.

func (*AccountUpdateOne) ClearRoles

func (auo *AccountUpdateOne) ClearRoles() *AccountUpdateOne

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

func (*AccountUpdateOne) ClearTenant

func (auo *AccountUpdateOne) ClearTenant() *AccountUpdateOne

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*AccountUpdateOne) ClearUsers

func (auo *AccountUpdateOne) ClearUsers() *AccountUpdateOne

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

func (*AccountUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AccountUpdateOne) ExecX

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

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

func (*AccountUpdateOne) Mutation

func (auo *AccountUpdateOne) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdateOne) RemoveAccessPolicies

func (auo *AccountUpdateOne) RemoveAccessPolicies(a ...*AccessPolicy) *AccountUpdateOne

RemoveAccessPolicies removes "access_policies" edges to AccessPolicy entities.

func (*AccountUpdateOne) RemoveAccessPolicyIDs

func (auo *AccountUpdateOne) RemoveAccessPolicyIDs(ids ...uuid.UUID) *AccountUpdateOne

RemoveAccessPolicyIDs removes the "access_policies" edge to AccessPolicy entities by IDs.

func (*AccountUpdateOne) RemoveResourceIDs

func (auo *AccountUpdateOne) RemoveResourceIDs(ids ...uuid.UUID) *AccountUpdateOne

RemoveResourceIDs removes the "resources" edge to Resource entities by IDs.

func (*AccountUpdateOne) RemoveResources

func (auo *AccountUpdateOne) RemoveResources(r ...*Resource) *AccountUpdateOne

RemoveResources removes "resources" edges to Resource entities.

func (*AccountUpdateOne) RemoveRoleIDs

func (auo *AccountUpdateOne) RemoveRoleIDs(ids ...uuid.UUID) *AccountUpdateOne

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

func (*AccountUpdateOne) RemoveRoles

func (auo *AccountUpdateOne) RemoveRoles(r ...*Role) *AccountUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*AccountUpdateOne) RemoveUserIDs

func (auo *AccountUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *AccountUpdateOne

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

func (*AccountUpdateOne) RemoveUsers

func (auo *AccountUpdateOne) RemoveUsers(u ...*User) *AccountUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*AccountUpdateOne) Save

func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error)

Save executes the query and returns the updated Account entity.

func (*AccountUpdateOne) SaveX

func (auo *AccountUpdateOne) SaveX(ctx context.Context) *Account

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

func (*AccountUpdateOne) Select

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

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

func (*AccountUpdateOne) SetDescription

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

SetDescription sets the "description" field.

func (*AccountUpdateOne) SetName

func (auo *AccountUpdateOne) SetName(s string) *AccountUpdateOne

SetName sets the "name" field.

func (*AccountUpdateOne) SetNillableDescription

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

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

func (*AccountUpdateOne) SetNillableName

func (auo *AccountUpdateOne) SetNillableName(s *string) *AccountUpdateOne

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

func (*AccountUpdateOne) SetNillableStatus

func (auo *AccountUpdateOne) SetNillableStatus(a *account.Status) *AccountUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*AccountUpdateOne) SetStatus

func (auo *AccountUpdateOne) SetStatus(a account.Status) *AccountUpdateOne

SetStatus sets the "status" field.

func (*AccountUpdateOne) SetTenant

func (auo *AccountUpdateOne) SetTenant(t *Tenant) *AccountUpdateOne

SetTenant sets the "tenant" edge to the Tenant entity.

func (*AccountUpdateOne) SetTenantID

func (auo *AccountUpdateOne) SetTenantID(id uuid.UUID) *AccountUpdateOne

SetTenantID sets the "tenant" edge to the Tenant entity by ID.

func (*AccountUpdateOne) SetUpdatedAt

func (auo *AccountUpdateOne) SetUpdatedAt(t time.Time) *AccountUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AccountUpdateOne) Where

Where appends a list predicates to the AccountUpdate builder.

type Accounts

type Accounts []*Account

Accounts is a parsable slice of Account.

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 AuditLog

type AuditLog struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// ActorID holds the value of the "actor_id" field.
	ActorID int `json:"actor_id,omitempty"`
	// ActorUsername holds the value of the "actor_username" field.
	ActorUsername string `json:"actor_username,omitempty"`
	// Action holds the value of the "action" field.
	Action string `json:"action,omitempty"`
	// ResourceID holds the value of the "resource_id" field.
	ResourceID int `json:"resource_id,omitempty"`
	// ResourceType holds the value of the "resource_type" field.
	ResourceType auditlog.ResourceType `json:"resource_type,omitempty"`
	// IPAddress holds the value of the "ip_address" field.
	IPAddress string `json:"ip_address,omitempty"`
	// UserAgent holds the value of the "user_agent" field.
	UserAgent string `json:"user_agent,omitempty"`
	// Details holds the value of the "details" field.
	Details map[string]interface{} `json:"details,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuditLogQuery when eager-loading is set.
	Edges AuditLogEdges `json:"edges"`
	// contains filtered or unexported fields
}

AuditLog is the model entity for the AuditLog schema.

func (*AuditLog) QueryTenant

func (al *AuditLog) QueryTenant() *TenantQuery

QueryTenant queries the "tenant" edge of the AuditLog entity.

func (*AuditLog) QueryUser

func (al *AuditLog) QueryUser() *UserQuery

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

func (*AuditLog) String

func (al *AuditLog) String() string

String implements the fmt.Stringer.

func (*AuditLog) Unwrap

func (al *AuditLog) Unwrap() *AuditLog

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

func (al *AuditLog) Update() *AuditLogUpdateOne

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

func (*AuditLog) Value

func (al *AuditLog) Value(name string) (ent.Value, error)

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

type AuditLogClient

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

AuditLogClient is a client for the AuditLog schema.

func NewAuditLogClient

func NewAuditLogClient(c config) *AuditLogClient

NewAuditLogClient returns a client for the AuditLog from the given config.

func (*AuditLogClient) Create

func (c *AuditLogClient) Create() *AuditLogCreate

Create returns a builder for creating a AuditLog entity.

func (*AuditLogClient) CreateBulk

func (c *AuditLogClient) CreateBulk(builders ...*AuditLogCreate) *AuditLogCreateBulk

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

func (*AuditLogClient) Delete

func (c *AuditLogClient) Delete() *AuditLogDelete

Delete returns a delete builder for AuditLog.

func (*AuditLogClient) DeleteOne

func (c *AuditLogClient) DeleteOne(al *AuditLog) *AuditLogDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AuditLogClient) DeleteOneID

func (c *AuditLogClient) DeleteOneID(id uuid.UUID) *AuditLogDeleteOne

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

func (*AuditLogClient) Get

func (c *AuditLogClient) Get(ctx context.Context, id uuid.UUID) (*AuditLog, error)

Get returns a AuditLog entity by its id.

func (*AuditLogClient) GetX

func (c *AuditLogClient) GetX(ctx context.Context, id uuid.UUID) *AuditLog

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

func (*AuditLogClient) Hooks

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

Hooks returns the client hooks.

func (*AuditLogClient) Intercept

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

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

func (*AuditLogClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AuditLogClient) MapCreateBulk

func (c *AuditLogClient) MapCreateBulk(slice any, setFunc func(*AuditLogCreate, int)) *AuditLogCreateBulk

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

func (c *AuditLogClient) Query() *AuditLogQuery

Query returns a query builder for AuditLog.

func (*AuditLogClient) QueryTenant

func (c *AuditLogClient) QueryTenant(al *AuditLog) *TenantQuery

QueryTenant queries the tenant edge of a AuditLog.

func (*AuditLogClient) QueryUser

func (c *AuditLogClient) QueryUser(al *AuditLog) *UserQuery

QueryUser queries the user edge of a AuditLog.

func (*AuditLogClient) Update

func (c *AuditLogClient) Update() *AuditLogUpdate

Update returns an update builder for AuditLog.

func (*AuditLogClient) UpdateOne

func (c *AuditLogClient) UpdateOne(al *AuditLog) *AuditLogUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuditLogClient) UpdateOneID

func (c *AuditLogClient) UpdateOneID(id uuid.UUID) *AuditLogUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuditLogClient) Use

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

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

type AuditLogCreate

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

AuditLogCreate is the builder for creating a AuditLog entity.

func (*AuditLogCreate) AddTenant

func (alc *AuditLogCreate) AddTenant(t ...*Tenant) *AuditLogCreate

AddTenant adds the "tenant" edges to the Tenant entity.

func (*AuditLogCreate) AddTenantIDs

func (alc *AuditLogCreate) AddTenantIDs(ids ...uuid.UUID) *AuditLogCreate

AddTenantIDs adds the "tenant" edge to the Tenant entity by IDs.

func (*AuditLogCreate) AddUser

func (alc *AuditLogCreate) AddUser(u ...*User) *AuditLogCreate

AddUser adds the "user" edges to the User entity.

func (*AuditLogCreate) AddUserIDs

func (alc *AuditLogCreate) AddUserIDs(ids ...uuid.UUID) *AuditLogCreate

AddUserIDs adds the "user" edge to the User entity by IDs.

func (*AuditLogCreate) Exec

func (alc *AuditLogCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuditLogCreate) ExecX

func (alc *AuditLogCreate) ExecX(ctx context.Context)

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

func (*AuditLogCreate) Mutation

func (alc *AuditLogCreate) Mutation() *AuditLogMutation

Mutation returns the AuditLogMutation object of the builder.

func (*AuditLogCreate) Save

func (alc *AuditLogCreate) Save(ctx context.Context) (*AuditLog, error)

Save creates the AuditLog in the database.

func (*AuditLogCreate) SaveX

func (alc *AuditLogCreate) SaveX(ctx context.Context) *AuditLog

SaveX calls Save and panics if Save returns an error.

func (*AuditLogCreate) SetAction

func (alc *AuditLogCreate) SetAction(s string) *AuditLogCreate

SetAction sets the "action" field.

func (*AuditLogCreate) SetActorID

func (alc *AuditLogCreate) SetActorID(i int) *AuditLogCreate

SetActorID sets the "actor_id" field.

func (*AuditLogCreate) SetActorUsername

func (alc *AuditLogCreate) SetActorUsername(s string) *AuditLogCreate

SetActorUsername sets the "actor_username" field.

func (*AuditLogCreate) SetCreatedAt

func (alc *AuditLogCreate) SetCreatedAt(t time.Time) *AuditLogCreate

SetCreatedAt sets the "created_at" field.

func (*AuditLogCreate) SetDetails

func (alc *AuditLogCreate) SetDetails(m map[string]interface{}) *AuditLogCreate

SetDetails sets the "details" field.

func (*AuditLogCreate) SetID

func (alc *AuditLogCreate) SetID(u uuid.UUID) *AuditLogCreate

SetID sets the "id" field.

func (*AuditLogCreate) SetIPAddress

func (alc *AuditLogCreate) SetIPAddress(s string) *AuditLogCreate

SetIPAddress sets the "ip_address" field.

func (*AuditLogCreate) SetNillableCreatedAt

func (alc *AuditLogCreate) SetNillableCreatedAt(t *time.Time) *AuditLogCreate

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

func (*AuditLogCreate) SetNillableID

func (alc *AuditLogCreate) SetNillableID(u *uuid.UUID) *AuditLogCreate

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

func (*AuditLogCreate) SetNillableIPAddress

func (alc *AuditLogCreate) SetNillableIPAddress(s *string) *AuditLogCreate

SetNillableIPAddress sets the "ip_address" field if the given value is not nil.

func (*AuditLogCreate) SetNillableResourceID

func (alc *AuditLogCreate) SetNillableResourceID(i *int) *AuditLogCreate

SetNillableResourceID sets the "resource_id" field if the given value is not nil.

func (*AuditLogCreate) SetNillableResourceType

func (alc *AuditLogCreate) SetNillableResourceType(at *auditlog.ResourceType) *AuditLogCreate

SetNillableResourceType sets the "resource_type" field if the given value is not nil.

func (*AuditLogCreate) SetNillableTimestamp

func (alc *AuditLogCreate) SetNillableTimestamp(t *time.Time) *AuditLogCreate

SetNillableTimestamp sets the "timestamp" field if the given value is not nil.

func (*AuditLogCreate) SetNillableUpdatedAt

func (alc *AuditLogCreate) SetNillableUpdatedAt(t *time.Time) *AuditLogCreate

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

func (*AuditLogCreate) SetNillableUserAgent

func (alc *AuditLogCreate) SetNillableUserAgent(s *string) *AuditLogCreate

SetNillableUserAgent sets the "user_agent" field if the given value is not nil.

func (*AuditLogCreate) SetResourceID

func (alc *AuditLogCreate) SetResourceID(i int) *AuditLogCreate

SetResourceID sets the "resource_id" field.

func (*AuditLogCreate) SetResourceType

func (alc *AuditLogCreate) SetResourceType(at auditlog.ResourceType) *AuditLogCreate

SetResourceType sets the "resource_type" field.

func (*AuditLogCreate) SetTimestamp

func (alc *AuditLogCreate) SetTimestamp(t time.Time) *AuditLogCreate

SetTimestamp sets the "timestamp" field.

func (*AuditLogCreate) SetUpdatedAt

func (alc *AuditLogCreate) SetUpdatedAt(t time.Time) *AuditLogCreate

SetUpdatedAt sets the "updated_at" field.

func (*AuditLogCreate) SetUserAgent

func (alc *AuditLogCreate) SetUserAgent(s string) *AuditLogCreate

SetUserAgent sets the "user_agent" field.

type AuditLogCreateBulk

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

AuditLogCreateBulk is the builder for creating many AuditLog entities in bulk.

func (*AuditLogCreateBulk) Exec

func (alcb *AuditLogCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AuditLogCreateBulk) ExecX

func (alcb *AuditLogCreateBulk) ExecX(ctx context.Context)

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

func (*AuditLogCreateBulk) Save

func (alcb *AuditLogCreateBulk) Save(ctx context.Context) ([]*AuditLog, error)

Save creates the AuditLog entities in the database.

func (*AuditLogCreateBulk) SaveX

func (alcb *AuditLogCreateBulk) SaveX(ctx context.Context) []*AuditLog

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

type AuditLogDelete

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

AuditLogDelete is the builder for deleting a AuditLog entity.

func (*AuditLogDelete) Exec

func (ald *AuditLogDelete) Exec(ctx context.Context) (int, error)

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

func (*AuditLogDelete) ExecX

func (ald *AuditLogDelete) ExecX(ctx context.Context) int

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

func (*AuditLogDelete) Where

func (ald *AuditLogDelete) Where(ps ...predicate.AuditLog) *AuditLogDelete

Where appends a list predicates to the AuditLogDelete builder.

type AuditLogDeleteOne

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

AuditLogDeleteOne is the builder for deleting a single AuditLog entity.

func (*AuditLogDeleteOne) Exec

func (aldo *AuditLogDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AuditLogDeleteOne) ExecX

func (aldo *AuditLogDeleteOne) ExecX(ctx context.Context)

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

func (*AuditLogDeleteOne) Where

Where appends a list predicates to the AuditLogDelete builder.

type AuditLogEdges

type AuditLogEdges struct {
	// 执行操作的用户
	User []*User `json:"user,omitempty"`
	// 操作所属的租户
	Tenant []*Tenant `json:"tenant,omitempty"`
	// contains filtered or unexported fields
}

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

func (AuditLogEdges) TenantOrErr

func (e AuditLogEdges) TenantOrErr() ([]*Tenant, error)

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

func (AuditLogEdges) UserOrErr

func (e AuditLogEdges) UserOrErr() ([]*User, error)

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

type AuditLogGroupBy

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

AuditLogGroupBy is the group-by builder for AuditLog entities.

func (*AuditLogGroupBy) Aggregate

func (algb *AuditLogGroupBy) Aggregate(fns ...AggregateFunc) *AuditLogGroupBy

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

func (*AuditLogGroupBy) Bool

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

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

func (*AuditLogGroupBy) BoolX

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

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

func (*AuditLogGroupBy) Bools

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

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

func (*AuditLogGroupBy) BoolsX

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

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

func (*AuditLogGroupBy) Float64

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

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

func (*AuditLogGroupBy) Float64X

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

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

func (*AuditLogGroupBy) Float64s

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

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

func (*AuditLogGroupBy) Float64sX

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

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

func (*AuditLogGroupBy) Int

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

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

func (*AuditLogGroupBy) IntX

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

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

func (*AuditLogGroupBy) Ints

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

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

func (*AuditLogGroupBy) IntsX

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

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

func (*AuditLogGroupBy) Scan

func (algb *AuditLogGroupBy) Scan(ctx context.Context, v any) error

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

func (*AuditLogGroupBy) ScanX

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

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

func (*AuditLogGroupBy) String

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

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

func (*AuditLogGroupBy) StringX

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

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

func (*AuditLogGroupBy) Strings

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

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

func (*AuditLogGroupBy) StringsX

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

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

type AuditLogMutation

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

AuditLogMutation represents an operation that mutates the AuditLog nodes in the graph.

func (*AuditLogMutation) Action

func (m *AuditLogMutation) Action() (r string, exists bool)

Action returns the value of the "action" field in the mutation.

func (*AuditLogMutation) ActorID

func (m *AuditLogMutation) ActorID() (r int, exists bool)

ActorID returns the value of the "actor_id" field in the mutation.

func (*AuditLogMutation) ActorUsername

func (m *AuditLogMutation) ActorUsername() (r string, exists bool)

ActorUsername returns the value of the "actor_username" field in the mutation.

func (*AuditLogMutation) AddActorID

func (m *AuditLogMutation) AddActorID(i int)

AddActorID adds i to the "actor_id" field.

func (*AuditLogMutation) AddField

func (m *AuditLogMutation) 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 (*AuditLogMutation) AddResourceID

func (m *AuditLogMutation) AddResourceID(i int)

AddResourceID adds i to the "resource_id" field.

func (*AuditLogMutation) AddTenantIDs

func (m *AuditLogMutation) AddTenantIDs(ids ...uuid.UUID)

AddTenantIDs adds the "tenant" edge to the Tenant entity by ids.

func (*AuditLogMutation) AddUserIDs

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

AddUserIDs adds the "user" edge to the User entity by ids.

func (*AuditLogMutation) AddedActorID

func (m *AuditLogMutation) AddedActorID() (r int, exists bool)

AddedActorID returns the value that was added to the "actor_id" field in this mutation.

func (*AuditLogMutation) AddedEdges

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

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

func (*AuditLogMutation) AddedField

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

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

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

func (*AuditLogMutation) AddedIDs

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

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

func (*AuditLogMutation) AddedResourceID

func (m *AuditLogMutation) AddedResourceID() (r int, exists bool)

AddedResourceID returns the value that was added to the "resource_id" field in this mutation.

func (*AuditLogMutation) ClearDetails

func (m *AuditLogMutation) ClearDetails()

ClearDetails clears the value of the "details" field.

func (*AuditLogMutation) ClearEdge

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

func (m *AuditLogMutation) 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 (*AuditLogMutation) ClearIPAddress

func (m *AuditLogMutation) ClearIPAddress()

ClearIPAddress clears the value of the "ip_address" field.

func (*AuditLogMutation) ClearResourceID

func (m *AuditLogMutation) ClearResourceID()

ClearResourceID clears the value of the "resource_id" field.

func (*AuditLogMutation) ClearResourceType

func (m *AuditLogMutation) ClearResourceType()

ClearResourceType clears the value of the "resource_type" field.

func (*AuditLogMutation) ClearTenant

func (m *AuditLogMutation) ClearTenant()

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*AuditLogMutation) ClearUser

func (m *AuditLogMutation) ClearUser()

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

func (*AuditLogMutation) ClearUserAgent

func (m *AuditLogMutation) ClearUserAgent()

ClearUserAgent clears the value of the "user_agent" field.

func (*AuditLogMutation) ClearedEdges

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

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

func (*AuditLogMutation) ClearedFields

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

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

func (AuditLogMutation) Client

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

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

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

func (*AuditLogMutation) Details

func (m *AuditLogMutation) Details() (r map[string]interface{}, exists bool)

Details returns the value of the "details" field in the mutation.

func (*AuditLogMutation) DetailsCleared

func (m *AuditLogMutation) DetailsCleared() bool

DetailsCleared returns if the "details" field was cleared in this mutation.

func (*AuditLogMutation) EdgeCleared

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

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

func (*AuditLogMutation) Field

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

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

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

func (*AuditLogMutation) Fields

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

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

func (m *AuditLogMutation) 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 (*AuditLogMutation) IPAddress

func (m *AuditLogMutation) IPAddress() (r string, exists bool)

IPAddress returns the value of the "ip_address" field in the mutation.

func (*AuditLogMutation) IPAddressCleared

func (m *AuditLogMutation) IPAddressCleared() bool

IPAddressCleared returns if the "ip_address" field was cleared in this mutation.

func (*AuditLogMutation) OldAction

func (m *AuditLogMutation) OldAction(ctx context.Context) (v string, err error)

OldAction returns the old "action" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldActorID

func (m *AuditLogMutation) OldActorID(ctx context.Context) (v int, err error)

OldActorID returns the old "actor_id" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldActorUsername

func (m *AuditLogMutation) OldActorUsername(ctx context.Context) (v string, err error)

OldActorUsername returns the old "actor_username" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldCreatedAt

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

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

func (m *AuditLogMutation) OldDetails(ctx context.Context) (v map[string]interface{}, err error)

OldDetails returns the old "details" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldField

func (m *AuditLogMutation) 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 (*AuditLogMutation) OldIPAddress

func (m *AuditLogMutation) OldIPAddress(ctx context.Context) (v string, err error)

OldIPAddress returns the old "ip_address" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldResourceID

func (m *AuditLogMutation) OldResourceID(ctx context.Context) (v int, err error)

OldResourceID returns the old "resource_id" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldResourceType

func (m *AuditLogMutation) OldResourceType(ctx context.Context) (v auditlog.ResourceType, err error)

OldResourceType returns the old "resource_type" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldTimestamp

func (m *AuditLogMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) OldUpdatedAt

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

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

func (m *AuditLogMutation) OldUserAgent(ctx context.Context) (v string, err error)

OldUserAgent returns the old "user_agent" field's value of the AuditLog entity. If the AuditLog 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 (*AuditLogMutation) Op

func (m *AuditLogMutation) Op() Op

Op returns the operation name.

func (*AuditLogMutation) RemoveTenantIDs

func (m *AuditLogMutation) RemoveTenantIDs(ids ...uuid.UUID)

RemoveTenantIDs removes the "tenant" edge to the Tenant entity by IDs.

func (*AuditLogMutation) RemoveUserIDs

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

RemoveUserIDs removes the "user" edge to the User entity by IDs.

func (*AuditLogMutation) RemovedEdges

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

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

func (*AuditLogMutation) RemovedIDs

func (m *AuditLogMutation) 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 (*AuditLogMutation) RemovedTenantIDs

func (m *AuditLogMutation) RemovedTenantIDs() (ids []uuid.UUID)

RemovedTenant returns the removed IDs of the "tenant" edge to the Tenant entity.

func (*AuditLogMutation) RemovedUserIDs

func (m *AuditLogMutation) RemovedUserIDs() (ids []uuid.UUID)

RemovedUser returns the removed IDs of the "user" edge to the User entity.

func (*AuditLogMutation) ResetAction

func (m *AuditLogMutation) ResetAction()

ResetAction resets all changes to the "action" field.

func (*AuditLogMutation) ResetActorID

func (m *AuditLogMutation) ResetActorID()

ResetActorID resets all changes to the "actor_id" field.

func (*AuditLogMutation) ResetActorUsername

func (m *AuditLogMutation) ResetActorUsername()

ResetActorUsername resets all changes to the "actor_username" field.

func (*AuditLogMutation) ResetCreatedAt

func (m *AuditLogMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AuditLogMutation) ResetDetails

func (m *AuditLogMutation) ResetDetails()

ResetDetails resets all changes to the "details" field.

func (*AuditLogMutation) ResetEdge

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

func (m *AuditLogMutation) 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 (*AuditLogMutation) ResetIPAddress

func (m *AuditLogMutation) ResetIPAddress()

ResetIPAddress resets all changes to the "ip_address" field.

func (*AuditLogMutation) ResetResourceID

func (m *AuditLogMutation) ResetResourceID()

ResetResourceID resets all changes to the "resource_id" field.

func (*AuditLogMutation) ResetResourceType

func (m *AuditLogMutation) ResetResourceType()

ResetResourceType resets all changes to the "resource_type" field.

func (*AuditLogMutation) ResetTenant

func (m *AuditLogMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*AuditLogMutation) ResetTimestamp

func (m *AuditLogMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*AuditLogMutation) ResetUpdatedAt

func (m *AuditLogMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AuditLogMutation) ResetUser

func (m *AuditLogMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*AuditLogMutation) ResetUserAgent

func (m *AuditLogMutation) ResetUserAgent()

ResetUserAgent resets all changes to the "user_agent" field.

func (*AuditLogMutation) ResourceID

func (m *AuditLogMutation) ResourceID() (r int, exists bool)

ResourceID returns the value of the "resource_id" field in the mutation.

func (*AuditLogMutation) ResourceIDCleared

func (m *AuditLogMutation) ResourceIDCleared() bool

ResourceIDCleared returns if the "resource_id" field was cleared in this mutation.

func (*AuditLogMutation) ResourceType

func (m *AuditLogMutation) ResourceType() (r auditlog.ResourceType, exists bool)

ResourceType returns the value of the "resource_type" field in the mutation.

func (*AuditLogMutation) ResourceTypeCleared

func (m *AuditLogMutation) ResourceTypeCleared() bool

ResourceTypeCleared returns if the "resource_type" field was cleared in this mutation.

func (*AuditLogMutation) SetAction

func (m *AuditLogMutation) SetAction(s string)

SetAction sets the "action" field.

func (*AuditLogMutation) SetActorID

func (m *AuditLogMutation) SetActorID(i int)

SetActorID sets the "actor_id" field.

func (*AuditLogMutation) SetActorUsername

func (m *AuditLogMutation) SetActorUsername(s string)

SetActorUsername sets the "actor_username" field.

func (*AuditLogMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AuditLogMutation) SetDetails

func (m *AuditLogMutation) SetDetails(value map[string]interface{})

SetDetails sets the "details" field.

func (*AuditLogMutation) SetField

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

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

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

func (*AuditLogMutation) SetIPAddress

func (m *AuditLogMutation) SetIPAddress(s string)

SetIPAddress sets the "ip_address" field.

func (*AuditLogMutation) SetOp

func (m *AuditLogMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AuditLogMutation) SetResourceID

func (m *AuditLogMutation) SetResourceID(i int)

SetResourceID sets the "resource_id" field.

func (*AuditLogMutation) SetResourceType

func (m *AuditLogMutation) SetResourceType(at auditlog.ResourceType)

SetResourceType sets the "resource_type" field.

func (*AuditLogMutation) SetTimestamp

func (m *AuditLogMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*AuditLogMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AuditLogMutation) SetUserAgent

func (m *AuditLogMutation) SetUserAgent(s string)

SetUserAgent sets the "user_agent" field.

func (*AuditLogMutation) TenantCleared

func (m *AuditLogMutation) TenantCleared() bool

TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.

func (*AuditLogMutation) TenantIDs

func (m *AuditLogMutation) TenantIDs() (ids []uuid.UUID)

TenantIDs returns the "tenant" edge IDs in the mutation.

func (*AuditLogMutation) Timestamp

func (m *AuditLogMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (AuditLogMutation) Tx

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

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

func (*AuditLogMutation) Type

func (m *AuditLogMutation) Type() string

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

func (*AuditLogMutation) UpdatedAt

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

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

func (*AuditLogMutation) UserAgent

func (m *AuditLogMutation) UserAgent() (r string, exists bool)

UserAgent returns the value of the "user_agent" field in the mutation.

func (*AuditLogMutation) UserAgentCleared

func (m *AuditLogMutation) UserAgentCleared() bool

UserAgentCleared returns if the "user_agent" field was cleared in this mutation.

func (*AuditLogMutation) UserCleared

func (m *AuditLogMutation) UserCleared() bool

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

func (*AuditLogMutation) UserIDs

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

UserIDs returns the "user" edge IDs in the mutation.

func (*AuditLogMutation) Where

func (m *AuditLogMutation) Where(ps ...predicate.AuditLog)

Where appends a list predicates to the AuditLogMutation builder.

func (*AuditLogMutation) WhereP

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

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

type AuditLogQuery

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

AuditLogQuery is the builder for querying AuditLog entities.

func (*AuditLogQuery) Aggregate

func (alq *AuditLogQuery) Aggregate(fns ...AggregateFunc) *AuditLogSelect

Aggregate returns a AuditLogSelect configured with the given aggregations.

func (*AuditLogQuery) All

func (alq *AuditLogQuery) All(ctx context.Context) ([]*AuditLog, error)

All executes the query and returns a list of AuditLogs.

func (*AuditLogQuery) AllX

func (alq *AuditLogQuery) AllX(ctx context.Context) []*AuditLog

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

func (*AuditLogQuery) Clone

func (alq *AuditLogQuery) Clone() *AuditLogQuery

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

func (*AuditLogQuery) Count

func (alq *AuditLogQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AuditLogQuery) CountX

func (alq *AuditLogQuery) CountX(ctx context.Context) int

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

func (*AuditLogQuery) Exist

func (alq *AuditLogQuery) Exist(ctx context.Context) (bool, error)

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

func (*AuditLogQuery) ExistX

func (alq *AuditLogQuery) ExistX(ctx context.Context) bool

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

func (*AuditLogQuery) First

func (alq *AuditLogQuery) First(ctx context.Context) (*AuditLog, error)

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

func (*AuditLogQuery) FirstID

func (alq *AuditLogQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AuditLogQuery) FirstIDX

func (alq *AuditLogQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*AuditLogQuery) FirstX

func (alq *AuditLogQuery) FirstX(ctx context.Context) *AuditLog

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

func (*AuditLogQuery) GroupBy

func (alq *AuditLogQuery) GroupBy(field string, fields ...string) *AuditLogGroupBy

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

Example:

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

client.AuditLog.Query().
	GroupBy(auditlog.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AuditLogQuery) IDs

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

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

func (*AuditLogQuery) IDsX

func (alq *AuditLogQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AuditLogQuery) Limit

func (alq *AuditLogQuery) Limit(limit int) *AuditLogQuery

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

func (*AuditLogQuery) Offset

func (alq *AuditLogQuery) Offset(offset int) *AuditLogQuery

Offset to start from.

func (*AuditLogQuery) Only

func (alq *AuditLogQuery) Only(ctx context.Context) (*AuditLog, error)

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

func (*AuditLogQuery) OnlyID

func (alq *AuditLogQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*AuditLogQuery) OnlyIDX

func (alq *AuditLogQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AuditLogQuery) OnlyX

func (alq *AuditLogQuery) OnlyX(ctx context.Context) *AuditLog

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

func (*AuditLogQuery) Order

func (alq *AuditLogQuery) Order(o ...auditlog.OrderOption) *AuditLogQuery

Order specifies how the records should be ordered.

func (*AuditLogQuery) QueryTenant

func (alq *AuditLogQuery) QueryTenant() *TenantQuery

QueryTenant chains the current query on the "tenant" edge.

func (*AuditLogQuery) QueryUser

func (alq *AuditLogQuery) QueryUser() *UserQuery

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

func (*AuditLogQuery) Select

func (alq *AuditLogQuery) Select(fields ...string) *AuditLogSelect

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

Example:

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

client.AuditLog.Query().
	Select(auditlog.FieldCreatedAt).
	Scan(ctx, &v)

func (*AuditLogQuery) Unique

func (alq *AuditLogQuery) Unique(unique bool) *AuditLogQuery

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

func (alq *AuditLogQuery) Where(ps ...predicate.AuditLog) *AuditLogQuery

Where adds a new predicate for the AuditLogQuery builder.

func (*AuditLogQuery) WithTenant

func (alq *AuditLogQuery) WithTenant(opts ...func(*TenantQuery)) *AuditLogQuery

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

func (*AuditLogQuery) WithUser

func (alq *AuditLogQuery) WithUser(opts ...func(*UserQuery)) *AuditLogQuery

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

type AuditLogSelect

type AuditLogSelect struct {
	*AuditLogQuery
	// contains filtered or unexported fields
}

AuditLogSelect is the builder for selecting fields of AuditLog entities.

func (*AuditLogSelect) Aggregate

func (als *AuditLogSelect) Aggregate(fns ...AggregateFunc) *AuditLogSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AuditLogSelect) Bool

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

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

func (*AuditLogSelect) BoolX

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

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

func (*AuditLogSelect) Bools

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

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

func (*AuditLogSelect) BoolsX

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

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

func (*AuditLogSelect) Float64

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

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

func (*AuditLogSelect) Float64X

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

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

func (*AuditLogSelect) Float64s

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

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

func (*AuditLogSelect) Float64sX

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

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

func (*AuditLogSelect) Int

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

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

func (*AuditLogSelect) IntX

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

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

func (*AuditLogSelect) Ints

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

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

func (*AuditLogSelect) IntsX

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

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

func (*AuditLogSelect) Scan

func (als *AuditLogSelect) Scan(ctx context.Context, v any) error

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

func (*AuditLogSelect) ScanX

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

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

func (*AuditLogSelect) String

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

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

func (*AuditLogSelect) StringX

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

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

func (*AuditLogSelect) Strings

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

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

func (*AuditLogSelect) StringsX

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

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

type AuditLogUpdate

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

AuditLogUpdate is the builder for updating AuditLog entities.

func (*AuditLogUpdate) AddActorID

func (alu *AuditLogUpdate) AddActorID(i int) *AuditLogUpdate

AddActorID adds i to the "actor_id" field.

func (*AuditLogUpdate) AddResourceID

func (alu *AuditLogUpdate) AddResourceID(i int) *AuditLogUpdate

AddResourceID adds i to the "resource_id" field.

func (*AuditLogUpdate) AddTenant

func (alu *AuditLogUpdate) AddTenant(t ...*Tenant) *AuditLogUpdate

AddTenant adds the "tenant" edges to the Tenant entity.

func (*AuditLogUpdate) AddTenantIDs

func (alu *AuditLogUpdate) AddTenantIDs(ids ...uuid.UUID) *AuditLogUpdate

AddTenantIDs adds the "tenant" edge to the Tenant entity by IDs.

func (*AuditLogUpdate) AddUser

func (alu *AuditLogUpdate) AddUser(u ...*User) *AuditLogUpdate

AddUser adds the "user" edges to the User entity.

func (*AuditLogUpdate) AddUserIDs

func (alu *AuditLogUpdate) AddUserIDs(ids ...uuid.UUID) *AuditLogUpdate

AddUserIDs adds the "user" edge to the User entity by IDs.

func (*AuditLogUpdate) ClearDetails

func (alu *AuditLogUpdate) ClearDetails() *AuditLogUpdate

ClearDetails clears the value of the "details" field.

func (*AuditLogUpdate) ClearIPAddress

func (alu *AuditLogUpdate) ClearIPAddress() *AuditLogUpdate

ClearIPAddress clears the value of the "ip_address" field.

func (*AuditLogUpdate) ClearResourceID

func (alu *AuditLogUpdate) ClearResourceID() *AuditLogUpdate

ClearResourceID clears the value of the "resource_id" field.

func (*AuditLogUpdate) ClearResourceType

func (alu *AuditLogUpdate) ClearResourceType() *AuditLogUpdate

ClearResourceType clears the value of the "resource_type" field.

func (*AuditLogUpdate) ClearTenant

func (alu *AuditLogUpdate) ClearTenant() *AuditLogUpdate

ClearTenant clears all "tenant" edges to the Tenant entity.

func (*AuditLogUpdate) ClearUser

func (alu *AuditLogUpdate) ClearUser() *AuditLogUpdate

ClearUser clears all "user" edges to the User entity.

func (*AuditLogUpdate) ClearUserAgent

func (alu *AuditLogUpdate) ClearUserAgent() *AuditLogUpdate

ClearUserAgent clears the value of the "user_agent" field.

func (*AuditLogUpdate) Exec

func (alu *AuditLogUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuditLogUpdate) ExecX

func (alu *AuditLogUpdate) ExecX(ctx context.Context)

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

func (*AuditLogUpdate) Mutation

func (alu *AuditLogUpdate) Mutation() *AuditLogMutation

Mutation returns the AuditLogMutation object of the builder.

func (*AuditLogUpdate) RemoveTenant

func (alu *AuditLogUpdate) RemoveTenant(t ...*Tenant) *AuditLogUpdate

RemoveTenant removes "tenant" edges to Tenant entities.

func (*AuditLogUpdate) RemoveTenantIDs

func (alu *AuditLogUpdate) RemoveTenantIDs(ids ...uuid.UUID) *AuditLogUpdate

RemoveTenantIDs removes the "tenant" edge to Tenant entities by IDs.

func (*AuditLogUpdate) RemoveUser

func (alu *AuditLogUpdate) RemoveUser(u ...*User) *AuditLogUpdate

RemoveUser removes "user" edges to User entities.

func (*AuditLogUpdate) RemoveUserIDs

func (alu *AuditLogUpdate) RemoveUserIDs(ids ...uuid.UUID) *AuditLogUpdate

RemoveUserIDs removes the "user" edge to User entities by IDs.

func (*AuditLogUpdate) Save

func (alu *AuditLogUpdate) Save(ctx context.Context) (int, error)

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

func (*AuditLogUpdate) SaveX

func (alu *AuditLogUpdate) SaveX(ctx context.Context) int

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

func (*AuditLogUpdate) SetAction

func (alu *AuditLogUpdate) SetAction(s string) *AuditLogUpdate

SetAction sets the "action" field.

func (*AuditLogUpdate) SetActorID

func (alu *AuditLogUpdate) SetActorID(i int) *AuditLogUpdate

SetActorID sets the "actor_id" field.

func (*AuditLogUpdate) SetActorUsername

func (alu *AuditLogUpdate) SetActorUsername(s string) *AuditLogUpdate

SetActorUsername sets the "actor_username" field.

func (*AuditLogUpdate) SetDetails

func (alu *AuditLogUpdate) SetDetails(m map[string]interface{}) *AuditLogUpdate

SetDetails sets the "details" field.

func (*AuditLogUpdate) SetIPAddress

func (alu *AuditLogUpdate) SetIPAddress(s string) *AuditLogUpdate

SetIPAddress sets the "ip_address" field.

func (*AuditLogUpdate) SetNillableAction

func (alu *AuditLogUpdate) SetNillableAction(s *string) *AuditLogUpdate

SetNillableAction sets the "action" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableActorID

func (alu *AuditLogUpdate) SetNillableActorID(i *int) *AuditLogUpdate

SetNillableActorID sets the "actor_id" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableActorUsername

func (alu *AuditLogUpdate) SetNillableActorUsername(s *string) *AuditLogUpdate

SetNillableActorUsername sets the "actor_username" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableIPAddress

func (alu *AuditLogUpdate) SetNillableIPAddress(s *string) *AuditLogUpdate

SetNillableIPAddress sets the "ip_address" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableResourceID

func (alu *AuditLogUpdate) SetNillableResourceID(i *int) *AuditLogUpdate

SetNillableResourceID sets the "resource_id" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableResourceType

func (alu *AuditLogUpdate) SetNillableResourceType(at *auditlog.ResourceType) *AuditLogUpdate

SetNillableResourceType sets the "resource_type" field if the given value is not nil.

func (*AuditLogUpdate) SetNillableUserAgent

func (alu *AuditLogUpdate) SetNillableUserAgent(s *string) *AuditLogUpdate

SetNillableUserAgent sets the "user_agent" field if the given value is not nil.

func (*AuditLogUpdate) SetResourceID

func (alu *AuditLogUpdate) SetResourceID(i int) *AuditLogUpdate

SetResourceID sets the "resource_id" field.

func (*AuditLogUpdate) SetResourceType

func (alu *AuditLogUpdate) SetResourceType(at auditlog.ResourceType) *AuditLogUpdate

SetResourceType sets the "resource_type" field.

func (*AuditLogUpdate) SetUpdatedAt

func (alu *AuditLogUpdate) SetUpdatedAt(t time.Time) *AuditLogUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AuditLogUpdate) SetUserAgent

func (alu *AuditLogUpdate) SetUserAgent(s string) *AuditLogUpdate

SetUserAgent sets the "user_agent" field.

func (*AuditLogUpdate) Where

func (alu *AuditLogUpdate) Where(ps ...predicate.AuditLog) *AuditLogUpdate

Where appends a list predicates to the AuditLogUpdate builder.

type AuditLogUpdateOne

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

AuditLogUpdateOne is the builder for updating a single AuditLog entity.

func (*AuditLogUpdateOne) AddActorID

func (aluo *AuditLogUpdateOne) AddActorID(i int) *AuditLogUpdateOne

AddActorID adds i to the "actor_id" field.

func (*AuditLogUpdateOne) AddResourceID

func (aluo *AuditLogUpdateOne) AddResourceID(i int) *AuditLogUpdateOne

AddResourceID adds i to the "resource_id" field.

func (*AuditLogUpdateOne) AddTenant

func (aluo *AuditLogUpdateOne) AddTenant(t ...*Tenant) *AuditLogUpdateOne

AddTenant adds the "tenant" edges to the Tenant entity.

func (*AuditLogUpdateOne) AddTenantIDs

func (aluo *AuditLogUpdateOne) AddTenantIDs(ids ...uuid.UUID) *AuditLogUpdateOne

AddTenantIDs adds the "tenant" edge to the Tenant entity by IDs.

func (*AuditLogUpdateOne) AddUser

func (aluo *AuditLogUpdateOne) AddUser(u ...*User) *AuditLogUpdateOne

AddUser adds the "user" edges to the User entity.

func (*AuditLogUpdateOne) AddUserIDs

func (aluo *AuditLogUpdateOne) AddUserIDs(ids ...uuid.UUID) *AuditLogUpdateOne

AddUserIDs adds the "user" edge to the User entity by IDs.

func (*AuditLogUpdateOne) ClearDetails

func (aluo *AuditLogUpdateOne) ClearDetails() *AuditLogUpdateOne

ClearDetails clears the value of the "details" field.

func (*AuditLogUpdateOne) ClearIPAddress

func (aluo *AuditLogUpdateOne) ClearIPAddress() *AuditLogUpdateOne

ClearIPAddress clears the value of the "ip_address" field.

func (*AuditLogUpdateOne) ClearResourceID

func (aluo *AuditLogUpdateOne) ClearResourceID() *AuditLogUpdateOne

ClearResourceID clears the value of the "resource_id" field.

func (*AuditLogUpdateOne) ClearResourceType

func (aluo *AuditLogUpdateOne) ClearResourceType() *AuditLogUpdateOne

ClearResourceType clears the value of the "resource_type" field.

func (*AuditLogUpdateOne) ClearTenant

func (aluo *AuditLogUpdateOne) ClearTenant() *AuditLogUpdateOne

ClearTenant clears all "tenant" edges to the Tenant entity.

func (*AuditLogUpdateOne) ClearUser

func (aluo *AuditLogUpdateOne) ClearUser() *AuditLogUpdateOne

ClearUser clears all "user" edges to the User entity.

func (*AuditLogUpdateOne) ClearUserAgent

func (aluo *AuditLogUpdateOne) ClearUserAgent() *AuditLogUpdateOne

ClearUserAgent clears the value of the "user_agent" field.

func (*AuditLogUpdateOne) Exec

func (aluo *AuditLogUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AuditLogUpdateOne) ExecX

func (aluo *AuditLogUpdateOne) ExecX(ctx context.Context)

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

func (*AuditLogUpdateOne) Mutation

func (aluo *AuditLogUpdateOne) Mutation() *AuditLogMutation

Mutation returns the AuditLogMutation object of the builder.

func (*AuditLogUpdateOne) RemoveTenant

func (aluo *AuditLogUpdateOne) RemoveTenant(t ...*Tenant) *AuditLogUpdateOne

RemoveTenant removes "tenant" edges to Tenant entities.

func (*AuditLogUpdateOne) RemoveTenantIDs

func (aluo *AuditLogUpdateOne) RemoveTenantIDs(ids ...uuid.UUID) *AuditLogUpdateOne

RemoveTenantIDs removes the "tenant" edge to Tenant entities by IDs.

func (*AuditLogUpdateOne) RemoveUser

func (aluo *AuditLogUpdateOne) RemoveUser(u ...*User) *AuditLogUpdateOne

RemoveUser removes "user" edges to User entities.

func (*AuditLogUpdateOne) RemoveUserIDs

func (aluo *AuditLogUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *AuditLogUpdateOne

RemoveUserIDs removes the "user" edge to User entities by IDs.

func (*AuditLogUpdateOne) Save

func (aluo *AuditLogUpdateOne) Save(ctx context.Context) (*AuditLog, error)

Save executes the query and returns the updated AuditLog entity.

func (*AuditLogUpdateOne) SaveX

func (aluo *AuditLogUpdateOne) SaveX(ctx context.Context) *AuditLog

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

func (*AuditLogUpdateOne) Select

func (aluo *AuditLogUpdateOne) Select(field string, fields ...string) *AuditLogUpdateOne

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

func (*AuditLogUpdateOne) SetAction

func (aluo *AuditLogUpdateOne) SetAction(s string) *AuditLogUpdateOne

SetAction sets the "action" field.

func (*AuditLogUpdateOne) SetActorID

func (aluo *AuditLogUpdateOne) SetActorID(i int) *AuditLogUpdateOne

SetActorID sets the "actor_id" field.

func (*AuditLogUpdateOne) SetActorUsername

func (aluo *AuditLogUpdateOne) SetActorUsername(s string) *AuditLogUpdateOne

SetActorUsername sets the "actor_username" field.

func (*AuditLogUpdateOne) SetDetails

func (aluo *AuditLogUpdateOne) SetDetails(m map[string]interface{}) *AuditLogUpdateOne

SetDetails sets the "details" field.

func (*AuditLogUpdateOne) SetIPAddress

func (aluo *AuditLogUpdateOne) SetIPAddress(s string) *AuditLogUpdateOne

SetIPAddress sets the "ip_address" field.

func (*AuditLogUpdateOne) SetNillableAction

func (aluo *AuditLogUpdateOne) SetNillableAction(s *string) *AuditLogUpdateOne

SetNillableAction sets the "action" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableActorID

func (aluo *AuditLogUpdateOne) SetNillableActorID(i *int) *AuditLogUpdateOne

SetNillableActorID sets the "actor_id" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableActorUsername

func (aluo *AuditLogUpdateOne) SetNillableActorUsername(s *string) *AuditLogUpdateOne

SetNillableActorUsername sets the "actor_username" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableIPAddress

func (aluo *AuditLogUpdateOne) SetNillableIPAddress(s *string) *AuditLogUpdateOne

SetNillableIPAddress sets the "ip_address" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableResourceID

func (aluo *AuditLogUpdateOne) SetNillableResourceID(i *int) *AuditLogUpdateOne

SetNillableResourceID sets the "resource_id" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableResourceType

func (aluo *AuditLogUpdateOne) SetNillableResourceType(at *auditlog.ResourceType) *AuditLogUpdateOne

SetNillableResourceType sets the "resource_type" field if the given value is not nil.

func (*AuditLogUpdateOne) SetNillableUserAgent

func (aluo *AuditLogUpdateOne) SetNillableUserAgent(s *string) *AuditLogUpdateOne

SetNillableUserAgent sets the "user_agent" field if the given value is not nil.

func (*AuditLogUpdateOne) SetResourceID

func (aluo *AuditLogUpdateOne) SetResourceID(i int) *AuditLogUpdateOne

SetResourceID sets the "resource_id" field.

func (*AuditLogUpdateOne) SetResourceType

func (aluo *AuditLogUpdateOne) SetResourceType(at auditlog.ResourceType) *AuditLogUpdateOne

SetResourceType sets the "resource_type" field.

func (*AuditLogUpdateOne) SetUpdatedAt

func (aluo *AuditLogUpdateOne) SetUpdatedAt(t time.Time) *AuditLogUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AuditLogUpdateOne) SetUserAgent

func (aluo *AuditLogUpdateOne) SetUserAgent(s string) *AuditLogUpdateOne

SetUserAgent sets the "user_agent" field.

func (*AuditLogUpdateOne) Where

Where appends a list predicates to the AuditLogUpdate builder.

type AuditLogs

type AuditLogs []*AuditLog

AuditLogs is a parsable slice of AuditLog.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AccessPolicy is the client for interacting with the AccessPolicy builders.
	AccessPolicy *AccessPolicyClient
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// AuditLog is the client for interacting with the AuditLog builders.
	AuditLog *AuditLogClient
	// Platform is the client for interacting with the Platform builders.
	Platform *PlatformClient
	// Resource is the client for interacting with the Resource builders.
	Resource *ResourceClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	AccessPolicy.
	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 Platform

type Platform struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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"`
	// Region holds the value of the "region" field.
	Region string `json:"region,omitempty"`
	// Version holds the value of the "version" field.
	Version string `json:"version,omitempty"`
	// Status holds the value of the "status" field.
	Status platform.Status `json:"status,omitempty"`
	// Config holds the value of the "config" field.
	Config map[string]interface{} `json:"config,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PlatformQuery when eager-loading is set.
	Edges PlatformEdges `json:"edges"`
	// contains filtered or unexported fields
}

Platform is the model entity for the Platform schema.

func (*Platform) QueryTenants

func (pl *Platform) QueryTenants() *TenantQuery

QueryTenants queries the "tenants" edge of the Platform entity.

func (*Platform) String

func (pl *Platform) String() string

String implements the fmt.Stringer.

func (*Platform) Unwrap

func (pl *Platform) Unwrap() *Platform

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

func (pl *Platform) Update() *PlatformUpdateOne

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

func (*Platform) Value

func (pl *Platform) Value(name string) (ent.Value, error)

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

type PlatformClient

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

PlatformClient is a client for the Platform schema.

func NewPlatformClient

func NewPlatformClient(c config) *PlatformClient

NewPlatformClient returns a client for the Platform from the given config.

func (*PlatformClient) Create

func (c *PlatformClient) Create() *PlatformCreate

Create returns a builder for creating a Platform entity.

func (*PlatformClient) CreateBulk

func (c *PlatformClient) CreateBulk(builders ...*PlatformCreate) *PlatformCreateBulk

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

func (*PlatformClient) Delete

func (c *PlatformClient) Delete() *PlatformDelete

Delete returns a delete builder for Platform.

func (*PlatformClient) DeleteOne

func (c *PlatformClient) DeleteOne(pl *Platform) *PlatformDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PlatformClient) DeleteOneID

func (c *PlatformClient) DeleteOneID(id uuid.UUID) *PlatformDeleteOne

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

func (*PlatformClient) Get

func (c *PlatformClient) Get(ctx context.Context, id uuid.UUID) (*Platform, error)

Get returns a Platform entity by its id.

func (*PlatformClient) GetX

func (c *PlatformClient) GetX(ctx context.Context, id uuid.UUID) *Platform

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

func (*PlatformClient) Hooks

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

Hooks returns the client hooks.

func (*PlatformClient) Intercept

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

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

func (*PlatformClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PlatformClient) MapCreateBulk

func (c *PlatformClient) MapCreateBulk(slice any, setFunc func(*PlatformCreate, int)) *PlatformCreateBulk

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

func (c *PlatformClient) Query() *PlatformQuery

Query returns a query builder for Platform.

func (*PlatformClient) QueryTenants

func (c *PlatformClient) QueryTenants(pl *Platform) *TenantQuery

QueryTenants queries the tenants edge of a Platform.

func (*PlatformClient) Update

func (c *PlatformClient) Update() *PlatformUpdate

Update returns an update builder for Platform.

func (*PlatformClient) UpdateOne

func (c *PlatformClient) UpdateOne(pl *Platform) *PlatformUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PlatformClient) UpdateOneID

func (c *PlatformClient) UpdateOneID(id uuid.UUID) *PlatformUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PlatformClient) Use

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

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

type PlatformCreate

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

PlatformCreate is the builder for creating a Platform entity.

func (*PlatformCreate) AddTenantIDs

func (pc *PlatformCreate) AddTenantIDs(ids ...uuid.UUID) *PlatformCreate

AddTenantIDs adds the "tenants" edge to the Tenant entity by IDs.

func (*PlatformCreate) AddTenants

func (pc *PlatformCreate) AddTenants(t ...*Tenant) *PlatformCreate

AddTenants adds the "tenants" edges to the Tenant entity.

func (*PlatformCreate) Exec

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

Exec executes the query.

func (*PlatformCreate) ExecX

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

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

func (*PlatformCreate) Mutation

func (pc *PlatformCreate) Mutation() *PlatformMutation

Mutation returns the PlatformMutation object of the builder.

func (*PlatformCreate) Save

func (pc *PlatformCreate) Save(ctx context.Context) (*Platform, error)

Save creates the Platform in the database.

func (*PlatformCreate) SaveX

func (pc *PlatformCreate) SaveX(ctx context.Context) *Platform

SaveX calls Save and panics if Save returns an error.

func (*PlatformCreate) SetConfig

func (pc *PlatformCreate) SetConfig(m map[string]interface{}) *PlatformCreate

SetConfig sets the "config" field.

func (*PlatformCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PlatformCreate) SetDescription

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

SetDescription sets the "description" field.

func (*PlatformCreate) SetID

func (pc *PlatformCreate) SetID(u uuid.UUID) *PlatformCreate

SetID sets the "id" field.

func (*PlatformCreate) SetName

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

SetName sets the "name" field.

func (*PlatformCreate) SetNillableCreatedAt

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

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

func (*PlatformCreate) SetNillableDescription

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

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

func (*PlatformCreate) SetNillableID

func (pc *PlatformCreate) SetNillableID(u *uuid.UUID) *PlatformCreate

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

func (*PlatformCreate) SetNillableRegion

func (pc *PlatformCreate) SetNillableRegion(s *string) *PlatformCreate

SetNillableRegion sets the "region" field if the given value is not nil.

func (*PlatformCreate) SetNillableStatus

func (pc *PlatformCreate) SetNillableStatus(pl *platform.Status) *PlatformCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*PlatformCreate) SetNillableUpdatedAt

func (pc *PlatformCreate) SetNillableUpdatedAt(t *time.Time) *PlatformCreate

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

func (*PlatformCreate) SetNillableVersion

func (pc *PlatformCreate) SetNillableVersion(s *string) *PlatformCreate

SetNillableVersion sets the "version" field if the given value is not nil.

func (*PlatformCreate) SetRegion

func (pc *PlatformCreate) SetRegion(s string) *PlatformCreate

SetRegion sets the "region" field.

func (*PlatformCreate) SetStatus

func (pc *PlatformCreate) SetStatus(pl platform.Status) *PlatformCreate

SetStatus sets the "status" field.

func (*PlatformCreate) SetUpdatedAt

func (pc *PlatformCreate) SetUpdatedAt(t time.Time) *PlatformCreate

SetUpdatedAt sets the "updated_at" field.

func (*PlatformCreate) SetVersion

func (pc *PlatformCreate) SetVersion(s string) *PlatformCreate

SetVersion sets the "version" field.

type PlatformCreateBulk

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

PlatformCreateBulk is the builder for creating many Platform entities in bulk.

func (*PlatformCreateBulk) Exec

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

Exec executes the query.

func (*PlatformCreateBulk) ExecX

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

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

func (*PlatformCreateBulk) Save

func (pcb *PlatformCreateBulk) Save(ctx context.Context) ([]*Platform, error)

Save creates the Platform entities in the database.

func (*PlatformCreateBulk) SaveX

func (pcb *PlatformCreateBulk) SaveX(ctx context.Context) []*Platform

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

type PlatformDelete

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

PlatformDelete is the builder for deleting a Platform entity.

func (*PlatformDelete) Exec

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

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

func (*PlatformDelete) ExecX

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

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

func (*PlatformDelete) Where

func (pd *PlatformDelete) Where(ps ...predicate.Platform) *PlatformDelete

Where appends a list predicates to the PlatformDelete builder.

type PlatformDeleteOne

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

PlatformDeleteOne is the builder for deleting a single Platform entity.

func (*PlatformDeleteOne) Exec

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

Exec executes the deletion query.

func (*PlatformDeleteOne) ExecX

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

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

func (*PlatformDeleteOne) Where

Where appends a list predicates to the PlatformDelete builder.

type PlatformEdges

type PlatformEdges struct {
	// 平台下的所有租户
	Tenants []*Tenant `json:"tenants,omitempty"`
	// contains filtered or unexported fields
}

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

func (PlatformEdges) TenantsOrErr

func (e PlatformEdges) TenantsOrErr() ([]*Tenant, error)

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

type PlatformGroupBy

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

PlatformGroupBy is the group-by builder for Platform entities.

func (*PlatformGroupBy) Aggregate

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

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

func (*PlatformGroupBy) Bool

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

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

func (*PlatformGroupBy) BoolX

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

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

func (*PlatformGroupBy) Bools

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

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

func (*PlatformGroupBy) BoolsX

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

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

func (*PlatformGroupBy) Float64

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

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

func (*PlatformGroupBy) Float64X

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

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

func (*PlatformGroupBy) Float64s

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

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

func (*PlatformGroupBy) Float64sX

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

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

func (*PlatformGroupBy) Int

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

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

func (*PlatformGroupBy) IntX

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

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

func (*PlatformGroupBy) Ints

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

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

func (*PlatformGroupBy) IntsX

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

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

func (*PlatformGroupBy) Scan

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

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

func (*PlatformGroupBy) ScanX

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

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

func (*PlatformGroupBy) String

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

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

func (*PlatformGroupBy) StringX

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

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

func (*PlatformGroupBy) Strings

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

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

func (*PlatformGroupBy) StringsX

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

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

type PlatformMutation

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

PlatformMutation represents an operation that mutates the Platform nodes in the graph.

func (*PlatformMutation) AddField

func (m *PlatformMutation) 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 (*PlatformMutation) AddTenantIDs

func (m *PlatformMutation) AddTenantIDs(ids ...uuid.UUID)

AddTenantIDs adds the "tenants" edge to the Tenant entity by ids.

func (*PlatformMutation) AddedEdges

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

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

func (*PlatformMutation) AddedField

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

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

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

func (*PlatformMutation) AddedIDs

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

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

func (*PlatformMutation) ClearConfig

func (m *PlatformMutation) ClearConfig()

ClearConfig clears the value of the "config" field.

func (*PlatformMutation) ClearDescription

func (m *PlatformMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PlatformMutation) ClearEdge

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

func (m *PlatformMutation) 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 (*PlatformMutation) ClearRegion

func (m *PlatformMutation) ClearRegion()

ClearRegion clears the value of the "region" field.

func (*PlatformMutation) ClearStatus

func (m *PlatformMutation) ClearStatus()

ClearStatus clears the value of the "status" field.

func (*PlatformMutation) ClearTenants

func (m *PlatformMutation) ClearTenants()

ClearTenants clears the "tenants" edge to the Tenant entity.

func (*PlatformMutation) ClearVersion

func (m *PlatformMutation) ClearVersion()

ClearVersion clears the value of the "version" field.

func (*PlatformMutation) ClearedEdges

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

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

func (*PlatformMutation) ClearedFields

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

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

func (PlatformMutation) Client

func (m PlatformMutation) 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 (*PlatformMutation) Config

func (m *PlatformMutation) Config() (r map[string]interface{}, exists bool)

Config returns the value of the "config" field in the mutation.

func (*PlatformMutation) ConfigCleared

func (m *PlatformMutation) ConfigCleared() bool

ConfigCleared returns if the "config" field was cleared in this mutation.

func (*PlatformMutation) CreatedAt

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

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

func (*PlatformMutation) Description

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

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

func (*PlatformMutation) DescriptionCleared

func (m *PlatformMutation) DescriptionCleared() bool

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

func (*PlatformMutation) EdgeCleared

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

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

func (*PlatformMutation) Field

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

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

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

func (*PlatformMutation) Fields

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

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

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

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

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

func (*PlatformMutation) OldConfig

func (m *PlatformMutation) OldConfig(ctx context.Context) (v map[string]interface{}, err error)

OldConfig returns the old "config" field's value of the Platform entity. If the Platform 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 (*PlatformMutation) OldCreatedAt

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

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

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

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

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

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

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

func (m *PlatformMutation) OldRegion(ctx context.Context) (v string, err error)

OldRegion returns the old "region" field's value of the Platform entity. If the Platform 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 (*PlatformMutation) OldStatus

func (m *PlatformMutation) OldStatus(ctx context.Context) (v platform.Status, err error)

OldStatus returns the old "status" field's value of the Platform entity. If the Platform 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 (*PlatformMutation) OldUpdatedAt

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

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

func (m *PlatformMutation) OldVersion(ctx context.Context) (v string, err error)

OldVersion returns the old "version" field's value of the Platform entity. If the Platform 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 (*PlatformMutation) Op

func (m *PlatformMutation) Op() Op

Op returns the operation name.

func (*PlatformMutation) Region

func (m *PlatformMutation) Region() (r string, exists bool)

Region returns the value of the "region" field in the mutation.

func (*PlatformMutation) RegionCleared

func (m *PlatformMutation) RegionCleared() bool

RegionCleared returns if the "region" field was cleared in this mutation.

func (*PlatformMutation) RemoveTenantIDs

func (m *PlatformMutation) RemoveTenantIDs(ids ...uuid.UUID)

RemoveTenantIDs removes the "tenants" edge to the Tenant entity by IDs.

func (*PlatformMutation) RemovedEdges

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

RemovedEdges returns all edge names that were removed in this mutation.

func (*PlatformMutation) RemovedIDs

func (m *PlatformMutation) 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 (*PlatformMutation) RemovedTenantsIDs

func (m *PlatformMutation) RemovedTenantsIDs() (ids []uuid.UUID)

RemovedTenants returns the removed IDs of the "tenants" edge to the Tenant entity.

func (*PlatformMutation) ResetConfig

func (m *PlatformMutation) ResetConfig()

ResetConfig resets all changes to the "config" field.

func (*PlatformMutation) ResetCreatedAt

func (m *PlatformMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PlatformMutation) ResetDescription

func (m *PlatformMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PlatformMutation) ResetEdge

func (m *PlatformMutation) 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 (*PlatformMutation) ResetField

func (m *PlatformMutation) 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 (*PlatformMutation) ResetName

func (m *PlatformMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PlatformMutation) ResetRegion

func (m *PlatformMutation) ResetRegion()

ResetRegion resets all changes to the "region" field.

func (*PlatformMutation) ResetStatus

func (m *PlatformMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*PlatformMutation) ResetTenants

func (m *PlatformMutation) ResetTenants()

ResetTenants resets all changes to the "tenants" edge.

func (*PlatformMutation) ResetUpdatedAt

func (m *PlatformMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PlatformMutation) ResetVersion

func (m *PlatformMutation) ResetVersion()

ResetVersion resets all changes to the "version" field.

func (*PlatformMutation) SetConfig

func (m *PlatformMutation) SetConfig(value map[string]interface{})

SetConfig sets the "config" field.

func (*PlatformMutation) SetCreatedAt

func (m *PlatformMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*PlatformMutation) SetDescription

func (m *PlatformMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PlatformMutation) SetField

func (m *PlatformMutation) 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 (*PlatformMutation) SetID

func (m *PlatformMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Platform entities.

func (*PlatformMutation) SetName

func (m *PlatformMutation) SetName(s string)

SetName sets the "name" field.

func (*PlatformMutation) SetOp

func (m *PlatformMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PlatformMutation) SetRegion

func (m *PlatformMutation) SetRegion(s string)

SetRegion sets the "region" field.

func (*PlatformMutation) SetStatus

func (m *PlatformMutation) SetStatus(pl platform.Status)

SetStatus sets the "status" field.

func (*PlatformMutation) SetUpdatedAt

func (m *PlatformMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*PlatformMutation) SetVersion

func (m *PlatformMutation) SetVersion(s string)

SetVersion sets the "version" field.

func (*PlatformMutation) Status

func (m *PlatformMutation) Status() (r platform.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*PlatformMutation) StatusCleared

func (m *PlatformMutation) StatusCleared() bool

StatusCleared returns if the "status" field was cleared in this mutation.

func (*PlatformMutation) TenantsCleared

func (m *PlatformMutation) TenantsCleared() bool

TenantsCleared reports if the "tenants" edge to the Tenant entity was cleared.

func (*PlatformMutation) TenantsIDs

func (m *PlatformMutation) TenantsIDs() (ids []uuid.UUID)

TenantsIDs returns the "tenants" edge IDs in the mutation.

func (PlatformMutation) Tx

func (m PlatformMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*PlatformMutation) Type

func (m *PlatformMutation) Type() string

Type returns the node type of this mutation (Platform).

func (*PlatformMutation) UpdatedAt

func (m *PlatformMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*PlatformMutation) Version

func (m *PlatformMutation) Version() (r string, exists bool)

Version returns the value of the "version" field in the mutation.

func (*PlatformMutation) VersionCleared

func (m *PlatformMutation) VersionCleared() bool

VersionCleared returns if the "version" field was cleared in this mutation.

func (*PlatformMutation) Where

func (m *PlatformMutation) Where(ps ...predicate.Platform)

Where appends a list predicates to the PlatformMutation builder.

func (*PlatformMutation) WhereP

func (m *PlatformMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the PlatformMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type PlatformQuery

type PlatformQuery struct {
	// contains filtered or unexported fields
}

PlatformQuery is the builder for querying Platform entities.

func (*PlatformQuery) Aggregate

func (pq *PlatformQuery) Aggregate(fns ...AggregateFunc) *PlatformSelect

Aggregate returns a PlatformSelect configured with the given aggregations.

func (*PlatformQuery) All

func (pq *PlatformQuery) All(ctx context.Context) ([]*Platform, error)

All executes the query and returns a list of Platforms.

func (*PlatformQuery) AllX

func (pq *PlatformQuery) AllX(ctx context.Context) []*Platform

AllX is like All, but panics if an error occurs.

func (*PlatformQuery) Clone

func (pq *PlatformQuery) Clone() *PlatformQuery

Clone returns a duplicate of the PlatformQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PlatformQuery) Count

func (pq *PlatformQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PlatformQuery) CountX

func (pq *PlatformQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PlatformQuery) Exist

func (pq *PlatformQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PlatformQuery) ExistX

func (pq *PlatformQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PlatformQuery) First

func (pq *PlatformQuery) First(ctx context.Context) (*Platform, error)

First returns the first Platform entity from the query. Returns a *NotFoundError when no Platform was found.

func (*PlatformQuery) FirstID

func (pq *PlatformQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Platform ID from the query. Returns a *NotFoundError when no Platform ID was found.

func (*PlatformQuery) FirstIDX

func (pq *PlatformQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*PlatformQuery) FirstX

func (pq *PlatformQuery) FirstX(ctx context.Context) *Platform

FirstX is like First, but panics if an error occurs.

func (*PlatformQuery) GroupBy

func (pq *PlatformQuery) GroupBy(field string, fields ...string) *PlatformGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Platform.Query().
	GroupBy(platform.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PlatformQuery) IDs

func (pq *PlatformQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of Platform IDs.

func (*PlatformQuery) IDsX

func (pq *PlatformQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*PlatformQuery) Limit

func (pq *PlatformQuery) Limit(limit int) *PlatformQuery

Limit the number of records to be returned by this query.

func (*PlatformQuery) Offset

func (pq *PlatformQuery) Offset(offset int) *PlatformQuery

Offset to start from.

func (*PlatformQuery) Only

func (pq *PlatformQuery) Only(ctx context.Context) (*Platform, error)

Only returns a single Platform entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Platform entity is found. Returns a *NotFoundError when no Platform entities are found.

func (*PlatformQuery) OnlyID

func (pq *PlatformQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Platform ID in the query. Returns a *NotSingularError when more than one Platform ID is found. Returns a *NotFoundError when no entities are found.

func (*PlatformQuery) OnlyIDX

func (pq *PlatformQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PlatformQuery) OnlyX

func (pq *PlatformQuery) OnlyX(ctx context.Context) *Platform

OnlyX is like Only, but panics if an error occurs.

func (*PlatformQuery) Order

Order specifies how the records should be ordered.

func (*PlatformQuery) QueryTenants

func (pq *PlatformQuery) QueryTenants() *TenantQuery

QueryTenants chains the current query on the "tenants" edge.

func (*PlatformQuery) Select

func (pq *PlatformQuery) Select(fields ...string) *PlatformSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Platform.Query().
	Select(platform.FieldCreatedAt).
	Scan(ctx, &v)

func (*PlatformQuery) Unique

func (pq *PlatformQuery) Unique(unique bool) *PlatformQuery

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 (*PlatformQuery) Where

func (pq *PlatformQuery) Where(ps ...predicate.Platform) *PlatformQuery

Where adds a new predicate for the PlatformQuery builder.

func (*PlatformQuery) WithTenants

func (pq *PlatformQuery) WithTenants(opts ...func(*TenantQuery)) *PlatformQuery

WithTenants tells the query-builder to eager-load the nodes that are connected to the "tenants" edge. The optional arguments are used to configure the query builder of the edge.

type PlatformSelect

type PlatformSelect struct {
	*PlatformQuery
	// contains filtered or unexported fields
}

PlatformSelect is the builder for selecting fields of Platform entities.

func (*PlatformSelect) Aggregate

func (ps *PlatformSelect) Aggregate(fns ...AggregateFunc) *PlatformSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PlatformSelect) Bool

func (s *PlatformSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) BoolX

func (s *PlatformSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PlatformSelect) Bools

func (s *PlatformSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) BoolsX

func (s *PlatformSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PlatformSelect) Float64

func (s *PlatformSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) Float64X

func (s *PlatformSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PlatformSelect) Float64s

func (s *PlatformSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) Float64sX

func (s *PlatformSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PlatformSelect) Int

func (s *PlatformSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) IntX

func (s *PlatformSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PlatformSelect) Ints

func (s *PlatformSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) IntsX

func (s *PlatformSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PlatformSelect) Scan

func (ps *PlatformSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*PlatformSelect) ScanX

func (s *PlatformSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*PlatformSelect) String

func (s *PlatformSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) StringX

func (s *PlatformSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PlatformSelect) Strings

func (s *PlatformSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PlatformSelect) StringsX

func (s *PlatformSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PlatformUpdate

type PlatformUpdate struct {
	// contains filtered or unexported fields
}

PlatformUpdate is the builder for updating Platform entities.

func (*PlatformUpdate) AddTenantIDs

func (pu *PlatformUpdate) AddTenantIDs(ids ...uuid.UUID) *PlatformUpdate

AddTenantIDs adds the "tenants" edge to the Tenant entity by IDs.

func (*PlatformUpdate) AddTenants

func (pu *PlatformUpdate) AddTenants(t ...*Tenant) *PlatformUpdate

AddTenants adds the "tenants" edges to the Tenant entity.

func (*PlatformUpdate) ClearConfig

func (pu *PlatformUpdate) ClearConfig() *PlatformUpdate

ClearConfig clears the value of the "config" field.

func (*PlatformUpdate) ClearDescription

func (pu *PlatformUpdate) ClearDescription() *PlatformUpdate

ClearDescription clears the value of the "description" field.

func (*PlatformUpdate) ClearRegion

func (pu *PlatformUpdate) ClearRegion() *PlatformUpdate

ClearRegion clears the value of the "region" field.

func (*PlatformUpdate) ClearStatus

func (pu *PlatformUpdate) ClearStatus() *PlatformUpdate

ClearStatus clears the value of the "status" field.

func (*PlatformUpdate) ClearTenants

func (pu *PlatformUpdate) ClearTenants() *PlatformUpdate

ClearTenants clears all "tenants" edges to the Tenant entity.

func (*PlatformUpdate) ClearVersion

func (pu *PlatformUpdate) ClearVersion() *PlatformUpdate

ClearVersion clears the value of the "version" field.

func (*PlatformUpdate) Exec

func (pu *PlatformUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlatformUpdate) ExecX

func (pu *PlatformUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlatformUpdate) Mutation

func (pu *PlatformUpdate) Mutation() *PlatformMutation

Mutation returns the PlatformMutation object of the builder.

func (*PlatformUpdate) RemoveTenantIDs

func (pu *PlatformUpdate) RemoveTenantIDs(ids ...uuid.UUID) *PlatformUpdate

RemoveTenantIDs removes the "tenants" edge to Tenant entities by IDs.

func (*PlatformUpdate) RemoveTenants

func (pu *PlatformUpdate) RemoveTenants(t ...*Tenant) *PlatformUpdate

RemoveTenants removes "tenants" edges to Tenant entities.

func (*PlatformUpdate) Save

func (pu *PlatformUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*PlatformUpdate) SaveX

func (pu *PlatformUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*PlatformUpdate) SetConfig

func (pu *PlatformUpdate) SetConfig(m map[string]interface{}) *PlatformUpdate

SetConfig sets the "config" field.

func (*PlatformUpdate) SetDescription

func (pu *PlatformUpdate) SetDescription(s string) *PlatformUpdate

SetDescription sets the "description" field.

func (*PlatformUpdate) SetName

func (pu *PlatformUpdate) SetName(s string) *PlatformUpdate

SetName sets the "name" field.

func (*PlatformUpdate) SetNillableDescription

func (pu *PlatformUpdate) SetNillableDescription(s *string) *PlatformUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlatformUpdate) SetNillableName

func (pu *PlatformUpdate) SetNillableName(s *string) *PlatformUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*PlatformUpdate) SetNillableRegion

func (pu *PlatformUpdate) SetNillableRegion(s *string) *PlatformUpdate

SetNillableRegion sets the "region" field if the given value is not nil.

func (*PlatformUpdate) SetNillableStatus

func (pu *PlatformUpdate) SetNillableStatus(pl *platform.Status) *PlatformUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*PlatformUpdate) SetNillableVersion

func (pu *PlatformUpdate) SetNillableVersion(s *string) *PlatformUpdate

SetNillableVersion sets the "version" field if the given value is not nil.

func (*PlatformUpdate) SetRegion

func (pu *PlatformUpdate) SetRegion(s string) *PlatformUpdate

SetRegion sets the "region" field.

func (*PlatformUpdate) SetStatus

func (pu *PlatformUpdate) SetStatus(pl platform.Status) *PlatformUpdate

SetStatus sets the "status" field.

func (*PlatformUpdate) SetUpdatedAt

func (pu *PlatformUpdate) SetUpdatedAt(t time.Time) *PlatformUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PlatformUpdate) SetVersion

func (pu *PlatformUpdate) SetVersion(s string) *PlatformUpdate

SetVersion sets the "version" field.

func (*PlatformUpdate) Where

func (pu *PlatformUpdate) Where(ps ...predicate.Platform) *PlatformUpdate

Where appends a list predicates to the PlatformUpdate builder.

type PlatformUpdateOne

type PlatformUpdateOne struct {
	// contains filtered or unexported fields
}

PlatformUpdateOne is the builder for updating a single Platform entity.

func (*PlatformUpdateOne) AddTenantIDs

func (puo *PlatformUpdateOne) AddTenantIDs(ids ...uuid.UUID) *PlatformUpdateOne

AddTenantIDs adds the "tenants" edge to the Tenant entity by IDs.

func (*PlatformUpdateOne) AddTenants

func (puo *PlatformUpdateOne) AddTenants(t ...*Tenant) *PlatformUpdateOne

AddTenants adds the "tenants" edges to the Tenant entity.

func (*PlatformUpdateOne) ClearConfig

func (puo *PlatformUpdateOne) ClearConfig() *PlatformUpdateOne

ClearConfig clears the value of the "config" field.

func (*PlatformUpdateOne) ClearDescription

func (puo *PlatformUpdateOne) ClearDescription() *PlatformUpdateOne

ClearDescription clears the value of the "description" field.

func (*PlatformUpdateOne) ClearRegion

func (puo *PlatformUpdateOne) ClearRegion() *PlatformUpdateOne

ClearRegion clears the value of the "region" field.

func (*PlatformUpdateOne) ClearStatus

func (puo *PlatformUpdateOne) ClearStatus() *PlatformUpdateOne

ClearStatus clears the value of the "status" field.

func (*PlatformUpdateOne) ClearTenants

func (puo *PlatformUpdateOne) ClearTenants() *PlatformUpdateOne

ClearTenants clears all "tenants" edges to the Tenant entity.

func (*PlatformUpdateOne) ClearVersion

func (puo *PlatformUpdateOne) ClearVersion() *PlatformUpdateOne

ClearVersion clears the value of the "version" field.

func (*PlatformUpdateOne) Exec

func (puo *PlatformUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PlatformUpdateOne) ExecX

func (puo *PlatformUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PlatformUpdateOne) Mutation

func (puo *PlatformUpdateOne) Mutation() *PlatformMutation

Mutation returns the PlatformMutation object of the builder.

func (*PlatformUpdateOne) RemoveTenantIDs

func (puo *PlatformUpdateOne) RemoveTenantIDs(ids ...uuid.UUID) *PlatformUpdateOne

RemoveTenantIDs removes the "tenants" edge to Tenant entities by IDs.

func (*PlatformUpdateOne) RemoveTenants

func (puo *PlatformUpdateOne) RemoveTenants(t ...*Tenant) *PlatformUpdateOne

RemoveTenants removes "tenants" edges to Tenant entities.

func (*PlatformUpdateOne) Save

func (puo *PlatformUpdateOne) Save(ctx context.Context) (*Platform, error)

Save executes the query and returns the updated Platform entity.

func (*PlatformUpdateOne) SaveX

func (puo *PlatformUpdateOne) SaveX(ctx context.Context) *Platform

SaveX is like Save, but panics if an error occurs.

func (*PlatformUpdateOne) Select

func (puo *PlatformUpdateOne) Select(field string, fields ...string) *PlatformUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*PlatformUpdateOne) SetConfig

func (puo *PlatformUpdateOne) SetConfig(m map[string]interface{}) *PlatformUpdateOne

SetConfig sets the "config" field.

func (*PlatformUpdateOne) SetDescription

func (puo *PlatformUpdateOne) SetDescription(s string) *PlatformUpdateOne

SetDescription sets the "description" field.

func (*PlatformUpdateOne) SetName

func (puo *PlatformUpdateOne) SetName(s string) *PlatformUpdateOne

SetName sets the "name" field.

func (*PlatformUpdateOne) SetNillableDescription

func (puo *PlatformUpdateOne) SetNillableDescription(s *string) *PlatformUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlatformUpdateOne) SetNillableName

func (puo *PlatformUpdateOne) SetNillableName(s *string) *PlatformUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*PlatformUpdateOne) SetNillableRegion

func (puo *PlatformUpdateOne) SetNillableRegion(s *string) *PlatformUpdateOne

SetNillableRegion sets the "region" field if the given value is not nil.

func (*PlatformUpdateOne) SetNillableStatus

func (puo *PlatformUpdateOne) SetNillableStatus(pl *platform.Status) *PlatformUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*PlatformUpdateOne) SetNillableVersion

func (puo *PlatformUpdateOne) SetNillableVersion(s *string) *PlatformUpdateOne

SetNillableVersion sets the "version" field if the given value is not nil.

func (*PlatformUpdateOne) SetRegion

func (puo *PlatformUpdateOne) SetRegion(s string) *PlatformUpdateOne

SetRegion sets the "region" field.

func (*PlatformUpdateOne) SetStatus

func (puo *PlatformUpdateOne) SetStatus(pl platform.Status) *PlatformUpdateOne

SetStatus sets the "status" field.

func (*PlatformUpdateOne) SetUpdatedAt

func (puo *PlatformUpdateOne) SetUpdatedAt(t time.Time) *PlatformUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*PlatformUpdateOne) SetVersion

func (puo *PlatformUpdateOne) SetVersion(s string) *PlatformUpdateOne

SetVersion sets the "version" field.

func (*PlatformUpdateOne) Where

Where appends a list predicates to the PlatformUpdate builder.

type Platforms

type Platforms []*Platform

Platforms is a parsable slice of Platform.

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 Resource

type Resource struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Rrn holds the value of the "rrn" field.
	Rrn string `json:"rrn,omitempty"`
	// Properties holds the value of the "properties" field.
	Properties map[string]interface{} `json:"properties,omitempty"`
	// Tags holds the value of the "tags" field.
	Tags map[string]string `json:"tags,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ResourceQuery when eager-loading is set.
	Edges ResourceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Resource is the model entity for the Resource schema.

func (*Resource) QueryAccount

func (r *Resource) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Resource entity.

func (*Resource) QueryChildren

func (r *Resource) QueryChildren() *ResourceQuery

QueryChildren queries the "children" edge of the Resource entity.

func (*Resource) QueryParent

func (r *Resource) QueryParent() *ResourceQuery

QueryParent queries the "parent" edge of the Resource entity.

func (*Resource) String

func (r *Resource) String() string

String implements the fmt.Stringer.

func (*Resource) Unwrap

func (r *Resource) Unwrap() *Resource

Unwrap unwraps the Resource 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 (*Resource) Update

func (r *Resource) Update() *ResourceUpdateOne

Update returns a builder for updating this Resource. Note that you need to call Resource.Unwrap() before calling this method if this Resource was returned from a transaction, and the transaction was committed or rolled back.

func (*Resource) Value

func (r *Resource) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Resource. This includes values selected through modifiers, order, etc.

type ResourceClient

type ResourceClient struct {
	// contains filtered or unexported fields
}

ResourceClient is a client for the Resource schema.

func NewResourceClient

func NewResourceClient(c config) *ResourceClient

NewResourceClient returns a client for the Resource from the given config.

func (*ResourceClient) Create

func (c *ResourceClient) Create() *ResourceCreate

Create returns a builder for creating a Resource entity.

func (*ResourceClient) CreateBulk

func (c *ResourceClient) CreateBulk(builders ...*ResourceCreate) *ResourceCreateBulk

CreateBulk returns a builder for creating a bulk of Resource entities.

func (*ResourceClient) Delete

func (c *ResourceClient) Delete() *ResourceDelete

Delete returns a delete builder for Resource.

func (*ResourceClient) DeleteOne

func (c *ResourceClient) DeleteOne(r *Resource) *ResourceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ResourceClient) DeleteOneID

func (c *ResourceClient) DeleteOneID(id uuid.UUID) *ResourceDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*ResourceClient) Get

func (c *ResourceClient) Get(ctx context.Context, id uuid.UUID) (*Resource, error)

Get returns a Resource entity by its id.

func (*ResourceClient) GetX

func (c *ResourceClient) GetX(ctx context.Context, id uuid.UUID) *Resource

GetX is like Get, but panics if an error occurs.

func (*ResourceClient) Hooks

func (c *ResourceClient) Hooks() []Hook

Hooks returns the client hooks.

func (*ResourceClient) Intercept

func (c *ResourceClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `resource.Intercept(f(g(h())))`.

func (*ResourceClient) Interceptors

func (c *ResourceClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*ResourceClient) MapCreateBulk

func (c *ResourceClient) MapCreateBulk(slice any, setFunc func(*ResourceCreate, int)) *ResourceCreateBulk

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 (*ResourceClient) Query

func (c *ResourceClient) Query() *ResourceQuery

Query returns a query builder for Resource.

func (*ResourceClient) QueryAccount

func (c *ResourceClient) QueryAccount(r *Resource) *AccountQuery

QueryAccount queries the account edge of a Resource.

func (*ResourceClient) QueryChildren

func (c *ResourceClient) QueryChildren(r *Resource) *ResourceQuery

QueryChildren queries the children edge of a Resource.

func (*ResourceClient) QueryParent

func (c *ResourceClient) QueryParent(r *Resource) *ResourceQuery

QueryParent queries the parent edge of a Resource.

func (*ResourceClient) Update

func (c *ResourceClient) Update() *ResourceUpdate

Update returns an update builder for Resource.

func (*ResourceClient) UpdateOne

func (c *ResourceClient) UpdateOne(r *Resource) *ResourceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ResourceClient) UpdateOneID

func (c *ResourceClient) UpdateOneID(id uuid.UUID) *ResourceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ResourceClient) Use

func (c *ResourceClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `resource.Hooks(f(g(h())))`.

type ResourceCreate

type ResourceCreate struct {
	// contains filtered or unexported fields
}

ResourceCreate is the builder for creating a Resource entity.

func (*ResourceCreate) AddAccount

func (rc *ResourceCreate) AddAccount(a ...*Account) *ResourceCreate

AddAccount adds the "account" edges to the Account entity.

func (*ResourceCreate) AddAccountIDs

func (rc *ResourceCreate) AddAccountIDs(ids ...uuid.UUID) *ResourceCreate

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*ResourceCreate) AddChildIDs

func (rc *ResourceCreate) AddChildIDs(ids ...uuid.UUID) *ResourceCreate

AddChildIDs adds the "children" edge to the Resource entity by IDs.

func (*ResourceCreate) AddChildren

func (rc *ResourceCreate) AddChildren(r ...*Resource) *ResourceCreate

AddChildren adds the "children" edges to the Resource entity.

func (*ResourceCreate) AddParent

func (rc *ResourceCreate) AddParent(r ...*Resource) *ResourceCreate

AddParent adds the "parent" edges to the Resource entity.

func (*ResourceCreate) AddParentIDs

func (rc *ResourceCreate) AddParentIDs(ids ...uuid.UUID) *ResourceCreate

AddParentIDs adds the "parent" edge to the Resource entity by IDs.

func (*ResourceCreate) Exec

func (rc *ResourceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ResourceCreate) ExecX

func (rc *ResourceCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ResourceCreate) Mutation

func (rc *ResourceCreate) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceCreate) Save

func (rc *ResourceCreate) Save(ctx context.Context) (*Resource, error)

Save creates the Resource in the database.

func (*ResourceCreate) SaveX

func (rc *ResourceCreate) SaveX(ctx context.Context) *Resource

SaveX calls Save and panics if Save returns an error.

func (*ResourceCreate) SetCreatedAt

func (rc *ResourceCreate) SetCreatedAt(t time.Time) *ResourceCreate

SetCreatedAt sets the "created_at" field.

func (*ResourceCreate) SetDescription

func (rc *ResourceCreate) SetDescription(s string) *ResourceCreate

SetDescription sets the "description" field.

func (*ResourceCreate) SetID

func (rc *ResourceCreate) SetID(u uuid.UUID) *ResourceCreate

SetID sets the "id" field.

func (*ResourceCreate) SetName

func (rc *ResourceCreate) SetName(s string) *ResourceCreate

SetName sets the "name" field.

func (*ResourceCreate) SetNillableCreatedAt

func (rc *ResourceCreate) SetNillableCreatedAt(t *time.Time) *ResourceCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ResourceCreate) SetNillableDescription

func (rc *ResourceCreate) SetNillableDescription(s *string) *ResourceCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ResourceCreate) SetNillableID

func (rc *ResourceCreate) SetNillableID(u *uuid.UUID) *ResourceCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*ResourceCreate) SetNillableUpdatedAt

func (rc *ResourceCreate) SetNillableUpdatedAt(t *time.Time) *ResourceCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*ResourceCreate) SetProperties

func (rc *ResourceCreate) SetProperties(m map[string]interface{}) *ResourceCreate

SetProperties sets the "properties" field.

func (*ResourceCreate) SetRrn

func (rc *ResourceCreate) SetRrn(s string) *ResourceCreate

SetRrn sets the "rrn" field.

func (*ResourceCreate) SetTags

func (rc *ResourceCreate) SetTags(m map[string]string) *ResourceCreate

SetTags sets the "tags" field.

func (*ResourceCreate) SetType

func (rc *ResourceCreate) SetType(s string) *ResourceCreate

SetType sets the "type" field.

func (*ResourceCreate) SetUpdatedAt

func (rc *ResourceCreate) SetUpdatedAt(t time.Time) *ResourceCreate

SetUpdatedAt sets the "updated_at" field.

type ResourceCreateBulk

type ResourceCreateBulk struct {
	// contains filtered or unexported fields
}

ResourceCreateBulk is the builder for creating many Resource entities in bulk.

func (*ResourceCreateBulk) Exec

func (rcb *ResourceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ResourceCreateBulk) ExecX

func (rcb *ResourceCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ResourceCreateBulk) Save

func (rcb *ResourceCreateBulk) Save(ctx context.Context) ([]*Resource, error)

Save creates the Resource entities in the database.

func (*ResourceCreateBulk) SaveX

func (rcb *ResourceCreateBulk) SaveX(ctx context.Context) []*Resource

SaveX is like Save, but panics if an error occurs.

type ResourceDelete

type ResourceDelete struct {
	// contains filtered or unexported fields
}

ResourceDelete is the builder for deleting a Resource entity.

func (*ResourceDelete) Exec

func (rd *ResourceDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*ResourceDelete) ExecX

func (rd *ResourceDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*ResourceDelete) Where

func (rd *ResourceDelete) Where(ps ...predicate.Resource) *ResourceDelete

Where appends a list predicates to the ResourceDelete builder.

type ResourceDeleteOne

type ResourceDeleteOne struct {
	// contains filtered or unexported fields
}

ResourceDeleteOne is the builder for deleting a single Resource entity.

func (*ResourceDeleteOne) Exec

func (rdo *ResourceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ResourceDeleteOne) ExecX

func (rdo *ResourceDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ResourceDeleteOne) Where

Where appends a list predicates to the ResourceDelete builder.

type ResourceEdges

type ResourceEdges struct {
	// 资源所属的账户
	Account []*Account `json:"account,omitempty"`
	// 父资源
	Children []*Resource `json:"children,omitempty"`
	// Parent holds the value of the parent edge.
	Parent []*Resource `json:"parent,omitempty"`
	// contains filtered or unexported fields
}

ResourceEdges holds the relations/edges for other nodes in the graph.

func (ResourceEdges) AccountOrErr

func (e ResourceEdges) AccountOrErr() ([]*Account, error)

AccountOrErr returns the Account value or an error if the edge was not loaded in eager-loading.

func (ResourceEdges) ChildrenOrErr

func (e ResourceEdges) ChildrenOrErr() ([]*Resource, error)

ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.

func (ResourceEdges) ParentOrErr

func (e ResourceEdges) ParentOrErr() ([]*Resource, error)

ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading.

type ResourceGroupBy

type ResourceGroupBy struct {
	// contains filtered or unexported fields
}

ResourceGroupBy is the group-by builder for Resource entities.

func (*ResourceGroupBy) Aggregate

func (rgb *ResourceGroupBy) Aggregate(fns ...AggregateFunc) *ResourceGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*ResourceGroupBy) Bool

func (s *ResourceGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) BoolX

func (s *ResourceGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ResourceGroupBy) Bools

func (s *ResourceGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) BoolsX

func (s *ResourceGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ResourceGroupBy) Float64

func (s *ResourceGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) Float64X

func (s *ResourceGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ResourceGroupBy) Float64s

func (s *ResourceGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) Float64sX

func (s *ResourceGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ResourceGroupBy) Int

func (s *ResourceGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) IntX

func (s *ResourceGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ResourceGroupBy) Ints

func (s *ResourceGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) IntsX

func (s *ResourceGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ResourceGroupBy) Scan

func (rgb *ResourceGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ResourceGroupBy) ScanX

func (s *ResourceGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ResourceGroupBy) String

func (s *ResourceGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) StringX

func (s *ResourceGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ResourceGroupBy) Strings

func (s *ResourceGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ResourceGroupBy) StringsX

func (s *ResourceGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ResourceMutation

type ResourceMutation struct {
	// contains filtered or unexported fields
}

ResourceMutation represents an operation that mutates the Resource nodes in the graph.

func (*ResourceMutation) AccountCleared

func (m *ResourceMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*ResourceMutation) AccountIDs

func (m *ResourceMutation) AccountIDs() (ids []uuid.UUID)

AccountIDs returns the "account" edge IDs in the mutation.

func (*ResourceMutation) AddAccountIDs

func (m *ResourceMutation) AddAccountIDs(ids ...uuid.UUID)

AddAccountIDs adds the "account" edge to the Account entity by ids.

func (*ResourceMutation) AddChildIDs

func (m *ResourceMutation) AddChildIDs(ids ...uuid.UUID)

AddChildIDs adds the "children" edge to the Resource entity by ids.

func (*ResourceMutation) AddField

func (m *ResourceMutation) 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 (*ResourceMutation) AddParentIDs

func (m *ResourceMutation) AddParentIDs(ids ...uuid.UUID)

AddParentIDs adds the "parent" edge to the Resource entity by ids.

func (*ResourceMutation) AddedEdges

func (m *ResourceMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*ResourceMutation) AddedField

func (m *ResourceMutation) 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 (*ResourceMutation) AddedFields

func (m *ResourceMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*ResourceMutation) AddedIDs

func (m *ResourceMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ResourceMutation) ChildrenCleared

func (m *ResourceMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Resource entity was cleared.

func (*ResourceMutation) ChildrenIDs

func (m *ResourceMutation) ChildrenIDs() (ids []uuid.UUID)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*ResourceMutation) ClearAccount

func (m *ResourceMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*ResourceMutation) ClearChildren

func (m *ResourceMutation) ClearChildren()

ClearChildren clears the "children" edge to the Resource entity.

func (*ResourceMutation) ClearDescription

func (m *ResourceMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*ResourceMutation) ClearEdge

func (m *ResourceMutation) 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 (*ResourceMutation) ClearField

func (m *ResourceMutation) 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 (*ResourceMutation) ClearParent

func (m *ResourceMutation) ClearParent()

ClearParent clears the "parent" edge to the Resource entity.

func (*ResourceMutation) ClearProperties

func (m *ResourceMutation) ClearProperties()

ClearProperties clears the value of the "properties" field.

func (*ResourceMutation) ClearTags

func (m *ResourceMutation) ClearTags()

ClearTags clears the value of the "tags" field.

func (*ResourceMutation) ClearedEdges

func (m *ResourceMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*ResourceMutation) ClearedFields

func (m *ResourceMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (ResourceMutation) Client

func (m ResourceMutation) 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 (*ResourceMutation) CreatedAt

func (m *ResourceMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ResourceMutation) Description

func (m *ResourceMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*ResourceMutation) DescriptionCleared

func (m *ResourceMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*ResourceMutation) EdgeCleared

func (m *ResourceMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ResourceMutation) Field

func (m *ResourceMutation) 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 (*ResourceMutation) FieldCleared

func (m *ResourceMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ResourceMutation) Fields

func (m *ResourceMutation) 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 (*ResourceMutation) GetType

func (m *ResourceMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*ResourceMutation) ID

func (m *ResourceMutation) 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 (*ResourceMutation) IDs

func (m *ResourceMutation) 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 (*ResourceMutation) Name

func (m *ResourceMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ResourceMutation) OldCreatedAt

func (m *ResourceMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldDescription

func (m *ResourceMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldField

func (m *ResourceMutation) 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 (*ResourceMutation) OldName

func (m *ResourceMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldProperties

func (m *ResourceMutation) OldProperties(ctx context.Context) (v map[string]interface{}, err error)

OldProperties returns the old "properties" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldRrn

func (m *ResourceMutation) OldRrn(ctx context.Context) (v string, err error)

OldRrn returns the old "rrn" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldTags

func (m *ResourceMutation) OldTags(ctx context.Context) (v map[string]string, err error)

OldTags returns the old "tags" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldType

func (m *ResourceMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) OldUpdatedAt

func (m *ResourceMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Resource entity. If the Resource 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 (*ResourceMutation) Op

func (m *ResourceMutation) Op() Op

Op returns the operation name.

func (*ResourceMutation) ParentCleared

func (m *ResourceMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Resource entity was cleared.

func (*ResourceMutation) ParentIDs

func (m *ResourceMutation) ParentIDs() (ids []uuid.UUID)

ParentIDs returns the "parent" edge IDs in the mutation.

func (*ResourceMutation) Properties

func (m *ResourceMutation) Properties() (r map[string]interface{}, exists bool)

Properties returns the value of the "properties" field in the mutation.

func (*ResourceMutation) PropertiesCleared

func (m *ResourceMutation) PropertiesCleared() bool

PropertiesCleared returns if the "properties" field was cleared in this mutation.

func (*ResourceMutation) RemoveAccountIDs

func (m *ResourceMutation) RemoveAccountIDs(ids ...uuid.UUID)

RemoveAccountIDs removes the "account" edge to the Account entity by IDs.

func (*ResourceMutation) RemoveChildIDs

func (m *ResourceMutation) RemoveChildIDs(ids ...uuid.UUID)

RemoveChildIDs removes the "children" edge to the Resource entity by IDs.

func (*ResourceMutation) RemoveParentIDs

func (m *ResourceMutation) RemoveParentIDs(ids ...uuid.UUID)

RemoveParentIDs removes the "parent" edge to the Resource entity by IDs.

func (*ResourceMutation) RemovedAccountIDs

func (m *ResourceMutation) RemovedAccountIDs() (ids []uuid.UUID)

RemovedAccount returns the removed IDs of the "account" edge to the Account entity.

func (*ResourceMutation) RemovedChildrenIDs

func (m *ResourceMutation) RemovedChildrenIDs() (ids []uuid.UUID)

RemovedChildren returns the removed IDs of the "children" edge to the Resource entity.

func (*ResourceMutation) RemovedEdges

func (m *ResourceMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*ResourceMutation) RemovedIDs

func (m *ResourceMutation) 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 (*ResourceMutation) RemovedParentIDs

func (m *ResourceMutation) RemovedParentIDs() (ids []uuid.UUID)

RemovedParent returns the removed IDs of the "parent" edge to the Resource entity.

func (*ResourceMutation) ResetAccount

func (m *ResourceMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*ResourceMutation) ResetChildren

func (m *ResourceMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*ResourceMutation) ResetCreatedAt

func (m *ResourceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ResourceMutation) ResetDescription

func (m *ResourceMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ResourceMutation) ResetEdge

func (m *ResourceMutation) 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 (*ResourceMutation) ResetField

func (m *ResourceMutation) 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 (*ResourceMutation) ResetName

func (m *ResourceMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ResourceMutation) ResetParent

func (m *ResourceMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*ResourceMutation) ResetProperties

func (m *ResourceMutation) ResetProperties()

ResetProperties resets all changes to the "properties" field.

func (*ResourceMutation) ResetRrn

func (m *ResourceMutation) ResetRrn()

ResetRrn resets all changes to the "rrn" field.

func (*ResourceMutation) ResetTags

func (m *ResourceMutation) ResetTags()

ResetTags resets all changes to the "tags" field.

func (*ResourceMutation) ResetType

func (m *ResourceMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*ResourceMutation) ResetUpdatedAt

func (m *ResourceMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ResourceMutation) Rrn

func (m *ResourceMutation) Rrn() (r string, exists bool)

Rrn returns the value of the "rrn" field in the mutation.

func (*ResourceMutation) SetCreatedAt

func (m *ResourceMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ResourceMutation) SetDescription

func (m *ResourceMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ResourceMutation) SetField

func (m *ResourceMutation) 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 (*ResourceMutation) SetID

func (m *ResourceMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Resource entities.

func (*ResourceMutation) SetName

func (m *ResourceMutation) SetName(s string)

SetName sets the "name" field.

func (*ResourceMutation) SetOp

func (m *ResourceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ResourceMutation) SetProperties

func (m *ResourceMutation) SetProperties(value map[string]interface{})

SetProperties sets the "properties" field.

func (*ResourceMutation) SetRrn

func (m *ResourceMutation) SetRrn(s string)

SetRrn sets the "rrn" field.

func (*ResourceMutation) SetTags

func (m *ResourceMutation) SetTags(value map[string]string)

SetTags sets the "tags" field.

func (*ResourceMutation) SetType

func (m *ResourceMutation) SetType(s string)

SetType sets the "type" field.

func (*ResourceMutation) SetUpdatedAt

func (m *ResourceMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*ResourceMutation) Tags

func (m *ResourceMutation) Tags() (r map[string]string, exists bool)

Tags returns the value of the "tags" field in the mutation.

func (*ResourceMutation) TagsCleared

func (m *ResourceMutation) TagsCleared() bool

TagsCleared returns if the "tags" field was cleared in this mutation.

func (ResourceMutation) Tx

func (m ResourceMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ResourceMutation) Type

func (m *ResourceMutation) Type() string

Type returns the node type of this mutation (Resource).

func (*ResourceMutation) UpdatedAt

func (m *ResourceMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*ResourceMutation) Where

func (m *ResourceMutation) Where(ps ...predicate.Resource)

Where appends a list predicates to the ResourceMutation builder.

func (*ResourceMutation) WhereP

func (m *ResourceMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ResourceMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ResourceQuery

type ResourceQuery struct {
	// contains filtered or unexported fields
}

ResourceQuery is the builder for querying Resource entities.

func (*ResourceQuery) Aggregate

func (rq *ResourceQuery) Aggregate(fns ...AggregateFunc) *ResourceSelect

Aggregate returns a ResourceSelect configured with the given aggregations.

func (*ResourceQuery) All

func (rq *ResourceQuery) All(ctx context.Context) ([]*Resource, error)

All executes the query and returns a list of Resources.

func (*ResourceQuery) AllX

func (rq *ResourceQuery) AllX(ctx context.Context) []*Resource

AllX is like All, but panics if an error occurs.

func (*ResourceQuery) Clone

func (rq *ResourceQuery) Clone() *ResourceQuery

Clone returns a duplicate of the ResourceQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ResourceQuery) Count

func (rq *ResourceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ResourceQuery) CountX

func (rq *ResourceQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ResourceQuery) Exist

func (rq *ResourceQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ResourceQuery) ExistX

func (rq *ResourceQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ResourceQuery) First

func (rq *ResourceQuery) First(ctx context.Context) (*Resource, error)

First returns the first Resource entity from the query. Returns a *NotFoundError when no Resource was found.

func (*ResourceQuery) FirstID

func (rq *ResourceQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Resource ID from the query. Returns a *NotFoundError when no Resource ID was found.

func (*ResourceQuery) FirstIDX

func (rq *ResourceQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*ResourceQuery) FirstX

func (rq *ResourceQuery) FirstX(ctx context.Context) *Resource

FirstX is like First, but panics if an error occurs.

func (*ResourceQuery) GroupBy

func (rq *ResourceQuery) GroupBy(field string, fields ...string) *ResourceGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Resource.Query().
	GroupBy(resource.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ResourceQuery) IDs

func (rq *ResourceQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of Resource IDs.

func (*ResourceQuery) IDsX

func (rq *ResourceQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*ResourceQuery) Limit

func (rq *ResourceQuery) Limit(limit int) *ResourceQuery

Limit the number of records to be returned by this query.

func (*ResourceQuery) Offset

func (rq *ResourceQuery) Offset(offset int) *ResourceQuery

Offset to start from.

func (*ResourceQuery) Only

func (rq *ResourceQuery) Only(ctx context.Context) (*Resource, error)

Only returns a single Resource entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Resource entity is found. Returns a *NotFoundError when no Resource entities are found.

func (*ResourceQuery) OnlyID

func (rq *ResourceQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Resource ID in the query. Returns a *NotSingularError when more than one Resource ID is found. Returns a *NotFoundError when no entities are found.

func (*ResourceQuery) OnlyIDX

func (rq *ResourceQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ResourceQuery) OnlyX

func (rq *ResourceQuery) OnlyX(ctx context.Context) *Resource

OnlyX is like Only, but panics if an error occurs.

func (*ResourceQuery) Order

Order specifies how the records should be ordered.

func (*ResourceQuery) QueryAccount

func (rq *ResourceQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*ResourceQuery) QueryChildren

func (rq *ResourceQuery) QueryChildren() *ResourceQuery

QueryChildren chains the current query on the "children" edge.

func (*ResourceQuery) QueryParent

func (rq *ResourceQuery) QueryParent() *ResourceQuery

QueryParent chains the current query on the "parent" edge.

func (*ResourceQuery) Select

func (rq *ResourceQuery) Select(fields ...string) *ResourceSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Resource.Query().
	Select(resource.FieldCreatedAt).
	Scan(ctx, &v)

func (*ResourceQuery) Unique

func (rq *ResourceQuery) Unique(unique bool) *ResourceQuery

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 (*ResourceQuery) Where

func (rq *ResourceQuery) Where(ps ...predicate.Resource) *ResourceQuery

Where adds a new predicate for the ResourceQuery builder.

func (*ResourceQuery) WithAccount

func (rq *ResourceQuery) WithAccount(opts ...func(*AccountQuery)) *ResourceQuery

WithAccount tells the query-builder to eager-load the nodes that are connected to the "account" edge. The optional arguments are used to configure the query builder of the edge.

func (*ResourceQuery) WithChildren

func (rq *ResourceQuery) WithChildren(opts ...func(*ResourceQuery)) *ResourceQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*ResourceQuery) WithParent

func (rq *ResourceQuery) WithParent(opts ...func(*ResourceQuery)) *ResourceQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

type ResourceSelect

type ResourceSelect struct {
	*ResourceQuery
	// contains filtered or unexported fields
}

ResourceSelect is the builder for selecting fields of Resource entities.

func (*ResourceSelect) Aggregate

func (rs *ResourceSelect) Aggregate(fns ...AggregateFunc) *ResourceSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ResourceSelect) Bool

func (s *ResourceSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) BoolX

func (s *ResourceSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ResourceSelect) Bools

func (s *ResourceSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) BoolsX

func (s *ResourceSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ResourceSelect) Float64

func (s *ResourceSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) Float64X

func (s *ResourceSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ResourceSelect) Float64s

func (s *ResourceSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) Float64sX

func (s *ResourceSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ResourceSelect) Int

func (s *ResourceSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) IntX

func (s *ResourceSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ResourceSelect) Ints

func (s *ResourceSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) IntsX

func (s *ResourceSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ResourceSelect) Scan

func (rs *ResourceSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ResourceSelect) ScanX

func (s *ResourceSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ResourceSelect) String

func (s *ResourceSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) StringX

func (s *ResourceSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ResourceSelect) Strings

func (s *ResourceSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ResourceSelect) StringsX

func (s *ResourceSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ResourceUpdate

type ResourceUpdate struct {
	// contains filtered or unexported fields
}

ResourceUpdate is the builder for updating Resource entities.

func (*ResourceUpdate) AddAccount

func (ru *ResourceUpdate) AddAccount(a ...*Account) *ResourceUpdate

AddAccount adds the "account" edges to the Account entity.

func (*ResourceUpdate) AddAccountIDs

func (ru *ResourceUpdate) AddAccountIDs(ids ...uuid.UUID) *ResourceUpdate

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*ResourceUpdate) AddChildIDs

func (ru *ResourceUpdate) AddChildIDs(ids ...uuid.UUID) *ResourceUpdate

AddChildIDs adds the "children" edge to the Resource entity by IDs.

func (*ResourceUpdate) AddChildren

func (ru *ResourceUpdate) AddChildren(r ...*Resource) *ResourceUpdate

AddChildren adds the "children" edges to the Resource entity.

func (*ResourceUpdate) AddParent

func (ru *ResourceUpdate) AddParent(r ...*Resource) *ResourceUpdate

AddParent adds the "parent" edges to the Resource entity.

func (*ResourceUpdate) AddParentIDs

func (ru *ResourceUpdate) AddParentIDs(ids ...uuid.UUID) *ResourceUpdate

AddParentIDs adds the "parent" edge to the Resource entity by IDs.

func (*ResourceUpdate) ClearAccount

func (ru *ResourceUpdate) ClearAccount() *ResourceUpdate

ClearAccount clears all "account" edges to the Account entity.

func (*ResourceUpdate) ClearChildren

func (ru *ResourceUpdate) ClearChildren() *ResourceUpdate

ClearChildren clears all "children" edges to the Resource entity.

func (*ResourceUpdate) ClearDescription

func (ru *ResourceUpdate) ClearDescription() *ResourceUpdate

ClearDescription clears the value of the "description" field.

func (*ResourceUpdate) ClearParent

func (ru *ResourceUpdate) ClearParent() *ResourceUpdate

ClearParent clears all "parent" edges to the Resource entity.

func (*ResourceUpdate) ClearProperties

func (ru *ResourceUpdate) ClearProperties() *ResourceUpdate

ClearProperties clears the value of the "properties" field.

func (*ResourceUpdate) ClearTags

func (ru *ResourceUpdate) ClearTags() *ResourceUpdate

ClearTags clears the value of the "tags" field.

func (*ResourceUpdate) Exec

func (ru *ResourceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ResourceUpdate) ExecX

func (ru *ResourceUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ResourceUpdate) Mutation

func (ru *ResourceUpdate) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceUpdate) RemoveAccount

func (ru *ResourceUpdate) RemoveAccount(a ...*Account) *ResourceUpdate

RemoveAccount removes "account" edges to Account entities.

func (*ResourceUpdate) RemoveAccountIDs

func (ru *ResourceUpdate) RemoveAccountIDs(ids ...uuid.UUID) *ResourceUpdate

RemoveAccountIDs removes the "account" edge to Account entities by IDs.

func (*ResourceUpdate) RemoveChildIDs

func (ru *ResourceUpdate) RemoveChildIDs(ids ...uuid.UUID) *ResourceUpdate

RemoveChildIDs removes the "children" edge to Resource entities by IDs.

func (*ResourceUpdate) RemoveChildren

func (ru *ResourceUpdate) RemoveChildren(r ...*Resource) *ResourceUpdate

RemoveChildren removes "children" edges to Resource entities.

func (*ResourceUpdate) RemoveParent

func (ru *ResourceUpdate) RemoveParent(r ...*Resource) *ResourceUpdate

RemoveParent removes "parent" edges to Resource entities.

func (*ResourceUpdate) RemoveParentIDs

func (ru *ResourceUpdate) RemoveParentIDs(ids ...uuid.UUID) *ResourceUpdate

RemoveParentIDs removes the "parent" edge to Resource entities by IDs.

func (*ResourceUpdate) Save

func (ru *ResourceUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ResourceUpdate) SaveX

func (ru *ResourceUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ResourceUpdate) SetDescription

func (ru *ResourceUpdate) SetDescription(s string) *ResourceUpdate

SetDescription sets the "description" field.

func (*ResourceUpdate) SetName

func (ru *ResourceUpdate) SetName(s string) *ResourceUpdate

SetName sets the "name" field.

func (*ResourceUpdate) SetNillableDescription

func (ru *ResourceUpdate) SetNillableDescription(s *string) *ResourceUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ResourceUpdate) SetNillableName

func (ru *ResourceUpdate) SetNillableName(s *string) *ResourceUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ResourceUpdate) SetNillableRrn

func (ru *ResourceUpdate) SetNillableRrn(s *string) *ResourceUpdate

SetNillableRrn sets the "rrn" field if the given value is not nil.

func (*ResourceUpdate) SetNillableType

func (ru *ResourceUpdate) SetNillableType(s *string) *ResourceUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*ResourceUpdate) SetProperties

func (ru *ResourceUpdate) SetProperties(m map[string]interface{}) *ResourceUpdate

SetProperties sets the "properties" field.

func (*ResourceUpdate) SetRrn

func (ru *ResourceUpdate) SetRrn(s string) *ResourceUpdate

SetRrn sets the "rrn" field.

func (*ResourceUpdate) SetTags

func (ru *ResourceUpdate) SetTags(m map[string]string) *ResourceUpdate

SetTags sets the "tags" field.

func (*ResourceUpdate) SetType

func (ru *ResourceUpdate) SetType(s string) *ResourceUpdate

SetType sets the "type" field.

func (*ResourceUpdate) SetUpdatedAt

func (ru *ResourceUpdate) SetUpdatedAt(t time.Time) *ResourceUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ResourceUpdate) Where

func (ru *ResourceUpdate) Where(ps ...predicate.Resource) *ResourceUpdate

Where appends a list predicates to the ResourceUpdate builder.

type ResourceUpdateOne

type ResourceUpdateOne struct {
	// contains filtered or unexported fields
}

ResourceUpdateOne is the builder for updating a single Resource entity.

func (*ResourceUpdateOne) AddAccount

func (ruo *ResourceUpdateOne) AddAccount(a ...*Account) *ResourceUpdateOne

AddAccount adds the "account" edges to the Account entity.

func (*ResourceUpdateOne) AddAccountIDs

func (ruo *ResourceUpdateOne) AddAccountIDs(ids ...uuid.UUID) *ResourceUpdateOne

AddAccountIDs adds the "account" edge to the Account entity by IDs.

func (*ResourceUpdateOne) AddChildIDs

func (ruo *ResourceUpdateOne) AddChildIDs(ids ...uuid.UUID) *ResourceUpdateOne

AddChildIDs adds the "children" edge to the Resource entity by IDs.

func (*ResourceUpdateOne) AddChildren

func (ruo *ResourceUpdateOne) AddChildren(r ...*Resource) *ResourceUpdateOne

AddChildren adds the "children" edges to the Resource entity.

func (*ResourceUpdateOne) AddParent

func (ruo *ResourceUpdateOne) AddParent(r ...*Resource) *ResourceUpdateOne

AddParent adds the "parent" edges to the Resource entity.

func (*ResourceUpdateOne) AddParentIDs

func (ruo *ResourceUpdateOne) AddParentIDs(ids ...uuid.UUID) *ResourceUpdateOne

AddParentIDs adds the "parent" edge to the Resource entity by IDs.

func (*ResourceUpdateOne) ClearAccount

func (ruo *ResourceUpdateOne) ClearAccount() *ResourceUpdateOne

ClearAccount clears all "account" edges to the Account entity.

func (*ResourceUpdateOne) ClearChildren

func (ruo *ResourceUpdateOne) ClearChildren() *ResourceUpdateOne

ClearChildren clears all "children" edges to the Resource entity.

func (*ResourceUpdateOne) ClearDescription

func (ruo *ResourceUpdateOne) ClearDescription() *ResourceUpdateOne

ClearDescription clears the value of the "description" field.

func (*ResourceUpdateOne) ClearParent

func (ruo *ResourceUpdateOne) ClearParent() *ResourceUpdateOne

ClearParent clears all "parent" edges to the Resource entity.

func (*ResourceUpdateOne) ClearProperties

func (ruo *ResourceUpdateOne) ClearProperties() *ResourceUpdateOne

ClearProperties clears the value of the "properties" field.

func (*ResourceUpdateOne) ClearTags

func (ruo *ResourceUpdateOne) ClearTags() *ResourceUpdateOne

ClearTags clears the value of the "tags" field.

func (*ResourceUpdateOne) Exec

func (ruo *ResourceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ResourceUpdateOne) ExecX

func (ruo *ResourceUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ResourceUpdateOne) Mutation

func (ruo *ResourceUpdateOne) Mutation() *ResourceMutation

Mutation returns the ResourceMutation object of the builder.

func (*ResourceUpdateOne) RemoveAccount

func (ruo *ResourceUpdateOne) RemoveAccount(a ...*Account) *ResourceUpdateOne

RemoveAccount removes "account" edges to Account entities.

func (*ResourceUpdateOne) RemoveAccountIDs

func (ruo *ResourceUpdateOne) RemoveAccountIDs(ids ...uuid.UUID) *ResourceUpdateOne

RemoveAccountIDs removes the "account" edge to Account entities by IDs.

func (*ResourceUpdateOne) RemoveChildIDs

func (ruo *ResourceUpdateOne) RemoveChildIDs(ids ...uuid.UUID) *ResourceUpdateOne

RemoveChildIDs removes the "children" edge to Resource entities by IDs.

func (*ResourceUpdateOne) RemoveChildren

func (ruo *ResourceUpdateOne) RemoveChildren(r ...*Resource) *ResourceUpdateOne

RemoveChildren removes "children" edges to Resource entities.

func (*ResourceUpdateOne) RemoveParent

func (ruo *ResourceUpdateOne) RemoveParent(r ...*Resource) *ResourceUpdateOne

RemoveParent removes "parent" edges to Resource entities.

func (*ResourceUpdateOne) RemoveParentIDs

func (ruo *ResourceUpdateOne) RemoveParentIDs(ids ...uuid.UUID) *ResourceUpdateOne

RemoveParentIDs removes the "parent" edge to Resource entities by IDs.

func (*ResourceUpdateOne) Save

func (ruo *ResourceUpdateOne) Save(ctx context.Context) (*Resource, error)

Save executes the query and returns the updated Resource entity.

func (*ResourceUpdateOne) SaveX

func (ruo *ResourceUpdateOne) SaveX(ctx context.Context) *Resource

SaveX is like Save, but panics if an error occurs.

func (*ResourceUpdateOne) Select

func (ruo *ResourceUpdateOne) Select(field string, fields ...string) *ResourceUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ResourceUpdateOne) SetDescription

func (ruo *ResourceUpdateOne) SetDescription(s string) *ResourceUpdateOne

SetDescription sets the "description" field.

func (*ResourceUpdateOne) SetName

func (ruo *ResourceUpdateOne) SetName(s string) *ResourceUpdateOne

SetName sets the "name" field.

func (*ResourceUpdateOne) SetNillableDescription

func (ruo *ResourceUpdateOne) SetNillableDescription(s *string) *ResourceUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ResourceUpdateOne) SetNillableName

func (ruo *ResourceUpdateOne) SetNillableName(s *string) *ResourceUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ResourceUpdateOne) SetNillableRrn

func (ruo *ResourceUpdateOne) SetNillableRrn(s *string) *ResourceUpdateOne

SetNillableRrn sets the "rrn" field if the given value is not nil.

func (*ResourceUpdateOne) SetNillableType

func (ruo *ResourceUpdateOne) SetNillableType(s *string) *ResourceUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*ResourceUpdateOne) SetProperties

func (ruo *ResourceUpdateOne) SetProperties(m map[string]interface{}) *ResourceUpdateOne

SetProperties sets the "properties" field.

func (*ResourceUpdateOne) SetRrn

func (ruo *ResourceUpdateOne) SetRrn(s string) *ResourceUpdateOne

SetRrn sets the "rrn" field.

func (*ResourceUpdateOne) SetTags

func (ruo *ResourceUpdateOne) SetTags(m map[string]string) *ResourceUpdateOne

SetTags sets the "tags" field.

func (*ResourceUpdateOne) SetType

func (ruo *ResourceUpdateOne) SetType(s string) *ResourceUpdateOne

SetType sets the "type" field.

func (*ResourceUpdateOne) SetUpdatedAt

func (ruo *ResourceUpdateOne) SetUpdatedAt(t time.Time) *ResourceUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ResourceUpdateOne) Where

Where appends a list predicates to the ResourceUpdate builder.

type Resources

type Resources []*Resource

Resources is a parsable slice of Resource.

type Role

type Role struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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"`
	// IsDisabled holds the value of the "is_disabled" field.
	IsDisabled bool `json:"is_disabled,omitempty"`
	// IsDefault holds the value of the "is_default" field.
	IsDefault bool `json:"is_default,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RoleQuery when eager-loading is set.
	Edges RoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) QueryAccessPolicies

func (r *Role) QueryAccessPolicies() *AccessPolicyQuery

QueryAccessPolicies queries the "access_policies" edge of the Role entity.

func (*Role) QueryAccount

func (r *Role) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the Role entity.

func (*Role) QueryChildRoles

func (r *Role) QueryChildRoles() *RoleQuery

QueryChildRoles queries the "child_roles" edge of the Role entity.

func (*Role) QueryParentRole

func (r *Role) QueryParentRole() *RoleQuery

QueryParentRole queries the "parent_role" edge of the Role entity.

func (*Role) QueryUsers

func (r *Role) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Role entity.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

Unwrap unwraps the Role entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Role) Update

func (r *Role) Update() *RoleUpdateOne

Update returns a builder for updating this Role. Note that you need to call Role.Unwrap() before calling this method if this Role was returned from a transaction, and the transaction was committed or rolled back.

func (*Role) Value

func (r *Role) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Role. This includes values selected through modifiers, order, etc.

type RoleClient

type RoleClient struct {
	// contains filtered or unexported fields
}

RoleClient is a client for the Role schema.

func NewRoleClient

func NewRoleClient(c config) *RoleClient

NewRoleClient returns a client for the Role from the given config.

func (*RoleClient) Create

func (c *RoleClient) Create() *RoleCreate

Create returns a builder for creating a Role entity.

func (*RoleClient) CreateBulk

func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk

CreateBulk returns a builder for creating a bulk of Role entities.

func (*RoleClient) Delete

func (c *RoleClient) Delete() *RoleDelete

Delete returns a delete builder for Role.

func (*RoleClient) DeleteOne

func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RoleClient) DeleteOneID

func (c *RoleClient) DeleteOneID(id uuid.UUID) *RoleDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*RoleClient) Get

func (c *RoleClient) Get(ctx context.Context, id uuid.UUID) (*Role, error)

Get returns a Role entity by its id.

func (*RoleClient) GetX

func (c *RoleClient) GetX(ctx context.Context, id uuid.UUID) *Role

GetX is like Get, but panics if an error occurs.

func (*RoleClient) Hooks

func (c *RoleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*RoleClient) Intercept

func (c *RoleClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `role.Intercept(f(g(h())))`.

func (*RoleClient) Interceptors

func (c *RoleClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*RoleClient) MapCreateBulk

func (c *RoleClient) MapCreateBulk(slice any, setFunc func(*RoleCreate, int)) *RoleCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*RoleClient) Query

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) QueryAccessPolicies

func (c *RoleClient) QueryAccessPolicies(r *Role) *AccessPolicyQuery

QueryAccessPolicies queries the access_policies edge of a Role.

func (*RoleClient) QueryAccount

func (c *RoleClient) QueryAccount(r *Role) *AccountQuery

QueryAccount queries the account edge of a Role.

func (*RoleClient) QueryChildRoles

func (c *RoleClient) QueryChildRoles(r *Role) *RoleQuery

QueryChildRoles queries the child_roles edge of a Role.

func (*RoleClient) QueryParentRole

func (c *RoleClient) QueryParentRole(r *Role) *RoleQuery

QueryParentRole queries the parent_role edge of a Role.

func (*RoleClient) QueryUsers

func (c *RoleClient) QueryUsers(r *Role) *UserQuery

QueryUsers queries the users edge of a Role.

func (*RoleClient) Update

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

func (c *RoleClient) UpdateOneID(id uuid.UUID) *RoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

func (c *RoleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `role.Hooks(f(g(h())))`.

type RoleCreate

type RoleCreate struct {
	// contains filtered or unexported fields
}

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) AddAccessPolicies

func (rc *RoleCreate) AddAccessPolicies(a ...*AccessPolicy) *RoleCreate

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*RoleCreate) AddAccessPolicyIDs

func (rc *RoleCreate) AddAccessPolicyIDs(ids ...uuid.UUID) *RoleCreate

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*RoleCreate) AddChildRoleIDs

func (rc *RoleCreate) AddChildRoleIDs(ids ...uuid.UUID) *RoleCreate

AddChildRoleIDs adds the "child_roles" edge to the Role entity by IDs.

func (*RoleCreate) AddChildRoles

func (rc *RoleCreate) AddChildRoles(r ...*Role) *RoleCreate

AddChildRoles adds the "child_roles" edges to the Role entity.

func (*RoleCreate) AddParentRole

func (rc *RoleCreate) AddParentRole(r ...*Role) *RoleCreate

AddParentRole adds the "parent_role" edges to the Role entity.

func (*RoleCreate) AddParentRoleIDs

func (rc *RoleCreate) AddParentRoleIDs(ids ...uuid.UUID) *RoleCreate

AddParentRoleIDs adds the "parent_role" edge to the Role entity by IDs.

func (*RoleCreate) AddUserIDs

func (rc *RoleCreate) AddUserIDs(ids ...uuid.UUID) *RoleCreate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleCreate) AddUsers

func (rc *RoleCreate) AddUsers(u ...*User) *RoleCreate

AddUsers adds the "users" edges to the User entity.

func (*RoleCreate) Exec

func (rc *RoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreate) ExecX

func (rc *RoleCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) Save

func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)

Save creates the Role in the database.

func (*RoleCreate) SaveX

func (rc *RoleCreate) SaveX(ctx context.Context) *Role

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetAccount

func (rc *RoleCreate) SetAccount(a *Account) *RoleCreate

SetAccount sets the "account" edge to the Account entity.

func (*RoleCreate) SetAccountID

func (rc *RoleCreate) SetAccountID(id uuid.UUID) *RoleCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*RoleCreate) SetCreatedAt

func (rc *RoleCreate) SetCreatedAt(t time.Time) *RoleCreate

SetCreatedAt sets the "created_at" field.

func (*RoleCreate) SetDescription

func (rc *RoleCreate) SetDescription(s string) *RoleCreate

SetDescription sets the "description" field.

func (*RoleCreate) SetID

func (rc *RoleCreate) SetID(u uuid.UUID) *RoleCreate

SetID sets the "id" field.

func (*RoleCreate) SetIsDefault

func (rc *RoleCreate) SetIsDefault(b bool) *RoleCreate

SetIsDefault sets the "is_default" field.

func (*RoleCreate) SetIsDisabled

func (rc *RoleCreate) SetIsDisabled(b bool) *RoleCreate

SetIsDisabled sets the "is_disabled" field.

func (*RoleCreate) SetName

func (rc *RoleCreate) SetName(s string) *RoleCreate

SetName sets the "name" field.

func (*RoleCreate) SetNillableAccountID

func (rc *RoleCreate) SetNillableAccountID(id *uuid.UUID) *RoleCreate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*RoleCreate) SetNillableCreatedAt

func (rc *RoleCreate) SetNillableCreatedAt(t *time.Time) *RoleCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*RoleCreate) SetNillableDescription

func (rc *RoleCreate) SetNillableDescription(s *string) *RoleCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleCreate) SetNillableID

func (rc *RoleCreate) SetNillableID(u *uuid.UUID) *RoleCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*RoleCreate) SetNillableIsDefault

func (rc *RoleCreate) SetNillableIsDefault(b *bool) *RoleCreate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*RoleCreate) SetNillableIsDisabled

func (rc *RoleCreate) SetNillableIsDisabled(b *bool) *RoleCreate

SetNillableIsDisabled sets the "is_disabled" field if the given value is not nil.

func (*RoleCreate) SetNillableUpdatedAt

func (rc *RoleCreate) SetNillableUpdatedAt(t *time.Time) *RoleCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*RoleCreate) SetUpdatedAt

func (rc *RoleCreate) SetUpdatedAt(t time.Time) *RoleCreate

SetUpdatedAt sets the "updated_at" field.

type RoleCreateBulk

type RoleCreateBulk struct {
	// contains filtered or unexported fields
}

RoleCreateBulk is the builder for creating many Role entities in bulk.

func (*RoleCreateBulk) Exec

func (rcb *RoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreateBulk) ExecX

func (rcb *RoleCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleCreateBulk) Save

func (rcb *RoleCreateBulk) Save(ctx context.Context) ([]*Role, error)

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

func (rcb *RoleCreateBulk) SaveX(ctx context.Context) []*Role

SaveX is like Save, but panics if an error occurs.

type RoleDelete

type RoleDelete struct {
	// contains filtered or unexported fields
}

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

func (rd *RoleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*RoleDelete) ExecX

func (rd *RoleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*RoleDelete) Where

func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

type RoleDeleteOne struct {
	// contains filtered or unexported fields
}

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

func (rdo *RoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

func (rdo *RoleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleDeleteOne) Where

func (rdo *RoleDeleteOne) Where(ps ...predicate.Role) *RoleDeleteOne

Where appends a list predicates to the RoleDelete builder.

type RoleEdges

type RoleEdges struct {
	// 角色所属的账户
	Account *Account `json:"account,omitempty"`
	// 拥有该角色的用户
	Users []*User `json:"users,omitempty"`
	// 分配给角色的策略
	AccessPolicies []*AccessPolicy `json:"access_policies,omitempty"`
	// ParentRole holds the value of the parent_role edge.
	ParentRole []*Role `json:"parent_role,omitempty"`
	// ChildRoles holds the value of the child_roles edge.
	ChildRoles []*Role `json:"child_roles,omitempty"`
	// contains filtered or unexported fields
}

RoleEdges holds the relations/edges for other nodes in the graph.

func (RoleEdges) AccessPoliciesOrErr

func (e RoleEdges) AccessPoliciesOrErr() ([]*AccessPolicy, error)

AccessPoliciesOrErr returns the AccessPolicies value or an error if the edge was not loaded in eager-loading.

func (RoleEdges) AccountOrErr

func (e RoleEdges) AccountOrErr() (*Account, error)

AccountOrErr returns the Account value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (RoleEdges) ChildRolesOrErr

func (e RoleEdges) ChildRolesOrErr() ([]*Role, error)

ChildRolesOrErr returns the ChildRoles value or an error if the edge was not loaded in eager-loading.

func (RoleEdges) ParentRoleOrErr

func (e RoleEdges) ParentRoleOrErr() ([]*Role, error)

ParentRoleOrErr returns the ParentRole value or an error if the edge was not loaded in eager-loading.

func (RoleEdges) UsersOrErr

func (e RoleEdges) UsersOrErr() ([]*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading.

type RoleGroupBy

type RoleGroupBy struct {
	// contains filtered or unexported fields
}

RoleGroupBy is the group-by builder for Role entities.

func (*RoleGroupBy) Aggregate

func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*RoleGroupBy) Bool

func (s *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) BoolX

func (s *RoleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleGroupBy) Bools

func (s *RoleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) BoolsX

func (s *RoleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleGroupBy) Float64

func (s *RoleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) Float64X

func (s *RoleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleGroupBy) Float64s

func (s *RoleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) Float64sX

func (s *RoleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleGroupBy) Int

func (s *RoleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) IntX

func (s *RoleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleGroupBy) Ints

func (s *RoleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) IntsX

func (s *RoleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RoleGroupBy) Scan

func (rgb *RoleGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*RoleGroupBy) ScanX

func (s *RoleGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*RoleGroupBy) String

func (s *RoleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) StringX

func (s *RoleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleGroupBy) Strings

func (s *RoleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RoleGroupBy) StringsX

func (s *RoleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RoleMutation

type RoleMutation struct {
	// contains filtered or unexported fields
}

RoleMutation represents an operation that mutates the Role nodes in the graph.

func (*RoleMutation) AccessPoliciesCleared

func (m *RoleMutation) AccessPoliciesCleared() bool

AccessPoliciesCleared reports if the "access_policies" edge to the AccessPolicy entity was cleared.

func (*RoleMutation) AccessPoliciesIDs

func (m *RoleMutation) AccessPoliciesIDs() (ids []uuid.UUID)

AccessPoliciesIDs returns the "access_policies" edge IDs in the mutation.

func (*RoleMutation) AccountCleared

func (m *RoleMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*RoleMutation) AccountID

func (m *RoleMutation) AccountID() (id uuid.UUID, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*RoleMutation) AccountIDs

func (m *RoleMutation) AccountIDs() (ids []uuid.UUID)

AccountIDs returns the "account" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AccountID instead. It exists only for internal usage by the builders.

func (*RoleMutation) AddAccessPolicyIDs

func (m *RoleMutation) AddAccessPolicyIDs(ids ...uuid.UUID)

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by ids.

func (*RoleMutation) AddChildRoleIDs

func (m *RoleMutation) AddChildRoleIDs(ids ...uuid.UUID)

AddChildRoleIDs adds the "child_roles" edge to the Role entity by ids.

func (*RoleMutation) AddField

func (m *RoleMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RoleMutation) AddParentRoleIDs

func (m *RoleMutation) AddParentRoleIDs(ids ...uuid.UUID)

AddParentRoleIDs adds the "parent_role" edge to the Role entity by ids.

func (*RoleMutation) AddUserIDs

func (m *RoleMutation) AddUserIDs(ids ...uuid.UUID)

AddUserIDs adds the "users" edge to the User entity by ids.

func (*RoleMutation) AddedEdges

func (m *RoleMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*RoleMutation) AddedField

func (m *RoleMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RoleMutation) AddedFields

func (m *RoleMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*RoleMutation) AddedIDs

func (m *RoleMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*RoleMutation) ChildRolesCleared

func (m *RoleMutation) ChildRolesCleared() bool

ChildRolesCleared reports if the "child_roles" edge to the Role entity was cleared.

func (*RoleMutation) ChildRolesIDs

func (m *RoleMutation) ChildRolesIDs() (ids []uuid.UUID)

ChildRolesIDs returns the "child_roles" edge IDs in the mutation.

func (*RoleMutation) ClearAccessPolicies

func (m *RoleMutation) ClearAccessPolicies()

ClearAccessPolicies clears the "access_policies" edge to the AccessPolicy entity.

func (*RoleMutation) ClearAccount

func (m *RoleMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*RoleMutation) ClearChildRoles

func (m *RoleMutation) ClearChildRoles()

ClearChildRoles clears the "child_roles" edge to the Role entity.

func (*RoleMutation) ClearDescription

func (m *RoleMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*RoleMutation) ClearEdge

func (m *RoleMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*RoleMutation) ClearField

func (m *RoleMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*RoleMutation) ClearParentRole

func (m *RoleMutation) ClearParentRole()

ClearParentRole clears the "parent_role" edge to the Role entity.

func (*RoleMutation) ClearUsers

func (m *RoleMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*RoleMutation) ClearedEdges

func (m *RoleMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*RoleMutation) ClearedFields

func (m *RoleMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (RoleMutation) Client

func (m RoleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*RoleMutation) CreatedAt

func (m *RoleMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*RoleMutation) Description

func (m *RoleMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*RoleMutation) DescriptionCleared

func (m *RoleMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*RoleMutation) EdgeCleared

func (m *RoleMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*RoleMutation) Field

func (m *RoleMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RoleMutation) FieldCleared

func (m *RoleMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*RoleMutation) Fields

func (m *RoleMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*RoleMutation) ID

func (m *RoleMutation) ID() (id 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 (*RoleMutation) IDs

func (m *RoleMutation) 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 (*RoleMutation) IsDefault

func (m *RoleMutation) IsDefault() (r bool, exists bool)

IsDefault returns the value of the "is_default" field in the mutation.

func (*RoleMutation) IsDisabled

func (m *RoleMutation) IsDisabled() (r bool, exists bool)

IsDisabled returns the value of the "is_disabled" field in the mutation.

func (*RoleMutation) Name

func (m *RoleMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*RoleMutation) OldCreatedAt

func (m *RoleMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldDescription

func (m *RoleMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldField

func (m *RoleMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*RoleMutation) OldIsDefault

func (m *RoleMutation) OldIsDefault(ctx context.Context) (v bool, err error)

OldIsDefault returns the old "is_default" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldIsDisabled

func (m *RoleMutation) OldIsDisabled(ctx context.Context) (v bool, err error)

OldIsDisabled returns the old "is_disabled" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldName

func (m *RoleMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldUpdatedAt

func (m *RoleMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) Op

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) ParentRoleCleared

func (m *RoleMutation) ParentRoleCleared() bool

ParentRoleCleared reports if the "parent_role" edge to the Role entity was cleared.

func (*RoleMutation) ParentRoleIDs

func (m *RoleMutation) ParentRoleIDs() (ids []uuid.UUID)

ParentRoleIDs returns the "parent_role" edge IDs in the mutation.

func (*RoleMutation) RemoveAccessPolicyIDs

func (m *RoleMutation) RemoveAccessPolicyIDs(ids ...uuid.UUID)

RemoveAccessPolicyIDs removes the "access_policies" edge to the AccessPolicy entity by IDs.

func (*RoleMutation) RemoveChildRoleIDs

func (m *RoleMutation) RemoveChildRoleIDs(ids ...uuid.UUID)

RemoveChildRoleIDs removes the "child_roles" edge to the Role entity by IDs.

func (*RoleMutation) RemoveParentRoleIDs

func (m *RoleMutation) RemoveParentRoleIDs(ids ...uuid.UUID)

RemoveParentRoleIDs removes the "parent_role" edge to the Role entity by IDs.

func (*RoleMutation) RemoveUserIDs

func (m *RoleMutation) RemoveUserIDs(ids ...uuid.UUID)

RemoveUserIDs removes the "users" edge to the User entity by IDs.

func (*RoleMutation) RemovedAccessPoliciesIDs

func (m *RoleMutation) RemovedAccessPoliciesIDs() (ids []uuid.UUID)

RemovedAccessPolicies returns the removed IDs of the "access_policies" edge to the AccessPolicy entity.

func (*RoleMutation) RemovedChildRolesIDs

func (m *RoleMutation) RemovedChildRolesIDs() (ids []uuid.UUID)

RemovedChildRoles returns the removed IDs of the "child_roles" edge to the Role entity.

func (*RoleMutation) RemovedEdges

func (m *RoleMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*RoleMutation) RemovedIDs

func (m *RoleMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*RoleMutation) RemovedParentRoleIDs

func (m *RoleMutation) RemovedParentRoleIDs() (ids []uuid.UUID)

RemovedParentRole returns the removed IDs of the "parent_role" edge to the Role entity.

func (*RoleMutation) RemovedUsersIDs

func (m *RoleMutation) RemovedUsersIDs() (ids []uuid.UUID)

RemovedUsers returns the removed IDs of the "users" edge to the User entity.

func (*RoleMutation) ResetAccessPolicies

func (m *RoleMutation) ResetAccessPolicies()

ResetAccessPolicies resets all changes to the "access_policies" edge.

func (*RoleMutation) ResetAccount

func (m *RoleMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*RoleMutation) ResetChildRoles

func (m *RoleMutation) ResetChildRoles()

ResetChildRoles resets all changes to the "child_roles" edge.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetDescription

func (m *RoleMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RoleMutation) ResetEdge

func (m *RoleMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*RoleMutation) ResetField

func (m *RoleMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*RoleMutation) ResetIsDefault

func (m *RoleMutation) ResetIsDefault()

ResetIsDefault resets all changes to the "is_default" field.

func (*RoleMutation) ResetIsDisabled

func (m *RoleMutation) ResetIsDisabled()

ResetIsDisabled resets all changes to the "is_disabled" field.

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetParentRole

func (m *RoleMutation) ResetParentRole()

ResetParentRole resets all changes to the "parent_role" edge.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) ResetUsers

func (m *RoleMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*RoleMutation) SetAccountID

func (m *RoleMutation) SetAccountID(id uuid.UUID)

SetAccountID sets the "account" edge to the Account entity by id.

func (*RoleMutation) SetCreatedAt

func (m *RoleMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetDescription

func (m *RoleMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RoleMutation) SetField

func (m *RoleMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RoleMutation) SetID

func (m *RoleMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Role entities.

func (*RoleMutation) SetIsDefault

func (m *RoleMutation) SetIsDefault(b bool)

SetIsDefault sets the "is_default" field.

func (*RoleMutation) SetIsDisabled

func (m *RoleMutation) SetIsDisabled(b bool)

SetIsDisabled sets the "is_disabled" field.

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetOp

func (m *RoleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RoleMutation) SetUpdatedAt

func (m *RoleMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (RoleMutation) Tx

func (m RoleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*RoleMutation) Type

func (m *RoleMutation) Type() string

Type returns the node type of this mutation (Role).

func (*RoleMutation) UpdatedAt

func (m *RoleMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*RoleMutation) UsersCleared

func (m *RoleMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*RoleMutation) UsersIDs

func (m *RoleMutation) UsersIDs() (ids []uuid.UUID)

UsersIDs returns the "users" edge IDs in the mutation.

func (*RoleMutation) Where

func (m *RoleMutation) Where(ps ...predicate.Role)

Where appends a list predicates to the RoleMutation builder.

func (*RoleMutation) WhereP

func (m *RoleMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the RoleMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type RoleQuery

type RoleQuery struct {
	// contains filtered or unexported fields
}

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) Aggregate

func (rq *RoleQuery) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate returns a RoleSelect configured with the given aggregations.

func (*RoleQuery) All

func (rq *RoleQuery) All(ctx context.Context) ([]*Role, error)

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

func (rq *RoleQuery) AllX(ctx context.Context) []*Role

AllX is like All, but panics if an error occurs.

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

Clone returns a duplicate of the RoleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*RoleQuery) Count

func (rq *RoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RoleQuery) CountX

func (rq *RoleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*RoleQuery) Exist

func (rq *RoleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*RoleQuery) ExistX

func (rq *RoleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*RoleQuery) First

func (rq *RoleQuery) First(ctx context.Context) (*Role, error)

First returns the first Role entity from the query. Returns a *NotFoundError when no Role was found.

func (*RoleQuery) FirstID

func (rq *RoleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Role ID from the query. Returns a *NotFoundError when no Role ID was found.

func (*RoleQuery) FirstIDX

func (rq *RoleQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*RoleQuery) FirstX

func (rq *RoleQuery) FirstX(ctx context.Context) *Role

FirstX is like First, but panics if an error occurs.

func (*RoleQuery) GroupBy

func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Role.Query().
	GroupBy(role.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of Role IDs.

func (*RoleQuery) IDsX

func (rq *RoleQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*RoleQuery) Limit

func (rq *RoleQuery) Limit(limit int) *RoleQuery

Limit the number of records to be returned by this query.

func (*RoleQuery) Offset

func (rq *RoleQuery) Offset(offset int) *RoleQuery

Offset to start from.

func (*RoleQuery) Only

func (rq *RoleQuery) Only(ctx context.Context) (*Role, error)

Only returns a single Role entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Role entity is found. Returns a *NotFoundError when no Role entities are found.

func (*RoleQuery) OnlyID

func (rq *RoleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Role ID in the query. Returns a *NotSingularError when more than one Role ID is found. Returns a *NotFoundError when no entities are found.

func (*RoleQuery) OnlyIDX

func (rq *RoleQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*RoleQuery) OnlyX

func (rq *RoleQuery) OnlyX(ctx context.Context) *Role

OnlyX is like Only, but panics if an error occurs.

func (*RoleQuery) Order

func (rq *RoleQuery) Order(o ...role.OrderOption) *RoleQuery

Order specifies how the records should be ordered.

func (*RoleQuery) QueryAccessPolicies

func (rq *RoleQuery) QueryAccessPolicies() *AccessPolicyQuery

QueryAccessPolicies chains the current query on the "access_policies" edge.

func (*RoleQuery) QueryAccount

func (rq *RoleQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*RoleQuery) QueryChildRoles

func (rq *RoleQuery) QueryChildRoles() *RoleQuery

QueryChildRoles chains the current query on the "child_roles" edge.

func (*RoleQuery) QueryParentRole

func (rq *RoleQuery) QueryParentRole() *RoleQuery

QueryParentRole chains the current query on the "parent_role" edge.

func (*RoleQuery) QueryUsers

func (rq *RoleQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*RoleQuery) Select

func (rq *RoleQuery) Select(fields ...string) *RoleSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Role.Query().
	Select(role.FieldCreatedAt).
	Scan(ctx, &v)

func (*RoleQuery) Unique

func (rq *RoleQuery) Unique(unique bool) *RoleQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*RoleQuery) Where

func (rq *RoleQuery) Where(ps ...predicate.Role) *RoleQuery

Where adds a new predicate for the RoleQuery builder.

func (*RoleQuery) WithAccessPolicies

func (rq *RoleQuery) WithAccessPolicies(opts ...func(*AccessPolicyQuery)) *RoleQuery

WithAccessPolicies tells the query-builder to eager-load the nodes that are connected to the "access_policies" edge. The optional arguments are used to configure the query builder of the edge.

func (*RoleQuery) WithAccount

func (rq *RoleQuery) WithAccount(opts ...func(*AccountQuery)) *RoleQuery

WithAccount tells the query-builder to eager-load the nodes that are connected to the "account" edge. The optional arguments are used to configure the query builder of the edge.

func (*RoleQuery) WithChildRoles

func (rq *RoleQuery) WithChildRoles(opts ...func(*RoleQuery)) *RoleQuery

WithChildRoles tells the query-builder to eager-load the nodes that are connected to the "child_roles" edge. The optional arguments are used to configure the query builder of the edge.

func (*RoleQuery) WithParentRole

func (rq *RoleQuery) WithParentRole(opts ...func(*RoleQuery)) *RoleQuery

WithParentRole tells the query-builder to eager-load the nodes that are connected to the "parent_role" edge. The optional arguments are used to configure the query builder of the edge.

func (*RoleQuery) WithUsers

func (rq *RoleQuery) WithUsers(opts ...func(*UserQuery)) *RoleQuery

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 RoleSelect

type RoleSelect struct {
	*RoleQuery
	// contains filtered or unexported fields
}

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Aggregate

func (rs *RoleSelect) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RoleSelect) Bool

func (s *RoleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RoleSelect) BoolX

func (s *RoleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleSelect) Bools

func (s *RoleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RoleSelect) BoolsX

func (s *RoleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleSelect) Float64

func (s *RoleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RoleSelect) Float64X

func (s *RoleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleSelect) Float64s

func (s *RoleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RoleSelect) Float64sX

func (s *RoleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleSelect) Int

func (s *RoleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RoleSelect) IntX

func (s *RoleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleSelect) Ints

func (s *RoleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RoleSelect) IntsX

func (s *RoleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RoleSelect) Scan

func (rs *RoleSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*RoleSelect) ScanX

func (s *RoleSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*RoleSelect) String

func (s *RoleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RoleSelect) StringX

func (s *RoleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleSelect) Strings

func (s *RoleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RoleSelect) StringsX

func (s *RoleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RoleUpdate

type RoleUpdate struct {
	// contains filtered or unexported fields
}

RoleUpdate is the builder for updating Role entities.

func (*RoleUpdate) AddAccessPolicies

func (ru *RoleUpdate) AddAccessPolicies(a ...*AccessPolicy) *RoleUpdate

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*RoleUpdate) AddAccessPolicyIDs

func (ru *RoleUpdate) AddAccessPolicyIDs(ids ...uuid.UUID) *RoleUpdate

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*RoleUpdate) AddChildRoleIDs

func (ru *RoleUpdate) AddChildRoleIDs(ids ...uuid.UUID) *RoleUpdate

AddChildRoleIDs adds the "child_roles" edge to the Role entity by IDs.

func (*RoleUpdate) AddChildRoles

func (ru *RoleUpdate) AddChildRoles(r ...*Role) *RoleUpdate

AddChildRoles adds the "child_roles" edges to the Role entity.

func (*RoleUpdate) AddParentRole

func (ru *RoleUpdate) AddParentRole(r ...*Role) *RoleUpdate

AddParentRole adds the "parent_role" edges to the Role entity.

func (*RoleUpdate) AddParentRoleIDs

func (ru *RoleUpdate) AddParentRoleIDs(ids ...uuid.UUID) *RoleUpdate

AddParentRoleIDs adds the "parent_role" edge to the Role entity by IDs.

func (*RoleUpdate) AddUserIDs

func (ru *RoleUpdate) AddUserIDs(ids ...uuid.UUID) *RoleUpdate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleUpdate) AddUsers

func (ru *RoleUpdate) AddUsers(u ...*User) *RoleUpdate

AddUsers adds the "users" edges to the User entity.

func (*RoleUpdate) ClearAccessPolicies

func (ru *RoleUpdate) ClearAccessPolicies() *RoleUpdate

ClearAccessPolicies clears all "access_policies" edges to the AccessPolicy entity.

func (*RoleUpdate) ClearAccount

func (ru *RoleUpdate) ClearAccount() *RoleUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*RoleUpdate) ClearChildRoles

func (ru *RoleUpdate) ClearChildRoles() *RoleUpdate

ClearChildRoles clears all "child_roles" edges to the Role entity.

func (*RoleUpdate) ClearDescription

func (ru *RoleUpdate) ClearDescription() *RoleUpdate

ClearDescription clears the value of the "description" field.

func (*RoleUpdate) ClearParentRole

func (ru *RoleUpdate) ClearParentRole() *RoleUpdate

ClearParentRole clears all "parent_role" edges to the Role entity.

func (*RoleUpdate) ClearUsers

func (ru *RoleUpdate) ClearUsers() *RoleUpdate

ClearUsers clears all "users" edges to the User entity.

func (*RoleUpdate) Exec

func (ru *RoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpdate) ExecX

func (ru *RoleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpdate) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) RemoveAccessPolicies

func (ru *RoleUpdate) RemoveAccessPolicies(a ...*AccessPolicy) *RoleUpdate

RemoveAccessPolicies removes "access_policies" edges to AccessPolicy entities.

func (*RoleUpdate) RemoveAccessPolicyIDs

func (ru *RoleUpdate) RemoveAccessPolicyIDs(ids ...uuid.UUID) *RoleUpdate

RemoveAccessPolicyIDs removes the "access_policies" edge to AccessPolicy entities by IDs.

func (*RoleUpdate) RemoveChildRoleIDs

func (ru *RoleUpdate) RemoveChildRoleIDs(ids ...uuid.UUID) *RoleUpdate

RemoveChildRoleIDs removes the "child_roles" edge to Role entities by IDs.

func (*RoleUpdate) RemoveChildRoles

func (ru *RoleUpdate) RemoveChildRoles(r ...*Role) *RoleUpdate

RemoveChildRoles removes "child_roles" edges to Role entities.

func (*RoleUpdate) RemoveParentRole

func (ru *RoleUpdate) RemoveParentRole(r ...*Role) *RoleUpdate

RemoveParentRole removes "parent_role" edges to Role entities.

func (*RoleUpdate) RemoveParentRoleIDs

func (ru *RoleUpdate) RemoveParentRoleIDs(ids ...uuid.UUID) *RoleUpdate

RemoveParentRoleIDs removes the "parent_role" edge to Role entities by IDs.

func (*RoleUpdate) RemoveUserIDs

func (ru *RoleUpdate) RemoveUserIDs(ids ...uuid.UUID) *RoleUpdate

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*RoleUpdate) RemoveUsers

func (ru *RoleUpdate) RemoveUsers(u ...*User) *RoleUpdate

RemoveUsers removes "users" edges to User entities.

func (*RoleUpdate) Save

func (ru *RoleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*RoleUpdate) SaveX

func (ru *RoleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*RoleUpdate) SetAccount

func (ru *RoleUpdate) SetAccount(a *Account) *RoleUpdate

SetAccount sets the "account" edge to the Account entity.

func (*RoleUpdate) SetAccountID

func (ru *RoleUpdate) SetAccountID(id uuid.UUID) *RoleUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*RoleUpdate) SetDescription

func (ru *RoleUpdate) SetDescription(s string) *RoleUpdate

SetDescription sets the "description" field.

func (*RoleUpdate) SetIsDefault

func (ru *RoleUpdate) SetIsDefault(b bool) *RoleUpdate

SetIsDefault sets the "is_default" field.

func (*RoleUpdate) SetIsDisabled

func (ru *RoleUpdate) SetIsDisabled(b bool) *RoleUpdate

SetIsDisabled sets the "is_disabled" field.

func (*RoleUpdate) SetName

func (ru *RoleUpdate) SetName(s string) *RoleUpdate

SetName sets the "name" field.

func (*RoleUpdate) SetNillableAccountID

func (ru *RoleUpdate) SetNillableAccountID(id *uuid.UUID) *RoleUpdate

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*RoleUpdate) SetNillableDescription

func (ru *RoleUpdate) SetNillableDescription(s *string) *RoleUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleUpdate) SetNillableIsDefault

func (ru *RoleUpdate) SetNillableIsDefault(b *bool) *RoleUpdate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*RoleUpdate) SetNillableIsDisabled

func (ru *RoleUpdate) SetNillableIsDisabled(b *bool) *RoleUpdate

SetNillableIsDisabled sets the "is_disabled" field if the given value is not nil.

func (*RoleUpdate) SetNillableName

func (ru *RoleUpdate) SetNillableName(s *string) *RoleUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*RoleUpdate) SetUpdatedAt

func (ru *RoleUpdate) SetUpdatedAt(t time.Time) *RoleUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

type RoleUpdateOne struct {
	// contains filtered or unexported fields
}

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) AddAccessPolicies

func (ruo *RoleUpdateOne) AddAccessPolicies(a ...*AccessPolicy) *RoleUpdateOne

AddAccessPolicies adds the "access_policies" edges to the AccessPolicy entity.

func (*RoleUpdateOne) AddAccessPolicyIDs

func (ruo *RoleUpdateOne) AddAccessPolicyIDs(ids ...uuid.UUID) *RoleUpdateOne

AddAccessPolicyIDs adds the "access_policies" edge to the AccessPolicy entity by IDs.

func (*RoleUpdateOne) AddChildRoleIDs

func (ruo *RoleUpdateOne) AddChildRoleIDs(ids ...uuid.UUID) *RoleUpdateOne

AddChildRoleIDs adds the "child_roles" edge to the Role entity by IDs.

func (*RoleUpdateOne) AddChildRoles

func (ruo *RoleUpdateOne) AddChildRoles(r ...*Role) *RoleUpdateOne

AddChildRoles adds the "child_roles" edges to the Role entity.

func (*RoleUpdateOne) AddParentRole

func (ruo *RoleUpdateOne) AddParentRole(r ...*Role) *RoleUpdateOne

AddParentRole adds the "parent_role" edges to the Role entity.

func (*RoleUpdateOne) AddParentRoleIDs

func (ruo *RoleUpdateOne) AddParentRoleIDs(ids ...uuid.UUID) *RoleUpdateOne

AddParentRoleIDs adds the "parent_role" edge to the Role entity by IDs.

func (*RoleUpdateOne) AddUserIDs

func (ruo *RoleUpdateOne) AddUserIDs(ids ...uuid.UUID) *RoleUpdateOne

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleUpdateOne) AddUsers

func (ruo *RoleUpdateOne) AddUsers(u ...*User) *RoleUpdateOne

AddUsers adds the "users" edges to the User entity.

func (*RoleUpdateOne) ClearAccessPolicies

func (ruo *RoleUpdateOne) ClearAccessPolicies() *RoleUpdateOne

ClearAccessPolicies clears all "access_policies" edges to the AccessPolicy entity.

func (*RoleUpdateOne) ClearAccount

func (ruo *RoleUpdateOne) ClearAccount() *RoleUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*RoleUpdateOne) ClearChildRoles

func (ruo *RoleUpdateOne) ClearChildRoles() *RoleUpdateOne

ClearChildRoles clears all "child_roles" edges to the Role entity.

func (*RoleUpdateOne) ClearDescription

func (ruo *RoleUpdateOne) ClearDescription() *RoleUpdateOne

ClearDescription clears the value of the "description" field.

func (*RoleUpdateOne) ClearParentRole

func (ruo *RoleUpdateOne) ClearParentRole() *RoleUpdateOne

ClearParentRole clears all "parent_role" edges to the Role entity.

func (*RoleUpdateOne) ClearUsers

func (ruo *RoleUpdateOne) ClearUsers() *RoleUpdateOne

ClearUsers clears all "users" edges to the User entity.

func (*RoleUpdateOne) Exec

func (ruo *RoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RoleUpdateOne) ExecX

func (ruo *RoleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RoleUpdateOne) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) RemoveAccessPolicies

func (ruo *RoleUpdateOne) RemoveAccessPolicies(a ...*AccessPolicy) *RoleUpdateOne

RemoveAccessPolicies removes "access_policies" edges to AccessPolicy entities.

func (*RoleUpdateOne) RemoveAccessPolicyIDs

func (ruo *RoleUpdateOne) RemoveAccessPolicyIDs(ids ...uuid.UUID) *RoleUpdateOne

RemoveAccessPolicyIDs removes the "access_policies" edge to AccessPolicy entities by IDs.

func (*RoleUpdateOne) RemoveChildRoleIDs

func (ruo *RoleUpdateOne) RemoveChildRoleIDs(ids ...uuid.UUID) *RoleUpdateOne

RemoveChildRoleIDs removes the "child_roles" edge to Role entities by IDs.

func (*RoleUpdateOne) RemoveChildRoles

func (ruo *RoleUpdateOne) RemoveChildRoles(r ...*Role) *RoleUpdateOne

RemoveChildRoles removes "child_roles" edges to Role entities.

func (*RoleUpdateOne) RemoveParentRole

func (ruo *RoleUpdateOne) RemoveParentRole(r ...*Role) *RoleUpdateOne

RemoveParentRole removes "parent_role" edges to Role entities.

func (*RoleUpdateOne) RemoveParentRoleIDs

func (ruo *RoleUpdateOne) RemoveParentRoleIDs(ids ...uuid.UUID) *RoleUpdateOne

RemoveParentRoleIDs removes the "parent_role" edge to Role entities by IDs.

func (*RoleUpdateOne) RemoveUserIDs

func (ruo *RoleUpdateOne) RemoveUserIDs(ids ...uuid.UUID) *RoleUpdateOne

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*RoleUpdateOne) RemoveUsers

func (ruo *RoleUpdateOne) RemoveUsers(u ...*User) *RoleUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*RoleUpdateOne) Save

func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role

SaveX is like Save, but panics if an error occurs.

func (*RoleUpdateOne) Select

func (ruo *RoleUpdateOne) Select(field string, fields ...string) *RoleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*RoleUpdateOne) SetAccount

func (ruo *RoleUpdateOne) SetAccount(a *Account) *RoleUpdateOne

SetAccount sets the "account" edge to the Account entity.

func (*RoleUpdateOne) SetAccountID

func (ruo *RoleUpdateOne) SetAccountID(id uuid.UUID) *RoleUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*RoleUpdateOne) SetDescription

func (ruo *RoleUpdateOne) SetDescription(s string) *RoleUpdateOne

SetDescription sets the "description" field.

func (*RoleUpdateOne) SetIsDefault

func (ruo *RoleUpdateOne) SetIsDefault(b bool) *RoleUpdateOne

SetIsDefault sets the "is_default" field.

func (*RoleUpdateOne) SetIsDisabled

func (ruo *RoleUpdateOne) SetIsDisabled(b bool) *RoleUpdateOne

SetIsDisabled sets the "is_disabled" field.

func (*RoleUpdateOne) SetName

func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableAccountID

func (ruo *RoleUpdateOne) SetNillableAccountID(id *uuid.UUID) *RoleUpdateOne

SetNillableAccountID sets the "account" edge to the Account entity by ID if the given value is not nil.

func (*RoleUpdateOne) SetNillableDescription

func (ruo *RoleUpdateOne) SetNillableDescription(s *string) *RoleUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableIsDefault

func (ruo *RoleUpdateOne) SetNillableIsDefault(b *bool) *RoleUpdateOne

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableIsDisabled

func (ruo *RoleUpdateOne) SetNillableIsDisabled(b *bool) *RoleUpdateOne

SetNillableIsDisabled sets the "is_disabled" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableName

func (ruo *RoleUpdateOne) SetNillableName(s *string) *RoleUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*RoleUpdateOne) SetUpdatedAt

func (ruo *RoleUpdateOne) SetUpdatedAt(t time.Time) *RoleUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdateOne) Where

func (ruo *RoleUpdateOne) Where(ps ...predicate.Role) *RoleUpdateOne

Where appends a list predicates to the RoleUpdate builder.

type Roles

type Roles []*Role

Roles is a parsable slice of Role.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Tenant

type Tenant struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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"`
	// Status holds the value of the "status" field.
	Status tenant.Status `json:"status,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TenantQuery when eager-loading is set.
	Edges TenantEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tenant is the model entity for the Tenant schema.

func (*Tenant) QueryAccounts

func (t *Tenant) QueryAccounts() *AccountQuery

QueryAccounts queries the "accounts" edge of the Tenant entity.

func (*Tenant) QueryAuditLogs

func (t *Tenant) QueryAuditLogs() *AuditLogQuery

QueryAuditLogs queries the "audit_logs" edge of the Tenant entity.

func (*Tenant) QueryPlatform

func (t *Tenant) QueryPlatform() *PlatformQuery

QueryPlatform queries the "platform" edge of the Tenant entity.

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) Unwrap

func (t *Tenant) Unwrap() *Tenant

Unwrap unwraps the Tenant 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 (*Tenant) Update

func (t *Tenant) Update() *TenantUpdateOne

Update returns a builder for updating this Tenant. Note that you need to call Tenant.Unwrap() before calling this method if this Tenant was returned from a transaction, and the transaction was committed or rolled back.

func (*Tenant) Value

func (t *Tenant) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Tenant. This includes values selected through modifiers, order, etc.

type TenantClient

type TenantClient struct {
	// contains filtered or unexported fields
}

TenantClient is a client for the Tenant schema.

func NewTenantClient

func NewTenantClient(c config) *TenantClient

NewTenantClient returns a client for the Tenant from the given config.

func (*TenantClient) Create

func (c *TenantClient) Create() *TenantCreate

Create returns a builder for creating a Tenant entity.

func (*TenantClient) CreateBulk

func (c *TenantClient) CreateBulk(builders ...*TenantCreate) *TenantCreateBulk

CreateBulk returns a builder for creating a bulk of Tenant entities.

func (*TenantClient) Delete

func (c *TenantClient) Delete() *TenantDelete

Delete returns a delete builder for Tenant.

func (*TenantClient) DeleteOne

func (c *TenantClient) DeleteOne(t *Tenant) *TenantDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TenantClient) DeleteOneID

func (c *TenantClient) DeleteOneID(id uuid.UUID) *TenantDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*TenantClient) Get

func (c *TenantClient) Get(ctx context.Context, id uuid.UUID) (*Tenant, error)

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

func (c *TenantClient) GetX(ctx context.Context, id uuid.UUID) *Tenant

GetX is like Get, but panics if an error occurs.

func (*TenantClient) Hooks

func (c *TenantClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TenantClient) Intercept

func (c *TenantClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `tenant.Intercept(f(g(h())))`.

func (*TenantClient) Interceptors

func (c *TenantClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*TenantClient) MapCreateBulk

func (c *TenantClient) MapCreateBulk(slice any, setFunc func(*TenantCreate, int)) *TenantCreateBulk

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 (*TenantClient) Query

func (c *TenantClient) Query() *TenantQuery

Query returns a query builder for Tenant.

func (*TenantClient) QueryAccounts

func (c *TenantClient) QueryAccounts(t *Tenant) *AccountQuery

QueryAccounts queries the accounts edge of a Tenant.

func (*TenantClient) QueryAuditLogs

func (c *TenantClient) QueryAuditLogs(t *Tenant) *AuditLogQuery

QueryAuditLogs queries the audit_logs edge of a Tenant.

func (*TenantClient) QueryPlatform

func (c *TenantClient) QueryPlatform(t *Tenant) *PlatformQuery

QueryPlatform queries the platform edge of a Tenant.

func (*TenantClient) Update

func (c *TenantClient) Update() *TenantUpdate

Update returns an update builder for Tenant.

func (*TenantClient) UpdateOne

func (c *TenantClient) UpdateOne(t *Tenant) *TenantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TenantClient) UpdateOneID

func (c *TenantClient) UpdateOneID(id uuid.UUID) *TenantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TenantClient) Use

func (c *TenantClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `tenant.Hooks(f(g(h())))`.

type TenantCreate

type TenantCreate struct {
	// contains filtered or unexported fields
}

TenantCreate is the builder for creating a Tenant entity.

func (*TenantCreate) AddAuditLogIDs

func (tc *TenantCreate) AddAuditLogIDs(ids ...uuid.UUID) *TenantCreate

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*TenantCreate) AddAuditLogs

func (tc *TenantCreate) AddAuditLogs(a ...*AuditLog) *TenantCreate

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*TenantCreate) Exec

func (tc *TenantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreate) ExecX

func (tc *TenantCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantCreate) Mutation

func (tc *TenantCreate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantCreate) Save

func (tc *TenantCreate) Save(ctx context.Context) (*Tenant, error)

Save creates the Tenant in the database.

func (*TenantCreate) SaveX

func (tc *TenantCreate) SaveX(ctx context.Context) *Tenant

SaveX calls Save and panics if Save returns an error.

func (*TenantCreate) SetAccounts

func (tc *TenantCreate) SetAccounts(a *Account) *TenantCreate

SetAccounts sets the "accounts" edge to the Account entity.

func (*TenantCreate) SetAccountsID

func (tc *TenantCreate) SetAccountsID(id uuid.UUID) *TenantCreate

SetAccountsID sets the "accounts" edge to the Account entity by ID.

func (*TenantCreate) SetCreatedAt

func (tc *TenantCreate) SetCreatedAt(t time.Time) *TenantCreate

SetCreatedAt sets the "created_at" field.

func (*TenantCreate) SetDescription

func (tc *TenantCreate) SetDescription(s string) *TenantCreate

SetDescription sets the "description" field.

func (*TenantCreate) SetID

func (tc *TenantCreate) SetID(u uuid.UUID) *TenantCreate

SetID sets the "id" field.

func (*TenantCreate) SetName

func (tc *TenantCreate) SetName(s string) *TenantCreate

SetName sets the "name" field.

func (*TenantCreate) SetNillableAccountsID

func (tc *TenantCreate) SetNillableAccountsID(id *uuid.UUID) *TenantCreate

SetNillableAccountsID sets the "accounts" edge to the Account entity by ID if the given value is not nil.

func (*TenantCreate) SetNillableCreatedAt

func (tc *TenantCreate) SetNillableCreatedAt(t *time.Time) *TenantCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TenantCreate) SetNillableDescription

func (tc *TenantCreate) SetNillableDescription(s *string) *TenantCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TenantCreate) SetNillableID

func (tc *TenantCreate) SetNillableID(u *uuid.UUID) *TenantCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*TenantCreate) SetNillableStatus

func (tc *TenantCreate) SetNillableStatus(t *tenant.Status) *TenantCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TenantCreate) SetNillableUpdatedAt

func (tc *TenantCreate) SetNillableUpdatedAt(t *time.Time) *TenantCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TenantCreate) SetPlatform

func (tc *TenantCreate) SetPlatform(p *Platform) *TenantCreate

SetPlatform sets the "platform" edge to the Platform entity.

func (*TenantCreate) SetPlatformID

func (tc *TenantCreate) SetPlatformID(id uuid.UUID) *TenantCreate

SetPlatformID sets the "platform" edge to the Platform entity by ID.

func (*TenantCreate) SetStatus

func (tc *TenantCreate) SetStatus(t tenant.Status) *TenantCreate

SetStatus sets the "status" field.

func (*TenantCreate) SetUpdatedAt

func (tc *TenantCreate) SetUpdatedAt(t time.Time) *TenantCreate

SetUpdatedAt sets the "updated_at" field.

type TenantCreateBulk

type TenantCreateBulk struct {
	// contains filtered or unexported fields
}

TenantCreateBulk is the builder for creating many Tenant entities in bulk.

func (*TenantCreateBulk) Exec

func (tcb *TenantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreateBulk) ExecX

func (tcb *TenantCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantCreateBulk) Save

func (tcb *TenantCreateBulk) Save(ctx context.Context) ([]*Tenant, error)

Save creates the Tenant entities in the database.

func (*TenantCreateBulk) SaveX

func (tcb *TenantCreateBulk) SaveX(ctx context.Context) []*Tenant

SaveX is like Save, but panics if an error occurs.

type TenantDelete

type TenantDelete struct {
	// contains filtered or unexported fields
}

TenantDelete is the builder for deleting a Tenant entity.

func (*TenantDelete) Exec

func (td *TenantDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TenantDelete) ExecX

func (td *TenantDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TenantDelete) Where

func (td *TenantDelete) Where(ps ...predicate.Tenant) *TenantDelete

Where appends a list predicates to the TenantDelete builder.

type TenantDeleteOne

type TenantDeleteOne struct {
	// contains filtered or unexported fields
}

TenantDeleteOne is the builder for deleting a single Tenant entity.

func (*TenantDeleteOne) Exec

func (tdo *TenantDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TenantDeleteOne) ExecX

func (tdo *TenantDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantDeleteOne) Where

func (tdo *TenantDeleteOne) Where(ps ...predicate.Tenant) *TenantDeleteOne

Where appends a list predicates to the TenantDelete builder.

type TenantEdges

type TenantEdges struct {
	// 租户所属的平台
	Platform *Platform `json:"platform,omitempty"`
	// 租户的账户
	Accounts *Account `json:"accounts,omitempty"`
	// 租户的审计日志
	AuditLogs []*AuditLog `json:"audit_logs,omitempty"`
	// contains filtered or unexported fields
}

TenantEdges holds the relations/edges for other nodes in the graph.

func (TenantEdges) AccountsOrErr

func (e TenantEdges) AccountsOrErr() (*Account, error)

AccountsOrErr returns the Accounts value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (TenantEdges) AuditLogsOrErr

func (e TenantEdges) AuditLogsOrErr() ([]*AuditLog, error)

AuditLogsOrErr returns the AuditLogs value or an error if the edge was not loaded in eager-loading.

func (TenantEdges) PlatformOrErr

func (e TenantEdges) PlatformOrErr() (*Platform, error)

PlatformOrErr returns the Platform value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type TenantGroupBy

type TenantGroupBy struct {
	// contains filtered or unexported fields
}

TenantGroupBy is the group-by builder for Tenant entities.

func (*TenantGroupBy) Aggregate

func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TenantGroupBy) Bool

func (s *TenantGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) BoolX

func (s *TenantGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TenantGroupBy) Bools

func (s *TenantGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) BoolsX

func (s *TenantGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TenantGroupBy) Float64

func (s *TenantGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) Float64X

func (s *TenantGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TenantGroupBy) Float64s

func (s *TenantGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) Float64sX

func (s *TenantGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TenantGroupBy) Int

func (s *TenantGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) IntX

func (s *TenantGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TenantGroupBy) Ints

func (s *TenantGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) IntsX

func (s *TenantGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TenantGroupBy) Scan

func (tgb *TenantGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TenantGroupBy) ScanX

func (s *TenantGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TenantGroupBy) String

func (s *TenantGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) StringX

func (s *TenantGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TenantGroupBy) Strings

func (s *TenantGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TenantGroupBy) StringsX

func (s *TenantGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TenantMutation

type TenantMutation struct {
	// contains filtered or unexported fields
}

TenantMutation represents an operation that mutates the Tenant nodes in the graph.

func (*TenantMutation) AccountsCleared

func (m *TenantMutation) AccountsCleared() bool

AccountsCleared reports if the "accounts" edge to the Account entity was cleared.

func (*TenantMutation) AccountsID

func (m *TenantMutation) AccountsID() (id uuid.UUID, exists bool)

AccountsID returns the "accounts" edge ID in the mutation.

func (*TenantMutation) AccountsIDs

func (m *TenantMutation) AccountsIDs() (ids []uuid.UUID)

AccountsIDs returns the "accounts" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AccountsID instead. It exists only for internal usage by the builders.

func (*TenantMutation) AddAuditLogIDs

func (m *TenantMutation) AddAuditLogIDs(ids ...uuid.UUID)

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by ids.

func (*TenantMutation) AddField

func (m *TenantMutation) 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 (*TenantMutation) AddedEdges

func (m *TenantMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TenantMutation) AddedField

func (m *TenantMutation) 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 (*TenantMutation) AddedFields

func (m *TenantMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TenantMutation) AddedIDs

func (m *TenantMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TenantMutation) AuditLogsCleared

func (m *TenantMutation) AuditLogsCleared() bool

AuditLogsCleared reports if the "audit_logs" edge to the AuditLog entity was cleared.

func (*TenantMutation) AuditLogsIDs

func (m *TenantMutation) AuditLogsIDs() (ids []uuid.UUID)

AuditLogsIDs returns the "audit_logs" edge IDs in the mutation.

func (*TenantMutation) ClearAccounts

func (m *TenantMutation) ClearAccounts()

ClearAccounts clears the "accounts" edge to the Account entity.

func (*TenantMutation) ClearAuditLogs

func (m *TenantMutation) ClearAuditLogs()

ClearAuditLogs clears the "audit_logs" edge to the AuditLog entity.

func (*TenantMutation) ClearDescription

func (m *TenantMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*TenantMutation) ClearEdge

func (m *TenantMutation) 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 (*TenantMutation) ClearField

func (m *TenantMutation) 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 (*TenantMutation) ClearPlatform

func (m *TenantMutation) ClearPlatform()

ClearPlatform clears the "platform" edge to the Platform entity.

func (*TenantMutation) ClearedEdges

func (m *TenantMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TenantMutation) ClearedFields

func (m *TenantMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TenantMutation) Client

func (m TenantMutation) 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 (*TenantMutation) CreatedAt

func (m *TenantMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*TenantMutation) Description

func (m *TenantMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*TenantMutation) DescriptionCleared

func (m *TenantMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*TenantMutation) EdgeCleared

func (m *TenantMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TenantMutation) Field

func (m *TenantMutation) 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 (*TenantMutation) FieldCleared

func (m *TenantMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TenantMutation) Fields

func (m *TenantMutation) 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 (*TenantMutation) ID

func (m *TenantMutation) 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 (*TenantMutation) IDs

func (m *TenantMutation) 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 (*TenantMutation) Name

func (m *TenantMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TenantMutation) OldCreatedAt

func (m *TenantMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldDescription

func (m *TenantMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldField

func (m *TenantMutation) 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 (*TenantMutation) OldName

func (m *TenantMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldStatus

func (m *TenantMutation) OldStatus(ctx context.Context) (v tenant.Status, err error)

OldStatus returns the old "status" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) OldUpdatedAt

func (m *TenantMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Tenant entity. If the Tenant 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 (*TenantMutation) Op

func (m *TenantMutation) Op() Op

Op returns the operation name.

func (*TenantMutation) PlatformCleared

func (m *TenantMutation) PlatformCleared() bool

PlatformCleared reports if the "platform" edge to the Platform entity was cleared.

func (*TenantMutation) PlatformID

func (m *TenantMutation) PlatformID() (id uuid.UUID, exists bool)

PlatformID returns the "platform" edge ID in the mutation.

func (*TenantMutation) PlatformIDs

func (m *TenantMutation) PlatformIDs() (ids []uuid.UUID)

PlatformIDs returns the "platform" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PlatformID instead. It exists only for internal usage by the builders.

func (*TenantMutation) RemoveAuditLogIDs

func (m *TenantMutation) RemoveAuditLogIDs(ids ...uuid.UUID)

RemoveAuditLogIDs removes the "audit_logs" edge to the AuditLog entity by IDs.

func (*TenantMutation) RemovedAuditLogsIDs

func (m *TenantMutation) RemovedAuditLogsIDs() (ids []uuid.UUID)

RemovedAuditLogs returns the removed IDs of the "audit_logs" edge to the AuditLog entity.

func (*TenantMutation) RemovedEdges

func (m *TenantMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TenantMutation) RemovedIDs

func (m *TenantMutation) 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 (*TenantMutation) ResetAccounts

func (m *TenantMutation) ResetAccounts()

ResetAccounts resets all changes to the "accounts" edge.

func (*TenantMutation) ResetAuditLogs

func (m *TenantMutation) ResetAuditLogs()

ResetAuditLogs resets all changes to the "audit_logs" edge.

func (*TenantMutation) ResetCreatedAt

func (m *TenantMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TenantMutation) ResetDescription

func (m *TenantMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*TenantMutation) ResetEdge

func (m *TenantMutation) 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 (*TenantMutation) ResetField

func (m *TenantMutation) 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 (*TenantMutation) ResetName

func (m *TenantMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TenantMutation) ResetPlatform

func (m *TenantMutation) ResetPlatform()

ResetPlatform resets all changes to the "platform" edge.

func (*TenantMutation) ResetStatus

func (m *TenantMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*TenantMutation) ResetUpdatedAt

func (m *TenantMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TenantMutation) SetAccountsID

func (m *TenantMutation) SetAccountsID(id uuid.UUID)

SetAccountsID sets the "accounts" edge to the Account entity by id.

func (*TenantMutation) SetCreatedAt

func (m *TenantMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*TenantMutation) SetDescription

func (m *TenantMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*TenantMutation) SetField

func (m *TenantMutation) 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 (*TenantMutation) SetID

func (m *TenantMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Tenant entities.

func (*TenantMutation) SetName

func (m *TenantMutation) SetName(s string)

SetName sets the "name" field.

func (*TenantMutation) SetOp

func (m *TenantMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TenantMutation) SetPlatformID

func (m *TenantMutation) SetPlatformID(id uuid.UUID)

SetPlatformID sets the "platform" edge to the Platform entity by id.

func (*TenantMutation) SetStatus

func (m *TenantMutation) SetStatus(t tenant.Status)

SetStatus sets the "status" field.

func (*TenantMutation) SetUpdatedAt

func (m *TenantMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*TenantMutation) Status

func (m *TenantMutation) Status() (r tenant.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (TenantMutation) Tx

func (m TenantMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TenantMutation) Type

func (m *TenantMutation) Type() string

Type returns the node type of this mutation (Tenant).

func (*TenantMutation) UpdatedAt

func (m *TenantMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*TenantMutation) Where

func (m *TenantMutation) Where(ps ...predicate.Tenant)

Where appends a list predicates to the TenantMutation builder.

func (*TenantMutation) WhereP

func (m *TenantMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TenantMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TenantQuery

type TenantQuery struct {
	// contains filtered or unexported fields
}

TenantQuery is the builder for querying Tenant entities.

func (*TenantQuery) Aggregate

func (tq *TenantQuery) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate returns a TenantSelect configured with the given aggregations.

func (*TenantQuery) All

func (tq *TenantQuery) All(ctx context.Context) ([]*Tenant, error)

All executes the query and returns a list of Tenants.

func (*TenantQuery) AllX

func (tq *TenantQuery) AllX(ctx context.Context) []*Tenant

AllX is like All, but panics if an error occurs.

func (*TenantQuery) Clone

func (tq *TenantQuery) Clone() *TenantQuery

Clone returns a duplicate of the TenantQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TenantQuery) Count

func (tq *TenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantQuery) CountX

func (tq *TenantQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TenantQuery) Exist

func (tq *TenantQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TenantQuery) ExistX

func (tq *TenantQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TenantQuery) First

func (tq *TenantQuery) First(ctx context.Context) (*Tenant, error)

First returns the first Tenant entity from the query. Returns a *NotFoundError when no Tenant was found.

func (*TenantQuery) FirstID

func (tq *TenantQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Tenant ID from the query. Returns a *NotFoundError when no Tenant ID was found.

func (*TenantQuery) FirstIDX

func (tq *TenantQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*TenantQuery) FirstX

func (tq *TenantQuery) FirstX(ctx context.Context) *Tenant

FirstX is like First, but panics if an error occurs.

func (*TenantQuery) GroupBy

func (tq *TenantQuery) GroupBy(field string, fields ...string) *TenantGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tenant.Query().
	GroupBy(tenant.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TenantQuery) IDs

func (tq *TenantQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of Tenant IDs.

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*TenantQuery) Limit

func (tq *TenantQuery) Limit(limit int) *TenantQuery

Limit the number of records to be returned by this query.

func (*TenantQuery) Offset

func (tq *TenantQuery) Offset(offset int) *TenantQuery

Offset to start from.

func (*TenantQuery) Only

func (tq *TenantQuery) Only(ctx context.Context) (*Tenant, error)

Only returns a single Tenant entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tenant entity is found. Returns a *NotFoundError when no Tenant entities are found.

func (*TenantQuery) OnlyID

func (tq *TenantQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Tenant ID in the query. Returns a *NotSingularError when more than one Tenant ID is found. Returns a *NotFoundError when no entities are found.

func (*TenantQuery) OnlyIDX

func (tq *TenantQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TenantQuery) OnlyX

func (tq *TenantQuery) OnlyX(ctx context.Context) *Tenant

OnlyX is like Only, but panics if an error occurs.

func (*TenantQuery) Order

func (tq *TenantQuery) Order(o ...tenant.OrderOption) *TenantQuery

Order specifies how the records should be ordered.

func (*TenantQuery) QueryAccounts

func (tq *TenantQuery) QueryAccounts() *AccountQuery

QueryAccounts chains the current query on the "accounts" edge.

func (*TenantQuery) QueryAuditLogs

func (tq *TenantQuery) QueryAuditLogs() *AuditLogQuery

QueryAuditLogs chains the current query on the "audit_logs" edge.

func (*TenantQuery) QueryPlatform

func (tq *TenantQuery) QueryPlatform() *PlatformQuery

QueryPlatform chains the current query on the "platform" edge.

func (*TenantQuery) Select

func (tq *TenantQuery) Select(fields ...string) *TenantSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Tenant.Query().
	Select(tenant.FieldCreatedAt).
	Scan(ctx, &v)

func (*TenantQuery) Unique

func (tq *TenantQuery) Unique(unique bool) *TenantQuery

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 (*TenantQuery) Where

func (tq *TenantQuery) Where(ps ...predicate.Tenant) *TenantQuery

Where adds a new predicate for the TenantQuery builder.

func (*TenantQuery) WithAccounts

func (tq *TenantQuery) WithAccounts(opts ...func(*AccountQuery)) *TenantQuery

WithAccounts tells the query-builder to eager-load the nodes that are connected to the "accounts" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithAuditLogs

func (tq *TenantQuery) WithAuditLogs(opts ...func(*AuditLogQuery)) *TenantQuery

WithAuditLogs tells the query-builder to eager-load the nodes that are connected to the "audit_logs" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithPlatform

func (tq *TenantQuery) WithPlatform(opts ...func(*PlatformQuery)) *TenantQuery

WithPlatform tells the query-builder to eager-load the nodes that are connected to the "platform" edge. The optional arguments are used to configure the query builder of the edge.

type TenantSelect

type TenantSelect struct {
	*TenantQuery
	// contains filtered or unexported fields
}

TenantSelect is the builder for selecting fields of Tenant entities.

func (*TenantSelect) Aggregate

func (ts *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TenantSelect) Bool

func (s *TenantSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TenantSelect) BoolX

func (s *TenantSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TenantSelect) Bools

func (s *TenantSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TenantSelect) BoolsX

func (s *TenantSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TenantSelect) Float64

func (s *TenantSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TenantSelect) Float64X

func (s *TenantSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TenantSelect) Float64s

func (s *TenantSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TenantSelect) Float64sX

func (s *TenantSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TenantSelect) Int

func (s *TenantSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TenantSelect) IntX

func (s *TenantSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TenantSelect) Ints

func (s *TenantSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TenantSelect) IntsX

func (s *TenantSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TenantSelect) Scan

func (ts *TenantSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TenantSelect) ScanX

func (s *TenantSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TenantSelect) String

func (s *TenantSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TenantSelect) StringX

func (s *TenantSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TenantSelect) Strings

func (s *TenantSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TenantSelect) StringsX

func (s *TenantSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TenantUpdate

type TenantUpdate struct {
	// contains filtered or unexported fields
}

TenantUpdate is the builder for updating Tenant entities.

func (*TenantUpdate) AddAuditLogIDs

func (tu *TenantUpdate) AddAuditLogIDs(ids ...uuid.UUID) *TenantUpdate

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*TenantUpdate) AddAuditLogs

func (tu *TenantUpdate) AddAuditLogs(a ...*AuditLog) *TenantUpdate

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*TenantUpdate) ClearAccounts

func (tu *TenantUpdate) ClearAccounts() *TenantUpdate

ClearAccounts clears the "accounts" edge to the Account entity.

func (*TenantUpdate) ClearAuditLogs

func (tu *TenantUpdate) ClearAuditLogs() *TenantUpdate

ClearAuditLogs clears all "audit_logs" edges to the AuditLog entity.

func (*TenantUpdate) ClearDescription

func (tu *TenantUpdate) ClearDescription() *TenantUpdate

ClearDescription clears the value of the "description" field.

func (*TenantUpdate) ClearPlatform

func (tu *TenantUpdate) ClearPlatform() *TenantUpdate

ClearPlatform clears the "platform" edge to the Platform entity.

func (*TenantUpdate) Exec

func (tu *TenantUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpdate) ExecX

func (tu *TenantUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantUpdate) Mutation

func (tu *TenantUpdate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdate) RemoveAuditLogIDs

func (tu *TenantUpdate) RemoveAuditLogIDs(ids ...uuid.UUID) *TenantUpdate

RemoveAuditLogIDs removes the "audit_logs" edge to AuditLog entities by IDs.

func (*TenantUpdate) RemoveAuditLogs

func (tu *TenantUpdate) RemoveAuditLogs(a ...*AuditLog) *TenantUpdate

RemoveAuditLogs removes "audit_logs" edges to AuditLog entities.

func (*TenantUpdate) Save

func (tu *TenantUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TenantUpdate) SaveX

func (tu *TenantUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TenantUpdate) SetAccounts

func (tu *TenantUpdate) SetAccounts(a *Account) *TenantUpdate

SetAccounts sets the "accounts" edge to the Account entity.

func (*TenantUpdate) SetAccountsID

func (tu *TenantUpdate) SetAccountsID(id uuid.UUID) *TenantUpdate

SetAccountsID sets the "accounts" edge to the Account entity by ID.

func (*TenantUpdate) SetDescription

func (tu *TenantUpdate) SetDescription(s string) *TenantUpdate

SetDescription sets the "description" field.

func (*TenantUpdate) SetName

func (tu *TenantUpdate) SetName(s string) *TenantUpdate

SetName sets the "name" field.

func (*TenantUpdate) SetNillableAccountsID

func (tu *TenantUpdate) SetNillableAccountsID(id *uuid.UUID) *TenantUpdate

SetNillableAccountsID sets the "accounts" edge to the Account entity by ID if the given value is not nil.

func (*TenantUpdate) SetNillableDescription

func (tu *TenantUpdate) SetNillableDescription(s *string) *TenantUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TenantUpdate) SetNillableName

func (tu *TenantUpdate) SetNillableName(s *string) *TenantUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*TenantUpdate) SetNillableStatus

func (tu *TenantUpdate) SetNillableStatus(t *tenant.Status) *TenantUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TenantUpdate) SetPlatform

func (tu *TenantUpdate) SetPlatform(p *Platform) *TenantUpdate

SetPlatform sets the "platform" edge to the Platform entity.

func (*TenantUpdate) SetPlatformID

func (tu *TenantUpdate) SetPlatformID(id uuid.UUID) *TenantUpdate

SetPlatformID sets the "platform" edge to the Platform entity by ID.

func (*TenantUpdate) SetStatus

func (tu *TenantUpdate) SetStatus(t tenant.Status) *TenantUpdate

SetStatus sets the "status" field.

func (*TenantUpdate) SetUpdatedAt

func (tu *TenantUpdate) SetUpdatedAt(t time.Time) *TenantUpdate

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpdate) Where

func (tu *TenantUpdate) Where(ps ...predicate.Tenant) *TenantUpdate

Where appends a list predicates to the TenantUpdate builder.

type TenantUpdateOne

type TenantUpdateOne struct {
	// contains filtered or unexported fields
}

TenantUpdateOne is the builder for updating a single Tenant entity.

func (*TenantUpdateOne) AddAuditLogIDs

func (tuo *TenantUpdateOne) AddAuditLogIDs(ids ...uuid.UUID) *TenantUpdateOne

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*TenantUpdateOne) AddAuditLogs

func (tuo *TenantUpdateOne) AddAuditLogs(a ...*AuditLog) *TenantUpdateOne

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*TenantUpdateOne) ClearAccounts

func (tuo *TenantUpdateOne) ClearAccounts() *TenantUpdateOne

ClearAccounts clears the "accounts" edge to the Account entity.

func (*TenantUpdateOne) ClearAuditLogs

func (tuo *TenantUpdateOne) ClearAuditLogs() *TenantUpdateOne

ClearAuditLogs clears all "audit_logs" edges to the AuditLog entity.

func (*TenantUpdateOne) ClearDescription

func (tuo *TenantUpdateOne) ClearDescription() *TenantUpdateOne

ClearDescription clears the value of the "description" field.

func (*TenantUpdateOne) ClearPlatform

func (tuo *TenantUpdateOne) ClearPlatform() *TenantUpdateOne

ClearPlatform clears the "platform" edge to the Platform entity.

func (*TenantUpdateOne) Exec

func (tuo *TenantUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TenantUpdateOne) ExecX

func (tuo *TenantUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantUpdateOne) Mutation

func (tuo *TenantUpdateOne) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdateOne) RemoveAuditLogIDs

func (tuo *TenantUpdateOne) RemoveAuditLogIDs(ids ...uuid.UUID) *TenantUpdateOne

RemoveAuditLogIDs removes the "audit_logs" edge to AuditLog entities by IDs.

func (*TenantUpdateOne) RemoveAuditLogs

func (tuo *TenantUpdateOne) RemoveAuditLogs(a ...*AuditLog) *TenantUpdateOne

RemoveAuditLogs removes "audit_logs" edges to AuditLog entities.

func (*TenantUpdateOne) Save

func (tuo *TenantUpdateOne) Save(ctx context.Context) (*Tenant, error)

Save executes the query and returns the updated Tenant entity.

func (*TenantUpdateOne) SaveX

func (tuo *TenantUpdateOne) SaveX(ctx context.Context) *Tenant

SaveX is like Save, but panics if an error occurs.

func (*TenantUpdateOne) Select

func (tuo *TenantUpdateOne) Select(field string, fields ...string) *TenantUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TenantUpdateOne) SetAccounts

func (tuo *TenantUpdateOne) SetAccounts(a *Account) *TenantUpdateOne

SetAccounts sets the "accounts" edge to the Account entity.

func (*TenantUpdateOne) SetAccountsID

func (tuo *TenantUpdateOne) SetAccountsID(id uuid.UUID) *TenantUpdateOne

SetAccountsID sets the "accounts" edge to the Account entity by ID.

func (*TenantUpdateOne) SetDescription

func (tuo *TenantUpdateOne) SetDescription(s string) *TenantUpdateOne

SetDescription sets the "description" field.

func (*TenantUpdateOne) SetName

func (tuo *TenantUpdateOne) SetName(s string) *TenantUpdateOne

SetName sets the "name" field.

func (*TenantUpdateOne) SetNillableAccountsID

func (tuo *TenantUpdateOne) SetNillableAccountsID(id *uuid.UUID) *TenantUpdateOne

SetNillableAccountsID sets the "accounts" edge to the Account entity by ID if the given value is not nil.

func (*TenantUpdateOne) SetNillableDescription

func (tuo *TenantUpdateOne) SetNillableDescription(s *string) *TenantUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableName

func (tuo *TenantUpdateOne) SetNillableName(s *string) *TenantUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableStatus

func (tuo *TenantUpdateOne) SetNillableStatus(t *tenant.Status) *TenantUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TenantUpdateOne) SetPlatform

func (tuo *TenantUpdateOne) SetPlatform(p *Platform) *TenantUpdateOne

SetPlatform sets the "platform" edge to the Platform entity.

func (*TenantUpdateOne) SetPlatformID

func (tuo *TenantUpdateOne) SetPlatformID(id uuid.UUID) *TenantUpdateOne

SetPlatformID sets the "platform" edge to the Platform entity by ID.

func (*TenantUpdateOne) SetStatus

func (tuo *TenantUpdateOne) SetStatus(t tenant.Status) *TenantUpdateOne

SetStatus sets the "status" field.

func (*TenantUpdateOne) SetUpdatedAt

func (tuo *TenantUpdateOne) SetUpdatedAt(t time.Time) *TenantUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpdateOne) Where

func (tuo *TenantUpdateOne) Where(ps ...predicate.Tenant) *TenantUpdateOne

Where appends a list predicates to the TenantUpdate builder.

type Tenants

type Tenants []*Tenant

Tenants is a parsable slice of Tenant.

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 {

	// AccessPolicy is the client for interacting with the AccessPolicy builders.
	AccessPolicy *AccessPolicyClient
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// AuditLog is the client for interacting with the AuditLog builders.
	AuditLog *AuditLogClient
	// Platform is the client for interacting with the Platform builders.
	Platform *PlatformClient
	// Resource is the client for interacting with the Resource builders.
	Resource *ResourceClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// 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"`
	// Avatar holds the value of the "avatar" field.
	Avatar string `json:"avatar,omitempty"`
	// Nickname holds the value of the "nickname" field.
	Nickname string `json:"nickname,omitempty"`
	// Bio holds the value of the "bio" field.
	Bio string `json:"bio,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"-"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// EmailVerified holds the value of the "email_verified" field.
	EmailVerified bool `json:"email_verified,omitempty"`
	// PhoneNumber holds the value of the "phone_number" field.
	PhoneNumber string `json:"phone_number,omitempty"`
	// PhoneNumberVerified holds the value of the "phone_number_verified" field.
	PhoneNumberVerified bool `json:"phone_number_verified,omitempty"`
	// TotpSecret holds the value of the "totp_secret" field.
	TotpSecret string `json:"totp_secret,omitempty"`
	// Online holds the value of the "online" field.
	Online bool `json:"online,omitempty"`
	// Status holds the value of the "status" field.
	Status bool `json:"status,omitempty"`
	// LoginAttempts holds the value of the "login_attempts" field.
	LoginAttempts int `json:"login_attempts,omitempty"`
	// LockoutTime holds the value of the "lockout_time" field.
	LockoutTime time.Time `json:"lockout_time,omitempty"`
	// LastLoginTime holds the value of the "last_login_time" field.
	LastLoginTime time.Time `json:"last_login_time,omitempty"`
	// SocialLogins holds the value of the "social_logins" field.
	SocialLogins map[string]string `json:"social_logins,omitempty"`
	// IsDefault holds the value of the "is_default" field.
	IsDefault bool `json:"is_default,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAccount

func (u *User) QueryAccount() *AccountQuery

QueryAccount queries the "account" edge of the User entity.

func (*User) QueryAuditLogs

func (u *User) QueryAuditLogs() *AuditLogQuery

QueryAuditLogs queries the "audit_logs" edge of the User entity.

func (*User) QueryRole

func (u *User) QueryRole() *RoleQuery

QueryRole queries the "role" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the User. This includes values selected through modifiers, order, etc.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAccount

func (c *UserClient) QueryAccount(u *User) *AccountQuery

QueryAccount queries the account edge of a User.

func (*UserClient) QueryAuditLogs

func (c *UserClient) QueryAuditLogs(u *User) *AuditLogQuery

QueryAuditLogs queries the audit_logs edge of a User.

func (*UserClient) QueryRole

func (c *UserClient) QueryRole(u *User) *RoleQuery

QueryRole queries the role edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAuditLogIDs

func (uc *UserCreate) AddAuditLogIDs(ids ...uuid.UUID) *UserCreate

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*UserCreate) AddAuditLogs

func (uc *UserCreate) AddAuditLogs(a ...*AuditLog) *UserCreate

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAccount

func (uc *UserCreate) SetAccount(a *Account) *UserCreate

SetAccount sets the "account" edge to the Account entity.

func (*UserCreate) SetAccountID

func (uc *UserCreate) SetAccountID(id uuid.UUID) *UserCreate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*UserCreate) SetAvatar

func (uc *UserCreate) SetAvatar(s string) *UserCreate

SetAvatar sets the "avatar" field.

func (*UserCreate) SetBio

func (uc *UserCreate) SetBio(s string) *UserCreate

SetBio sets the "bio" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetEmailVerified

func (uc *UserCreate) SetEmailVerified(b bool) *UserCreate

SetEmailVerified sets the "email_verified" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetIsDefault

func (uc *UserCreate) SetIsDefault(b bool) *UserCreate

SetIsDefault sets the "is_default" field.

func (*UserCreate) SetLastLoginTime

func (uc *UserCreate) SetLastLoginTime(t time.Time) *UserCreate

SetLastLoginTime sets the "last_login_time" field.

func (*UserCreate) SetLockoutTime

func (uc *UserCreate) SetLockoutTime(t time.Time) *UserCreate

SetLockoutTime sets the "lockout_time" field.

func (*UserCreate) SetLoginAttempts

func (uc *UserCreate) SetLoginAttempts(i int) *UserCreate

SetLoginAttempts sets the "login_attempts" field.

func (*UserCreate) SetNickname

func (uc *UserCreate) SetNickname(s string) *UserCreate

SetNickname sets the "nickname" field.

func (*UserCreate) SetNillableAvatar

func (uc *UserCreate) SetNillableAvatar(s *string) *UserCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserCreate) SetNillableBio

func (uc *UserCreate) SetNillableBio(s *string) *UserCreate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableEmailVerified

func (uc *UserCreate) SetNillableEmailVerified(b *bool) *UserCreate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableIsDefault

func (uc *UserCreate) SetNillableIsDefault(b *bool) *UserCreate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*UserCreate) SetNillableLastLoginTime

func (uc *UserCreate) SetNillableLastLoginTime(t *time.Time) *UserCreate

SetNillableLastLoginTime sets the "last_login_time" field if the given value is not nil.

func (*UserCreate) SetNillableLockoutTime

func (uc *UserCreate) SetNillableLockoutTime(t *time.Time) *UserCreate

SetNillableLockoutTime sets the "lockout_time" field if the given value is not nil.

func (*UserCreate) SetNillableLoginAttempts

func (uc *UserCreate) SetNillableLoginAttempts(i *int) *UserCreate

SetNillableLoginAttempts sets the "login_attempts" field if the given value is not nil.

func (*UserCreate) SetNillableNickname

func (uc *UserCreate) SetNillableNickname(s *string) *UserCreate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserCreate) SetNillableOnline

func (uc *UserCreate) SetNillableOnline(b *bool) *UserCreate

SetNillableOnline sets the "online" field if the given value is not nil.

func (*UserCreate) SetNillablePhoneNumber

func (uc *UserCreate) SetNillablePhoneNumber(s *string) *UserCreate

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserCreate) SetNillablePhoneNumberVerified

func (uc *UserCreate) SetNillablePhoneNumberVerified(b *bool) *UserCreate

SetNillablePhoneNumberVerified sets the "phone_number_verified" field if the given value is not nil.

func (*UserCreate) SetNillableStatus

func (uc *UserCreate) SetNillableStatus(b *bool) *UserCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserCreate) SetNillableTotpSecret

func (uc *UserCreate) SetNillableTotpSecret(s *string) *UserCreate

SetNillableTotpSecret sets the "totp_secret" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetOnline

func (uc *UserCreate) SetOnline(b bool) *UserCreate

SetOnline sets the "online" field.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetPhoneNumber

func (uc *UserCreate) SetPhoneNumber(s string) *UserCreate

SetPhoneNumber sets the "phone_number" field.

func (*UserCreate) SetPhoneNumberVerified

func (uc *UserCreate) SetPhoneNumberVerified(b bool) *UserCreate

SetPhoneNumberVerified sets the "phone_number_verified" field.

func (*UserCreate) SetRole

func (uc *UserCreate) SetRole(r *Role) *UserCreate

SetRole sets the "role" edge to the Role entity.

func (*UserCreate) SetRoleID

func (uc *UserCreate) SetRoleID(id uuid.UUID) *UserCreate

SetRoleID sets the "role" edge to the Role entity by ID.

func (*UserCreate) SetSocialLogins

func (uc *UserCreate) SetSocialLogins(m map[string]string) *UserCreate

SetSocialLogins sets the "social_logins" field.

func (*UserCreate) SetStatus

func (uc *UserCreate) SetStatus(b bool) *UserCreate

SetStatus sets the "status" field.

func (*UserCreate) SetTotpSecret

func (uc *UserCreate) SetTotpSecret(s string) *UserCreate

SetTotpSecret sets the "totp_secret" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// 用户所属的账户
	Account *Account `json:"account,omitempty"`
	// 用户拥有的角色
	Role *Role `json:"role,omitempty"`
	// 用户的审计日志
	AuditLogs []*AuditLog `json:"audit_logs,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AccountOrErr

func (e UserEdges) AccountOrErr() (*Account, error)

AccountOrErr returns the Account value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) AuditLogsOrErr

func (e UserEdges) AuditLogsOrErr() ([]*AuditLog, error)

AuditLogsOrErr returns the AuditLogs value or an error if the edge was not loaded in eager-loading.

func (UserEdges) RoleOrErr

func (e UserEdges) RoleOrErr() (*Role, error)

RoleOrErr returns the Role value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AccountCleared

func (m *UserMutation) AccountCleared() bool

AccountCleared reports if the "account" edge to the Account entity was cleared.

func (*UserMutation) AccountID

func (m *UserMutation) AccountID() (id uuid.UUID, exists bool)

AccountID returns the "account" edge ID in the mutation.

func (*UserMutation) AccountIDs

func (m *UserMutation) AccountIDs() (ids []uuid.UUID)

AccountIDs returns the "account" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AccountID instead. It exists only for internal usage by the builders.

func (*UserMutation) AddAuditLogIDs

func (m *UserMutation) AddAuditLogIDs(ids ...uuid.UUID)

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddLoginAttempts

func (m *UserMutation) AddLoginAttempts(i int)

AddLoginAttempts adds i to the "login_attempts" field.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) AddedLoginAttempts

func (m *UserMutation) AddedLoginAttempts() (r int, exists bool)

AddedLoginAttempts returns the value that was added to the "login_attempts" field in this mutation.

func (*UserMutation) AuditLogsCleared

func (m *UserMutation) AuditLogsCleared() bool

AuditLogsCleared reports if the "audit_logs" edge to the AuditLog entity was cleared.

func (*UserMutation) AuditLogsIDs

func (m *UserMutation) AuditLogsIDs() (ids []uuid.UUID)

AuditLogsIDs returns the "audit_logs" edge IDs in the mutation.

func (*UserMutation) Avatar

func (m *UserMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*UserMutation) AvatarCleared

func (m *UserMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*UserMutation) Bio

func (m *UserMutation) Bio() (r string, exists bool)

Bio returns the value of the "bio" field in the mutation.

func (*UserMutation) BioCleared

func (m *UserMutation) BioCleared() bool

BioCleared returns if the "bio" field was cleared in this mutation.

func (*UserMutation) ClearAccount

func (m *UserMutation) ClearAccount()

ClearAccount clears the "account" edge to the Account entity.

func (*UserMutation) ClearAuditLogs

func (m *UserMutation) ClearAuditLogs()

ClearAuditLogs clears the "audit_logs" edge to the AuditLog entity.

func (*UserMutation) ClearAvatar

func (m *UserMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UserMutation) ClearBio

func (m *UserMutation) ClearBio()

ClearBio clears the value of the "bio" field.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearLockoutTime

func (m *UserMutation) ClearLockoutTime()

ClearLockoutTime clears the value of the "lockout_time" field.

func (*UserMutation) ClearNickname

func (m *UserMutation) ClearNickname()

ClearNickname clears the value of the "nickname" field.

func (*UserMutation) ClearPhoneNumber

func (m *UserMutation) ClearPhoneNumber()

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserMutation) ClearRole

func (m *UserMutation) ClearRole()

ClearRole clears the "role" edge to the Role entity.

func (*UserMutation) ClearSocialLogins

func (m *UserMutation) ClearSocialLogins()

ClearSocialLogins clears the value of the "social_logins" field.

func (*UserMutation) ClearTotpSecret

func (m *UserMutation) ClearTotpSecret()

ClearTotpSecret clears the value of the "totp_secret" field.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) EmailVerified

func (m *UserMutation) EmailVerified() (r bool, exists bool)

EmailVerified returns the value of the "email_verified" field in the mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) ID

func (m *UserMutation) ID() (id uuid.UUID, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) IsDefault

func (m *UserMutation) IsDefault() (r bool, exists bool)

IsDefault returns the value of the "is_default" field in the mutation.

func (*UserMutation) LastLoginTime

func (m *UserMutation) LastLoginTime() (r time.Time, exists bool)

LastLoginTime returns the value of the "last_login_time" field in the mutation.

func (*UserMutation) LockoutTime

func (m *UserMutation) LockoutTime() (r time.Time, exists bool)

LockoutTime returns the value of the "lockout_time" field in the mutation.

func (*UserMutation) LockoutTimeCleared

func (m *UserMutation) LockoutTimeCleared() bool

LockoutTimeCleared returns if the "lockout_time" field was cleared in this mutation.

func (*UserMutation) LoginAttempts

func (m *UserMutation) LoginAttempts() (r int, exists bool)

LoginAttempts returns the value of the "login_attempts" field in the mutation.

func (*UserMutation) Nickname

func (m *UserMutation) Nickname() (r string, exists bool)

Nickname returns the value of the "nickname" field in the mutation.

func (*UserMutation) NicknameCleared

func (m *UserMutation) NicknameCleared() bool

NicknameCleared returns if the "nickname" field was cleared in this mutation.

func (*UserMutation) OldAvatar

func (m *UserMutation) OldAvatar(ctx context.Context) (v string, err error)

OldAvatar returns the old "avatar" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldBio

func (m *UserMutation) OldBio(ctx context.Context) (v string, err error)

OldBio returns the old "bio" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmailVerified

func (m *UserMutation) OldEmailVerified(ctx context.Context) (v bool, err error)

OldEmailVerified returns the old "email_verified" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldIsDefault

func (m *UserMutation) OldIsDefault(ctx context.Context) (v bool, err error)

OldIsDefault returns the old "is_default" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLastLoginTime

func (m *UserMutation) OldLastLoginTime(ctx context.Context) (v time.Time, err error)

OldLastLoginTime returns the old "last_login_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLockoutTime

func (m *UserMutation) OldLockoutTime(ctx context.Context) (v time.Time, err error)

OldLockoutTime returns the old "lockout_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLoginAttempts

func (m *UserMutation) OldLoginAttempts(ctx context.Context) (v int, err error)

OldLoginAttempts returns the old "login_attempts" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldNickname

func (m *UserMutation) OldNickname(ctx context.Context) (v string, err error)

OldNickname returns the old "nickname" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldOnline

func (m *UserMutation) OldOnline(ctx context.Context) (v bool, err error)

OldOnline returns the old "online" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPhoneNumber

func (m *UserMutation) OldPhoneNumber(ctx context.Context) (v string, err error)

OldPhoneNumber returns the old "phone_number" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPhoneNumberVerified

func (m *UserMutation) OldPhoneNumberVerified(ctx context.Context) (v bool, err error)

OldPhoneNumberVerified returns the old "phone_number_verified" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldSocialLogins

func (m *UserMutation) OldSocialLogins(ctx context.Context) (v map[string]string, err error)

OldSocialLogins returns the old "social_logins" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldStatus

func (m *UserMutation) OldStatus(ctx context.Context) (v bool, err error)

OldStatus returns the old "status" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldTotpSecret

func (m *UserMutation) OldTotpSecret(ctx context.Context) (v string, err error)

OldTotpSecret returns the old "totp_secret" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Online

func (m *UserMutation) Online() (r bool, exists bool)

Online returns the value of the "online" field in the mutation.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) PhoneNumber

func (m *UserMutation) PhoneNumber() (r string, exists bool)

PhoneNumber returns the value of the "phone_number" field in the mutation.

func (*UserMutation) PhoneNumberCleared

func (m *UserMutation) PhoneNumberCleared() bool

PhoneNumberCleared returns if the "phone_number" field was cleared in this mutation.

func (*UserMutation) PhoneNumberVerified

func (m *UserMutation) PhoneNumberVerified() (r bool, exists bool)

PhoneNumberVerified returns the value of the "phone_number_verified" field in the mutation.

func (*UserMutation) RemoveAuditLogIDs

func (m *UserMutation) RemoveAuditLogIDs(ids ...uuid.UUID)

RemoveAuditLogIDs removes the "audit_logs" edge to the AuditLog entity by IDs.

func (*UserMutation) RemovedAuditLogsIDs

func (m *UserMutation) RemovedAuditLogsIDs() (ids []uuid.UUID)

RemovedAuditLogs returns the removed IDs of the "audit_logs" edge to the AuditLog entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) ResetAccount

func (m *UserMutation) ResetAccount()

ResetAccount resets all changes to the "account" edge.

func (*UserMutation) ResetAuditLogs

func (m *UserMutation) ResetAuditLogs()

ResetAuditLogs resets all changes to the "audit_logs" edge.

func (*UserMutation) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetBio

func (m *UserMutation) ResetBio()

ResetBio resets all changes to the "bio" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetEmailVerified

func (m *UserMutation) ResetEmailVerified()

ResetEmailVerified resets all changes to the "email_verified" field.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetIsDefault

func (m *UserMutation) ResetIsDefault()

ResetIsDefault resets all changes to the "is_default" field.

func (*UserMutation) ResetLastLoginTime

func (m *UserMutation) ResetLastLoginTime()

ResetLastLoginTime resets all changes to the "last_login_time" field.

func (*UserMutation) ResetLockoutTime

func (m *UserMutation) ResetLockoutTime()

ResetLockoutTime resets all changes to the "lockout_time" field.

func (*UserMutation) ResetLoginAttempts

func (m *UserMutation) ResetLoginAttempts()

ResetLoginAttempts resets all changes to the "login_attempts" field.

func (*UserMutation) ResetNickname

func (m *UserMutation) ResetNickname()

ResetNickname resets all changes to the "nickname" field.

func (*UserMutation) ResetOnline

func (m *UserMutation) ResetOnline()

ResetOnline resets all changes to the "online" field.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPhoneNumber

func (m *UserMutation) ResetPhoneNumber()

ResetPhoneNumber resets all changes to the "phone_number" field.

func (*UserMutation) ResetPhoneNumberVerified

func (m *UserMutation) ResetPhoneNumberVerified()

ResetPhoneNumberVerified resets all changes to the "phone_number_verified" field.

func (*UserMutation) ResetRole

func (m *UserMutation) ResetRole()

ResetRole resets all changes to the "role" edge.

func (*UserMutation) ResetSocialLogins

func (m *UserMutation) ResetSocialLogins()

ResetSocialLogins resets all changes to the "social_logins" field.

func (*UserMutation) ResetStatus

func (m *UserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*UserMutation) ResetTotpSecret

func (m *UserMutation) ResetTotpSecret()

ResetTotpSecret resets all changes to the "totp_secret" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) RoleCleared

func (m *UserMutation) RoleCleared() bool

RoleCleared reports if the "role" edge to the Role entity was cleared.

func (*UserMutation) RoleID

func (m *UserMutation) RoleID() (id uuid.UUID, exists bool)

RoleID returns the "role" edge ID in the mutation.

func (*UserMutation) RoleIDs

func (m *UserMutation) RoleIDs() (ids []uuid.UUID)

RoleIDs returns the "role" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use RoleID instead. It exists only for internal usage by the builders.

func (*UserMutation) SetAccountID

func (m *UserMutation) SetAccountID(id uuid.UUID)

SetAccountID sets the "account" edge to the Account entity by id.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetBio

func (m *UserMutation) SetBio(s string)

SetBio sets the "bio" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetEmailVerified

func (m *UserMutation) SetEmailVerified(b bool)

SetEmailVerified sets the "email_verified" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetIsDefault

func (m *UserMutation) SetIsDefault(b bool)

SetIsDefault sets the "is_default" field.

func (*UserMutation) SetLastLoginTime

func (m *UserMutation) SetLastLoginTime(t time.Time)

SetLastLoginTime sets the "last_login_time" field.

func (*UserMutation) SetLockoutTime

func (m *UserMutation) SetLockoutTime(t time.Time)

SetLockoutTime sets the "lockout_time" field.

func (*UserMutation) SetLoginAttempts

func (m *UserMutation) SetLoginAttempts(i int)

SetLoginAttempts sets the "login_attempts" field.

func (*UserMutation) SetNickname

func (m *UserMutation) SetNickname(s string)

SetNickname sets the "nickname" field.

func (*UserMutation) SetOnline

func (m *UserMutation) SetOnline(b bool)

SetOnline sets the "online" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetPhoneNumber

func (m *UserMutation) SetPhoneNumber(s string)

SetPhoneNumber sets the "phone_number" field.

func (*UserMutation) SetPhoneNumberVerified

func (m *UserMutation) SetPhoneNumberVerified(b bool)

SetPhoneNumberVerified sets the "phone_number_verified" field.

func (*UserMutation) SetRoleID

func (m *UserMutation) SetRoleID(id uuid.UUID)

SetRoleID sets the "role" edge to the Role entity by id.

func (*UserMutation) SetSocialLogins

func (m *UserMutation) SetSocialLogins(value map[string]string)

SetSocialLogins sets the "social_logins" field.

func (*UserMutation) SetStatus

func (m *UserMutation) SetStatus(b bool)

SetStatus sets the "status" field.

func (*UserMutation) SetTotpSecret

func (m *UserMutation) SetTotpSecret(s string)

SetTotpSecret sets the "totp_secret" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*UserMutation) SocialLogins

func (m *UserMutation) SocialLogins() (r map[string]string, exists bool)

SocialLogins returns the value of the "social_logins" field in the mutation.

func (*UserMutation) SocialLoginsCleared

func (m *UserMutation) SocialLoginsCleared() bool

SocialLoginsCleared returns if the "social_logins" field was cleared in this mutation.

func (*UserMutation) Status

func (m *UserMutation) Status() (r bool, exists bool)

Status returns the value of the "status" field in the mutation.

func (*UserMutation) TotpSecret

func (m *UserMutation) TotpSecret() (r string, exists bool)

TotpSecret returns the value of the "totp_secret" field in the mutation.

func (*UserMutation) TotpSecretCleared

func (m *UserMutation) TotpSecretCleared() bool

TotpSecretCleared returns if the "totp_secret" field was cleared in this mutation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAccount

func (uq *UserQuery) QueryAccount() *AccountQuery

QueryAccount chains the current query on the "account" edge.

func (*UserQuery) QueryAuditLogs

func (uq *UserQuery) QueryAuditLogs() *AuditLogQuery

QueryAuditLogs chains the current query on the "audit_logs" edge.

func (*UserQuery) QueryRole

func (uq *UserQuery) QueryRole() *RoleQuery

QueryRole chains the current query on the "role" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAccount

func (uq *UserQuery) WithAccount(opts ...func(*AccountQuery)) *UserQuery

WithAccount tells the query-builder to eager-load the nodes that are connected to the "account" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithAuditLogs

func (uq *UserQuery) WithAuditLogs(opts ...func(*AuditLogQuery)) *UserQuery

WithAuditLogs tells the query-builder to eager-load the nodes that are connected to the "audit_logs" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithRole

func (uq *UserQuery) WithRole(opts ...func(*RoleQuery)) *UserQuery

WithRole tells the query-builder to eager-load the nodes that are connected to the "role" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAuditLogIDs

func (uu *UserUpdate) AddAuditLogIDs(ids ...uuid.UUID) *UserUpdate

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*UserUpdate) AddAuditLogs

func (uu *UserUpdate) AddAuditLogs(a ...*AuditLog) *UserUpdate

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*UserUpdate) AddLoginAttempts

func (uu *UserUpdate) AddLoginAttempts(i int) *UserUpdate

AddLoginAttempts adds i to the "login_attempts" field.

func (*UserUpdate) ClearAccount

func (uu *UserUpdate) ClearAccount() *UserUpdate

ClearAccount clears the "account" edge to the Account entity.

func (*UserUpdate) ClearAuditLogs

func (uu *UserUpdate) ClearAuditLogs() *UserUpdate

ClearAuditLogs clears all "audit_logs" edges to the AuditLog entity.

func (*UserUpdate) ClearAvatar

func (uu *UserUpdate) ClearAvatar() *UserUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdate) ClearBio

func (uu *UserUpdate) ClearBio() *UserUpdate

ClearBio clears the value of the "bio" field.

func (*UserUpdate) ClearLockoutTime

func (uu *UserUpdate) ClearLockoutTime() *UserUpdate

ClearLockoutTime clears the value of the "lockout_time" field.

func (*UserUpdate) ClearNickname

func (uu *UserUpdate) ClearNickname() *UserUpdate

ClearNickname clears the value of the "nickname" field.

func (*UserUpdate) ClearPhoneNumber

func (uu *UserUpdate) ClearPhoneNumber() *UserUpdate

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserUpdate) ClearRole

func (uu *UserUpdate) ClearRole() *UserUpdate

ClearRole clears the "role" edge to the Role entity.

func (*UserUpdate) ClearSocialLogins

func (uu *UserUpdate) ClearSocialLogins() *UserUpdate

ClearSocialLogins clears the value of the "social_logins" field.

func (*UserUpdate) ClearTotpSecret

func (uu *UserUpdate) ClearTotpSecret() *UserUpdate

ClearTotpSecret clears the value of the "totp_secret" field.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAuditLogIDs

func (uu *UserUpdate) RemoveAuditLogIDs(ids ...uuid.UUID) *UserUpdate

RemoveAuditLogIDs removes the "audit_logs" edge to AuditLog entities by IDs.

func (*UserUpdate) RemoveAuditLogs

func (uu *UserUpdate) RemoveAuditLogs(a ...*AuditLog) *UserUpdate

RemoveAuditLogs removes "audit_logs" edges to AuditLog entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAccount

func (uu *UserUpdate) SetAccount(a *Account) *UserUpdate

SetAccount sets the "account" edge to the Account entity.

func (*UserUpdate) SetAccountID

func (uu *UserUpdate) SetAccountID(id uuid.UUID) *UserUpdate

SetAccountID sets the "account" edge to the Account entity by ID.

func (*UserUpdate) SetAvatar

func (uu *UserUpdate) SetAvatar(s string) *UserUpdate

SetAvatar sets the "avatar" field.

func (*UserUpdate) SetBio

func (uu *UserUpdate) SetBio(s string) *UserUpdate

SetBio sets the "bio" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetEmailVerified

func (uu *UserUpdate) SetEmailVerified(b bool) *UserUpdate

SetEmailVerified sets the "email_verified" field.

func (*UserUpdate) SetIsDefault

func (uu *UserUpdate) SetIsDefault(b bool) *UserUpdate

SetIsDefault sets the "is_default" field.

func (*UserUpdate) SetLastLoginTime

func (uu *UserUpdate) SetLastLoginTime(t time.Time) *UserUpdate

SetLastLoginTime sets the "last_login_time" field.

func (*UserUpdate) SetLockoutTime

func (uu *UserUpdate) SetLockoutTime(t time.Time) *UserUpdate

SetLockoutTime sets the "lockout_time" field.

func (*UserUpdate) SetLoginAttempts

func (uu *UserUpdate) SetLoginAttempts(i int) *UserUpdate

SetLoginAttempts sets the "login_attempts" field.

func (*UserUpdate) SetNickname

func (uu *UserUpdate) SetNickname(s string) *UserUpdate

SetNickname sets the "nickname" field.

func (*UserUpdate) SetNillableAvatar

func (uu *UserUpdate) SetNillableAvatar(s *string) *UserUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdate) SetNillableBio

func (uu *UserUpdate) SetNillableBio(s *string) *UserUpdate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableEmailVerified

func (uu *UserUpdate) SetNillableEmailVerified(b *bool) *UserUpdate

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserUpdate) SetNillableIsDefault

func (uu *UserUpdate) SetNillableIsDefault(b *bool) *UserUpdate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*UserUpdate) SetNillableLastLoginTime

func (uu *UserUpdate) SetNillableLastLoginTime(t *time.Time) *UserUpdate

SetNillableLastLoginTime sets the "last_login_time" field if the given value is not nil.

func (*UserUpdate) SetNillableLockoutTime

func (uu *UserUpdate) SetNillableLockoutTime(t *time.Time) *UserUpdate

SetNillableLockoutTime sets the "lockout_time" field if the given value is not nil.

func (*UserUpdate) SetNillableLoginAttempts

func (uu *UserUpdate) SetNillableLoginAttempts(i *int) *UserUpdate

SetNillableLoginAttempts sets the "login_attempts" field if the given value is not nil.

func (*UserUpdate) SetNillableNickname

func (uu *UserUpdate) SetNillableNickname(s *string) *UserUpdate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserUpdate) SetNillableOnline

func (uu *UserUpdate) SetNillableOnline(b *bool) *UserUpdate

SetNillableOnline sets the "online" field if the given value is not nil.

func (*UserUpdate) SetNillablePassword

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillablePhoneNumber

func (uu *UserUpdate) SetNillablePhoneNumber(s *string) *UserUpdate

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserUpdate) SetNillablePhoneNumberVerified

func (uu *UserUpdate) SetNillablePhoneNumberVerified(b *bool) *UserUpdate

SetNillablePhoneNumberVerified sets the "phone_number_verified" field if the given value is not nil.

func (*UserUpdate) SetNillableStatus

func (uu *UserUpdate) SetNillableStatus(b *bool) *UserUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdate) SetNillableTotpSecret

func (uu *UserUpdate) SetNillableTotpSecret(s *string) *UserUpdate

SetNillableTotpSecret sets the "totp_secret" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername

func (uu *UserUpdate) SetNillableUsername(s *string) *UserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdate) SetOnline

func (uu *UserUpdate) SetOnline(b bool) *UserUpdate

SetOnline sets the "online" field.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetPhoneNumber

func (uu *UserUpdate) SetPhoneNumber(s string) *UserUpdate

SetPhoneNumber sets the "phone_number" field.

func (*UserUpdate) SetPhoneNumberVerified

func (uu *UserUpdate) SetPhoneNumberVerified(b bool) *UserUpdate

SetPhoneNumberVerified sets the "phone_number_verified" field.

func (*UserUpdate) SetRole

func (uu *UserUpdate) SetRole(r *Role) *UserUpdate

SetRole sets the "role" edge to the Role entity.

func (*UserUpdate) SetRoleID

func (uu *UserUpdate) SetRoleID(id uuid.UUID) *UserUpdate

SetRoleID sets the "role" edge to the Role entity by ID.

func (*UserUpdate) SetSocialLogins

func (uu *UserUpdate) SetSocialLogins(m map[string]string) *UserUpdate

SetSocialLogins sets the "social_logins" field.

func (*UserUpdate) SetStatus

func (uu *UserUpdate) SetStatus(b bool) *UserUpdate

SetStatus sets the "status" field.

func (*UserUpdate) SetTotpSecret

func (uu *UserUpdate) SetTotpSecret(s string) *UserUpdate

SetTotpSecret sets the "totp_secret" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAuditLogIDs

func (uuo *UserUpdateOne) AddAuditLogIDs(ids ...uuid.UUID) *UserUpdateOne

AddAuditLogIDs adds the "audit_logs" edge to the AuditLog entity by IDs.

func (*UserUpdateOne) AddAuditLogs

func (uuo *UserUpdateOne) AddAuditLogs(a ...*AuditLog) *UserUpdateOne

AddAuditLogs adds the "audit_logs" edges to the AuditLog entity.

func (*UserUpdateOne) AddLoginAttempts

func (uuo *UserUpdateOne) AddLoginAttempts(i int) *UserUpdateOne

AddLoginAttempts adds i to the "login_attempts" field.

func (*UserUpdateOne) ClearAccount

func (uuo *UserUpdateOne) ClearAccount() *UserUpdateOne

ClearAccount clears the "account" edge to the Account entity.

func (*UserUpdateOne) ClearAuditLogs

func (uuo *UserUpdateOne) ClearAuditLogs() *UserUpdateOne

ClearAuditLogs clears all "audit_logs" edges to the AuditLog entity.

func (*UserUpdateOne) ClearAvatar

func (uuo *UserUpdateOne) ClearAvatar() *UserUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdateOne) ClearBio

func (uuo *UserUpdateOne) ClearBio() *UserUpdateOne

ClearBio clears the value of the "bio" field.

func (*UserUpdateOne) ClearLockoutTime

func (uuo *UserUpdateOne) ClearLockoutTime() *UserUpdateOne

ClearLockoutTime clears the value of the "lockout_time" field.

func (*UserUpdateOne) ClearNickname

func (uuo *UserUpdateOne) ClearNickname() *UserUpdateOne

ClearNickname clears the value of the "nickname" field.

func (*UserUpdateOne) ClearPhoneNumber

func (uuo *UserUpdateOne) ClearPhoneNumber() *UserUpdateOne

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserUpdateOne) ClearRole

func (uuo *UserUpdateOne) ClearRole() *UserUpdateOne

ClearRole clears the "role" edge to the Role entity.

func (*UserUpdateOne) ClearSocialLogins

func (uuo *UserUpdateOne) ClearSocialLogins() *UserUpdateOne

ClearSocialLogins clears the value of the "social_logins" field.

func (*UserUpdateOne) ClearTotpSecret

func (uuo *UserUpdateOne) ClearTotpSecret() *UserUpdateOne

ClearTotpSecret clears the value of the "totp_secret" field.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAuditLogIDs

func (uuo *UserUpdateOne) RemoveAuditLogIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveAuditLogIDs removes the "audit_logs" edge to AuditLog entities by IDs.

func (*UserUpdateOne) RemoveAuditLogs

func (uuo *UserUpdateOne) RemoveAuditLogs(a ...*AuditLog) *UserUpdateOne

RemoveAuditLogs removes "audit_logs" edges to AuditLog entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAccount

func (uuo *UserUpdateOne) SetAccount(a *Account) *UserUpdateOne

SetAccount sets the "account" edge to the Account entity.

func (*UserUpdateOne) SetAccountID

func (uuo *UserUpdateOne) SetAccountID(id uuid.UUID) *UserUpdateOne

SetAccountID sets the "account" edge to the Account entity by ID.

func (*UserUpdateOne) SetAvatar

func (uuo *UserUpdateOne) SetAvatar(s string) *UserUpdateOne

SetAvatar sets the "avatar" field.

func (*UserUpdateOne) SetBio

func (uuo *UserUpdateOne) SetBio(s string) *UserUpdateOne

SetBio sets the "bio" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetEmailVerified

func (uuo *UserUpdateOne) SetEmailVerified(b bool) *UserUpdateOne

SetEmailVerified sets the "email_verified" field.

func (*UserUpdateOne) SetIsDefault

func (uuo *UserUpdateOne) SetIsDefault(b bool) *UserUpdateOne

SetIsDefault sets the "is_default" field.

func (*UserUpdateOne) SetLastLoginTime

func (uuo *UserUpdateOne) SetLastLoginTime(t time.Time) *UserUpdateOne

SetLastLoginTime sets the "last_login_time" field.

func (*UserUpdateOne) SetLockoutTime

func (uuo *UserUpdateOne) SetLockoutTime(t time.Time) *UserUpdateOne

SetLockoutTime sets the "lockout_time" field.

func (*UserUpdateOne) SetLoginAttempts

func (uuo *UserUpdateOne) SetLoginAttempts(i int) *UserUpdateOne

SetLoginAttempts sets the "login_attempts" field.

func (*UserUpdateOne) SetNickname

func (uuo *UserUpdateOne) SetNickname(s string) *UserUpdateOne

SetNickname sets the "nickname" field.

func (*UserUpdateOne) SetNillableAvatar

func (uuo *UserUpdateOne) SetNillableAvatar(s *string) *UserUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdateOne) SetNillableBio

func (uuo *UserUpdateOne) SetNillableBio(s *string) *UserUpdateOne

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmailVerified

func (uuo *UserUpdateOne) SetNillableEmailVerified(b *bool) *UserUpdateOne

SetNillableEmailVerified sets the "email_verified" field if the given value is not nil.

func (*UserUpdateOne) SetNillableIsDefault

func (uuo *UserUpdateOne) SetNillableIsDefault(b *bool) *UserUpdateOne

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLastLoginTime

func (uuo *UserUpdateOne) SetNillableLastLoginTime(t *time.Time) *UserUpdateOne

SetNillableLastLoginTime sets the "last_login_time" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLockoutTime

func (uuo *UserUpdateOne) SetNillableLockoutTime(t *time.Time) *UserUpdateOne

SetNillableLockoutTime sets the "lockout_time" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLoginAttempts

func (uuo *UserUpdateOne) SetNillableLoginAttempts(i *int) *UserUpdateOne

SetNillableLoginAttempts sets the "login_attempts" field if the given value is not nil.

func (*UserUpdateOne) SetNillableNickname

func (uuo *UserUpdateOne) SetNillableNickname(s *string) *UserUpdateOne

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserUpdateOne) SetNillableOnline

func (uuo *UserUpdateOne) SetNillableOnline(b *bool) *UserUpdateOne

SetNillableOnline sets the "online" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePassword

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhoneNumber

func (uuo *UserUpdateOne) SetNillablePhoneNumber(s *string) *UserUpdateOne

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhoneNumberVerified

func (uuo *UserUpdateOne) SetNillablePhoneNumberVerified(b *bool) *UserUpdateOne

SetNillablePhoneNumberVerified sets the "phone_number_verified" field if the given value is not nil.

func (*UserUpdateOne) SetNillableStatus

func (uuo *UserUpdateOne) SetNillableStatus(b *bool) *UserUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdateOne) SetNillableTotpSecret

func (uuo *UserUpdateOne) SetNillableTotpSecret(s *string) *UserUpdateOne

SetNillableTotpSecret sets the "totp_secret" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername

func (uuo *UserUpdateOne) SetNillableUsername(s *string) *UserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdateOne) SetOnline

func (uuo *UserUpdateOne) SetOnline(b bool) *UserUpdateOne

SetOnline sets the "online" field.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetPhoneNumber

func (uuo *UserUpdateOne) SetPhoneNumber(s string) *UserUpdateOne

SetPhoneNumber sets the "phone_number" field.

func (*UserUpdateOne) SetPhoneNumberVerified

func (uuo *UserUpdateOne) SetPhoneNumberVerified(b bool) *UserUpdateOne

SetPhoneNumberVerified sets the "phone_number_verified" field.

func (*UserUpdateOne) SetRole

func (uuo *UserUpdateOne) SetRole(r *Role) *UserUpdateOne

SetRole sets the "role" edge to the Role entity.

func (*UserUpdateOne) SetRoleID

func (uuo *UserUpdateOne) SetRoleID(id uuid.UUID) *UserUpdateOne

SetRoleID sets the "role" edge to the Role entity by ID.

func (*UserUpdateOne) SetSocialLogins

func (uuo *UserUpdateOne) SetSocialLogins(m map[string]string) *UserUpdateOne

SetSocialLogins sets the "social_logins" field.

func (*UserUpdateOne) SetStatus

func (uuo *UserUpdateOne) SetStatus(b bool) *UserUpdateOne

SetStatus sets the "status" field.

func (*UserUpdateOne) SetTotpSecret

func (uuo *UserUpdateOne) SetTotpSecret(s string) *UserUpdateOne

SetTotpSecret sets the "totp_secret" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL