ent

package
v0.0.0-...-9bd63dd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeApi        = "Api"
	TypeDictData   = "DictData"
	TypeDictType   = "DictType"
	TypePermission = "Permission"
	TypeRole       = "Role"
	TypeStaff      = "Staff"
	TypeUser       = "User"
	TypeUserRole   = "UserRole"
)

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type APICreate

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

APICreate is the builder for creating a Api entity.

func (*APICreate) Exec

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

Exec executes the query.

func (*APICreate) ExecX

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

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

func (*APICreate) Mutation

func (ac *APICreate) Mutation() *APIMutation

Mutation returns the APIMutation object of the builder.

func (*APICreate) Save

func (ac *APICreate) Save(ctx context.Context) (*Api, error)

Save creates the Api in the database.

func (*APICreate) SaveX

func (ac *APICreate) SaveX(ctx context.Context) *Api

SaveX calls Save and panics if Save returns an error.

func (*APICreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*APICreate) SetCreatedBy

func (ac *APICreate) SetCreatedBy(i int64) *APICreate

SetCreatedBy sets the "created_by" field.

func (*APICreate) SetDesc

func (ac *APICreate) SetDesc(s string) *APICreate

SetDesc sets the "desc" field.

func (*APICreate) SetGroup

func (ac *APICreate) SetGroup(s string) *APICreate

SetGroup sets the "group" field.

func (*APICreate) SetID

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

SetID sets the "id" field.

func (*APICreate) SetMethod

func (ac *APICreate) SetMethod(s string) *APICreate

SetMethod sets the "method" field.

func (*APICreate) SetName

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

SetName sets the "name" field.

func (*APICreate) SetNillableCreatedAt

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

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

func (*APICreate) SetNillableCreatedBy

func (ac *APICreate) SetNillableCreatedBy(i *int64) *APICreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*APICreate) SetNillableDesc

func (ac *APICreate) SetNillableDesc(s *string) *APICreate

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

func (*APICreate) SetNillableGroup

func (ac *APICreate) SetNillableGroup(s *string) *APICreate

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

func (*APICreate) SetNillableMethod

func (ac *APICreate) SetNillableMethod(s *string) *APICreate

SetNillableMethod sets the "method" field if the given value is not nil.

func (*APICreate) SetNillableName

func (ac *APICreate) SetNillableName(s *string) *APICreate

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

func (*APICreate) SetNillablePath

func (ac *APICreate) SetNillablePath(s *string) *APICreate

SetNillablePath sets the "path" field if the given value is not nil.

func (*APICreate) SetNillablePermission

func (ac *APICreate) SetNillablePermission(s *string) *APICreate

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*APICreate) SetNillableStatus

func (ac *APICreate) SetNillableStatus(u *uint8) *APICreate

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

func (*APICreate) SetNillableUpdatedAt

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

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

func (*APICreate) SetNillableUpdatedBy

func (ac *APICreate) SetNillableUpdatedBy(i *int64) *APICreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*APICreate) SetPath

func (ac *APICreate) SetPath(s string) *APICreate

SetPath sets the "path" field.

func (*APICreate) SetPermission

func (ac *APICreate) SetPermission(s string) *APICreate

SetPermission sets the "permission" field.

func (*APICreate) SetStatus

func (ac *APICreate) SetStatus(u uint8) *APICreate

SetStatus sets the "status" field.

func (*APICreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*APICreate) SetUpdatedBy

func (ac *APICreate) SetUpdatedBy(i int64) *APICreate

SetUpdatedBy sets the "updated_by" field.

type APICreateBulk

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

APICreateBulk is the builder for creating many Api entities in bulk.

func (*APICreateBulk) Exec

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

Exec executes the query.

func (*APICreateBulk) ExecX

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

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

func (*APICreateBulk) Save

func (acb *APICreateBulk) Save(ctx context.Context) ([]*Api, error)

Save creates the Api entities in the database.

func (*APICreateBulk) SaveX

func (acb *APICreateBulk) SaveX(ctx context.Context) []*Api

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

type APIDelete

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

APIDelete is the builder for deleting a Api entity.

func (*APIDelete) Exec

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

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

func (*APIDelete) ExecX

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

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

func (*APIDelete) Where

func (ad *APIDelete) Where(ps ...predicate.Api) *APIDelete

Where appends a list predicates to the APIDelete builder.

type APIDeleteOne

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

APIDeleteOne is the builder for deleting a single Api entity.

func (*APIDeleteOne) Exec

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

Exec executes the deletion query.

func (*APIDeleteOne) ExecX

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

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

type APIGroupBy

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

APIGroupBy is the group-by builder for Api entities.

func (*APIGroupBy) Aggregate

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

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

func (*APIGroupBy) Bool

func (agb *APIGroupBy) 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 (*APIGroupBy) BoolX

func (agb *APIGroupBy) BoolX(ctx context.Context) bool

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

func (*APIGroupBy) Bools

func (agb *APIGroupBy) 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 (*APIGroupBy) BoolsX

func (agb *APIGroupBy) BoolsX(ctx context.Context) []bool

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

func (*APIGroupBy) Float64

func (agb *APIGroupBy) 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 (*APIGroupBy) Float64X

func (agb *APIGroupBy) Float64X(ctx context.Context) float64

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

func (*APIGroupBy) Float64s

func (agb *APIGroupBy) 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 (*APIGroupBy) Float64sX

func (agb *APIGroupBy) Float64sX(ctx context.Context) []float64

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

func (*APIGroupBy) Int

func (agb *APIGroupBy) 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 (*APIGroupBy) IntX

func (agb *APIGroupBy) IntX(ctx context.Context) int

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

func (*APIGroupBy) Ints

func (agb *APIGroupBy) 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 (*APIGroupBy) IntsX

func (agb *APIGroupBy) IntsX(ctx context.Context) []int

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

func (*APIGroupBy) Scan

func (agb *APIGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*APIGroupBy) ScanX

func (agb *APIGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*APIGroupBy) String

func (agb *APIGroupBy) 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 (*APIGroupBy) StringX

func (agb *APIGroupBy) StringX(ctx context.Context) string

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

func (*APIGroupBy) Strings

func (agb *APIGroupBy) 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 (*APIGroupBy) StringsX

func (agb *APIGroupBy) StringsX(ctx context.Context) []string

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

type APIMutation

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

APIMutation represents an operation that mutates the Api nodes in the graph.

func (*APIMutation) AddCreatedBy

func (m *APIMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*APIMutation) AddField

func (m *APIMutation) 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 (*APIMutation) AddStatus

func (m *APIMutation) AddStatus(u int8)

AddStatus adds u to the "status" field.

func (*APIMutation) AddUpdatedBy

func (m *APIMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*APIMutation) AddedCreatedBy

func (m *APIMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*APIMutation) AddedEdges

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

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

func (*APIMutation) AddedField

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

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

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

func (*APIMutation) AddedIDs

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

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

func (*APIMutation) AddedStatus

func (m *APIMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the "status" field in this mutation.

func (*APIMutation) AddedUpdatedBy

func (m *APIMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*APIMutation) ClearEdge

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

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

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

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

func (*APIMutation) ClearedFields

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

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

func (APIMutation) Client

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

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

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

func (*APIMutation) CreatedBy

func (m *APIMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*APIMutation) Desc

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

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

func (*APIMutation) EdgeCleared

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

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

func (*APIMutation) Field

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

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

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

func (*APIMutation) Fields

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

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

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

func (*APIMutation) ID

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

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

func (*APIMutation) IDs

func (m *APIMutation) IDs(ctx context.Context) ([]int64, error)

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

func (*APIMutation) Method

func (m *APIMutation) Method() (r string, exists bool)

Method returns the value of the "method" field in the mutation.

func (*APIMutation) Name

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

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

func (*APIMutation) OldCreatedAt

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

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

func (m *APIMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" field's value of the Api entity. If the Api 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 (*APIMutation) OldDesc

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

OldDesc returns the old "desc" field's value of the Api entity. If the Api 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 (*APIMutation) OldField

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

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

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

func (m *APIMutation) OldMethod(ctx context.Context) (v string, err error)

OldMethod returns the old "method" field's value of the Api entity. If the Api 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 (*APIMutation) OldName

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

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

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

OldPath returns the old "path" field's value of the Api entity. If the Api 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 (*APIMutation) OldPermission

func (m *APIMutation) OldPermission(ctx context.Context) (v string, err error)

OldPermission returns the old "permission" field's value of the Api entity. If the Api 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 (*APIMutation) OldStatus

func (m *APIMutation) OldStatus(ctx context.Context) (v uint8, err error)

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

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

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

func (m *APIMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the Api entity. If the Api 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 (*APIMutation) Op

func (m *APIMutation) Op() Op

Op returns the operation name.

func (*APIMutation) Path

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

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

func (*APIMutation) Permission

func (m *APIMutation) Permission() (r string, exists bool)

Permission returns the value of the "permission" field in the mutation.

func (*APIMutation) RemovedEdges

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

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

func (*APIMutation) RemovedIDs

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

func (m *APIMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*APIMutation) ResetCreatedBy

func (m *APIMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*APIMutation) ResetDesc

func (m *APIMutation) ResetDesc()

ResetDesc resets all changes to the "desc" field.

func (*APIMutation) ResetEdge

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

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

func (m *APIMutation) ResetGroup()

ResetGroup resets all changes to the "group" field.

func (*APIMutation) ResetMethod

func (m *APIMutation) ResetMethod()

ResetMethod resets all changes to the "method" field.

func (*APIMutation) ResetName

func (m *APIMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*APIMutation) ResetPath

func (m *APIMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*APIMutation) ResetPermission

func (m *APIMutation) ResetPermission()

ResetPermission resets all changes to the "permission" field.

func (*APIMutation) ResetStatus

func (m *APIMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*APIMutation) ResetUpdatedAt

func (m *APIMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*APIMutation) ResetUpdatedBy

func (m *APIMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*APIMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*APIMutation) SetCreatedBy

func (m *APIMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*APIMutation) SetDesc

func (m *APIMutation) SetDesc(s string)

SetDesc sets the "desc" field.

func (*APIMutation) SetField

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

func (m *APIMutation) SetGroup(s string)

SetGroup sets the "group" field.

func (*APIMutation) SetID

func (m *APIMutation) SetID(id int64)

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

func (*APIMutation) SetMethod

func (m *APIMutation) SetMethod(s string)

SetMethod sets the "method" field.

func (*APIMutation) SetName

func (m *APIMutation) SetName(s string)

SetName sets the "name" field.

func (*APIMutation) SetPath

func (m *APIMutation) SetPath(s string)

SetPath sets the "path" field.

func (*APIMutation) SetPermission

func (m *APIMutation) SetPermission(s string)

SetPermission sets the "permission" field.

func (*APIMutation) SetStatus

func (m *APIMutation) SetStatus(u uint8)

SetStatus sets the "status" field.

func (*APIMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*APIMutation) SetUpdatedBy

func (m *APIMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*APIMutation) Status

func (m *APIMutation) Status() (r uint8, exists bool)

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

func (APIMutation) Tx

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

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

func (*APIMutation) Type

func (m *APIMutation) Type() string

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

func (*APIMutation) UpdatedAt

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

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

func (*APIMutation) UpdatedBy

func (m *APIMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*APIMutation) Where

func (m *APIMutation) Where(ps ...predicate.Api)

Where appends a list predicates to the APIMutation builder.

type APIQuery

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

APIQuery is the builder for querying Api entities.

func (*APIQuery) All

func (aq *APIQuery) All(ctx context.Context) ([]*Api, error)

All executes the query and returns a list of Apis.

func (*APIQuery) AllX

func (aq *APIQuery) AllX(ctx context.Context) []*Api

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

func (*APIQuery) Clone

func (aq *APIQuery) Clone() *APIQuery

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

func (*APIQuery) Count

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

Count returns the count of the given query.

func (*APIQuery) CountX

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

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

func (*APIQuery) Exist

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

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

func (*APIQuery) ExistX

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

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

func (*APIQuery) First

func (aq *APIQuery) First(ctx context.Context) (*Api, error)

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

func (*APIQuery) FirstID

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

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

func (*APIQuery) FirstIDX

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

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

func (*APIQuery) FirstX

func (aq *APIQuery) FirstX(ctx context.Context) *Api

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

func (*APIQuery) GroupBy

func (aq *APIQuery) GroupBy(field string, fields ...string) *APIGroupBy

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

Example:

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

client.API.Query().
	GroupBy(api.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*APIQuery) IDs

func (aq *APIQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*APIQuery) IDsX

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

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

func (*APIQuery) Limit

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

Limit adds a limit step to the query.

func (*APIQuery) Offset

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

Offset adds an offset step to the query.

func (*APIQuery) Only

func (aq *APIQuery) Only(ctx context.Context) (*Api, error)

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

func (*APIQuery) OnlyID

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

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

func (*APIQuery) OnlyIDX

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

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

func (*APIQuery) OnlyX

func (aq *APIQuery) OnlyX(ctx context.Context) *Api

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

func (*APIQuery) Order

func (aq *APIQuery) Order(o ...OrderFunc) *APIQuery

Order adds an order step to the query.

func (*APIQuery) Select

func (aq *APIQuery) Select(fields ...string) *APISelect

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

Example:

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

client.API.Query().
	Select(api.FieldCreatedAt).
	Scan(ctx, &v)

func (*APIQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*APIQuery) Where

func (aq *APIQuery) Where(ps ...predicate.Api) *APIQuery

Where adds a new predicate for the APIQuery builder.

type APISelect

type APISelect struct {
	*APIQuery
	// contains filtered or unexported fields
}

APISelect is the builder for selecting fields of API entities.

func (*APISelect) Bool

func (as *APISelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*APISelect) BoolX

func (as *APISelect) BoolX(ctx context.Context) bool

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

func (*APISelect) Bools

func (as *APISelect) Bools(ctx context.Context) ([]bool, error)

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

func (*APISelect) BoolsX

func (as *APISelect) BoolsX(ctx context.Context) []bool

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

func (*APISelect) Float64

func (as *APISelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*APISelect) Float64X

func (as *APISelect) Float64X(ctx context.Context) float64

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

func (*APISelect) Float64s

func (as *APISelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*APISelect) Float64sX

func (as *APISelect) Float64sX(ctx context.Context) []float64

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

func (*APISelect) Int

func (as *APISelect) Int(ctx context.Context) (_ int, err error)

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

func (*APISelect) IntX

func (as *APISelect) IntX(ctx context.Context) int

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

func (*APISelect) Ints

func (as *APISelect) Ints(ctx context.Context) ([]int, error)

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

func (*APISelect) IntsX

func (as *APISelect) IntsX(ctx context.Context) []int

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

func (*APISelect) Scan

func (as *APISelect) Scan(ctx context.Context, v interface{}) error

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

func (*APISelect) ScanX

func (as *APISelect) ScanX(ctx context.Context, v interface{})

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

func (*APISelect) String

func (as *APISelect) String(ctx context.Context) (_ string, err error)

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

func (*APISelect) StringX

func (as *APISelect) StringX(ctx context.Context) string

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

func (*APISelect) Strings

func (as *APISelect) Strings(ctx context.Context) ([]string, error)

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

func (*APISelect) StringsX

func (as *APISelect) StringsX(ctx context.Context) []string

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

type APIUpdate

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

APIUpdate is the builder for updating Api entities.

func (*APIUpdate) AddCreatedBy

func (au *APIUpdate) AddCreatedBy(i int64) *APIUpdate

AddCreatedBy adds i to the "created_by" field.

func (*APIUpdate) AddStatus

func (au *APIUpdate) AddStatus(u int8) *APIUpdate

AddStatus adds u to the "status" field.

func (*APIUpdate) AddUpdatedBy

func (au *APIUpdate) AddUpdatedBy(i int64) *APIUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*APIUpdate) Exec

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

Exec executes the query.

func (*APIUpdate) ExecX

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

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

func (*APIUpdate) Mutation

func (au *APIUpdate) Mutation() *APIMutation

Mutation returns the APIMutation object of the builder.

func (*APIUpdate) Save

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

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

func (*APIUpdate) SaveX

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

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

func (*APIUpdate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*APIUpdate) SetCreatedBy

func (au *APIUpdate) SetCreatedBy(i int64) *APIUpdate

SetCreatedBy sets the "created_by" field.

func (*APIUpdate) SetDesc

func (au *APIUpdate) SetDesc(s string) *APIUpdate

SetDesc sets the "desc" field.

func (*APIUpdate) SetGroup

func (au *APIUpdate) SetGroup(s string) *APIUpdate

SetGroup sets the "group" field.

func (*APIUpdate) SetMethod

func (au *APIUpdate) SetMethod(s string) *APIUpdate

SetMethod sets the "method" field.

func (*APIUpdate) SetName

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

SetName sets the "name" field.

func (*APIUpdate) SetNillableCreatedAt

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

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

func (*APIUpdate) SetNillableCreatedBy

func (au *APIUpdate) SetNillableCreatedBy(i *int64) *APIUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*APIUpdate) SetNillableDesc

func (au *APIUpdate) SetNillableDesc(s *string) *APIUpdate

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

func (*APIUpdate) SetNillableGroup

func (au *APIUpdate) SetNillableGroup(s *string) *APIUpdate

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

func (*APIUpdate) SetNillableMethod

func (au *APIUpdate) SetNillableMethod(s *string) *APIUpdate

SetNillableMethod sets the "method" field if the given value is not nil.

func (*APIUpdate) SetNillableName

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

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

func (*APIUpdate) SetNillablePath

func (au *APIUpdate) SetNillablePath(s *string) *APIUpdate

SetNillablePath sets the "path" field if the given value is not nil.

func (*APIUpdate) SetNillablePermission

func (au *APIUpdate) SetNillablePermission(s *string) *APIUpdate

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*APIUpdate) SetNillableStatus

func (au *APIUpdate) SetNillableStatus(u *uint8) *APIUpdate

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

func (*APIUpdate) SetNillableUpdatedBy

func (au *APIUpdate) SetNillableUpdatedBy(i *int64) *APIUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*APIUpdate) SetPath

func (au *APIUpdate) SetPath(s string) *APIUpdate

SetPath sets the "path" field.

func (*APIUpdate) SetPermission

func (au *APIUpdate) SetPermission(s string) *APIUpdate

SetPermission sets the "permission" field.

func (*APIUpdate) SetStatus

func (au *APIUpdate) SetStatus(u uint8) *APIUpdate

SetStatus sets the "status" field.

func (*APIUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*APIUpdate) SetUpdatedBy

func (au *APIUpdate) SetUpdatedBy(i int64) *APIUpdate

SetUpdatedBy sets the "updated_by" field.

func (*APIUpdate) Where

func (au *APIUpdate) Where(ps ...predicate.Api) *APIUpdate

Where appends a list predicates to the APIUpdate builder.

type APIUpdateOne

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

APIUpdateOne is the builder for updating a single Api entity.

func (*APIUpdateOne) AddCreatedBy

func (auo *APIUpdateOne) AddCreatedBy(i int64) *APIUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*APIUpdateOne) AddStatus

func (auo *APIUpdateOne) AddStatus(u int8) *APIUpdateOne

AddStatus adds u to the "status" field.

func (*APIUpdateOne) AddUpdatedBy

func (auo *APIUpdateOne) AddUpdatedBy(i int64) *APIUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*APIUpdateOne) Exec

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

Exec executes the query on the entity.

func (*APIUpdateOne) ExecX

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

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

func (*APIUpdateOne) Mutation

func (auo *APIUpdateOne) Mutation() *APIMutation

Mutation returns the APIMutation object of the builder.

func (*APIUpdateOne) Save

func (auo *APIUpdateOne) Save(ctx context.Context) (*Api, error)

Save executes the query and returns the updated Api entity.

func (*APIUpdateOne) SaveX

func (auo *APIUpdateOne) SaveX(ctx context.Context) *Api

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

func (*APIUpdateOne) Select

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

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

func (*APIUpdateOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*APIUpdateOne) SetCreatedBy

func (auo *APIUpdateOne) SetCreatedBy(i int64) *APIUpdateOne

SetCreatedBy sets the "created_by" field.

func (*APIUpdateOne) SetDesc

func (auo *APIUpdateOne) SetDesc(s string) *APIUpdateOne

SetDesc sets the "desc" field.

func (*APIUpdateOne) SetGroup

func (auo *APIUpdateOne) SetGroup(s string) *APIUpdateOne

SetGroup sets the "group" field.

func (*APIUpdateOne) SetMethod

func (auo *APIUpdateOne) SetMethod(s string) *APIUpdateOne

SetMethod sets the "method" field.

func (*APIUpdateOne) SetName

func (auo *APIUpdateOne) SetName(s string) *APIUpdateOne

SetName sets the "name" field.

func (*APIUpdateOne) SetNillableCreatedAt

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

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

