ent

package
v0.0.0-...-a2c21a8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 21 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.
	TypeEmployee   = "Employee"
	TypePermission = "Permission"
	TypeRole       = "Role"
)

Variables

This section is empty.

Functions

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 validaton error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector, func(string) bool) 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
	// Employee is the client for interacting with the Employee builders.
	Employee *EmployeeClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// 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().
	Employee.
	Query().
	Count(ctx)

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(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 Committer 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 Employee

type Employee struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Sex holds the value of the "sex" field.
	// 性别
	Sex employee.Sex `json:"sex,omitempty"`
	// UUID holds the value of the "uuid" field.
	// uuid
	UUID uuid.UUID `json:"uuid,omitempty"`
	// Account holds the value of the "account" field.
	//  账号
	Account string `json:"account,omitempty"`
	// Avatar holds the value of the "avatar" field.
	//  avatar
	Avatar string `json:"avatar,omitempty"`
	// Name holds the value of the "name" field.
	// 名称
	Name string `json:"name,omitempty"`
	// Email holds the value of the "email" field.
	// 邮箱
	Email string `json:"email,omitempty"`
	// Mobile holds the value of the "mobile" field.
	// 手机号
	Mobile string `json:"mobile,omitempty"`
	// IDCard holds the value of the "id_card" field.
	// 身份证
	IDCard string `json:"id_card,omitempty"`
	// Birthday holds the value of the "birthday" field.
	// 生日
	Birthday time.Time `json:"birthday,omitempty"`
	// Password holds the value of the "password" field.
	// 密码
	Password string `json:"password,omitempty"`
	// Salt holds the value of the "salt" field.
	// 加密盐
	Salt string `json:"salt,omitempty"`
	// LastIP holds the value of the "last_ip" field.
	// 最后登陆ip
	LastIP string `json:"last_ip,omitempty"`
	// LastTime holds the value of the "last_time" field.
	// 最后登陆时间
	LastTime time.Time `json:"last_time,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the EmployeeQuery when eager-loading is set.
	Edges EmployeeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Employee is the model entity for the Employee schema.

func (*Employee) QueryRoles

func (e *Employee) QueryRoles() *RoleQuery

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

func (*Employee) String

func (e *Employee) String() string

String implements the fmt.Stringer.

func (*Employee) Unwrap

func (e *Employee) Unwrap() *Employee

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

func (e *Employee) Update() *EmployeeUpdateOne

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

type EmployeeClient

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

EmployeeClient is a client for the Employee schema.

func NewEmployeeClient

func NewEmployeeClient(c config) *EmployeeClient

NewEmployeeClient returns a client for the Employee from the given config.

func (*EmployeeClient) Create

func (c *EmployeeClient) Create() *EmployeeCreate

Create returns a create builder for Employee.

func (*EmployeeClient) CreateBulk

func (c *EmployeeClient) CreateBulk(builders ...*EmployeeCreate) *EmployeeCreateBulk

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

func (*EmployeeClient) Delete

func (c *EmployeeClient) Delete() *EmployeeDelete

Delete returns a delete builder for Employee.

func (*EmployeeClient) DeleteOne

func (c *EmployeeClient) DeleteOne(e *Employee) *EmployeeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*EmployeeClient) DeleteOneID

func (c *EmployeeClient) DeleteOneID(id int64) *EmployeeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*EmployeeClient) Get

func (c *EmployeeClient) Get(ctx context.Context, id int64) (*Employee, error)

Get returns a Employee entity by its id.

func (*EmployeeClient) GetX

func (c *EmployeeClient) GetX(ctx context.Context, id int64) *Employee

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

func (*EmployeeClient) Hooks

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

Hooks returns the client hooks.

func (*EmployeeClient) Query

func (c *EmployeeClient) Query() *EmployeeQuery

Query returns a query builder for Employee.

func (*EmployeeClient) QueryRoles

func (c *EmployeeClient) QueryRoles(e *Employee) *RoleQuery

QueryRoles queries the roles edge of a Employee.

func (*EmployeeClient) Update

func (c *EmployeeClient) Update() *EmployeeUpdate

Update returns an update builder for Employee.

func (*EmployeeClient) UpdateOne

func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EmployeeClient) UpdateOneID

func (c *EmployeeClient) UpdateOneID(id int64) *EmployeeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EmployeeClient) Use

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

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

type EmployeeCreate

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

EmployeeCreate is the builder for creating a Employee entity.

func (*EmployeeCreate) AddRoleIDs

func (ec *EmployeeCreate) AddRoleIDs(ids ...int64) *EmployeeCreate

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

func (*EmployeeCreate) AddRoles

func (ec *EmployeeCreate) AddRoles(r ...*Role) *EmployeeCreate

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

func (*EmployeeCreate) Mutation

func (ec *EmployeeCreate) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeCreate) Save

func (ec *EmployeeCreate) Save(ctx context.Context) (*Employee, error)

Save creates the Employee in the database.

func (*EmployeeCreate) SaveX

func (ec *EmployeeCreate) SaveX(ctx context.Context) *Employee

SaveX calls Save and panics if Save returns an error.

func (*EmployeeCreate) SetAccount

func (ec *EmployeeCreate) SetAccount(s string) *EmployeeCreate

SetAccount sets the "account" field.

func (*EmployeeCreate) SetAvatar

func (ec *EmployeeCreate) SetAvatar(s string) *EmployeeCreate

SetAvatar sets the "avatar" field.

func (*EmployeeCreate) SetBirthday

func (ec *EmployeeCreate) SetBirthday(t time.Time) *EmployeeCreate

SetBirthday sets the "birthday" field.

func (*EmployeeCreate) SetCreateTime

func (ec *EmployeeCreate) SetCreateTime(t time.Time) *EmployeeCreate

SetCreateTime sets the "create_time" field.

func (*EmployeeCreate) SetEmail

func (ec *EmployeeCreate) SetEmail(s string) *EmployeeCreate

SetEmail sets the "email" field.

func (*EmployeeCreate) SetID

func (ec *EmployeeCreate) SetID(i int64) *EmployeeCreate

SetID sets the "id" field.

func (*EmployeeCreate) SetIDCard

func (ec *EmployeeCreate) SetIDCard(s string) *EmployeeCreate

SetIDCard sets the "id_card" field.

func (*EmployeeCreate) SetLastIP

func (ec *EmployeeCreate) SetLastIP(s string) *EmployeeCreate

SetLastIP sets the "last_ip" field.

func (*EmployeeCreate) SetLastTime

func (ec *EmployeeCreate) SetLastTime(t time.Time) *EmployeeCreate

SetLastTime sets the "last_time" field.

func (*EmployeeCreate) SetMobile

func (ec *EmployeeCreate) SetMobile(s string) *EmployeeCreate

SetMobile sets the "mobile" field.

func (*EmployeeCreate) SetName

func (ec *EmployeeCreate) SetName(s string) *EmployeeCreate

SetName sets the "name" field.

func (*EmployeeCreate) SetNillableAvatar

func (ec *EmployeeCreate) SetNillableAvatar(s *string) *EmployeeCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*EmployeeCreate) SetNillableBirthday

func (ec *EmployeeCreate) SetNillableBirthday(t *time.Time) *EmployeeCreate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*EmployeeCreate) SetNillableCreateTime

func (ec *EmployeeCreate) SetNillableCreateTime(t *time.Time) *EmployeeCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*EmployeeCreate) SetNillableIDCard

func (ec *EmployeeCreate) SetNillableIDCard(s *string) *EmployeeCreate

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*EmployeeCreate) SetNillableLastIP

func (ec *EmployeeCreate) SetNillableLastIP(s *string) *EmployeeCreate

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*EmployeeCreate) SetNillableLastTime

func (ec *EmployeeCreate) SetNillableLastTime(t *time.Time) *EmployeeCreate

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*EmployeeCreate) SetNillableMobile

func (ec *EmployeeCreate) SetNillableMobile(s *string) *EmployeeCreate

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*EmployeeCreate) SetNillableName

func (ec *EmployeeCreate) SetNillableName(s *string) *EmployeeCreate

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

func (*EmployeeCreate) SetNillableSex

func (ec *EmployeeCreate) SetNillableSex(e *employee.Sex) *EmployeeCreate

SetNillableSex sets the "sex" field if the given value is not nil.

func (*EmployeeCreate) SetNillableUpdateTime

func (ec *EmployeeCreate) SetNillableUpdateTime(t *time.Time) *EmployeeCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*EmployeeCreate) SetPassword

func (ec *EmployeeCreate) SetPassword(s string) *EmployeeCreate

SetPassword sets the "password" field.

func (*EmployeeCreate) SetSalt

func (ec *EmployeeCreate) SetSalt(s string) *EmployeeCreate

SetSalt sets the "salt" field.

func (*EmployeeCreate) SetSex

func (ec *EmployeeCreate) SetSex(e employee.Sex) *EmployeeCreate

SetSex sets the "sex" field.

func (*EmployeeCreate) SetUUID

func (ec *EmployeeCreate) SetUUID(u uuid.UUID) *EmployeeCreate

SetUUID sets the "uuid" field.

func (*EmployeeCreate) SetUpdateTime

func (ec *EmployeeCreate) SetUpdateTime(t time.Time) *EmployeeCreate

SetUpdateTime sets the "update_time" field.

type EmployeeCreateBulk

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

EmployeeCreateBulk is the builder for creating many Employee entities in bulk.

func (*EmployeeCreateBulk) Save

func (ecb *EmployeeCreateBulk) Save(ctx context.Context) ([]*Employee, error)

Save creates the Employee entities in the database.

func (*EmployeeCreateBulk) SaveX

func (ecb *EmployeeCreateBulk) SaveX(ctx context.Context) []*Employee

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

type EmployeeDelete

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

EmployeeDelete is the builder for deleting a Employee entity.

func (*EmployeeDelete) Exec

func (ed *EmployeeDelete) Exec(ctx context.Context) (int, error)

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

func (*EmployeeDelete) ExecX

func (ed *EmployeeDelete) ExecX(ctx context.Context) int

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

func (*EmployeeDelete) Where

func (ed *EmployeeDelete) Where(ps ...predicate.Employee) *EmployeeDelete

Where adds a new predicate to the EmployeeDelete builder.

type EmployeeDeleteOne

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

EmployeeDeleteOne is the builder for deleting a single Employee entity.

func (*EmployeeDeleteOne) Exec

func (edo *EmployeeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EmployeeDeleteOne) ExecX

func (edo *EmployeeDeleteOne) ExecX(ctx context.Context)

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

type EmployeeEdges

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

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

func (EmployeeEdges) RolesOrErr

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

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

type EmployeeGroupBy

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

EmployeeGroupBy is the group-by builder for Employee entities.

func (*EmployeeGroupBy) Aggregate

func (egb *EmployeeGroupBy) Aggregate(fns ...AggregateFunc) *EmployeeGroupBy

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

func (*EmployeeGroupBy) Bool

func (egb *EmployeeGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) BoolX

func (egb *EmployeeGroupBy) BoolX(ctx context.Context) bool

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

func (*EmployeeGroupBy) Bools

func (egb *EmployeeGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) BoolsX

func (egb *EmployeeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*EmployeeGroupBy) Float64

func (egb *EmployeeGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) Float64X

func (egb *EmployeeGroupBy) Float64X(ctx context.Context) float64

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

func (*EmployeeGroupBy) Float64s

func (egb *EmployeeGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) Float64sX

func (egb *EmployeeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*EmployeeGroupBy) Int

func (egb *EmployeeGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) IntX

func (egb *EmployeeGroupBy) IntX(ctx context.Context) int

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

func (*EmployeeGroupBy) Ints

func (egb *EmployeeGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) IntsX

func (egb *EmployeeGroupBy) IntsX(ctx context.Context) []int

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

func (*EmployeeGroupBy) Scan

func (egb *EmployeeGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*EmployeeGroupBy) ScanX

func (egb *EmployeeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*EmployeeGroupBy) String

func (egb *EmployeeGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) StringX

func (egb *EmployeeGroupBy) StringX(ctx context.Context) string

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

func (*EmployeeGroupBy) Strings

func (egb *EmployeeGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*EmployeeGroupBy) StringsX

func (egb *EmployeeGroupBy) StringsX(ctx context.Context) []string

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

type EmployeeMutation

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

EmployeeMutation represents an operation that mutates the Employee nodes in the graph.

func (*EmployeeMutation) Account

func (m *EmployeeMutation) Account() (r string, exists bool)

Account returns the value of the "account" field in the mutation.

func (*EmployeeMutation) AddField

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

func (m *EmployeeMutation) AddRoleIDs(ids ...int64)

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

func (*EmployeeMutation) AddedEdges

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

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

func (*EmployeeMutation) AddedField

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

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

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

func (*EmployeeMutation) AddedIDs

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

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

func (*EmployeeMutation) Avatar

func (m *EmployeeMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*EmployeeMutation) AvatarCleared

func (m *EmployeeMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*EmployeeMutation) Birthday

func (m *EmployeeMutation) Birthday() (r time.Time, exists bool)

Birthday returns the value of the "birthday" field in the mutation.

func (*EmployeeMutation) BirthdayCleared

func (m *EmployeeMutation) BirthdayCleared() bool

BirthdayCleared returns if the "birthday" field was cleared in this mutation.

func (*EmployeeMutation) ClearAvatar

func (m *EmployeeMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*EmployeeMutation) ClearBirthday

func (m *EmployeeMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*EmployeeMutation) ClearEdge

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

func (m *EmployeeMutation) 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 (*EmployeeMutation) ClearIDCard

func (m *EmployeeMutation) ClearIDCard()

ClearIDCard clears the value of the "id_card" field.

func (*EmployeeMutation) ClearLastIP

func (m *EmployeeMutation) ClearLastIP()

ClearLastIP clears the value of the "last_ip" field.

func (*EmployeeMutation) ClearLastTime

func (m *EmployeeMutation) ClearLastTime()

ClearLastTime clears the value of the "last_time" field.

func (*EmployeeMutation) ClearMobile

func (m *EmployeeMutation) ClearMobile()

ClearMobile clears the value of the "mobile" field.

func (*EmployeeMutation) ClearName

func (m *EmployeeMutation) ClearName()

ClearName clears the value of the "name" field.

func (*EmployeeMutation) ClearRoles

func (m *EmployeeMutation) ClearRoles()

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

func (*EmployeeMutation) ClearedEdges

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

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

func (*EmployeeMutation) ClearedFields

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

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

func (EmployeeMutation) Client

func (m EmployeeMutation) 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 (*EmployeeMutation) CreateTime

func (m *EmployeeMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*EmployeeMutation) EdgeCleared

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

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

func (*EmployeeMutation) Email

func (m *EmployeeMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*EmployeeMutation) Field

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

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

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

func (*EmployeeMutation) Fields

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

func (m *EmployeeMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*EmployeeMutation) IDCard

func (m *EmployeeMutation) IDCard() (r string, exists bool)

IDCard returns the value of the "id_card" field in the mutation.

func (*EmployeeMutation) IDCardCleared

func (m *EmployeeMutation) IDCardCleared() bool

IDCardCleared returns if the "id_card" field was cleared in this mutation.

func (*EmployeeMutation) LastIP

func (m *EmployeeMutation) LastIP() (r string, exists bool)

LastIP returns the value of the "last_ip" field in the mutation.

func (*EmployeeMutation) LastIPCleared

func (m *EmployeeMutation) LastIPCleared() bool

LastIPCleared returns if the "last_ip" field was cleared in this mutation.

func (*EmployeeMutation) LastTime

func (m *EmployeeMutation) LastTime() (r time.Time, exists bool)

LastTime returns the value of the "last_time" field in the mutation.

func (*EmployeeMutation) LastTimeCleared

func (m *EmployeeMutation) LastTimeCleared() bool

LastTimeCleared returns if the "last_time" field was cleared in this mutation.

func (*EmployeeMutation) Mobile

func (m *EmployeeMutation) Mobile() (r string, exists bool)

Mobile returns the value of the "mobile" field in the mutation.

func (*EmployeeMutation) MobileCleared

func (m *EmployeeMutation) MobileCleared() bool

MobileCleared returns if the "mobile" field was cleared in this mutation.

func (*EmployeeMutation) Name

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

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

func (*EmployeeMutation) NameCleared

func (m *EmployeeMutation) NameCleared() bool

NameCleared returns if the "name" field was cleared in this mutation.

func (*EmployeeMutation) OldAccount

func (m *EmployeeMutation) OldAccount(ctx context.Context) (v string, err error)

OldAccount returns the old "account" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldAvatar

func (m *EmployeeMutation) OldAvatar(ctx context.Context) (v string, err error)

OldAvatar returns the old "avatar" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldBirthday

func (m *EmployeeMutation) OldBirthday(ctx context.Context) (v time.Time, err error)

OldBirthday returns the old "birthday" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldCreateTime

func (m *EmployeeMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldEmail

func (m *EmployeeMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldField

func (m *EmployeeMutation) 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 (*EmployeeMutation) OldIDCard

func (m *EmployeeMutation) OldIDCard(ctx context.Context) (v string, err error)

OldIDCard returns the old "id_card" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldLastIP

func (m *EmployeeMutation) OldLastIP(ctx context.Context) (v string, err error)

OldLastIP returns the old "last_ip" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldLastTime

func (m *EmployeeMutation) OldLastTime(ctx context.Context) (v time.Time, err error)

OldLastTime returns the old "last_time" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldMobile

func (m *EmployeeMutation) OldMobile(ctx context.Context) (v string, err error)

OldMobile returns the old "mobile" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldName

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

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

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

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

func (m *EmployeeMutation) OldSalt(ctx context.Context) (v string, err error)

OldSalt returns the old "salt" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldSex

func (m *EmployeeMutation) OldSex(ctx context.Context) (v employee.Sex, err error)

OldSex returns the old "sex" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldUUID

func (m *EmployeeMutation) OldUUID(ctx context.Context) (v uuid.UUID, err error)

OldUUID returns the old "uuid" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) OldUpdateTime

func (m *EmployeeMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Employee entity. If the Employee 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 (*EmployeeMutation) Op

func (m *EmployeeMutation) Op() Op

Op returns the operation name.

func (*EmployeeMutation) Password

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

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

func (*EmployeeMutation) RemoveRoleIDs

func (m *EmployeeMutation) RemoveRoleIDs(ids ...int64)

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

func (*EmployeeMutation) RemovedEdges

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

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

func (*EmployeeMutation) RemovedIDs

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

func (m *EmployeeMutation) RemovedRolesIDs() (ids []int64)

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

func (*EmployeeMutation) ResetAccount

func (m *EmployeeMutation) ResetAccount()

ResetAccount resets all changes to the "account" field.

func (*EmployeeMutation) ResetAvatar

func (m *EmployeeMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*EmployeeMutation) ResetBirthday

func (m *EmployeeMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*EmployeeMutation) ResetCreateTime

func (m *EmployeeMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*EmployeeMutation) ResetEdge

func (m *EmployeeMutation) 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 (*EmployeeMutation) ResetEmail

func (m *EmployeeMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*EmployeeMutation) ResetField

func (m *EmployeeMutation) 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 (*EmployeeMutation) ResetIDCard

func (m *EmployeeMutation) ResetIDCard()

ResetIDCard resets all changes to the "id_card" field.

func (*EmployeeMutation) ResetLastIP

func (m *EmployeeMutation) ResetLastIP()

ResetLastIP resets all changes to the "last_ip" field.

func (*EmployeeMutation) ResetLastTime

func (m *EmployeeMutation) ResetLastTime()

ResetLastTime resets all changes to the "last_time" field.

func (*EmployeeMutation) ResetMobile

func (m *EmployeeMutation) ResetMobile()

ResetMobile resets all changes to the "mobile" field.

func (*EmployeeMutation) ResetName

func (m *EmployeeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*EmployeeMutation) ResetPassword

func (m *EmployeeMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*EmployeeMutation) ResetRoles

func (m *EmployeeMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*EmployeeMutation) ResetSalt

func (m *EmployeeMutation) ResetSalt()

ResetSalt resets all changes to the "salt" field.

func (*EmployeeMutation) ResetSex

func (m *EmployeeMutation) ResetSex()

ResetSex resets all changes to the "sex" field.

func (*EmployeeMutation) ResetUUID

func (m *EmployeeMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*EmployeeMutation) ResetUpdateTime

func (m *EmployeeMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*EmployeeMutation) RolesCleared

func (m *EmployeeMutation) RolesCleared() bool

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

func (*EmployeeMutation) RolesIDs

func (m *EmployeeMutation) RolesIDs() (ids []int64)

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

func (*EmployeeMutation) Salt

func (m *EmployeeMutation) Salt() (r string, exists bool)

Salt returns the value of the "salt" field in the mutation.

func (*EmployeeMutation) SetAccount

func (m *EmployeeMutation) SetAccount(s string)

SetAccount sets the "account" field.

func (*EmployeeMutation) SetAvatar

func (m *EmployeeMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*EmployeeMutation) SetBirthday

func (m *EmployeeMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*EmployeeMutation) SetCreateTime

func (m *EmployeeMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*EmployeeMutation) SetEmail

func (m *EmployeeMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*EmployeeMutation) SetField

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

func (m *EmployeeMutation) SetID(id int64)

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

func (*EmployeeMutation) SetIDCard

func (m *EmployeeMutation) SetIDCard(s string)

SetIDCard sets the "id_card" field.

func (*EmployeeMutation) SetLastIP

func (m *EmployeeMutation) SetLastIP(s string)

SetLastIP sets the "last_ip" field.

func (*EmployeeMutation) SetLastTime

func (m *EmployeeMutation) SetLastTime(t time.Time)

SetLastTime sets the "last_time" field.

func (*EmployeeMutation) SetMobile

func (m *EmployeeMutation) SetMobile(s string)

SetMobile sets the "mobile" field.

func (*EmployeeMutation) SetName

func (m *EmployeeMutation) SetName(s string)

SetName sets the "name" field.

func (*EmployeeMutation) SetPassword

func (m *EmployeeMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*EmployeeMutation) SetSalt

func (m *EmployeeMutation) SetSalt(s string)

SetSalt sets the "salt" field.

func (*EmployeeMutation) SetSex

func (m *EmployeeMutation) SetSex(e employee.Sex)

SetSex sets the "sex" field.

func (*EmployeeMutation) SetUUID

func (m *EmployeeMutation) SetUUID(u uuid.UUID)

SetUUID sets the "uuid" field.

func (*EmployeeMutation) SetUpdateTime

func (m *EmployeeMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*EmployeeMutation) Sex

func (m *EmployeeMutation) Sex() (r employee.Sex, exists bool)

Sex returns the value of the "sex" field in the mutation.

func (EmployeeMutation) Tx

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

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

func (*EmployeeMutation) Type

func (m *EmployeeMutation) Type() string

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

func (*EmployeeMutation) UUID

func (m *EmployeeMutation) UUID() (r uuid.UUID, exists bool)

UUID returns the value of the "uuid" field in the mutation.

func (*EmployeeMutation) UpdateTime

func (m *EmployeeMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

type EmployeeQuery

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

EmployeeQuery is the builder for querying Employee entities.

func (*EmployeeQuery) All

func (eq *EmployeeQuery) All(ctx context.Context) ([]*Employee, error)

All executes the query and returns a list of Employees.

func (*EmployeeQuery) AllX

func (eq *EmployeeQuery) AllX(ctx context.Context) []*Employee

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

func (*EmployeeQuery) Clone

func (eq *EmployeeQuery) Clone() *EmployeeQuery

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

func (*EmployeeQuery) Count

func (eq *EmployeeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EmployeeQuery) CountX

func (eq *EmployeeQuery) CountX(ctx context.Context) int

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

func (*EmployeeQuery) Exist

func (eq *EmployeeQuery) Exist(ctx context.Context) (bool, error)

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

func (*EmployeeQuery) ExistX

func (eq *EmployeeQuery) ExistX(ctx context.Context) bool

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

func (*EmployeeQuery) First

func (eq *EmployeeQuery) First(ctx context.Context) (*Employee, error)

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

func (*EmployeeQuery) FirstID

func (eq *EmployeeQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*EmployeeQuery) FirstIDX

func (eq *EmployeeQuery) FirstIDX(ctx context.Context) int64

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

func (*EmployeeQuery) FirstX

func (eq *EmployeeQuery) FirstX(ctx context.Context) *Employee

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

func (*EmployeeQuery) GroupBy

func (eq *EmployeeQuery) GroupBy(field string, fields ...string) *EmployeeGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Employee.Query().
	GroupBy(employee.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EmployeeQuery) IDs

func (eq *EmployeeQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*EmployeeQuery) IDsX

func (eq *EmployeeQuery) IDsX(ctx context.Context) []int64

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

func (*EmployeeQuery) Limit

func (eq *EmployeeQuery) Limit(limit int) *EmployeeQuery

Limit adds a limit step to the query.

func (*EmployeeQuery) Offset

func (eq *EmployeeQuery) Offset(offset int) *EmployeeQuery

Offset adds an offset step to the query.

func (*EmployeeQuery) Only

func (eq *EmployeeQuery) Only(ctx context.Context) (*Employee, error)

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

func (*EmployeeQuery) OnlyID

func (eq *EmployeeQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*EmployeeQuery) OnlyIDX

func (eq *EmployeeQuery) OnlyIDX(ctx context.Context) int64

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

func (*EmployeeQuery) OnlyX

func (eq *EmployeeQuery) OnlyX(ctx context.Context) *Employee

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

func (*EmployeeQuery) Order

func (eq *EmployeeQuery) Order(o ...OrderFunc) *EmployeeQuery

Order adds an order step to the query.

func (*EmployeeQuery) QueryRoles

func (eq *EmployeeQuery) QueryRoles() *RoleQuery

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

func (*EmployeeQuery) Select

func (eq *EmployeeQuery) Select(field string, fields ...string) *EmployeeSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Employee.Query().
	Select(employee.FieldCreateTime).
	Scan(ctx, &v)

func (*EmployeeQuery) Where

func (eq *EmployeeQuery) Where(ps ...predicate.Employee) *EmployeeQuery

Where adds a new predicate for the EmployeeQuery builder.

func (*EmployeeQuery) WithRoles

func (eq *EmployeeQuery) WithRoles(opts ...func(*RoleQuery)) *EmployeeQuery

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 EmployeeSelect

type EmployeeSelect struct {
	*EmployeeQuery
	// contains filtered or unexported fields
}

EmployeeSelect is the builder for selecting fields of Employee entities.

func (*EmployeeSelect) Bool

func (es *EmployeeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*EmployeeSelect) BoolX

func (es *EmployeeSelect) BoolX(ctx context.Context) bool

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

func (*EmployeeSelect) Bools

func (es *EmployeeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*EmployeeSelect) BoolsX

func (es *EmployeeSelect) BoolsX(ctx context.Context) []bool

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

func (*EmployeeSelect) Float64

func (es *EmployeeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*EmployeeSelect) Float64X

func (es *EmployeeSelect) Float64X(ctx context.Context) float64

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

func (*EmployeeSelect) Float64s

func (es *EmployeeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*EmployeeSelect) Float64sX

func (es *EmployeeSelect) Float64sX(ctx context.Context) []float64

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

func (*EmployeeSelect) Int

func (es *EmployeeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*EmployeeSelect) IntX

func (es *EmployeeSelect) IntX(ctx context.Context) int

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

func (*EmployeeSelect) Ints

func (es *EmployeeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*EmployeeSelect) IntsX

func (es *EmployeeSelect) IntsX(ctx context.Context) []int

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

func (*EmployeeSelect) Scan

func (es *EmployeeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*EmployeeSelect) ScanX

func (es *EmployeeSelect) ScanX(ctx context.Context, v interface{})

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

func (*EmployeeSelect) String

func (es *EmployeeSelect) String(ctx context.Context) (_ string, err error)

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

func (*EmployeeSelect) StringX

func (es *EmployeeSelect) StringX(ctx context.Context) string

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

func (*EmployeeSelect) Strings

func (es *EmployeeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*EmployeeSelect) StringsX

func (es *EmployeeSelect) StringsX(ctx context.Context) []string

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

type EmployeeUpdate

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

EmployeeUpdate is the builder for updating Employee entities.

func (*EmployeeUpdate) AddRoleIDs

func (eu *EmployeeUpdate) AddRoleIDs(ids ...int64) *EmployeeUpdate

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

func (*EmployeeUpdate) AddRoles

func (eu *EmployeeUpdate) AddRoles(r ...*Role) *EmployeeUpdate

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

func (*EmployeeUpdate) ClearAvatar

func (eu *EmployeeUpdate) ClearAvatar() *EmployeeUpdate

ClearAvatar clears the value of the "avatar" field.

func (*EmployeeUpdate) ClearBirthday

func (eu *EmployeeUpdate) ClearBirthday() *EmployeeUpdate

ClearBirthday clears the value of the "birthday" field.

func (*EmployeeUpdate) ClearIDCard

func (eu *EmployeeUpdate) ClearIDCard() *EmployeeUpdate

ClearIDCard clears the value of the "id_card" field.

func (*EmployeeUpdate) ClearLastIP

func (eu *EmployeeUpdate) ClearLastIP() *EmployeeUpdate

ClearLastIP clears the value of the "last_ip" field.

func (*EmployeeUpdate) ClearLastTime

func (eu *EmployeeUpdate) ClearLastTime() *EmployeeUpdate

ClearLastTime clears the value of the "last_time" field.

func (*EmployeeUpdate) ClearMobile

func (eu *EmployeeUpdate) ClearMobile() *EmployeeUpdate

ClearMobile clears the value of the "mobile" field.

func (*EmployeeUpdate) ClearName

func (eu *EmployeeUpdate) ClearName() *EmployeeUpdate

ClearName clears the value of the "name" field.

func (*EmployeeUpdate) ClearRoles

func (eu *EmployeeUpdate) ClearRoles() *EmployeeUpdate

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

func (*EmployeeUpdate) Exec

func (eu *EmployeeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EmployeeUpdate) ExecX

func (eu *EmployeeUpdate) ExecX(ctx context.Context)

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

func (*EmployeeUpdate) Mutation

func (eu *EmployeeUpdate) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeUpdate) RemoveRoleIDs

func (eu *EmployeeUpdate) RemoveRoleIDs(ids ...int64) *EmployeeUpdate

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

func (*EmployeeUpdate) RemoveRoles

func (eu *EmployeeUpdate) RemoveRoles(r ...*Role) *EmployeeUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*EmployeeUpdate) Save

func (eu *EmployeeUpdate) Save(ctx context.Context) (int, error)

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

func (*EmployeeUpdate) SaveX

func (eu *EmployeeUpdate) SaveX(ctx context.Context) int

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

func (*EmployeeUpdate) SetAccount

func (eu *EmployeeUpdate) SetAccount(s string) *EmployeeUpdate

SetAccount sets the "account" field.

func (*EmployeeUpdate) SetAvatar

func (eu *EmployeeUpdate) SetAvatar(s string) *EmployeeUpdate

SetAvatar sets the "avatar" field.

func (*EmployeeUpdate) SetBirthday

func (eu *EmployeeUpdate) SetBirthday(t time.Time) *EmployeeUpdate

SetBirthday sets the "birthday" field.

func (*EmployeeUpdate) SetEmail

func (eu *EmployeeUpdate) SetEmail(s string) *EmployeeUpdate

SetEmail sets the "email" field.

func (*EmployeeUpdate) SetIDCard

func (eu *EmployeeUpdate) SetIDCard(s string) *EmployeeUpdate

SetIDCard sets the "id_card" field.

func (*EmployeeUpdate) SetLastIP

func (eu *EmployeeUpdate) SetLastIP(s string) *EmployeeUpdate

SetLastIP sets the "last_ip" field.

func (*EmployeeUpdate) SetLastTime

func (eu *EmployeeUpdate) SetLastTime(t time.Time) *EmployeeUpdate

SetLastTime sets the "last_time" field.

func (*EmployeeUpdate) SetMobile

func (eu *EmployeeUpdate) SetMobile(s string) *EmployeeUpdate

SetMobile sets the "mobile" field.

func (*EmployeeUpdate) SetName

func (eu *EmployeeUpdate) SetName(s string) *EmployeeUpdate

SetName sets the "name" field.

func (*EmployeeUpdate) SetNillableAvatar

func (eu *EmployeeUpdate) SetNillableAvatar(s *string) *EmployeeUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableBirthday

func (eu *EmployeeUpdate) SetNillableBirthday(t *time.Time) *EmployeeUpdate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableIDCard

func (eu *EmployeeUpdate) SetNillableIDCard(s *string) *EmployeeUpdate

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableLastIP

func (eu *EmployeeUpdate) SetNillableLastIP(s *string) *EmployeeUpdate

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableLastTime

func (eu *EmployeeUpdate) SetNillableLastTime(t *time.Time) *EmployeeUpdate

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableMobile

func (eu *EmployeeUpdate) SetNillableMobile(s *string) *EmployeeUpdate

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*EmployeeUpdate) SetNillableName

func (eu *EmployeeUpdate) SetNillableName(s *string) *EmployeeUpdate

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

func (*EmployeeUpdate) SetNillableSex

func (eu *EmployeeUpdate) SetNillableSex(e *employee.Sex) *EmployeeUpdate

SetNillableSex sets the "sex" field if the given value is not nil.

func (*EmployeeUpdate) SetPassword

func (eu *EmployeeUpdate) SetPassword(s string) *EmployeeUpdate

SetPassword sets the "password" field.

func (*EmployeeUpdate) SetSalt

func (eu *EmployeeUpdate) SetSalt(s string) *EmployeeUpdate

SetSalt sets the "salt" field.

func (*EmployeeUpdate) SetSex

func (eu *EmployeeUpdate) SetSex(e employee.Sex) *EmployeeUpdate

SetSex sets the "sex" field.

func (*EmployeeUpdate) SetUUID

func (eu *EmployeeUpdate) SetUUID(u uuid.UUID) *EmployeeUpdate

SetUUID sets the "uuid" field.

func (*EmployeeUpdate) Where

func (eu *EmployeeUpdate) Where(ps ...predicate.Employee) *EmployeeUpdate

Where adds a new predicate for the EmployeeUpdate builder.

type EmployeeUpdateOne

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

EmployeeUpdateOne is the builder for updating a single Employee entity.

func (*EmployeeUpdateOne) AddRoleIDs

func (euo *EmployeeUpdateOne) AddRoleIDs(ids ...int64) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) AddRoles

func (euo *EmployeeUpdateOne) AddRoles(r ...*Role) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) ClearAvatar

func (euo *EmployeeUpdateOne) ClearAvatar() *EmployeeUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*EmployeeUpdateOne) ClearBirthday

func (euo *EmployeeUpdateOne) ClearBirthday() *EmployeeUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*EmployeeUpdateOne) ClearIDCard

func (euo *EmployeeUpdateOne) ClearIDCard() *EmployeeUpdateOne

ClearIDCard clears the value of the "id_card" field.

func (*EmployeeUpdateOne) ClearLastIP

func (euo *EmployeeUpdateOne) ClearLastIP() *EmployeeUpdateOne

ClearLastIP clears the value of the "last_ip" field.

func (*EmployeeUpdateOne) ClearLastTime

func (euo *EmployeeUpdateOne) ClearLastTime() *EmployeeUpdateOne

ClearLastTime clears the value of the "last_time" field.

func (*EmployeeUpdateOne) ClearMobile

func (euo *EmployeeUpdateOne) ClearMobile() *EmployeeUpdateOne

ClearMobile clears the value of the "mobile" field.

func (*EmployeeUpdateOne) ClearName

func (euo *EmployeeUpdateOne) ClearName() *EmployeeUpdateOne

ClearName clears the value of the "name" field.

func (*EmployeeUpdateOne) ClearRoles

func (euo *EmployeeUpdateOne) ClearRoles() *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) Exec

func (euo *EmployeeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EmployeeUpdateOne) ExecX

func (euo *EmployeeUpdateOne) ExecX(ctx context.Context)

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

func (*EmployeeUpdateOne) Mutation

func (euo *EmployeeUpdateOne) Mutation() *EmployeeMutation

Mutation returns the EmployeeMutation object of the builder.

func (*EmployeeUpdateOne) RemoveRoleIDs

func (euo *EmployeeUpdateOne) RemoveRoleIDs(ids ...int64) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) RemoveRoles

func (euo *EmployeeUpdateOne) RemoveRoles(r ...*Role) *EmployeeUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*EmployeeUpdateOne) Save

func (euo *EmployeeUpdateOne) Save(ctx context.Context) (*Employee, error)

Save executes the query and returns the updated Employee entity.

func (*EmployeeUpdateOne) SaveX

func (euo *EmployeeUpdateOne) SaveX(ctx context.Context) *Employee

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

func (*EmployeeUpdateOne) SetAccount

func (euo *EmployeeUpdateOne) SetAccount(s string) *EmployeeUpdateOne

SetAccount sets the "account" field.

func (*EmployeeUpdateOne) SetAvatar

func (euo *EmployeeUpdateOne) SetAvatar(s string) *EmployeeUpdateOne

SetAvatar sets the "avatar" field.

func (*EmployeeUpdateOne) SetBirthday

func (euo *EmployeeUpdateOne) SetBirthday(t time.Time) *EmployeeUpdateOne

SetBirthday sets the "birthday" field.

func (*EmployeeUpdateOne) SetEmail

func (euo *EmployeeUpdateOne) SetEmail(s string) *EmployeeUpdateOne

SetEmail sets the "email" field.

func (*EmployeeUpdateOne) SetIDCard

func (euo *EmployeeUpdateOne) SetIDCard(s string) *EmployeeUpdateOne

SetIDCard sets the "id_card" field.

func (*EmployeeUpdateOne) SetLastIP

func (euo *EmployeeUpdateOne) SetLastIP(s string) *EmployeeUpdateOne

SetLastIP sets the "last_ip" field.

func (*EmployeeUpdateOne) SetLastTime

func (euo *EmployeeUpdateOne) SetLastTime(t time.Time) *EmployeeUpdateOne

SetLastTime sets the "last_time" field.

func (*EmployeeUpdateOne) SetMobile

func (euo *EmployeeUpdateOne) SetMobile(s string) *EmployeeUpdateOne

SetMobile sets the "mobile" field.

func (*EmployeeUpdateOne) SetName

func (euo *EmployeeUpdateOne) SetName(s string) *EmployeeUpdateOne

SetName sets the "name" field.

func (*EmployeeUpdateOne) SetNillableAvatar

func (euo *EmployeeUpdateOne) SetNillableAvatar(s *string) *EmployeeUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableBirthday

func (euo *EmployeeUpdateOne) SetNillableBirthday(t *time.Time) *EmployeeUpdateOne

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableIDCard

func (euo *EmployeeUpdateOne) SetNillableIDCard(s *string) *EmployeeUpdateOne

SetNillableIDCard sets the "id_card" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableLastIP

func (euo *EmployeeUpdateOne) SetNillableLastIP(s *string) *EmployeeUpdateOne

SetNillableLastIP sets the "last_ip" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableLastTime

func (euo *EmployeeUpdateOne) SetNillableLastTime(t *time.Time) *EmployeeUpdateOne

SetNillableLastTime sets the "last_time" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableMobile

func (euo *EmployeeUpdateOne) SetNillableMobile(s *string) *EmployeeUpdateOne

SetNillableMobile sets the "mobile" field if the given value is not nil.

func (*EmployeeUpdateOne) SetNillableName

func (euo *EmployeeUpdateOne) SetNillableName(s *string) *EmployeeUpdateOne

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

func (*EmployeeUpdateOne) SetNillableSex

func (euo *EmployeeUpdateOne) SetNillableSex(e *employee.Sex) *EmployeeUpdateOne

SetNillableSex sets the "sex" field if the given value is not nil.

func (*EmployeeUpdateOne) SetPassword

func (euo *EmployeeUpdateOne) SetPassword(s string) *EmployeeUpdateOne

SetPassword sets the "password" field.

func (*EmployeeUpdateOne) SetSalt

func (euo *EmployeeUpdateOne) SetSalt(s string) *EmployeeUpdateOne

SetSalt sets the "salt" field.

func (*EmployeeUpdateOne) SetSex

SetSex sets the "sex" field.

func (*EmployeeUpdateOne) SetUUID

func (euo *EmployeeUpdateOne) SetUUID(u uuid.UUID) *EmployeeUpdateOne

SetUUID sets the "uuid" field.

type Employees

type Employees []*Employee

Employees is a parsable slice of Employee.

type Hook

type Hook = ent.Hook

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(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Permission

type Permission struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	// 名称
	Name string `json:"name,omitempty"`
	// Service holds the value of the "service" field.
	// 服务
	Service string `json:"service,omitempty"`
	// Path holds the value of the "path" field.
	// 路径
	Path string `json:"path,omitempty"`
	// Action holds the value of the "action" field.
	// 动作
	Action string `json:"action,omitempty"`
	// Desc holds the value of the "desc" field.
	// 备注
	Desc string `json:"desc,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.

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 create builder for Permission.

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 delete builder for the given entity.

func (*PermissionClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*PermissionClient) Get

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

Get returns a Permission entity by its id.

func (*PermissionClient) GetX

func (c *PermissionClient) GetX(ctx context.Context, id int64) *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) 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 int64) *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 ...int64) *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) 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) SetAction

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

SetAction sets the "action" field.

func (*PermissionCreate) SetCreateTime

func (pc *PermissionCreate) SetCreateTime(t time.Time) *PermissionCreate

SetCreateTime sets the "create_time" field.

func (*PermissionCreate) SetDesc

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

SetDesc sets the "desc" field.

func (*PermissionCreate) SetID

func (pc *PermissionCreate) SetID(i int64) *PermissionCreate

SetID sets the "id" field.

func (*PermissionCreate) SetName

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

SetName sets the "name" field.

func (*PermissionCreate) SetNillableCreateTime

func (pc *PermissionCreate) SetNillableCreateTime(t *time.Time) *PermissionCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*PermissionCreate) SetNillableDesc

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

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*PermissionCreate) SetNillableUpdateTime

func (pc *PermissionCreate) SetNillableUpdateTime(t *time.Time) *PermissionCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*PermissionCreate) SetPath

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

SetPath sets the "path" field.

func (*PermissionCreate) SetService

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

SetService sets the "service" field.

func (*PermissionCreate) SetUpdateTime

func (pc *PermissionCreate) SetUpdateTime(t time.Time) *PermissionCreate

SetUpdateTime sets the "update_time" field.

type PermissionCreateBulk

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

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

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 adds a new predicate 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.

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 (pgb *PermissionGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) BoolX

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

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

func (*PermissionGroupBy) Bools

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

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) BoolsX

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

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

func (*PermissionGroupBy) Float64

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

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) Float64X

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

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

func (*PermissionGroupBy) Float64s

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

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) Float64sX

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

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

func (*PermissionGroupBy) Int

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

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) IntX

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

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

func (*PermissionGroupBy) Ints

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

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) IntsX

func (pgb *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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*PermissionGroupBy) ScanX

func (pgb *PermissionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PermissionGroupBy) String

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

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) StringX

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

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

func (*PermissionGroupBy) Strings

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

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) StringsX

func (pgb *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) Action

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

Action returns the value of the "action" field in the mutation.

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

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

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

func (m *PermissionMutation) ClearDesc()

ClearDesc clears the value of the "desc" field.

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

func (m *PermissionMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*PermissionMutation) Desc

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

Desc returns the value of the "desc" field in the mutation.

func (*PermissionMutation) DescCleared

func (m *PermissionMutation) DescCleared() bool

DescCleared returns if the "desc" field was cleared in this mutation.

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

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

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*PermissionMutation) Name

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

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

func (*PermissionMutation) OldAction

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

OldAction returns the old "action" 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) OldCreateTime

func (m *PermissionMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" 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) OldDesc

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

OldDesc returns the old "desc" 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) 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) 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) OldPath

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

OldPath returns the old "path" 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) OldService

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

OldService returns the old "service" 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) OldUpdateTime

func (m *PermissionMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" 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) Path

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

Path returns the value of the "path" field in the mutation.

func (*PermissionMutation) RemoveRoleIDs

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

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 []int64)

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

func (*PermissionMutation) ResetAction

func (m *PermissionMutation) ResetAction()

ResetAction resets all changes to the "action" field.

func (*PermissionMutation) ResetCreateTime

func (m *PermissionMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*PermissionMutation) ResetDesc

func (m *PermissionMutation) ResetDesc()

ResetDesc resets all changes to the "desc" field.

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

func (m *PermissionMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PermissionMutation) ResetPath

func (m *PermissionMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*PermissionMutation) ResetRoles

func (m *PermissionMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*PermissionMutation) ResetService

func (m *PermissionMutation) ResetService()

ResetService resets all changes to the "service" field.

func (*PermissionMutation) ResetUpdateTime

func (m *PermissionMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*PermissionMutation) RolesCleared

func (m *PermissionMutation) RolesCleared() bool

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

func (*PermissionMutation) RolesIDs

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

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

func (*PermissionMutation) Service

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

Service returns the value of the "service" field in the mutation.

func (*PermissionMutation) SetAction

func (m *PermissionMutation) SetAction(s string)

SetAction sets the "action" field.

func (*PermissionMutation) SetCreateTime

func (m *PermissionMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*PermissionMutation) SetDesc

func (m *PermissionMutation) SetDesc(s string)

SetDesc sets the "desc" field.

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

func (m *PermissionMutation) SetID(id int64)

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

func (*PermissionMutation) SetName

func (m *PermissionMutation) SetName(s string)

SetName sets the "name" field.

func (*PermissionMutation) SetPath

func (m *PermissionMutation) SetPath(s string)

SetPath sets the "path" field.

func (*PermissionMutation) SetService

func (m *PermissionMutation) SetService(s string)

SetService sets the "service" field.

func (*PermissionMutation) SetUpdateTime

func (m *PermissionMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" 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) UpdateTime

func (m *PermissionMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

type PermissionQuery

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

PermissionQuery is the builder for querying Permission entities.

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 int64, 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) int64

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

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

func (*PermissionQuery) IDs

func (pq *PermissionQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*PermissionQuery) IDsX

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

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

func (*PermissionQuery) Limit

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

Limit adds a limit step to the query.

func (*PermissionQuery) Offset

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

Offset adds an offset step to the query.

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 exactly one Permission entity is not found. Returns a *NotFoundError when no Permission entities are found.

func (*PermissionQuery) OnlyID

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

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

func (*PermissionQuery) OnlyIDX

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

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

func (pq *PermissionQuery) Order(o ...OrderFunc) *PermissionQuery

Order adds an order step to the query.

func (*PermissionQuery) QueryRoles

func (pq *PermissionQuery) QueryRoles() *RoleQuery

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

func (*PermissionQuery) Select

func (pq *PermissionQuery) Select(field string, 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

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

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

func (ps *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 (ps *PermissionSelect) BoolX(ctx context.Context) bool

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

func (*PermissionSelect) Bools

func (ps *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 (ps *PermissionSelect) BoolsX(ctx context.Context) []bool

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

func (*PermissionSelect) Float64

func (ps *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 (ps *PermissionSelect) Float64X(ctx context.Context) float64

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

func (*PermissionSelect) Float64s

func (ps *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 (ps *PermissionSelect) Float64sX(ctx context.Context) []float64

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

func (*PermissionSelect) Int

func (ps *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 (ps *PermissionSelect) IntX(ctx context.Context) int

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

func (*PermissionSelect) Ints

func (ps *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 (ps *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 interface{}) error

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

func (*PermissionSelect) ScanX

func (ps *PermissionSelect) ScanX(ctx context.Context, v interface{})

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

func (*PermissionSelect) String

func (ps *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 (ps *PermissionSelect) StringX(ctx context.Context) string

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

func (*PermissionSelect) Strings

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

func (pu *PermissionUpdate) AddRoleIDs(ids ...int64) *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) ClearDesc

func (pu *PermissionUpdate) ClearDesc() *PermissionUpdate

ClearDesc clears the value of the "desc" field.

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 ...int64) *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) SetAction

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

SetAction sets the "action" field.

func (*PermissionUpdate) SetDesc

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

SetDesc sets the "desc" field.

func (*PermissionUpdate) SetName

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

SetName sets the "name" field.

func (*PermissionUpdate) SetNillableDesc

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

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*PermissionUpdate) SetPath

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

SetPath sets the "path" field.

func (*PermissionUpdate) SetService

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

SetService sets the "service" field.

func (*PermissionUpdate) Where

Where adds a new predicate for 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) AddRoleIDs

func (puo *PermissionUpdateOne) AddRoleIDs(ids ...int64) *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) ClearDesc

func (puo *PermissionUpdateOne) ClearDesc() *PermissionUpdateOne

ClearDesc clears the value of the "desc" field.

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 ...int64) *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) SetAction

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

SetAction sets the "action" field.

func (*PermissionUpdateOne) SetDesc

SetDesc sets the "desc" field.

func (*PermissionUpdateOne) SetName

SetName sets the "name" field.

func (*PermissionUpdateOne) SetNillableDesc

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

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*PermissionUpdateOne) SetPath

SetPath sets the "path" field.

func (*PermissionUpdateOne) SetService

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

SetService sets the "service" field.

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 Query

type Query = ent.Query

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

type Role

type Role struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	//  角色名称
	Name string `json:"name,omitempty"`
	// Desc holds the value of the "desc" field.
	// 备注
	Desc string `json:"desc,omitempty"`
	// Status holds the value of the "status" field.
	// 状态
	Status role.Status `json:"status,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RoleQuery when eager-loading is set.
	Edges RoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) QueryEmployees

func (r *Role) QueryEmployees() *EmployeeQuery

QueryEmployees queries the "employees" edge of the Role entity.

func (*Role) QueryPermissions

func (r *Role) QueryPermissions() *PermissionQuery

QueryPermissions queries the "permissions" 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.

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 create builder for Role.

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 delete builder for the given entity.

func (*RoleClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*RoleClient) Get

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

Get returns a Role entity by its id.

func (*RoleClient) GetX

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

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

func (*RoleClient) Hooks

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

Hooks returns the client hooks.

func (*RoleClient) Query

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) QueryEmployees

func (c *RoleClient) QueryEmployees(r *Role) *EmployeeQuery

QueryEmployees queries the employees edge of a Role.

func (*RoleClient) QueryPermissions

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

QueryPermissions queries the permissions 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 int64) *RoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) AddEmployeeIDs

func (rc *RoleCreate) AddEmployeeIDs(ids ...int64) *RoleCreate

AddEmployeeIDs adds the "employees" edge to the Employee entity by IDs.

func (*RoleCreate) AddEmployees

func (rc *RoleCreate) AddEmployees(e ...*Employee) *RoleCreate

AddEmployees adds the "employees" edges to the Employee entity.

func (*RoleCreate) AddPermissionIDs

func (rc *RoleCreate) AddPermissionIDs(ids ...int64) *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) 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) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*RoleCreate) SetDesc

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

SetDesc sets the "desc" field.

func (*RoleCreate) SetID

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

SetID sets the "id" field.

func (*RoleCreate) SetName

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

SetName sets the "name" field.

func (*RoleCreate) SetNillableCreateTime

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

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*RoleCreate) SetNillableDesc

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

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*RoleCreate) SetNillableStatus

func (rc *RoleCreate) SetNillableStatus(r *role.Status) *RoleCreate

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

func (*RoleCreate) SetNillableUpdateTime

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

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*RoleCreate) SetStatus

func (rc *RoleCreate) SetStatus(r role.Status) *RoleCreate

SetStatus sets the "status" field.

func (*RoleCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type RoleCreateBulk

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

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

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 adds a new predicate 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.

type RoleEdges

type RoleEdges struct {
	// Permissions holds the value of the permissions edge.
	Permissions []*Permission `json:"permissions,omitempty"`
	// Employees holds the value of the employees edge.
	Employees []*Employee `json:"employees,omitempty"`
	// contains filtered or unexported fields
}

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

func (RoleEdges) EmployeesOrErr

func (e RoleEdges) EmployeesOrErr() ([]*Employee, error)

EmployeesOrErr returns the Employees 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.

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 (rgb *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) BoolX

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

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

func (*RoleGroupBy) Bools

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

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) BoolsX

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

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

func (*RoleGroupBy) Float64

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

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) Float64X

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

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

func (*RoleGroupBy) Float64s

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

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) Float64sX

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

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

func (*RoleGroupBy) Int

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

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) IntX

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

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

func (*RoleGroupBy) Ints

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

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) IntsX

func (rgb *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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*RoleGroupBy) ScanX

func (rgb *RoleGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*RoleGroupBy) String

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

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) StringX

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

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

func (*RoleGroupBy) Strings

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

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) StringsX

func (rgb *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) AddEmployeeIDs

func (m *RoleMutation) AddEmployeeIDs(ids ...int64)

AddEmployeeIDs adds the "employees" edge to the Employee entity by ids.

func (*RoleMutation) AddField

func (m *RoleMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RoleMutation) AddPermissionIDs

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

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

func (*RoleMutation) AddedEdges

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

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

func (*RoleMutation) AddedField

func (m *RoleMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RoleMutation) AddedFields

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

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

func (*RoleMutation) AddedIDs

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

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

func (*RoleMutation) ClearDesc

func (m *RoleMutation) ClearDesc()

ClearDesc clears the value of the "desc" field.

func (*RoleMutation) ClearEdge

func (m *RoleMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*RoleMutation) ClearEmployees

func (m *RoleMutation) ClearEmployees()

ClearEmployees clears the "employees" edge to the Employee entity.

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

func (m *RoleMutation) ClearStatus()

ClearStatus clears the value of the "status" field.

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

func (m *RoleMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*RoleMutation) Desc

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

Desc returns the value of the "desc" field in the mutation.

func (*RoleMutation) DescCleared

func (m *RoleMutation) DescCleared() bool

DescCleared returns if the "desc" field was cleared in this mutation.

func (*RoleMutation) EdgeCleared

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

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

func (*RoleMutation) EmployeesCleared

func (m *RoleMutation) EmployeesCleared() bool

EmployeesCleared returns if the "employees" edge to the Employee entity was cleared.

func (*RoleMutation) EmployeesIDs

func (m *RoleMutation) EmployeesIDs() (ids []int64)

EmployeesIDs returns the "employees" edge IDs in the mutation.

func (*RoleMutation) Field

func (m *RoleMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RoleMutation) FieldCleared

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

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

func (*RoleMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*RoleMutation) ID

func (m *RoleMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*RoleMutation) Name

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

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

func (*RoleMutation) OldCreateTime

func (m *RoleMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" 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) OldDesc

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

OldDesc returns the old "desc" 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) 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) OldStatus

func (m *RoleMutation) OldStatus(ctx context.Context) (v role.Status, err error)

OldStatus returns the old "status" 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) OldUpdateTime

func (m *RoleMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" 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) PermissionsCleared

func (m *RoleMutation) PermissionsCleared() bool

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

func (*RoleMutation) PermissionsIDs

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

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

func (*RoleMutation) RemoveEmployeeIDs

func (m *RoleMutation) RemoveEmployeeIDs(ids ...int64)

RemoveEmployeeIDs removes the "employees" edge to the Employee entity by IDs.

func (*RoleMutation) RemovePermissionIDs

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

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

func (*RoleMutation) RemovedEdges

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

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

func (*RoleMutation) RemovedEmployeesIDs

func (m *RoleMutation) RemovedEmployeesIDs() (ids []int64)

RemovedEmployees returns the removed IDs of the "employees" edge to the Employee entity.

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 []int64)

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

func (*RoleMutation) ResetCreateTime

func (m *RoleMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*RoleMutation) ResetDesc

func (m *RoleMutation) ResetDesc()

ResetDesc resets all changes to the "desc" 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) ResetEmployees

func (m *RoleMutation) ResetEmployees()

ResetEmployees resets all changes to the "employees" edge.

func (*RoleMutation) ResetField

func (m *RoleMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetPermissions

func (m *RoleMutation) ResetPermissions()

ResetPermissions resets all changes to the "permissions" edge.

func (*RoleMutation) ResetStatus

func (m *RoleMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RoleMutation) ResetUpdateTime

func (m *RoleMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*RoleMutation) SetCreateTime

func (m *RoleMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*RoleMutation) SetDesc

func (m *RoleMutation) SetDesc(s string)

SetDesc sets the "desc" field.

func (*RoleMutation) SetField

func (m *RoleMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RoleMutation) SetID

func (m *RoleMutation) SetID(id int64)

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

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetStatus

func (m *RoleMutation) SetStatus(r role.Status)

SetStatus sets the "status" field.

func (*RoleMutation) SetUpdateTime

func (m *RoleMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*RoleMutation) Status

func (m *RoleMutation) Status() (r role.Status, exists bool)

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

func (*RoleMutation) StatusCleared

func (m *RoleMutation) StatusCleared() bool

StatusCleared returns if the "status" field was cleared in this mutation.

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

func (m *RoleMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

type RoleQuery

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

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) All

func (rq *RoleQuery) All(ctx context.Context) ([]*Role, error)

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

func (rq *RoleQuery) AllX(ctx context.Context) []*Role

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

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

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

func (*RoleQuery) Count

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

Count returns the count of the given query.

func (*RoleQuery) CountX

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

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

func (*RoleQuery) Exist

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

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

func (*RoleQuery) ExistX

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

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

func (*RoleQuery) First

func (rq *RoleQuery) First(ctx context.Context) (*Role, error)

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

func (*RoleQuery) FirstID

func (rq *RoleQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*RoleQuery) FirstIDX

func (rq *RoleQuery) FirstIDX(ctx context.Context) int64

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

func (*RoleQuery) FirstX

func (rq *RoleQuery) FirstX(ctx context.Context) *Role

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

func (*RoleQuery) GroupBy

func (rq *RoleQuery) GroupBy(field string, fields ...string) *RoleGroupBy

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

Example:

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

client.Role.Query().
	GroupBy(role.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*RoleQuery) IDsX

func (rq *RoleQuery) IDsX(ctx context.Context) []int64

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

func (*RoleQuery) Limit

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

Limit adds a limit step to the query.

func (*RoleQuery) Offset

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

Offset adds an offset step to the query.

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 exactly one Role entity is not found. Returns a *NotFoundError when no Role entities are found.

func (*RoleQuery) OnlyID

func (rq *RoleQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*RoleQuery) OnlyIDX

func (rq *RoleQuery) OnlyIDX(ctx context.Context) int64

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

func (*RoleQuery) OnlyX

func (rq *RoleQuery) OnlyX(ctx context.Context) *Role

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

func (*RoleQuery) Order

func (rq *RoleQuery) Order(o ...OrderFunc) *RoleQuery

Order adds an order step to the query.

func (*RoleQuery) QueryEmployees

func (rq *RoleQuery) QueryEmployees() *EmployeeQuery

QueryEmployees chains the current query on the "employees" edge.

func (*RoleQuery) QueryPermissions

func (rq *RoleQuery) QueryPermissions() *PermissionQuery

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

func (*RoleQuery) Select

func (rq *RoleQuery) Select(field string, 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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.Role.Query().
	Select(role.FieldCreateTime).
	Scan(ctx, &v)

func (*RoleQuery) Where

func (rq *RoleQuery) Where(ps ...predicate.Role) *RoleQuery

Where adds a new predicate for the RoleQuery builder.

func (*RoleQuery) WithEmployees

func (rq *RoleQuery) WithEmployees(opts ...func(*EmployeeQuery)) *RoleQuery

WithEmployees tells the query-builder to eager-load the nodes that are connected to the "employees" 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.

type RoleSelect

type RoleSelect struct {
	*RoleQuery
	// contains filtered or unexported fields
}

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Bool

func (rs *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 (rs *RoleSelect) BoolX(ctx context.Context) bool

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

func (*RoleSelect) Bools

func (rs *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 (rs *RoleSelect) BoolsX(ctx context.Context) []bool

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

func (*RoleSelect) Float64

func (rs *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 (rs *RoleSelect) Float64X(ctx context.Context) float64

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

func (*RoleSelect) Float64s

func (rs *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 (rs *RoleSelect) Float64sX(ctx context.Context) []float64

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

func (*RoleSelect) Int

func (rs *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 (rs *RoleSelect) IntX(ctx context.Context) int

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

func (*RoleSelect) Ints

func (rs *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 (rs *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 interface{}) error

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

func (*RoleSelect) ScanX

func (rs *RoleSelect) ScanX(ctx context.Context, v interface{})

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

func (*RoleSelect) String

func (rs *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 (rs *RoleSelect) StringX(ctx context.Context) string

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

func (*RoleSelect) Strings

func (rs *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 (rs *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) AddEmployeeIDs

func (ru *RoleUpdate) AddEmployeeIDs(ids ...int64) *RoleUpdate

AddEmployeeIDs adds the "employees" edge to the Employee entity by IDs.

func (*RoleUpdate) AddEmployees

func (ru *RoleUpdate) AddEmployees(e ...*Employee) *RoleUpdate

AddEmployees adds the "employees" edges to the Employee entity.

func (*RoleUpdate) AddPermissionIDs

func (ru *RoleUpdate) AddPermissionIDs(ids ...int64) *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) ClearDesc

func (ru *RoleUpdate) ClearDesc() *RoleUpdate

ClearDesc clears the value of the "desc" field.

func (*RoleUpdate) ClearEmployees

func (ru *RoleUpdate) ClearEmployees() *RoleUpdate

ClearEmployees clears all "employees" edges to the Employee entity.

func (*RoleUpdate) ClearPermissions

func (ru *RoleUpdate) ClearPermissions() *RoleUpdate

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

func (*RoleUpdate) ClearStatus

func (ru *RoleUpdate) ClearStatus() *RoleUpdate

ClearStatus clears the value of the "status" field.

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

func (ru *RoleUpdate) RemoveEmployeeIDs(ids ...int64) *RoleUpdate

RemoveEmployeeIDs removes the "employees" edge to Employee entities by IDs.

func (*RoleUpdate) RemoveEmployees

func (ru *RoleUpdate) RemoveEmployees(e ...*Employee) *RoleUpdate

RemoveEmployees removes "employees" edges to Employee entities.

func (*RoleUpdate) RemovePermissionIDs

func (ru *RoleUpdate) RemovePermissionIDs(ids ...int64) *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) 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) SetDesc

func (ru *RoleUpdate) SetDesc(s string) *RoleUpdate

SetDesc sets the "desc" field.

func (*RoleUpdate) SetName

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

SetName sets the "name" field.

func (*RoleUpdate) SetNillableDesc

func (ru *RoleUpdate) SetNillableDesc(s *string) *RoleUpdate

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*RoleUpdate) SetNillableStatus

func (ru *RoleUpdate) SetNillableStatus(r *role.Status) *RoleUpdate

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

func (*RoleUpdate) SetStatus

func (ru *RoleUpdate) SetStatus(r role.Status) *RoleUpdate

SetStatus sets the "status" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where adds a new predicate for 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) AddEmployeeIDs

func (ruo *RoleUpdateOne) AddEmployeeIDs(ids ...int64) *RoleUpdateOne

AddEmployeeIDs adds the "employees" edge to the Employee entity by IDs.

func (*RoleUpdateOne) AddEmployees

func (ruo *RoleUpdateOne) AddEmployees(e ...*Employee) *RoleUpdateOne

AddEmployees adds the "employees" edges to the Employee entity.

func (*RoleUpdateOne) AddPermissionIDs

func (ruo *RoleUpdateOne) AddPermissionIDs(ids ...int64) *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) ClearDesc

func (ruo *RoleUpdateOne) ClearDesc() *RoleUpdateOne

ClearDesc clears the value of the "desc" field.

func (*RoleUpdateOne) ClearEmployees

func (ruo *RoleUpdateOne) ClearEmployees() *RoleUpdateOne

ClearEmployees clears all "employees" edges to the Employee entity.

func (*RoleUpdateOne) ClearPermissions

func (ruo *RoleUpdateOne) ClearPermissions() *RoleUpdateOne

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

func (*RoleUpdateOne) ClearStatus

func (ruo *RoleUpdateOne) ClearStatus() *RoleUpdateOne

ClearStatus clears the value of the "status" field.

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

func (ruo *RoleUpdateOne) RemoveEmployeeIDs(ids ...int64) *RoleUpdateOne

RemoveEmployeeIDs removes the "employees" edge to Employee entities by IDs.

func (*RoleUpdateOne) RemoveEmployees

func (ruo *RoleUpdateOne) RemoveEmployees(e ...*Employee) *RoleUpdateOne

RemoveEmployees removes "employees" edges to Employee entities.

func (*RoleUpdateOne) RemovePermissionIDs

func (ruo *RoleUpdateOne) RemovePermissionIDs(ids ...int64) *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) 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) SetDesc

func (ruo *RoleUpdateOne) SetDesc(s string) *RoleUpdateOne

SetDesc sets the "desc" field.

func (*RoleUpdateOne) SetName

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

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableDesc

func (ruo *RoleUpdateOne) SetNillableDesc(s *string) *RoleUpdateOne

SetNillableDesc sets the "desc" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableStatus

func (ruo *RoleUpdateOne) SetNillableStatus(r *role.Status) *RoleUpdateOne

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

func (*RoleUpdateOne) SetStatus

func (ruo *RoleUpdateOne) SetStatus(r role.Status) *RoleUpdateOne

SetStatus sets the "status" field.

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(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 Rollbacker method.

type Tx

type Tx struct {

	// Employee is the client for interacting with the Employee builders.
	Employee *EmployeeClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// 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 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