ent

package
v0.0.0-...-a7b145a Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: BSD-2-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeAuthzPolicy = "AuthzPolicy"
	TypeRole        = "Role"
	TypeTenant      = "Tenant"
	TypeUser        = "User"
)

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 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 AuthzPolicies

type AuthzPolicies []*AuthzPolicy

AuthzPolicies is a parsable slice of AuthzPolicy.

type AuthzPolicy

type AuthzPolicy struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// PolicyName holds the value of the "policy_name" field.
	PolicyName string `json:"policy_name,omitempty"`
	// Obj holds the value of the "obj" field.
	Obj string `json:"obj,omitempty"`
	// Policy holds the value of the "policy" field.
	Policy *string `json:"policy,omitempty"`
	// Status holds the value of the "status" field.
	// active or disable or delete
	Status string `json:"status,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime *time.Time `json:"update_time,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuthzPolicyQuery when eager-loading is set.
	Edges AuthzPolicyEdges `json:"edges"`
	// contains filtered or unexported fields
}

AuthzPolicy is the model entity for the AuthzPolicy schema.

func (*AuthzPolicy) QueryCreateBy

func (ap *AuthzPolicy) QueryCreateBy() *UserQuery

QueryCreateBy queries the "create_by" edge of the AuthzPolicy entity.

func (*AuthzPolicy) String

func (ap *AuthzPolicy) String() string

String implements the fmt.Stringer.

func (*AuthzPolicy) Unwrap

func (ap *AuthzPolicy) Unwrap() *AuthzPolicy

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

func (ap *AuthzPolicy) Update() *AuthzPolicyUpdateOne

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

type AuthzPolicyClient

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

AuthzPolicyClient is a client for the AuthzPolicy schema.

func NewAuthzPolicyClient

func NewAuthzPolicyClient(c config) *AuthzPolicyClient

NewAuthzPolicyClient returns a client for the AuthzPolicy from the given config.

func (*AuthzPolicyClient) Create

func (c *AuthzPolicyClient) Create() *AuthzPolicyCreate

Create returns a create builder for AuthzPolicy.

func (*AuthzPolicyClient) CreateBulk

func (c *AuthzPolicyClient) CreateBulk(builders ...*AuthzPolicyCreate) *AuthzPolicyCreateBulk

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

func (*AuthzPolicyClient) Delete

func (c *AuthzPolicyClient) Delete() *AuthzPolicyDelete

Delete returns a delete builder for AuthzPolicy.

func (*AuthzPolicyClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AuthzPolicyClient) DeleteOneID

func (c *AuthzPolicyClient) DeleteOneID(id int) *AuthzPolicyDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AuthzPolicyClient) Get

func (c *AuthzPolicyClient) Get(ctx context.Context, id int) (*AuthzPolicy, error)

Get returns a AuthzPolicy entity by its id.

func (*AuthzPolicyClient) GetX

func (c *AuthzPolicyClient) GetX(ctx context.Context, id int) *AuthzPolicy

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

func (*AuthzPolicyClient) Hooks

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

Hooks returns the client hooks.

func (*AuthzPolicyClient) Query

func (c *AuthzPolicyClient) Query() *AuthzPolicyQuery

Query returns a query builder for AuthzPolicy.

func (*AuthzPolicyClient) QueryCreateBy

func (c *AuthzPolicyClient) QueryCreateBy(ap *AuthzPolicy) *UserQuery

QueryCreateBy queries the create_by edge of a AuthzPolicy.

func (*AuthzPolicyClient) Update

func (c *AuthzPolicyClient) Update() *AuthzPolicyUpdate

Update returns an update builder for AuthzPolicy.

func (*AuthzPolicyClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuthzPolicyClient) UpdateOneID

func (c *AuthzPolicyClient) UpdateOneID(id int) *AuthzPolicyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuthzPolicyClient) Use

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

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

type AuthzPolicyCreate

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

AuthzPolicyCreate is the builder for creating a AuthzPolicy entity.

func (*AuthzPolicyCreate) Exec

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

Exec executes the query.

func (*AuthzPolicyCreate) ExecX

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

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

func (*AuthzPolicyCreate) Mutation

func (apc *AuthzPolicyCreate) Mutation() *AuthzPolicyMutation

Mutation returns the AuthzPolicyMutation object of the builder.

func (*AuthzPolicyCreate) Save

func (apc *AuthzPolicyCreate) Save(ctx context.Context) (*AuthzPolicy, error)

Save creates the AuthzPolicy in the database.

func (*AuthzPolicyCreate) SaveX

func (apc *AuthzPolicyCreate) SaveX(ctx context.Context) *AuthzPolicy

SaveX calls Save and panics if Save returns an error.

func (*AuthzPolicyCreate) SetCreateBy

func (apc *AuthzPolicyCreate) SetCreateBy(u *User) *AuthzPolicyCreate

SetCreateBy sets the "create_by" edge to the User entity.

func (*AuthzPolicyCreate) SetCreateByID

func (apc *AuthzPolicyCreate) SetCreateByID(id int) *AuthzPolicyCreate

SetCreateByID sets the "create_by" edge to the User entity by ID.

func (*AuthzPolicyCreate) SetCreateTime

func (apc *AuthzPolicyCreate) SetCreateTime(t time.Time) *AuthzPolicyCreate

SetCreateTime sets the "create_time" field.

func (*AuthzPolicyCreate) SetNillableCreateByID

func (apc *AuthzPolicyCreate) SetNillableCreateByID(id *int) *AuthzPolicyCreate

SetNillableCreateByID sets the "create_by" edge to the User entity by ID if the given value is not nil.

func (*AuthzPolicyCreate) SetNillableCreateTime

func (apc *AuthzPolicyCreate) SetNillableCreateTime(t *time.Time) *AuthzPolicyCreate

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

func (*AuthzPolicyCreate) SetNillablePolicy

func (apc *AuthzPolicyCreate) SetNillablePolicy(s *string) *AuthzPolicyCreate

SetNillablePolicy sets the "policy" field if the given value is not nil.

func (*AuthzPolicyCreate) SetNillableUpdateTime

func (apc *AuthzPolicyCreate) SetNillableUpdateTime(t *time.Time) *AuthzPolicyCreate

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

func (*AuthzPolicyCreate) SetObj

func (apc *AuthzPolicyCreate) SetObj(s string) *AuthzPolicyCreate

SetObj sets the "obj" field.

func (*AuthzPolicyCreate) SetPolicy

func (apc *AuthzPolicyCreate) SetPolicy(s string) *AuthzPolicyCreate

SetPolicy sets the "policy" field.

func (*AuthzPolicyCreate) SetPolicyName

func (apc *AuthzPolicyCreate) SetPolicyName(s string) *AuthzPolicyCreate

SetPolicyName sets the "policy_name" field.

func (*AuthzPolicyCreate) SetStatus

func (apc *AuthzPolicyCreate) SetStatus(s string) *AuthzPolicyCreate

SetStatus sets the "status" field.

func (*AuthzPolicyCreate) SetUpdateTime

func (apc *AuthzPolicyCreate) SetUpdateTime(t time.Time) *AuthzPolicyCreate

SetUpdateTime sets the "update_time" field.

type AuthzPolicyCreateBulk

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

AuthzPolicyCreateBulk is the builder for creating many AuthzPolicy entities in bulk.

func (*AuthzPolicyCreateBulk) Exec

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

Exec executes the query.

func (*AuthzPolicyCreateBulk) ExecX

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

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

func (*AuthzPolicyCreateBulk) Save

func (apcb *AuthzPolicyCreateBulk) Save(ctx context.Context) ([]*AuthzPolicy, error)

Save creates the AuthzPolicy entities in the database.

func (*AuthzPolicyCreateBulk) SaveX

func (apcb *AuthzPolicyCreateBulk) SaveX(ctx context.Context) []*AuthzPolicy

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

type AuthzPolicyDelete

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

AuthzPolicyDelete is the builder for deleting a AuthzPolicy entity.

func (*AuthzPolicyDelete) Exec

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

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

func (*AuthzPolicyDelete) ExecX

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

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

func (*AuthzPolicyDelete) Where

Where appends a list predicates to the AuthzPolicyDelete builder.

type AuthzPolicyDeleteOne

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

AuthzPolicyDeleteOne is the builder for deleting a single AuthzPolicy entity.

func (*AuthzPolicyDeleteOne) Exec

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

Exec executes the deletion query.

func (*AuthzPolicyDeleteOne) ExecX

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

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

type AuthzPolicyEdges

type AuthzPolicyEdges struct {
	// CreateBy holds the value of the create_by edge.
	CreateBy *User `json:"create_by,omitempty"`
	// contains filtered or unexported fields
}

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

func (AuthzPolicyEdges) CreateByOrErr

func (e AuthzPolicyEdges) CreateByOrErr() (*User, error)

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

type AuthzPolicyGroupBy

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

AuthzPolicyGroupBy is the group-by builder for AuthzPolicy entities.

func (*AuthzPolicyGroupBy) Aggregate

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

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

func (*AuthzPolicyGroupBy) Bool

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) BoolX

func (apgb *AuthzPolicyGroupBy) BoolX(ctx context.Context) bool

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

func (*AuthzPolicyGroupBy) Bools

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) BoolsX

func (apgb *AuthzPolicyGroupBy) BoolsX(ctx context.Context) []bool

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

func (*AuthzPolicyGroupBy) Float64

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) Float64X

func (apgb *AuthzPolicyGroupBy) Float64X(ctx context.Context) float64

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

func (*AuthzPolicyGroupBy) Float64s

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) Float64sX

func (apgb *AuthzPolicyGroupBy) Float64sX(ctx context.Context) []float64

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

func (*AuthzPolicyGroupBy) Int

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) IntX

func (apgb *AuthzPolicyGroupBy) IntX(ctx context.Context) int

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

func (*AuthzPolicyGroupBy) Ints

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) IntsX

func (apgb *AuthzPolicyGroupBy) IntsX(ctx context.Context) []int

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

func (*AuthzPolicyGroupBy) Scan

func (apgb *AuthzPolicyGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AuthzPolicyGroupBy) ScanX

func (apgb *AuthzPolicyGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AuthzPolicyGroupBy) String

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) StringX

func (apgb *AuthzPolicyGroupBy) StringX(ctx context.Context) string

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

func (*AuthzPolicyGroupBy) Strings

func (apgb *AuthzPolicyGroupBy) 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 (*AuthzPolicyGroupBy) StringsX

func (apgb *AuthzPolicyGroupBy) StringsX(ctx context.Context) []string

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

type AuthzPolicyMutation

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

AuthzPolicyMutation represents an operation that mutates the AuthzPolicy nodes in the graph.

func (*AuthzPolicyMutation) AddField

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) AddedEdges

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

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

func (*AuthzPolicyMutation) AddedField

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

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

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

func (*AuthzPolicyMutation) AddedIDs

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

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

func (*AuthzPolicyMutation) ClearCreateBy

func (m *AuthzPolicyMutation) ClearCreateBy()

ClearCreateBy clears the "create_by" edge to the User entity.

func (*AuthzPolicyMutation) ClearEdge

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

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) ClearPolicy

func (m *AuthzPolicyMutation) ClearPolicy()

ClearPolicy clears the value of the "policy" field.

func (*AuthzPolicyMutation) ClearUpdateTime

func (m *AuthzPolicyMutation) ClearUpdateTime()

ClearUpdateTime clears the value of the "update_time" field.

func (*AuthzPolicyMutation) ClearedEdges

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

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

func (*AuthzPolicyMutation) ClearedFields

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

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

func (AuthzPolicyMutation) Client

func (m AuthzPolicyMutation) 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 (*AuthzPolicyMutation) CreateByCleared

func (m *AuthzPolicyMutation) CreateByCleared() bool

CreateByCleared reports if the "create_by" edge to the User entity was cleared.

func (*AuthzPolicyMutation) CreateByID

func (m *AuthzPolicyMutation) CreateByID() (id int, exists bool)

CreateByID returns the "create_by" edge ID in the mutation.

func (*AuthzPolicyMutation) CreateByIDs

func (m *AuthzPolicyMutation) CreateByIDs() (ids []int)

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

func (*AuthzPolicyMutation) CreateTime

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

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

func (*AuthzPolicyMutation) EdgeCleared

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

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

func (*AuthzPolicyMutation) Field

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

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

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

func (*AuthzPolicyMutation) Fields

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

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

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) Obj

func (m *AuthzPolicyMutation) Obj() (r string, exists bool)

Obj returns the value of the "obj" field in the mutation.

func (*AuthzPolicyMutation) OldCreateTime

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

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

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) OldObj

func (m *AuthzPolicyMutation) OldObj(ctx context.Context) (v string, err error)

OldObj returns the old "obj" field's value of the AuthzPolicy entity. If the AuthzPolicy 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 (*AuthzPolicyMutation) OldPolicy

func (m *AuthzPolicyMutation) OldPolicy(ctx context.Context) (v *string, err error)

OldPolicy returns the old "policy" field's value of the AuthzPolicy entity. If the AuthzPolicy 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 (*AuthzPolicyMutation) OldPolicyName

func (m *AuthzPolicyMutation) OldPolicyName(ctx context.Context) (v string, err error)

OldPolicyName returns the old "policy_name" field's value of the AuthzPolicy entity. If the AuthzPolicy 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 (*AuthzPolicyMutation) OldStatus

func (m *AuthzPolicyMutation) OldStatus(ctx context.Context) (v string, err error)

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

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

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

func (m *AuthzPolicyMutation) Op() Op

Op returns the operation name.

func (*AuthzPolicyMutation) Policy

func (m *AuthzPolicyMutation) Policy() (r string, exists bool)

Policy returns the value of the "policy" field in the mutation.

func (*AuthzPolicyMutation) PolicyCleared

func (m *AuthzPolicyMutation) PolicyCleared() bool

PolicyCleared returns if the "policy" field was cleared in this mutation.

func (*AuthzPolicyMutation) PolicyName

func (m *AuthzPolicyMutation) PolicyName() (r string, exists bool)

PolicyName returns the value of the "policy_name" field in the mutation.

func (*AuthzPolicyMutation) RemovedEdges

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

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

func (*AuthzPolicyMutation) RemovedIDs

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) ResetCreateBy

func (m *AuthzPolicyMutation) ResetCreateBy()

ResetCreateBy resets all changes to the "create_by" edge.

func (*AuthzPolicyMutation) ResetCreateTime

func (m *AuthzPolicyMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*AuthzPolicyMutation) ResetEdge

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

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) ResetObj

func (m *AuthzPolicyMutation) ResetObj()

ResetObj resets all changes to the "obj" field.

func (*AuthzPolicyMutation) ResetPolicy

func (m *AuthzPolicyMutation) ResetPolicy()

ResetPolicy resets all changes to the "policy" field.

func (*AuthzPolicyMutation) ResetPolicyName

func (m *AuthzPolicyMutation) ResetPolicyName()

ResetPolicyName resets all changes to the "policy_name" field.

func (*AuthzPolicyMutation) ResetStatus

func (m *AuthzPolicyMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*AuthzPolicyMutation) ResetUpdateTime

func (m *AuthzPolicyMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*AuthzPolicyMutation) SetCreateByID

func (m *AuthzPolicyMutation) SetCreateByID(id int)

SetCreateByID sets the "create_by" edge to the User entity by id.

func (*AuthzPolicyMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*AuthzPolicyMutation) SetField

func (m *AuthzPolicyMutation) 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 (*AuthzPolicyMutation) SetObj

func (m *AuthzPolicyMutation) SetObj(s string)

SetObj sets the "obj" field.

func (*AuthzPolicyMutation) SetPolicy

func (m *AuthzPolicyMutation) SetPolicy(s string)

SetPolicy sets the "policy" field.

func (*AuthzPolicyMutation) SetPolicyName

func (m *AuthzPolicyMutation) SetPolicyName(s string)

SetPolicyName sets the "policy_name" field.

func (*AuthzPolicyMutation) SetStatus

func (m *AuthzPolicyMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*AuthzPolicyMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*AuthzPolicyMutation) Status

func (m *AuthzPolicyMutation) Status() (r string, exists bool)

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

func (AuthzPolicyMutation) Tx

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

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

func (*AuthzPolicyMutation) Type

func (m *AuthzPolicyMutation) Type() string

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

func (*AuthzPolicyMutation) UpdateTime

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

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

func (*AuthzPolicyMutation) UpdateTimeCleared

func (m *AuthzPolicyMutation) UpdateTimeCleared() bool

UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.

func (*AuthzPolicyMutation) Where

func (m *AuthzPolicyMutation) Where(ps ...predicate.AuthzPolicy)

Where appends a list predicates to the AuthzPolicyMutation builder.

type AuthzPolicyQuery

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

AuthzPolicyQuery is the builder for querying AuthzPolicy entities.

func (*AuthzPolicyQuery) All

func (apq *AuthzPolicyQuery) All(ctx context.Context) ([]*AuthzPolicy, error)

All executes the query and returns a list of AuthzPolicies.

func (*AuthzPolicyQuery) AllX

func (apq *AuthzPolicyQuery) AllX(ctx context.Context) []*AuthzPolicy

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

func (*AuthzPolicyQuery) Clone

func (apq *AuthzPolicyQuery) Clone() *AuthzPolicyQuery

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

func (*AuthzPolicyQuery) Count

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

Count returns the count of the given query.

func (*AuthzPolicyQuery) CountX

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

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

func (*AuthzPolicyQuery) Exist

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

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

func (*AuthzPolicyQuery) ExistX

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

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

func (*AuthzPolicyQuery) First

func (apq *AuthzPolicyQuery) First(ctx context.Context) (*AuthzPolicy, error)

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

func (*AuthzPolicyQuery) FirstID

func (apq *AuthzPolicyQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AuthzPolicyQuery) FirstIDX

func (apq *AuthzPolicyQuery) FirstIDX(ctx context.Context) int

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

func (*AuthzPolicyQuery) FirstX

func (apq *AuthzPolicyQuery) FirstX(ctx context.Context) *AuthzPolicy

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

func (*AuthzPolicyQuery) GroupBy

func (apq *AuthzPolicyQuery) GroupBy(field string, fields ...string) *AuthzPolicyGroupBy

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

client.AuthzPolicy.Query().
	GroupBy(authzpolicy.FieldPolicyName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AuthzPolicyQuery) IDs

func (apq *AuthzPolicyQuery) IDs(ctx context.Context) ([]int, error)

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

func (*AuthzPolicyQuery) IDsX

func (apq *AuthzPolicyQuery) IDsX(ctx context.Context) []int

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

func (*AuthzPolicyQuery) Limit

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

Limit adds a limit step to the query.

func (*AuthzPolicyQuery) Offset

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

Offset adds an offset step to the query.

func (*AuthzPolicyQuery) Only

func (apq *AuthzPolicyQuery) Only(ctx context.Context) (*AuthzPolicy, error)

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

func (*AuthzPolicyQuery) OnlyID

func (apq *AuthzPolicyQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AuthzPolicyQuery) OnlyIDX

func (apq *AuthzPolicyQuery) OnlyIDX(ctx context.Context) int

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

func (*AuthzPolicyQuery) OnlyX

func (apq *AuthzPolicyQuery) OnlyX(ctx context.Context) *AuthzPolicy

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

func (*AuthzPolicyQuery) Order

func (apq *AuthzPolicyQuery) Order(o ...OrderFunc) *AuthzPolicyQuery

Order adds an order step to the query.

func (*AuthzPolicyQuery) QueryCreateBy

func (apq *AuthzPolicyQuery) QueryCreateBy() *UserQuery

QueryCreateBy chains the current query on the "create_by" edge.

func (*AuthzPolicyQuery) Select

func (apq *AuthzPolicyQuery) Select(fields ...string) *AuthzPolicySelect

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

client.AuthzPolicy.Query().
	Select(authzpolicy.FieldPolicyName).
	Scan(ctx, &v)

func (*AuthzPolicyQuery) Unique

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

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

Where adds a new predicate for the AuthzPolicyQuery builder.

func (*AuthzPolicyQuery) WithCreateBy

func (apq *AuthzPolicyQuery) WithCreateBy(opts ...func(*UserQuery)) *AuthzPolicyQuery

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

type AuthzPolicySelect

type AuthzPolicySelect struct {
	*AuthzPolicyQuery
	// contains filtered or unexported fields
}

AuthzPolicySelect is the builder for selecting fields of AuthzPolicy entities.

func (*AuthzPolicySelect) Bool

func (aps *AuthzPolicySelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*AuthzPolicySelect) BoolX

func (aps *AuthzPolicySelect) BoolX(ctx context.Context) bool

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

func (*AuthzPolicySelect) Bools

func (aps *AuthzPolicySelect) Bools(ctx context.Context) ([]bool, error)

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

func (*AuthzPolicySelect) BoolsX

func (aps *AuthzPolicySelect) BoolsX(ctx context.Context) []bool

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

func (*AuthzPolicySelect) Float64

func (aps *AuthzPolicySelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*AuthzPolicySelect) Float64X

func (aps *AuthzPolicySelect) Float64X(ctx context.Context) float64

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

func (*AuthzPolicySelect) Float64s

func (aps *AuthzPolicySelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*AuthzPolicySelect) Float64sX

func (aps *AuthzPolicySelect) Float64sX(ctx context.Context) []float64

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

func (*AuthzPolicySelect) Int

func (aps *AuthzPolicySelect) Int(ctx context.Context) (_ int, err error)

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

func (*AuthzPolicySelect) IntX

func (aps *AuthzPolicySelect) IntX(ctx context.Context) int

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

func (*AuthzPolicySelect) Ints

func (aps *AuthzPolicySelect) Ints(ctx context.Context) ([]int, error)

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

func (*AuthzPolicySelect) IntsX

func (aps *AuthzPolicySelect) IntsX(ctx context.Context) []int

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

func (*AuthzPolicySelect) Scan

func (aps *AuthzPolicySelect) Scan(ctx context.Context, v interface{}) error

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

func (*AuthzPolicySelect) ScanX

func (aps *AuthzPolicySelect) ScanX(ctx context.Context, v interface{})

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

func (*AuthzPolicySelect) String

func (aps *AuthzPolicySelect) String(ctx context.Context) (_ string, err error)

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

func (*AuthzPolicySelect) StringX

func (aps *AuthzPolicySelect) StringX(ctx context.Context) string

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

func (*AuthzPolicySelect) Strings

func (aps *AuthzPolicySelect) Strings(ctx context.Context) ([]string, error)

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

func (*AuthzPolicySelect) StringsX

func (aps *AuthzPolicySelect) StringsX(ctx context.Context) []string

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

type AuthzPolicyUpdate

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

AuthzPolicyUpdate is the builder for updating AuthzPolicy entities.

func (*AuthzPolicyUpdate) ClearCreateBy

func (apu *AuthzPolicyUpdate) ClearCreateBy() *AuthzPolicyUpdate

ClearCreateBy clears the "create_by" edge to the User entity.

func (*AuthzPolicyUpdate) ClearPolicy

func (apu *AuthzPolicyUpdate) ClearPolicy() *AuthzPolicyUpdate

ClearPolicy clears the value of the "policy" field.

func (*AuthzPolicyUpdate) ClearUpdateTime

func (apu *AuthzPolicyUpdate) ClearUpdateTime() *AuthzPolicyUpdate

ClearUpdateTime clears the value of the "update_time" field.

func (*AuthzPolicyUpdate) Exec

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

Exec executes the query.

func (*AuthzPolicyUpdate) ExecX

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

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

func (*AuthzPolicyUpdate) Mutation

func (apu *AuthzPolicyUpdate) Mutation() *AuthzPolicyMutation

Mutation returns the AuthzPolicyMutation object of the builder.

func (*AuthzPolicyUpdate) Save

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

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

func (*AuthzPolicyUpdate) SaveX

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

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

func (*AuthzPolicyUpdate) SetCreateBy

func (apu *AuthzPolicyUpdate) SetCreateBy(u *User) *AuthzPolicyUpdate

SetCreateBy sets the "create_by" edge to the User entity.

func (*AuthzPolicyUpdate) SetCreateByID

func (apu *AuthzPolicyUpdate) SetCreateByID(id int) *AuthzPolicyUpdate

SetCreateByID sets the "create_by" edge to the User entity by ID.

func (*AuthzPolicyUpdate) SetNillableCreateByID

func (apu *AuthzPolicyUpdate) SetNillableCreateByID(id *int) *AuthzPolicyUpdate

SetNillableCreateByID sets the "create_by" edge to the User entity by ID if the given value is not nil.

func (*AuthzPolicyUpdate) SetNillablePolicy

func (apu *AuthzPolicyUpdate) SetNillablePolicy(s *string) *AuthzPolicyUpdate

SetNillablePolicy sets the "policy" field if the given value is not nil.

func (*AuthzPolicyUpdate) SetNillableUpdateTime

func (apu *AuthzPolicyUpdate) SetNillableUpdateTime(t *time.Time) *AuthzPolicyUpdate

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

func (*AuthzPolicyUpdate) SetObj

func (apu *AuthzPolicyUpdate) SetObj(s string) *AuthzPolicyUpdate

SetObj sets the "obj" field.

func (*AuthzPolicyUpdate) SetPolicy

func (apu *AuthzPolicyUpdate) SetPolicy(s string) *AuthzPolicyUpdate

SetPolicy sets the "policy" field.

func (*AuthzPolicyUpdate) SetPolicyName

func (apu *AuthzPolicyUpdate) SetPolicyName(s string) *AuthzPolicyUpdate

SetPolicyName sets the "policy_name" field.

func (*AuthzPolicyUpdate) SetStatus

func (apu *AuthzPolicyUpdate) SetStatus(s string) *AuthzPolicyUpdate

SetStatus sets the "status" field.

func (*AuthzPolicyUpdate) SetUpdateTime

func (apu *AuthzPolicyUpdate) SetUpdateTime(t time.Time) *AuthzPolicyUpdate

SetUpdateTime sets the "update_time" field.

func (*AuthzPolicyUpdate) Where

Where appends a list predicates to the AuthzPolicyUpdate builder.

type AuthzPolicyUpdateOne

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

AuthzPolicyUpdateOne is the builder for updating a single AuthzPolicy entity.

func (*AuthzPolicyUpdateOne) ClearCreateBy

func (apuo *AuthzPolicyUpdateOne) ClearCreateBy() *AuthzPolicyUpdateOne

ClearCreateBy clears the "create_by" edge to the User entity.

func (*AuthzPolicyUpdateOne) ClearPolicy

func (apuo *AuthzPolicyUpdateOne) ClearPolicy() *AuthzPolicyUpdateOne

ClearPolicy clears the value of the "policy" field.

func (*AuthzPolicyUpdateOne) ClearUpdateTime

func (apuo *AuthzPolicyUpdateOne) ClearUpdateTime() *AuthzPolicyUpdateOne

ClearUpdateTime clears the value of the "update_time" field.

func (*AuthzPolicyUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AuthzPolicyUpdateOne) ExecX

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

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

func (*AuthzPolicyUpdateOne) Mutation

func (apuo *AuthzPolicyUpdateOne) Mutation() *AuthzPolicyMutation

Mutation returns the AuthzPolicyMutation object of the builder.

func (*AuthzPolicyUpdateOne) Save

Save executes the query and returns the updated AuthzPolicy entity.

func (*AuthzPolicyUpdateOne) SaveX

func (apuo *AuthzPolicyUpdateOne) SaveX(ctx context.Context) *AuthzPolicy

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

func (*AuthzPolicyUpdateOne) Select

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

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

func (*AuthzPolicyUpdateOne) SetCreateBy

func (apuo *AuthzPolicyUpdateOne) SetCreateBy(u *User) *AuthzPolicyUpdateOne

SetCreateBy sets the "create_by" edge to the User entity.

func (*AuthzPolicyUpdateOne) SetCreateByID

func (apuo *AuthzPolicyUpdateOne) SetCreateByID(id int) *AuthzPolicyUpdateOne

SetCreateByID sets the "create_by" edge to the User entity by ID.

func (*AuthzPolicyUpdateOne) SetNillableCreateByID

func (apuo *AuthzPolicyUpdateOne) SetNillableCreateByID(id *int) *AuthzPolicyUpdateOne

SetNillableCreateByID sets the "create_by" edge to the User entity by ID if the given value is not nil.

func (*AuthzPolicyUpdateOne) SetNillablePolicy

func (apuo *AuthzPolicyUpdateOne) SetNillablePolicy(s *string) *AuthzPolicyUpdateOne

SetNillablePolicy sets the "policy" field if the given value is not nil.

func (*AuthzPolicyUpdateOne) SetNillableUpdateTime

func (apuo *AuthzPolicyUpdateOne) SetNillableUpdateTime(t *time.Time) *AuthzPolicyUpdateOne

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

func (*AuthzPolicyUpdateOne) SetObj

SetObj sets the "obj" field.

func (*AuthzPolicyUpdateOne) SetPolicy

func (apuo *AuthzPolicyUpdateOne) SetPolicy(s string) *AuthzPolicyUpdateOne

SetPolicy sets the "policy" field.

func (*AuthzPolicyUpdateOne) SetPolicyName

func (apuo *AuthzPolicyUpdateOne) SetPolicyName(s string) *AuthzPolicyUpdateOne

SetPolicyName sets the "policy_name" field.

func (*AuthzPolicyUpdateOne) SetStatus

func (apuo *AuthzPolicyUpdateOne) SetStatus(s string) *AuthzPolicyUpdateOne

SetStatus sets the "status" field.

func (*AuthzPolicyUpdateOne) SetUpdateTime

func (apuo *AuthzPolicyUpdateOne) SetUpdateTime(t time.Time) *AuthzPolicyUpdateOne

SetUpdateTime sets the "update_time" field.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AuthzPolicy is the client for interacting with the AuthzPolicy builders.
	AuthzPolicy *AuthzPolicyClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	AuthzPolicy.
	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 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 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 int `json:"id,omitempty"`
	// Rolename holds the value of the "rolename" field.
	Rolename string `json:"rolename,omitempty"`
	// Status holds the value of the "status" field.
	// active or disable or delete
	Status string `json:"status,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime *time.Time `json:"update_time,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RoleQuery when eager-loading is set.
	Edges RoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) QueryUsers

func (r *Role) QueryUsers() *UserQuery

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

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

Unwrap unwraps the Role entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Role) Update

func (r *Role) Update() *RoleUpdateOne

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

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 int) *RoleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RoleClient) Get

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

Get returns a Role entity by its id.

func (*RoleClient) GetX

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

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

func (*RoleClient) Hooks

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

Hooks returns the client hooks.

func (*RoleClient) Query

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) QueryUsers

func (c *RoleClient) QueryUsers(r *Role) *UserQuery

QueryUsers queries the users edge of a Role.

func (*RoleClient) Update

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

func (c *RoleClient) UpdateOne(r *Role) *RoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

func (c *RoleClient) UpdateOneID(id int) *RoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) AddUserIDs

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

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

func (*RoleCreate) AddUsers

func (rc *RoleCreate) AddUsers(u ...*User) *RoleCreate

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

func (*RoleCreate) Exec

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

Exec executes the query.

func (*RoleCreate) ExecX

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

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

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) Save

func (rc *RoleCreate) Save(ctx context.Context) (*Role, error)

Save creates the Role in the database.

func (*RoleCreate) SaveX

func (rc *RoleCreate) SaveX(ctx context.Context) *Role

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*RoleCreate) SetNillableCreateTime

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

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

func (*RoleCreate) SetNillableUpdateTime

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

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

func (*RoleCreate) SetRolename

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

SetRolename sets the "rolename" field.

func (*RoleCreate) SetStatus

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

SetStatus sets the "status" field.

func (*RoleCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type RoleCreateBulk

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

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

func (*RoleCreateBulk) 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 RoleEdges

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

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

func (RoleEdges) UsersOrErr

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

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

type RoleGroupBy

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

RoleGroupBy is the group-by builder for Role entities.

func (*RoleGroupBy) Aggregate

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

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

func (*RoleGroupBy) Bool

func (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) 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) AddUserIDs

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

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

func (*RoleMutation) AddedEdges

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

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

func (*RoleMutation) AddedField

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

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

func (*RoleMutation) AddedFields

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

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

func (*RoleMutation) AddedIDs

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

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

func (*RoleMutation) 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) ClearUpdateTime

func (m *RoleMutation) ClearUpdateTime()

ClearUpdateTime clears the value of the "update_time" field.

func (*RoleMutation) ClearUsers

func (m *RoleMutation) ClearUsers()

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

func (*RoleMutation) ClearedEdges

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

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

func (*RoleMutation) ClearedFields

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

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

func (RoleMutation) Client

func (m RoleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*RoleMutation) CreateTime

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

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

func (*RoleMutation) EdgeCleared

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

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

func (*RoleMutation) Field

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

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

func (*RoleMutation) FieldCleared

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

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

func (*RoleMutation) Fields

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

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

func (*RoleMutation) ID

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

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

func (*RoleMutation) IDs

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

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

func (*RoleMutation) OldCreateTime

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

OldCreateTime returns the old "create_time" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) 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) OldRolename

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

OldRolename returns the old "rolename" 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 string, err error)

OldStatus returns the old "status" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) OldUpdateTime

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

OldUpdateTime returns the old "update_time" field's value of the Role entity. If the Role object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RoleMutation) Op

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) RemoveUserIDs

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

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

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

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

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

func (*RoleMutation) ResetCreateTime

func (m *RoleMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" 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) ResetRolename

func (m *RoleMutation) ResetRolename()

ResetRolename resets all changes to the "rolename" field.

func (*RoleMutation) ResetStatus

func (m *RoleMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RoleMutation) ResetUpdateTime

func (m *RoleMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*RoleMutation) ResetUsers

func (m *RoleMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*RoleMutation) Rolename

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

Rolename returns the value of the "rolename" field in the mutation.

func (*RoleMutation) SetCreateTime

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

SetCreateTime sets the "create_time" 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) SetRolename

func (m *RoleMutation) SetRolename(s string)

SetRolename sets the "rolename" field.

func (*RoleMutation) SetStatus

func (m *RoleMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*RoleMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*RoleMutation) Status

func (m *RoleMutation) Status() (r string, 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) UpdateTime

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

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

func (*RoleMutation) UpdateTimeCleared

func (m *RoleMutation) UpdateTimeCleared() bool

UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.

func (*RoleMutation) UsersCleared

func (m *RoleMutation) UsersCleared() bool

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

func (*RoleMutation) UsersIDs

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

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

func (*RoleMutation) Where

func (m *RoleMutation) Where(ps ...predicate.Role)

Where appends a list predicates to the RoleMutation builder.

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 int, err error)

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

func (*RoleQuery) FirstIDX

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

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

func (*RoleQuery) FirstX

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

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

func (*RoleQuery) GroupBy

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

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

Example:

var v []struct {
	Rolename string `json:"rolename,omitempty"`
	Count int `json:"count,omitempty"`
}

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

func (*RoleQuery) IDs

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

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

func (*RoleQuery) IDsX

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

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

func (*RoleQuery) Limit

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

Limit adds a limit step to the query.

func (*RoleQuery) Offset

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

Offset adds an offset step to the query.

func (*RoleQuery) Only

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

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

func (*RoleQuery) OnlyID

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

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

func (*RoleQuery) OnlyIDX

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

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

func (*RoleQuery) OnlyX

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

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

func (*RoleQuery) Order

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

Order adds an order step to the query.

func (*RoleQuery) QueryUsers

func (rq *RoleQuery) QueryUsers() *UserQuery

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

func (*RoleQuery) Select

func (rq *RoleQuery) Select(fields ...string) *RoleSelect

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

Example:

var v []struct {
	Rolename string `json:"rolename,omitempty"`
}

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

func (*RoleQuery) Unique

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

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

func (*RoleQuery) Where

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

Where adds a new predicate for the RoleQuery builder.

func (*RoleQuery) WithUsers

func (rq *RoleQuery) WithUsers(opts ...func(*UserQuery)) *RoleQuery

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

type RoleSelect

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

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) 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) AddUserIDs

func (ru *RoleUpdate) AddUserIDs(ids ...int) *RoleUpdate

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

func (*RoleUpdate) AddUsers

func (ru *RoleUpdate) AddUsers(u ...*User) *RoleUpdate

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

func (*RoleUpdate) ClearUpdateTime

func (ru *RoleUpdate) ClearUpdateTime() *RoleUpdate

ClearUpdateTime clears the value of the "update_time" field.

func (*RoleUpdate) ClearUsers

func (ru *RoleUpdate) ClearUsers() *RoleUpdate

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

func (*RoleUpdate) Exec

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

Exec executes the query.

func (*RoleUpdate) ExecX

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

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

func (*RoleUpdate) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) RemoveUserIDs

func (ru *RoleUpdate) RemoveUserIDs(ids ...int) *RoleUpdate

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

func (*RoleUpdate) RemoveUsers

func (ru *RoleUpdate) RemoveUsers(u ...*User) *RoleUpdate

RemoveUsers removes "users" edges to User entities.

func (*RoleUpdate) Save

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

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

func (*RoleUpdate) SaveX

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

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

func (*RoleUpdate) SetNillableUpdateTime

func (ru *RoleUpdate) SetNillableUpdateTime(t *time.Time) *RoleUpdate

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

func (*RoleUpdate) SetRolename

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

SetRolename sets the "rolename" field.

func (*RoleUpdate) SetStatus

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

SetStatus sets the "status" field.

func (*RoleUpdate) SetUpdateTime

func (ru *RoleUpdate) SetUpdateTime(t time.Time) *RoleUpdate

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

func (ruo *RoleUpdateOne) AddUserIDs(ids ...int) *RoleUpdateOne

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

func (*RoleUpdateOne) AddUsers

func (ruo *RoleUpdateOne) AddUsers(u ...*User) *RoleUpdateOne

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

func (*RoleUpdateOne) ClearUpdateTime

func (ruo *RoleUpdateOne) ClearUpdateTime() *RoleUpdateOne

ClearUpdateTime clears the value of the "update_time" field.

func (*RoleUpdateOne) ClearUsers

func (ruo *RoleUpdateOne) ClearUsers() *RoleUpdateOne

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

func (*RoleUpdateOne) Exec

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

Exec executes the query on the entity.

func (*RoleUpdateOne) ExecX

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

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

func (*RoleUpdateOne) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) RemoveUserIDs

func (ruo *RoleUpdateOne) RemoveUserIDs(ids ...int) *RoleUpdateOne

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

func (*RoleUpdateOne) RemoveUsers

func (ruo *RoleUpdateOne) RemoveUsers(u ...*User) *RoleUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*RoleUpdateOne) Save

func (ruo *RoleUpdateOne) Save(ctx context.Context) (*Role, error)

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

func (ruo *RoleUpdateOne) SaveX(ctx context.Context) *Role

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

func (*RoleUpdateOne) Select

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

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

func (*RoleUpdateOne) SetNillableUpdateTime

func (ruo *RoleUpdateOne) SetNillableUpdateTime(t *time.Time) *RoleUpdateOne

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

func (*RoleUpdateOne) SetRolename

func (ruo *RoleUpdateOne) SetRolename(s string) *RoleUpdateOne

SetRolename sets the "rolename" field.

func (*RoleUpdateOne) SetStatus

func (ruo *RoleUpdateOne) SetStatus(s string) *RoleUpdateOne

SetStatus sets the "status" field.

func (*RoleUpdateOne) SetUpdateTime

func (ruo *RoleUpdateOne) SetUpdateTime(t time.Time) *RoleUpdateOne

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

type Tenant struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// TenantName holds the value of the "tenant_name" field.
	TenantName string `json:"tenant_name,omitempty"`
	// Status holds the value of the "status" field.
	// active or disable or delete
	Status string `json:"status,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime *time.Time `json:"update_time,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TenantQuery when eager-loading is set.
	Edges TenantEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tenant is the model entity for the Tenant schema.

func (*Tenant) QueryUsers

func (t *Tenant) QueryUsers() *UserQuery

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

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) Unwrap

func (t *Tenant) Unwrap() *Tenant

Unwrap unwraps the Tenant entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Tenant) Update

func (t *Tenant) Update() *TenantUpdateOne

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

type TenantClient

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

TenantClient is a client for the Tenant schema.

func NewTenantClient

func NewTenantClient(c config) *TenantClient

NewTenantClient returns a client for the Tenant from the given config.

func (*TenantClient) Create

func (c *TenantClient) Create() *TenantCreate

Create returns a create builder for Tenant.

func (*TenantClient) CreateBulk

func (c *TenantClient) CreateBulk(builders ...*TenantCreate) *TenantCreateBulk

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

func (*TenantClient) Delete

func (c *TenantClient) Delete() *TenantDelete

Delete returns a delete builder for Tenant.

func (*TenantClient) DeleteOne

func (c *TenantClient) DeleteOne(t *Tenant) *TenantDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*TenantClient) DeleteOneID

func (c *TenantClient) DeleteOneID(id int) *TenantDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TenantClient) Get

func (c *TenantClient) Get(ctx context.Context, id int) (*Tenant, error)

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

func (c *TenantClient) GetX(ctx context.Context, id int) *Tenant

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

func (*TenantClient) Hooks

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

Hooks returns the client hooks.

func (*TenantClient) Query

func (c *TenantClient) Query() *TenantQuery

Query returns a query builder for Tenant.

func (*TenantClient) QueryUsers

func (c *TenantClient) QueryUsers(t *Tenant) *UserQuery

QueryUsers queries the users edge of a Tenant.

func (*TenantClient) Update

func (c *TenantClient) Update() *TenantUpdate

Update returns an update builder for Tenant.

func (*TenantClient) UpdateOne

func (c *TenantClient) UpdateOne(t *Tenant) *TenantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TenantClient) UpdateOneID

func (c *TenantClient) UpdateOneID(id int) *TenantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TenantClient) Use

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

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

type TenantCreate

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

TenantCreate is the builder for creating a Tenant entity.

func (*TenantCreate) AddUserIDs

func (tc *TenantCreate) AddUserIDs(ids ...int) *TenantCreate

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

func (*TenantCreate) AddUsers

func (tc *TenantCreate) AddUsers(u ...*User) *TenantCreate

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

func (*TenantCreate) Exec

func (tc *TenantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreate) ExecX

func (tc *TenantCreate) ExecX(ctx context.Context)

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

func (*TenantCreate) Mutation

func (tc *TenantCreate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantCreate) Save

func (tc *TenantCreate) Save(ctx context.Context) (*Tenant, error)

Save creates the Tenant in the database.

func (*TenantCreate) SaveX

func (tc *TenantCreate) SaveX(ctx context.Context) *Tenant

SaveX calls Save and panics if Save returns an error.

func (*TenantCreate) SetCreateTime

func (tc *TenantCreate) SetCreateTime(t time.Time) *TenantCreate

SetCreateTime sets the "create_time" field.

func (*TenantCreate) SetNillableCreateTime

func (tc *TenantCreate) SetNillableCreateTime(t *time.Time) *TenantCreate

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

func (*TenantCreate) SetNillableUpdateTime

func (tc *TenantCreate) SetNillableUpdateTime(t *time.Time) *TenantCreate

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

func (*TenantCreate) SetStatus

func (tc *TenantCreate) SetStatus(s string) *TenantCreate

SetStatus sets the "status" field.

func (*TenantCreate) SetTenantName

func (tc *TenantCreate) SetTenantName(s string) *TenantCreate

SetTenantName sets the "tenant_name" field.

func (*TenantCreate) SetUpdateTime

func (tc *TenantCreate) SetUpdateTime(t time.Time) *TenantCreate

SetUpdateTime sets the "update_time" field.

type TenantCreateBulk

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

TenantCreateBulk is the builder for creating many Tenant entities in bulk.

func (*TenantCreateBulk) Exec

func (tcb *TenantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantCreateBulk) ExecX

func (tcb *TenantCreateBulk) ExecX(ctx context.Context)

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

func (*TenantCreateBulk) Save

func (tcb *TenantCreateBulk) Save(ctx context.Context) ([]*Tenant, error)

Save creates the Tenant entities in the database.

func (*TenantCreateBulk) SaveX

func (tcb *TenantCreateBulk) SaveX(ctx context.Context) []*Tenant

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

type TenantDelete

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

TenantDelete is the builder for deleting a Tenant entity.

func (*TenantDelete) Exec

func (td *TenantDelete) Exec(ctx context.Context) (int, error)

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

func (*TenantDelete) ExecX

func (td *TenantDelete) ExecX(ctx context.Context) int

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

func (*TenantDelete) Where

func (td *TenantDelete) Where(ps ...predicate.Tenant) *TenantDelete

Where appends a list predicates to the TenantDelete builder.

type TenantDeleteOne

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

TenantDeleteOne is the builder for deleting a single Tenant entity.

func (*TenantDeleteOne) Exec

func (tdo *TenantDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TenantDeleteOne) ExecX

func (tdo *TenantDeleteOne) ExecX(ctx context.Context)

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

type TenantEdges

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

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

func (TenantEdges) UsersOrErr

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

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

type TenantGroupBy

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

TenantGroupBy is the group-by builder for Tenant entities.

func (*TenantGroupBy) Aggregate

func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy

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

func (*TenantGroupBy) Bool

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) BoolX

func (tgb *TenantGroupBy) BoolX(ctx context.Context) bool

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

func (*TenantGroupBy) Bools

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) BoolsX

func (tgb *TenantGroupBy) BoolsX(ctx context.Context) []bool

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

func (*TenantGroupBy) Float64

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) Float64X

func (tgb *TenantGroupBy) Float64X(ctx context.Context) float64

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

func (*TenantGroupBy) Float64s

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) Float64sX

func (tgb *TenantGroupBy) Float64sX(ctx context.Context) []float64

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

func (*TenantGroupBy) Int

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) IntX

func (tgb *TenantGroupBy) IntX(ctx context.Context) int

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

func (*TenantGroupBy) Ints

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) IntsX

func (tgb *TenantGroupBy) IntsX(ctx context.Context) []int

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

func (*TenantGroupBy) Scan

func (tgb *TenantGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*TenantGroupBy) ScanX

func (tgb *TenantGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*TenantGroupBy) String

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) StringX

func (tgb *TenantGroupBy) StringX(ctx context.Context) string

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

func (*TenantGroupBy) Strings

func (tgb *TenantGroupBy) 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 (*TenantGroupBy) StringsX

func (tgb *TenantGroupBy) StringsX(ctx context.Context) []string

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

type TenantMutation

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

TenantMutation represents an operation that mutates the Tenant nodes in the graph.

func (*TenantMutation) AddField

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

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

func (*TenantMutation) AddUserIDs

func (m *TenantMutation) AddUserIDs(ids ...int)

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

func (*TenantMutation) AddedEdges

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

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

func (*TenantMutation) AddedField

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

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

func (*TenantMutation) AddedFields

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

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

func (*TenantMutation) AddedIDs

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

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

func (*TenantMutation) ClearEdge

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

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

func (*TenantMutation) ClearField

func (m *TenantMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*TenantMutation) ClearUpdateTime

func (m *TenantMutation) ClearUpdateTime()

ClearUpdateTime clears the value of the "update_time" field.

func (*TenantMutation) ClearUsers

func (m *TenantMutation) ClearUsers()

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

func (*TenantMutation) ClearedEdges

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

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

func (*TenantMutation) ClearedFields

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

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

func (TenantMutation) Client

func (m TenantMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*TenantMutation) CreateTime

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

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

func (*TenantMutation) EdgeCleared

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

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

func (*TenantMutation) Field

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

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

func (*TenantMutation) FieldCleared

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

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

func (*TenantMutation) Fields

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

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

func (*TenantMutation) ID

func (m *TenantMutation) ID() (id 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 (*TenantMutation) IDs

func (m *TenantMutation) 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 (*TenantMutation) OldCreateTime

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

OldCreateTime returns the old "create_time" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldField

func (m *TenantMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*TenantMutation) OldStatus

func (m *TenantMutation) OldStatus(ctx context.Context) (v string, err error)

OldStatus returns the old "status" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldTenantName

func (m *TenantMutation) OldTenantName(ctx context.Context) (v string, err error)

OldTenantName returns the old "tenant_name" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldUpdateTime

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

OldUpdateTime returns the old "update_time" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) Op

func (m *TenantMutation) Op() Op

Op returns the operation name.

func (*TenantMutation) RemoveUserIDs

func (m *TenantMutation) RemoveUserIDs(ids ...int)

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

func (*TenantMutation) RemovedEdges

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

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

func (*TenantMutation) RemovedIDs

func (m *TenantMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TenantMutation) RemovedUsersIDs

func (m *TenantMutation) RemovedUsersIDs() (ids []int)

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

func (*TenantMutation) ResetCreateTime

func (m *TenantMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*TenantMutation) ResetEdge

func (m *TenantMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*TenantMutation) ResetField

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

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

func (*TenantMutation) ResetStatus

func (m *TenantMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*TenantMutation) ResetTenantName

func (m *TenantMutation) ResetTenantName()

ResetTenantName resets all changes to the "tenant_name" field.

func (*TenantMutation) ResetUpdateTime

func (m *TenantMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*TenantMutation) ResetUsers

func (m *TenantMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*TenantMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*TenantMutation) SetField

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

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

func (*TenantMutation) SetStatus

func (m *TenantMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*TenantMutation) SetTenantName

func (m *TenantMutation) SetTenantName(s string)

SetTenantName sets the "tenant_name" field.

func (*TenantMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*TenantMutation) Status

func (m *TenantMutation) Status() (r string, exists bool)

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

func (*TenantMutation) TenantName

func (m *TenantMutation) TenantName() (r string, exists bool)

TenantName returns the value of the "tenant_name" field in the mutation.

func (TenantMutation) Tx

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

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

func (*TenantMutation) Type

func (m *TenantMutation) Type() string

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

func (*TenantMutation) UpdateTime

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

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

func (*TenantMutation) UpdateTimeCleared

func (m *TenantMutation) UpdateTimeCleared() bool

UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.

func (*TenantMutation) UsersCleared

func (m *TenantMutation) UsersCleared() bool

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

func (*TenantMutation) UsersIDs

func (m *TenantMutation) UsersIDs() (ids []int)

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

func (*TenantMutation) Where

func (m *TenantMutation) Where(ps ...predicate.Tenant)

Where appends a list predicates to the TenantMutation builder.

type TenantQuery

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

TenantQuery is the builder for querying Tenant entities.

func (*TenantQuery) All

func (tq *TenantQuery) All(ctx context.Context) ([]*Tenant, error)

All executes the query and returns a list of Tenants.

func (*TenantQuery) AllX

func (tq *TenantQuery) AllX(ctx context.Context) []*Tenant

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

func (*TenantQuery) Clone

func (tq *TenantQuery) Clone() *TenantQuery

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

func (*TenantQuery) Count

func (tq *TenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantQuery) CountX

func (tq *TenantQuery) CountX(ctx context.Context) int

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

func (*TenantQuery) Exist

func (tq *TenantQuery) Exist(ctx context.Context) (bool, error)

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

func (*TenantQuery) ExistX

func (tq *TenantQuery) ExistX(ctx context.Context) bool

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

func (*TenantQuery) First

func (tq *TenantQuery) First(ctx context.Context) (*Tenant, error)

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

func (*TenantQuery) FirstID

func (tq *TenantQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TenantQuery) FirstIDX

func (tq *TenantQuery) FirstIDX(ctx context.Context) int

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

func (*TenantQuery) FirstX

func (tq *TenantQuery) FirstX(ctx context.Context) *Tenant

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

func (*TenantQuery) GroupBy

func (tq *TenantQuery) GroupBy(field string, fields ...string) *TenantGroupBy

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

Example:

var v []struct {
	TenantName string `json:"tenant_name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tenant.Query().
	GroupBy(tenant.FieldTenantName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TenantQuery) IDs

func (tq *TenantQuery) IDs(ctx context.Context) ([]int, error)

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

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []int

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

func (*TenantQuery) Limit

func (tq *TenantQuery) Limit(limit int) *TenantQuery

Limit adds a limit step to the query.

func (*TenantQuery) Offset

func (tq *TenantQuery) Offset(offset int) *TenantQuery

Offset adds an offset step to the query.

func (*TenantQuery) Only

func (tq *TenantQuery) Only(ctx context.Context) (*Tenant, error)

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

func (*TenantQuery) OnlyID

func (tq *TenantQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TenantQuery) OnlyIDX

func (tq *TenantQuery) OnlyIDX(ctx context.Context) int

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

func (*TenantQuery) OnlyX

func (tq *TenantQuery) OnlyX(ctx context.Context) *Tenant

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

func (*TenantQuery) Order

func (tq *TenantQuery) Order(o ...OrderFunc) *TenantQuery

Order adds an order step to the query.

func (*TenantQuery) QueryUsers

func (tq *TenantQuery) QueryUsers() *UserQuery

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

func (*TenantQuery) Select

func (tq *TenantQuery) Select(fields ...string) *TenantSelect

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

Example:

var v []struct {
	TenantName string `json:"tenant_name,omitempty"`
}

client.Tenant.Query().
	Select(tenant.FieldTenantName).
	Scan(ctx, &v)

func (*TenantQuery) Unique

func (tq *TenantQuery) Unique(unique bool) *TenantQuery

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

func (*TenantQuery) Where

func (tq *TenantQuery) Where(ps ...predicate.Tenant) *TenantQuery

Where adds a new predicate for the TenantQuery builder.

func (*TenantQuery) WithUsers

func (tq *TenantQuery) WithUsers(opts ...func(*UserQuery)) *TenantQuery

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

type TenantSelect

type TenantSelect struct {
	*TenantQuery
	// contains filtered or unexported fields
}

TenantSelect is the builder for selecting fields of Tenant entities.

func (*TenantSelect) Bool

func (ts *TenantSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*TenantSelect) BoolX

func (ts *TenantSelect) BoolX(ctx context.Context) bool

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

func (*TenantSelect) Bools

func (ts *TenantSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*TenantSelect) BoolsX

func (ts *TenantSelect) BoolsX(ctx context.Context) []bool

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

func (*TenantSelect) Float64

func (ts *TenantSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*TenantSelect) Float64X

func (ts *TenantSelect) Float64X(ctx context.Context) float64

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

func (*TenantSelect) Float64s

func (ts *TenantSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*TenantSelect) Float64sX

func (ts *TenantSelect) Float64sX(ctx context.Context) []float64

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

func (*TenantSelect) Int

func (ts *TenantSelect) Int(ctx context.Context) (_ int, err error)

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

func (*TenantSelect) IntX

func (ts *TenantSelect) IntX(ctx context.Context) int

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

func (*TenantSelect) Ints

func (ts *TenantSelect) Ints(ctx context.Context) ([]int, error)

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

func (*TenantSelect) IntsX

func (ts *TenantSelect) IntsX(ctx context.Context) []int

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

func (*TenantSelect) Scan

func (ts *TenantSelect) Scan(ctx context.Context, v interface{}) error

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

func (*TenantSelect) ScanX

func (ts *TenantSelect) ScanX(ctx context.Context, v interface{})

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

func (*TenantSelect) String

func (ts *TenantSelect) String(ctx context.Context) (_ string, err error)

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

func (*TenantSelect) StringX

func (ts *TenantSelect) StringX(ctx context.Context) string

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

func (*TenantSelect) Strings

func (ts *TenantSelect) Strings(ctx context.Context) ([]string, error)

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

func (*TenantSelect) StringsX

func (ts *TenantSelect) StringsX(ctx context.Context) []string

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

type TenantUpdate

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

TenantUpdate is the builder for updating Tenant entities.

func (*TenantUpdate) AddUserIDs

func (tu *TenantUpdate) AddUserIDs(ids ...int) *TenantUpdate

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

func (*TenantUpdate) AddUsers

func (tu *TenantUpdate) AddUsers(u ...*User) *TenantUpdate

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

func (*TenantUpdate) ClearUpdateTime

func (tu *TenantUpdate) ClearUpdateTime() *TenantUpdate

ClearUpdateTime clears the value of the "update_time" field.

func (*TenantUpdate) ClearUsers

func (tu *TenantUpdate) ClearUsers() *TenantUpdate

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

func (*TenantUpdate) Exec

func (tu *TenantUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpdate) ExecX

func (tu *TenantUpdate) ExecX(ctx context.Context)

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

func (*TenantUpdate) Mutation

func (tu *TenantUpdate) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdate) RemoveUserIDs

func (tu *TenantUpdate) RemoveUserIDs(ids ...int) *TenantUpdate

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

func (*TenantUpdate) RemoveUsers

func (tu *TenantUpdate) RemoveUsers(u ...*User) *TenantUpdate

RemoveUsers removes "users" edges to User entities.

func (*TenantUpdate) Save

func (tu *TenantUpdate) Save(ctx context.Context) (int, error)

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

func (*TenantUpdate) SaveX

func (tu *TenantUpdate) SaveX(ctx context.Context) int

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

func (*TenantUpdate) SetNillableUpdateTime

func (tu *TenantUpdate) SetNillableUpdateTime(t *time.Time) *TenantUpdate

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

func (*TenantUpdate) SetStatus

func (tu *TenantUpdate) SetStatus(s string) *TenantUpdate

SetStatus sets the "status" field.

func (*TenantUpdate) SetTenantName

func (tu *TenantUpdate) SetTenantName(s string) *TenantUpdate

SetTenantName sets the "tenant_name" field.

func (*TenantUpdate) SetUpdateTime

func (tu *TenantUpdate) SetUpdateTime(t time.Time) *TenantUpdate

SetUpdateTime sets the "update_time" field.

func (*TenantUpdate) Where

func (tu *TenantUpdate) Where(ps ...predicate.Tenant) *TenantUpdate

Where appends a list predicates to the TenantUpdate builder.

type TenantUpdateOne

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

TenantUpdateOne is the builder for updating a single Tenant entity.

func (*TenantUpdateOne) AddUserIDs

func (tuo *TenantUpdateOne) AddUserIDs(ids ...int) *TenantUpdateOne

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

func (*TenantUpdateOne) AddUsers

func (tuo *TenantUpdateOne) AddUsers(u ...*User) *TenantUpdateOne

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

func (*TenantUpdateOne) ClearUpdateTime

func (tuo *TenantUpdateOne) ClearUpdateTime() *TenantUpdateOne

ClearUpdateTime clears the value of the "update_time" field.

func (*TenantUpdateOne) ClearUsers

func (tuo *TenantUpdateOne) ClearUsers() *TenantUpdateOne

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

func (*TenantUpdateOne) Exec

func (tuo *TenantUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TenantUpdateOne) ExecX

func (tuo *TenantUpdateOne) ExecX(ctx context.Context)

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

func (*TenantUpdateOne) Mutation

func (tuo *TenantUpdateOne) Mutation() *TenantMutation

Mutation returns the TenantMutation object of the builder.

func (*TenantUpdateOne) RemoveUserIDs

func (tuo *TenantUpdateOne) RemoveUserIDs(ids ...int) *TenantUpdateOne

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

func (*TenantUpdateOne) RemoveUsers

func (tuo *TenantUpdateOne) RemoveUsers(u ...*User) *TenantUpdateOne

RemoveUsers removes "users" edges to User entities.

func (*TenantUpdateOne) Save

func (tuo *TenantUpdateOne) Save(ctx context.Context) (*Tenant, error)

Save executes the query and returns the updated Tenant entity.

func (*TenantUpdateOne) SaveX

func (tuo *TenantUpdateOne) SaveX(ctx context.Context) *Tenant

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

func (*TenantUpdateOne) Select

func (tuo *TenantUpdateOne) Select(field string, fields ...string) *TenantUpdateOne

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

func (*TenantUpdateOne) SetNillableUpdateTime

func (tuo *TenantUpdateOne) SetNillableUpdateTime(t *time.Time) *TenantUpdateOne

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

func (*TenantUpdateOne) SetStatus

func (tuo *TenantUpdateOne) SetStatus(s string) *TenantUpdateOne

SetStatus sets the "status" field.

func (*TenantUpdateOne) SetTenantName

func (tuo *TenantUpdateOne) SetTenantName(s string) *TenantUpdateOne

SetTenantName sets the "tenant_name" field.

func (*TenantUpdateOne) SetUpdateTime

func (tuo *TenantUpdateOne) SetUpdateTime(t time.Time) *TenantUpdateOne

SetUpdateTime sets the "update_time" field.

type Tenants

type Tenants []*Tenant

Tenants is a parsable slice of Tenant.

type Tx

type Tx struct {

	// AuthzPolicy is the client for interacting with the AuthzPolicy builders.
	AuthzPolicy *AuthzPolicyClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Tenant is the client for interacting with the Tenant builders.
	Tenant *TenantClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// TenantName holds the value of the "tenant_name" field.
	TenantName *string `json:"tenant_name,omitempty"`
	// Passwd holds the value of the "passwd" field.
	Passwd string `json:"passwd,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"`
	// Status holds the value of the "status" field.
	// active or disable or delete
	Status string `json:"status,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime *time.Time `json:"update_time,omitempty"`
	// 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) QueryBelong

func (u *User) QueryBelong() *TenantQuery

QueryBelong queries the "belong" edge of the User entity.

func (*User) QueryPolicys

func (u *User) QueryPolicys() *AuthzPolicyQuery

QueryPolicys queries the "policys" edge of the User entity.

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 int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

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

func (c *UserClient) QueryBelong(u *User) *TenantQuery

QueryBelong queries the belong edge of a User.

func (*UserClient) QueryPolicys

func (c *UserClient) QueryPolicys(u *User) *AuthzPolicyQuery

QueryPolicys queries the policys edge of a 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 int) *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) AddPolicyIDs

func (uc *UserCreate) AddPolicyIDs(ids ...int) *UserCreate

AddPolicyIDs adds the "policys" edge to the AuthzPolicy entity by IDs.

func (*UserCreate) AddPolicys

func (uc *UserCreate) AddPolicys(a ...*AuthzPolicy) *UserCreate

AddPolicys adds the "policys" edges to the AuthzPolicy entity.

func (*UserCreate) AddRoleIDs

func (uc *UserCreate) AddRoleIDs(ids ...int) *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) SetBelong

func (uc *UserCreate) SetBelong(t *Tenant) *UserCreate

SetBelong sets the "belong" edge to the Tenant entity.

func (*UserCreate) SetBelongID

func (uc *UserCreate) SetBelongID(id int) *UserCreate

SetBelongID sets the "belong" edge to the Tenant entity by ID.

func (*UserCreate) SetCreateTime

func (uc *UserCreate) SetCreateTime(t time.Time) *UserCreate

SetCreateTime sets the "create_time" field.

func (*UserCreate) SetEmail

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

SetEmail sets the "email" field.

func (*UserCreate) SetNillableBelongID

func (uc *UserCreate) SetNillableBelongID(id *int) *UserCreate

SetNillableBelongID sets the "belong" edge to the Tenant entity by ID if the given value is not nil.

func (*UserCreate) SetNillableCreateTime

func (uc *UserCreate) SetNillableCreateTime(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableEmail

func (uc *UserCreate) SetNillableEmail(s *string) *UserCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserCreate) SetNillablePhone

func (uc *UserCreate) SetNillablePhone(s *string) *UserCreate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserCreate) SetNillableTenantName

func (uc *UserCreate) SetNillableTenantName(s *string) *UserCreate

SetNillableTenantName sets the "tenant_name" field if the given value is not nil.

func (*UserCreate) SetNillableUpdateTime

func (uc *UserCreate) SetNillableUpdateTime(t *time.Time) *UserCreate

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

func (*UserCreate) SetPasswd

func (uc *UserCreate) SetPasswd(s string) *UserCreate

SetPasswd sets the "passwd" field.

func (*UserCreate) SetPhone

func (uc *UserCreate) SetPhone(s string) *UserCreate

SetPhone sets the "phone" field.

func (*UserCreate) SetStatus

func (uc *UserCreate) SetStatus(s string) *UserCreate

SetStatus sets the "status" field.

func (*UserCreate) SetTenantName

func (uc *UserCreate) SetTenantName(s string) *UserCreate

SetTenantName sets the "tenant_name" field.

func (*UserCreate) SetUpdateTime

func (uc *UserCreate) SetUpdateTime(t time.Time) *UserCreate

SetUpdateTime sets the "update_time" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

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

Exec executes the query.

func (*UserCreateBulk) ExecX

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

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

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

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

func (*UserDelete) ExecX

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

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

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

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

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

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

type UserEdges

type UserEdges struct {
	// Policys holds the value of the policys edge.
	Policys []*AuthzPolicy `json:"policys,omitempty"`
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// Belong holds the value of the belong edge.
	Belong *Tenant `json:"belong,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) BelongOrErr

func (e UserEdges) BelongOrErr() (*Tenant, error)

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

func (UserEdges) PolicysOrErr

func (e UserEdges) PolicysOrErr() ([]*AuthzPolicy, error)

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

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

func (m *UserMutation) AddPolicyIDs(ids ...int)

AddPolicyIDs adds the "policys" edge to the AuthzPolicy entity by ids.

func (*UserMutation) AddRoleIDs

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

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

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

func (m *UserMutation) BelongCleared() bool

BelongCleared reports if the "belong" edge to the Tenant entity was cleared.

func (*UserMutation) BelongID

func (m *UserMutation) BelongID() (id int, exists bool)

BelongID returns the "belong" edge ID in the mutation.

func (*UserMutation) BelongIDs

func (m *UserMutation) BelongIDs() (ids []int)

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

func (*UserMutation) ClearBelong

func (m *UserMutation) ClearBelong()

ClearBelong clears the "belong" edge to the Tenant entity.

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

func (m *UserMutation) ClearEmail()

ClearEmail clears the value of the "email" field.

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

func (m *UserMutation) ClearPhone()

ClearPhone clears the value of the "phone" field.

func (*UserMutation) ClearPolicys

func (m *UserMutation) ClearPolicys()

ClearPolicys clears the "policys" edge to the AuthzPolicy entity.

func (*UserMutation) ClearRoles

func (m *UserMutation) ClearRoles()

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

func (*UserMutation) ClearTenantName

func (m *UserMutation) ClearTenantName()

ClearTenantName clears the value of the "tenant_name" field.

func (*UserMutation) ClearUpdateTime

func (m *UserMutation) ClearUpdateTime()

ClearUpdateTime clears the value of the "update_time" field.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreateTime

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

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

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Email

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

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

func (*UserMutation) EmailCleared

func (m *UserMutation) EmailCleared() bool

EmailCleared returns if the "email" field 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) ID

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

func (m *UserMutation) 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 (*UserMutation) OldCreateTime

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

OldCreateTime returns the old "create_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

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

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) 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) OldPasswd

func (m *UserMutation) OldPasswd(ctx context.Context) (v string, err error)

OldPasswd returns the old "passwd" 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) OldPhone

func (m *UserMutation) OldPhone(ctx context.Context) (v *string, err error)

OldPhone returns the old "phone" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldStatus

func (m *UserMutation) OldStatus(ctx context.Context) (v string, err error)

OldStatus returns the old "status" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldTenantName

func (m *UserMutation) OldTenantName(ctx context.Context) (v *string, err error)

OldTenantName returns the old "tenant_name" 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) OldUpdateTime

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

OldUpdateTime returns the old "update_time" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

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

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Passwd

func (m *UserMutation) Passwd() (r string, exists bool)

Passwd returns the value of the "passwd" field in the mutation.

func (*UserMutation) Phone

func (m *UserMutation) Phone() (r string, exists bool)

Phone returns the value of the "phone" field in the mutation.

func (*UserMutation) PhoneCleared

func (m *UserMutation) PhoneCleared() bool

PhoneCleared returns if the "phone" field was cleared in this mutation.

func (*UserMutation) PolicysCleared

func (m *UserMutation) PolicysCleared() bool

PolicysCleared reports if the "policys" edge to the AuthzPolicy entity was cleared.

func (*UserMutation) PolicysIDs

func (m *UserMutation) PolicysIDs() (ids []int)

PolicysIDs returns the "policys" edge IDs in the mutation.

func (*UserMutation) RemovePolicyIDs

func (m *UserMutation) RemovePolicyIDs(ids ...int)

RemovePolicyIDs removes the "policys" edge to the AuthzPolicy entity by IDs.

func (*UserMutation) RemoveRoleIDs

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

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

func (m *UserMutation) RemovedPolicysIDs() (ids []int)

RemovedPolicys returns the removed IDs of the "policys" edge to the AuthzPolicy entity.

func (*UserMutation) RemovedRolesIDs

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

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

func (*UserMutation) ResetBelong

func (m *UserMutation) ResetBelong()

ResetBelong resets all changes to the "belong" edge.

func (*UserMutation) ResetCreateTime

func (m *UserMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) 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) ResetPasswd

func (m *UserMutation) ResetPasswd()

ResetPasswd resets all changes to the "passwd" field.

func (*UserMutation) ResetPhone

func (m *UserMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*UserMutation) ResetPolicys

func (m *UserMutation) ResetPolicys()

ResetPolicys resets all changes to the "policys" edge.

func (*UserMutation) ResetRoles

func (m *UserMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*UserMutation) ResetStatus

func (m *UserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*UserMutation) ResetTenantName

func (m *UserMutation) ResetTenantName()

ResetTenantName resets all changes to the "tenant_name" field.

func (*UserMutation) ResetUpdateTime

func (m *UserMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" 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 []int)

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

func (*UserMutation) SetBelongID

func (m *UserMutation) SetBelongID(id int)

SetBelongID sets the "belong" edge to the Tenant entity by id.

func (*UserMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" 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) SetPasswd

func (m *UserMutation) SetPasswd(s string)

SetPasswd sets the "passwd" field.

func (*UserMutation) SetPhone

func (m *UserMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*UserMutation) SetStatus

func (m *UserMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*UserMutation) SetTenantName

func (m *UserMutation) SetTenantName(s string)

SetTenantName sets the "tenant_name" field.

func (*UserMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*UserMutation) Status

func (m *UserMutation) Status() (r string, exists bool)

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

func (*UserMutation) TenantName

func (m *UserMutation) TenantName() (r string, exists bool)

TenantName returns the value of the "tenant_name" field in the mutation.

func (*UserMutation) TenantNameCleared

func (m *UserMutation) TenantNameCleared() bool

TenantNameCleared returns if the "tenant_name" field was cleared in this mutation.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdateTime

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

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

func (*UserMutation) UpdateTimeCleared

func (m *UserMutation) UpdateTimeCleared() bool

UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.

func (*UserMutation) Username

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

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

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

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

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

client.User.Query().
	GroupBy(user.FieldUsername).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (uq *UserQuery) QueryBelong() *TenantQuery

QueryBelong chains the current query on the "belong" edge.

func (*UserQuery) QueryPolicys

func (uq *UserQuery) QueryPolicys() *AuthzPolicyQuery

QueryPolicys chains the current query on the "policys" edge.

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

client.User.Query().
	Select(user.FieldUsername).
	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) WithBelong

func (uq *UserQuery) WithBelong(opts ...func(*TenantQuery)) *UserQuery

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

func (*UserQuery) WithPolicys

func (uq *UserQuery) WithPolicys(opts ...func(*AuthzPolicyQuery)) *UserQuery

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

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

func (uu *UserUpdate) AddPolicyIDs(ids ...int) *UserUpdate

AddPolicyIDs adds the "policys" edge to the AuthzPolicy entity by IDs.

func (*UserUpdate) AddPolicys

func (uu *UserUpdate) AddPolicys(a ...*AuthzPolicy) *UserUpdate

AddPolicys adds the "policys" edges to the AuthzPolicy entity.

func (*UserUpdate) AddRoleIDs

func (uu *UserUpdate) AddRoleIDs(ids ...int) *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) ClearBelong

func (uu *UserUpdate) ClearBelong() *UserUpdate

ClearBelong clears the "belong" edge to the Tenant entity.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of the "email" field.

func (*UserUpdate) ClearPhone

func (uu *UserUpdate) ClearPhone() *UserUpdate

ClearPhone clears the value of the "phone" field.

func (*UserUpdate) ClearPolicys

func (uu *UserUpdate) ClearPolicys() *UserUpdate

ClearPolicys clears all "policys" edges to the AuthzPolicy entity.

func (*UserUpdate) ClearRoles

func (uu *UserUpdate) ClearRoles() *UserUpdate

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

func (*UserUpdate) ClearTenantName

func (uu *UserUpdate) ClearTenantName() *UserUpdate

ClearTenantName clears the value of the "tenant_name" field.

func (*UserUpdate) ClearUpdateTime

func (uu *UserUpdate) ClearUpdateTime() *UserUpdate

ClearUpdateTime clears the value of the "update_time" field.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemovePolicyIDs

func (uu *UserUpdate) RemovePolicyIDs(ids ...int) *UserUpdate

RemovePolicyIDs removes the "policys" edge to AuthzPolicy entities by IDs.

func (*UserUpdate) RemovePolicys

func (uu *UserUpdate) RemovePolicys(a ...*AuthzPolicy) *UserUpdate

RemovePolicys removes "policys" edges to AuthzPolicy entities.

func (*UserUpdate) RemoveRoleIDs

func (uu *UserUpdate) RemoveRoleIDs(ids ...int) *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) SetBelong

func (uu *UserUpdate) SetBelong(t *Tenant) *UserUpdate

SetBelong sets the "belong" edge to the Tenant entity.

func (*UserUpdate) SetBelongID

func (uu *UserUpdate) SetBelongID(id int) *UserUpdate

SetBelongID sets the "belong" edge to the Tenant entity by ID.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetNillableBelongID

func (uu *UserUpdate) SetNillableBelongID(id *int) *UserUpdate

SetNillableBelongID sets the "belong" edge to the Tenant entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillablePhone

func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdate) SetNillableTenantName

func (uu *UserUpdate) SetNillableTenantName(s *string) *UserUpdate

SetNillableTenantName sets the "tenant_name" field if the given value is not nil.

func (*UserUpdate) SetNillableUpdateTime

func (uu *UserUpdate) SetNillableUpdateTime(t *time.Time) *UserUpdate

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

func (*UserUpdate) SetPasswd

func (uu *UserUpdate) SetPasswd(s string) *UserUpdate

SetPasswd sets the "passwd" field.

func (*UserUpdate) SetPhone

func (uu *UserUpdate) SetPhone(s string) *UserUpdate

SetPhone sets the "phone" field.

func (*UserUpdate) SetStatus

func (uu *UserUpdate) SetStatus(s string) *UserUpdate

SetStatus sets the "status" field.

func (*UserUpdate) SetTenantName

func (uu *UserUpdate) SetTenantName(s string) *UserUpdate

SetTenantName sets the "tenant_name" field.

func (*UserUpdate) SetUpdateTime

func (uu *UserUpdate) SetUpdateTime(t time.Time) *UserUpdate

SetUpdateTime sets the "update_time" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddPolicyIDs

func (uuo *UserUpdateOne) AddPolicyIDs(ids ...int) *UserUpdateOne

AddPolicyIDs adds the "policys" edge to the AuthzPolicy entity by IDs.

func (*UserUpdateOne) AddPolicys

func (uuo *UserUpdateOne) AddPolicys(a ...*AuthzPolicy) *UserUpdateOne

AddPolicys adds the "policys" edges to the AuthzPolicy entity.

func (*UserUpdateOne) AddRoleIDs

func (uuo *UserUpdateOne) AddRoleIDs(ids ...int) *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) ClearBelong

func (uuo *UserUpdateOne) ClearBelong() *UserUpdateOne

ClearBelong clears the "belong" edge to the Tenant entity.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of the "email" field.

func (*UserUpdateOne) ClearPhone

func (uuo *UserUpdateOne) ClearPhone() *UserUpdateOne

ClearPhone clears the value of the "phone" field.

func (*UserUpdateOne) ClearPolicys

func (uuo *UserUpdateOne) ClearPolicys() *UserUpdateOne

ClearPolicys clears all "policys" edges to the AuthzPolicy entity.

func (*UserUpdateOne) ClearRoles

func (uuo *UserUpdateOne) ClearRoles() *UserUpdateOne

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

func (*UserUpdateOne) ClearTenantName

func (uuo *UserUpdateOne) ClearTenantName() *UserUpdateOne

ClearTenantName clears the value of the "tenant_name" field.

func (*UserUpdateOne) ClearUpdateTime

func (uuo *UserUpdateOne) ClearUpdateTime() *UserUpdateOne

ClearUpdateTime clears the value of the "update_time" field.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemovePolicyIDs

func (uuo *UserUpdateOne) RemovePolicyIDs(ids ...int) *UserUpdateOne

RemovePolicyIDs removes the "policys" edge to AuthzPolicy entities by IDs.

func (*UserUpdateOne) RemovePolicys

func (uuo *UserUpdateOne) RemovePolicys(a ...*AuthzPolicy) *UserUpdateOne

RemovePolicys removes "policys" edges to AuthzPolicy entities.

func (*UserUpdateOne) RemoveRoleIDs

func (uuo *UserUpdateOne) RemoveRoleIDs(ids ...int) *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) SetBelong

func (uuo *UserUpdateOne) SetBelong(t *Tenant) *UserUpdateOne

SetBelong sets the "belong" edge to the Tenant entity.

func (*UserUpdateOne) SetBelongID

func (uuo *UserUpdateOne) SetBelongID(id int) *UserUpdateOne

SetBelongID sets the "belong" edge to the Tenant entity by ID.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetNillableBelongID

func (uuo *UserUpdateOne) SetNillableBelongID(id *int) *UserUpdateOne

SetNillableBelongID sets the "belong" edge to the Tenant entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhone

func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdateOne) SetNillableTenantName

func (uuo *UserUpdateOne) SetNillableTenantName(s *string) *UserUpdateOne

SetNillableTenantName sets the "tenant_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUpdateTime

func (uuo *UserUpdateOne) SetNillableUpdateTime(t *time.Time) *UserUpdateOne

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

func (*UserUpdateOne) SetPasswd

func (uuo *UserUpdateOne) SetPasswd(s string) *UserUpdateOne

SetPasswd sets the "passwd" field.

func (*UserUpdateOne) SetPhone

func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne

SetPhone sets the "phone" field.

func (*UserUpdateOne) SetStatus

func (uuo *UserUpdateOne) SetStatus(s string) *UserUpdateOne

SetStatus sets the "status" field.

func (*UserUpdateOne) SetTenantName

func (uuo *UserUpdateOne) SetTenantName(s string) *UserUpdateOne

SetTenantName sets the "tenant_name" field.

func (*UserUpdateOne) SetUpdateTime

func (uuo *UserUpdateOne) SetUpdateTime(t time.Time) *UserUpdateOne

SetUpdateTime sets the "update_time" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" 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