func (*APIUpdateOne) SetNillableCreatedBy

func (auo *APIUpdateOne) SetNillableCreatedBy(i *int64) *APIUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*APIUpdateOne) SetNillableDesc

func (auo *APIUpdateOne) SetNillableDesc(s *string) *APIUpdateOne

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

func (*APIUpdateOne) SetNillableGroup

func (auo *APIUpdateOne) SetNillableGroup(s *string) *APIUpdateOne

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

func (*APIUpdateOne) SetNillableMethod

func (auo *APIUpdateOne) SetNillableMethod(s *string) *APIUpdateOne

SetNillableMethod sets the "method" field if the given value is not nil.

func (*APIUpdateOne) SetNillableName

func (auo *APIUpdateOne) SetNillableName(s *string) *APIUpdateOne

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

func (*APIUpdateOne) SetNillablePath

func (auo *APIUpdateOne) SetNillablePath(s *string) *APIUpdateOne

SetNillablePath sets the "path" field if the given value is not nil.

func (*APIUpdateOne) SetNillablePermission

func (auo *APIUpdateOne) SetNillablePermission(s *string) *APIUpdateOne

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*APIUpdateOne) SetNillableStatus

func (auo *APIUpdateOne) SetNillableStatus(u *uint8) *APIUpdateOne

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

func (*APIUpdateOne) SetNillableUpdatedBy

func (auo *APIUpdateOne) SetNillableUpdatedBy(i *int64) *APIUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*APIUpdateOne) SetPath

func (auo *APIUpdateOne) SetPath(s string) *APIUpdateOne

SetPath sets the "path" field.

func (*APIUpdateOne) SetPermission

func (auo *APIUpdateOne) SetPermission(s string) *APIUpdateOne

SetPermission sets the "permission" field.

func (*APIUpdateOne) SetStatus

func (auo *APIUpdateOne) SetStatus(u uint8) *APIUpdateOne

SetStatus sets the "status" field.

func (*APIUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*APIUpdateOne) SetUpdatedBy

func (auo *APIUpdateOne) SetUpdatedBy(i int64) *APIUpdateOne

SetUpdatedBy sets the "updated_by" field.

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Api

type Api struct {

	// ID of the ent.
	// 自增id
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// Group holds the value of the "group" field.
	// 接口分组
	Group string `json:"group,omitempty"`
	// Name holds the value of the "name" field.
	// 接口名称
	Name string `json:"name,omitempty"`
	// Path holds the value of the "path" field.
	// 接口路径
	Path string `json:"path,omitempty"`
	// Method holds the value of the "method" field.
	// 接口请求方式
	Method string `json:"method,omitempty"`
	// Desc holds the value of the "desc" field.
	// 接口描述
	Desc string `json:"desc,omitempty"`
	// Permission holds the value of the "permission" field.
	// 接口权限
	Permission string `json:"permission,omitempty"`
	// Status holds the value of the "status" field.
	// 状态 0:禁用 1:启用 -1:删除
	Status uint8 `json:"status,omitempty"`
	// contains filtered or unexported fields
}

Api is the model entity for the Api schema.

func (*Api) String

func (a *Api) String() string

String implements the fmt.Stringer.

func (*Api) Unwrap

func (a *Api) Unwrap() *Api

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

func (a *Api) Update() *APIUpdateOne

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

type ApiClient

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

ApiClient is a client for the Api schema.

func NewApiClient

func NewApiClient(c config) *ApiClient

NewApiClient returns a client for the Api from the given config.

func (*ApiClient) Create

func (c *ApiClient) Create() *APICreate

Create returns a create builder for Api.

func (*ApiClient) CreateBulk

func (c *ApiClient) CreateBulk(builders ...*APICreate) *APICreateBulk

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

func (*ApiClient) Delete

func (c *ApiClient) Delete() *APIDelete

Delete returns a delete builder for Api.

func (*ApiClient) DeleteOne

func (c *ApiClient) DeleteOne(a *Api) *APIDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ApiClient) DeleteOneID

func (c *ApiClient) DeleteOneID(id int64) *APIDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ApiClient) Get

func (c *ApiClient) Get(ctx context.Context, id int64) (*Api, error)

Get returns a Api entity by its id.

func (*ApiClient) GetX

func (c *ApiClient) GetX(ctx context.Context, id int64) *Api

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

func (*ApiClient) Hooks

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

Hooks returns the client hooks.

func (*ApiClient) Query

func (c *ApiClient) Query() *APIQuery

Query returns a query builder for Api.

func (*ApiClient) Update

func (c *ApiClient) Update() *APIUpdate

Update returns an update builder for Api.

func (*ApiClient) UpdateOne

func (c *ApiClient) UpdateOne(a *Api) *APIUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ApiClient) UpdateOneID

func (c *ApiClient) UpdateOneID(id int64) *APIUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ApiClient) Use

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

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

type Apis

type Apis []*Api

Apis is a parsable slice of Api.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Api is the client for interacting with the Api builders.
	Api *ApiClient
	// DictData is the client for interacting with the DictData builders.
	DictData *DictDataClient
	// DictType is the client for interacting with the DictType builders.
	DictType *DictTypeClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Staff is the client for interacting with the Staff builders.
	Staff *StaffClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserRole is the client for interacting with the UserRole builders.
	UserRole *UserRoleClient
	// 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().
	Api.
	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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type DictData

type DictData struct {

	// ID of the ent.
	// 字典数据id
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// DictTypeID holds the value of the "dict_type_id" field.
	// 字典类型id
	DictTypeID int64 `json:"dict_type_id,omitempty"`
	// Label holds the value of the "label" field.
	// 字典标签
	Label string `json:"label,omitempty"`
	// Value holds the value of the "value" field.
	// 字典键值
	Value string `json:"value,omitempty"`
	// Sort holds the value of the "sort" field.
	// 排序
	Sort int8 `json:"sort,omitempty"`
	// Status holds the value of the "status" field.
	// 状态 0:禁用 1:启用 -1:删除
	Status int8 `json:"status,omitempty"`
	// Remark holds the value of the "remark" field.
	// 备注
	Remark string `json:"remark,omitempty"`
	// IsDefault holds the value of the "is_default" field.
	// 是否默认值 0:否 1:是
	IsDefault int8 `json:"is_default,omitempty"`
	// contains filtered or unexported fields
}

DictData is the model entity for the DictData schema.

func (*DictData) String

func (dd *DictData) String() string

String implements the fmt.Stringer.

func (*DictData) Unwrap

func (dd *DictData) Unwrap() *DictData

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

func (dd *DictData) Update() *DictDataUpdateOne

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

type DictDataClient

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

DictDataClient is a client for the DictData schema.

func NewDictDataClient

func NewDictDataClient(c config) *DictDataClient

NewDictDataClient returns a client for the DictData from the given config.

func (*DictDataClient) Create

func (c *DictDataClient) Create() *DictDataCreate

Create returns a create builder for DictData.

func (*DictDataClient) CreateBulk

func (c *DictDataClient) CreateBulk(builders ...*DictDataCreate) *DictDataCreateBulk

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

func (*DictDataClient) Delete

func (c *DictDataClient) Delete() *DictDataDelete

Delete returns a delete builder for DictData.

func (*DictDataClient) DeleteOne

func (c *DictDataClient) DeleteOne(dd *DictData) *DictDataDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*DictDataClient) DeleteOneID

func (c *DictDataClient) DeleteOneID(id int64) *DictDataDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*DictDataClient) Get

func (c *DictDataClient) Get(ctx context.Context, id int64) (*DictData, error)

Get returns a DictData entity by its id.

func (*DictDataClient) GetX

func (c *DictDataClient) GetX(ctx context.Context, id int64) *DictData

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

func (*DictDataClient) Hooks

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

Hooks returns the client hooks.

func (*DictDataClient) Query

func (c *DictDataClient) Query() *DictDataQuery

Query returns a query builder for DictData.

func (*DictDataClient) Update

func (c *DictDataClient) Update() *DictDataUpdate

Update returns an update builder for DictData.

func (*DictDataClient) UpdateOne

func (c *DictDataClient) UpdateOne(dd *DictData) *DictDataUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DictDataClient) UpdateOneID

func (c *DictDataClient) UpdateOneID(id int64) *DictDataUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DictDataClient) Use

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

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

type DictDataCreate

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

DictDataCreate is the builder for creating a DictData entity.

func (*DictDataCreate) Exec

func (ddc *DictDataCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DictDataCreate) ExecX

func (ddc *DictDataCreate) ExecX(ctx context.Context)

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

func (*DictDataCreate) Mutation

func (ddc *DictDataCreate) Mutation() *DictDataMutation

Mutation returns the DictDataMutation object of the builder.

func (*DictDataCreate) Save

func (ddc *DictDataCreate) Save(ctx context.Context) (*DictData, error)

Save creates the DictData in the database.

func (*DictDataCreate) SaveX

func (ddc *DictDataCreate) SaveX(ctx context.Context) *DictData

SaveX calls Save and panics if Save returns an error.

func (*DictDataCreate) SetCreatedAt

func (ddc *DictDataCreate) SetCreatedAt(t time.Time) *DictDataCreate

SetCreatedAt sets the "created_at" field.

func (*DictDataCreate) SetCreatedBy

func (ddc *DictDataCreate) SetCreatedBy(i int64) *DictDataCreate

SetCreatedBy sets the "created_by" field.

func (*DictDataCreate) SetDictTypeID

func (ddc *DictDataCreate) SetDictTypeID(i int64) *DictDataCreate

SetDictTypeID sets the "dict_type_id" field.

func (*DictDataCreate) SetID

func (ddc *DictDataCreate) SetID(i int64) *DictDataCreate

SetID sets the "id" field.

func (*DictDataCreate) SetIsDefault

func (ddc *DictDataCreate) SetIsDefault(i int8) *DictDataCreate

SetIsDefault sets the "is_default" field.

func (*DictDataCreate) SetLabel

func (ddc *DictDataCreate) SetLabel(s string) *DictDataCreate

SetLabel sets the "label" field.

func (*DictDataCreate) SetNillableCreatedAt

func (ddc *DictDataCreate) SetNillableCreatedAt(t *time.Time) *DictDataCreate

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

func (*DictDataCreate) SetNillableCreatedBy

func (ddc *DictDataCreate) SetNillableCreatedBy(i *int64) *DictDataCreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictDataCreate) SetNillableDictTypeID

func (ddc *DictDataCreate) SetNillableDictTypeID(i *int64) *DictDataCreate

SetNillableDictTypeID sets the "dict_type_id" field if the given value is not nil.

func (*DictDataCreate) SetNillableIsDefault

func (ddc *DictDataCreate) SetNillableIsDefault(i *int8) *DictDataCreate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*DictDataCreate) SetNillableLabel

func (ddc *DictDataCreate) SetNillableLabel(s *string) *DictDataCreate

SetNillableLabel sets the "label" field if the given value is not nil.

func (*DictDataCreate) SetNillableRemark

func (ddc *DictDataCreate) SetNillableRemark(s *string) *DictDataCreate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictDataCreate) SetNillableSort

func (ddc *DictDataCreate) SetNillableSort(i *int8) *DictDataCreate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*DictDataCreate) SetNillableStatus

func (ddc *DictDataCreate) SetNillableStatus(i *int8) *DictDataCreate

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

func (*DictDataCreate) SetNillableUpdatedAt

func (ddc *DictDataCreate) SetNillableUpdatedAt(t *time.Time) *DictDataCreate

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

func (*DictDataCreate) SetNillableUpdatedBy

func (ddc *DictDataCreate) SetNillableUpdatedBy(i *int64) *DictDataCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictDataCreate) SetNillableValue

func (ddc *DictDataCreate) SetNillableValue(s *string) *DictDataCreate

SetNillableValue sets the "value" field if the given value is not nil.

func (*DictDataCreate) SetRemark

func (ddc *DictDataCreate) SetRemark(s string) *DictDataCreate

SetRemark sets the "remark" field.

func (*DictDataCreate) SetSort

func (ddc *DictDataCreate) SetSort(i int8) *DictDataCreate

SetSort sets the "sort" field.

func (*DictDataCreate) SetStatus

func (ddc *DictDataCreate) SetStatus(i int8) *DictDataCreate

SetStatus sets the "status" field.

func (*DictDataCreate) SetUpdatedAt

func (ddc *DictDataCreate) SetUpdatedAt(t time.Time) *DictDataCreate

SetUpdatedAt sets the "updated_at" field.

func (*DictDataCreate) SetUpdatedBy

func (ddc *DictDataCreate) SetUpdatedBy(i int64) *DictDataCreate

SetUpdatedBy sets the "updated_by" field.

func (*DictDataCreate) SetValue

func (ddc *DictDataCreate) SetValue(s string) *DictDataCreate

SetValue sets the "value" field.

type DictDataCreateBulk

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

DictDataCreateBulk is the builder for creating many DictData entities in bulk.

func (*DictDataCreateBulk) Exec

func (ddcb *DictDataCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DictDataCreateBulk) ExecX

func (ddcb *DictDataCreateBulk) ExecX(ctx context.Context)

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

func (*DictDataCreateBulk) Save

func (ddcb *DictDataCreateBulk) Save(ctx context.Context) ([]*DictData, error)

Save creates the DictData entities in the database.

func (*DictDataCreateBulk) SaveX

func (ddcb *DictDataCreateBulk) SaveX(ctx context.Context) []*DictData

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

type DictDataDelete

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

DictDataDelete is the builder for deleting a DictData entity.

func (*DictDataDelete) Exec

func (ddd *DictDataDelete) Exec(ctx context.Context) (int, error)

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

func (*DictDataDelete) ExecX

func (ddd *DictDataDelete) ExecX(ctx context.Context) int

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

func (*DictDataDelete) Where

func (ddd *DictDataDelete) Where(ps ...predicate.DictData) *DictDataDelete

Where appends a list predicates to the DictDataDelete builder.

type DictDataDeleteOne

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

DictDataDeleteOne is the builder for deleting a single DictData entity.

func (*DictDataDeleteOne) Exec

func (dddo *DictDataDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DictDataDeleteOne) ExecX

func (dddo *DictDataDeleteOne) ExecX(ctx context.Context)

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

type DictDataGroupBy

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

DictDataGroupBy is the group-by builder for DictData entities.

func (*DictDataGroupBy) Aggregate

func (ddgb *DictDataGroupBy) Aggregate(fns ...AggregateFunc) *DictDataGroupBy

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

func (*DictDataGroupBy) Bool

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) BoolX

func (ddgb *DictDataGroupBy) BoolX(ctx context.Context) bool

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

func (*DictDataGroupBy) Bools

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) BoolsX

func (ddgb *DictDataGroupBy) BoolsX(ctx context.Context) []bool

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

func (*DictDataGroupBy) Float64

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) Float64X

func (ddgb *DictDataGroupBy) Float64X(ctx context.Context) float64

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

func (*DictDataGroupBy) Float64s

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) Float64sX

func (ddgb *DictDataGroupBy) Float64sX(ctx context.Context) []float64

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

func (*DictDataGroupBy) Int

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) IntX

func (ddgb *DictDataGroupBy) IntX(ctx context.Context) int

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

func (*DictDataGroupBy) Ints

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) IntsX

func (ddgb *DictDataGroupBy) IntsX(ctx context.Context) []int

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

func (*DictDataGroupBy) Scan

func (ddgb *DictDataGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*DictDataGroupBy) ScanX

func (ddgb *DictDataGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*DictDataGroupBy) String

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) StringX

func (ddgb *DictDataGroupBy) StringX(ctx context.Context) string

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

func (*DictDataGroupBy) Strings

func (ddgb *DictDataGroupBy) 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 (*DictDataGroupBy) StringsX

func (ddgb *DictDataGroupBy) StringsX(ctx context.Context) []string

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

type DictDataMutation

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

DictDataMutation represents an operation that mutates the DictData nodes in the graph.

func (*DictDataMutation) AddCreatedBy

func (m *DictDataMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*DictDataMutation) AddDictTypeID

func (m *DictDataMutation) AddDictTypeID(i int64)

AddDictTypeID adds i to the "dict_type_id" field.

func (*DictDataMutation) AddField

func (m *DictDataMutation) 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 (*DictDataMutation) AddIsDefault

func (m *DictDataMutation) AddIsDefault(i int8)

AddIsDefault adds i to the "is_default" field.

func (*DictDataMutation) AddSort

func (m *DictDataMutation) AddSort(i int8)

AddSort adds i to the "sort" field.

func (*DictDataMutation) AddStatus

func (m *DictDataMutation) AddStatus(i int8)

AddStatus adds i to the "status" field.

func (*DictDataMutation) AddUpdatedBy

func (m *DictDataMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*DictDataMutation) AddedCreatedBy

func (m *DictDataMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*DictDataMutation) AddedDictTypeID

func (m *DictDataMutation) AddedDictTypeID() (r int64, exists bool)

AddedDictTypeID returns the value that was added to the "dict_type_id" field in this mutation.

func (*DictDataMutation) AddedEdges

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

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

func (*DictDataMutation) AddedField

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

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

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

func (*DictDataMutation) AddedIDs

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

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

func (*DictDataMutation) AddedIsDefault

func (m *DictDataMutation) AddedIsDefault() (r int8, exists bool)

AddedIsDefault returns the value that was added to the "is_default" field in this mutation.

func (*DictDataMutation) AddedSort

func (m *DictDataMutation) AddedSort() (r int8, exists bool)

AddedSort returns the value that was added to the "sort" field in this mutation.

func (*DictDataMutation) AddedStatus

func (m *DictDataMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the "status" field in this mutation.

func (*DictDataMutation) AddedUpdatedBy

func (m *DictDataMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*DictDataMutation) ClearEdge

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

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

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

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

func (*DictDataMutation) ClearedFields

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

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

func (DictDataMutation) Client

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

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

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

func (*DictDataMutation) CreatedBy

func (m *DictDataMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*DictDataMutation) DictTypeID

func (m *DictDataMutation) DictTypeID() (r int64, exists bool)

DictTypeID returns the value of the "dict_type_id" field in the mutation.

func (*DictDataMutation) EdgeCleared

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

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

func (*DictDataMutation) Field

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

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

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

func (*DictDataMutation) Fields

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

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

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

func (*DictDataMutation) IDs

func (m *DictDataMutation) IDs(ctx context.Context) ([]int64, error)

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

func (*DictDataMutation) IsDefault

func (m *DictDataMutation) IsDefault() (r int8, exists bool)

IsDefault returns the value of the "is_default" field in the mutation.

func (*DictDataMutation) Label

func (m *DictDataMutation) Label() (r string, exists bool)

Label returns the value of the "label" field in the mutation.

func (*DictDataMutation) OldCreatedAt

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

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

func (m *DictDataMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldDictTypeID

func (m *DictDataMutation) OldDictTypeID(ctx context.Context) (v int64, err error)

OldDictTypeID returns the old "dict_type_id" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldField

func (m *DictDataMutation) 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 (*DictDataMutation) OldIsDefault

func (m *DictDataMutation) OldIsDefault(ctx context.Context) (v int8, err error)

OldIsDefault returns the old "is_default" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldLabel

func (m *DictDataMutation) OldLabel(ctx context.Context) (v string, err error)

OldLabel returns the old "label" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldRemark

func (m *DictDataMutation) OldRemark(ctx context.Context) (v string, err error)

OldRemark returns the old "remark" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldSort

func (m *DictDataMutation) OldSort(ctx context.Context) (v int8, err error)

OldSort returns the old "sort" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldStatus

func (m *DictDataMutation) OldStatus(ctx context.Context) (v int8, err error)

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

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

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

func (m *DictDataMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) OldValue

func (m *DictDataMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the DictData entity. If the DictData 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 (*DictDataMutation) Op

func (m *DictDataMutation) Op() Op

Op returns the operation name.

func (*DictDataMutation) Remark

func (m *DictDataMutation) Remark() (r string, exists bool)

Remark returns the value of the "remark" field in the mutation.

func (*DictDataMutation) RemovedEdges

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

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

func (*DictDataMutation) RemovedIDs

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

func (m *DictDataMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DictDataMutation) ResetCreatedBy

func (m *DictDataMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*DictDataMutation) ResetDictTypeID

func (m *DictDataMutation) ResetDictTypeID()

ResetDictTypeID resets all changes to the "dict_type_id" field.

func (*DictDataMutation) ResetEdge

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

func (m *DictDataMutation) 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 (*DictDataMutation) ResetIsDefault

func (m *DictDataMutation) ResetIsDefault()

ResetIsDefault resets all changes to the "is_default" field.

func (*DictDataMutation) ResetLabel

func (m *DictDataMutation) ResetLabel()

ResetLabel resets all changes to the "label" field.

func (*DictDataMutation) ResetRemark

func (m *DictDataMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*DictDataMutation) ResetSort

func (m *DictDataMutation) ResetSort()

ResetSort resets all changes to the "sort" field.

func (*DictDataMutation) ResetStatus

func (m *DictDataMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*DictDataMutation) ResetUpdatedAt

func (m *DictDataMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DictDataMutation) ResetUpdatedBy

func (m *DictDataMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*DictDataMutation) ResetValue

func (m *DictDataMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*DictDataMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DictDataMutation) SetCreatedBy

func (m *DictDataMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*DictDataMutation) SetDictTypeID

func (m *DictDataMutation) SetDictTypeID(i int64)

SetDictTypeID sets the "dict_type_id" field.

func (*DictDataMutation) SetField

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

func (m *DictDataMutation) SetID(id int64)

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

func (*DictDataMutation) SetIsDefault

func (m *DictDataMutation) SetIsDefault(i int8)

SetIsDefault sets the "is_default" field.

func (*DictDataMutation) SetLabel

func (m *DictDataMutation) SetLabel(s string)

SetLabel sets the "label" field.

func (*DictDataMutation) SetRemark

func (m *DictDataMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*DictDataMutation) SetSort

func (m *DictDataMutation) SetSort(i int8)

SetSort sets the "sort" field.

func (*DictDataMutation) SetStatus

func (m *DictDataMutation) SetStatus(i int8)

SetStatus sets the "status" field.

func (*DictDataMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DictDataMutation) SetUpdatedBy

func (m *DictDataMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*DictDataMutation) SetValue

func (m *DictDataMutation) SetValue(s string)

SetValue sets the "value" field.

func (*DictDataMutation) Sort

func (m *DictDataMutation) Sort() (r int8, exists bool)

Sort returns the value of the "sort" field in the mutation.

func (*DictDataMutation) Status

func (m *DictDataMutation) Status() (r int8, exists bool)

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

func (DictDataMutation) Tx

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

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

func (*DictDataMutation) Type

func (m *DictDataMutation) Type() string

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

func (*DictDataMutation) UpdatedAt

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

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

func (*DictDataMutation) UpdatedBy

func (m *DictDataMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*DictDataMutation) Value

func (m *DictDataMutation) Value() (r string, exists bool)

Value returns the value of the "value" field in the mutation.

func (*DictDataMutation) Where

func (m *DictDataMutation) Where(ps ...predicate.DictData)

Where appends a list predicates to the DictDataMutation builder.

type DictDataQuery

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

DictDataQuery is the builder for querying DictData entities.

func (*DictDataQuery) All

func (ddq *DictDataQuery) All(ctx context.Context) ([]*DictData, error)

All executes the query and returns a list of DictDataSlice.

func (*DictDataQuery) AllX

func (ddq *DictDataQuery) AllX(ctx context.Context) []*DictData

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

func (*DictDataQuery) Clone

func (ddq *DictDataQuery) Clone() *DictDataQuery

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

func (*DictDataQuery) Count

func (ddq *DictDataQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DictDataQuery) CountX

func (ddq *DictDataQuery) CountX(ctx context.Context) int

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

func (*DictDataQuery) Exist

func (ddq *DictDataQuery) Exist(ctx context.Context) (bool, error)

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

func (*DictDataQuery) ExistX

func (ddq *DictDataQuery) ExistX(ctx context.Context) bool

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

func (*DictDataQuery) First

func (ddq *DictDataQuery) First(ctx context.Context) (*DictData, error)

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

func (*DictDataQuery) FirstID

func (ddq *DictDataQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*DictDataQuery) FirstIDX

func (ddq *DictDataQuery) FirstIDX(ctx context.Context) int64

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

func (*DictDataQuery) FirstX

func (ddq *DictDataQuery) FirstX(ctx context.Context) *DictData

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

func (*DictDataQuery) GroupBy

func (ddq *DictDataQuery) GroupBy(field string, fields ...string) *DictDataGroupBy

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

Example:

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

client.DictData.Query().
	GroupBy(dictdata.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DictDataQuery) IDs

func (ddq *DictDataQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*DictDataQuery) IDsX

func (ddq *DictDataQuery) IDsX(ctx context.Context) []int64

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

func (*DictDataQuery) Limit

func (ddq *DictDataQuery) Limit(limit int) *DictDataQuery

Limit adds a limit step to the query.

func (*DictDataQuery) Offset

func (ddq *DictDataQuery) Offset(offset int) *DictDataQuery

Offset adds an offset step to the query.

func (*DictDataQuery) Only

func (ddq *DictDataQuery) Only(ctx context.Context) (*DictData, error)

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

func (*DictDataQuery) OnlyID

func (ddq *DictDataQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*DictDataQuery) OnlyIDX

func (ddq *DictDataQuery) OnlyIDX(ctx context.Context) int64

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

func (*DictDataQuery) OnlyX

func (ddq *DictDataQuery) OnlyX(ctx context.Context) *DictData

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

func (*DictDataQuery) Order

func (ddq *DictDataQuery) Order(o ...OrderFunc) *DictDataQuery

Order adds an order step to the query.

func (*DictDataQuery) Select

func (ddq *DictDataQuery) Select(fields ...string) *DictDataSelect

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

Example:

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

client.DictData.Query().
	Select(dictdata.FieldCreatedAt).
	Scan(ctx, &v)

func (*DictDataQuery) Unique

func (ddq *DictDataQuery) Unique(unique bool) *DictDataQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*DictDataQuery) Where

func (ddq *DictDataQuery) Where(ps ...predicate.DictData) *DictDataQuery

Where adds a new predicate for the DictDataQuery builder.

type DictDataSelect

type DictDataSelect struct {
	*DictDataQuery
	// contains filtered or unexported fields
}

DictDataSelect is the builder for selecting fields of DictData entities.

func (*DictDataSelect) Bool

func (dds *DictDataSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*DictDataSelect) BoolX

func (dds *DictDataSelect) BoolX(ctx context.Context) bool

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

func (*DictDataSelect) Bools

func (dds *DictDataSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*DictDataSelect) BoolsX

func (dds *DictDataSelect) BoolsX(ctx context.Context) []bool

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

func (*DictDataSelect) Float64

func (dds *DictDataSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*DictDataSelect) Float64X

func (dds *DictDataSelect) Float64X(ctx context.Context) float64

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

func (*DictDataSelect) Float64s

func (dds *DictDataSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*DictDataSelect) Float64sX

func (dds *DictDataSelect) Float64sX(ctx context.Context) []float64

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

func (*DictDataSelect) Int

func (dds *DictDataSelect) Int(ctx context.Context) (_ int, err error)

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

func (*DictDataSelect) IntX

func (dds *DictDataSelect) IntX(ctx context.Context) int

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

func (*DictDataSelect) Ints

func (dds *DictDataSelect) Ints(ctx context.Context) ([]int, error)

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

func (*DictDataSelect) IntsX

func (dds *DictDataSelect) IntsX(ctx context.Context) []int

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

func (*DictDataSelect) Scan

func (dds *DictDataSelect) Scan(ctx context.Context, v interface{}) error

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

func (*DictDataSelect) ScanX

func (dds *DictDataSelect) ScanX(ctx context.Context, v interface{})

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

func (*DictDataSelect) String

func (dds *DictDataSelect) String(ctx context.Context) (_ string, err error)

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

func (*DictDataSelect) StringX

func (dds *DictDataSelect) StringX(ctx context.Context) string

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

func (*DictDataSelect) Strings

func (dds *DictDataSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DictDataSelect) StringsX

func (dds *DictDataSelect) StringsX(ctx context.Context) []string

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

type DictDataSlice

type DictDataSlice []*DictData

DictDataSlice is a parsable slice of DictData.

type DictDataUpdate

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

DictDataUpdate is the builder for updating DictData entities.

func (*DictDataUpdate) AddCreatedBy

func (ddu *DictDataUpdate) AddCreatedBy(i int64) *DictDataUpdate

AddCreatedBy adds i to the "created_by" field.

func (*DictDataUpdate) AddDictTypeID

func (ddu *DictDataUpdate) AddDictTypeID(i int64) *DictDataUpdate

AddDictTypeID adds i to the "dict_type_id" field.

func (*DictDataUpdate) AddIsDefault

func (ddu *DictDataUpdate) AddIsDefault(i int8) *DictDataUpdate

AddIsDefault adds i to the "is_default" field.

func (*DictDataUpdate) AddSort

func (ddu *DictDataUpdate) AddSort(i int8) *DictDataUpdate

AddSort adds i to the "sort" field.

func (*DictDataUpdate) AddStatus

func (ddu *DictDataUpdate) AddStatus(i int8) *DictDataUpdate

AddStatus adds i to the "status" field.

func (*DictDataUpdate) AddUpdatedBy

func (ddu *DictDataUpdate) AddUpdatedBy(i int64) *DictDataUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*DictDataUpdate) Exec

func (ddu *DictDataUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DictDataUpdate) ExecX

func (ddu *DictDataUpdate) ExecX(ctx context.Context)

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

func (*DictDataUpdate) Mutation

func (ddu *DictDataUpdate) Mutation() *DictDataMutation

Mutation returns the DictDataMutation object of the builder.

func (*DictDataUpdate) Save

func (ddu *DictDataUpdate) Save(ctx context.Context) (int, error)

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

func (*DictDataUpdate) SaveX

func (ddu *DictDataUpdate) SaveX(ctx context.Context) int

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

func (*DictDataUpdate) SetCreatedAt

func (ddu *DictDataUpdate) SetCreatedAt(t time.Time) *DictDataUpdate

SetCreatedAt sets the "created_at" field.

func (*DictDataUpdate) SetCreatedBy

func (ddu *DictDataUpdate) SetCreatedBy(i int64) *DictDataUpdate

SetCreatedBy sets the "created_by" field.

func (*DictDataUpdate) SetDictTypeID

func (ddu *DictDataUpdate) SetDictTypeID(i int64) *DictDataUpdate

SetDictTypeID sets the "dict_type_id" field.

func (*DictDataUpdate) SetIsDefault

func (ddu *DictDataUpdate) SetIsDefault(i int8) *DictDataUpdate

SetIsDefault sets the "is_default" field.

func (*DictDataUpdate) SetLabel

func (ddu *DictDataUpdate) SetLabel(s string) *DictDataUpdate

SetLabel sets the "label" field.

func (*DictDataUpdate) SetNillableCreatedAt

func (ddu *DictDataUpdate) SetNillableCreatedAt(t *time.Time) *DictDataUpdate

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

func (*DictDataUpdate) SetNillableCreatedBy

func (ddu *DictDataUpdate) SetNillableCreatedBy(i *int64) *DictDataUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictDataUpdate) SetNillableDictTypeID

func (ddu *DictDataUpdate) SetNillableDictTypeID(i *int64) *DictDataUpdate

SetNillableDictTypeID sets the "dict_type_id" field if the given value is not nil.

func (*DictDataUpdate) SetNillableIsDefault

func (ddu *DictDataUpdate) SetNillableIsDefault(i *int8) *DictDataUpdate

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*DictDataUpdate) SetNillableLabel

func (ddu *DictDataUpdate) SetNillableLabel(s *string) *DictDataUpdate

SetNillableLabel sets the "label" field if the given value is not nil.

func (*DictDataUpdate) SetNillableRemark

func (ddu *DictDataUpdate) SetNillableRemark(s *string) *DictDataUpdate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictDataUpdate) SetNillableSort

func (ddu *DictDataUpdate) SetNillableSort(i *int8) *DictDataUpdate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*DictDataUpdate) SetNillableStatus

func (ddu *DictDataUpdate) SetNillableStatus(i *int8) *DictDataUpdate

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

func (*DictDataUpdate) SetNillableUpdatedBy

func (ddu *DictDataUpdate) SetNillableUpdatedBy(i *int64) *DictDataUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictDataUpdate) SetNillableValue

func (ddu *DictDataUpdate) SetNillableValue(s *string) *DictDataUpdate

SetNillableValue sets the "value" field if the given value is not nil.

func (*DictDataUpdate) SetRemark

func (ddu *DictDataUpdate) SetRemark(s string) *DictDataUpdate

SetRemark sets the "remark" field.

func (*DictDataUpdate) SetSort

func (ddu *DictDataUpdate) SetSort(i int8) *DictDataUpdate

SetSort sets the "sort" field.

func (*DictDataUpdate) SetStatus

func (ddu *DictDataUpdate) SetStatus(i int8) *DictDataUpdate

SetStatus sets the "status" field.

func (*DictDataUpdate) SetUpdatedAt

func (ddu *DictDataUpdate) SetUpdatedAt(t time.Time) *DictDataUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DictDataUpdate) SetUpdatedBy

func (ddu *DictDataUpdate) SetUpdatedBy(i int64) *DictDataUpdate

SetUpdatedBy sets the "updated_by" field.

func (*DictDataUpdate) SetValue

func (ddu *DictDataUpdate) SetValue(s string) *DictDataUpdate

SetValue sets the "value" field.

func (*DictDataUpdate) Where

func (ddu *DictDataUpdate) Where(ps ...predicate.DictData) *DictDataUpdate

Where appends a list predicates to the DictDataUpdate builder.

type DictDataUpdateOne

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

DictDataUpdateOne is the builder for updating a single DictData entity.

func (*DictDataUpdateOne) AddCreatedBy

func (dduo *DictDataUpdateOne) AddCreatedBy(i int64) *DictDataUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*DictDataUpdateOne) AddDictTypeID

func (dduo *DictDataUpdateOne) AddDictTypeID(i int64) *DictDataUpdateOne

AddDictTypeID adds i to the "dict_type_id" field.

func (*DictDataUpdateOne) AddIsDefault

func (dduo *DictDataUpdateOne) AddIsDefault(i int8) *DictDataUpdateOne

AddIsDefault adds i to the "is_default" field.

func (*DictDataUpdateOne) AddSort

func (dduo *DictDataUpdateOne) AddSort(i int8) *DictDataUpdateOne

AddSort adds i to the "sort" field.

func (*DictDataUpdateOne) AddStatus

func (dduo *DictDataUpdateOne) AddStatus(i int8) *DictDataUpdateOne

AddStatus adds i to the "status" field.

func (*DictDataUpdateOne) AddUpdatedBy

func (dduo *DictDataUpdateOne) AddUpdatedBy(i int64) *DictDataUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*DictDataUpdateOne) Exec

func (dduo *DictDataUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DictDataUpdateOne) ExecX

func (dduo *DictDataUpdateOne) ExecX(ctx context.Context)

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

func (*DictDataUpdateOne) Mutation

func (dduo *DictDataUpdateOne) Mutation() *DictDataMutation

Mutation returns the DictDataMutation object of the builder.

func (*DictDataUpdateOne) Save

func (dduo *DictDataUpdateOne) Save(ctx context.Context) (*DictData, error)

Save executes the query and returns the updated DictData entity.

func (*DictDataUpdateOne) SaveX

func (dduo *DictDataUpdateOne) SaveX(ctx context.Context) *DictData

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

func (*DictDataUpdateOne) Select

func (dduo *DictDataUpdateOne) Select(field string, fields ...string) *DictDataUpdateOne

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

func (*DictDataUpdateOne) SetCreatedAt

func (dduo *DictDataUpdateOne) SetCreatedAt(t time.Time) *DictDataUpdateOne

SetCreatedAt sets the "created_at" field.

func (*DictDataUpdateOne) SetCreatedBy

func (dduo *DictDataUpdateOne) SetCreatedBy(i int64) *DictDataUpdateOne

SetCreatedBy sets the "created_by" field.

func (*DictDataUpdateOne) SetDictTypeID

func (dduo *DictDataUpdateOne) SetDictTypeID(i int64) *DictDataUpdateOne

SetDictTypeID sets the "dict_type_id" field.

func (*DictDataUpdateOne) SetIsDefault

func (dduo *DictDataUpdateOne) SetIsDefault(i int8) *DictDataUpdateOne

SetIsDefault sets the "is_default" field.

func (*DictDataUpdateOne) SetLabel

func (dduo *DictDataUpdateOne) SetLabel(s string) *DictDataUpdateOne

SetLabel sets the "label" field.

func (*DictDataUpdateOne) SetNillableCreatedAt

func (dduo *DictDataUpdateOne) SetNillableCreatedAt(t *time.Time) *DictDataUpdateOne

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

func (*DictDataUpdateOne) SetNillableCreatedBy

func (dduo *DictDataUpdateOne) SetNillableCreatedBy(i *int64) *DictDataUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableDictTypeID

func (dduo *DictDataUpdateOne) SetNillableDictTypeID(i *int64) *DictDataUpdateOne

SetNillableDictTypeID sets the "dict_type_id" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableIsDefault

func (dduo *DictDataUpdateOne) SetNillableIsDefault(i *int8) *DictDataUpdateOne

SetNillableIsDefault sets the "is_default" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableLabel

func (dduo *DictDataUpdateOne) SetNillableLabel(s *string) *DictDataUpdateOne

SetNillableLabel sets the "label" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableRemark

func (dduo *DictDataUpdateOne) SetNillableRemark(s *string) *DictDataUpdateOne

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableSort

func (dduo *DictDataUpdateOne) SetNillableSort(i *int8) *DictDataUpdateOne

SetNillableSort sets the "sort" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableStatus

func (dduo *DictDataUpdateOne) SetNillableStatus(i *int8) *DictDataUpdateOne

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

func (*DictDataUpdateOne) SetNillableUpdatedBy

func (dduo *DictDataUpdateOne) SetNillableUpdatedBy(i *int64) *DictDataUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictDataUpdateOne) SetNillableValue

func (dduo *DictDataUpdateOne) SetNillableValue(s *string) *DictDataUpdateOne

SetNillableValue sets the "value" field if the given value is not nil.

func (*DictDataUpdateOne) SetRemark

func (dduo *DictDataUpdateOne) SetRemark(s string) *DictDataUpdateOne

SetRemark sets the "remark" field.

func (*DictDataUpdateOne) SetSort

func (dduo *DictDataUpdateOne) SetSort(i int8) *DictDataUpdateOne

SetSort sets the "sort" field.

func (*DictDataUpdateOne) SetStatus

func (dduo *DictDataUpdateOne) SetStatus(i int8) *DictDataUpdateOne

SetStatus sets the "status" field.

func (*DictDataUpdateOne) SetUpdatedAt

func (dduo *DictDataUpdateOne) SetUpdatedAt(t time.Time) *DictDataUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DictDataUpdateOne) SetUpdatedBy

func (dduo *DictDataUpdateOne) SetUpdatedBy(i int64) *DictDataUpdateOne

SetUpdatedBy sets the "updated_by" field.

func (*DictDataUpdateOne) SetValue

func (dduo *DictDataUpdateOne) SetValue(s string) *DictDataUpdateOne

SetValue sets the "value" field.

type DictType

type DictType struct {

	// ID of the ent.
	// 字典类型id
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// Name holds the value of the "name" field.
	// 字典名称
	Name string `json:"name,omitempty"`
	// Type holds the value of the "type" field.
	// 字典类型
	Type string `json:"type,omitempty"`
	// Status holds the value of the "status" field.
	// 状态 0:禁用 1:启用
	Status int8 `json:"status,omitempty"`
	// Remark holds the value of the "remark" field.
	// 备注
	Remark string `json:"remark,omitempty"`
	// contains filtered or unexported fields
}

DictType is the model entity for the DictType schema.

func (*DictType) String

func (dt *DictType) String() string

String implements the fmt.Stringer.

func (*DictType) Unwrap

func (dt *DictType) Unwrap() *DictType

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

func (dt *DictType) Update() *DictTypeUpdateOne

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

type DictTypeClient

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

DictTypeClient is a client for the DictType schema.

func NewDictTypeClient

func NewDictTypeClient(c config) *DictTypeClient

NewDictTypeClient returns a client for the DictType from the given config.

func (*DictTypeClient) Create

func (c *DictTypeClient) Create() *DictTypeCreate

Create returns a create builder for DictType.

func (*DictTypeClient) CreateBulk

func (c *DictTypeClient) CreateBulk(builders ...*DictTypeCreate) *DictTypeCreateBulk

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

func (*DictTypeClient) Delete

func (c *DictTypeClient) Delete() *DictTypeDelete

Delete returns a delete builder for DictType.

func (*DictTypeClient) DeleteOne

func (c *DictTypeClient) DeleteOne(dt *DictType) *DictTypeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*DictTypeClient) DeleteOneID

func (c *DictTypeClient) DeleteOneID(id int64) *DictTypeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*DictTypeClient) Get

func (c *DictTypeClient) Get(ctx context.Context, id int64) (*DictType, error)

Get returns a DictType entity by its id.

func (*DictTypeClient) GetX

func (c *DictTypeClient) GetX(ctx context.Context, id int64) *DictType

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

func (*DictTypeClient) Hooks

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

Hooks returns the client hooks.

func (*DictTypeClient) Query

func (c *DictTypeClient) Query() *DictTypeQuery

Query returns a query builder for DictType.

func (*DictTypeClient) Update

func (c *DictTypeClient) Update() *DictTypeUpdate

Update returns an update builder for DictType.

func (*DictTypeClient) UpdateOne

func (c *DictTypeClient) UpdateOne(dt *DictType) *DictTypeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DictTypeClient) UpdateOneID

func (c *DictTypeClient) UpdateOneID(id int64) *DictTypeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DictTypeClient) Use

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

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

type DictTypeCreate

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

DictTypeCreate is the builder for creating a DictType entity.

func (*DictTypeCreate) Exec

func (dtc *DictTypeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DictTypeCreate) ExecX

func (dtc *DictTypeCreate) ExecX(ctx context.Context)

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

func (*DictTypeCreate) Mutation

func (dtc *DictTypeCreate) Mutation() *DictTypeMutation

Mutation returns the DictTypeMutation object of the builder.

func (*DictTypeCreate) Save

func (dtc *DictTypeCreate) Save(ctx context.Context) (*DictType, error)

Save creates the DictType in the database.

func (*DictTypeCreate) SaveX

func (dtc *DictTypeCreate) SaveX(ctx context.Context) *DictType

SaveX calls Save and panics if Save returns an error.

func (*DictTypeCreate) SetCreatedAt

func (dtc *DictTypeCreate) SetCreatedAt(t time.Time) *DictTypeCreate

SetCreatedAt sets the "created_at" field.

func (*DictTypeCreate) SetCreatedBy

func (dtc *DictTypeCreate) SetCreatedBy(i int64) *DictTypeCreate

SetCreatedBy sets the "created_by" field.

func (*DictTypeCreate) SetID

func (dtc *DictTypeCreate) SetID(i int64) *DictTypeCreate

SetID sets the "id" field.

func (*DictTypeCreate) SetName

func (dtc *DictTypeCreate) SetName(s string) *DictTypeCreate

SetName sets the "name" field.

func (*DictTypeCreate) SetNillableCreatedAt

func (dtc *DictTypeCreate) SetNillableCreatedAt(t *time.Time) *DictTypeCreate

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

func (*DictTypeCreate) SetNillableCreatedBy

func (dtc *DictTypeCreate) SetNillableCreatedBy(i *int64) *DictTypeCreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictTypeCreate) SetNillableName

func (dtc *DictTypeCreate) SetNillableName(s *string) *DictTypeCreate

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

func (*DictTypeCreate) SetNillableRemark

func (dtc *DictTypeCreate) SetNillableRemark(s *string) *DictTypeCreate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictTypeCreate) SetNillableStatus

func (dtc *DictTypeCreate) SetNillableStatus(i *int8) *DictTypeCreate

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

func (*DictTypeCreate) SetNillableType

func (dtc *DictTypeCreate) SetNillableType(s *string) *DictTypeCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*DictTypeCreate) SetNillableUpdatedAt

func (dtc *DictTypeCreate) SetNillableUpdatedAt(t *time.Time) *DictTypeCreate

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

func (*DictTypeCreate) SetNillableUpdatedBy

func (dtc *DictTypeCreate) SetNillableUpdatedBy(i *int64) *DictTypeCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictTypeCreate) SetRemark

func (dtc *DictTypeCreate) SetRemark(s string) *DictTypeCreate

SetRemark sets the "remark" field.

func (*DictTypeCreate) SetStatus

func (dtc *DictTypeCreate) SetStatus(i int8) *DictTypeCreate

SetStatus sets the "status" field.

func (*DictTypeCreate) SetType

func (dtc *DictTypeCreate) SetType(s string) *DictTypeCreate

SetType sets the "type" field.

func (*DictTypeCreate) SetUpdatedAt

func (dtc *DictTypeCreate) SetUpdatedAt(t time.Time) *DictTypeCreate

SetUpdatedAt sets the "updated_at" field.

func (*DictTypeCreate) SetUpdatedBy

func (dtc *DictTypeCreate) SetUpdatedBy(i int64) *DictTypeCreate

SetUpdatedBy sets the "updated_by" field.

type DictTypeCreateBulk

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

DictTypeCreateBulk is the builder for creating many DictType entities in bulk.

func (*DictTypeCreateBulk) Exec

func (dtcb *DictTypeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DictTypeCreateBulk) ExecX

func (dtcb *DictTypeCreateBulk) ExecX(ctx context.Context)

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

func (*DictTypeCreateBulk) Save

func (dtcb *DictTypeCreateBulk) Save(ctx context.Context) ([]*DictType, error)

Save creates the DictType entities in the database.

func (*DictTypeCreateBulk) SaveX

func (dtcb *DictTypeCreateBulk) SaveX(ctx context.Context) []*DictType

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

type DictTypeDelete

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

DictTypeDelete is the builder for deleting a DictType entity.

func (*DictTypeDelete) Exec

func (dtd *DictTypeDelete) Exec(ctx context.Context) (int, error)

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

func (*DictTypeDelete) ExecX

func (dtd *DictTypeDelete) ExecX(ctx context.Context) int

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

func (*DictTypeDelete) Where

func (dtd *DictTypeDelete) Where(ps ...predicate.DictType) *DictTypeDelete

Where appends a list predicates to the DictTypeDelete builder.

type DictTypeDeleteOne

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

DictTypeDeleteOne is the builder for deleting a single DictType entity.

func (*DictTypeDeleteOne) Exec

func (dtdo *DictTypeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DictTypeDeleteOne) ExecX

func (dtdo *DictTypeDeleteOne) ExecX(ctx context.Context)

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

type DictTypeGroupBy

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

DictTypeGroupBy is the group-by builder for DictType entities.

func (*DictTypeGroupBy) Aggregate

func (dtgb *DictTypeGroupBy) Aggregate(fns ...AggregateFunc) *DictTypeGroupBy

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

func (*DictTypeGroupBy) Bool

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) BoolX

func (dtgb *DictTypeGroupBy) BoolX(ctx context.Context) bool

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

func (*DictTypeGroupBy) Bools

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) BoolsX

func (dtgb *DictTypeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*DictTypeGroupBy) Float64

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) Float64X

func (dtgb *DictTypeGroupBy) Float64X(ctx context.Context) float64

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

func (*DictTypeGroupBy) Float64s

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) Float64sX

func (dtgb *DictTypeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*DictTypeGroupBy) Int

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) IntX

func (dtgb *DictTypeGroupBy) IntX(ctx context.Context) int

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

func (*DictTypeGroupBy) Ints

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) IntsX

func (dtgb *DictTypeGroupBy) IntsX(ctx context.Context) []int

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

func (*DictTypeGroupBy) Scan

func (dtgb *DictTypeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*DictTypeGroupBy) ScanX

func (dtgb *DictTypeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*DictTypeGroupBy) String

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) StringX

func (dtgb *DictTypeGroupBy) StringX(ctx context.Context) string

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

func (*DictTypeGroupBy) Strings

func (dtgb *DictTypeGroupBy) 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 (*DictTypeGroupBy) StringsX

func (dtgb *DictTypeGroupBy) StringsX(ctx context.Context) []string

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

type DictTypeMutation

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

DictTypeMutation represents an operation that mutates the DictType nodes in the graph.

func (*DictTypeMutation) AddCreatedBy

func (m *DictTypeMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*DictTypeMutation) AddField

func (m *DictTypeMutation) 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 (*DictTypeMutation) AddStatus

func (m *DictTypeMutation) AddStatus(i int8)

AddStatus adds i to the "status" field.

func (*DictTypeMutation) AddUpdatedBy

func (m *DictTypeMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*DictTypeMutation) AddedCreatedBy

func (m *DictTypeMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*DictTypeMutation) AddedEdges

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

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

func (*DictTypeMutation) AddedField

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

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

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

func (*DictTypeMutation) AddedIDs

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

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

func (*DictTypeMutation) AddedStatus

func (m *DictTypeMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the "status" field in this mutation.

func (*DictTypeMutation) AddedUpdatedBy

func (m *DictTypeMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*DictTypeMutation) ClearEdge

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

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

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

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

func (*DictTypeMutation) ClearedFields

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

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

func (DictTypeMutation) Client

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

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

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

func (*DictTypeMutation) CreatedBy

func (m *DictTypeMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*DictTypeMutation) EdgeCleared

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

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

func (*DictTypeMutation) Field

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

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

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

func (*DictTypeMutation) Fields

func (m *DictTypeMutation) 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 (*DictTypeMutation) GetType

func (m *DictTypeMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*DictTypeMutation) ID

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

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

func (*DictTypeMutation) IDs

func (m *DictTypeMutation) IDs(ctx context.Context) ([]int64, error)

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

func (*DictTypeMutation) Name

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

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

func (*DictTypeMutation) OldCreatedAt

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

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

func (m *DictTypeMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" field's value of the DictType entity. If the DictType 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 (*DictTypeMutation) OldField

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

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

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

func (m *DictTypeMutation) OldRemark(ctx context.Context) (v string, err error)

OldRemark returns the old "remark" field's value of the DictType entity. If the DictType 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 (*DictTypeMutation) OldStatus

func (m *DictTypeMutation) OldStatus(ctx context.Context) (v int8, err error)

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

func (m *DictTypeMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the DictType entity. If the DictType 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 (*DictTypeMutation) OldUpdatedAt

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

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

func (m *DictTypeMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the DictType entity. If the DictType 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 (*DictTypeMutation) Op

func (m *DictTypeMutation) Op() Op

Op returns the operation name.

func (*DictTypeMutation) Remark

func (m *DictTypeMutation) Remark() (r string, exists bool)

Remark returns the value of the "remark" field in the mutation.

func (*DictTypeMutation) RemovedEdges

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

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

func (*DictTypeMutation) RemovedIDs

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

func (m *DictTypeMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DictTypeMutation) ResetCreatedBy

func (m *DictTypeMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*DictTypeMutation) ResetEdge

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

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

func (m *DictTypeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*DictTypeMutation) ResetRemark

func (m *DictTypeMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*DictTypeMutation) ResetStatus

func (m *DictTypeMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*DictTypeMutation) ResetType

func (m *DictTypeMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*DictTypeMutation) ResetUpdatedAt

func (m *DictTypeMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DictTypeMutation) ResetUpdatedBy

func (m *DictTypeMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*DictTypeMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DictTypeMutation) SetCreatedBy

func (m *DictTypeMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*DictTypeMutation) SetField

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

func (m *DictTypeMutation) SetID(id int64)

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

func (*DictTypeMutation) SetName

func (m *DictTypeMutation) SetName(s string)

SetName sets the "name" field.

func (*DictTypeMutation) SetRemark

func (m *DictTypeMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*DictTypeMutation) SetStatus

func (m *DictTypeMutation) SetStatus(i int8)

SetStatus sets the "status" field.

func (*DictTypeMutation) SetType

func (m *DictTypeMutation) SetType(s string)

SetType sets the "type" field.

func (*DictTypeMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DictTypeMutation) SetUpdatedBy

func (m *DictTypeMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*DictTypeMutation) Status

func (m *DictTypeMutation) Status() (r int8, exists bool)

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

func (DictTypeMutation) Tx

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

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

func (*DictTypeMutation) Type

func (m *DictTypeMutation) Type() string

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

func (*DictTypeMutation) UpdatedAt

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

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

func (*DictTypeMutation) UpdatedBy

func (m *DictTypeMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*DictTypeMutation) Where

func (m *DictTypeMutation) Where(ps ...predicate.DictType)

Where appends a list predicates to the DictTypeMutation builder.

type DictTypeQuery

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

DictTypeQuery is the builder for querying DictType entities.

func (*DictTypeQuery) All

func (dtq *DictTypeQuery) All(ctx context.Context) ([]*DictType, error)

All executes the query and returns a list of DictTypes.

func (*DictTypeQuery) AllX

func (dtq *DictTypeQuery) AllX(ctx context.Context) []*DictType

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

func (*DictTypeQuery) Clone

func (dtq *DictTypeQuery) Clone() *DictTypeQuery

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

func (*DictTypeQuery) Count

func (dtq *DictTypeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DictTypeQuery) CountX

func (dtq *DictTypeQuery) CountX(ctx context.Context) int

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

func (*DictTypeQuery) Exist

func (dtq *DictTypeQuery) Exist(ctx context.Context) (bool, error)

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

func (*DictTypeQuery) ExistX

func (dtq *DictTypeQuery) ExistX(ctx context.Context) bool

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

func (*DictTypeQuery) First

func (dtq *DictTypeQuery) First(ctx context.Context) (*DictType, error)

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

func (*DictTypeQuery) FirstID

func (dtq *DictTypeQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*DictTypeQuery) FirstIDX

func (dtq *DictTypeQuery) FirstIDX(ctx context.Context) int64

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

func (*DictTypeQuery) FirstX

func (dtq *DictTypeQuery) FirstX(ctx context.Context) *DictType

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

func (*DictTypeQuery) GroupBy

func (dtq *DictTypeQuery) GroupBy(field string, fields ...string) *DictTypeGroupBy

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

Example:

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

client.DictType.Query().
	GroupBy(dicttype.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DictTypeQuery) IDs

func (dtq *DictTypeQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*DictTypeQuery) IDsX

func (dtq *DictTypeQuery) IDsX(ctx context.Context) []int64

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

func (*DictTypeQuery) Limit

func (dtq *DictTypeQuery) Limit(limit int) *DictTypeQuery

Limit adds a limit step to the query.

func (*DictTypeQuery) Offset

func (dtq *DictTypeQuery) Offset(offset int) *DictTypeQuery

Offset adds an offset step to the query.

func (*DictTypeQuery) Only

func (dtq *DictTypeQuery) Only(ctx context.Context) (*DictType, error)

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

func (*DictTypeQuery) OnlyID

func (dtq *DictTypeQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*DictTypeQuery) OnlyIDX

func (dtq *DictTypeQuery) OnlyIDX(ctx context.Context) int64

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

func (*DictTypeQuery) OnlyX

func (dtq *DictTypeQuery) OnlyX(ctx context.Context) *DictType

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

func (*DictTypeQuery) Order

func (dtq *DictTypeQuery) Order(o ...OrderFunc) *DictTypeQuery

Order adds an order step to the query.

func (*DictTypeQuery) Select

func (dtq *DictTypeQuery) Select(fields ...string) *DictTypeSelect

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

Example:

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

client.DictType.Query().
	Select(dicttype.FieldCreatedAt).
	Scan(ctx, &v)

func (*DictTypeQuery) Unique

func (dtq *DictTypeQuery) Unique(unique bool) *DictTypeQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*DictTypeQuery) Where

func (dtq *DictTypeQuery) Where(ps ...predicate.DictType) *DictTypeQuery

Where adds a new predicate for the DictTypeQuery builder.

type DictTypeSelect

type DictTypeSelect struct {
	*DictTypeQuery
	// contains filtered or unexported fields
}

DictTypeSelect is the builder for selecting fields of DictType entities.

func (*DictTypeSelect) Bool

func (dts *DictTypeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*DictTypeSelect) BoolX

func (dts *DictTypeSelect) BoolX(ctx context.Context) bool

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

func (*DictTypeSelect) Bools

func (dts *DictTypeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*DictTypeSelect) BoolsX

func (dts *DictTypeSelect) BoolsX(ctx context.Context) []bool

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

func (*DictTypeSelect) Float64

func (dts *DictTypeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*DictTypeSelect) Float64X

func (dts *DictTypeSelect) Float64X(ctx context.Context) float64

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

func (*DictTypeSelect) Float64s

func (dts *DictTypeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*DictTypeSelect) Float64sX

func (dts *DictTypeSelect) Float64sX(ctx context.Context) []float64

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

func (*DictTypeSelect) Int

func (dts *DictTypeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*DictTypeSelect) IntX

func (dts *DictTypeSelect) IntX(ctx context.Context) int

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

func (*DictTypeSelect) Ints

func (dts *DictTypeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*DictTypeSelect) IntsX

func (dts *DictTypeSelect) IntsX(ctx context.Context) []int

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

func (*DictTypeSelect) Scan

func (dts *DictTypeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*DictTypeSelect) ScanX

func (dts *DictTypeSelect) ScanX(ctx context.Context, v interface{})

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

func (*DictTypeSelect) String

func (dts *DictTypeSelect) String(ctx context.Context) (_ string, err error)

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

func (*DictTypeSelect) StringX

func (dts *DictTypeSelect) StringX(ctx context.Context) string

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

func (*DictTypeSelect) Strings

func (dts *DictTypeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DictTypeSelect) StringsX

func (dts *DictTypeSelect) StringsX(ctx context.Context) []string

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

type DictTypeUpdate

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

DictTypeUpdate is the builder for updating DictType entities.

func (*DictTypeUpdate) AddCreatedBy

func (dtu *DictTypeUpdate) AddCreatedBy(i int64) *DictTypeUpdate

AddCreatedBy adds i to the "created_by" field.

func (*DictTypeUpdate) AddStatus

func (dtu *DictTypeUpdate) AddStatus(i int8) *DictTypeUpdate

AddStatus adds i to the "status" field.

func (*DictTypeUpdate) AddUpdatedBy

func (dtu *DictTypeUpdate) AddUpdatedBy(i int64) *DictTypeUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*DictTypeUpdate) Exec

func (dtu *DictTypeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DictTypeUpdate) ExecX

func (dtu *DictTypeUpdate) ExecX(ctx context.Context)

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

func (*DictTypeUpdate) Mutation

func (dtu *DictTypeUpdate) Mutation() *DictTypeMutation

Mutation returns the DictTypeMutation object of the builder.

func (*DictTypeUpdate) Save

func (dtu *DictTypeUpdate) Save(ctx context.Context) (int, error)

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

func (*DictTypeUpdate) SaveX

func (dtu *DictTypeUpdate) SaveX(ctx context.Context) int

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

func (*DictTypeUpdate) SetCreatedAt

func (dtu *DictTypeUpdate) SetCreatedAt(t time.Time) *DictTypeUpdate

SetCreatedAt sets the "created_at" field.

func (*DictTypeUpdate) SetCreatedBy

func (dtu *DictTypeUpdate) SetCreatedBy(i int64) *DictTypeUpdate

SetCreatedBy sets the "created_by" field.

func (*DictTypeUpdate) SetName

func (dtu *DictTypeUpdate) SetName(s string) *DictTypeUpdate

SetName sets the "name" field.

func (*DictTypeUpdate) SetNillableCreatedAt

func (dtu *DictTypeUpdate) SetNillableCreatedAt(t *time.Time) *DictTypeUpdate

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

func (*DictTypeUpdate) SetNillableCreatedBy

func (dtu *DictTypeUpdate) SetNillableCreatedBy(i *int64) *DictTypeUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictTypeUpdate) SetNillableName

func (dtu *DictTypeUpdate) SetNillableName(s *string) *DictTypeUpdate

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

func (*DictTypeUpdate) SetNillableRemark

func (dtu *DictTypeUpdate) SetNillableRemark(s *string) *DictTypeUpdate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictTypeUpdate) SetNillableStatus

func (dtu *DictTypeUpdate) SetNillableStatus(i *int8) *DictTypeUpdate

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

func (*DictTypeUpdate) SetNillableType

func (dtu *DictTypeUpdate) SetNillableType(s *string) *DictTypeUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*DictTypeUpdate) SetNillableUpdatedBy

func (dtu *DictTypeUpdate) SetNillableUpdatedBy(i *int64) *DictTypeUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictTypeUpdate) SetRemark

func (dtu *DictTypeUpdate) SetRemark(s string) *DictTypeUpdate

SetRemark sets the "remark" field.

func (*DictTypeUpdate) SetStatus

func (dtu *DictTypeUpdate) SetStatus(i int8) *DictTypeUpdate

SetStatus sets the "status" field.

func (*DictTypeUpdate) SetType

func (dtu *DictTypeUpdate) SetType(s string) *DictTypeUpdate

SetType sets the "type" field.

func (*DictTypeUpdate) SetUpdatedAt

func (dtu *DictTypeUpdate) SetUpdatedAt(t time.Time) *DictTypeUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DictTypeUpdate) SetUpdatedBy

func (dtu *DictTypeUpdate) SetUpdatedBy(i int64) *DictTypeUpdate

SetUpdatedBy sets the "updated_by" field.

func (*DictTypeUpdate) Where

func (dtu *DictTypeUpdate) Where(ps ...predicate.DictType) *DictTypeUpdate

Where appends a list predicates to the DictTypeUpdate builder.

type DictTypeUpdateOne

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

DictTypeUpdateOne is the builder for updating a single DictType entity.

func (*DictTypeUpdateOne) AddCreatedBy

func (dtuo *DictTypeUpdateOne) AddCreatedBy(i int64) *DictTypeUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*DictTypeUpdateOne) AddStatus

func (dtuo *DictTypeUpdateOne) AddStatus(i int8) *DictTypeUpdateOne

AddStatus adds i to the "status" field.

func (*DictTypeUpdateOne) AddUpdatedBy

func (dtuo *DictTypeUpdateOne) AddUpdatedBy(i int64) *DictTypeUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*DictTypeUpdateOne) Exec

func (dtuo *DictTypeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DictTypeUpdateOne) ExecX

func (dtuo *DictTypeUpdateOne) ExecX(ctx context.Context)

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

func (*DictTypeUpdateOne) Mutation

func (dtuo *DictTypeUpdateOne) Mutation() *DictTypeMutation

Mutation returns the DictTypeMutation object of the builder.

func (*DictTypeUpdateOne) Save

func (dtuo *DictTypeUpdateOne) Save(ctx context.Context) (*DictType, error)

Save executes the query and returns the updated DictType entity.

func (*DictTypeUpdateOne) SaveX

func (dtuo *DictTypeUpdateOne) SaveX(ctx context.Context) *DictType

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

func (*DictTypeUpdateOne) Select

func (dtuo *DictTypeUpdateOne) Select(field string, fields ...string) *DictTypeUpdateOne

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

func (*DictTypeUpdateOne) SetCreatedAt

func (dtuo *DictTypeUpdateOne) SetCreatedAt(t time.Time) *DictTypeUpdateOne

SetCreatedAt sets the "created_at" field.

func (*DictTypeUpdateOne) SetCreatedBy

func (dtuo *DictTypeUpdateOne) SetCreatedBy(i int64) *DictTypeUpdateOne

SetCreatedBy sets the "created_by" field.

func (*DictTypeUpdateOne) SetName

func (dtuo *DictTypeUpdateOne) SetName(s string) *DictTypeUpdateOne

SetName sets the "name" field.

func (*DictTypeUpdateOne) SetNillableCreatedAt

func (dtuo *DictTypeUpdateOne) SetNillableCreatedAt(t *time.Time) *DictTypeUpdateOne

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

func (*DictTypeUpdateOne) SetNillableCreatedBy

func (dtuo *DictTypeUpdateOne) SetNillableCreatedBy(i *int64) *DictTypeUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*DictTypeUpdateOne) SetNillableName

func (dtuo *DictTypeUpdateOne) SetNillableName(s *string) *DictTypeUpdateOne

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

func (*DictTypeUpdateOne) SetNillableRemark

func (dtuo *DictTypeUpdateOne) SetNillableRemark(s *string) *DictTypeUpdateOne

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*DictTypeUpdateOne) SetNillableStatus

func (dtuo *DictTypeUpdateOne) SetNillableStatus(i *int8) *DictTypeUpdateOne

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

func (*DictTypeUpdateOne) SetNillableType

func (dtuo *DictTypeUpdateOne) SetNillableType(s *string) *DictTypeUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*DictTypeUpdateOne) SetNillableUpdatedBy

func (dtuo *DictTypeUpdateOne) SetNillableUpdatedBy(i *int64) *DictTypeUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*DictTypeUpdateOne) SetRemark

func (dtuo *DictTypeUpdateOne) SetRemark(s string) *DictTypeUpdateOne

SetRemark sets the "remark" field.

func (*DictTypeUpdateOne) SetStatus

func (dtuo *DictTypeUpdateOne) SetStatus(i int8) *DictTypeUpdateOne

SetStatus sets the "status" field.

func (*DictTypeUpdateOne) SetType

func (dtuo *DictTypeUpdateOne) SetType(s string) *DictTypeUpdateOne

SetType sets the "type" field.

func (*DictTypeUpdateOne) SetUpdatedAt

func (dtuo *DictTypeUpdateOne) SetUpdatedAt(t time.Time) *DictTypeUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DictTypeUpdateOne) SetUpdatedBy

func (dtuo *DictTypeUpdateOne) SetUpdatedBy(i int64) *DictTypeUpdateOne

SetUpdatedBy sets the "updated_by" field.

type DictTypes

type DictTypes []*DictType

DictTypes is a parsable slice of DictType.

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)

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
	ID int64 `json:"id,omitempty"`
	// MenuID holds the value of the "menu_id" field.
	// 菜单ID
	MenuID int64 `json:"menu_id,omitempty"`
	// Name holds the value of the "name" field.
	// 权限名称
	Name string `json:"name,omitempty"`
	// Permission holds the value of the "permission" field.
	// 权限
	Permission string `json:"permission,omitempty"`
	// contains filtered or unexported fields
}

Permission is the model entity for the Permission schema.

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

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

Exec executes the query.

func (*PermissionCreate) ExecX

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

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

func (*PermissionCreate) Mutation

func (pc *PermissionCreate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionCreate) Save

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

Save creates the Permission in the database.

func (*PermissionCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*PermissionCreate) SetID

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

SetID sets the "id" field.

func (*PermissionCreate) SetMenuID

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

SetMenuID sets the "menu_id" field.

func (*PermissionCreate) SetName

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

SetName sets the "name" field.

func (*PermissionCreate) SetNillableMenuID

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

SetNillableMenuID sets the "menu_id" field if the given value is not nil.

func (*PermissionCreate) SetNillableName

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

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

func (*PermissionCreate) SetNillablePermission

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

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*PermissionCreate) SetPermission

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

SetPermission sets the "permission" field.

type PermissionCreateBulk

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

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

func (*PermissionCreateBulk) Exec

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

Exec executes the query.

func (*PermissionCreateBulk) ExecX

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

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

func (*PermissionCreateBulk) Save

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

Save creates the Permission entities in the database.

func (*PermissionCreateBulk) SaveX

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

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

type PermissionDelete

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

PermissionDelete is the builder for deleting a Permission entity.

func (*PermissionDelete) Exec

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

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

func (*PermissionDelete) ExecX

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

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

func (*PermissionDelete) Where

Where appends a list predicates to the PermissionDelete builder.

type PermissionDeleteOne

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

PermissionDeleteOne is the builder for deleting a single Permission entity.

func (*PermissionDeleteOne) Exec

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

Exec executes the deletion query.

func (*PermissionDeleteOne) ExecX

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

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

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

func (m *PermissionMutation) AddMenuID(i int64)

AddMenuID adds i to the "menu_id" field.

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

func (m *PermissionMutation) AddedMenuID() (r int64, exists bool)

AddedMenuID returns the value that was added to the "menu_id" field in this mutation.

func (*PermissionMutation) ClearEdge

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

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

func (*PermissionMutation) ClearField

func (m *PermissionMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*PermissionMutation) ClearedEdges

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

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

func (*PermissionMutation) ClearedFields

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

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

func (PermissionMutation) Client

func (m PermissionMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*PermissionMutation) EdgeCleared

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

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

func (*PermissionMutation) Field

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

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

func (*PermissionMutation) FieldCleared

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

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

func (*PermissionMutation) Fields

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

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

func (*PermissionMutation) 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 or after it was returned from the database.

func (*PermissionMutation) IDs

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

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

func (*PermissionMutation) MenuID

func (m *PermissionMutation) MenuID() (r int64, exists bool)

MenuID returns the value of the "menu_id" field in the mutation.

func (*PermissionMutation) Name

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

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

func (*PermissionMutation) OldField

func (m *PermissionMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*PermissionMutation) OldMenuID

func (m *PermissionMutation) OldMenuID(ctx context.Context) (v int64, err error)

OldMenuID returns the old "menu_id" field's value of the Permission entity. If the Permission object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*PermissionMutation) OldName

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

OldName returns the old "name" field's value of the Permission entity. If the Permission object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*PermissionMutation) OldPermission

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

OldPermission returns the old "permission" 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) Permission

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

Permission returns the value of the "permission" field in the mutation.

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

func (m *PermissionMutation) ResetMenuID()

ResetMenuID resets all changes to the "menu_id" field.

func (*PermissionMutation) ResetName

func (m *PermissionMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PermissionMutation) ResetPermission

func (m *PermissionMutation) ResetPermission()

ResetPermission resets all changes to the "permission" 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) SetMenuID

func (m *PermissionMutation) SetMenuID(i int64)

SetMenuID sets the "menu_id" field.

func (*PermissionMutation) SetName

func (m *PermissionMutation) SetName(s string)

SetName sets the "name" field.

func (*PermissionMutation) SetPermission

func (m *PermissionMutation) SetPermission(s string)

SetPermission sets the "permission" field.

func (PermissionMutation) Tx

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

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

func (*PermissionMutation) Type

func (m *PermissionMutation) Type() string

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

func (*PermissionMutation) Where

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

Where appends a list predicates to the PermissionMutation builder.

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 {
	MenuID int64 `json:"menu_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Permission.Query().
	GroupBy(permission.FieldMenuID).
	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 more than one Permission entity is found. Returns a *NotFoundError when no Permission entities are found.

func (*PermissionQuery) OnlyID

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

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

func (*PermissionQuery) OnlyIDX

func (pq *PermissionQuery) OnlyIDX(ctx context.Context) 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) Select

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

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

Example:

var v []struct {
	MenuID int64 `json:"menu_id,omitempty"`
}

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

func (*PermissionQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*PermissionQuery) Where

Where adds a new predicate for the PermissionQuery builder.

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

func (pu *PermissionUpdate) AddMenuID(i int64) *PermissionUpdate

AddMenuID adds i to the "menu_id" field.

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

func (pu *PermissionUpdate) SetMenuID(i int64) *PermissionUpdate

SetMenuID sets the "menu_id" field.

func (*PermissionUpdate) SetName

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

SetName sets the "name" field.

func (*PermissionUpdate) SetNillableMenuID

func (pu *PermissionUpdate) SetNillableMenuID(i *int64) *PermissionUpdate

SetNillableMenuID sets the "menu_id" field if the given value is not nil.

func (*PermissionUpdate) SetNillableName

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

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

func (*PermissionUpdate) SetNillablePermission

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

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*PermissionUpdate) SetPermission

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

SetPermission sets the "permission" field.

func (*PermissionUpdate) Where

Where appends a list predicates to the PermissionUpdate builder.

type PermissionUpdateOne

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

PermissionUpdateOne is the builder for updating a single Permission entity.

func (*PermissionUpdateOne) AddMenuID

func (puo *PermissionUpdateOne) AddMenuID(i int64) *PermissionUpdateOne

AddMenuID adds i to the "menu_id" field.

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

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

Save executes the query and returns the updated Permission entity.

func (*PermissionUpdateOne) SaveX

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

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

func (*PermissionUpdateOne) Select

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

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

func (*PermissionUpdateOne) SetMenuID

func (puo *PermissionUpdateOne) SetMenuID(i int64) *PermissionUpdateOne

SetMenuID sets the "menu_id" field.

func (*PermissionUpdateOne) SetName

SetName sets the "name" field.

func (*PermissionUpdateOne) SetNillableMenuID

func (puo *PermissionUpdateOne) SetNillableMenuID(i *int64) *PermissionUpdateOne

SetNillableMenuID sets the "menu_id" field if the given value is not nil.

func (*PermissionUpdateOne) SetNillableName

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

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

func (*PermissionUpdateOne) SetNillablePermission

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

SetNillablePermission sets the "permission" field if the given value is not nil.

func (*PermissionUpdateOne) SetPermission

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

SetPermission sets the "permission" 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
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// Name holds the value of the "name" field.
	// 角色名称
	Name string `json:"name,omitempty"`
	// Sort holds the value of the "sort" field.
	// 排序
	Sort int8 `json:"sort,omitempty"`
	// Status holds the value of the "status" field.
	// 状态 0:禁用 1:启用
	Status int8 `json:"status,omitempty"`
	// Remark holds the value of the "remark" field.
	// 备注
	Remark string `json:"remark,omitempty"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

Unwrap unwraps the Role entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Role) Update

func (r *Role) Update() *RoleUpdateOne

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

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

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) Exec

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

Exec executes the query.

func (*RoleCreate) ExecX

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

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

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) Save

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

Save creates the Role in the database.

func (*RoleCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleCreate) SetCreatedBy

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

SetCreatedBy sets the "created_by" 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) SetNillableCreatedAt

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

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

func (*RoleCreate) SetNillableCreatedBy

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

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*RoleCreate) SetNillableName

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

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

func (*RoleCreate) SetNillableRemark

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

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*RoleCreate) SetNillableSort

func (rc *RoleCreate) SetNillableSort(i *int8) *RoleCreate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*RoleCreate) SetNillableStatus

func (rc *RoleCreate) SetNillableStatus(i *int8) *RoleCreate

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

func (*RoleCreate) SetNillableUpdatedAt

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

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

func (*RoleCreate) SetNillableUpdatedBy

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

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*RoleCreate) SetRemark

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

SetRemark sets the "remark" field.

func (*RoleCreate) SetSort

func (rc *RoleCreate) SetSort(i int8) *RoleCreate

SetSort sets the "sort" field.

func (*RoleCreate) SetStatus

func (rc *RoleCreate) SetStatus(i int8) *RoleCreate

SetStatus sets the "status" field.

func (*RoleCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RoleCreate) SetUpdatedBy

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

SetUpdatedBy sets the "updated_by" field.

type RoleCreateBulk

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

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

func (*RoleCreateBulk) Exec

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

Exec executes the query.

func (*RoleCreateBulk) ExecX

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

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

func (*RoleCreateBulk) Save

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

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

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

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

type RoleDelete

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

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

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

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

func (*RoleDelete) ExecX

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

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

func (*RoleDelete) Where

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

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

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

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

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

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

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

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

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

func (m *RoleMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*RoleMutation) AddField

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

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

func (*RoleMutation) AddSort

func (m *RoleMutation) AddSort(i int8)

AddSort adds i to the "sort" field.

func (*RoleMutation) AddStatus

func (m *RoleMutation) AddStatus(i int8)

AddStatus adds i to the "status" field.

func (*RoleMutation) AddUpdatedBy

func (m *RoleMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*RoleMutation) AddedCreatedBy

func (m *RoleMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*RoleMutation) AddedEdges

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

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

func (*RoleMutation) AddedField

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

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

func (*RoleMutation) AddedFields

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

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

func (*RoleMutation) AddedIDs

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

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

func (*RoleMutation) AddedSort

func (m *RoleMutation) AddedSort() (r int8, exists bool)

AddedSort returns the value that was added to the "sort" field in this mutation.

func (*RoleMutation) AddedStatus

func (m *RoleMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the "status" field in this mutation.

func (*RoleMutation) AddedUpdatedBy

func (m *RoleMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*RoleMutation) ClearEdge

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

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

func (*RoleMutation) ClearField

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

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*RoleMutation) ClearedEdges

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

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

func (*RoleMutation) ClearedFields

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

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

func (RoleMutation) Client

func (m RoleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*RoleMutation) CreatedAt

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

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

func (*RoleMutation) CreatedBy

func (m *RoleMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*RoleMutation) EdgeCleared

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

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

func (*RoleMutation) Field

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

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

func (*RoleMutation) FieldCleared

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

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

func (*RoleMutation) Fields

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

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

func (*RoleMutation) ID

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

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

func (*RoleMutation) IDs

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

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

func (*RoleMutation) Name

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

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

func (*RoleMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldCreatedBy

func (m *RoleMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" 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) OldRemark

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

OldRemark returns the old "remark" 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) OldSort

func (m *RoleMutation) OldSort(ctx context.Context) (v int8, err error)

OldSort returns the old "sort" 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 int8, 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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldUpdatedBy

func (m *RoleMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" 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) Remark

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

Remark returns the value of the "remark" field in the mutation.

func (*RoleMutation) RemovedEdges

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

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

func (*RoleMutation) RemovedIDs

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

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetCreatedBy

func (m *RoleMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*RoleMutation) ResetEdge

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

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*RoleMutation) ResetField

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

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

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetRemark

func (m *RoleMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*RoleMutation) ResetSort

func (m *RoleMutation) ResetSort()

ResetSort resets all changes to the "sort" field.

func (*RoleMutation) ResetStatus

func (m *RoleMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) ResetUpdatedBy

func (m *RoleMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*RoleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetCreatedBy

func (m *RoleMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" 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) SetRemark

func (m *RoleMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*RoleMutation) SetSort

func (m *RoleMutation) SetSort(i int8)

SetSort sets the "sort" field.

func (*RoleMutation) SetStatus

func (m *RoleMutation) SetStatus(i int8)

SetStatus sets the "status" field.

func (*RoleMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RoleMutation) SetUpdatedBy

func (m *RoleMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*RoleMutation) Sort

func (m *RoleMutation) Sort() (r int8, exists bool)

Sort returns the value of the "sort" field in the mutation.

func (*RoleMutation) Status

func (m *RoleMutation) Status() (r int8, exists bool)

Status returns the value of the "status" field in the 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) UpdatedAt

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

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

func (*RoleMutation) UpdatedBy

func (m *RoleMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*RoleMutation) Where

func (m *RoleMutation) Where(ps ...predicate.Role)

Where appends a list predicates to the RoleMutation builder.

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

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

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) ([]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 more than one Role entity is found. Returns a *NotFoundError when no Role entities are found.

func (*RoleQuery) OnlyID

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

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

func (*RoleQuery) OnlyIDX

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

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

func (*RoleQuery) OnlyX

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

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

func (*RoleQuery) Order

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

Order adds an order step to the query.

func (*RoleQuery) Select

func (rq *RoleQuery) Select(fields ...string) *RoleSelect

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

Example:

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

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

func (*RoleQuery) Unique

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

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*RoleQuery) Where

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

Where adds a new predicate for the RoleQuery builder.

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

func (ru *RoleUpdate) AddCreatedBy(i int64) *RoleUpdate

AddCreatedBy adds i to the "created_by" field.

func (*RoleUpdate) AddSort

func (ru *RoleUpdate) AddSort(i int8) *RoleUpdate

AddSort adds i to the "sort" field.

func (*RoleUpdate) AddStatus

func (ru *RoleUpdate) AddStatus(i int8) *RoleUpdate

AddStatus adds i to the "status" field.

func (*RoleUpdate) AddUpdatedBy

func (ru *RoleUpdate) AddUpdatedBy(i int64) *RoleUpdate

AddUpdatedBy adds i to the "updated_by" 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) Save

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

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

func (*RoleUpdate) SaveX

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

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

func (*RoleUpdate) SetCreatedAt

func (ru *RoleUpdate) SetCreatedAt(t time.Time) *RoleUpdate

SetCreatedAt sets the "created_at" field.

func (*RoleUpdate) SetCreatedBy

func (ru *RoleUpdate) SetCreatedBy(i int64) *RoleUpdate

SetCreatedBy sets the "created_by" field.

func (*RoleUpdate) SetName

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

SetName sets the "name" field.

func (*RoleUpdate) SetNillableCreatedAt

func (ru *RoleUpdate) SetNillableCreatedAt(t *time.Time) *RoleUpdate

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

func (*RoleUpdate) SetNillableCreatedBy

func (ru *RoleUpdate) SetNillableCreatedBy(i *int64) *RoleUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*RoleUpdate) SetNillableName

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

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

func (*RoleUpdate) SetNillableRemark

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

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*RoleUpdate) SetNillableSort

func (ru *RoleUpdate) SetNillableSort(i *int8) *RoleUpdate

SetNillableSort sets the "sort" field if the given value is not nil.

func (*RoleUpdate) SetNillableStatus

func (ru *RoleUpdate) SetNillableStatus(i *int8) *RoleUpdate

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

func (*RoleUpdate) SetNillableUpdatedBy

func (ru *RoleUpdate) SetNillableUpdatedBy(i *int64) *RoleUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*RoleUpdate) SetRemark

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

SetRemark sets the "remark" field.

func (*RoleUpdate) SetSort

func (ru *RoleUpdate) SetSort(i int8) *RoleUpdate

SetSort sets the "sort" field.

func (*RoleUpdate) SetStatus

func (ru *RoleUpdate) SetStatus(i int8) *RoleUpdate

SetStatus sets the "status" field.

func (*RoleUpdate) SetUpdatedAt

func (ru *RoleUpdate) SetUpdatedAt(t time.Time) *RoleUpdate

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdate) SetUpdatedBy

func (ru *RoleUpdate) SetUpdatedBy(i int64) *RoleUpdate

SetUpdatedBy sets the "updated_by" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

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

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) AddCreatedBy

func (ruo *RoleUpdateOne) AddCreatedBy(i int64) *RoleUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*RoleUpdateOne) AddSort

func (ruo *RoleUpdateOne) AddSort(i int8) *RoleUpdateOne

AddSort adds i to the "sort" field.

func (*RoleUpdateOne) AddStatus

func (ruo *RoleUpdateOne) AddStatus(i int8) *RoleUpdateOne

AddStatus adds i to the "status" field.

func (*RoleUpdateOne) AddUpdatedBy

func (ruo *RoleUpdateOne) AddUpdatedBy(i int64) *RoleUpdateOne

AddUpdatedBy adds i to the "updated_by" 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) Save

func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role

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

func (*RoleUpdateOne) Select

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

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

func (*RoleUpdateOne) SetCreatedAt

func (ruo *RoleUpdateOne) SetCreatedAt(t time.Time) *RoleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*RoleUpdateOne) SetCreatedBy

func (ruo *RoleUpdateOne) SetCreatedBy(i int64) *RoleUpdateOne

SetCreatedBy sets the "created_by" field.

func (*RoleUpdateOne) SetName

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

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableCreatedAt

func (ruo *RoleUpdateOne) SetNillableCreatedAt(t *time.Time) *RoleUpdateOne

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

func (*RoleUpdateOne) SetNillableCreatedBy

func (ruo *RoleUpdateOne) SetNillableCreatedBy(i *int64) *RoleUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableName

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

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

func (*RoleUpdateOne) SetNillableRemark

func (ruo *RoleUpdateOne) SetNillableRemark(s *string) *RoleUpdateOne

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableSort

func (ruo *RoleUpdateOne) SetNillableSort(i *int8) *RoleUpdateOne

SetNillableSort sets the "sort" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableStatus

func (ruo *RoleUpdateOne) SetNillableStatus(i *int8) *RoleUpdateOne

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

func (*RoleUpdateOne) SetNillableUpdatedBy

func (ruo *RoleUpdateOne) SetNillableUpdatedBy(i *int64) *RoleUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*RoleUpdateOne) SetRemark

func (ruo *RoleUpdateOne) SetRemark(s string) *RoleUpdateOne

SetRemark sets the "remark" field.

func (*RoleUpdateOne) SetSort

func (ruo *RoleUpdateOne) SetSort(i int8) *RoleUpdateOne

SetSort sets the "sort" field.

func (*RoleUpdateOne) SetStatus

func (ruo *RoleUpdateOne) SetStatus(i int8) *RoleUpdateOne

SetStatus sets the "status" field.

func (*RoleUpdateOne) SetUpdatedAt

func (ruo *RoleUpdateOne) SetUpdatedAt(t time.Time) *RoleUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdateOne) SetUpdatedBy

func (ruo *RoleUpdateOne) SetUpdatedBy(i int64) *RoleUpdateOne

SetUpdatedBy sets the "updated_by" 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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Staff

type Staff struct {

	// ID of the ent.
	// 自增id
	ID int64 `json:"id,omitempty"`
	// UID holds the value of the "uid" field.
	// 账号id
	UID int64 `json:"uid,omitempty"`
	// Name holds the value of the "name" field.
	// 员工姓名
	Name string `json:"name,omitempty"`
	// Phone holds the value of the "phone" field.
	// 员工手机号
	Phone string `json:"phone,omitempty"`
	// Email holds the value of the "email" field.
	// 员工邮箱
	Email string `json:"email,omitempty"`
	// Nickname holds the value of the "nickname" field.
	// 员工昵称
	Nickname string `json:"nickname,omitempty"`
	// Avatar holds the value of the "avatar" field.
	// 员工头像(相对路径)
	Avatar string `json:"avatar,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// contains filtered or unexported fields
}

Staff is the model entity for the Staff schema.

func (*Staff) String

func (s *Staff) String() string

String implements the fmt.Stringer.

func (*Staff) Unwrap

func (s *Staff) Unwrap() *Staff

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

func (s *Staff) Update() *StaffUpdateOne

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

type StaffClient

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

StaffClient is a client for the Staff schema.

func NewStaffClient

func NewStaffClient(c config) *StaffClient

NewStaffClient returns a client for the Staff from the given config.

func (*StaffClient) Create

func (c *StaffClient) Create() *StaffCreate

Create returns a create builder for Staff.

func (*StaffClient) CreateBulk

func (c *StaffClient) CreateBulk(builders ...*StaffCreate) *StaffCreateBulk

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

func (*StaffClient) Delete

func (c *StaffClient) Delete() *StaffDelete

Delete returns a delete builder for Staff.

func (*StaffClient) DeleteOne

func (c *StaffClient) DeleteOne(s *Staff) *StaffDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*StaffClient) DeleteOneID

func (c *StaffClient) DeleteOneID(id int64) *StaffDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*StaffClient) Get

func (c *StaffClient) Get(ctx context.Context, id int64) (*Staff, error)

Get returns a Staff entity by its id.

func (*StaffClient) GetX

func (c *StaffClient) GetX(ctx context.Context, id int64) *Staff

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

func (*StaffClient) Hooks

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

Hooks returns the client hooks.

func (*StaffClient) Query

func (c *StaffClient) Query() *StaffQuery

Query returns a query builder for Staff.

func (*StaffClient) Update

func (c *StaffClient) Update() *StaffUpdate

Update returns an update builder for Staff.

func (*StaffClient) UpdateOne

func (c *StaffClient) UpdateOne(s *Staff) *StaffUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StaffClient) UpdateOneID

func (c *StaffClient) UpdateOneID(id int64) *StaffUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StaffClient) Use

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

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

type StaffCreate

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

StaffCreate is the builder for creating a Staff entity.

func (*StaffCreate) Exec

func (sc *StaffCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*StaffCreate) ExecX

func (sc *StaffCreate) ExecX(ctx context.Context)

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

func (*StaffCreate) Mutation

func (sc *StaffCreate) Mutation() *StaffMutation

Mutation returns the StaffMutation object of the builder.

func (*StaffCreate) Save

func (sc *StaffCreate) Save(ctx context.Context) (*Staff, error)

Save creates the Staff in the database.

func (*StaffCreate) SaveX

func (sc *StaffCreate) SaveX(ctx context.Context) *Staff

SaveX calls Save and panics if Save returns an error.

func (*StaffCreate) SetAvatar

func (sc *StaffCreate) SetAvatar(s string) *StaffCreate

SetAvatar sets the "avatar" field.

func (*StaffCreate) SetCreatedAt

func (sc *StaffCreate) SetCreatedAt(t time.Time) *StaffCreate

SetCreatedAt sets the "created_at" field.

func (*StaffCreate) SetCreatedBy

func (sc *StaffCreate) SetCreatedBy(i int64) *StaffCreate

SetCreatedBy sets the "created_by" field.

func (*StaffCreate) SetEmail

func (sc *StaffCreate) SetEmail(s string) *StaffCreate

SetEmail sets the "email" field.

func (*StaffCreate) SetID

func (sc *StaffCreate) SetID(i int64) *StaffCreate

SetID sets the "id" field.

func (*StaffCreate) SetName

func (sc *StaffCreate) SetName(s string) *StaffCreate

SetName sets the "name" field.

func (*StaffCreate) SetNickname

func (sc *StaffCreate) SetNickname(s string) *StaffCreate

SetNickname sets the "nickname" field.

func (*StaffCreate) SetNillableAvatar

func (sc *StaffCreate) SetNillableAvatar(s *string) *StaffCreate

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

func (*StaffCreate) SetNillableCreatedAt

func (sc *StaffCreate) SetNillableCreatedAt(t *time.Time) *StaffCreate

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

func (*StaffCreate) SetNillableCreatedBy

func (sc *StaffCreate) SetNillableCreatedBy(i *int64) *StaffCreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*StaffCreate) SetNillableEmail

func (sc *StaffCreate) SetNillableEmail(s *string) *StaffCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*StaffCreate) SetNillableName

func (sc *StaffCreate) SetNillableName(s *string) *StaffCreate

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

func (*StaffCreate) SetNillableNickname

func (sc *StaffCreate) SetNillableNickname(s *string) *StaffCreate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*StaffCreate) SetNillablePhone

func (sc *StaffCreate) SetNillablePhone(s *string) *StaffCreate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*StaffCreate) SetNillableUID

func (sc *StaffCreate) SetNillableUID(i *int64) *StaffCreate

SetNillableUID sets the "uid" field if the given value is not nil.

func (*StaffCreate) SetNillableUpdatedAt

func (sc *StaffCreate) SetNillableUpdatedAt(t *time.Time) *StaffCreate

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

func (*StaffCreate) SetNillableUpdatedBy

func (sc *StaffCreate) SetNillableUpdatedBy(i *int64) *StaffCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*StaffCreate) SetPhone

func (sc *StaffCreate) SetPhone(s string) *StaffCreate

SetPhone sets the "phone" field.

func (*StaffCreate) SetUID

func (sc *StaffCreate) SetUID(i int64) *StaffCreate

SetUID sets the "uid" field.

func (*StaffCreate) SetUpdatedAt

func (sc *StaffCreate) SetUpdatedAt(t time.Time) *StaffCreate

SetUpdatedAt sets the "updated_at" field.

func (*StaffCreate) SetUpdatedBy

func (sc *StaffCreate) SetUpdatedBy(i int64) *StaffCreate

SetUpdatedBy sets the "updated_by" field.

type StaffCreateBulk

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

StaffCreateBulk is the builder for creating many Staff entities in bulk.

func (*StaffCreateBulk) Exec

func (scb *StaffCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*StaffCreateBulk) ExecX

func (scb *StaffCreateBulk) ExecX(ctx context.Context)

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

func (*StaffCreateBulk) Save

func (scb *StaffCreateBulk) Save(ctx context.Context) ([]*Staff, error)

Save creates the Staff entities in the database.

func (*StaffCreateBulk) SaveX

func (scb *StaffCreateBulk) SaveX(ctx context.Context) []*Staff

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

type StaffDelete

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

StaffDelete is the builder for deleting a Staff entity.

func (*StaffDelete) Exec

func (sd *StaffDelete) Exec(ctx context.Context) (int, error)

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

func (*StaffDelete) ExecX

func (sd *StaffDelete) ExecX(ctx context.Context) int

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

func (*StaffDelete) Where

func (sd *StaffDelete) Where(ps ...predicate.Staff) *StaffDelete

Where appends a list predicates to the StaffDelete builder.

type StaffDeleteOne

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

StaffDeleteOne is the builder for deleting a single Staff entity.

func (*StaffDeleteOne) Exec

func (sdo *StaffDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*StaffDeleteOne) ExecX

func (sdo *StaffDeleteOne) ExecX(ctx context.Context)

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

type StaffGroupBy

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

StaffGroupBy is the group-by builder for Staff entities.

func (*StaffGroupBy) Aggregate

func (sgb *StaffGroupBy) Aggregate(fns ...AggregateFunc) *StaffGroupBy

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

func (*StaffGroupBy) Bool

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) BoolX

func (sgb *StaffGroupBy) BoolX(ctx context.Context) bool

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

func (*StaffGroupBy) Bools

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) BoolsX

func (sgb *StaffGroupBy) BoolsX(ctx context.Context) []bool

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

func (*StaffGroupBy) Float64

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) Float64X

func (sgb *StaffGroupBy) Float64X(ctx context.Context) float64

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

func (*StaffGroupBy) Float64s

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) Float64sX

func (sgb *StaffGroupBy) Float64sX(ctx context.Context) []float64

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

func (*StaffGroupBy) Int

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) IntX

func (sgb *StaffGroupBy) IntX(ctx context.Context) int

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

func (*StaffGroupBy) Ints

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) IntsX

func (sgb *StaffGroupBy) IntsX(ctx context.Context) []int

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

func (*StaffGroupBy) Scan

func (sgb *StaffGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*StaffGroupBy) ScanX

func (sgb *StaffGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*StaffGroupBy) String

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) StringX

func (sgb *StaffGroupBy) StringX(ctx context.Context) string

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

func (*StaffGroupBy) Strings

func (sgb *StaffGroupBy) 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 (*StaffGroupBy) StringsX

func (sgb *StaffGroupBy) StringsX(ctx context.Context) []string

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

type StaffMutation

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

StaffMutation represents an operation that mutates the Staff nodes in the graph.

func (*StaffMutation) AddCreatedBy

func (m *StaffMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*StaffMutation) AddField

func (m *StaffMutation) 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 (*StaffMutation) AddUID

func (m *StaffMutation) AddUID(i int64)

AddUID adds i to the "uid" field.

func (*StaffMutation) AddUpdatedBy

func (m *StaffMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*StaffMutation) AddedCreatedBy

func (m *StaffMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*StaffMutation) AddedEdges

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

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

func (*StaffMutation) AddedField

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

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

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

func (*StaffMutation) AddedIDs

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

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

func (*StaffMutation) AddedUID

func (m *StaffMutation) AddedUID() (r int64, exists bool)

AddedUID returns the value that was added to the "uid" field in this mutation.

func (*StaffMutation) AddedUpdatedBy

func (m *StaffMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*StaffMutation) Avatar

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

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

func (*StaffMutation) ClearEdge

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

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

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

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

func (*StaffMutation) ClearedFields

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

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

func (StaffMutation) Client

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

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

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

func (*StaffMutation) CreatedBy

func (m *StaffMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*StaffMutation) EdgeCleared

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

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

func (*StaffMutation) Email

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

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

func (*StaffMutation) Field

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

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

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

func (*StaffMutation) Fields

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

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

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

func (*StaffMutation) IDs

func (m *StaffMutation) IDs(ctx context.Context) ([]int64, error)

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

func (*StaffMutation) Name

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

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

func (*StaffMutation) Nickname

func (m *StaffMutation) Nickname() (r string, exists bool)

Nickname returns the value of the "nickname" field in the mutation.

func (*StaffMutation) OldAvatar

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

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

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

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

func (m *StaffMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" field's value of the Staff entity. If the Staff 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 (*StaffMutation) OldEmail

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

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

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

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

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

func (m *StaffMutation) OldNickname(ctx context.Context) (v string, err error)

OldNickname returns the old "nickname" field's value of the Staff entity. If the Staff 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 (*StaffMutation) OldPhone

func (m *StaffMutation) OldPhone(ctx context.Context) (v string, err error)

OldPhone returns the old "phone" field's value of the Staff entity. If the Staff 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 (*StaffMutation) OldUID

func (m *StaffMutation) OldUID(ctx context.Context) (v int64, err error)

OldUID returns the old "uid" field's value of the Staff entity. If the Staff 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 (*StaffMutation) OldUpdatedAt

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

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

func (m *StaffMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the Staff entity. If the Staff 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 (*StaffMutation) Op

func (m *StaffMutation) Op() Op

Op returns the operation name.

func (*StaffMutation) Phone

func (m *StaffMutation) Phone() (r string, exists bool)

Phone returns the value of the "phone" field in the mutation.

func (*StaffMutation) RemovedEdges

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

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

func (*StaffMutation) RemovedIDs

func (m *StaffMutation) 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 (*StaffMutation) ResetAvatar

func (m *StaffMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*StaffMutation) ResetCreatedAt

func (m *StaffMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*StaffMutation) ResetCreatedBy

func (m *StaffMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*StaffMutation) ResetEdge

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

func (m *StaffMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*StaffMutation) ResetField

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

func (m *StaffMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*StaffMutation) ResetNickname

func (m *StaffMutation) ResetNickname()

ResetNickname resets all changes to the "nickname" field.

func (*StaffMutation) ResetPhone

func (m *StaffMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*StaffMutation) ResetUID

func (m *StaffMutation) ResetUID()

ResetUID resets all changes to the "uid" field.

func (*StaffMutation) ResetUpdatedAt

func (m *StaffMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*StaffMutation) ResetUpdatedBy

func (m *StaffMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*StaffMutation) SetAvatar

func (m *StaffMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*StaffMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*StaffMutation) SetCreatedBy

func (m *StaffMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*StaffMutation) SetEmail

func (m *StaffMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*StaffMutation) SetField

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

func (m *StaffMutation) SetID(id int64)

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

func (*StaffMutation) SetName

func (m *StaffMutation) SetName(s string)

SetName sets the "name" field.

func (*StaffMutation) SetNickname

func (m *StaffMutation) SetNickname(s string)

SetNickname sets the "nickname" field.

func (*StaffMutation) SetPhone

func (m *StaffMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*StaffMutation) SetUID

func (m *StaffMutation) SetUID(i int64)

SetUID sets the "uid" field.

func (*StaffMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*StaffMutation) SetUpdatedBy

func (m *StaffMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (StaffMutation) Tx

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

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

func (*StaffMutation) Type

func (m *StaffMutation) Type() string

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

func (*StaffMutation) UID

func (m *StaffMutation) UID() (r int64, exists bool)

UID returns the value of the "uid" field in the mutation.

func (*StaffMutation) UpdatedAt

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

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

func (*StaffMutation) UpdatedBy

func (m *StaffMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*StaffMutation) Where

func (m *StaffMutation) Where(ps ...predicate.Staff)

Where appends a list predicates to the StaffMutation builder.

type StaffQuery

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

StaffQuery is the builder for querying Staff entities.

func (*StaffQuery) All

func (sq *StaffQuery) All(ctx context.Context) ([]*Staff, error)

All executes the query and returns a list of Staffs.

func (*StaffQuery) AllX

func (sq *StaffQuery) AllX(ctx context.Context) []*Staff

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

func (*StaffQuery) Clone

func (sq *StaffQuery) Clone() *StaffQuery

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

func (*StaffQuery) Count

func (sq *StaffQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*StaffQuery) CountX

func (sq *StaffQuery) CountX(ctx context.Context) int

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

func (*StaffQuery) Exist

func (sq *StaffQuery) Exist(ctx context.Context) (bool, error)

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

func (*StaffQuery) ExistX

func (sq *StaffQuery) ExistX(ctx context.Context) bool

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

func (*StaffQuery) First

func (sq *StaffQuery) First(ctx context.Context) (*Staff, error)

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

func (*StaffQuery) FirstID

func (sq *StaffQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*StaffQuery) FirstIDX

func (sq *StaffQuery) FirstIDX(ctx context.Context) int64

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

func (*StaffQuery) FirstX

func (sq *StaffQuery) FirstX(ctx context.Context) *Staff

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

func (*StaffQuery) GroupBy

func (sq *StaffQuery) GroupBy(field string, fields ...string) *StaffGroupBy

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 {
	UID int64 `json:"uid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Staff.Query().
	GroupBy(staff.FieldUID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StaffQuery) IDs

func (sq *StaffQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*StaffQuery) IDsX

func (sq *StaffQuery) IDsX(ctx context.Context) []int64

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

func (*StaffQuery) Limit

func (sq *StaffQuery) Limit(limit int) *StaffQuery

Limit adds a limit step to the query.

func (*StaffQuery) Offset

func (sq *StaffQuery) Offset(offset int) *StaffQuery

Offset adds an offset step to the query.

func (*StaffQuery) Only

func (sq *StaffQuery) Only(ctx context.Context) (*Staff, error)

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

func (*StaffQuery) OnlyID

func (sq *StaffQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*StaffQuery) OnlyIDX

func (sq *StaffQuery) OnlyIDX(ctx context.Context) int64

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

func (*StaffQuery) OnlyX

func (sq *StaffQuery) OnlyX(ctx context.Context) *Staff

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

func (*StaffQuery) Order

func (sq *StaffQuery) Order(o ...OrderFunc) *StaffQuery

Order adds an order step to the query.

func (*StaffQuery) Select

func (sq *StaffQuery) Select(fields ...string) *StaffSelect

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 {
	UID int64 `json:"uid,omitempty"`
}

client.Staff.Query().
	Select(staff.FieldUID).
	Scan(ctx, &v)

func (*StaffQuery) Unique

func (sq *StaffQuery) Unique(unique bool) *StaffQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*StaffQuery) Where

func (sq *StaffQuery) Where(ps ...predicate.Staff) *StaffQuery

Where adds a new predicate for the StaffQuery builder.

type StaffSelect

type StaffSelect struct {
	*StaffQuery
	// contains filtered or unexported fields
}

StaffSelect is the builder for selecting fields of Staff entities.

func (*StaffSelect) Bool

func (ss *StaffSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*StaffSelect) BoolX

func (ss *StaffSelect) BoolX(ctx context.Context) bool

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

func (*StaffSelect) Bools

func (ss *StaffSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*StaffSelect) BoolsX

func (ss *StaffSelect) BoolsX(ctx context.Context) []bool

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

func (*StaffSelect) Float64

func (ss *StaffSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*StaffSelect) Float64X

func (ss *StaffSelect) Float64X(ctx context.Context) float64

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

func (*StaffSelect) Float64s

func (ss *StaffSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*StaffSelect) Float64sX

func (ss *StaffSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*StaffSelect) Int

func (ss *StaffSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*StaffSelect) IntX

func (ss *StaffSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*StaffSelect) Ints

func (ss *StaffSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*StaffSelect) IntsX

func (ss *StaffSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*StaffSelect) Scan

func (ss *StaffSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*StaffSelect) ScanX

func (ss *StaffSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*StaffSelect) String

func (ss *StaffSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*StaffSelect) StringX

func (ss *StaffSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*StaffSelect) Strings

func (ss *StaffSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*StaffSelect) StringsX

func (ss *StaffSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type StaffUpdate

type StaffUpdate struct {
	// contains filtered or unexported fields
}

StaffUpdate is the builder for updating Staff entities.

func (*StaffUpdate) AddCreatedBy

func (su *StaffUpdate) AddCreatedBy(i int64) *StaffUpdate

AddCreatedBy adds i to the "created_by" field.

func (*StaffUpdate) AddUID

func (su *StaffUpdate) AddUID(i int64) *StaffUpdate

AddUID adds i to the "uid" field.

func (*StaffUpdate) AddUpdatedBy

func (su *StaffUpdate) AddUpdatedBy(i int64) *StaffUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*StaffUpdate) Exec

func (su *StaffUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StaffUpdate) ExecX

func (su *StaffUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StaffUpdate) Mutation

func (su *StaffUpdate) Mutation() *StaffMutation

Mutation returns the StaffMutation object of the builder.

func (*StaffUpdate) Save

func (su *StaffUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*StaffUpdate) SaveX

func (su *StaffUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*StaffUpdate) SetAvatar

func (su *StaffUpdate) SetAvatar(s string) *StaffUpdate

SetAvatar sets the "avatar" field.

func (*StaffUpdate) SetCreatedAt

func (su *StaffUpdate) SetCreatedAt(t time.Time) *StaffUpdate

SetCreatedAt sets the "created_at" field.

func (*StaffUpdate) SetCreatedBy

func (su *StaffUpdate) SetCreatedBy(i int64) *StaffUpdate

SetCreatedBy sets the "created_by" field.

func (*StaffUpdate) SetEmail

func (su *StaffUpdate) SetEmail(s string) *StaffUpdate

SetEmail sets the "email" field.

func (*StaffUpdate) SetName

func (su *StaffUpdate) SetName(s string) *StaffUpdate

SetName sets the "name" field.

func (*StaffUpdate) SetNickname

func (su *StaffUpdate) SetNickname(s string) *StaffUpdate

SetNickname sets the "nickname" field.

func (*StaffUpdate) SetNillableAvatar

func (su *StaffUpdate) SetNillableAvatar(s *string) *StaffUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*StaffUpdate) SetNillableCreatedAt

func (su *StaffUpdate) SetNillableCreatedAt(t *time.Time) *StaffUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*StaffUpdate) SetNillableCreatedBy

func (su *StaffUpdate) SetNillableCreatedBy(i *int64) *StaffUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*StaffUpdate) SetNillableEmail

func (su *StaffUpdate) SetNillableEmail(s *string) *StaffUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*StaffUpdate) SetNillableName

func (su *StaffUpdate) SetNillableName(s *string) *StaffUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*StaffUpdate) SetNillableNickname

func (su *StaffUpdate) SetNillableNickname(s *string) *StaffUpdate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*StaffUpdate) SetNillablePhone

func (su *StaffUpdate) SetNillablePhone(s *string) *StaffUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*StaffUpdate) SetNillableUID

func (su *StaffUpdate) SetNillableUID(i *int64) *StaffUpdate

SetNillableUID sets the "uid" field if the given value is not nil.

func (*StaffUpdate) SetNillableUpdatedBy

func (su *StaffUpdate) SetNillableUpdatedBy(i *int64) *StaffUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*StaffUpdate) SetPhone

func (su *StaffUpdate) SetPhone(s string) *StaffUpdate

SetPhone sets the "phone" field.

func (*StaffUpdate) SetUID

func (su *StaffUpdate) SetUID(i int64) *StaffUpdate

SetUID sets the "uid" field.

func (*StaffUpdate) SetUpdatedAt

func (su *StaffUpdate) SetUpdatedAt(t time.Time) *StaffUpdate

SetUpdatedAt sets the "updated_at" field.

func (*StaffUpdate) SetUpdatedBy

func (su *StaffUpdate) SetUpdatedBy(i int64) *StaffUpdate

SetUpdatedBy sets the "updated_by" field.

func (*StaffUpdate) Where

func (su *StaffUpdate) Where(ps ...predicate.Staff) *StaffUpdate

Where appends a list predicates to the StaffUpdate builder.

type StaffUpdateOne

type StaffUpdateOne struct {
	// contains filtered or unexported fields
}

StaffUpdateOne is the builder for updating a single Staff entity.

func (*StaffUpdateOne) AddCreatedBy

func (suo *StaffUpdateOne) AddCreatedBy(i int64) *StaffUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*StaffUpdateOne) AddUID

func (suo *StaffUpdateOne) AddUID(i int64) *StaffUpdateOne

AddUID adds i to the "uid" field.

func (*StaffUpdateOne) AddUpdatedBy

func (suo *StaffUpdateOne) AddUpdatedBy(i int64) *StaffUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*StaffUpdateOne) Exec

func (suo *StaffUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StaffUpdateOne) ExecX

func (suo *StaffUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StaffUpdateOne) Mutation

func (suo *StaffUpdateOne) Mutation() *StaffMutation

Mutation returns the StaffMutation object of the builder.

func (*StaffUpdateOne) Save

func (suo *StaffUpdateOne) Save(ctx context.Context) (*Staff, error)

Save executes the query and returns the updated Staff entity.

func (*StaffUpdateOne) SaveX

func (suo *StaffUpdateOne) SaveX(ctx context.Context) *Staff

SaveX is like Save, but panics if an error occurs.

func (*StaffUpdateOne) Select

func (suo *StaffUpdateOne) Select(field string, fields ...string) *StaffUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*StaffUpdateOne) SetAvatar

func (suo *StaffUpdateOne) SetAvatar(s string) *StaffUpdateOne

SetAvatar sets the "avatar" field.

func (*StaffUpdateOne) SetCreatedAt

func (suo *StaffUpdateOne) SetCreatedAt(t time.Time) *StaffUpdateOne

SetCreatedAt sets the "created_at" field.

func (*StaffUpdateOne) SetCreatedBy

func (suo *StaffUpdateOne) SetCreatedBy(i int64) *StaffUpdateOne

SetCreatedBy sets the "created_by" field.

func (*StaffUpdateOne) SetEmail

func (suo *StaffUpdateOne) SetEmail(s string) *StaffUpdateOne

SetEmail sets the "email" field.

func (*StaffUpdateOne) SetName

func (suo *StaffUpdateOne) SetName(s string) *StaffUpdateOne

SetName sets the "name" field.

func (*StaffUpdateOne) SetNickname

func (suo *StaffUpdateOne) SetNickname(s string) *StaffUpdateOne

SetNickname sets the "nickname" field.

func (*StaffUpdateOne) SetNillableAvatar

func (suo *StaffUpdateOne) SetNillableAvatar(s *string) *StaffUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableCreatedAt

func (suo *StaffUpdateOne) SetNillableCreatedAt(t *time.Time) *StaffUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableCreatedBy

func (suo *StaffUpdateOne) SetNillableCreatedBy(i *int64) *StaffUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableEmail

func (suo *StaffUpdateOne) SetNillableEmail(s *string) *StaffUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableName

func (suo *StaffUpdateOne) SetNillableName(s *string) *StaffUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableNickname

func (suo *StaffUpdateOne) SetNillableNickname(s *string) *StaffUpdateOne

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*StaffUpdateOne) SetNillablePhone

func (suo *StaffUpdateOne) SetNillablePhone(s *string) *StaffUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableUID

func (suo *StaffUpdateOne) SetNillableUID(i *int64) *StaffUpdateOne

SetNillableUID sets the "uid" field if the given value is not nil.

func (*StaffUpdateOne) SetNillableUpdatedBy

func (suo *StaffUpdateOne) SetNillableUpdatedBy(i *int64) *StaffUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*StaffUpdateOne) SetPhone

func (suo *StaffUpdateOne) SetPhone(s string) *StaffUpdateOne

SetPhone sets the "phone" field.

func (*StaffUpdateOne) SetUID

func (suo *StaffUpdateOne) SetUID(i int64) *StaffUpdateOne

SetUID sets the "uid" field.

func (*StaffUpdateOne) SetUpdatedAt

func (suo *StaffUpdateOne) SetUpdatedAt(t time.Time) *StaffUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*StaffUpdateOne) SetUpdatedBy

func (suo *StaffUpdateOne) SetUpdatedBy(i int64) *StaffUpdateOne

SetUpdatedBy sets the "updated_by" field.

type Staffs

type Staffs []*Staff

Staffs is a parsable slice of Staff.

type Tx

type Tx struct {

	// Api is the client for interacting with the Api builders.
	Api *ApiClient
	// DictData is the client for interacting with the DictData builders.
	DictData *DictDataClient
	// DictType is the client for interacting with the DictType builders.
	DictType *DictTypeClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Staff is the client for interacting with the Staff builders.
	Staff *StaffClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserRole is the client for interacting with the UserRole builders.
	UserRole *UserRoleClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	// 用户id
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// CreatedBy holds the value of the "created_by" field.
	// 更新人
	CreatedBy int64 `json:"created_by,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UpdatedBy holds the value of the "updated_by" field.
	// 更新人
	UpdatedBy int64 `json:"updated_by,omitempty"`
	// UID holds the value of the "uid" field.
	// 账号id
	UID int64 `json:"uid,omitempty"`
	// Nickname holds the value of the "nickname" field.
	// 昵称
	Nickname string `json:"nickname,omitempty"`
	// Avatar holds the value of the "avatar" field.
	// 头像
	Avatar string `json:"avatar,omitempty"`
	// Gender holds the value of the "gender" field.
	// 性别
	Gender user.Gender `json:"gender,omitempty"`
	// Remark holds the value of the "remark" field.
	// 备注
	Remark string `json:"remark,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryRoles

func (u *User) QueryRoles() *RoleQuery

QueryRoles queries the "roles" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int64) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int64) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int64) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryRoles

func (c *UserClient) QueryRoles(u *User) *RoleQuery

QueryRoles queries the roles edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddRoleIDs

func (uc *UserCreate) AddRoleIDs(ids ...int64) *UserCreate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserCreate) AddRoles

func (uc *UserCreate) AddRoles(r ...*Role) *UserCreate

AddRoles adds the "roles" edges to the Role entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAvatar

func (uc *UserCreate) SetAvatar(s string) *UserCreate

SetAvatar sets the "avatar" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetCreatedBy

func (uc *UserCreate) SetCreatedBy(i int64) *UserCreate

SetCreatedBy sets the "created_by" field.

func (*UserCreate) SetGender

func (uc *UserCreate) SetGender(u user.Gender) *UserCreate

SetGender sets the "gender" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int64) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetNickname

func (uc *UserCreate) SetNickname(s string) *UserCreate

SetNickname sets the "nickname" field.

func (*UserCreate) SetNillableAvatar

func (uc *UserCreate) SetNillableAvatar(s *string) *UserCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedBy

func (uc *UserCreate) SetNillableCreatedBy(i *int64) *UserCreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserCreate) SetNillableGender

func (uc *UserCreate) SetNillableGender(u *user.Gender) *UserCreate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserCreate) SetNillableNickname

func (uc *UserCreate) SetNillableNickname(s *string) *UserCreate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserCreate) SetNillableRemark

func (uc *UserCreate) SetNillableRemark(s *string) *UserCreate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*UserCreate) SetNillableUID

func (uc *UserCreate) SetNillableUID(i *int64) *UserCreate

SetNillableUID sets the "uid" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedBy

func (uc *UserCreate) SetNillableUpdatedBy(i *int64) *UserCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserCreate) SetRemark

func (uc *UserCreate) SetRemark(s string) *UserCreate

SetRemark sets the "remark" field.

func (*UserCreate) SetUID

func (uc *UserCreate) SetUID(i int64) *UserCreate

SetUID sets the "uid" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUpdatedBy

func (uc *UserCreate) SetUpdatedBy(i int64) *UserCreate

SetUpdatedBy sets the "updated_by" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserEdges

type UserEdges struct {
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) RolesOrErr

func (e UserEdges) RolesOrErr() ([]*Role, error)

RolesOrErr returns the Roles value or an error if the edge was not loaded in eager-loading.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) 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 (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) 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 (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) 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 (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) 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 (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (ugb *UserGroupBy) 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 (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) 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 (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (ugb *UserGroupBy) 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 (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) 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 (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddCreatedBy

func (m *UserMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddRoleIDs

func (m *UserMutation) AddRoleIDs(ids ...int64)

AddRoleIDs adds the "roles" edge to the Role entity by ids.

func (*UserMutation) AddUID

func (m *UserMutation) AddUID(i int64)

AddUID adds i to the "uid" field.

func (*UserMutation) AddUpdatedBy

func (m *UserMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*UserMutation) AddedCreatedBy

func (m *UserMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) AddedUID

func (m *UserMutation) AddedUID() (r int64, exists bool)

AddedUID returns the value that was added to the "uid" field in this mutation.

func (*UserMutation) AddedUpdatedBy

func (m *UserMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*UserMutation) Avatar

func (m *UserMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearRoles

func (m *UserMutation) ClearRoles()

ClearRoles clears the "roles" edge to the Role entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) CreatedBy

func (m *UserMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) Gender

func (m *UserMutation) Gender() (r user.Gender, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int64, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) Nickname

func (m *UserMutation) Nickname() (r string, exists bool)

Nickname returns the value of the "nickname" field in the mutation.

func (*UserMutation) OldAvatar

func (m *UserMutation) OldAvatar(ctx context.Context) (v string, err error)

OldAvatar returns the old "avatar" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedBy

func (m *UserMutation) OldCreatedBy(ctx context.Context) (v int64, err error)

OldCreatedBy returns the old "created_by" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldGender

func (m *UserMutation) OldGender(ctx context.Context) (v user.Gender, err error)

OldGender returns the old "gender" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldNickname

func (m *UserMutation) OldNickname(ctx context.Context) (v string, err error)

OldNickname returns the old "nickname" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRemark

func (m *UserMutation) OldRemark(ctx context.Context) (v string, err error)

OldRemark returns the old "remark" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUID

func (m *UserMutation) OldUID(ctx context.Context) (v int64, err error)

OldUID returns the old "uid" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedBy

func (m *UserMutation) OldUpdatedBy(ctx context.Context) (v int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Remark

func (m *UserMutation) Remark() (r string, exists bool)

Remark returns the value of the "remark" field in the mutation.

func (*UserMutation) RemoveRoleIDs

func (m *UserMutation) RemoveRoleIDs(ids ...int64)

RemoveRoleIDs removes the "roles" edge to the Role entity by IDs.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedRolesIDs

func (m *UserMutation) RemovedRolesIDs() (ids []int64)

RemovedRoles returns the removed IDs of the "roles" edge to the Role entity.

func (*UserMutation) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetCreatedBy

func (m *UserMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetGender

func (m *UserMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*UserMutation) ResetNickname

func (m *UserMutation) ResetNickname()

ResetNickname resets all changes to the "nickname" field.

func (*UserMutation) ResetRemark

func (m *UserMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*UserMutation) ResetRoles

func (m *UserMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*UserMutation) ResetUID

func (m *UserMutation) ResetUID()

ResetUID resets all changes to the "uid" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUpdatedBy

func (m *UserMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*UserMutation) RolesCleared

func (m *UserMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Role entity was cleared.

func (*UserMutation) RolesIDs

func (m *UserMutation) RolesIDs() (ids []int64)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetCreatedBy

func (m *UserMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetGender

func (m *UserMutation) SetGender(u user.Gender)

SetGender sets the "gender" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetNickname

func (m *UserMutation) SetNickname(s string)

SetNickname sets the "nickname" field.

func (*UserMutation) SetRemark

func (m *UserMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*UserMutation) SetUID

func (m *UserMutation) SetUID(i int64)

SetUID sets the "uid" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUpdatedBy

func (m *UserMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UID

func (m *UserMutation) UID() (r int64, exists bool)

UID returns the value of the "uid" field in the mutation.

func (*UserMutation) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) UpdatedBy

func (m *UserMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int64, error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryRoles

func (uq *UserQuery) QueryRoles() *RoleQuery

QueryRoles chains the current query on the "roles" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithRoles

func (uq *UserQuery) WithRoles(opts ...func(*RoleQuery)) *UserQuery

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 UserRole

type UserRole struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UserID holds the value of the "user_id" field.
	// 用户ID
	UserID int64 `json:"user_id,omitempty"`
	// RoleID holds the value of the "role_id" field.
	// 角色ID
	RoleID int64 `json:"role_id,omitempty"`
	// contains filtered or unexported fields
}

UserRole is the model entity for the UserRole schema.

func (*UserRole) String

func (ur *UserRole) String() string

String implements the fmt.Stringer.

func (*UserRole) Unwrap

func (ur *UserRole) Unwrap() *UserRole

Unwrap unwraps the UserRole 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 (*UserRole) Update

func (ur *UserRole) Update() *UserRoleUpdateOne

Update returns a builder for updating this UserRole. Note that you need to call UserRole.Unwrap() before calling this method if this UserRole was returned from a transaction, and the transaction was committed or rolled back.

type UserRoleClient

type UserRoleClient struct {
	// contains filtered or unexported fields
}

UserRoleClient is a client for the UserRole schema.

func NewUserRoleClient

func NewUserRoleClient(c config) *UserRoleClient

NewUserRoleClient returns a client for the UserRole from the given config.

func (*UserRoleClient) Create

func (c *UserRoleClient) Create() *UserRoleCreate

Create returns a create builder for UserRole.

func (*UserRoleClient) CreateBulk

func (c *UserRoleClient) CreateBulk(builders ...*UserRoleCreate) *UserRoleCreateBulk

CreateBulk returns a builder for creating a bulk of UserRole entities.

func (*UserRoleClient) Delete

func (c *UserRoleClient) Delete() *UserRoleDelete

Delete returns a delete builder for UserRole.

func (*UserRoleClient) DeleteOne

func (c *UserRoleClient) DeleteOne(ur *UserRole) *UserRoleDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserRoleClient) DeleteOneID

func (c *UserRoleClient) DeleteOneID(id int) *UserRoleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserRoleClient) Get

func (c *UserRoleClient) Get(ctx context.Context, id int) (*UserRole, error)

Get returns a UserRole entity by its id.

func (*UserRoleClient) GetX

func (c *UserRoleClient) GetX(ctx context.Context, id int) *UserRole

GetX is like Get, but panics if an error occurs.

func (*UserRoleClient) Hooks

func (c *UserRoleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserRoleClient) Query

func (c *UserRoleClient) Query() *UserRoleQuery

Query returns a query builder for UserRole.

func (*UserRoleClient) Update

func (c *UserRoleClient) Update() *UserRoleUpdate

Update returns an update builder for UserRole.

func (*UserRoleClient) UpdateOne

func (c *UserRoleClient) UpdateOne(ur *UserRole) *UserRoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserRoleClient) UpdateOneID

func (c *UserRoleClient) UpdateOneID(id int) *UserRoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserRoleClient) Use

func (c *UserRoleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `userrole.Hooks(f(g(h())))`.

type UserRoleCreate

type UserRoleCreate struct {
	// contains filtered or unexported fields
}

UserRoleCreate is the builder for creating a UserRole entity.

func (*UserRoleCreate) Exec

func (urc *UserRoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleCreate) ExecX

func (urc *UserRoleCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleCreate) Mutation

func (urc *UserRoleCreate) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleCreate) Save

func (urc *UserRoleCreate) Save(ctx context.Context) (*UserRole, error)

Save creates the UserRole in the database.

func (*UserRoleCreate) SaveX

func (urc *UserRoleCreate) SaveX(ctx context.Context) *UserRole

SaveX calls Save and panics if Save returns an error.

func (*UserRoleCreate) SetNillableRoleID

func (urc *UserRoleCreate) SetNillableRoleID(i *int64) *UserRoleCreate

SetNillableRoleID sets the "role_id" field if the given value is not nil.

func (*UserRoleCreate) SetNillableUserID

func (urc *UserRoleCreate) SetNillableUserID(i *int64) *UserRoleCreate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserRoleCreate) SetRoleID

func (urc *UserRoleCreate) SetRoleID(i int64) *UserRoleCreate

SetRoleID sets the "role_id" field.

func (*UserRoleCreate) SetUserID

func (urc *UserRoleCreate) SetUserID(i int64) *UserRoleCreate

SetUserID sets the "user_id" field.

type UserRoleCreateBulk

type UserRoleCreateBulk struct {
	// contains filtered or unexported fields
}

UserRoleCreateBulk is the builder for creating many UserRole entities in bulk.

func (*UserRoleCreateBulk) Exec

func (urcb *UserRoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleCreateBulk) ExecX

func (urcb *UserRoleCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleCreateBulk) Save

func (urcb *UserRoleCreateBulk) Save(ctx context.Context) ([]*UserRole, error)

Save creates the UserRole entities in the database.

func (*UserRoleCreateBulk) SaveX

func (urcb *UserRoleCreateBulk) SaveX(ctx context.Context) []*UserRole

SaveX is like Save, but panics if an error occurs.

type UserRoleDelete

type UserRoleDelete struct {
	// contains filtered or unexported fields
}

UserRoleDelete is the builder for deleting a UserRole entity.

func (*UserRoleDelete) Exec

func (urd *UserRoleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserRoleDelete) ExecX

func (urd *UserRoleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleDelete) Where

func (urd *UserRoleDelete) Where(ps ...predicate.UserRole) *UserRoleDelete

Where appends a list predicates to the UserRoleDelete builder.

type UserRoleDeleteOne

type UserRoleDeleteOne struct {
	// contains filtered or unexported fields
}

UserRoleDeleteOne is the builder for deleting a single UserRole entity.

func (*UserRoleDeleteOne) Exec

func (urdo *UserRoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserRoleDeleteOne) ExecX

func (urdo *UserRoleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserRoleGroupBy

type UserRoleGroupBy struct {
	// contains filtered or unexported fields
}

UserRoleGroupBy is the group-by builder for UserRole entities.

func (*UserRoleGroupBy) Aggregate

func (urgb *UserRoleGroupBy) Aggregate(fns ...AggregateFunc) *UserRoleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserRoleGroupBy) Bool

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) BoolX

func (urgb *UserRoleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserRoleGroupBy) Bools

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) BoolsX

func (urgb *UserRoleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserRoleGroupBy) Float64

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) Float64X

func (urgb *UserRoleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserRoleGroupBy) Float64s

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) Float64sX

func (urgb *UserRoleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserRoleGroupBy) Int

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) IntX

func (urgb *UserRoleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserRoleGroupBy) Ints

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) IntsX

func (urgb *UserRoleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserRoleGroupBy) Scan

func (urgb *UserRoleGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserRoleGroupBy) ScanX

func (urgb *UserRoleGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserRoleGroupBy) String

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) StringX

func (urgb *UserRoleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserRoleGroupBy) Strings

func (urgb *UserRoleGroupBy) 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 (*UserRoleGroupBy) StringsX

func (urgb *UserRoleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserRoleMutation

type UserRoleMutation struct {
	// contains filtered or unexported fields
}

UserRoleMutation represents an operation that mutates the UserRole nodes in the graph.

func (*UserRoleMutation) AddField

func (m *UserRoleMutation) 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 (*UserRoleMutation) AddRoleID

func (m *UserRoleMutation) AddRoleID(i int64)

AddRoleID adds i to the "role_id" field.

func (*UserRoleMutation) AddUserID

func (m *UserRoleMutation) AddUserID(i int64)

AddUserID adds i to the "user_id" field.

func (*UserRoleMutation) AddedEdges

func (m *UserRoleMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserRoleMutation) AddedField

func (m *UserRoleMutation) 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 (*UserRoleMutation) AddedFields

func (m *UserRoleMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserRoleMutation) AddedIDs

func (m *UserRoleMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserRoleMutation) AddedRoleID

func (m *UserRoleMutation) AddedRoleID() (r int64, exists bool)

AddedRoleID returns the value that was added to the "role_id" field in this mutation.

func (*UserRoleMutation) AddedUserID

func (m *UserRoleMutation) AddedUserID() (r int64, exists bool)

AddedUserID returns the value that was added to the "user_id" field in this mutation.

func (*UserRoleMutation) ClearEdge

func (m *UserRoleMutation) 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 (*UserRoleMutation) ClearField

func (m *UserRoleMutation) 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 (*UserRoleMutation) ClearedEdges

func (m *UserRoleMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserRoleMutation) ClearedFields

func (m *UserRoleMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserRoleMutation) Client

func (m UserRoleMutation) 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 (*UserRoleMutation) EdgeCleared

func (m *UserRoleMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserRoleMutation) Field

func (m *UserRoleMutation) 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 (*UserRoleMutation) FieldCleared

func (m *UserRoleMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserRoleMutation) Fields

func (m *UserRoleMutation) 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 (*UserRoleMutation) ID

func (m *UserRoleMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserRoleMutation) IDs

func (m *UserRoleMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserRoleMutation) OldField

func (m *UserRoleMutation) 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 (*UserRoleMutation) OldRoleID

func (m *UserRoleMutation) OldRoleID(ctx context.Context) (v int64, err error)

OldRoleID returns the old "role_id" field's value of the UserRole entity. If the UserRole 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 (*UserRoleMutation) OldUserID

func (m *UserRoleMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the UserRole entity. If the UserRole 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 (*UserRoleMutation) Op

func (m *UserRoleMutation) Op() Op

Op returns the operation name.

func (*UserRoleMutation) RemovedEdges

func (m *UserRoleMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserRoleMutation) RemovedIDs

func (m *UserRoleMutation) 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 (*UserRoleMutation) ResetEdge

func (m *UserRoleMutation) 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 (*UserRoleMutation) ResetField

func (m *UserRoleMutation) 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 (*UserRoleMutation) ResetRoleID

func (m *UserRoleMutation) ResetRoleID()

ResetRoleID resets all changes to the "role_id" field.

func (*UserRoleMutation) ResetUserID

func (m *UserRoleMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserRoleMutation) RoleID

func (m *UserRoleMutation) RoleID() (r int64, exists bool)

RoleID returns the value of the "role_id" field in the mutation.

func (*UserRoleMutation) SetField

func (m *UserRoleMutation) 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 (*UserRoleMutation) SetRoleID

func (m *UserRoleMutation) SetRoleID(i int64)

SetRoleID sets the "role_id" field.

func (*UserRoleMutation) SetUserID

func (m *UserRoleMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (UserRoleMutation) Tx

func (m UserRoleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserRoleMutation) Type

func (m *UserRoleMutation) Type() string

Type returns the node type of this mutation (UserRole).

func (*UserRoleMutation) UserID

func (m *UserRoleMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserRoleMutation) Where

func (m *UserRoleMutation) Where(ps ...predicate.UserRole)

Where appends a list predicates to the UserRoleMutation builder.

type UserRoleQuery

type UserRoleQuery struct {
	// contains filtered or unexported fields
}

UserRoleQuery is the builder for querying UserRole entities.

func (*UserRoleQuery) All

func (urq *UserRoleQuery) All(ctx context.Context) ([]*UserRole, error)

All executes the query and returns a list of UserRoles.

func (*UserRoleQuery) AllX

func (urq *UserRoleQuery) AllX(ctx context.Context) []*UserRole

AllX is like All, but panics if an error occurs.

func (*UserRoleQuery) Clone

func (urq *UserRoleQuery) Clone() *UserRoleQuery

Clone returns a duplicate of the UserRoleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserRoleQuery) Count

func (urq *UserRoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserRoleQuery) CountX

func (urq *UserRoleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserRoleQuery) Exist

func (urq *UserRoleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserRoleQuery) ExistX

func (urq *UserRoleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserRoleQuery) First

func (urq *UserRoleQuery) First(ctx context.Context) (*UserRole, error)

First returns the first UserRole entity from the query. Returns a *NotFoundError when no UserRole was found.

func (*UserRoleQuery) FirstID

func (urq *UserRoleQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UserRole ID from the query. Returns a *NotFoundError when no UserRole ID was found.

func (*UserRoleQuery) FirstIDX

func (urq *UserRoleQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserRoleQuery) FirstX

func (urq *UserRoleQuery) FirstX(ctx context.Context) *UserRole

FirstX is like First, but panics if an error occurs.

func (*UserRoleQuery) GroupBy

func (urq *UserRoleQuery) GroupBy(field string, fields ...string) *UserRoleGroupBy

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 {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserRole.Query().
	GroupBy(userrole.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserRoleQuery) IDs

func (urq *UserRoleQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of UserRole IDs.

func (*UserRoleQuery) IDsX

func (urq *UserRoleQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserRoleQuery) Limit

func (urq *UserRoleQuery) Limit(limit int) *UserRoleQuery

Limit adds a limit step to the query.

func (*UserRoleQuery) Offset

func (urq *UserRoleQuery) Offset(offset int) *UserRoleQuery

Offset adds an offset step to the query.

func (*UserRoleQuery) Only

func (urq *UserRoleQuery) Only(ctx context.Context) (*UserRole, error)

Only returns a single UserRole entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserRole entity is found. Returns a *NotFoundError when no UserRole entities are found.

func (*UserRoleQuery) OnlyID

func (urq *UserRoleQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UserRole ID in the query. Returns a *NotSingularError when more than one UserRole ID is found. Returns a *NotFoundError when no entities are found.

func (*UserRoleQuery) OnlyIDX

func (urq *UserRoleQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserRoleQuery) OnlyX

func (urq *UserRoleQuery) OnlyX(ctx context.Context) *UserRole

OnlyX is like Only, but panics if an error occurs.

func (*UserRoleQuery) Order

func (urq *UserRoleQuery) Order(o ...OrderFunc) *UserRoleQuery

Order adds an order step to the query.

func (*UserRoleQuery) Select

func (urq *UserRoleQuery) Select(fields ...string) *UserRoleSelect

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 {
	UserID int64 `json:"user_id,omitempty"`
}

client.UserRole.Query().
	Select(userrole.FieldUserID).
	Scan(ctx, &v)

func (*UserRoleQuery) Unique

func (urq *UserRoleQuery) Unique(unique bool) *UserRoleQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserRoleQuery) Where

func (urq *UserRoleQuery) Where(ps ...predicate.UserRole) *UserRoleQuery

Where adds a new predicate for the UserRoleQuery builder.

type UserRoleSelect

type UserRoleSelect struct {
	*UserRoleQuery
	// contains filtered or unexported fields
}

UserRoleSelect is the builder for selecting fields of UserRole entities.

func (*UserRoleSelect) Bool

func (urs *UserRoleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) BoolX

func (urs *UserRoleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserRoleSelect) Bools

func (urs *UserRoleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) BoolsX

func (urs *UserRoleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserRoleSelect) Float64

func (urs *UserRoleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) Float64X

func (urs *UserRoleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserRoleSelect) Float64s

func (urs *UserRoleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) Float64sX

func (urs *UserRoleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserRoleSelect) Int

func (urs *UserRoleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) IntX

func (urs *UserRoleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserRoleSelect) Ints

func (urs *UserRoleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) IntsX

func (urs *UserRoleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserRoleSelect) Scan

func (urs *UserRoleSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserRoleSelect) ScanX

func (urs *UserRoleSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserRoleSelect) String

func (urs *UserRoleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) StringX

func (urs *UserRoleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserRoleSelect) Strings

func (urs *UserRoleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) StringsX

func (urs *UserRoleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserRoleUpdate

type UserRoleUpdate struct {
	// contains filtered or unexported fields
}

UserRoleUpdate is the builder for updating UserRole entities.

func (*UserRoleUpdate) AddRoleID

func (uru *UserRoleUpdate) AddRoleID(i int64) *UserRoleUpdate

AddRoleID adds i to the "role_id" field.

func (*UserRoleUpdate) AddUserID

func (uru *UserRoleUpdate) AddUserID(i int64) *UserRoleUpdate

AddUserID adds i to the "user_id" field.

func (*UserRoleUpdate) Exec

func (uru *UserRoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleUpdate) ExecX

func (uru *UserRoleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpdate) Mutation

func (uru *UserRoleUpdate) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleUpdate) Save

func (uru *UserRoleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserRoleUpdate) SaveX

func (uru *UserRoleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserRoleUpdate) SetNillableRoleID

func (uru *UserRoleUpdate) SetNillableRoleID(i *int64) *UserRoleUpdate

SetNillableRoleID sets the "role_id" field if the given value is not nil.

func (*UserRoleUpdate) SetNillableUserID

func (uru *UserRoleUpdate) SetNillableUserID(i *int64) *UserRoleUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserRoleUpdate) SetRoleID

func (uru *UserRoleUpdate) SetRoleID(i int64) *UserRoleUpdate

SetRoleID sets the "role_id" field.

func (*UserRoleUpdate) SetUserID

func (uru *UserRoleUpdate) SetUserID(i int64) *UserRoleUpdate

SetUserID sets the "user_id" field.

func (*UserRoleUpdate) Where

func (uru *UserRoleUpdate) Where(ps ...predicate.UserRole) *UserRoleUpdate

Where appends a list predicates to the UserRoleUpdate builder.

type UserRoleUpdateOne

type UserRoleUpdateOne struct {
	// contains filtered or unexported fields
}

UserRoleUpdateOne is the builder for updating a single UserRole entity.

func (*UserRoleUpdateOne) AddRoleID

func (uruo *UserRoleUpdateOne) AddRoleID(i int64) *UserRoleUpdateOne

AddRoleID adds i to the "role_id" field.

func (*UserRoleUpdateOne) AddUserID

func (uruo *UserRoleUpdateOne) AddUserID(i int64) *UserRoleUpdateOne

AddUserID adds i to the "user_id" field.

func (*UserRoleUpdateOne) Exec

func (uruo *UserRoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserRoleUpdateOne) ExecX

func (uruo *UserRoleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpdateOne) Mutation

func (uruo *UserRoleUpdateOne) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleUpdateOne) Save

func (uruo *UserRoleUpdateOne) Save(ctx context.Context) (*UserRole, error)

Save executes the query and returns the updated UserRole entity.

func (*UserRoleUpdateOne) SaveX

func (uruo *UserRoleUpdateOne) SaveX(ctx context.Context) *UserRole

SaveX is like Save, but panics if an error occurs.

func (*UserRoleUpdateOne) Select

func (uruo *UserRoleUpdateOne) Select(field string, fields ...string) *UserRoleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserRoleUpdateOne) SetNillableRoleID

func (uruo *UserRoleUpdateOne) SetNillableRoleID(i *int64) *UserRoleUpdateOne

SetNillableRoleID sets the "role_id" field if the given value is not nil.

func (*UserRoleUpdateOne) SetNillableUserID

func (uruo *UserRoleUpdateOne) SetNillableUserID(i *int64) *UserRoleUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserRoleUpdateOne) SetRoleID

func (uruo *UserRoleUpdateOne) SetRoleID(i int64) *UserRoleUpdateOne

SetRoleID sets the "role_id" field.

func (*UserRoleUpdateOne) SetUserID

func (uruo *UserRoleUpdateOne) SetUserID(i int64) *UserRoleUpdateOne

SetUserID sets the "user_id" field.

type UserRoles

type UserRoles []*UserRole

UserRoles is a parsable slice of UserRole.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddCreatedBy

func (uu *UserUpdate) AddCreatedBy(i int64) *UserUpdate

AddCreatedBy adds i to the "created_by" field.

func (*UserUpdate) AddRoleIDs

func (uu *UserUpdate) AddRoleIDs(ids ...int64) *UserUpdate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserUpdate) AddRoles

func (uu *UserUpdate) AddRoles(r ...*Role) *UserUpdate

AddRoles adds the "roles" edges to the Role entity.

func (*UserUpdate) AddUID

func (uu *UserUpdate) AddUID(i int64) *UserUpdate

AddUID adds i to the "uid" field.

func (*UserUpdate) AddUpdatedBy

func (uu *UserUpdate) AddUpdatedBy(i int64) *UserUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*UserUpdate) ClearRoles

func (uu *UserUpdate) ClearRoles() *UserUpdate

ClearRoles clears all "roles" edges to the Role entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveRoleIDs

func (uu *UserUpdate) RemoveRoleIDs(ids ...int64) *UserUpdate

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*UserUpdate) RemoveRoles

func (uu *UserUpdate) RemoveRoles(r ...*Role) *UserUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAvatar

func (uu *UserUpdate) SetAvatar(s string) *UserUpdate

SetAvatar sets the "avatar" field.

func (*UserUpdate) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetCreatedBy

func (uu *UserUpdate) SetCreatedBy(i int64) *UserUpdate

SetCreatedBy sets the "created_by" field.

func (*UserUpdate) SetGender

func (uu *UserUpdate) SetGender(u user.Gender) *UserUpdate

SetGender sets the "gender" field.

func (*UserUpdate) SetNickname

func (uu *UserUpdate) SetNickname(s string) *UserUpdate

SetNickname sets the "nickname" field.

func (*UserUpdate) SetNillableAvatar

func (uu *UserUpdate) SetNillableAvatar(s *string) *UserUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdate) SetNillableCreatedAt

func (uu *UserUpdate) SetNillableCreatedAt(t *time.Time) *UserUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdate) SetNillableCreatedBy

func (uu *UserUpdate) SetNillableCreatedBy(i *int64) *UserUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserUpdate) SetNillableGender

func (uu *UserUpdate) SetNillableGender(u *user.Gender) *UserUpdate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdate) SetNillableNickname

func (uu *UserUpdate) SetNillableNickname(s *string) *UserUpdate

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserUpdate) SetNillableRemark

func (uu *UserUpdate) SetNillableRemark(s *string) *UserUpdate

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*UserUpdate) SetNillableUID

func (uu *UserUpdate) SetNillableUID(i *int64) *UserUpdate

SetNillableUID sets the "uid" field if the given value is not nil.

func (*UserUpdate) SetNillableUpdatedBy

func (uu *UserUpdate) SetNillableUpdatedBy(i *int64) *UserUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserUpdate) SetRemark

func (uu *UserUpdate) SetRemark(s string) *UserUpdate

SetRemark sets the "remark" field.

func (*UserUpdate) SetUID

func (uu *UserUpdate) SetUID(i int64) *UserUpdate

SetUID sets the "uid" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUpdatedBy

func (uu *UserUpdate) SetUpdatedBy(i int64) *UserUpdate

SetUpdatedBy sets the "updated_by" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddCreatedBy

func (uuo *UserUpdateOne) AddCreatedBy(i int64) *UserUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*UserUpdateOne) AddRoleIDs

func (uuo *UserUpdateOne) AddRoleIDs(ids ...int64) *UserUpdateOne

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserUpdateOne) AddRoles

func (uuo *UserUpdateOne) AddRoles(r ...*Role) *UserUpdateOne

AddRoles adds the "roles" edges to the Role entity.

func (*UserUpdateOne) AddUID

func (uuo *UserUpdateOne) AddUID(i int64) *UserUpdateOne

AddUID adds i to the "uid" field.

func (*UserUpdateOne) AddUpdatedBy

func (uuo *UserUpdateOne) AddUpdatedBy(i int64) *UserUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*UserUpdateOne) ClearRoles

func (uuo *UserUpdateOne) ClearRoles() *UserUpdateOne

ClearRoles clears all "roles" edges to the Role entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveRoleIDs

func (uuo *UserUpdateOne) RemoveRoleIDs(ids ...int64) *UserUpdateOne

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*UserUpdateOne) RemoveRoles

func (uuo *UserUpdateOne) RemoveRoles(r ...*Role) *UserUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAvatar

func (uuo *UserUpdateOne) SetAvatar(s string) *UserUpdateOne

SetAvatar sets the "avatar" field.

func (*UserUpdateOne) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetCreatedBy

func (uuo *UserUpdateOne) SetCreatedBy(i int64) *UserUpdateOne

SetCreatedBy sets the "created_by" field.

func (*UserUpdateOne) SetGender

func (uuo *UserUpdateOne) SetGender(u user.Gender) *UserUpdateOne

SetGender sets the "gender" field.

func (*UserUpdateOne) SetNickname

func (uuo *UserUpdateOne) SetNickname(s string) *UserUpdateOne

SetNickname sets the "nickname" field.

func (*UserUpdateOne) SetNillableAvatar

func (uuo *UserUpdateOne) SetNillableAvatar(s *string) *UserUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCreatedAt

func (uuo *UserUpdateOne) SetNillableCreatedAt(t *time.Time) *UserUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCreatedBy

func (uuo *UserUpdateOne) SetNillableCreatedBy(i *int64) *UserUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserUpdateOne) SetNillableGender

func (uuo *UserUpdateOne) SetNillableGender(u *user.Gender) *UserUpdateOne

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdateOne) SetNillableNickname

func (uuo *UserUpdateOne) SetNillableNickname(s *string) *UserUpdateOne

SetNillableNickname sets the "nickname" field if the given value is not nil.

func (*UserUpdateOne) SetNillableRemark

func (uuo *UserUpdateOne) SetNillableRemark(s *string) *UserUpdateOne

SetNillableRemark sets the "remark" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUID

func (uuo *UserUpdateOne) SetNillableUID(i *int64) *UserUpdateOne

SetNillableUID sets the "uid" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUpdatedBy

func (uuo *UserUpdateOne) SetNillableUpdatedBy(i *int64) *UserUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserUpdateOne) SetRemark

func (uuo *UserUpdateOne) SetRemark(s string) *UserUpdateOne

SetRemark sets the "remark" field.

func (*UserUpdateOne) SetUID

func (uuo *UserUpdateOne) SetUID(i int64) *UserUpdateOne

SetUID sets the "uid" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUpdatedBy

func (uuo *UserUpdateOne) SetUpdatedBy(i int64) *UserUpdateOne

SetUpdatedBy sets the "updated_by" field.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL