ent

package
v0.0.0-...-fc1b19b Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 24 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.
	TypeAdmin      = "Admin"
	TypePermission = "Permission"
	TypeRole       = "Role"
	TypeRoute      = "Route"
	TypeTodo       = "Todo"
)

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 Admin

type Admin struct {

	// ID of the ent.
	ID int `json:"id" rql:"filter,sort"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt,omitempty" rql:"filter,sort"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	// IsEnable holds the value of the "is_enable" field.
	IsEnable bool `json:"isEnable"  rql:"filter,sort"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt int `json:"-"`
	// Username holds the value of the "username" field.
	Username string `json:"username" rql:"column=username,filter,sort"`
	// Password holds the value of the "password" field.
	Password string `json:"-" rql:"-"`
	// WhitelistIps holds the value of the "whitelist_ips" field.
	WhitelistIps []string `json:"whitelistIps"`
	// DisplayName holds the value of the "display_name" field.
	DisplayName string `json:"displayName,omitempty" rql:"column=display_name,filter,sort"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AdminQuery when eager-loading is set.
	Edges AdminEdges `json:"edges" rql:"-"`
	// contains filtered or unexported fields
}

Admin is the model entity for the Admin schema.

func (*Admin) QueryRoles

func (a *Admin) QueryRoles() *RoleQuery

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

func (*Admin) String

func (a *Admin) String() string

String implements the fmt.Stringer.

func (*Admin) Unwrap

func (a *Admin) Unwrap() *Admin

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

func (a *Admin) Update() *AdminUpdateOne

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

func (*Admin) Value

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

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

type AdminClient

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

AdminClient is a client for the Admin schema.

func NewAdminClient

func NewAdminClient(c config) *AdminClient

NewAdminClient returns a client for the Admin from the given config.

func (*AdminClient) Create

func (c *AdminClient) Create() *AdminCreate

Create returns a builder for creating a Admin entity.

func (*AdminClient) CreateBulk

func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk

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

func (*AdminClient) Delete

func (c *AdminClient) Delete() *AdminDelete

Delete returns a delete builder for Admin.

func (*AdminClient) DeleteOne

func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AdminClient) DeleteOneID

func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne

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

func (*AdminClient) Get

func (c *AdminClient) Get(ctx context.Context, id int) (*Admin, error)

Get returns a Admin entity by its id.

func (*AdminClient) GetX

func (c *AdminClient) GetX(ctx context.Context, id int) *Admin

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

func (*AdminClient) Hooks

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

Hooks returns the client hooks.

func (*AdminClient) Intercept

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

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

func (*AdminClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AdminClient) MapCreateBulk

func (c *AdminClient) MapCreateBulk(slice any, setFunc func(*AdminCreate, int)) *AdminCreateBulk

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

func (c *AdminClient) Query() *AdminQuery

Query returns a query builder for Admin.

func (*AdminClient) QueryRoles

func (c *AdminClient) QueryRoles(a *Admin) *RoleQuery

QueryRoles queries the roles edge of a Admin.

func (*AdminClient) Update

func (c *AdminClient) Update() *AdminUpdate

Update returns an update builder for Admin.

func (*AdminClient) UpdateOne

func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AdminClient) UpdateOneID

func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AdminClient) Use

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

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

type AdminCreate

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

AdminCreate is the builder for creating a Admin entity.

func (*AdminCreate) AddRoleIDs

func (ac *AdminCreate) AddRoleIDs(ids ...int) *AdminCreate

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

func (*AdminCreate) AddRoles

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

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

func (*AdminCreate) Exec

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

Exec executes the query.

func (*AdminCreate) ExecX

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

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

func (*AdminCreate) Mutation

func (ac *AdminCreate) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminCreate) Save

func (ac *AdminCreate) Save(ctx context.Context) (*Admin, error)

Save creates the Admin in the database.

func (*AdminCreate) SaveX

func (ac *AdminCreate) SaveX(ctx context.Context) *Admin

SaveX calls Save and panics if Save returns an error.

func (*AdminCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AdminCreate) SetDeletedAt

func (ac *AdminCreate) SetDeletedAt(i int) *AdminCreate

SetDeletedAt sets the "deleted_at" field.

func (*AdminCreate) SetDisplayName

func (ac *AdminCreate) SetDisplayName(s string) *AdminCreate

SetDisplayName sets the "display_name" field.

func (*AdminCreate) SetIsEnable

func (ac *AdminCreate) SetIsEnable(b bool) *AdminCreate

SetIsEnable sets the "is_enable" field.

func (*AdminCreate) SetNillableCreatedAt

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

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

func (*AdminCreate) SetNillableDeletedAt

func (ac *AdminCreate) SetNillableDeletedAt(i *int) *AdminCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AdminCreate) SetNillableDisplayName

func (ac *AdminCreate) SetNillableDisplayName(s *string) *AdminCreate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*AdminCreate) SetNillableIsEnable

func (ac *AdminCreate) SetNillableIsEnable(b *bool) *AdminCreate

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*AdminCreate) SetNillableUpdatedAt

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

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

func (*AdminCreate) SetPassword

func (ac *AdminCreate) SetPassword(s string) *AdminCreate

SetPassword sets the "password" field.

func (*AdminCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AdminCreate) SetUsername

func (ac *AdminCreate) SetUsername(s string) *AdminCreate

SetUsername sets the "username" field.

func (*AdminCreate) SetWhitelistIps

func (ac *AdminCreate) SetWhitelistIps(s []string) *AdminCreate

SetWhitelistIps sets the "whitelist_ips" field.

type AdminCreateBulk

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

AdminCreateBulk is the builder for creating many Admin entities in bulk.

func (*AdminCreateBulk) Exec

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

Exec executes the query.

func (*AdminCreateBulk) ExecX

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

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

func (*AdminCreateBulk) Save

func (acb *AdminCreateBulk) Save(ctx context.Context) ([]*Admin, error)

Save creates the Admin entities in the database.

func (*AdminCreateBulk) SaveX

func (acb *AdminCreateBulk) SaveX(ctx context.Context) []*Admin

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

type AdminDelete

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

AdminDelete is the builder for deleting a Admin entity.

func (*AdminDelete) Exec

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

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

func (*AdminDelete) ExecX

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

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

func (*AdminDelete) Where

func (ad *AdminDelete) Where(ps ...predicate.Admin) *AdminDelete

Where appends a list predicates to the AdminDelete builder.

type AdminDeleteOne

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

AdminDeleteOne is the builder for deleting a single Admin entity.

func (*AdminDeleteOne) Exec

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

Exec executes the deletion query.

func (*AdminDeleteOne) ExecX

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

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

func (*AdminDeleteOne) Where

func (ado *AdminDeleteOne) Where(ps ...predicate.Admin) *AdminDeleteOne

Where appends a list predicates to the AdminDelete builder.

type AdminEdges

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

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

func (AdminEdges) RolesOrErr

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

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

type AdminGroupBy

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

AdminGroupBy is the group-by builder for Admin entities.

func (*AdminGroupBy) Aggregate

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

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

func (*AdminGroupBy) Bool

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

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

func (*AdminGroupBy) BoolX

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

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

func (*AdminGroupBy) Bools

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

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

func (*AdminGroupBy) BoolsX

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

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

func (*AdminGroupBy) Float64

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

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

func (*AdminGroupBy) Float64X

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

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

func (*AdminGroupBy) Float64s

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

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

func (*AdminGroupBy) Float64sX

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

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

func (*AdminGroupBy) Int

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

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

func (*AdminGroupBy) IntX

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

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

func (*AdminGroupBy) Ints

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

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

func (*AdminGroupBy) IntsX

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

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

func (*AdminGroupBy) Scan

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

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

func (*AdminGroupBy) ScanX

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

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

func (*AdminGroupBy) String

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

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

func (*AdminGroupBy) StringX

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

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

func (*AdminGroupBy) Strings

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

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

func (*AdminGroupBy) StringsX

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

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

type AdminMutation

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

AdminMutation represents an operation that mutates the Admin nodes in the graph.

func (*AdminMutation) AddDeletedAt

func (m *AdminMutation) AddDeletedAt(i int)

AddDeletedAt adds i to the "deleted_at" field.

func (*AdminMutation) AddField

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

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

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

func (*AdminMutation) AddedDeletedAt

func (m *AdminMutation) AddedDeletedAt() (r int, exists bool)

AddedDeletedAt returns the value that was added to the "deleted_at" field in this mutation.

func (*AdminMutation) AddedEdges

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

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

func (*AdminMutation) AddedField

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

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

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

func (*AdminMutation) AddedIDs

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

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

func (*AdminMutation) AppendWhitelistIps

func (m *AdminMutation) AppendWhitelistIps(s []string)

AppendWhitelistIps adds s to the "whitelist_ips" field.

func (*AdminMutation) AppendedWhitelistIps

func (m *AdminMutation) AppendedWhitelistIps() ([]string, bool)

AppendedWhitelistIps returns the list of values that were appended to the "whitelist_ips" field in this mutation.

func (*AdminMutation) ClearDisplayName

func (m *AdminMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" field.

func (*AdminMutation) ClearEdge

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

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

func (m *AdminMutation) ClearRoles()

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

func (*AdminMutation) ClearedEdges

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

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

func (*AdminMutation) ClearedFields

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

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

func (AdminMutation) Client

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

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

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

func (*AdminMutation) DeletedAt

func (m *AdminMutation) DeletedAt() (r int, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*AdminMutation) DisplayName

func (m *AdminMutation) DisplayName() (r string, exists bool)

DisplayName returns the value of the "display_name" field in the mutation.

func (*AdminMutation) DisplayNameCleared

func (m *AdminMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the "display_name" field was cleared in this mutation.

func (*AdminMutation) EdgeCleared

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

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

func (*AdminMutation) Field

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

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

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

func (*AdminMutation) Fields

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

func (m *AdminMutation) ID() (id int, exists bool)

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

func (*AdminMutation) IDs

func (m *AdminMutation) IDs(ctx context.Context) ([]int, error)

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

func (*AdminMutation) IsEnable

func (m *AdminMutation) IsEnable() (r bool, exists bool)

IsEnable returns the value of the "is_enable" field in the mutation.

func (*AdminMutation) OldCreatedAt

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

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

func (m *AdminMutation) OldDeletedAt(ctx context.Context) (v int, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldDisplayName

func (m *AdminMutation) OldDisplayName(ctx context.Context) (v string, err error)

OldDisplayName returns the old "display_name" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldField

func (m *AdminMutation) 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 (*AdminMutation) OldIsEnable

func (m *AdminMutation) OldIsEnable(ctx context.Context) (v bool, err error)

OldIsEnable returns the old "is_enable" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldPassword

func (m *AdminMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldUpdatedAt

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

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

func (m *AdminMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the Admin entity. If the Admin 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 (*AdminMutation) OldWhitelistIps

func (m *AdminMutation) OldWhitelistIps(ctx context.Context) (v []string, err error)

OldWhitelistIps returns the old "whitelist_ips" field's value of the Admin entity. If the Admin 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 (*AdminMutation) Op

func (m *AdminMutation) Op() Op

Op returns the operation name.

func (*AdminMutation) Password

func (m *AdminMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*AdminMutation) RemoveRoleIDs

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

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

func (*AdminMutation) RemovedEdges

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

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

func (*AdminMutation) RemovedIDs

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

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

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

func (*AdminMutation) ResetCreatedAt

func (m *AdminMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AdminMutation) ResetDeletedAt

func (m *AdminMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*AdminMutation) ResetDisplayName

func (m *AdminMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*AdminMutation) ResetEdge

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

func (m *AdminMutation) 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 (*AdminMutation) ResetIsEnable

func (m *AdminMutation) ResetIsEnable()

ResetIsEnable resets all changes to the "is_enable" field.

func (*AdminMutation) ResetPassword

func (m *AdminMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*AdminMutation) ResetRoles

func (m *AdminMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*AdminMutation) ResetUpdatedAt

func (m *AdminMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AdminMutation) ResetUsername

func (m *AdminMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*AdminMutation) ResetWhitelistIps

func (m *AdminMutation) ResetWhitelistIps()

ResetWhitelistIps resets all changes to the "whitelist_ips" field.

func (*AdminMutation) RolesCleared

func (m *AdminMutation) RolesCleared() bool

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

func (*AdminMutation) RolesIDs

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

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

func (*AdminMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AdminMutation) SetDeletedAt

func (m *AdminMutation) SetDeletedAt(i int)

SetDeletedAt sets the "deleted_at" field.

func (*AdminMutation) SetDisplayName

func (m *AdminMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" field.

func (*AdminMutation) SetField

func (m *AdminMutation) 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 (*AdminMutation) SetIsEnable

func (m *AdminMutation) SetIsEnable(b bool)

SetIsEnable sets the "is_enable" field.

func (*AdminMutation) SetOp

func (m *AdminMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AdminMutation) SetPassword

func (m *AdminMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*AdminMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AdminMutation) SetUsername

func (m *AdminMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*AdminMutation) SetWhitelistIps

func (m *AdminMutation) SetWhitelistIps(s []string)

SetWhitelistIps sets the "whitelist_ips" field.

func (AdminMutation) Tx

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

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

func (*AdminMutation) Type

func (m *AdminMutation) Type() string

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

func (*AdminMutation) UpdatedAt

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

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

func (*AdminMutation) Username

func (m *AdminMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*AdminMutation) Where

func (m *AdminMutation) Where(ps ...predicate.Admin)

Where appends a list predicates to the AdminMutation builder.

func (*AdminMutation) WhereP

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

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

func (*AdminMutation) WhitelistIps

func (m *AdminMutation) WhitelistIps() (r []string, exists bool)

WhitelistIps returns the value of the "whitelist_ips" field in the mutation.

type AdminQuery

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

AdminQuery is the builder for querying Admin entities.

func (*AdminQuery) Aggregate

func (aq *AdminQuery) Aggregate(fns ...AggregateFunc) *AdminSelect

Aggregate returns a AdminSelect configured with the given aggregations.

func (*AdminQuery) All

func (aq *AdminQuery) All(ctx context.Context) ([]*Admin, error)

All executes the query and returns a list of Admins.

func (*AdminQuery) AllX

func (aq *AdminQuery) AllX(ctx context.Context) []*Admin

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

func (*AdminQuery) Clone

func (aq *AdminQuery) Clone() *AdminQuery

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

func (*AdminQuery) Count

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

Count returns the count of the given query.

func (*AdminQuery) CountX

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

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

func (*AdminQuery) Exist

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

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

func (*AdminQuery) ExistX

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

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

func (*AdminQuery) First

func (aq *AdminQuery) First(ctx context.Context) (*Admin, error)

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

func (*AdminQuery) FirstID

func (aq *AdminQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AdminQuery) FirstIDX

func (aq *AdminQuery) FirstIDX(ctx context.Context) int

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

func (*AdminQuery) FirstX

func (aq *AdminQuery) FirstX(ctx context.Context) *Admin

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

func (*AdminQuery) GroupBy

func (aq *AdminQuery) GroupBy(field string, fields ...string) *AdminGroupBy

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

Example:

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

client.Admin.Query().
	GroupBy(admin.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AdminQuery) IDs

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

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

func (*AdminQuery) IDsX

func (aq *AdminQuery) IDsX(ctx context.Context) []int

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

func (*AdminQuery) Limit

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

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

func (*AdminQuery) Offset

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

Offset to start from.

func (*AdminQuery) Only

func (aq *AdminQuery) Only(ctx context.Context) (*Admin, error)

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

func (*AdminQuery) OnlyID

func (aq *AdminQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AdminQuery) OnlyIDX

func (aq *AdminQuery) OnlyIDX(ctx context.Context) int

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

func (*AdminQuery) OnlyX

func (aq *AdminQuery) OnlyX(ctx context.Context) *Admin

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

func (*AdminQuery) Order

func (aq *AdminQuery) Order(o ...admin.OrderOption) *AdminQuery

Order specifies how the records should be ordered.

func (*AdminQuery) QueryRoles

func (aq *AdminQuery) QueryRoles() *RoleQuery

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

func (*AdminQuery) Select

func (aq *AdminQuery) Select(fields ...string) *AdminSelect

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

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt,omitempty" rql:"filter,sort"`
}

client.Admin.Query().
	Select(admin.FieldCreatedAt).
	Scan(ctx, &v)

func (*AdminQuery) Unique

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

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

func (aq *AdminQuery) Where(ps ...predicate.Admin) *AdminQuery

Where adds a new predicate for the AdminQuery builder.

func (*AdminQuery) WithRoles

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

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 AdminSelect

type AdminSelect struct {
	*AdminQuery
	// contains filtered or unexported fields
}

AdminSelect is the builder for selecting fields of Admin entities.

func (*AdminSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*AdminSelect) Bool

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

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

func (*AdminSelect) BoolX

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

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

func (*AdminSelect) Bools

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

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

func (*AdminSelect) BoolsX

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

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

func (*AdminSelect) Float64

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

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

func (*AdminSelect) Float64X

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

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

func (*AdminSelect) Float64s

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

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

func (*AdminSelect) Float64sX

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

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

func (*AdminSelect) Int

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

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

func (*AdminSelect) IntX

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

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

func (*AdminSelect) Ints

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

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

func (*AdminSelect) IntsX

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

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

func (*AdminSelect) Scan

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

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

func (*AdminSelect) ScanX

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

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

func (*AdminSelect) String

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

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

func (*AdminSelect) StringX

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

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

func (*AdminSelect) Strings

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

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

func (*AdminSelect) StringsX

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

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

type AdminUpdate

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

AdminUpdate is the builder for updating Admin entities.

func (*AdminUpdate) AddDeletedAt

func (au *AdminUpdate) AddDeletedAt(i int) *AdminUpdate

AddDeletedAt adds i to the "deleted_at" field.

func (*AdminUpdate) AddRoleIDs

func (au *AdminUpdate) AddRoleIDs(ids ...int) *AdminUpdate

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

func (*AdminUpdate) AddRoles

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

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

func (*AdminUpdate) AppendWhitelistIps

func (au *AdminUpdate) AppendWhitelistIps(s []string) *AdminUpdate

AppendWhitelistIps appends s to the "whitelist_ips" field.

func (*AdminUpdate) ClearDisplayName

func (au *AdminUpdate) ClearDisplayName() *AdminUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*AdminUpdate) ClearRoles

func (au *AdminUpdate) ClearRoles() *AdminUpdate

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

func (*AdminUpdate) Exec

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

Exec executes the query.

func (*AdminUpdate) ExecX

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

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

func (*AdminUpdate) Mutation

func (au *AdminUpdate) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminUpdate) RemoveRoleIDs

func (au *AdminUpdate) RemoveRoleIDs(ids ...int) *AdminUpdate

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

func (*AdminUpdate) RemoveRoles

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

RemoveRoles removes "roles" edges to Role entities.

func (*AdminUpdate) Save

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

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

func (*AdminUpdate) SaveX

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

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

func (*AdminUpdate) SetCreatedAt

func (au *AdminUpdate) SetCreatedAt(t time.Time) *AdminUpdate

SetCreatedAt sets the "created_at" field.

func (*AdminUpdate) SetDeletedAt

func (au *AdminUpdate) SetDeletedAt(i int) *AdminUpdate

SetDeletedAt sets the "deleted_at" field.

func (*AdminUpdate) SetDisplayName

func (au *AdminUpdate) SetDisplayName(s string) *AdminUpdate

SetDisplayName sets the "display_name" field.

func (*AdminUpdate) SetIsEnable

func (au *AdminUpdate) SetIsEnable(b bool) *AdminUpdate

SetIsEnable sets the "is_enable" field.

func (*AdminUpdate) SetNillableCreatedAt

func (au *AdminUpdate) SetNillableCreatedAt(t *time.Time) *AdminUpdate

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

func (*AdminUpdate) SetNillableDeletedAt

func (au *AdminUpdate) SetNillableDeletedAt(i *int) *AdminUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AdminUpdate) SetNillableDisplayName

func (au *AdminUpdate) SetNillableDisplayName(s *string) *AdminUpdate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*AdminUpdate) SetNillableIsEnable

func (au *AdminUpdate) SetNillableIsEnable(b *bool) *AdminUpdate

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*AdminUpdate) SetNillablePassword

func (au *AdminUpdate) SetNillablePassword(s *string) *AdminUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*AdminUpdate) SetNillableUsername

func (au *AdminUpdate) SetNillableUsername(s *string) *AdminUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AdminUpdate) SetPassword

func (au *AdminUpdate) SetPassword(s string) *AdminUpdate

SetPassword sets the "password" field.

func (*AdminUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AdminUpdate) SetUsername

func (au *AdminUpdate) SetUsername(s string) *AdminUpdate

SetUsername sets the "username" field.

func (*AdminUpdate) SetWhitelistIps

func (au *AdminUpdate) SetWhitelistIps(s []string) *AdminUpdate

SetWhitelistIps sets the "whitelist_ips" field.

func (*AdminUpdate) Where

func (au *AdminUpdate) Where(ps ...predicate.Admin) *AdminUpdate

Where appends a list predicates to the AdminUpdate builder.

type AdminUpdateOne

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

AdminUpdateOne is the builder for updating a single Admin entity.

func (*AdminUpdateOne) AddDeletedAt

func (auo *AdminUpdateOne) AddDeletedAt(i int) *AdminUpdateOne

AddDeletedAt adds i to the "deleted_at" field.

func (*AdminUpdateOne) AddRoleIDs

func (auo *AdminUpdateOne) AddRoleIDs(ids ...int) *AdminUpdateOne

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

func (*AdminUpdateOne) AddRoles

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

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

func (*AdminUpdateOne) AppendWhitelistIps

func (auo *AdminUpdateOne) AppendWhitelistIps(s []string) *AdminUpdateOne

AppendWhitelistIps appends s to the "whitelist_ips" field.

func (*AdminUpdateOne) ClearDisplayName

func (auo *AdminUpdateOne) ClearDisplayName() *AdminUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*AdminUpdateOne) ClearRoles

func (auo *AdminUpdateOne) ClearRoles() *AdminUpdateOne

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

func (*AdminUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AdminUpdateOne) ExecX

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

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

func (*AdminUpdateOne) Mutation

func (auo *AdminUpdateOne) Mutation() *AdminMutation

Mutation returns the AdminMutation object of the builder.

func (*AdminUpdateOne) RemoveRoleIDs

func (auo *AdminUpdateOne) RemoveRoleIDs(ids ...int) *AdminUpdateOne

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

func (*AdminUpdateOne) RemoveRoles

func (auo *AdminUpdateOne) RemoveRoles(r ...*Role) *AdminUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*AdminUpdateOne) Save

func (auo *AdminUpdateOne) Save(ctx context.Context) (*Admin, error)

Save executes the query and returns the updated Admin entity.

func (*AdminUpdateOne) SaveX

func (auo *AdminUpdateOne) SaveX(ctx context.Context) *Admin

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

func (*AdminUpdateOne) Select

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

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

func (*AdminUpdateOne) SetCreatedAt

func (auo *AdminUpdateOne) SetCreatedAt(t time.Time) *AdminUpdateOne

SetCreatedAt sets the "created_at" field.

func (*AdminUpdateOne) SetDeletedAt

func (auo *AdminUpdateOne) SetDeletedAt(i int) *AdminUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*AdminUpdateOne) SetDisplayName

func (auo *AdminUpdateOne) SetDisplayName(s string) *AdminUpdateOne

SetDisplayName sets the "display_name" field.

func (*AdminUpdateOne) SetIsEnable

func (auo *AdminUpdateOne) SetIsEnable(b bool) *AdminUpdateOne

SetIsEnable sets the "is_enable" field.

func (*AdminUpdateOne) SetNillableCreatedAt

func (auo *AdminUpdateOne) SetNillableCreatedAt(t *time.Time) *AdminUpdateOne

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

func (*AdminUpdateOne) SetNillableDeletedAt

func (auo *AdminUpdateOne) SetNillableDeletedAt(i *int) *AdminUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*AdminUpdateOne) SetNillableDisplayName

func (auo *AdminUpdateOne) SetNillableDisplayName(s *string) *AdminUpdateOne

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*AdminUpdateOne) SetNillableIsEnable

func (auo *AdminUpdateOne) SetNillableIsEnable(b *bool) *AdminUpdateOne

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*AdminUpdateOne) SetNillablePassword

func (auo *AdminUpdateOne) SetNillablePassword(s *string) *AdminUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*AdminUpdateOne) SetNillableUsername

func (auo *AdminUpdateOne) SetNillableUsername(s *string) *AdminUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AdminUpdateOne) SetPassword

func (auo *AdminUpdateOne) SetPassword(s string) *AdminUpdateOne

SetPassword sets the "password" field.

func (*AdminUpdateOne) SetUpdatedAt

func (auo *AdminUpdateOne) SetUpdatedAt(t time.Time) *AdminUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AdminUpdateOne) SetUsername

func (auo *AdminUpdateOne) SetUsername(s string) *AdminUpdateOne

SetUsername sets the "username" field.

func (*AdminUpdateOne) SetWhitelistIps

func (auo *AdminUpdateOne) SetWhitelistIps(s []string) *AdminUpdateOne

SetWhitelistIps sets the "whitelist_ips" field.

func (*AdminUpdateOne) Where

func (auo *AdminUpdateOne) Where(ps ...predicate.Admin) *AdminUpdateOne

Where appends a list predicates to the AdminUpdate builder.

type Admins

type Admins []*Admin

Admins is a parsable slice of Admin.

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Admin is the client for interacting with the Admin builders.
	Admin *AdminClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Route is the client for interacting with the Route builders.
	Route *RouteClient
	// Todo is the client for interacting with the Todo builders.
	Todo *TodoClient
	// 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().
	Admin.
	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 Permission

type Permission struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Group holds the value of the "group" field.
	Group string `json:"group,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Key holds the value of the "key" field.
	Key string `json:"key,omitempty"`
	// Order holds the value of the "order" field.
	Order int `json:"order,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PermissionQuery when eager-loading is set.
	Edges PermissionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Permission is the model entity for the Permission schema.

func (*Permission) QueryRoles

func (pe *Permission) QueryRoles() *RoleQuery

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

func (*Permission) String

func (pe *Permission) String() string

String implements the fmt.Stringer.

func (*Permission) Unwrap

func (pe *Permission) Unwrap() *Permission

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

func (pe *Permission) Update() *PermissionUpdateOne

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

func (*Permission) Value

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

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

type PermissionClient

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

PermissionClient is a client for the Permission schema.

func NewPermissionClient

func NewPermissionClient(c config) *PermissionClient

NewPermissionClient returns a client for the Permission from the given config.

func (*PermissionClient) Create

func (c *PermissionClient) Create() *PermissionCreate

Create returns a builder for creating a Permission entity.

func (*PermissionClient) CreateBulk

func (c *PermissionClient) CreateBulk(builders ...*PermissionCreate) *PermissionCreateBulk

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

func (*PermissionClient) Delete

func (c *PermissionClient) Delete() *PermissionDelete

Delete returns a delete builder for Permission.

func (*PermissionClient) DeleteOne

func (c *PermissionClient) DeleteOne(pe *Permission) *PermissionDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PermissionClient) DeleteOneID

func (c *PermissionClient) DeleteOneID(id int) *PermissionDeleteOne

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

func (*PermissionClient) Get

func (c *PermissionClient) Get(ctx context.Context, id int) (*Permission, error)

Get returns a Permission entity by its id.

func (*PermissionClient) GetX

func (c *PermissionClient) GetX(ctx context.Context, id int) *Permission

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

func (*PermissionClient) Hooks

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

Hooks returns the client hooks.

func (*PermissionClient) Intercept

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

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

func (*PermissionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PermissionClient) MapCreateBulk

func (c *PermissionClient) MapCreateBulk(slice any, setFunc func(*PermissionCreate, int)) *PermissionCreateBulk

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

func (c *PermissionClient) Query() *PermissionQuery

Query returns a query builder for Permission.

func (*PermissionClient) QueryRoles

func (c *PermissionClient) QueryRoles(pe *Permission) *RoleQuery

QueryRoles queries the roles edge of a Permission.

func (*PermissionClient) Update

func (c *PermissionClient) Update() *PermissionUpdate

Update returns an update builder for Permission.

func (*PermissionClient) UpdateOne

func (c *PermissionClient) UpdateOne(pe *Permission) *PermissionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PermissionClient) UpdateOneID

func (c *PermissionClient) UpdateOneID(id int) *PermissionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PermissionClient) Use

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

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

type PermissionCreate

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

PermissionCreate is the builder for creating a Permission entity.

func (*PermissionCreate) AddRoleIDs

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

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

func (*PermissionCreate) AddRoles

func (pc *PermissionCreate) AddRoles(r ...*Role) *PermissionCreate

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

func (*PermissionCreate) Exec

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

Exec executes the query.

func (*PermissionCreate) ExecX

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

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

func (*PermissionCreate) Mutation

func (pc *PermissionCreate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionCreate) Save

func (pc *PermissionCreate) Save(ctx context.Context) (*Permission, error)

Save creates the Permission in the database.

func (*PermissionCreate) SaveX

func (pc *PermissionCreate) SaveX(ctx context.Context) *Permission

SaveX calls Save and panics if Save returns an error.

func (*PermissionCreate) SetGroup

func (pc *PermissionCreate) SetGroup(s string) *PermissionCreate

SetGroup sets the "group" field.

func (*PermissionCreate) SetKey

func (pc *PermissionCreate) SetKey(s string) *PermissionCreate

SetKey sets the "key" field.

func (*PermissionCreate) SetName

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

SetName sets the "name" field.

func (*PermissionCreate) SetOrder

func (pc *PermissionCreate) SetOrder(i int) *PermissionCreate

SetOrder sets the "order" field.

type PermissionCreateBulk

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

PermissionCreateBulk is the builder for creating many Permission entities in bulk.

func (*PermissionCreateBulk) Exec

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

Exec executes the query.

func (*PermissionCreateBulk) ExecX

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

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

func (*PermissionCreateBulk) Save

func (pcb *PermissionCreateBulk) Save(ctx context.Context) ([]*Permission, error)

Save creates the Permission entities in the database.

func (*PermissionCreateBulk) SaveX

func (pcb *PermissionCreateBulk) SaveX(ctx context.Context) []*Permission

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

type PermissionDelete

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

PermissionDelete is the builder for deleting a Permission entity.

func (*PermissionDelete) Exec

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

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

func (*PermissionDelete) ExecX

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

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

func (*PermissionDelete) Where

Where appends a list predicates to the PermissionDelete builder.

type PermissionDeleteOne

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

PermissionDeleteOne is the builder for deleting a single Permission entity.

func (*PermissionDeleteOne) Exec

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

Exec executes the deletion query.

func (*PermissionDeleteOne) ExecX

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

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

func (*PermissionDeleteOne) Where

Where appends a list predicates to the PermissionDelete builder.

type PermissionEdges

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

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

func (PermissionEdges) RolesOrErr

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

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

type PermissionGroupBy

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

PermissionGroupBy is the group-by builder for Permission entities.

func (*PermissionGroupBy) Aggregate

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

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

func (*PermissionGroupBy) Bool

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

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

func (*PermissionGroupBy) BoolX

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

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

func (*PermissionGroupBy) Bools

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

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

func (*PermissionGroupBy) BoolsX

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

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

func (*PermissionGroupBy) Float64

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

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

func (*PermissionGroupBy) Float64X

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

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

func (*PermissionGroupBy) Float64s

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

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

func (*PermissionGroupBy) Float64sX

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

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

func (*PermissionGroupBy) Int

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

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

func (*PermissionGroupBy) IntX

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

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

func (*PermissionGroupBy) Ints

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

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

func (*PermissionGroupBy) IntsX

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

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

func (*PermissionGroupBy) Scan

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

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

func (*PermissionGroupBy) ScanX

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

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

func (*PermissionGroupBy) String

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

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

func (*PermissionGroupBy) StringX

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

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

func (*PermissionGroupBy) Strings

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

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

func (*PermissionGroupBy) StringsX

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

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

type PermissionMutation

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

PermissionMutation represents an operation that mutates the Permission nodes in the graph.

func (*PermissionMutation) AddField

func (m *PermissionMutation) 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 (*PermissionMutation) AddOrder

func (m *PermissionMutation) AddOrder(i int)

AddOrder adds i to the "order" field.

func (*PermissionMutation) AddRoleIDs

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

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

func (*PermissionMutation) AddedEdges

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

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

func (*PermissionMutation) AddedField

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

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

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

func (*PermissionMutation) AddedIDs

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

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

func (*PermissionMutation) AddedOrder

func (m *PermissionMutation) AddedOrder() (r int, exists bool)

AddedOrder returns the value that was added to the "order" field in this mutation.

func (*PermissionMutation) ClearEdge

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

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

func (m *PermissionMutation) ClearRoles()

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

func (*PermissionMutation) ClearedEdges

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

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

func (*PermissionMutation) ClearedFields

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

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

func (PermissionMutation) Client

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

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

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

func (*PermissionMutation) Field

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

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

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

func (*PermissionMutation) Fields

func (m *PermissionMutation) 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 (*PermissionMutation) Group

func (m *PermissionMutation) Group() (r string, exists bool)

Group returns the value of the "group" field in the mutation.

func (*PermissionMutation) ID

func (m *PermissionMutation) ID() (id int, exists bool)

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

func (*PermissionMutation) IDs

func (m *PermissionMutation) IDs(ctx context.Context) ([]int, error)

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

func (*PermissionMutation) Key

func (m *PermissionMutation) Key() (r string, exists bool)

Key returns the value of the "key" field in the mutation.

func (*PermissionMutation) Name

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

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

func (*PermissionMutation) OldField

func (m *PermissionMutation) 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 (*PermissionMutation) OldGroup

func (m *PermissionMutation) OldGroup(ctx context.Context) (v string, err error)

OldGroup returns the old "group" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) OldKey

func (m *PermissionMutation) OldKey(ctx context.Context) (v string, err error)

OldKey returns the old "key" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) OldName

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

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

func (m *PermissionMutation) OldOrder(ctx context.Context) (v int, err error)

OldOrder returns the old "order" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) Op

func (m *PermissionMutation) Op() Op

Op returns the operation name.

func (*PermissionMutation) Order

func (m *PermissionMutation) Order() (r int, exists bool)

Order returns the value of the "order" field in the mutation.

func (*PermissionMutation) RemoveRoleIDs

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

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

func (*PermissionMutation) RemovedEdges

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

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

func (*PermissionMutation) RemovedIDs

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

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

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

func (*PermissionMutation) ResetEdge

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

func (m *PermissionMutation) 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 (*PermissionMutation) ResetGroup

func (m *PermissionMutation) ResetGroup()

ResetGroup resets all changes to the "group" field.

func (*PermissionMutation) ResetKey

func (m *PermissionMutation) ResetKey()

ResetKey resets all changes to the "key" field.

func (*PermissionMutation) ResetName

func (m *PermissionMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PermissionMutation) ResetOrder

func (m *PermissionMutation) ResetOrder()

ResetOrder resets all changes to the "order" field.

func (*PermissionMutation) ResetRoles

func (m *PermissionMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*PermissionMutation) RolesCleared

func (m *PermissionMutation) RolesCleared() bool

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

func (*PermissionMutation) RolesIDs

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

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

func (*PermissionMutation) SetField

func (m *PermissionMutation) 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 (*PermissionMutation) SetGroup

func (m *PermissionMutation) SetGroup(s string)

SetGroup sets the "group" field.

func (*PermissionMutation) SetKey

func (m *PermissionMutation) SetKey(s string)

SetKey sets the "key" field.

func (*PermissionMutation) SetName

func (m *PermissionMutation) SetName(s string)

SetName sets the "name" field.

func (*PermissionMutation) SetOp

func (m *PermissionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PermissionMutation) SetOrder

func (m *PermissionMutation) SetOrder(i int)

SetOrder sets the "order" field.

func (PermissionMutation) Tx

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

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

func (*PermissionMutation) Type

func (m *PermissionMutation) Type() string

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

func (*PermissionMutation) Where

func (m *PermissionMutation) Where(ps ...predicate.Permission)

Where appends a list predicates to the PermissionMutation builder.

func (*PermissionMutation) WhereP

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

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

type PermissionQuery

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

PermissionQuery is the builder for querying Permission entities.

func (*PermissionQuery) Aggregate

func (pq *PermissionQuery) Aggregate(fns ...AggregateFunc) *PermissionSelect

Aggregate returns a PermissionSelect configured with the given aggregations.

func (*PermissionQuery) All

func (pq *PermissionQuery) All(ctx context.Context) ([]*Permission, error)

All executes the query and returns a list of Permissions.

func (*PermissionQuery) AllX

func (pq *PermissionQuery) AllX(ctx context.Context) []*Permission

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

func (*PermissionQuery) Clone

func (pq *PermissionQuery) Clone() *PermissionQuery

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

func (*PermissionQuery) Count

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

Count returns the count of the given query.

func (*PermissionQuery) CountX

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

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

func (*PermissionQuery) Exist

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

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

func (*PermissionQuery) ExistX

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

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

func (*PermissionQuery) First

func (pq *PermissionQuery) First(ctx context.Context) (*Permission, error)

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

func (*PermissionQuery) FirstID

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

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

func (*PermissionQuery) FirstIDX

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

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

func (*PermissionQuery) FirstX

func (pq *PermissionQuery) FirstX(ctx context.Context) *Permission

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

func (*PermissionQuery) GroupBy

func (pq *PermissionQuery) GroupBy(field string, fields ...string) *PermissionGroupBy

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

client.Permission.Query().
	GroupBy(permission.FieldGroup).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PermissionQuery) IDs

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

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

func (*PermissionQuery) IDsX

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

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

func (*PermissionQuery) Limit

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

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

func (*PermissionQuery) Offset

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

Offset to start from.

func (*PermissionQuery) Only

func (pq *PermissionQuery) Only(ctx context.Context) (*Permission, error)

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

func (*PermissionQuery) OnlyID

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

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

func (*PermissionQuery) OnlyIDX

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

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

func (*PermissionQuery) OnlyX

func (pq *PermissionQuery) OnlyX(ctx context.Context) *Permission

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

func (*PermissionQuery) Order

Order specifies how the records should be ordered.

func (*PermissionQuery) QueryRoles

func (pq *PermissionQuery) QueryRoles() *RoleQuery

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

func (*PermissionQuery) Select

func (pq *PermissionQuery) Select(fields ...string) *PermissionSelect

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

client.Permission.Query().
	Select(permission.FieldGroup).
	Scan(ctx, &v)

func (*PermissionQuery) Unique

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

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

Where adds a new predicate for the PermissionQuery builder.

func (*PermissionQuery) WithRoles

func (pq *PermissionQuery) WithRoles(opts ...func(*RoleQuery)) *PermissionQuery

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 PermissionSelect

type PermissionSelect struct {
	*PermissionQuery
	// contains filtered or unexported fields
}

PermissionSelect is the builder for selecting fields of Permission entities.

func (*PermissionSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*PermissionSelect) Bool

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

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

func (*PermissionSelect) BoolX

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

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

func (*PermissionSelect) Bools

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

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

func (*PermissionSelect) BoolsX

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

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

func (*PermissionSelect) Float64

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

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

func (*PermissionSelect) Float64X

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

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

func (*PermissionSelect) Float64s

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

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

func (*PermissionSelect) Float64sX

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

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

func (*PermissionSelect) Int

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

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

func (*PermissionSelect) IntX

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

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

func (*PermissionSelect) Ints

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

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

func (*PermissionSelect) IntsX

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

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

func (*PermissionSelect) Scan

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

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

func (*PermissionSelect) ScanX

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

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

func (*PermissionSelect) String

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

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

func (*PermissionSelect) StringX

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

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

func (*PermissionSelect) Strings

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

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

func (*PermissionSelect) StringsX

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

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

type PermissionUpdate

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

PermissionUpdate is the builder for updating Permission entities.

func (*PermissionUpdate) AddOrder

func (pu *PermissionUpdate) AddOrder(i int) *PermissionUpdate

AddOrder adds i to the "order" field.

func (*PermissionUpdate) AddRoleIDs

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

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

func (*PermissionUpdate) AddRoles

func (pu *PermissionUpdate) AddRoles(r ...*Role) *PermissionUpdate

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

func (*PermissionUpdate) ClearRoles

func (pu *PermissionUpdate) ClearRoles() *PermissionUpdate

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

func (*PermissionUpdate) Exec

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

Exec executes the query.

func (*PermissionUpdate) ExecX

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

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

func (*PermissionUpdate) Mutation

func (pu *PermissionUpdate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdate) RemoveRoleIDs

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

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

func (*PermissionUpdate) RemoveRoles

func (pu *PermissionUpdate) RemoveRoles(r ...*Role) *PermissionUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*PermissionUpdate) Save

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

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

func (*PermissionUpdate) SaveX

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

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

func (*PermissionUpdate) SetGroup

func (pu *PermissionUpdate) SetGroup(s string) *PermissionUpdate

SetGroup sets the "group" field.

func (*PermissionUpdate) SetKey

func (pu *PermissionUpdate) SetKey(s string) *PermissionUpdate

SetKey sets the "key" field.

func (*PermissionUpdate) SetName

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

SetName sets the "name" field.

func (*PermissionUpdate) SetNillableGroup

func (pu *PermissionUpdate) SetNillableGroup(s *string) *PermissionUpdate

SetNillableGroup sets the "group" field if the given value is not nil.

func (*PermissionUpdate) SetNillableKey

func (pu *PermissionUpdate) SetNillableKey(s *string) *PermissionUpdate

SetNillableKey sets the "key" field if the given value is not nil.

func (*PermissionUpdate) SetNillableName

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

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

func (*PermissionUpdate) SetNillableOrder

func (pu *PermissionUpdate) SetNillableOrder(i *int) *PermissionUpdate

SetNillableOrder sets the "order" field if the given value is not nil.

func (*PermissionUpdate) SetOrder

func (pu *PermissionUpdate) SetOrder(i int) *PermissionUpdate

SetOrder sets the "order" field.

func (*PermissionUpdate) Where

Where appends a list predicates to the PermissionUpdate builder.

type PermissionUpdateOne

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

PermissionUpdateOne is the builder for updating a single Permission entity.

func (*PermissionUpdateOne) AddOrder

func (puo *PermissionUpdateOne) AddOrder(i int) *PermissionUpdateOne

AddOrder adds i to the "order" field.

func (*PermissionUpdateOne) AddRoleIDs

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

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

func (*PermissionUpdateOne) AddRoles

func (puo *PermissionUpdateOne) AddRoles(r ...*Role) *PermissionUpdateOne

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

func (*PermissionUpdateOne) ClearRoles

func (puo *PermissionUpdateOne) ClearRoles() *PermissionUpdateOne

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

func (*PermissionUpdateOne) Exec

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

Exec executes the query on the entity.

func (*PermissionUpdateOne) ExecX

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

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

func (*PermissionUpdateOne) Mutation

func (puo *PermissionUpdateOne) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdateOne) RemoveRoleIDs

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

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

func (*PermissionUpdateOne) RemoveRoles

func (puo *PermissionUpdateOne) RemoveRoles(r ...*Role) *PermissionUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*PermissionUpdateOne) Save

func (puo *PermissionUpdateOne) Save(ctx context.Context) (*Permission, error)

Save executes the query and returns the updated Permission entity.

func (*PermissionUpdateOne) SaveX

func (puo *PermissionUpdateOne) SaveX(ctx context.Context) *Permission

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

func (*PermissionUpdateOne) Select

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

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

func (*PermissionUpdateOne) SetGroup

SetGroup sets the "group" field.

func (*PermissionUpdateOne) SetKey

SetKey sets the "key" field.

func (*PermissionUpdateOne) SetName

SetName sets the "name" field.

func (*PermissionUpdateOne) SetNillableGroup

func (puo *PermissionUpdateOne) SetNillableGroup(s *string) *PermissionUpdateOne

SetNillableGroup sets the "group" field if the given value is not nil.

func (*PermissionUpdateOne) SetNillableKey

func (puo *PermissionUpdateOne) SetNillableKey(s *string) *PermissionUpdateOne

SetNillableKey sets the "key" field if the given value is not nil.

func (*PermissionUpdateOne) SetNillableName

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

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

func (*PermissionUpdateOne) SetNillableOrder

func (puo *PermissionUpdateOne) SetNillableOrder(i *int) *PermissionUpdateOne

SetNillableOrder sets the "order" field if the given value is not nil.

func (*PermissionUpdateOne) SetOrder

func (puo *PermissionUpdateOne) SetOrder(i int) *PermissionUpdateOne

SetOrder sets the "order" field.

func (*PermissionUpdateOne) Where

Where appends a list predicates to the PermissionUpdate builder.

type Permissions

type Permissions []*Permission

Permissions is a parsable slice of Permission.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type Role

type Role struct {

	// ID of the ent.
	ID int `json:"id" rql:"filter,sort"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt,omitempty" rql:"filter,sort"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	// IsEnable holds the value of the "is_enable" field.
	IsEnable bool `json:"isEnable"  rql:"filter,sort"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt int `json:"-"`
	// 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"`
	// Order holds the value of the "order" field.
	Order int `json:"order,omitempty"`
	// IsChangeable holds the value of the "is_changeable" field.
	IsChangeable bool `json:"isChangeable,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" rql:"-"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) QueryAdmins

func (r *Role) QueryAdmins() *AdminQuery

QueryAdmins queries the "admins" edge of the Role entity.

func (*Role) QueryPermissions

func (r *Role) QueryPermissions() *PermissionQuery

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

func (*Role) QueryRoutes

func (r *Role) QueryRoutes() *RouteQuery

QueryRoutes queries the "routes" 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 int) *RoleDeleteOne

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

func (*RoleClient) Get

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

Get returns a Role entity by its id.

func (*RoleClient) GetX

func (c *RoleClient) GetX(ctx context.Context, id int) *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) QueryAdmins

func (c *RoleClient) QueryAdmins(r *Role) *AdminQuery

QueryAdmins queries the admins edge of a Role.

func (*RoleClient) QueryPermissions

func (c *RoleClient) QueryPermissions(r *Role) *PermissionQuery

QueryPermissions queries the permissions edge of a Role.

func (*RoleClient) QueryRoutes

func (c *RoleClient) QueryRoutes(r *Role) *RouteQuery

QueryRoutes queries the routes 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 int) *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) AddAdminIDs

func (rc *RoleCreate) AddAdminIDs(ids ...int) *RoleCreate

AddAdminIDs adds the "admins" edge to the Admin entity by IDs.

func (*RoleCreate) AddAdmins

func (rc *RoleCreate) AddAdmins(a ...*Admin) *RoleCreate

AddAdmins adds the "admins" edges to the Admin entity.

func (*RoleCreate) AddPermissionIDs

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

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

func (*RoleCreate) AddPermissions

func (rc *RoleCreate) AddPermissions(p ...*Permission) *RoleCreate

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

func (*RoleCreate) AddRouteIDs

func (rc *RoleCreate) AddRouteIDs(ids ...int) *RoleCreate

AddRouteIDs adds the "routes" edge to the Route entity by IDs.

func (*RoleCreate) AddRoutes

func (rc *RoleCreate) AddRoutes(r ...*Route) *RoleCreate

AddRoutes adds the "routes" edges to the Route 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleCreate) SetDeletedAt

func (rc *RoleCreate) SetDeletedAt(i int) *RoleCreate

SetDeletedAt sets the "deleted_at" field.

func (*RoleCreate) SetDescription

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

SetDescription sets the "description" field.

func (*RoleCreate) SetIsChangeable

func (rc *RoleCreate) SetIsChangeable(b bool) *RoleCreate

SetIsChangeable sets the "is_changeable" field.

func (*RoleCreate) SetIsEnable

func (rc *RoleCreate) SetIsEnable(b bool) *RoleCreate

SetIsEnable sets the "is_enable" field.

func (*RoleCreate) SetName

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

SetName sets the "name" field.

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) SetNillableDeletedAt

func (rc *RoleCreate) SetNillableDeletedAt(i *int) *RoleCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RoleCreate) SetNillableIsEnable

func (rc *RoleCreate) SetNillableIsEnable(b *bool) *RoleCreate

SetNillableIsEnable sets the "is_enable" 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) SetOrder

func (rc *RoleCreate) SetOrder(i int) *RoleCreate

SetOrder sets the "order" field.

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 {
	// Admins holds the value of the admins edge.
	Admins []*Admin `json:"admins,omitempty"`
	// Permissions holds the value of the permissions edge.
	Permissions []*Permission `json:"permissions,omitempty"`
	// Routes holds the value of the routes edge.
	Routes []*Route `json:"routes,omitempty"`
	// contains filtered or unexported fields
}

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

func (RoleEdges) AdminsOrErr

func (e RoleEdges) AdminsOrErr() ([]*Admin, error)

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

func (RoleEdges) PermissionsOrErr

func (e RoleEdges) PermissionsOrErr() ([]*Permission, error)

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

func (RoleEdges) RoutesOrErr

func (e RoleEdges) RoutesOrErr() ([]*Route, error)

RoutesOrErr returns the Routes 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) AddAdminIDs

func (m *RoleMutation) AddAdminIDs(ids ...int)

AddAdminIDs adds the "admins" edge to the Admin entity by ids.

func (*RoleMutation) AddDeletedAt

func (m *RoleMutation) AddDeletedAt(i int)

AddDeletedAt adds i to the "deleted_at" field.

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) AddOrder

func (m *RoleMutation) AddOrder(i int)

AddOrder adds i to the "order" field.

func (*RoleMutation) AddPermissionIDs

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

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

func (*RoleMutation) AddRouteIDs

func (m *RoleMutation) AddRouteIDs(ids ...int)

AddRouteIDs adds the "routes" edge to the Route entity by ids.

func (*RoleMutation) AddedDeletedAt

func (m *RoleMutation) AddedDeletedAt() (r int, exists bool)

AddedDeletedAt returns the value that was added to the "deleted_at" field in this mutation.

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) AddedOrder

func (m *RoleMutation) AddedOrder() (r int, exists bool)

AddedOrder returns the value that was added to the "order" field in this mutation.

func (*RoleMutation) AdminsCleared

func (m *RoleMutation) AdminsCleared() bool

AdminsCleared reports if the "admins" edge to the Admin entity was cleared.

func (*RoleMutation) AdminsIDs

func (m *RoleMutation) AdminsIDs() (ids []int)

AdminsIDs returns the "admins" edge IDs in the mutation.

func (*RoleMutation) ClearAdmins

func (m *RoleMutation) ClearAdmins()

ClearAdmins clears the "admins" edge to the Admin entity.

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) ClearPermissions

func (m *RoleMutation) ClearPermissions()

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

func (*RoleMutation) ClearRoutes

func (m *RoleMutation) ClearRoutes()

ClearRoutes clears the "routes" edge to the Route 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) DeletedAt

func (m *RoleMutation) DeletedAt() (r int, exists bool)

DeletedAt returns the value of the "deleted_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) 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 int, exists bool)

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

func (*RoleMutation) IDs

func (m *RoleMutation) IDs(ctx context.Context) ([]int, error)

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

func (*RoleMutation) IsChangeable

func (m *RoleMutation) IsChangeable() (r bool, exists bool)

IsChangeable returns the value of the "is_changeable" field in the mutation.

func (*RoleMutation) IsEnable

func (m *RoleMutation) IsEnable() (r bool, exists bool)

IsEnable returns the value of the "is_enable" 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) OldDeletedAt

func (m *RoleMutation) OldDeletedAt(ctx context.Context) (v int, err error)

OldDeletedAt returns the old "deleted_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) OldIsChangeable

func (m *RoleMutation) OldIsChangeable(ctx context.Context) (v bool, err error)

OldIsChangeable returns the old "is_changeable" 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) OldIsEnable

func (m *RoleMutation) OldIsEnable(ctx context.Context) (v bool, err error)

OldIsEnable returns the old "is_enable" 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) OldOrder

func (m *RoleMutation) OldOrder(ctx context.Context) (v int, err error)

OldOrder returns the old "order" 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) Order

func (m *RoleMutation) Order() (r int, exists bool)

Order returns the value of the "order" field in the mutation.

func (*RoleMutation) PermissionsCleared

func (m *RoleMutation) PermissionsCleared() bool

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

func (*RoleMutation) PermissionsIDs

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

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

func (*RoleMutation) RemoveAdminIDs

func (m *RoleMutation) RemoveAdminIDs(ids ...int)

RemoveAdminIDs removes the "admins" edge to the Admin entity by IDs.

func (*RoleMutation) RemovePermissionIDs

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

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

func (*RoleMutation) RemoveRouteIDs

func (m *RoleMutation) RemoveRouteIDs(ids ...int)

RemoveRouteIDs removes the "routes" edge to the Route entity by IDs.

func (*RoleMutation) RemovedAdminsIDs

func (m *RoleMutation) RemovedAdminsIDs() (ids []int)

RemovedAdmins returns the removed IDs of the "admins" edge to the Admin 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) RemovedPermissionsIDs

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

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

func (*RoleMutation) RemovedRoutesIDs

func (m *RoleMutation) RemovedRoutesIDs() (ids []int)

RemovedRoutes returns the removed IDs of the "routes" edge to the Route entity.

func (*RoleMutation) ResetAdmins

func (m *RoleMutation) ResetAdmins()

ResetAdmins resets all changes to the "admins" edge.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetDeletedAt

func (m *RoleMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_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) ResetIsChangeable

func (m *RoleMutation) ResetIsChangeable()

ResetIsChangeable resets all changes to the "is_changeable" field.

func (*RoleMutation) ResetIsEnable

func (m *RoleMutation) ResetIsEnable()

ResetIsEnable resets all changes to the "is_enable" field.

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetOrder

func (m *RoleMutation) ResetOrder()

ResetOrder resets all changes to the "order" field.

func (*RoleMutation) ResetPermissions

func (m *RoleMutation) ResetPermissions()

ResetPermissions resets all changes to the "permissions" edge.

func (*RoleMutation) ResetRoutes

func (m *RoleMutation) ResetRoutes()

ResetRoutes resets all changes to the "routes" edge.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) RoutesCleared

func (m *RoleMutation) RoutesCleared() bool

RoutesCleared reports if the "routes" edge to the Route entity was cleared.

func (*RoleMutation) RoutesIDs

func (m *RoleMutation) RoutesIDs() (ids []int)

RoutesIDs returns the "routes" edge IDs in the mutation.

func (*RoleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetDeletedAt

func (m *RoleMutation) SetDeletedAt(i int)

SetDeletedAt sets the "deleted_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) SetIsChangeable

func (m *RoleMutation) SetIsChangeable(b bool)

SetIsChangeable sets the "is_changeable" field.

func (*RoleMutation) SetIsEnable

func (m *RoleMutation) SetIsEnable(b bool)

SetIsEnable sets the "is_enable" 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) SetOrder

func (m *RoleMutation) SetOrder(i int)

SetOrder sets the "order" field.

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) 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 int, 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) int

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:"createdAt,omitempty" rql:"filter,sort"`
	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 []int, err error)

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

func (*RoleQuery) IDsX

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

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 int, 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) int

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) QueryAdmins

func (rq *RoleQuery) QueryAdmins() *AdminQuery

QueryAdmins chains the current query on the "admins" edge.

func (*RoleQuery) QueryPermissions

func (rq *RoleQuery) QueryPermissions() *PermissionQuery

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

func (*RoleQuery) QueryRoutes

func (rq *RoleQuery) QueryRoutes() *RouteQuery

QueryRoutes chains the current query on the "routes" 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:"createdAt,omitempty" rql:"filter,sort"`
}

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) WithAdmins

func (rq *RoleQuery) WithAdmins(opts ...func(*AdminQuery)) *RoleQuery

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

func (*RoleQuery) WithPermissions

func (rq *RoleQuery) WithPermissions(opts ...func(*PermissionQuery)) *RoleQuery

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

func (*RoleQuery) WithRoutes

func (rq *RoleQuery) WithRoutes(opts ...func(*RouteQuery)) *RoleQuery

WithRoutes tells the query-builder to eager-load the nodes that are connected to the "routes" 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) AddAdminIDs

func (ru *RoleUpdate) AddAdminIDs(ids ...int) *RoleUpdate

AddAdminIDs adds the "admins" edge to the Admin entity by IDs.

func (*RoleUpdate) AddAdmins

func (ru *RoleUpdate) AddAdmins(a ...*Admin) *RoleUpdate

AddAdmins adds the "admins" edges to the Admin entity.

func (*RoleUpdate) AddDeletedAt

func (ru *RoleUpdate) AddDeletedAt(i int) *RoleUpdate

AddDeletedAt adds i to the "deleted_at" field.

func (*RoleUpdate) AddOrder

func (ru *RoleUpdate) AddOrder(i int) *RoleUpdate

AddOrder adds i to the "order" field.

func (*RoleUpdate) AddPermissionIDs

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

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

func (*RoleUpdate) AddPermissions

func (ru *RoleUpdate) AddPermissions(p ...*Permission) *RoleUpdate

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

func (*RoleUpdate) AddRouteIDs

func (ru *RoleUpdate) AddRouteIDs(ids ...int) *RoleUpdate

AddRouteIDs adds the "routes" edge to the Route entity by IDs.

func (*RoleUpdate) AddRoutes

func (ru *RoleUpdate) AddRoutes(r ...*Route) *RoleUpdate

AddRoutes adds the "routes" edges to the Route entity.

func (*RoleUpdate) ClearAdmins

func (ru *RoleUpdate) ClearAdmins() *RoleUpdate

ClearAdmins clears all "admins" edges to the Admin entity.

func (*RoleUpdate) ClearPermissions

func (ru *RoleUpdate) ClearPermissions() *RoleUpdate

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

func (*RoleUpdate) ClearRoutes

func (ru *RoleUpdate) ClearRoutes() *RoleUpdate

ClearRoutes clears all "routes" edges to the Route 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) RemoveAdminIDs

func (ru *RoleUpdate) RemoveAdminIDs(ids ...int) *RoleUpdate

RemoveAdminIDs removes the "admins" edge to Admin entities by IDs.

func (*RoleUpdate) RemoveAdmins

func (ru *RoleUpdate) RemoveAdmins(a ...*Admin) *RoleUpdate

RemoveAdmins removes "admins" edges to Admin entities.

func (*RoleUpdate) RemovePermissionIDs

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

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

func (*RoleUpdate) RemovePermissions

func (ru *RoleUpdate) RemovePermissions(p ...*Permission) *RoleUpdate

RemovePermissions removes "permissions" edges to Permission entities.

func (*RoleUpdate) RemoveRouteIDs

func (ru *RoleUpdate) RemoveRouteIDs(ids ...int) *RoleUpdate

RemoveRouteIDs removes the "routes" edge to Route entities by IDs.

func (*RoleUpdate) RemoveRoutes

func (ru *RoleUpdate) RemoveRoutes(r ...*Route) *RoleUpdate

RemoveRoutes removes "routes" edges to Route 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) SetCreatedAt

func (ru *RoleUpdate) SetCreatedAt(t time.Time) *RoleUpdate

SetCreatedAt sets the "created_at" field.

func (*RoleUpdate) SetDeletedAt

func (ru *RoleUpdate) SetDeletedAt(i int) *RoleUpdate

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpdate) SetDescription

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

SetDescription sets the "description" field.

func (*RoleUpdate) SetIsChangeable

func (ru *RoleUpdate) SetIsChangeable(b bool) *RoleUpdate

SetIsChangeable sets the "is_changeable" field.

func (*RoleUpdate) SetIsEnable

func (ru *RoleUpdate) SetIsEnable(b bool) *RoleUpdate

SetIsEnable sets the "is_enable" field.

func (*RoleUpdate) SetName

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

SetName sets the "name" field.

func (*RoleUpdate) SetNillableCreatedAt

func (ru *RoleUpdate) SetNillableCreatedAt(t *time.Time) *RoleUpdate

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

func (*RoleUpdate) SetNillableDeletedAt

func (ru *RoleUpdate) SetNillableDeletedAt(i *int) *RoleUpdate

SetNillableDeletedAt sets the "deleted_at" field 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) SetNillableIsChangeable

func (ru *RoleUpdate) SetNillableIsChangeable(b *bool) *RoleUpdate

SetNillableIsChangeable sets the "is_changeable" field if the given value is not nil.

func (*RoleUpdate) SetNillableIsEnable

func (ru *RoleUpdate) SetNillableIsEnable(b *bool) *RoleUpdate

SetNillableIsEnable sets the "is_enable" 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) SetNillableOrder

func (ru *RoleUpdate) SetNillableOrder(i *int) *RoleUpdate

SetNillableOrder sets the "order" field if the given value is not nil.

func (*RoleUpdate) SetOrder

func (ru *RoleUpdate) SetOrder(i int) *RoleUpdate

SetOrder sets the "order" field.

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) AddAdminIDs

func (ruo *RoleUpdateOne) AddAdminIDs(ids ...int) *RoleUpdateOne

AddAdminIDs adds the "admins" edge to the Admin entity by IDs.

func (*RoleUpdateOne) AddAdmins

func (ruo *RoleUpdateOne) AddAdmins(a ...*Admin) *RoleUpdateOne

AddAdmins adds the "admins" edges to the Admin entity.

func (*RoleUpdateOne) AddDeletedAt

func (ruo *RoleUpdateOne) AddDeletedAt(i int) *RoleUpdateOne

AddDeletedAt adds i to the "deleted_at" field.

func (*RoleUpdateOne) AddOrder

func (ruo *RoleUpdateOne) AddOrder(i int) *RoleUpdateOne

AddOrder adds i to the "order" field.

func (*RoleUpdateOne) AddPermissionIDs

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

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

func (*RoleUpdateOne) AddPermissions

func (ruo *RoleUpdateOne) AddPermissions(p ...*Permission) *RoleUpdateOne

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

func (*RoleUpdateOne) AddRouteIDs

func (ruo *RoleUpdateOne) AddRouteIDs(ids ...int) *RoleUpdateOne

AddRouteIDs adds the "routes" edge to the Route entity by IDs.

func (*RoleUpdateOne) AddRoutes

func (ruo *RoleUpdateOne) AddRoutes(r ...*Route) *RoleUpdateOne

AddRoutes adds the "routes" edges to the Route entity.

func (*RoleUpdateOne) ClearAdmins

func (ruo *RoleUpdateOne) ClearAdmins() *RoleUpdateOne

ClearAdmins clears all "admins" edges to the Admin entity.

func (*RoleUpdateOne) ClearPermissions

func (ruo *RoleUpdateOne) ClearPermissions() *RoleUpdateOne

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

func (*RoleUpdateOne) ClearRoutes

func (ruo *RoleUpdateOne) ClearRoutes() *RoleUpdateOne

ClearRoutes clears all "routes" edges to the Route 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) RemoveAdminIDs

func (ruo *RoleUpdateOne) RemoveAdminIDs(ids ...int) *RoleUpdateOne

RemoveAdminIDs removes the "admins" edge to Admin entities by IDs.

func (*RoleUpdateOne) RemoveAdmins

func (ruo *RoleUpdateOne) RemoveAdmins(a ...*Admin) *RoleUpdateOne

RemoveAdmins removes "admins" edges to Admin entities.

func (*RoleUpdateOne) RemovePermissionIDs

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

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

func (*RoleUpdateOne) RemovePermissions

func (ruo *RoleUpdateOne) RemovePermissions(p ...*Permission) *RoleUpdateOne

RemovePermissions removes "permissions" edges to Permission entities.

func (*RoleUpdateOne) RemoveRouteIDs

func (ruo *RoleUpdateOne) RemoveRouteIDs(ids ...int) *RoleUpdateOne

RemoveRouteIDs removes the "routes" edge to Route entities by IDs.

func (*RoleUpdateOne) RemoveRoutes

func (ruo *RoleUpdateOne) RemoveRoutes(r ...*Route) *RoleUpdateOne

RemoveRoutes removes "routes" edges to Route 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) SetCreatedAt

func (ruo *RoleUpdateOne) SetCreatedAt(t time.Time) *RoleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*RoleUpdateOne) SetDeletedAt

func (ruo *RoleUpdateOne) SetDeletedAt(i int) *RoleUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpdateOne) SetDescription

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

SetDescription sets the "description" field.

func (*RoleUpdateOne) SetIsChangeable

func (ruo *RoleUpdateOne) SetIsChangeable(b bool) *RoleUpdateOne

SetIsChangeable sets the "is_changeable" field.

func (*RoleUpdateOne) SetIsEnable

func (ruo *RoleUpdateOne) SetIsEnable(b bool) *RoleUpdateOne

SetIsEnable sets the "is_enable" field.

func (*RoleUpdateOne) SetName

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

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableCreatedAt

func (ruo *RoleUpdateOne) SetNillableCreatedAt(t *time.Time) *RoleUpdateOne

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

func (*RoleUpdateOne) SetNillableDeletedAt

func (ruo *RoleUpdateOne) SetNillableDeletedAt(i *int) *RoleUpdateOne

SetNillableDeletedAt sets the "deleted_at" field 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) SetNillableIsChangeable

func (ruo *RoleUpdateOne) SetNillableIsChangeable(b *bool) *RoleUpdateOne

SetNillableIsChangeable sets the "is_changeable" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableIsEnable

func (ruo *RoleUpdateOne) SetNillableIsEnable(b *bool) *RoleUpdateOne

SetNillableIsEnable sets the "is_enable" 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) SetNillableOrder

func (ruo *RoleUpdateOne) SetNillableOrder(i *int) *RoleUpdateOne

SetNillableOrder sets the "order" field if the given value is not nil.

func (*RoleUpdateOne) SetOrder

func (ruo *RoleUpdateOne) SetOrder(i int) *RoleUpdateOne

SetOrder sets the "order" field.

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 Route

type Route struct {

	// ID of the ent.
	ID int `json:"id" rql:"filter,sort"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"createdAt,omitempty" rql:"filter,sort"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	// IsEnable holds the value of the "is_enable" field.
	IsEnable bool `json:"isEnable"  rql:"filter,sort"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt int `json:"-"`
	// ParentID holds the value of the "parent_id" field.
	ParentID *int `json:"parentId,omitempty"`
	// Path holds the value of the "path" field.
	Path string `json:"path,omitempty"`
	// Component holds the value of the "component" field.
	Component string `json:"component,omitempty"`
	// Redirect holds the value of the "redirect" field.
	Redirect string `json:"redirect,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Type holds the value of the "type" field.
	Type int `json:"type,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Meta holds the value of the "meta" field.
	Meta map[string]interface{} `json:"meta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RouteQuery when eager-loading is set.
	Edges RouteEdges `json:"edges" rql:"-"`
	// contains filtered or unexported fields
}

Route is the model entity for the Route schema.

func (*Route) QueryChildren

func (r *Route) QueryChildren() *RouteQuery

QueryChildren queries the "children" edge of the Route entity.

func (*Route) QueryParent

func (r *Route) QueryParent() *RouteQuery

QueryParent queries the "parent" edge of the Route entity.

func (*Route) QueryRoles

func (r *Route) QueryRoles() *RoleQuery

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

func (*Route) String

func (r *Route) String() string

String implements the fmt.Stringer.

func (*Route) Unwrap

func (r *Route) Unwrap() *Route

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

func (r *Route) Update() *RouteUpdateOne

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

func (*Route) Value

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

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

type RouteClient

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

RouteClient is a client for the Route schema.

func NewRouteClient

func NewRouteClient(c config) *RouteClient

NewRouteClient returns a client for the Route from the given config.

func (*RouteClient) Create

func (c *RouteClient) Create() *RouteCreate

Create returns a builder for creating a Route entity.

func (*RouteClient) CreateBulk

func (c *RouteClient) CreateBulk(builders ...*RouteCreate) *RouteCreateBulk

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

func (*RouteClient) Delete

func (c *RouteClient) Delete() *RouteDelete

Delete returns a delete builder for Route.

func (*RouteClient) DeleteOne

func (c *RouteClient) DeleteOne(r *Route) *RouteDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RouteClient) DeleteOneID

func (c *RouteClient) DeleteOneID(id int) *RouteDeleteOne

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

func (*RouteClient) Get

func (c *RouteClient) Get(ctx context.Context, id int) (*Route, error)

Get returns a Route entity by its id.

func (*RouteClient) GetX

func (c *RouteClient) GetX(ctx context.Context, id int) *Route

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

func (*RouteClient) Hooks

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

Hooks returns the client hooks.

func (*RouteClient) Intercept

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

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

func (*RouteClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RouteClient) MapCreateBulk

func (c *RouteClient) MapCreateBulk(slice any, setFunc func(*RouteCreate, int)) *RouteCreateBulk

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

func (c *RouteClient) Query() *RouteQuery

Query returns a query builder for Route.

func (*RouteClient) QueryChildren

func (c *RouteClient) QueryChildren(r *Route) *RouteQuery

QueryChildren queries the children edge of a Route.

func (*RouteClient) QueryParent

func (c *RouteClient) QueryParent(r *Route) *RouteQuery

QueryParent queries the parent edge of a Route.

func (*RouteClient) QueryRoles

func (c *RouteClient) QueryRoles(r *Route) *RoleQuery

QueryRoles queries the roles edge of a Route.

func (*RouteClient) Update

func (c *RouteClient) Update() *RouteUpdate

Update returns an update builder for Route.

func (*RouteClient) UpdateOne

func (c *RouteClient) UpdateOne(r *Route) *RouteUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RouteClient) UpdateOneID

func (c *RouteClient) UpdateOneID(id int) *RouteUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RouteClient) Use

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

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

type RouteCreate

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

RouteCreate is the builder for creating a Route entity.

func (*RouteCreate) AddChildIDs

func (rc *RouteCreate) AddChildIDs(ids ...int) *RouteCreate

AddChildIDs adds the "children" edge to the Route entity by IDs.

func (*RouteCreate) AddChildren

func (rc *RouteCreate) AddChildren(r ...*Route) *RouteCreate

AddChildren adds the "children" edges to the Route entity.

func (*RouteCreate) AddRoleIDs

func (rc *RouteCreate) AddRoleIDs(ids ...int) *RouteCreate

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

func (*RouteCreate) AddRoles

func (rc *RouteCreate) AddRoles(r ...*Role) *RouteCreate

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

func (*RouteCreate) Exec

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

Exec executes the query.

func (*RouteCreate) ExecX

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

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

func (*RouteCreate) Mutation

func (rc *RouteCreate) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteCreate) Save

func (rc *RouteCreate) Save(ctx context.Context) (*Route, error)

Save creates the Route in the database.

func (*RouteCreate) SaveX

func (rc *RouteCreate) SaveX(ctx context.Context) *Route

SaveX calls Save and panics if Save returns an error.

func (*RouteCreate) SetComponent

func (rc *RouteCreate) SetComponent(s string) *RouteCreate

SetComponent sets the "component" field.

func (*RouteCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RouteCreate) SetDeletedAt

func (rc *RouteCreate) SetDeletedAt(i int) *RouteCreate

SetDeletedAt sets the "deleted_at" field.

func (*RouteCreate) SetID

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

SetID sets the "id" field.

func (*RouteCreate) SetIsEnable

func (rc *RouteCreate) SetIsEnable(b bool) *RouteCreate

SetIsEnable sets the "is_enable" field.

func (*RouteCreate) SetMeta

func (rc *RouteCreate) SetMeta(m map[string]interface{}) *RouteCreate

SetMeta sets the "meta" field.

func (*RouteCreate) SetName

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

SetName sets the "name" field.

func (*RouteCreate) SetNillableCreatedAt

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

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

func (*RouteCreate) SetNillableDeletedAt

func (rc *RouteCreate) SetNillableDeletedAt(i *int) *RouteCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RouteCreate) SetNillableIsEnable

func (rc *RouteCreate) SetNillableIsEnable(b *bool) *RouteCreate

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*RouteCreate) SetNillableParentID

func (rc *RouteCreate) SetNillableParentID(i *int) *RouteCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*RouteCreate) SetNillableUpdatedAt

func (rc *RouteCreate) SetNillableUpdatedAt(t *time.Time) *RouteCreate

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

func (*RouteCreate) SetParent

func (rc *RouteCreate) SetParent(r *Route) *RouteCreate

SetParent sets the "parent" edge to the Route entity.

func (*RouteCreate) SetParentID

func (rc *RouteCreate) SetParentID(i int) *RouteCreate

SetParentID sets the "parent_id" field.

func (*RouteCreate) SetPath

func (rc *RouteCreate) SetPath(s string) *RouteCreate

SetPath sets the "path" field.

func (*RouteCreate) SetRedirect

func (rc *RouteCreate) SetRedirect(s string) *RouteCreate

SetRedirect sets the "redirect" field.

func (*RouteCreate) SetTitle

func (rc *RouteCreate) SetTitle(s string) *RouteCreate

SetTitle sets the "title" field.

func (*RouteCreate) SetType

func (rc *RouteCreate) SetType(i int) *RouteCreate

SetType sets the "type" field.

func (*RouteCreate) SetUpdatedAt

func (rc *RouteCreate) SetUpdatedAt(t time.Time) *RouteCreate

SetUpdatedAt sets the "updated_at" field.

type RouteCreateBulk

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

RouteCreateBulk is the builder for creating many Route entities in bulk.

func (*RouteCreateBulk) Exec

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

Exec executes the query.

func (*RouteCreateBulk) ExecX

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

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

func (*RouteCreateBulk) Save

func (rcb *RouteCreateBulk) Save(ctx context.Context) ([]*Route, error)

Save creates the Route entities in the database.

func (*RouteCreateBulk) SaveX

func (rcb *RouteCreateBulk) SaveX(ctx context.Context) []*Route

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

type RouteDelete

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

RouteDelete is the builder for deleting a Route entity.

func (*RouteDelete) Exec

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

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

func (*RouteDelete) ExecX

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

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

func (*RouteDelete) Where

func (rd *RouteDelete) Where(ps ...predicate.Route) *RouteDelete

Where appends a list predicates to the RouteDelete builder.

type RouteDeleteOne

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

RouteDeleteOne is the builder for deleting a single Route entity.

func (*RouteDeleteOne) Exec

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

Exec executes the deletion query.

func (*RouteDeleteOne) ExecX

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

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

func (*RouteDeleteOne) Where

func (rdo *RouteDeleteOne) Where(ps ...predicate.Route) *RouteDeleteOne

Where appends a list predicates to the RouteDelete builder.

type RouteEdges

type RouteEdges struct {
	// Parent holds the value of the parent edge.
	Parent *Route `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Route `json:"children,omitempty"`
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (RouteEdges) ChildrenOrErr

func (e RouteEdges) ChildrenOrErr() ([]*Route, error)

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

func (RouteEdges) ParentOrErr

func (e RouteEdges) ParentOrErr() (*Route, error)

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

func (RouteEdges) RolesOrErr

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

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

type RouteGroupBy

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

RouteGroupBy is the group-by builder for Route entities.

func (*RouteGroupBy) Aggregate

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

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

func (*RouteGroupBy) Bool

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

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

func (*RouteGroupBy) BoolX

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

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

func (*RouteGroupBy) Bools

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

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

func (*RouteGroupBy) BoolsX

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

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

func (*RouteGroupBy) Float64

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

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

func (*RouteGroupBy) Float64X

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

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

func (*RouteGroupBy) Float64s

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

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

func (*RouteGroupBy) Float64sX

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

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

func (*RouteGroupBy) Int

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

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

func (*RouteGroupBy) IntX

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

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

func (*RouteGroupBy) Ints

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

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

func (*RouteGroupBy) IntsX

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

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

func (*RouteGroupBy) Scan

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

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

func (*RouteGroupBy) ScanX

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

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

func (*RouteGroupBy) String

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

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

func (*RouteGroupBy) StringX

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

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

func (*RouteGroupBy) Strings

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

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

func (*RouteGroupBy) StringsX

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

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

type RouteMutation

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

RouteMutation represents an operation that mutates the Route nodes in the graph.

func (*RouteMutation) AddChildIDs

func (m *RouteMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the Route entity by ids.

func (*RouteMutation) AddDeletedAt

func (m *RouteMutation) AddDeletedAt(i int)

AddDeletedAt adds i to the "deleted_at" field.

func (*RouteMutation) AddField

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

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

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

func (*RouteMutation) AddType

func (m *RouteMutation) AddType(i int)

AddType adds i to the "type" field.

func (*RouteMutation) AddedDeletedAt

func (m *RouteMutation) AddedDeletedAt() (r int, exists bool)

AddedDeletedAt returns the value that was added to the "deleted_at" field in this mutation.

func (*RouteMutation) AddedEdges

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

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

func (*RouteMutation) AddedField

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

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

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

func (*RouteMutation) AddedIDs

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

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

func (*RouteMutation) AddedType

func (m *RouteMutation) AddedType() (r int, exists bool)

AddedType returns the value that was added to the "type" field in this mutation.

func (*RouteMutation) ChildrenCleared

func (m *RouteMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Route entity was cleared.

func (*RouteMutation) ChildrenIDs

func (m *RouteMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*RouteMutation) ClearChildren

func (m *RouteMutation) ClearChildren()

ClearChildren clears the "children" edge to the Route entity.

func (*RouteMutation) ClearEdge

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

func (m *RouteMutation) 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 (*RouteMutation) ClearParent

func (m *RouteMutation) ClearParent()

ClearParent clears the "parent" edge to the Route entity.

func (*RouteMutation) ClearParentID

func (m *RouteMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*RouteMutation) ClearRoles

func (m *RouteMutation) ClearRoles()

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

func (*RouteMutation) ClearedEdges

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

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

func (*RouteMutation) ClearedFields

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

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

func (RouteMutation) Client

func (m RouteMutation) 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 (*RouteMutation) Component

func (m *RouteMutation) Component() (r string, exists bool)

Component returns the value of the "component" field in the mutation.

func (*RouteMutation) CreatedAt

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

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

func (*RouteMutation) DeletedAt

func (m *RouteMutation) DeletedAt() (r int, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*RouteMutation) EdgeCleared

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

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

func (*RouteMutation) Field

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

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

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

func (*RouteMutation) Fields

func (m *RouteMutation) 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 (*RouteMutation) GetType

func (m *RouteMutation) GetType() (r int, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*RouteMutation) ID

func (m *RouteMutation) ID() (id int, exists bool)

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

func (*RouteMutation) IDs

func (m *RouteMutation) IDs(ctx context.Context) ([]int, error)

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

func (*RouteMutation) IsEnable

func (m *RouteMutation) IsEnable() (r bool, exists bool)

IsEnable returns the value of the "is_enable" field in the mutation.

func (*RouteMutation) Meta

func (m *RouteMutation) Meta() (r map[string]interface{}, exists bool)

Meta returns the value of the "meta" field in the mutation.

func (*RouteMutation) Name

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

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

func (*RouteMutation) OldComponent

func (m *RouteMutation) OldComponent(ctx context.Context) (v string, err error)

OldComponent returns the old "component" field's value of the Route entity. If the Route 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 (*RouteMutation) OldCreatedAt

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

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

func (m *RouteMutation) OldDeletedAt(ctx context.Context) (v int, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Route entity. If the Route 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 (*RouteMutation) OldField

func (m *RouteMutation) 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 (*RouteMutation) OldIsEnable

func (m *RouteMutation) OldIsEnable(ctx context.Context) (v bool, err error)

OldIsEnable returns the old "is_enable" field's value of the Route entity. If the Route 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 (*RouteMutation) OldMeta

func (m *RouteMutation) OldMeta(ctx context.Context) (v map[string]interface{}, err error)

OldMeta returns the old "meta" field's value of the Route entity. If the Route 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 (*RouteMutation) OldName

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

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

func (m *RouteMutation) OldParentID(ctx context.Context) (v *int, err error)

OldParentID returns the old "parent_id" field's value of the Route entity. If the Route 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 (*RouteMutation) OldPath

func (m *RouteMutation) OldPath(ctx context.Context) (v string, err error)

OldPath returns the old "path" field's value of the Route entity. If the Route 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 (*RouteMutation) OldRedirect

func (m *RouteMutation) OldRedirect(ctx context.Context) (v string, err error)

OldRedirect returns the old "redirect" field's value of the Route entity. If the Route 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 (*RouteMutation) OldTitle

func (m *RouteMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Route entity. If the Route 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 (*RouteMutation) OldType

func (m *RouteMutation) OldType(ctx context.Context) (v int, err error)

OldType returns the old "type" field's value of the Route entity. If the Route 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 (*RouteMutation) OldUpdatedAt

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

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

func (m *RouteMutation) Op() Op

Op returns the operation name.

func (*RouteMutation) ParentCleared

func (m *RouteMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Route entity was cleared.

func (*RouteMutation) ParentID

func (m *RouteMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*RouteMutation) ParentIDCleared

func (m *RouteMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*RouteMutation) ParentIDs

func (m *RouteMutation) ParentIDs() (ids []int)

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

func (*RouteMutation) Path

func (m *RouteMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*RouteMutation) Redirect

func (m *RouteMutation) Redirect() (r string, exists bool)

Redirect returns the value of the "redirect" field in the mutation.

func (*RouteMutation) RemoveChildIDs

func (m *RouteMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Route entity by IDs.

func (*RouteMutation) RemoveRoleIDs

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

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

func (*RouteMutation) RemovedChildrenIDs

func (m *RouteMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the Route entity.

func (*RouteMutation) RemovedEdges

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

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

func (*RouteMutation) RemovedIDs

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

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

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

func (*RouteMutation) ResetChildren

func (m *RouteMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*RouteMutation) ResetComponent

func (m *RouteMutation) ResetComponent()

ResetComponent resets all changes to the "component" field.

func (*RouteMutation) ResetCreatedAt

func (m *RouteMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RouteMutation) ResetDeletedAt

func (m *RouteMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*RouteMutation) ResetEdge

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

func (m *RouteMutation) 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 (*RouteMutation) ResetIsEnable

func (m *RouteMutation) ResetIsEnable()

ResetIsEnable resets all changes to the "is_enable" field.

func (*RouteMutation) ResetMeta

func (m *RouteMutation) ResetMeta()

ResetMeta resets all changes to the "meta" field.

func (*RouteMutation) ResetName

func (m *RouteMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RouteMutation) ResetParent

func (m *RouteMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*RouteMutation) ResetParentID

func (m *RouteMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*RouteMutation) ResetPath

func (m *RouteMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*RouteMutation) ResetRedirect

func (m *RouteMutation) ResetRedirect()

ResetRedirect resets all changes to the "redirect" field.

func (*RouteMutation) ResetRoles

func (m *RouteMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*RouteMutation) ResetTitle

func (m *RouteMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*RouteMutation) ResetType

func (m *RouteMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*RouteMutation) ResetUpdatedAt

func (m *RouteMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RouteMutation) RolesCleared

func (m *RouteMutation) RolesCleared() bool

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

func (*RouteMutation) RolesIDs

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

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

func (*RouteMutation) SetComponent

func (m *RouteMutation) SetComponent(s string)

SetComponent sets the "component" field.

func (*RouteMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RouteMutation) SetDeletedAt

func (m *RouteMutation) SetDeletedAt(i int)

SetDeletedAt sets the "deleted_at" field.

func (*RouteMutation) SetField

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

func (m *RouteMutation) SetID(id int)

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

func (*RouteMutation) SetIsEnable

func (m *RouteMutation) SetIsEnable(b bool)

SetIsEnable sets the "is_enable" field.

func (*RouteMutation) SetMeta

func (m *RouteMutation) SetMeta(value map[string]interface{})

SetMeta sets the "meta" field.

func (*RouteMutation) SetName

func (m *RouteMutation) SetName(s string)

SetName sets the "name" field.

func (*RouteMutation) SetOp

func (m *RouteMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RouteMutation) SetParentID

func (m *RouteMutation) SetParentID(i int)

SetParentID sets the "parent_id" field.

func (*RouteMutation) SetPath

func (m *RouteMutation) SetPath(s string)

SetPath sets the "path" field.

func (*RouteMutation) SetRedirect

func (m *RouteMutation) SetRedirect(s string)

SetRedirect sets the "redirect" field.

func (*RouteMutation) SetTitle

func (m *RouteMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*RouteMutation) SetType

func (m *RouteMutation) SetType(i int)

SetType sets the "type" field.

func (*RouteMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RouteMutation) Title

func (m *RouteMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (RouteMutation) Tx

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

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

func (*RouteMutation) Type

func (m *RouteMutation) Type() string

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

func (*RouteMutation) UpdatedAt

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

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

func (*RouteMutation) Where

func (m *RouteMutation) Where(ps ...predicate.Route)

Where appends a list predicates to the RouteMutation builder.

func (*RouteMutation) WhereP

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

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

type RouteQuery

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

RouteQuery is the builder for querying Route entities.

func (*RouteQuery) Aggregate

func (rq *RouteQuery) Aggregate(fns ...AggregateFunc) *RouteSelect

Aggregate returns a RouteSelect configured with the given aggregations.

func (*RouteQuery) All

func (rq *RouteQuery) All(ctx context.Context) ([]*Route, error)

All executes the query and returns a list of Routes.

func (*RouteQuery) AllX

func (rq *RouteQuery) AllX(ctx context.Context) []*Route

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

func (*RouteQuery) Clone

func (rq *RouteQuery) Clone() *RouteQuery

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

func (*RouteQuery) Count

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

Count returns the count of the given query.

func (*RouteQuery) CountX

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

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

func (*RouteQuery) Exist

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

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

func (*RouteQuery) ExistX

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

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

func (*RouteQuery) First

func (rq *RouteQuery) First(ctx context.Context) (*Route, error)

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

func (*RouteQuery) FirstID

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

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

func (*RouteQuery) FirstIDX

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

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

func (*RouteQuery) FirstX

func (rq *RouteQuery) FirstX(ctx context.Context) *Route

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

func (*RouteQuery) GroupBy

func (rq *RouteQuery) GroupBy(field string, fields ...string) *RouteGroupBy

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

Example:

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

client.Route.Query().
	GroupBy(route.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RouteQuery) IDs

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

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

func (*RouteQuery) IDsX

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

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

func (*RouteQuery) Limit

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

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

func (*RouteQuery) Offset

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

Offset to start from.

func (*RouteQuery) Only

func (rq *RouteQuery) Only(ctx context.Context) (*Route, error)

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

func (*RouteQuery) OnlyID

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

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

func (*RouteQuery) OnlyIDX

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

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

func (*RouteQuery) OnlyX

func (rq *RouteQuery) OnlyX(ctx context.Context) *Route

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

func (*RouteQuery) Order

func (rq *RouteQuery) Order(o ...route.OrderOption) *RouteQuery

Order specifies how the records should be ordered.

func (*RouteQuery) QueryChildren

func (rq *RouteQuery) QueryChildren() *RouteQuery

QueryChildren chains the current query on the "children" edge.

func (*RouteQuery) QueryParent

func (rq *RouteQuery) QueryParent() *RouteQuery

QueryParent chains the current query on the "parent" edge.

func (*RouteQuery) QueryRoles

func (rq *RouteQuery) QueryRoles() *RoleQuery

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

func (*RouteQuery) Select

func (rq *RouteQuery) Select(fields ...string) *RouteSelect

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

Example:

var v []struct {
	CreatedAt time.Time `json:"createdAt,omitempty" rql:"filter,sort"`
}

client.Route.Query().
	Select(route.FieldCreatedAt).
	Scan(ctx, &v)

func (*RouteQuery) Unique

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

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

func (rq *RouteQuery) Where(ps ...predicate.Route) *RouteQuery

Where adds a new predicate for the RouteQuery builder.

func (*RouteQuery) WithChildren

func (rq *RouteQuery) WithChildren(opts ...func(*RouteQuery)) *RouteQuery

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 (*RouteQuery) WithParent

func (rq *RouteQuery) WithParent(opts ...func(*RouteQuery)) *RouteQuery

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.

func (*RouteQuery) WithRoles

func (rq *RouteQuery) WithRoles(opts ...func(*RoleQuery)) *RouteQuery

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 RouteSelect

type RouteSelect struct {
	*RouteQuery
	// contains filtered or unexported fields
}

RouteSelect is the builder for selecting fields of Route entities.

func (*RouteSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*RouteSelect) Bool

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

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

func (*RouteSelect) BoolX

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

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

func (*RouteSelect) Bools

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

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

func (*RouteSelect) BoolsX

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

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

func (*RouteSelect) Float64

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

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

func (*RouteSelect) Float64X

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

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

func (*RouteSelect) Float64s

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

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

func (*RouteSelect) Float64sX

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

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

func (*RouteSelect) Int

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

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

func (*RouteSelect) IntX

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

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

func (*RouteSelect) Ints

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

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

func (*RouteSelect) IntsX

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

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

func (*RouteSelect) Scan

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

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

func (*RouteSelect) ScanX

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

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

func (*RouteSelect) String

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

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

func (*RouteSelect) StringX

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

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

func (*RouteSelect) Strings

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

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

func (*RouteSelect) StringsX

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

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

type RouteUpdate

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

RouteUpdate is the builder for updating Route entities.

func (*RouteUpdate) AddChildIDs

func (ru *RouteUpdate) AddChildIDs(ids ...int) *RouteUpdate

AddChildIDs adds the "children" edge to the Route entity by IDs.

func (*RouteUpdate) AddChildren

func (ru *RouteUpdate) AddChildren(r ...*Route) *RouteUpdate

AddChildren adds the "children" edges to the Route entity.

func (*RouteUpdate) AddDeletedAt

func (ru *RouteUpdate) AddDeletedAt(i int) *RouteUpdate

AddDeletedAt adds i to the "deleted_at" field.

func (*RouteUpdate) AddRoleIDs

func (ru *RouteUpdate) AddRoleIDs(ids ...int) *RouteUpdate

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

func (*RouteUpdate) AddRoles

func (ru *RouteUpdate) AddRoles(r ...*Role) *RouteUpdate

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

func (*RouteUpdate) AddType

func (ru *RouteUpdate) AddType(i int) *RouteUpdate

AddType adds i to the "type" field.

func (*RouteUpdate) ClearChildren

func (ru *RouteUpdate) ClearChildren() *RouteUpdate

ClearChildren clears all "children" edges to the Route entity.

func (*RouteUpdate) ClearParent

func (ru *RouteUpdate) ClearParent() *RouteUpdate

ClearParent clears the "parent" edge to the Route entity.

func (*RouteUpdate) ClearParentID

func (ru *RouteUpdate) ClearParentID() *RouteUpdate

ClearParentID clears the value of the "parent_id" field.

func (*RouteUpdate) ClearRoles

func (ru *RouteUpdate) ClearRoles() *RouteUpdate

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

func (*RouteUpdate) Exec

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

Exec executes the query.

func (*RouteUpdate) ExecX

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

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

func (*RouteUpdate) Mutation

func (ru *RouteUpdate) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteUpdate) RemoveChildIDs

func (ru *RouteUpdate) RemoveChildIDs(ids ...int) *RouteUpdate

RemoveChildIDs removes the "children" edge to Route entities by IDs.

func (*RouteUpdate) RemoveChildren

func (ru *RouteUpdate) RemoveChildren(r ...*Route) *RouteUpdate

RemoveChildren removes "children" edges to Route entities.

func (*RouteUpdate) RemoveRoleIDs

func (ru *RouteUpdate) RemoveRoleIDs(ids ...int) *RouteUpdate

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

func (*RouteUpdate) RemoveRoles

func (ru *RouteUpdate) RemoveRoles(r ...*Role) *RouteUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*RouteUpdate) Save

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

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

func (*RouteUpdate) SaveX

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

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

func (*RouteUpdate) SetComponent

func (ru *RouteUpdate) SetComponent(s string) *RouteUpdate

SetComponent sets the "component" field.

func (*RouteUpdate) SetCreatedAt

func (ru *RouteUpdate) SetCreatedAt(t time.Time) *RouteUpdate

SetCreatedAt sets the "created_at" field.

func (*RouteUpdate) SetDeletedAt

func (ru *RouteUpdate) SetDeletedAt(i int) *RouteUpdate

SetDeletedAt sets the "deleted_at" field.

func (*RouteUpdate) SetIsEnable

func (ru *RouteUpdate) SetIsEnable(b bool) *RouteUpdate

SetIsEnable sets the "is_enable" field.

func (*RouteUpdate) SetMeta

func (ru *RouteUpdate) SetMeta(m map[string]interface{}) *RouteUpdate

SetMeta sets the "meta" field.

func (*RouteUpdate) SetName

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

SetName sets the "name" field.

func (*RouteUpdate) SetNillableComponent

func (ru *RouteUpdate) SetNillableComponent(s *string) *RouteUpdate

SetNillableComponent sets the "component" field if the given value is not nil.

func (*RouteUpdate) SetNillableCreatedAt

func (ru *RouteUpdate) SetNillableCreatedAt(t *time.Time) *RouteUpdate

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

func (*RouteUpdate) SetNillableDeletedAt

func (ru *RouteUpdate) SetNillableDeletedAt(i *int) *RouteUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RouteUpdate) SetNillableIsEnable

func (ru *RouteUpdate) SetNillableIsEnable(b *bool) *RouteUpdate

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*RouteUpdate) SetNillableName

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

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

func (*RouteUpdate) SetNillableParentID

func (ru *RouteUpdate) SetNillableParentID(i *int) *RouteUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*RouteUpdate) SetNillablePath

func (ru *RouteUpdate) SetNillablePath(s *string) *RouteUpdate

SetNillablePath sets the "path" field if the given value is not nil.

func (*RouteUpdate) SetNillableRedirect

func (ru *RouteUpdate) SetNillableRedirect(s *string) *RouteUpdate

SetNillableRedirect sets the "redirect" field if the given value is not nil.

func (*RouteUpdate) SetNillableTitle

func (ru *RouteUpdate) SetNillableTitle(s *string) *RouteUpdate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*RouteUpdate) SetNillableType

func (ru *RouteUpdate) SetNillableType(i *int) *RouteUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*RouteUpdate) SetParent

func (ru *RouteUpdate) SetParent(r *Route) *RouteUpdate

SetParent sets the "parent" edge to the Route entity.

func (*RouteUpdate) SetParentID

func (ru *RouteUpdate) SetParentID(i int) *RouteUpdate

SetParentID sets the "parent_id" field.

func (*RouteUpdate) SetPath

func (ru *RouteUpdate) SetPath(s string) *RouteUpdate

SetPath sets the "path" field.

func (*RouteUpdate) SetRedirect

func (ru *RouteUpdate) SetRedirect(s string) *RouteUpdate

SetRedirect sets the "redirect" field.

func (*RouteUpdate) SetTitle

func (ru *RouteUpdate) SetTitle(s string) *RouteUpdate

SetTitle sets the "title" field.

func (*RouteUpdate) SetType

func (ru *RouteUpdate) SetType(i int) *RouteUpdate

SetType sets the "type" field.

func (*RouteUpdate) SetUpdatedAt

func (ru *RouteUpdate) SetUpdatedAt(t time.Time) *RouteUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RouteUpdate) Where

func (ru *RouteUpdate) Where(ps ...predicate.Route) *RouteUpdate

Where appends a list predicates to the RouteUpdate builder.

type RouteUpdateOne

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

RouteUpdateOne is the builder for updating a single Route entity.

func (*RouteUpdateOne) AddChildIDs

func (ruo *RouteUpdateOne) AddChildIDs(ids ...int) *RouteUpdateOne

AddChildIDs adds the "children" edge to the Route entity by IDs.

func (*RouteUpdateOne) AddChildren

func (ruo *RouteUpdateOne) AddChildren(r ...*Route) *RouteUpdateOne

AddChildren adds the "children" edges to the Route entity.

func (*RouteUpdateOne) AddDeletedAt

func (ruo *RouteUpdateOne) AddDeletedAt(i int) *RouteUpdateOne

AddDeletedAt adds i to the "deleted_at" field.

func (*RouteUpdateOne) AddRoleIDs

func (ruo *RouteUpdateOne) AddRoleIDs(ids ...int) *RouteUpdateOne

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

func (*RouteUpdateOne) AddRoles

func (ruo *RouteUpdateOne) AddRoles(r ...*Role) *RouteUpdateOne

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

func (*RouteUpdateOne) AddType

func (ruo *RouteUpdateOne) AddType(i int) *RouteUpdateOne

AddType adds i to the "type" field.

func (*RouteUpdateOne) ClearChildren

func (ruo *RouteUpdateOne) ClearChildren() *RouteUpdateOne

ClearChildren clears all "children" edges to the Route entity.

func (*RouteUpdateOne) ClearParent

func (ruo *RouteUpdateOne) ClearParent() *RouteUpdateOne

ClearParent clears the "parent" edge to the Route entity.

func (*RouteUpdateOne) ClearParentID

func (ruo *RouteUpdateOne) ClearParentID() *RouteUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*RouteUpdateOne) ClearRoles

func (ruo *RouteUpdateOne) ClearRoles() *RouteUpdateOne

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

func (*RouteUpdateOne) Exec

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

Exec executes the query on the entity.

func (*RouteUpdateOne) ExecX

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

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

func (*RouteUpdateOne) Mutation

func (ruo *RouteUpdateOne) Mutation() *RouteMutation

Mutation returns the RouteMutation object of the builder.

func (*RouteUpdateOne) RemoveChildIDs

func (ruo *RouteUpdateOne) RemoveChildIDs(ids ...int) *RouteUpdateOne

RemoveChildIDs removes the "children" edge to Route entities by IDs.

func (*RouteUpdateOne) RemoveChildren

func (ruo *RouteUpdateOne) RemoveChildren(r ...*Route) *RouteUpdateOne

RemoveChildren removes "children" edges to Route entities.

func (*RouteUpdateOne) RemoveRoleIDs

func (ruo *RouteUpdateOne) RemoveRoleIDs(ids ...int) *RouteUpdateOne

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

func (*RouteUpdateOne) RemoveRoles

func (ruo *RouteUpdateOne) RemoveRoles(r ...*Role) *RouteUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*RouteUpdateOne) Save

func (ruo *RouteUpdateOne) Save(ctx context.Context) (*Route, error)

Save executes the query and returns the updated Route entity.

func (*RouteUpdateOne) SaveX

func (ruo *RouteUpdateOne) SaveX(ctx context.Context) *Route

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

func (*RouteUpdateOne) Select

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

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

func (*RouteUpdateOne) SetComponent

func (ruo *RouteUpdateOne) SetComponent(s string) *RouteUpdateOne

SetComponent sets the "component" field.

func (*RouteUpdateOne) SetCreatedAt

func (ruo *RouteUpdateOne) SetCreatedAt(t time.Time) *RouteUpdateOne

SetCreatedAt sets the "created_at" field.

func (*RouteUpdateOne) SetDeletedAt

func (ruo *RouteUpdateOne) SetDeletedAt(i int) *RouteUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*RouteUpdateOne) SetIsEnable

func (ruo *RouteUpdateOne) SetIsEnable(b bool) *RouteUpdateOne

SetIsEnable sets the "is_enable" field.

func (*RouteUpdateOne) SetMeta

func (ruo *RouteUpdateOne) SetMeta(m map[string]interface{}) *RouteUpdateOne

SetMeta sets the "meta" field.

func (*RouteUpdateOne) SetName

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

SetName sets the "name" field.

func (*RouteUpdateOne) SetNillableComponent

func (ruo *RouteUpdateOne) SetNillableComponent(s *string) *RouteUpdateOne

SetNillableComponent sets the "component" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableCreatedAt

func (ruo *RouteUpdateOne) SetNillableCreatedAt(t *time.Time) *RouteUpdateOne

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

func (*RouteUpdateOne) SetNillableDeletedAt

func (ruo *RouteUpdateOne) SetNillableDeletedAt(i *int) *RouteUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableIsEnable

func (ruo *RouteUpdateOne) SetNillableIsEnable(b *bool) *RouteUpdateOne

SetNillableIsEnable sets the "is_enable" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableName

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

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

func (*RouteUpdateOne) SetNillableParentID

func (ruo *RouteUpdateOne) SetNillableParentID(i *int) *RouteUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*RouteUpdateOne) SetNillablePath

func (ruo *RouteUpdateOne) SetNillablePath(s *string) *RouteUpdateOne

SetNillablePath sets the "path" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableRedirect

func (ruo *RouteUpdateOne) SetNillableRedirect(s *string) *RouteUpdateOne

SetNillableRedirect sets the "redirect" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableTitle

func (ruo *RouteUpdateOne) SetNillableTitle(s *string) *RouteUpdateOne

SetNillableTitle sets the "title" field if the given value is not nil.

func (*RouteUpdateOne) SetNillableType

func (ruo *RouteUpdateOne) SetNillableType(i *int) *RouteUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*RouteUpdateOne) SetParent

func (ruo *RouteUpdateOne) SetParent(r *Route) *RouteUpdateOne

SetParent sets the "parent" edge to the Route entity.

func (*RouteUpdateOne) SetParentID

func (ruo *RouteUpdateOne) SetParentID(i int) *RouteUpdateOne

SetParentID sets the "parent_id" field.

func (*RouteUpdateOne) SetPath

func (ruo *RouteUpdateOne) SetPath(s string) *RouteUpdateOne

SetPath sets the "path" field.

func (*RouteUpdateOne) SetRedirect

func (ruo *RouteUpdateOne) SetRedirect(s string) *RouteUpdateOne

SetRedirect sets the "redirect" field.

func (*RouteUpdateOne) SetTitle

func (ruo *RouteUpdateOne) SetTitle(s string) *RouteUpdateOne

SetTitle sets the "title" field.

func (*RouteUpdateOne) SetType

func (ruo *RouteUpdateOne) SetType(i int) *RouteUpdateOne

SetType sets the "type" field.

func (*RouteUpdateOne) SetUpdatedAt

func (ruo *RouteUpdateOne) SetUpdatedAt(t time.Time) *RouteUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*RouteUpdateOne) Where

func (ruo *RouteUpdateOne) Where(ps ...predicate.Route) *RouteUpdateOne

Where appends a list predicates to the RouteUpdate builder.

type Routes

type Routes []*Route

Routes is a parsable slice of Route.

type Todo

type Todo struct {

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

Todo is the model entity for the Todo schema.

func (*Todo) String

func (t *Todo) String() string

String implements the fmt.Stringer.

func (*Todo) Unwrap

func (t *Todo) Unwrap() *Todo

Unwrap unwraps the Todo entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Todo) Update

func (t *Todo) Update() *TodoUpdateOne

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

func (*Todo) Value

func (t *Todo) Value(name string) (ent.Value, error)

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

type TodoClient

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

TodoClient is a client for the Todo schema.

func NewTodoClient

func NewTodoClient(c config) *TodoClient

NewTodoClient returns a client for the Todo from the given config.

func (*TodoClient) Create

func (c *TodoClient) Create() *TodoCreate

Create returns a builder for creating a Todo entity.

func (*TodoClient) CreateBulk

func (c *TodoClient) CreateBulk(builders ...*TodoCreate) *TodoCreateBulk

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

func (*TodoClient) Delete

func (c *TodoClient) Delete() *TodoDelete

Delete returns a delete builder for Todo.

func (*TodoClient) DeleteOne

func (c *TodoClient) DeleteOne(t *Todo) *TodoDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TodoClient) DeleteOneID

func (c *TodoClient) DeleteOneID(id int) *TodoDeleteOne

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

func (*TodoClient) Get

func (c *TodoClient) Get(ctx context.Context, id int) (*Todo, error)

Get returns a Todo entity by its id.

func (*TodoClient) GetX

func (c *TodoClient) GetX(ctx context.Context, id int) *Todo

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

func (*TodoClient) Hooks

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

Hooks returns the client hooks.

func (*TodoClient) Intercept

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

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

func (*TodoClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TodoClient) MapCreateBulk

func (c *TodoClient) MapCreateBulk(slice any, setFunc func(*TodoCreate, int)) *TodoCreateBulk

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

func (*TodoClient) Query

func (c *TodoClient) Query() *TodoQuery

Query returns a query builder for Todo.

func (*TodoClient) Update

func (c *TodoClient) Update() *TodoUpdate

Update returns an update builder for Todo.

func (*TodoClient) UpdateOne

func (c *TodoClient) UpdateOne(t *Todo) *TodoUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TodoClient) UpdateOneID

func (c *TodoClient) UpdateOneID(id int) *TodoUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TodoClient) Use

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

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

type TodoCreate

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

TodoCreate is the builder for creating a Todo entity.

func (*TodoCreate) Exec

func (tc *TodoCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoCreate) ExecX

func (tc *TodoCreate) ExecX(ctx context.Context)

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

func (*TodoCreate) Mutation

func (tc *TodoCreate) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoCreate) Save

func (tc *TodoCreate) Save(ctx context.Context) (*Todo, error)

Save creates the Todo in the database.

func (*TodoCreate) SaveX

func (tc *TodoCreate) SaveX(ctx context.Context) *Todo

SaveX calls Save and panics if Save returns an error.

func (*TodoCreate) SetName

func (tc *TodoCreate) SetName(s string) *TodoCreate

SetName sets the "name" field.

type TodoCreateBulk

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

TodoCreateBulk is the builder for creating many Todo entities in bulk.

func (*TodoCreateBulk) Exec

func (tcb *TodoCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoCreateBulk) ExecX

func (tcb *TodoCreateBulk) ExecX(ctx context.Context)

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

func (*TodoCreateBulk) Save

func (tcb *TodoCreateBulk) Save(ctx context.Context) ([]*Todo, error)

Save creates the Todo entities in the database.

func (*TodoCreateBulk) SaveX

func (tcb *TodoCreateBulk) SaveX(ctx context.Context) []*Todo

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

type TodoDelete

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

TodoDelete is the builder for deleting a Todo entity.

func (*TodoDelete) Exec

func (td *TodoDelete) Exec(ctx context.Context) (int, error)

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

func (*TodoDelete) ExecX

func (td *TodoDelete) ExecX(ctx context.Context) int

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

func (*TodoDelete) Where

func (td *TodoDelete) Where(ps ...predicate.Todo) *TodoDelete

Where appends a list predicates to the TodoDelete builder.

type TodoDeleteOne

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

TodoDeleteOne is the builder for deleting a single Todo entity.

func (*TodoDeleteOne) Exec

func (tdo *TodoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TodoDeleteOne) ExecX

func (tdo *TodoDeleteOne) ExecX(ctx context.Context)

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

func (*TodoDeleteOne) Where

func (tdo *TodoDeleteOne) Where(ps ...predicate.Todo) *TodoDeleteOne

Where appends a list predicates to the TodoDelete builder.

type TodoGroupBy

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

TodoGroupBy is the group-by builder for Todo entities.

func (*TodoGroupBy) Aggregate

func (tgb *TodoGroupBy) Aggregate(fns ...AggregateFunc) *TodoGroupBy

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

func (*TodoGroupBy) Bool

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

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) BoolX

func (s *TodoGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TodoGroupBy) Bools

func (s *TodoGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) BoolsX

func (s *TodoGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TodoGroupBy) Float64

func (s *TodoGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) Float64X

func (s *TodoGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TodoGroupBy) Float64s

func (s *TodoGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) Float64sX

func (s *TodoGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TodoGroupBy) Int

func (s *TodoGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) IntX

func (s *TodoGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TodoGroupBy) Ints

func (s *TodoGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) IntsX

func (s *TodoGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TodoGroupBy) Scan

func (tgb *TodoGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TodoGroupBy) ScanX

func (s *TodoGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TodoGroupBy) String

func (s *TodoGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) StringX

func (s *TodoGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TodoGroupBy) Strings

func (s *TodoGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TodoGroupBy) StringsX

func (s *TodoGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TodoMutation

type TodoMutation struct {
	// contains filtered or unexported fields
}

TodoMutation represents an operation that mutates the Todo nodes in the graph.

func (*TodoMutation) AddField

func (m *TodoMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*TodoMutation) AddedEdges

func (m *TodoMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TodoMutation) AddedField

func (m *TodoMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*TodoMutation) AddedFields

func (m *TodoMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TodoMutation) AddedIDs

func (m *TodoMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TodoMutation) ClearEdge

func (m *TodoMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*TodoMutation) ClearField

func (m *TodoMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*TodoMutation) ClearedEdges

func (m *TodoMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TodoMutation) ClearedFields

func (m *TodoMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TodoMutation) Client

func (m TodoMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*TodoMutation) EdgeCleared

func (m *TodoMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TodoMutation) Field

func (m *TodoMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*TodoMutation) FieldCleared

func (m *TodoMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TodoMutation) Fields

func (m *TodoMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*TodoMutation) ID

func (m *TodoMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*TodoMutation) IDs

func (m *TodoMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*TodoMutation) Name

func (m *TodoMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TodoMutation) OldField

func (m *TodoMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*TodoMutation) OldName

func (m *TodoMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Todo entity. If the Todo 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 (*TodoMutation) Op

func (m *TodoMutation) Op() Op

Op returns the operation name.

func (*TodoMutation) RemovedEdges

func (m *TodoMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TodoMutation) RemovedIDs

func (m *TodoMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TodoMutation) ResetEdge

func (m *TodoMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*TodoMutation) ResetField

func (m *TodoMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*TodoMutation) ResetName

func (m *TodoMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TodoMutation) SetField

func (m *TodoMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*TodoMutation) SetName

func (m *TodoMutation) SetName(s string)

SetName sets the "name" field.

func (*TodoMutation) SetOp

func (m *TodoMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (TodoMutation) Tx

func (m TodoMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TodoMutation) Type

func (m *TodoMutation) Type() string

Type returns the node type of this mutation (Todo).

func (*TodoMutation) Where

func (m *TodoMutation) Where(ps ...predicate.Todo)

Where appends a list predicates to the TodoMutation builder.

func (*TodoMutation) WhereP

func (m *TodoMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TodoMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TodoQuery

type TodoQuery struct {
	// contains filtered or unexported fields
}

TodoQuery is the builder for querying Todo entities.

func (*TodoQuery) Aggregate

func (tq *TodoQuery) Aggregate(fns ...AggregateFunc) *TodoSelect

Aggregate returns a TodoSelect configured with the given aggregations.

func (*TodoQuery) All

func (tq *TodoQuery) All(ctx context.Context) ([]*Todo, error)

All executes the query and returns a list of Todos.

func (*TodoQuery) AllX

func (tq *TodoQuery) AllX(ctx context.Context) []*Todo

AllX is like All, but panics if an error occurs.

func (*TodoQuery) Clone

func (tq *TodoQuery) Clone() *TodoQuery

Clone returns a duplicate of the TodoQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TodoQuery) Count

func (tq *TodoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TodoQuery) CountX

func (tq *TodoQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TodoQuery) Exist

func (tq *TodoQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TodoQuery) ExistX

func (tq *TodoQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TodoQuery) First

func (tq *TodoQuery) First(ctx context.Context) (*Todo, error)

First returns the first Todo entity from the query. Returns a *NotFoundError when no Todo was found.

func (*TodoQuery) FirstID

func (tq *TodoQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Todo ID from the query. Returns a *NotFoundError when no Todo ID was found.

func (*TodoQuery) FirstIDX

func (tq *TodoQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TodoQuery) FirstX

func (tq *TodoQuery) FirstX(ctx context.Context) *Todo

FirstX is like First, but panics if an error occurs.

func (*TodoQuery) GroupBy

func (tq *TodoQuery) GroupBy(field string, fields ...string) *TodoGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Todo.Query().
	GroupBy(todo.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TodoQuery) IDs

func (tq *TodoQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Todo IDs.

func (*TodoQuery) IDsX

func (tq *TodoQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TodoQuery) Limit

func (tq *TodoQuery) Limit(limit int) *TodoQuery

Limit the number of records to be returned by this query.

func (*TodoQuery) Offset

func (tq *TodoQuery) Offset(offset int) *TodoQuery

Offset to start from.

func (*TodoQuery) Only

func (tq *TodoQuery) Only(ctx context.Context) (*Todo, error)

Only returns a single Todo entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Todo entity is found. Returns a *NotFoundError when no Todo entities are found.

func (*TodoQuery) OnlyID

func (tq *TodoQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Todo ID in the query. Returns a *NotSingularError when more than one Todo ID is found. Returns a *NotFoundError when no entities are found.

func (*TodoQuery) OnlyIDX

func (tq *TodoQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TodoQuery) OnlyX

func (tq *TodoQuery) OnlyX(ctx context.Context) *Todo

OnlyX is like Only, but panics if an error occurs.

func (*TodoQuery) Order

func (tq *TodoQuery) Order(o ...todo.OrderOption) *TodoQuery

Order specifies how the records should be ordered.

func (*TodoQuery) Select

func (tq *TodoQuery) Select(fields ...string) *TodoSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Todo.Query().
	Select(todo.FieldName).
	Scan(ctx, &v)

func (*TodoQuery) Unique

func (tq *TodoQuery) Unique(unique bool) *TodoQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*TodoQuery) Where

func (tq *TodoQuery) Where(ps ...predicate.Todo) *TodoQuery

Where adds a new predicate for the TodoQuery builder.

type TodoSelect

type TodoSelect struct {
	*TodoQuery
	// contains filtered or unexported fields
}

TodoSelect is the builder for selecting fields of Todo entities.

func (*TodoSelect) Aggregate

func (ts *TodoSelect) Aggregate(fns ...AggregateFunc) *TodoSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TodoSelect) Bool

func (s *TodoSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TodoSelect) BoolX

func (s *TodoSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TodoSelect) Bools

func (s *TodoSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TodoSelect) BoolsX

func (s *TodoSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TodoSelect) Float64

func (s *TodoSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TodoSelect) Float64X

func (s *TodoSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TodoSelect) Float64s

func (s *TodoSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TodoSelect) Float64sX

func (s *TodoSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TodoSelect) Int

func (s *TodoSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TodoSelect) IntX

func (s *TodoSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TodoSelect) Ints

func (s *TodoSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TodoSelect) IntsX

func (s *TodoSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TodoSelect) Scan

func (ts *TodoSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TodoSelect) ScanX

func (s *TodoSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TodoSelect) String

func (s *TodoSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TodoSelect) StringX

func (s *TodoSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TodoSelect) Strings

func (s *TodoSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TodoSelect) StringsX

func (s *TodoSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TodoUpdate

type TodoUpdate struct {
	// contains filtered or unexported fields
}

TodoUpdate is the builder for updating Todo entities.

func (*TodoUpdate) Exec

func (tu *TodoUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TodoUpdate) ExecX

func (tu *TodoUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TodoUpdate) Mutation

func (tu *TodoUpdate) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoUpdate) Save

func (tu *TodoUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TodoUpdate) SaveX

func (tu *TodoUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TodoUpdate) SetName

func (tu *TodoUpdate) SetName(s string) *TodoUpdate

SetName sets the "name" field.

func (*TodoUpdate) SetNillableName

func (tu *TodoUpdate) SetNillableName(s *string) *TodoUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*TodoUpdate) Where

func (tu *TodoUpdate) Where(ps ...predicate.Todo) *TodoUpdate

Where appends a list predicates to the TodoUpdate builder.

type TodoUpdateOne

type TodoUpdateOne struct {
	// contains filtered or unexported fields
}

TodoUpdateOne is the builder for updating a single Todo entity.

func (*TodoUpdateOne) Exec

func (tuo *TodoUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TodoUpdateOne) ExecX

func (tuo *TodoUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TodoUpdateOne) Mutation

func (tuo *TodoUpdateOne) Mutation() *TodoMutation

Mutation returns the TodoMutation object of the builder.

func (*TodoUpdateOne) Save

func (tuo *TodoUpdateOne) Save(ctx context.Context) (*Todo, error)

Save executes the query and returns the updated Todo entity.

func (*TodoUpdateOne) SaveX

func (tuo *TodoUpdateOne) SaveX(ctx context.Context) *Todo

SaveX is like Save, but panics if an error occurs.

func (*TodoUpdateOne) Select

func (tuo *TodoUpdateOne) Select(field string, fields ...string) *TodoUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TodoUpdateOne) SetName

func (tuo *TodoUpdateOne) SetName(s string) *TodoUpdateOne

SetName sets the "name" field.

func (*TodoUpdateOne) SetNillableName

func (tuo *TodoUpdateOne) SetNillableName(s *string) *TodoUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*TodoUpdateOne) Where

func (tuo *TodoUpdateOne) Where(ps ...predicate.Todo) *TodoUpdateOne

Where appends a list predicates to the TodoUpdate builder.

type Todos

type Todos []*Todo

Todos is a parsable slice of Todo.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// Admin is the client for interacting with the Admin builders.
	Admin *AdminClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Route is the client for interacting with the Route builders.
	Route *RouteClient
	// Todo is the client for interacting with the Todo builders.
	Todo *TodoClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL