ent

package
v0.0.0-...-f8e2896 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 28 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.
	TypeCasbinRule     = "CasbinRule"
	TypeDepartment     = "Department"
	TypeRole           = "Role"
	TypeTenant         = "Tenant"
	TypeUser           = "User"
	TypeUserAccount    = "UserAccount"
	TypeUserDepartment = "UserDepartment"
	TypeUserRole       = "UserRole"
	TypeUserTenant     = "UserTenant"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type 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 CasbinRule

type CasbinRule struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// 策略类型:p或g
	Ptype string `json:"ptype,omitempty"`
	// V0 holds the value of the "v0" field.
	V0 string `json:"v0,omitempty"`
	// V1 holds the value of the "v1" field.
	V1 string `json:"v1,omitempty"`
	// V2 holds the value of the "v2" field.
	V2 string `json:"v2,omitempty"`
	// V3 holds the value of the "v3" field.
	V3 string `json:"v3,omitempty"`
	// V4 holds the value of the "v4" field.
	V4 string `json:"v4,omitempty"`
	// V5 holds the value of the "v5" field.
	V5 string `json:"v5,omitempty"`
	// contains filtered or unexported fields
}

CasbinRule is the model entity for the CasbinRule schema.

func (*CasbinRule) String

func (cr *CasbinRule) String() string

String implements the fmt.Stringer.

func (*CasbinRule) Unwrap

func (cr *CasbinRule) Unwrap() *CasbinRule

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

func (cr *CasbinRule) Update() *CasbinRuleUpdateOne

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

func (*CasbinRule) Value

func (cr *CasbinRule) Value(name string) (ent.Value, error)

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

type CasbinRuleClient

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

CasbinRuleClient is a client for the CasbinRule schema.

func NewCasbinRuleClient

func NewCasbinRuleClient(c config) *CasbinRuleClient

NewCasbinRuleClient returns a client for the CasbinRule from the given config.

func (*CasbinRuleClient) Create

func (c *CasbinRuleClient) Create() *CasbinRuleCreate

Create returns a builder for creating a CasbinRule entity.

func (*CasbinRuleClient) CreateBulk

func (c *CasbinRuleClient) CreateBulk(builders ...*CasbinRuleCreate) *CasbinRuleCreateBulk

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

func (*CasbinRuleClient) Delete

func (c *CasbinRuleClient) Delete() *CasbinRuleDelete

Delete returns a delete builder for CasbinRule.

func (*CasbinRuleClient) DeleteOne

func (c *CasbinRuleClient) DeleteOne(cr *CasbinRule) *CasbinRuleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CasbinRuleClient) DeleteOneID

func (c *CasbinRuleClient) DeleteOneID(id int) *CasbinRuleDeleteOne

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

func (*CasbinRuleClient) Get

func (c *CasbinRuleClient) Get(ctx context.Context, id int) (*CasbinRule, error)

Get returns a CasbinRule entity by its id.

func (*CasbinRuleClient) GetX

func (c *CasbinRuleClient) GetX(ctx context.Context, id int) *CasbinRule

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

func (*CasbinRuleClient) Hooks

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

Hooks returns the client hooks.

func (*CasbinRuleClient) Intercept

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

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

func (*CasbinRuleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CasbinRuleClient) MapCreateBulk

func (c *CasbinRuleClient) MapCreateBulk(slice any, setFunc func(*CasbinRuleCreate, int)) *CasbinRuleCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*CasbinRuleClient) Query

func (c *CasbinRuleClient) Query() *CasbinRuleQuery

Query returns a query builder for CasbinRule.

func (*CasbinRuleClient) Update

func (c *CasbinRuleClient) Update() *CasbinRuleUpdate

Update returns an update builder for CasbinRule.

func (*CasbinRuleClient) UpdateOne

func (c *CasbinRuleClient) UpdateOne(cr *CasbinRule) *CasbinRuleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CasbinRuleClient) UpdateOneID

func (c *CasbinRuleClient) UpdateOneID(id int) *CasbinRuleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CasbinRuleClient) Use

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

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

type CasbinRuleCreate

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

CasbinRuleCreate is the builder for creating a CasbinRule entity.

func (*CasbinRuleCreate) Exec

func (crc *CasbinRuleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CasbinRuleCreate) ExecX

func (crc *CasbinRuleCreate) ExecX(ctx context.Context)

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

func (*CasbinRuleCreate) Mutation

func (crc *CasbinRuleCreate) Mutation() *CasbinRuleMutation

Mutation returns the CasbinRuleMutation object of the builder.

func (*CasbinRuleCreate) OnConflict

func (crc *CasbinRuleCreate) OnConflict(opts ...sql.ConflictOption) *CasbinRuleUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.CasbinRule.Create().
	SetPtype(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CasbinRuleUpsert) {
		SetPtype(v+v).
	}).
	Exec(ctx)

func (*CasbinRuleCreate) OnConflictColumns

func (crc *CasbinRuleCreate) OnConflictColumns(columns ...string) *CasbinRuleUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.CasbinRule.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CasbinRuleCreate) Save

func (crc *CasbinRuleCreate) Save(ctx context.Context) (*CasbinRule, error)

Save creates the CasbinRule in the database.

func (*CasbinRuleCreate) SaveX

func (crc *CasbinRuleCreate) SaveX(ctx context.Context) *CasbinRule

SaveX calls Save and panics if Save returns an error.

func (*CasbinRuleCreate) SetID

func (crc *CasbinRuleCreate) SetID(i int) *CasbinRuleCreate

SetID sets the "id" field.

func (*CasbinRuleCreate) SetNillableV0

func (crc *CasbinRuleCreate) SetNillableV0(s *string) *CasbinRuleCreate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinRuleCreate) SetNillableV1

func (crc *CasbinRuleCreate) SetNillableV1(s *string) *CasbinRuleCreate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinRuleCreate) SetNillableV2

func (crc *CasbinRuleCreate) SetNillableV2(s *string) *CasbinRuleCreate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinRuleCreate) SetNillableV3

func (crc *CasbinRuleCreate) SetNillableV3(s *string) *CasbinRuleCreate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinRuleCreate) SetNillableV4

func (crc *CasbinRuleCreate) SetNillableV4(s *string) *CasbinRuleCreate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinRuleCreate) SetNillableV5

func (crc *CasbinRuleCreate) SetNillableV5(s *string) *CasbinRuleCreate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinRuleCreate) SetPtype

func (crc *CasbinRuleCreate) SetPtype(s string) *CasbinRuleCreate

SetPtype sets the "ptype" field.

func (*CasbinRuleCreate) SetV0

func (crc *CasbinRuleCreate) SetV0(s string) *CasbinRuleCreate

SetV0 sets the "v0" field.

func (*CasbinRuleCreate) SetV1

func (crc *CasbinRuleCreate) SetV1(s string) *CasbinRuleCreate

SetV1 sets the "v1" field.

func (*CasbinRuleCreate) SetV2

func (crc *CasbinRuleCreate) SetV2(s string) *CasbinRuleCreate

SetV2 sets the "v2" field.

func (*CasbinRuleCreate) SetV3

func (crc *CasbinRuleCreate) SetV3(s string) *CasbinRuleCreate

SetV3 sets the "v3" field.

func (*CasbinRuleCreate) SetV4

func (crc *CasbinRuleCreate) SetV4(s string) *CasbinRuleCreate

SetV4 sets the "v4" field.

func (*CasbinRuleCreate) SetV5

func (crc *CasbinRuleCreate) SetV5(s string) *CasbinRuleCreate

SetV5 sets the "v5" field.

type CasbinRuleCreateBulk

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

CasbinRuleCreateBulk is the builder for creating many CasbinRule entities in bulk.

func (*CasbinRuleCreateBulk) Exec

func (crcb *CasbinRuleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CasbinRuleCreateBulk) ExecX

func (crcb *CasbinRuleCreateBulk) ExecX(ctx context.Context)

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

func (*CasbinRuleCreateBulk) OnConflict

func (crcb *CasbinRuleCreateBulk) OnConflict(opts ...sql.ConflictOption) *CasbinRuleUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.CasbinRule.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CasbinRuleUpsert) {
		SetPtype(v+v).
	}).
	Exec(ctx)

func (*CasbinRuleCreateBulk) OnConflictColumns

func (crcb *CasbinRuleCreateBulk) OnConflictColumns(columns ...string) *CasbinRuleUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.CasbinRule.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CasbinRuleCreateBulk) Save

func (crcb *CasbinRuleCreateBulk) Save(ctx context.Context) ([]*CasbinRule, error)

Save creates the CasbinRule entities in the database.

func (*CasbinRuleCreateBulk) SaveX

func (crcb *CasbinRuleCreateBulk) SaveX(ctx context.Context) []*CasbinRule

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

type CasbinRuleDelete

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

CasbinRuleDelete is the builder for deleting a CasbinRule entity.

func (*CasbinRuleDelete) Exec

func (crd *CasbinRuleDelete) Exec(ctx context.Context) (int, error)

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

func (*CasbinRuleDelete) ExecX

func (crd *CasbinRuleDelete) ExecX(ctx context.Context) int

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

func (*CasbinRuleDelete) Where

Where appends a list predicates to the CasbinRuleDelete builder.

type CasbinRuleDeleteOne

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

CasbinRuleDeleteOne is the builder for deleting a single CasbinRule entity.

func (*CasbinRuleDeleteOne) Exec

func (crdo *CasbinRuleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CasbinRuleDeleteOne) ExecX

func (crdo *CasbinRuleDeleteOne) ExecX(ctx context.Context)

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

func (*CasbinRuleDeleteOne) Where

Where appends a list predicates to the CasbinRuleDelete builder.

type CasbinRuleGroupBy

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

CasbinRuleGroupBy is the group-by builder for CasbinRule entities.

func (*CasbinRuleGroupBy) Aggregate

func (crgb *CasbinRuleGroupBy) Aggregate(fns ...AggregateFunc) *CasbinRuleGroupBy

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

func (*CasbinRuleGroupBy) Bool

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

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

func (*CasbinRuleGroupBy) BoolX

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

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

func (*CasbinRuleGroupBy) Bools

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

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

func (*CasbinRuleGroupBy) BoolsX

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

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

func (*CasbinRuleGroupBy) Float64

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

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

func (*CasbinRuleGroupBy) Float64X

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

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

func (*CasbinRuleGroupBy) Float64s

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

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

func (*CasbinRuleGroupBy) Float64sX

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

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

func (*CasbinRuleGroupBy) Int

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

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

func (*CasbinRuleGroupBy) IntX

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

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

func (*CasbinRuleGroupBy) Ints

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

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

func (*CasbinRuleGroupBy) IntsX

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

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

func (*CasbinRuleGroupBy) Scan

func (crgb *CasbinRuleGroupBy) Scan(ctx context.Context, v any) error

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

func (*CasbinRuleGroupBy) ScanX

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

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

func (*CasbinRuleGroupBy) String

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

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

func (*CasbinRuleGroupBy) StringX

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

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

func (*CasbinRuleGroupBy) Strings

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

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

func (*CasbinRuleGroupBy) StringsX

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

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

type CasbinRuleMutation

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

CasbinRuleMutation represents an operation that mutates the CasbinRule nodes in the graph.

func (*CasbinRuleMutation) AddField

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

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

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

func (*CasbinRuleMutation) AddedField

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

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

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

func (*CasbinRuleMutation) AddedIDs

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

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

func (*CasbinRuleMutation) ClearEdge

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

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

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

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

func (*CasbinRuleMutation) ClearedFields

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

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

func (CasbinRuleMutation) Client

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

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

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

func (*CasbinRuleMutation) Field

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

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

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

func (*CasbinRuleMutation) Fields

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

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

func (m *CasbinRuleMutation) 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 (*CasbinRuleMutation) OldField

func (m *CasbinRuleMutation) 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 (*CasbinRuleMutation) OldPtype

func (m *CasbinRuleMutation) OldPtype(ctx context.Context) (v string, err error)

OldPtype returns the old "ptype" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV0

func (m *CasbinRuleMutation) OldV0(ctx context.Context) (v string, err error)

OldV0 returns the old "v0" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV1

func (m *CasbinRuleMutation) OldV1(ctx context.Context) (v string, err error)

OldV1 returns the old "v1" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV2

func (m *CasbinRuleMutation) OldV2(ctx context.Context) (v string, err error)

OldV2 returns the old "v2" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV3

func (m *CasbinRuleMutation) OldV3(ctx context.Context) (v string, err error)

OldV3 returns the old "v3" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV4

func (m *CasbinRuleMutation) OldV4(ctx context.Context) (v string, err error)

OldV4 returns the old "v4" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) OldV5

func (m *CasbinRuleMutation) OldV5(ctx context.Context) (v string, err error)

OldV5 returns the old "v5" field's value of the CasbinRule entity. If the CasbinRule 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 (*CasbinRuleMutation) Op

func (m *CasbinRuleMutation) Op() Op

Op returns the operation name.

func (*CasbinRuleMutation) Ptype

func (m *CasbinRuleMutation) Ptype() (r string, exists bool)

Ptype returns the value of the "ptype" field in the mutation.

func (*CasbinRuleMutation) RemovedEdges

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

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

func (*CasbinRuleMutation) RemovedIDs

func (m *CasbinRuleMutation) 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 (*CasbinRuleMutation) ResetEdge

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

func (m *CasbinRuleMutation) 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 (*CasbinRuleMutation) ResetPtype

func (m *CasbinRuleMutation) ResetPtype()

ResetPtype resets all changes to the "ptype" field.

func (*CasbinRuleMutation) ResetV0

func (m *CasbinRuleMutation) ResetV0()

ResetV0 resets all changes to the "v0" field.

func (*CasbinRuleMutation) ResetV1

func (m *CasbinRuleMutation) ResetV1()

ResetV1 resets all changes to the "v1" field.

func (*CasbinRuleMutation) ResetV2

func (m *CasbinRuleMutation) ResetV2()

ResetV2 resets all changes to the "v2" field.

func (*CasbinRuleMutation) ResetV3

func (m *CasbinRuleMutation) ResetV3()

ResetV3 resets all changes to the "v3" field.

func (*CasbinRuleMutation) ResetV4

func (m *CasbinRuleMutation) ResetV4()

ResetV4 resets all changes to the "v4" field.

func (*CasbinRuleMutation) ResetV5

func (m *CasbinRuleMutation) ResetV5()

ResetV5 resets all changes to the "v5" field.

func (*CasbinRuleMutation) SetField

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

func (m *CasbinRuleMutation) SetID(id int)

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

func (*CasbinRuleMutation) SetOp

func (m *CasbinRuleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CasbinRuleMutation) SetPtype

func (m *CasbinRuleMutation) SetPtype(s string)

SetPtype sets the "ptype" field.

func (*CasbinRuleMutation) SetV0

func (m *CasbinRuleMutation) SetV0(s string)

SetV0 sets the "v0" field.

func (*CasbinRuleMutation) SetV1

func (m *CasbinRuleMutation) SetV1(s string)

SetV1 sets the "v1" field.

func (*CasbinRuleMutation) SetV2

func (m *CasbinRuleMutation) SetV2(s string)

SetV2 sets the "v2" field.

func (*CasbinRuleMutation) SetV3

func (m *CasbinRuleMutation) SetV3(s string)

SetV3 sets the "v3" field.

func (*CasbinRuleMutation) SetV4

func (m *CasbinRuleMutation) SetV4(s string)

SetV4 sets the "v4" field.

func (*CasbinRuleMutation) SetV5

func (m *CasbinRuleMutation) SetV5(s string)

SetV5 sets the "v5" field.

func (CasbinRuleMutation) Tx

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

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

func (*CasbinRuleMutation) Type

func (m *CasbinRuleMutation) Type() string

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

func (*CasbinRuleMutation) V0

func (m *CasbinRuleMutation) V0() (r string, exists bool)

V0 returns the value of the "v0" field in the mutation.

func (*CasbinRuleMutation) V1

func (m *CasbinRuleMutation) V1() (r string, exists bool)

V1 returns the value of the "v1" field in the mutation.

func (*CasbinRuleMutation) V2

func (m *CasbinRuleMutation) V2() (r string, exists bool)

V2 returns the value of the "v2" field in the mutation.

func (*CasbinRuleMutation) V3

func (m *CasbinRuleMutation) V3() (r string, exists bool)

V3 returns the value of the "v3" field in the mutation.

func (*CasbinRuleMutation) V4

func (m *CasbinRuleMutation) V4() (r string, exists bool)

V4 returns the value of the "v4" field in the mutation.

func (*CasbinRuleMutation) V5

func (m *CasbinRuleMutation) V5() (r string, exists bool)

V5 returns the value of the "v5" field in the mutation.

func (*CasbinRuleMutation) Where

func (m *CasbinRuleMutation) Where(ps ...predicate.CasbinRule)

Where appends a list predicates to the CasbinRuleMutation builder.

func (*CasbinRuleMutation) WhereP

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

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

type CasbinRuleQuery

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

CasbinRuleQuery is the builder for querying CasbinRule entities.

func (*CasbinRuleQuery) Aggregate

func (crq *CasbinRuleQuery) Aggregate(fns ...AggregateFunc) *CasbinRuleSelect

Aggregate returns a CasbinRuleSelect configured with the given aggregations.

func (*CasbinRuleQuery) All

func (crq *CasbinRuleQuery) All(ctx context.Context) ([]*CasbinRule, error)

All executes the query and returns a list of CasbinRules.

func (*CasbinRuleQuery) AllX

func (crq *CasbinRuleQuery) AllX(ctx context.Context) []*CasbinRule

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

func (*CasbinRuleQuery) Clone

func (crq *CasbinRuleQuery) Clone() *CasbinRuleQuery

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

func (*CasbinRuleQuery) Count

func (crq *CasbinRuleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CasbinRuleQuery) CountX

func (crq *CasbinRuleQuery) CountX(ctx context.Context) int

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

func (*CasbinRuleQuery) Exist

func (crq *CasbinRuleQuery) Exist(ctx context.Context) (bool, error)

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

func (*CasbinRuleQuery) ExistX

func (crq *CasbinRuleQuery) ExistX(ctx context.Context) bool

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

func (*CasbinRuleQuery) First

func (crq *CasbinRuleQuery) First(ctx context.Context) (*CasbinRule, error)

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

func (*CasbinRuleQuery) FirstID

func (crq *CasbinRuleQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CasbinRuleQuery) FirstIDX

func (crq *CasbinRuleQuery) FirstIDX(ctx context.Context) int

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

func (*CasbinRuleQuery) FirstX

func (crq *CasbinRuleQuery) FirstX(ctx context.Context) *CasbinRule

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

func (*CasbinRuleQuery) ForShare

func (crq *CasbinRuleQuery) ForShare(opts ...sql.LockOption) *CasbinRuleQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*CasbinRuleQuery) ForUpdate

func (crq *CasbinRuleQuery) ForUpdate(opts ...sql.LockOption) *CasbinRuleQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*CasbinRuleQuery) GroupBy

func (crq *CasbinRuleQuery) GroupBy(field string, fields ...string) *CasbinRuleGroupBy

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

client.CasbinRule.Query().
	GroupBy(casbinrule.FieldPtype).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CasbinRuleQuery) IDs

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

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

func (*CasbinRuleQuery) IDsX

func (crq *CasbinRuleQuery) IDsX(ctx context.Context) []int

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

func (*CasbinRuleQuery) Limit

func (crq *CasbinRuleQuery) Limit(limit int) *CasbinRuleQuery

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

func (*CasbinRuleQuery) Offset

func (crq *CasbinRuleQuery) Offset(offset int) *CasbinRuleQuery

Offset to start from.

func (*CasbinRuleQuery) Only

func (crq *CasbinRuleQuery) Only(ctx context.Context) (*CasbinRule, error)

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

func (*CasbinRuleQuery) OnlyID

func (crq *CasbinRuleQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CasbinRuleQuery) OnlyIDX

func (crq *CasbinRuleQuery) OnlyIDX(ctx context.Context) int

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

func (*CasbinRuleQuery) OnlyX

func (crq *CasbinRuleQuery) OnlyX(ctx context.Context) *CasbinRule

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

func (*CasbinRuleQuery) Order

Order specifies how the records should be ordered.

func (*CasbinRuleQuery) Select

func (crq *CasbinRuleQuery) Select(fields ...string) *CasbinRuleSelect

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

client.CasbinRule.Query().
	Select(casbinrule.FieldPtype).
	Scan(ctx, &v)

func (*CasbinRuleQuery) Unique

func (crq *CasbinRuleQuery) Unique(unique bool) *CasbinRuleQuery

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

Where adds a new predicate for the CasbinRuleQuery builder.

type CasbinRuleSelect

type CasbinRuleSelect struct {
	*CasbinRuleQuery
	// contains filtered or unexported fields
}

CasbinRuleSelect is the builder for selecting fields of CasbinRule entities.

func (*CasbinRuleSelect) Aggregate

func (crs *CasbinRuleSelect) Aggregate(fns ...AggregateFunc) *CasbinRuleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CasbinRuleSelect) Bool

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

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

func (*CasbinRuleSelect) BoolX

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

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

func (*CasbinRuleSelect) Bools

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

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

func (*CasbinRuleSelect) BoolsX

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

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

func (*CasbinRuleSelect) Float64

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

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

func (*CasbinRuleSelect) Float64X

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

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

func (*CasbinRuleSelect) Float64s

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

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

func (*CasbinRuleSelect) Float64sX

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

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

func (*CasbinRuleSelect) Int

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

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

func (*CasbinRuleSelect) IntX

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

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

func (*CasbinRuleSelect) Ints

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

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

func (*CasbinRuleSelect) IntsX

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

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

func (*CasbinRuleSelect) Scan

func (crs *CasbinRuleSelect) Scan(ctx context.Context, v any) error

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

func (*CasbinRuleSelect) ScanX

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

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

func (*CasbinRuleSelect) String

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

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

func (*CasbinRuleSelect) StringX

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

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

func (*CasbinRuleSelect) Strings

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

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

func (*CasbinRuleSelect) StringsX

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

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

type CasbinRuleUpdate

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

CasbinRuleUpdate is the builder for updating CasbinRule entities.

func (*CasbinRuleUpdate) Exec

func (cru *CasbinRuleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CasbinRuleUpdate) ExecX

func (cru *CasbinRuleUpdate) ExecX(ctx context.Context)

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

func (*CasbinRuleUpdate) Mutation

func (cru *CasbinRuleUpdate) Mutation() *CasbinRuleMutation

Mutation returns the CasbinRuleMutation object of the builder.

func (*CasbinRuleUpdate) Save

func (cru *CasbinRuleUpdate) Save(ctx context.Context) (int, error)

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

func (*CasbinRuleUpdate) SaveX

func (cru *CasbinRuleUpdate) SaveX(ctx context.Context) int

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

func (*CasbinRuleUpdate) SetNillablePtype

func (cru *CasbinRuleUpdate) SetNillablePtype(s *string) *CasbinRuleUpdate

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV0

func (cru *CasbinRuleUpdate) SetNillableV0(s *string) *CasbinRuleUpdate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV1

func (cru *CasbinRuleUpdate) SetNillableV1(s *string) *CasbinRuleUpdate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV2

func (cru *CasbinRuleUpdate) SetNillableV2(s *string) *CasbinRuleUpdate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV3

func (cru *CasbinRuleUpdate) SetNillableV3(s *string) *CasbinRuleUpdate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV4

func (cru *CasbinRuleUpdate) SetNillableV4(s *string) *CasbinRuleUpdate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinRuleUpdate) SetNillableV5

func (cru *CasbinRuleUpdate) SetNillableV5(s *string) *CasbinRuleUpdate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinRuleUpdate) SetPtype

func (cru *CasbinRuleUpdate) SetPtype(s string) *CasbinRuleUpdate

SetPtype sets the "ptype" field.

func (*CasbinRuleUpdate) SetV0

func (cru *CasbinRuleUpdate) SetV0(s string) *CasbinRuleUpdate

SetV0 sets the "v0" field.

func (*CasbinRuleUpdate) SetV1

func (cru *CasbinRuleUpdate) SetV1(s string) *CasbinRuleUpdate

SetV1 sets the "v1" field.

func (*CasbinRuleUpdate) SetV2

func (cru *CasbinRuleUpdate) SetV2(s string) *CasbinRuleUpdate

SetV2 sets the "v2" field.

func (*CasbinRuleUpdate) SetV3

func (cru *CasbinRuleUpdate) SetV3(s string) *CasbinRuleUpdate

SetV3 sets the "v3" field.

func (*CasbinRuleUpdate) SetV4

func (cru *CasbinRuleUpdate) SetV4(s string) *CasbinRuleUpdate

SetV4 sets the "v4" field.

func (*CasbinRuleUpdate) SetV5

func (cru *CasbinRuleUpdate) SetV5(s string) *CasbinRuleUpdate

SetV5 sets the "v5" field.

func (*CasbinRuleUpdate) Where

Where appends a list predicates to the CasbinRuleUpdate builder.

type CasbinRuleUpdateOne

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

CasbinRuleUpdateOne is the builder for updating a single CasbinRule entity.

func (*CasbinRuleUpdateOne) Exec

func (cruo *CasbinRuleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CasbinRuleUpdateOne) ExecX

func (cruo *CasbinRuleUpdateOne) ExecX(ctx context.Context)

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

func (*CasbinRuleUpdateOne) Mutation

func (cruo *CasbinRuleUpdateOne) Mutation() *CasbinRuleMutation

Mutation returns the CasbinRuleMutation object of the builder.

func (*CasbinRuleUpdateOne) Save

func (cruo *CasbinRuleUpdateOne) Save(ctx context.Context) (*CasbinRule, error)

Save executes the query and returns the updated CasbinRule entity.

func (*CasbinRuleUpdateOne) SaveX

func (cruo *CasbinRuleUpdateOne) SaveX(ctx context.Context) *CasbinRule

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

func (*CasbinRuleUpdateOne) Select

func (cruo *CasbinRuleUpdateOne) Select(field string, fields ...string) *CasbinRuleUpdateOne

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

func (*CasbinRuleUpdateOne) SetNillablePtype

func (cruo *CasbinRuleUpdateOne) SetNillablePtype(s *string) *CasbinRuleUpdateOne

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV0

func (cruo *CasbinRuleUpdateOne) SetNillableV0(s *string) *CasbinRuleUpdateOne

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV1

func (cruo *CasbinRuleUpdateOne) SetNillableV1(s *string) *CasbinRuleUpdateOne

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV2

func (cruo *CasbinRuleUpdateOne) SetNillableV2(s *string) *CasbinRuleUpdateOne

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV3

func (cruo *CasbinRuleUpdateOne) SetNillableV3(s *string) *CasbinRuleUpdateOne

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV4

func (cruo *CasbinRuleUpdateOne) SetNillableV4(s *string) *CasbinRuleUpdateOne

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetNillableV5

func (cruo *CasbinRuleUpdateOne) SetNillableV5(s *string) *CasbinRuleUpdateOne

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinRuleUpdateOne) SetPtype

func (cruo *CasbinRuleUpdateOne) SetPtype(s string) *CasbinRuleUpdateOne

SetPtype sets the "ptype" field.

func (*CasbinRuleUpdateOne) SetV0

SetV0 sets the "v0" field.

func (*CasbinRuleUpdateOne) SetV1

SetV1 sets the "v1" field.

func (*CasbinRuleUpdateOne) SetV2

SetV2 sets the "v2" field.

func (*CasbinRuleUpdateOne) SetV3

SetV3 sets the "v3" field.

func (*CasbinRuleUpdateOne) SetV4

SetV4 sets the "v4" field.

func (*CasbinRuleUpdateOne) SetV5

SetV5 sets the "v5" field.

func (*CasbinRuleUpdateOne) Where

Where appends a list predicates to the CasbinRuleUpdate builder.

type CasbinRuleUpsert

type CasbinRuleUpsert struct {
	*sql.UpdateSet
}

CasbinRuleUpsert is the "OnConflict" setter.

func (*CasbinRuleUpsert) SetPtype

func (u *CasbinRuleUpsert) SetPtype(v string) *CasbinRuleUpsert

SetPtype sets the "ptype" field.

func (*CasbinRuleUpsert) SetV0

SetV0 sets the "v0" field.

func (*CasbinRuleUpsert) SetV1

SetV1 sets the "v1" field.

func (*CasbinRuleUpsert) SetV2

SetV2 sets the "v2" field.

func (*CasbinRuleUpsert) SetV3

SetV3 sets the "v3" field.

func (*CasbinRuleUpsert) SetV4

SetV4 sets the "v4" field.

func (*CasbinRuleUpsert) SetV5

SetV5 sets the "v5" field.

func (*CasbinRuleUpsert) UpdatePtype

func (u *CasbinRuleUpsert) UpdatePtype() *CasbinRuleUpsert

UpdatePtype sets the "ptype" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV0

func (u *CasbinRuleUpsert) UpdateV0() *CasbinRuleUpsert

UpdateV0 sets the "v0" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV1

func (u *CasbinRuleUpsert) UpdateV1() *CasbinRuleUpsert

UpdateV1 sets the "v1" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV2

func (u *CasbinRuleUpsert) UpdateV2() *CasbinRuleUpsert

UpdateV2 sets the "v2" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV3

func (u *CasbinRuleUpsert) UpdateV3() *CasbinRuleUpsert

UpdateV3 sets the "v3" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV4

func (u *CasbinRuleUpsert) UpdateV4() *CasbinRuleUpsert

UpdateV4 sets the "v4" field to the value that was provided on create.

func (*CasbinRuleUpsert) UpdateV5

func (u *CasbinRuleUpsert) UpdateV5() *CasbinRuleUpsert

UpdateV5 sets the "v5" field to the value that was provided on create.

type CasbinRuleUpsertBulk

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

CasbinRuleUpsertBulk is the builder for "upsert"-ing a bulk of CasbinRule nodes.

func (*CasbinRuleUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CasbinRuleUpsertBulk) Exec

Exec executes the query.

func (*CasbinRuleUpsertBulk) ExecX

func (u *CasbinRuleUpsertBulk) ExecX(ctx context.Context)

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

func (*CasbinRuleUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.CasbinRule.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*CasbinRuleUpsertBulk) SetPtype

SetPtype sets the "ptype" field.

func (*CasbinRuleUpsertBulk) SetV0

SetV0 sets the "v0" field.

func (*CasbinRuleUpsertBulk) SetV1

SetV1 sets the "v1" field.

func (*CasbinRuleUpsertBulk) SetV2

SetV2 sets the "v2" field.

func (*CasbinRuleUpsertBulk) SetV3

SetV3 sets the "v3" field.

func (*CasbinRuleUpsertBulk) SetV4

SetV4 sets the "v4" field.

func (*CasbinRuleUpsertBulk) SetV5

SetV5 sets the "v5" field.

func (*CasbinRuleUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the CasbinRuleCreateBulk.OnConflict documentation for more info.

func (*CasbinRuleUpsertBulk) UpdateNewValues

func (u *CasbinRuleUpsertBulk) UpdateNewValues() *CasbinRuleUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.CasbinRule.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(casbinrule.FieldID)
		}),
	).
	Exec(ctx)

func (*CasbinRuleUpsertBulk) UpdatePtype

func (u *CasbinRuleUpsertBulk) UpdatePtype() *CasbinRuleUpsertBulk

UpdatePtype sets the "ptype" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV0

UpdateV0 sets the "v0" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV1

UpdateV1 sets the "v1" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV2

UpdateV2 sets the "v2" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV3

UpdateV3 sets the "v3" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV4

UpdateV4 sets the "v4" field to the value that was provided on create.

func (*CasbinRuleUpsertBulk) UpdateV5

UpdateV5 sets the "v5" field to the value that was provided on create.

type CasbinRuleUpsertOne

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

CasbinRuleUpsertOne is the builder for "upsert"-ing

one CasbinRule node.

func (*CasbinRuleUpsertOne) DoNothing

func (u *CasbinRuleUpsertOne) DoNothing() *CasbinRuleUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CasbinRuleUpsertOne) Exec

Exec executes the query.

func (*CasbinRuleUpsertOne) ExecX

func (u *CasbinRuleUpsertOne) ExecX(ctx context.Context)

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

func (*CasbinRuleUpsertOne) ID

func (u *CasbinRuleUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*CasbinRuleUpsertOne) IDX

func (u *CasbinRuleUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*CasbinRuleUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.CasbinRule.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*CasbinRuleUpsertOne) SetPtype

SetPtype sets the "ptype" field.

func (*CasbinRuleUpsertOne) SetV0

SetV0 sets the "v0" field.

func (*CasbinRuleUpsertOne) SetV1

SetV1 sets the "v1" field.

func (*CasbinRuleUpsertOne) SetV2

SetV2 sets the "v2" field.

func (*CasbinRuleUpsertOne) SetV3

SetV3 sets the "v3" field.

func (*CasbinRuleUpsertOne) SetV4

SetV4 sets the "v4" field.

func (*CasbinRuleUpsertOne) SetV5

SetV5 sets the "v5" field.

func (*CasbinRuleUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the CasbinRuleCreate.OnConflict documentation for more info.

func (*CasbinRuleUpsertOne) UpdateNewValues

func (u *CasbinRuleUpsertOne) UpdateNewValues() *CasbinRuleUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.CasbinRule.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(casbinrule.FieldID)
		}),
	).
	Exec(ctx)

func (*CasbinRuleUpsertOne) UpdatePtype

func (u *CasbinRuleUpsertOne) UpdatePtype() *CasbinRuleUpsertOne

UpdatePtype sets the "ptype" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV0

UpdateV0 sets the "v0" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV1

UpdateV1 sets the "v1" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV2

UpdateV2 sets the "v2" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV3

UpdateV3 sets the "v3" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV4

UpdateV4 sets the "v4" field to the value that was provided on create.

func (*CasbinRuleUpsertOne) UpdateV5

UpdateV5 sets the "v5" field to the value that was provided on create.

type CasbinRules

type CasbinRules []*CasbinRule

CasbinRules is a parsable slice of CasbinRule.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// CasbinRule is the client for interacting with the CasbinRule builders.
	CasbinRule *CasbinRuleClient
	// Department is the client for interacting with the Department builders.
	Department *DepartmentClient
	// 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
	// UserAccount is the client for interacting with the UserAccount builders.
	UserAccount *UserAccountClient
	// UserDepartment is the client for interacting with the UserDepartment builders.
	UserDepartment *UserDepartmentClient
	// UserRole is the client for interacting with the UserRole builders.
	UserRole *UserRoleClient
	// UserTenant is the client for interacting with the UserTenant builders.
	UserTenant *UserTenantClient
	// 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().
	CasbinRule.
	Query().
	Count(ctx)

func (*Client) Intercept

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

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Department

type Department struct {

	// ID of the ent.
	// Primary Key ID
	ID int64 `json:"id,omitempty"`
	// Tenant ID
	TenantID int64 `json:"tenant_id,omitempty"`
	// Parent Department ID
	ParentID int64 `json:"parent_id,omitempty"`
	// Name of the department
	Name string `json:"name,omitempty"`
	// save ltree path
	Path string `json:"path,omitempty"`
	// Attributes holds the value of the "attributes" field.
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	// User who created this record
	CreatedBy *int64 `json:"created_by,omitempty"`
	// User who last updated this record
	UpdatedBy *int64 `json:"updated_by,omitempty"`
	// Creation timestamp of this record
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Last update timestamp of this record
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Timestamp when the record was deleted, if applicable
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DepartmentQuery when eager-loading is set.
	Edges DepartmentEdges `json:"edges"`
	// contains filtered or unexported fields
}

Department is the model entity for the Department schema.

func (*Department) QueryTenant

func (d *Department) QueryTenant() *TenantQuery

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

func (*Department) QueryUserDepartments

func (d *Department) QueryUserDepartments() *UserDepartmentQuery

QueryUserDepartments queries the "user_departments" edge of the Department entity.

func (*Department) String

func (d *Department) String() string

String implements the fmt.Stringer.

func (*Department) Unwrap

func (d *Department) Unwrap() *Department

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

func (d *Department) Update() *DepartmentUpdateOne

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

func (*Department) Value

func (d *Department) Value(name string) (ent.Value, error)

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

type DepartmentClient

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

DepartmentClient is a client for the Department schema.

func NewDepartmentClient

func NewDepartmentClient(c config) *DepartmentClient

NewDepartmentClient returns a client for the Department from the given config.

func (*DepartmentClient) Create

func (c *DepartmentClient) Create() *DepartmentCreate

Create returns a builder for creating a Department entity.

func (*DepartmentClient) CreateBulk

func (c *DepartmentClient) CreateBulk(builders ...*DepartmentCreate) *DepartmentCreateBulk

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

func (*DepartmentClient) Delete

func (c *DepartmentClient) Delete() *DepartmentDelete

Delete returns a delete builder for Department.

func (*DepartmentClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DepartmentClient) DeleteOneID

func (c *DepartmentClient) DeleteOneID(id int64) *DepartmentDeleteOne

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

func (*DepartmentClient) Get

func (c *DepartmentClient) Get(ctx context.Context, id int64) (*Department, error)

Get returns a Department entity by its id.

func (*DepartmentClient) GetX

func (c *DepartmentClient) GetX(ctx context.Context, id int64) *Department

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

func (*DepartmentClient) Hooks

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

Hooks returns the client hooks.

func (*DepartmentClient) Intercept

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

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

func (*DepartmentClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DepartmentClient) MapCreateBulk

func (c *DepartmentClient) MapCreateBulk(slice any, setFunc func(*DepartmentCreate, int)) *DepartmentCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*DepartmentClient) Query

func (c *DepartmentClient) Query() *DepartmentQuery

Query returns a query builder for Department.

func (*DepartmentClient) QueryTenant

func (c *DepartmentClient) QueryTenant(d *Department) *TenantQuery

QueryTenant queries the tenant edge of a Department.

func (*DepartmentClient) QueryUserDepartments

func (c *DepartmentClient) QueryUserDepartments(d *Department) *UserDepartmentQuery

QueryUserDepartments queries the user_departments edge of a Department.

func (*DepartmentClient) Update

func (c *DepartmentClient) Update() *DepartmentUpdate

Update returns an update builder for Department.

func (*DepartmentClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*DepartmentClient) UpdateOneID

func (c *DepartmentClient) UpdateOneID(id int64) *DepartmentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DepartmentClient) Use

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

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

type DepartmentCreate

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

DepartmentCreate is the builder for creating a Department entity.

func (*DepartmentCreate) AddUserDepartmentIDs

func (dc *DepartmentCreate) AddUserDepartmentIDs(ids ...int) *DepartmentCreate

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*DepartmentCreate) AddUserDepartments

func (dc *DepartmentCreate) AddUserDepartments(u ...*UserDepartment) *DepartmentCreate

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*DepartmentCreate) Exec

func (dc *DepartmentCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DepartmentCreate) ExecX

func (dc *DepartmentCreate) ExecX(ctx context.Context)

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

func (*DepartmentCreate) Mutation

func (dc *DepartmentCreate) Mutation() *DepartmentMutation

Mutation returns the DepartmentMutation object of the builder.

func (*DepartmentCreate) OnConflict

func (dc *DepartmentCreate) OnConflict(opts ...sql.ConflictOption) *DepartmentUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Department.Create().
	SetTenantID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DepartmentUpsert) {
		SetTenantID(v+v).
	}).
	Exec(ctx)

func (*DepartmentCreate) OnConflictColumns

func (dc *DepartmentCreate) OnConflictColumns(columns ...string) *DepartmentUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Department.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DepartmentCreate) Save

func (dc *DepartmentCreate) Save(ctx context.Context) (*Department, error)

Save creates the Department in the database.

func (*DepartmentCreate) SaveX

func (dc *DepartmentCreate) SaveX(ctx context.Context) *Department

SaveX calls Save and panics if Save returns an error.

func (*DepartmentCreate) SetAttributes

func (dc *DepartmentCreate) SetAttributes(m map[string]interface{}) *DepartmentCreate

SetAttributes sets the "attributes" field.

func (*DepartmentCreate) SetCreatedAt

func (dc *DepartmentCreate) SetCreatedAt(t time.Time) *DepartmentCreate

SetCreatedAt sets the "created_at" field.

func (*DepartmentCreate) SetCreatedBy

func (dc *DepartmentCreate) SetCreatedBy(i int64) *DepartmentCreate

SetCreatedBy sets the "created_by" field.

func (*DepartmentCreate) SetDeletedAt

func (dc *DepartmentCreate) SetDeletedAt(t time.Time) *DepartmentCreate

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentCreate) SetID

func (dc *DepartmentCreate) SetID(i int64) *DepartmentCreate

SetID sets the "id" field.

func (*DepartmentCreate) SetName

func (dc *DepartmentCreate) SetName(s string) *DepartmentCreate

SetName sets the "name" field.

func (*DepartmentCreate) SetNillableCreatedAt

func (dc *DepartmentCreate) SetNillableCreatedAt(t *time.Time) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableCreatedBy

func (dc *DepartmentCreate) SetNillableCreatedBy(i *int64) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableDeletedAt

func (dc *DepartmentCreate) SetNillableDeletedAt(t *time.Time) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableID

func (dc *DepartmentCreate) SetNillableID(i *int64) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableUpdatedAt

func (dc *DepartmentCreate) SetNillableUpdatedAt(t *time.Time) *DepartmentCreate

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

func (*DepartmentCreate) SetNillableUpdatedBy

func (dc *DepartmentCreate) SetNillableUpdatedBy(i *int64) *DepartmentCreate

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

func (*DepartmentCreate) SetParentID

func (dc *DepartmentCreate) SetParentID(i int64) *DepartmentCreate

SetParentID sets the "parent_id" field.

func (*DepartmentCreate) SetPath

func (dc *DepartmentCreate) SetPath(s string) *DepartmentCreate

SetPath sets the "path" field.

func (*DepartmentCreate) SetTenant

func (dc *DepartmentCreate) SetTenant(t *Tenant) *DepartmentCreate

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

func (*DepartmentCreate) SetTenantID

func (dc *DepartmentCreate) SetTenantID(i int64) *DepartmentCreate

SetTenantID sets the "tenant_id" field.

func (*DepartmentCreate) SetUpdatedAt

func (dc *DepartmentCreate) SetUpdatedAt(t time.Time) *DepartmentCreate

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentCreate) SetUpdatedBy

func (dc *DepartmentCreate) SetUpdatedBy(i int64) *DepartmentCreate

SetUpdatedBy sets the "updated_by" field.

type DepartmentCreateBulk

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

DepartmentCreateBulk is the builder for creating many Department entities in bulk.

func (*DepartmentCreateBulk) Exec

func (dcb *DepartmentCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DepartmentCreateBulk) ExecX

func (dcb *DepartmentCreateBulk) ExecX(ctx context.Context)

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

func (*DepartmentCreateBulk) OnConflict

func (dcb *DepartmentCreateBulk) OnConflict(opts ...sql.ConflictOption) *DepartmentUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Department.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DepartmentUpsert) {
		SetTenantID(v+v).
	}).
	Exec(ctx)

func (*DepartmentCreateBulk) OnConflictColumns

func (dcb *DepartmentCreateBulk) OnConflictColumns(columns ...string) *DepartmentUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Department.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DepartmentCreateBulk) Save

func (dcb *DepartmentCreateBulk) Save(ctx context.Context) ([]*Department, error)

Save creates the Department entities in the database.

func (*DepartmentCreateBulk) SaveX

func (dcb *DepartmentCreateBulk) SaveX(ctx context.Context) []*Department

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

type DepartmentDelete

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

DepartmentDelete is the builder for deleting a Department entity.

func (*DepartmentDelete) Exec

func (dd *DepartmentDelete) Exec(ctx context.Context) (int, error)

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

func (*DepartmentDelete) ExecX

func (dd *DepartmentDelete) ExecX(ctx context.Context) int

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

func (*DepartmentDelete) Where

Where appends a list predicates to the DepartmentDelete builder.

type DepartmentDeleteOne

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

DepartmentDeleteOne is the builder for deleting a single Department entity.

func (*DepartmentDeleteOne) Exec

func (ddo *DepartmentDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DepartmentDeleteOne) ExecX

func (ddo *DepartmentDeleteOne) ExecX(ctx context.Context)

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

func (*DepartmentDeleteOne) Where

Where appends a list predicates to the DepartmentDelete builder.

type DepartmentEdges

type DepartmentEdges struct {
	// Tenant holds the value of the tenant edge.
	Tenant *Tenant `json:"tenant,omitempty"`
	// UserDepartments holds the value of the user_departments edge.
	UserDepartments []*UserDepartment `json:"user_departments,omitempty"`
	// contains filtered or unexported fields
}

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

func (DepartmentEdges) TenantOrErr

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

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

func (DepartmentEdges) UserDepartmentsOrErr

func (e DepartmentEdges) UserDepartmentsOrErr() ([]*UserDepartment, error)

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

type DepartmentGroupBy

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

DepartmentGroupBy is the group-by builder for Department entities.

func (*DepartmentGroupBy) Aggregate

func (dgb *DepartmentGroupBy) Aggregate(fns ...AggregateFunc) *DepartmentGroupBy

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

func (*DepartmentGroupBy) Bool

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

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

func (*DepartmentGroupBy) BoolX

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

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

func (*DepartmentGroupBy) Bools

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

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

func (*DepartmentGroupBy) BoolsX

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

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

func (*DepartmentGroupBy) Float64

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

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

func (*DepartmentGroupBy) Float64X

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

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

func (*DepartmentGroupBy) Float64s

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

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

func (*DepartmentGroupBy) Float64sX

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

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

func (*DepartmentGroupBy) Int

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

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

func (*DepartmentGroupBy) IntX

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

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

func (*DepartmentGroupBy) Ints

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

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

func (*DepartmentGroupBy) IntsX

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

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

func (*DepartmentGroupBy) Scan

func (dgb *DepartmentGroupBy) Scan(ctx context.Context, v any) error

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

func (*DepartmentGroupBy) ScanX

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

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

func (*DepartmentGroupBy) String

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

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

func (*DepartmentGroupBy) StringX

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

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

func (*DepartmentGroupBy) Strings

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

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

func (*DepartmentGroupBy) StringsX

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

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

type DepartmentMutation

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

DepartmentMutation represents an operation that mutates the Department nodes in the graph.

func (*DepartmentMutation) AddCreatedBy

func (m *DepartmentMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*DepartmentMutation) AddField

func (m *DepartmentMutation) 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 (*DepartmentMutation) AddParentID

func (m *DepartmentMutation) AddParentID(i int64)

AddParentID adds i to the "parent_id" field.

func (*DepartmentMutation) AddUpdatedBy

func (m *DepartmentMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*DepartmentMutation) AddUserDepartmentIDs

func (m *DepartmentMutation) AddUserDepartmentIDs(ids ...int)

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by ids.

func (*DepartmentMutation) AddedCreatedBy

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

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

func (*DepartmentMutation) AddedEdges

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

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

func (*DepartmentMutation) AddedField

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

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

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

func (*DepartmentMutation) AddedIDs

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

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

func (*DepartmentMutation) AddedParentID

func (m *DepartmentMutation) AddedParentID() (r int64, exists bool)

AddedParentID returns the value that was added to the "parent_id" field in this mutation.

func (*DepartmentMutation) AddedUpdatedBy

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

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

func (*DepartmentMutation) Attributes

func (m *DepartmentMutation) Attributes() (r map[string]interface{}, exists bool)

Attributes returns the value of the "attributes" field in the mutation.

func (*DepartmentMutation) ClearCreatedBy

func (m *DepartmentMutation) ClearCreatedBy()

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentMutation) ClearDeletedAt

func (m *DepartmentMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentMutation) ClearEdge

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

func (m *DepartmentMutation) 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 (*DepartmentMutation) ClearTenant

func (m *DepartmentMutation) ClearTenant()

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

func (*DepartmentMutation) ClearUpdatedBy

func (m *DepartmentMutation) ClearUpdatedBy()

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentMutation) ClearUserDepartments

func (m *DepartmentMutation) ClearUserDepartments()

ClearUserDepartments clears the "user_departments" edge to the UserDepartment entity.

func (*DepartmentMutation) ClearedEdges

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

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

func (*DepartmentMutation) ClearedFields

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

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

func (DepartmentMutation) Client

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

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

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

func (*DepartmentMutation) CreatedBy

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

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

func (*DepartmentMutation) CreatedByCleared

func (m *DepartmentMutation) CreatedByCleared() bool

CreatedByCleared returns if the "created_by" field was cleared in this mutation.

func (*DepartmentMutation) DeletedAt

func (m *DepartmentMutation) DeletedAt() (r time.Time, exists bool)

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

func (*DepartmentMutation) DeletedAtCleared

func (m *DepartmentMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*DepartmentMutation) EdgeCleared

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

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

func (*DepartmentMutation) Field

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

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

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

func (*DepartmentMutation) Fields

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

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

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

func (*DepartmentMutation) IDs

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

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

func (*DepartmentMutation) Name

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

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

func (*DepartmentMutation) OldAttributes

func (m *DepartmentMutation) OldAttributes(ctx context.Context) (v map[string]interface{}, err error)

OldAttributes returns the old "attributes" field's value of the Department entity. If the Department 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 (*DepartmentMutation) OldCreatedAt

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

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

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

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

func (m *DepartmentMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

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

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

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

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

func (m *DepartmentMutation) OldParentID(ctx context.Context) (v int64, err error)

OldParentID returns the old "parent_id" field's value of the Department entity. If the Department 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 (*DepartmentMutation) OldPath

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

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

func (m *DepartmentMutation) OldTenantID(ctx context.Context) (v int64, err error)

OldTenantID returns the old "tenant_id" field's value of the Department entity. If the Department 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 (*DepartmentMutation) OldUpdatedAt

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

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

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

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

func (m *DepartmentMutation) Op() Op

Op returns the operation name.

func (*DepartmentMutation) ParentID

func (m *DepartmentMutation) ParentID() (r int64, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*DepartmentMutation) Path

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

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

func (*DepartmentMutation) RemoveUserDepartmentIDs

func (m *DepartmentMutation) RemoveUserDepartmentIDs(ids ...int)

RemoveUserDepartmentIDs removes the "user_departments" edge to the UserDepartment entity by IDs.

func (*DepartmentMutation) RemovedEdges

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

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

func (*DepartmentMutation) RemovedIDs

func (m *DepartmentMutation) 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 (*DepartmentMutation) RemovedUserDepartmentsIDs

func (m *DepartmentMutation) RemovedUserDepartmentsIDs() (ids []int)

RemovedUserDepartments returns the removed IDs of the "user_departments" edge to the UserDepartment entity.

func (*DepartmentMutation) ResetAttributes

func (m *DepartmentMutation) ResetAttributes()

ResetAttributes resets all changes to the "attributes" field.

func (*DepartmentMutation) ResetCreatedAt

func (m *DepartmentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DepartmentMutation) ResetCreatedBy

func (m *DepartmentMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*DepartmentMutation) ResetDeletedAt

func (m *DepartmentMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*DepartmentMutation) ResetEdge

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

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

func (m *DepartmentMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*DepartmentMutation) ResetParentID

func (m *DepartmentMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*DepartmentMutation) ResetPath

func (m *DepartmentMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*DepartmentMutation) ResetTenant

func (m *DepartmentMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*DepartmentMutation) ResetTenantID

func (m *DepartmentMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*DepartmentMutation) ResetUpdatedAt

func (m *DepartmentMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DepartmentMutation) ResetUpdatedBy

func (m *DepartmentMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*DepartmentMutation) ResetUserDepartments

func (m *DepartmentMutation) ResetUserDepartments()

ResetUserDepartments resets all changes to the "user_departments" edge.

func (*DepartmentMutation) SetAttributes

func (m *DepartmentMutation) SetAttributes(value map[string]interface{})

SetAttributes sets the "attributes" field.

func (*DepartmentMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DepartmentMutation) SetCreatedBy

func (m *DepartmentMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*DepartmentMutation) SetDeletedAt

func (m *DepartmentMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentMutation) SetField

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

func (m *DepartmentMutation) SetID(id int64)

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

func (*DepartmentMutation) SetName

func (m *DepartmentMutation) SetName(s string)

SetName sets the "name" field.

func (*DepartmentMutation) SetOp

func (m *DepartmentMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DepartmentMutation) SetParentID

func (m *DepartmentMutation) SetParentID(i int64)

SetParentID sets the "parent_id" field.

func (*DepartmentMutation) SetPath

func (m *DepartmentMutation) SetPath(s string)

SetPath sets the "path" field.

func (*DepartmentMutation) SetTenantID

func (m *DepartmentMutation) SetTenantID(i int64)

SetTenantID sets the "tenant_id" field.

func (*DepartmentMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentMutation) SetUpdatedBy

func (m *DepartmentMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentMutation) TenantCleared

func (m *DepartmentMutation) TenantCleared() bool

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

func (*DepartmentMutation) TenantID

func (m *DepartmentMutation) TenantID() (r int64, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (*DepartmentMutation) TenantIDs

func (m *DepartmentMutation) TenantIDs() (ids []int64)

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

func (DepartmentMutation) Tx

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

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

func (*DepartmentMutation) Type

func (m *DepartmentMutation) Type() string

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

func (*DepartmentMutation) UpdatedAt

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

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

func (*DepartmentMutation) UpdatedBy

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

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

func (*DepartmentMutation) UpdatedByCleared

func (m *DepartmentMutation) UpdatedByCleared() bool

UpdatedByCleared returns if the "updated_by" field was cleared in this mutation.

func (*DepartmentMutation) UserDepartmentsCleared

func (m *DepartmentMutation) UserDepartmentsCleared() bool

UserDepartmentsCleared reports if the "user_departments" edge to the UserDepartment entity was cleared.

func (*DepartmentMutation) UserDepartmentsIDs

func (m *DepartmentMutation) UserDepartmentsIDs() (ids []int)

UserDepartmentsIDs returns the "user_departments" edge IDs in the mutation.

func (*DepartmentMutation) Where

func (m *DepartmentMutation) Where(ps ...predicate.Department)

Where appends a list predicates to the DepartmentMutation builder.

func (*DepartmentMutation) WhereP

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

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

type DepartmentQuery

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

DepartmentQuery is the builder for querying Department entities.

func (*DepartmentQuery) Aggregate

func (dq *DepartmentQuery) Aggregate(fns ...AggregateFunc) *DepartmentSelect

Aggregate returns a DepartmentSelect configured with the given aggregations.

func (*DepartmentQuery) All

func (dq *DepartmentQuery) All(ctx context.Context) ([]*Department, error)

All executes the query and returns a list of Departments.

func (*DepartmentQuery) AllX

func (dq *DepartmentQuery) AllX(ctx context.Context) []*Department

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

func (*DepartmentQuery) Clone

func (dq *DepartmentQuery) Clone() *DepartmentQuery

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

func (*DepartmentQuery) Count

func (dq *DepartmentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DepartmentQuery) CountX

func (dq *DepartmentQuery) CountX(ctx context.Context) int

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

func (*DepartmentQuery) Exist

func (dq *DepartmentQuery) Exist(ctx context.Context) (bool, error)

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

func (*DepartmentQuery) ExistX

func (dq *DepartmentQuery) ExistX(ctx context.Context) bool

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

func (*DepartmentQuery) First

func (dq *DepartmentQuery) First(ctx context.Context) (*Department, error)

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

func (*DepartmentQuery) FirstID

func (dq *DepartmentQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*DepartmentQuery) FirstIDX

func (dq *DepartmentQuery) FirstIDX(ctx context.Context) int64

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

func (*DepartmentQuery) FirstX

func (dq *DepartmentQuery) FirstX(ctx context.Context) *Department

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

func (*DepartmentQuery) ForShare

func (dq *DepartmentQuery) ForShare(opts ...sql.LockOption) *DepartmentQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*DepartmentQuery) ForUpdate

func (dq *DepartmentQuery) ForUpdate(opts ...sql.LockOption) *DepartmentQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*DepartmentQuery) GroupBy

func (dq *DepartmentQuery) GroupBy(field string, fields ...string) *DepartmentGroupBy

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 {
	TenantID int64 `json:"tenant_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Department.Query().
	GroupBy(department.FieldTenantID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DepartmentQuery) IDs

func (dq *DepartmentQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*DepartmentQuery) IDsX

func (dq *DepartmentQuery) IDsX(ctx context.Context) []int64

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

func (*DepartmentQuery) Limit

func (dq *DepartmentQuery) Limit(limit int) *DepartmentQuery

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

func (*DepartmentQuery) Offset

func (dq *DepartmentQuery) Offset(offset int) *DepartmentQuery

Offset to start from.

func (*DepartmentQuery) Only

func (dq *DepartmentQuery) Only(ctx context.Context) (*Department, error)

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

func (*DepartmentQuery) OnlyID

func (dq *DepartmentQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*DepartmentQuery) OnlyIDX

func (dq *DepartmentQuery) OnlyIDX(ctx context.Context) int64

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

func (*DepartmentQuery) OnlyX

func (dq *DepartmentQuery) OnlyX(ctx context.Context) *Department

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

func (*DepartmentQuery) Order

Order specifies how the records should be ordered.

func (*DepartmentQuery) QueryTenant

func (dq *DepartmentQuery) QueryTenant() *TenantQuery

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

func (*DepartmentQuery) QueryUserDepartments

func (dq *DepartmentQuery) QueryUserDepartments() *UserDepartmentQuery

QueryUserDepartments chains the current query on the "user_departments" edge.

func (*DepartmentQuery) Select

func (dq *DepartmentQuery) Select(fields ...string) *DepartmentSelect

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 {
	TenantID int64 `json:"tenant_id,omitempty"`
}

client.Department.Query().
	Select(department.FieldTenantID).
	Scan(ctx, &v)

func (*DepartmentQuery) Unique

func (dq *DepartmentQuery) Unique(unique bool) *DepartmentQuery

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

Where adds a new predicate for the DepartmentQuery builder.

func (*DepartmentQuery) WithTenant

func (dq *DepartmentQuery) WithTenant(opts ...func(*TenantQuery)) *DepartmentQuery

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

func (*DepartmentQuery) WithUserDepartments

func (dq *DepartmentQuery) WithUserDepartments(opts ...func(*UserDepartmentQuery)) *DepartmentQuery

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

type DepartmentSelect

type DepartmentSelect struct {
	*DepartmentQuery
	// contains filtered or unexported fields
}

DepartmentSelect is the builder for selecting fields of Department entities.

func (*DepartmentSelect) Aggregate

func (ds *DepartmentSelect) Aggregate(fns ...AggregateFunc) *DepartmentSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DepartmentSelect) Bool

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

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

func (*DepartmentSelect) BoolX

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

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

func (*DepartmentSelect) Bools

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

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

func (*DepartmentSelect) BoolsX

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

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

func (*DepartmentSelect) Float64

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

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

func (*DepartmentSelect) Float64X

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

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

func (*DepartmentSelect) Float64s

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

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

func (*DepartmentSelect) Float64sX

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

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

func (*DepartmentSelect) Int

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

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

func (*DepartmentSelect) IntX

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

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

func (*DepartmentSelect) Ints

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

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

func (*DepartmentSelect) IntsX

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

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

func (*DepartmentSelect) Scan

func (ds *DepartmentSelect) Scan(ctx context.Context, v any) error

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

func (*DepartmentSelect) ScanX

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

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

func (*DepartmentSelect) String

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

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

func (*DepartmentSelect) StringX

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

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

func (*DepartmentSelect) Strings

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

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

func (*DepartmentSelect) StringsX

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

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

type DepartmentUpdate

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

DepartmentUpdate is the builder for updating Department entities.

func (*DepartmentUpdate) AddCreatedBy

func (du *DepartmentUpdate) AddCreatedBy(i int64) *DepartmentUpdate

AddCreatedBy adds i to the "created_by" field.

func (*DepartmentUpdate) AddParentID

func (du *DepartmentUpdate) AddParentID(i int64) *DepartmentUpdate

AddParentID adds i to the "parent_id" field.

func (*DepartmentUpdate) AddUpdatedBy

func (du *DepartmentUpdate) AddUpdatedBy(i int64) *DepartmentUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*DepartmentUpdate) AddUserDepartmentIDs

func (du *DepartmentUpdate) AddUserDepartmentIDs(ids ...int) *DepartmentUpdate

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*DepartmentUpdate) AddUserDepartments

func (du *DepartmentUpdate) AddUserDepartments(u ...*UserDepartment) *DepartmentUpdate

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*DepartmentUpdate) ClearCreatedBy

func (du *DepartmentUpdate) ClearCreatedBy() *DepartmentUpdate

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentUpdate) ClearDeletedAt

func (du *DepartmentUpdate) ClearDeletedAt() *DepartmentUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentUpdate) ClearTenant

func (du *DepartmentUpdate) ClearTenant() *DepartmentUpdate

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

func (*DepartmentUpdate) ClearUpdatedBy

func (du *DepartmentUpdate) ClearUpdatedBy() *DepartmentUpdate

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentUpdate) ClearUserDepartments

func (du *DepartmentUpdate) ClearUserDepartments() *DepartmentUpdate

ClearUserDepartments clears all "user_departments" edges to the UserDepartment entity.

func (*DepartmentUpdate) Exec

func (du *DepartmentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DepartmentUpdate) ExecX

func (du *DepartmentUpdate) ExecX(ctx context.Context)

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

func (*DepartmentUpdate) Mutation

func (du *DepartmentUpdate) Mutation() *DepartmentMutation

Mutation returns the DepartmentMutation object of the builder.

func (*DepartmentUpdate) RemoveUserDepartmentIDs

func (du *DepartmentUpdate) RemoveUserDepartmentIDs(ids ...int) *DepartmentUpdate

RemoveUserDepartmentIDs removes the "user_departments" edge to UserDepartment entities by IDs.

func (*DepartmentUpdate) RemoveUserDepartments

func (du *DepartmentUpdate) RemoveUserDepartments(u ...*UserDepartment) *DepartmentUpdate

RemoveUserDepartments removes "user_departments" edges to UserDepartment entities.

func (*DepartmentUpdate) Save

func (du *DepartmentUpdate) Save(ctx context.Context) (int, error)

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

func (*DepartmentUpdate) SaveX

func (du *DepartmentUpdate) SaveX(ctx context.Context) int

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

func (*DepartmentUpdate) SetAttributes

func (du *DepartmentUpdate) SetAttributes(m map[string]interface{}) *DepartmentUpdate

SetAttributes sets the "attributes" field.

func (*DepartmentUpdate) SetCreatedBy

func (du *DepartmentUpdate) SetCreatedBy(i int64) *DepartmentUpdate

SetCreatedBy sets the "created_by" field.

func (*DepartmentUpdate) SetDeletedAt

func (du *DepartmentUpdate) SetDeletedAt(t time.Time) *DepartmentUpdate

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentUpdate) SetName

func (du *DepartmentUpdate) SetName(s string) *DepartmentUpdate

SetName sets the "name" field.

func (*DepartmentUpdate) SetNillableCreatedBy

func (du *DepartmentUpdate) SetNillableCreatedBy(i *int64) *DepartmentUpdate

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

func (*DepartmentUpdate) SetNillableDeletedAt

func (du *DepartmentUpdate) SetNillableDeletedAt(t *time.Time) *DepartmentUpdate

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

func (*DepartmentUpdate) SetNillableName

func (du *DepartmentUpdate) SetNillableName(s *string) *DepartmentUpdate

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

func (*DepartmentUpdate) SetNillableParentID

func (du *DepartmentUpdate) SetNillableParentID(i *int64) *DepartmentUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*DepartmentUpdate) SetNillablePath

func (du *DepartmentUpdate) SetNillablePath(s *string) *DepartmentUpdate

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

func (*DepartmentUpdate) SetNillableTenantID

func (du *DepartmentUpdate) SetNillableTenantID(i *int64) *DepartmentUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*DepartmentUpdate) SetNillableUpdatedBy

func (du *DepartmentUpdate) SetNillableUpdatedBy(i *int64) *DepartmentUpdate

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

func (*DepartmentUpdate) SetParentID

func (du *DepartmentUpdate) SetParentID(i int64) *DepartmentUpdate

SetParentID sets the "parent_id" field.

func (*DepartmentUpdate) SetPath

func (du *DepartmentUpdate) SetPath(s string) *DepartmentUpdate

SetPath sets the "path" field.

func (*DepartmentUpdate) SetTenant

func (du *DepartmentUpdate) SetTenant(t *Tenant) *DepartmentUpdate

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

func (*DepartmentUpdate) SetTenantID

func (du *DepartmentUpdate) SetTenantID(i int64) *DepartmentUpdate

SetTenantID sets the "tenant_id" field.

func (*DepartmentUpdate) SetUpdatedAt

func (du *DepartmentUpdate) SetUpdatedAt(t time.Time) *DepartmentUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpdate) SetUpdatedBy

func (du *DepartmentUpdate) SetUpdatedBy(i int64) *DepartmentUpdate

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentUpdate) Where

Where appends a list predicates to the DepartmentUpdate builder.

type DepartmentUpdateOne

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

DepartmentUpdateOne is the builder for updating a single Department entity.

func (*DepartmentUpdateOne) AddCreatedBy

func (duo *DepartmentUpdateOne) AddCreatedBy(i int64) *DepartmentUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*DepartmentUpdateOne) AddParentID

func (duo *DepartmentUpdateOne) AddParentID(i int64) *DepartmentUpdateOne

AddParentID adds i to the "parent_id" field.

func (*DepartmentUpdateOne) AddUpdatedBy

func (duo *DepartmentUpdateOne) AddUpdatedBy(i int64) *DepartmentUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*DepartmentUpdateOne) AddUserDepartmentIDs

func (duo *DepartmentUpdateOne) AddUserDepartmentIDs(ids ...int) *DepartmentUpdateOne

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*DepartmentUpdateOne) AddUserDepartments

func (duo *DepartmentUpdateOne) AddUserDepartments(u ...*UserDepartment) *DepartmentUpdateOne

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*DepartmentUpdateOne) ClearCreatedBy

func (duo *DepartmentUpdateOne) ClearCreatedBy() *DepartmentUpdateOne

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentUpdateOne) ClearDeletedAt

func (duo *DepartmentUpdateOne) ClearDeletedAt() *DepartmentUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentUpdateOne) ClearTenant

func (duo *DepartmentUpdateOne) ClearTenant() *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) ClearUpdatedBy

func (duo *DepartmentUpdateOne) ClearUpdatedBy() *DepartmentUpdateOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentUpdateOne) ClearUserDepartments

func (duo *DepartmentUpdateOne) ClearUserDepartments() *DepartmentUpdateOne

ClearUserDepartments clears all "user_departments" edges to the UserDepartment entity.

func (*DepartmentUpdateOne) Exec

func (duo *DepartmentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DepartmentUpdateOne) ExecX

func (duo *DepartmentUpdateOne) ExecX(ctx context.Context)

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

func (*DepartmentUpdateOne) Mutation

func (duo *DepartmentUpdateOne) Mutation() *DepartmentMutation

Mutation returns the DepartmentMutation object of the builder.

func (*DepartmentUpdateOne) RemoveUserDepartmentIDs

func (duo *DepartmentUpdateOne) RemoveUserDepartmentIDs(ids ...int) *DepartmentUpdateOne

RemoveUserDepartmentIDs removes the "user_departments" edge to UserDepartment entities by IDs.

func (*DepartmentUpdateOne) RemoveUserDepartments

func (duo *DepartmentUpdateOne) RemoveUserDepartments(u ...*UserDepartment) *DepartmentUpdateOne

RemoveUserDepartments removes "user_departments" edges to UserDepartment entities.

func (*DepartmentUpdateOne) Save

func (duo *DepartmentUpdateOne) Save(ctx context.Context) (*Department, error)

Save executes the query and returns the updated Department entity.

func (*DepartmentUpdateOne) SaveX

func (duo *DepartmentUpdateOne) SaveX(ctx context.Context) *Department

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

func (*DepartmentUpdateOne) Select

func (duo *DepartmentUpdateOne) Select(field string, fields ...string) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetAttributes

func (duo *DepartmentUpdateOne) SetAttributes(m map[string]interface{}) *DepartmentUpdateOne

SetAttributes sets the "attributes" field.

func (*DepartmentUpdateOne) SetCreatedBy

func (duo *DepartmentUpdateOne) SetCreatedBy(i int64) *DepartmentUpdateOne

SetCreatedBy sets the "created_by" field.

func (*DepartmentUpdateOne) SetDeletedAt

func (duo *DepartmentUpdateOne) SetDeletedAt(t time.Time) *DepartmentUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentUpdateOne) SetName

SetName sets the "name" field.

func (*DepartmentUpdateOne) SetNillableCreatedBy

func (duo *DepartmentUpdateOne) SetNillableCreatedBy(i *int64) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetNillableDeletedAt

func (duo *DepartmentUpdateOne) SetNillableDeletedAt(t *time.Time) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetNillableName

func (duo *DepartmentUpdateOne) SetNillableName(s *string) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetNillableParentID

func (duo *DepartmentUpdateOne) SetNillableParentID(i *int64) *DepartmentUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*DepartmentUpdateOne) SetNillablePath

func (duo *DepartmentUpdateOne) SetNillablePath(s *string) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetNillableTenantID

func (duo *DepartmentUpdateOne) SetNillableTenantID(i *int64) *DepartmentUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*DepartmentUpdateOne) SetNillableUpdatedBy

func (duo *DepartmentUpdateOne) SetNillableUpdatedBy(i *int64) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetParentID

func (duo *DepartmentUpdateOne) SetParentID(i int64) *DepartmentUpdateOne

SetParentID sets the "parent_id" field.

func (*DepartmentUpdateOne) SetPath

SetPath sets the "path" field.

func (*DepartmentUpdateOne) SetTenant

func (duo *DepartmentUpdateOne) SetTenant(t *Tenant) *DepartmentUpdateOne

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

func (*DepartmentUpdateOne) SetTenantID

func (duo *DepartmentUpdateOne) SetTenantID(i int64) *DepartmentUpdateOne

SetTenantID sets the "tenant_id" field.

func (*DepartmentUpdateOne) SetUpdatedAt

func (duo *DepartmentUpdateOne) SetUpdatedAt(t time.Time) *DepartmentUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpdateOne) SetUpdatedBy

func (duo *DepartmentUpdateOne) SetUpdatedBy(i int64) *DepartmentUpdateOne

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentUpdateOne) Where

Where appends a list predicates to the DepartmentUpdate builder.

type DepartmentUpsert

type DepartmentUpsert struct {
	*sql.UpdateSet
}

DepartmentUpsert is the "OnConflict" setter.

func (*DepartmentUpsert) AddCreatedBy

func (u *DepartmentUpsert) AddCreatedBy(v int64) *DepartmentUpsert

AddCreatedBy adds v to the "created_by" field.

func (*DepartmentUpsert) AddParentID

func (u *DepartmentUpsert) AddParentID(v int64) *DepartmentUpsert

AddParentID adds v to the "parent_id" field.

func (*DepartmentUpsert) AddUpdatedBy

func (u *DepartmentUpsert) AddUpdatedBy(v int64) *DepartmentUpsert

AddUpdatedBy adds v to the "updated_by" field.

func (*DepartmentUpsert) ClearCreatedBy

func (u *DepartmentUpsert) ClearCreatedBy() *DepartmentUpsert

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentUpsert) ClearDeletedAt

func (u *DepartmentUpsert) ClearDeletedAt() *DepartmentUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentUpsert) ClearUpdatedBy

func (u *DepartmentUpsert) ClearUpdatedBy() *DepartmentUpsert

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentUpsert) SetAttributes

func (u *DepartmentUpsert) SetAttributes(v map[string]interface{}) *DepartmentUpsert

SetAttributes sets the "attributes" field.

func (*DepartmentUpsert) SetCreatedBy

func (u *DepartmentUpsert) SetCreatedBy(v int64) *DepartmentUpsert

SetCreatedBy sets the "created_by" field.

func (*DepartmentUpsert) SetDeletedAt

func (u *DepartmentUpsert) SetDeletedAt(v time.Time) *DepartmentUpsert

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentUpsert) SetName

func (u *DepartmentUpsert) SetName(v string) *DepartmentUpsert

SetName sets the "name" field.

func (*DepartmentUpsert) SetParentID

func (u *DepartmentUpsert) SetParentID(v int64) *DepartmentUpsert

SetParentID sets the "parent_id" field.

func (*DepartmentUpsert) SetPath

func (u *DepartmentUpsert) SetPath(v string) *DepartmentUpsert

SetPath sets the "path" field.

func (*DepartmentUpsert) SetTenantID

func (u *DepartmentUpsert) SetTenantID(v int64) *DepartmentUpsert

SetTenantID sets the "tenant_id" field.

func (*DepartmentUpsert) SetUpdatedAt

func (u *DepartmentUpsert) SetUpdatedAt(v time.Time) *DepartmentUpsert

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsert) SetUpdatedBy

func (u *DepartmentUpsert) SetUpdatedBy(v int64) *DepartmentUpsert

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentUpsert) UpdateAttributes

func (u *DepartmentUpsert) UpdateAttributes() *DepartmentUpsert

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateCreatedBy

func (u *DepartmentUpsert) UpdateCreatedBy() *DepartmentUpsert

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateDeletedAt

func (u *DepartmentUpsert) UpdateDeletedAt() *DepartmentUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateName

func (u *DepartmentUpsert) UpdateName() *DepartmentUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateParentID

func (u *DepartmentUpsert) UpdateParentID() *DepartmentUpsert

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*DepartmentUpsert) UpdatePath

func (u *DepartmentUpsert) UpdatePath() *DepartmentUpsert

UpdatePath sets the "path" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateTenantID

func (u *DepartmentUpsert) UpdateTenantID() *DepartmentUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateUpdatedAt

func (u *DepartmentUpsert) UpdateUpdatedAt() *DepartmentUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*DepartmentUpsert) UpdateUpdatedBy

func (u *DepartmentUpsert) UpdateUpdatedBy() *DepartmentUpsert

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type DepartmentUpsertBulk

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

DepartmentUpsertBulk is the builder for "upsert"-ing a bulk of Department nodes.

func (*DepartmentUpsertBulk) AddCreatedBy

func (u *DepartmentUpsertBulk) AddCreatedBy(v int64) *DepartmentUpsertBulk

AddCreatedBy adds v to the "created_by" field.

func (*DepartmentUpsertBulk) AddParentID

func (u *DepartmentUpsertBulk) AddParentID(v int64) *DepartmentUpsertBulk

AddParentID adds v to the "parent_id" field.

func (*DepartmentUpsertBulk) AddUpdatedBy

func (u *DepartmentUpsertBulk) AddUpdatedBy(v int64) *DepartmentUpsertBulk

AddUpdatedBy adds v to the "updated_by" field.

func (*DepartmentUpsertBulk) ClearCreatedBy

func (u *DepartmentUpsertBulk) ClearCreatedBy() *DepartmentUpsertBulk

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentUpsertBulk) ClearDeletedAt

func (u *DepartmentUpsertBulk) ClearDeletedAt() *DepartmentUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentUpsertBulk) ClearUpdatedBy

func (u *DepartmentUpsertBulk) ClearUpdatedBy() *DepartmentUpsertBulk

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DepartmentUpsertBulk) Exec

Exec executes the query.

func (*DepartmentUpsertBulk) ExecX

func (u *DepartmentUpsertBulk) ExecX(ctx context.Context)

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

func (*DepartmentUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Department.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*DepartmentUpsertBulk) SetAttributes

func (u *DepartmentUpsertBulk) SetAttributes(v map[string]interface{}) *DepartmentUpsertBulk

SetAttributes sets the "attributes" field.

func (*DepartmentUpsertBulk) SetCreatedBy

func (u *DepartmentUpsertBulk) SetCreatedBy(v int64) *DepartmentUpsertBulk

SetCreatedBy sets the "created_by" field.

func (*DepartmentUpsertBulk) SetDeletedAt

func (u *DepartmentUpsertBulk) SetDeletedAt(v time.Time) *DepartmentUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentUpsertBulk) SetName

SetName sets the "name" field.

func (*DepartmentUpsertBulk) SetParentID

func (u *DepartmentUpsertBulk) SetParentID(v int64) *DepartmentUpsertBulk

SetParentID sets the "parent_id" field.

func (*DepartmentUpsertBulk) SetPath

SetPath sets the "path" field.

func (*DepartmentUpsertBulk) SetTenantID

func (u *DepartmentUpsertBulk) SetTenantID(v int64) *DepartmentUpsertBulk

SetTenantID sets the "tenant_id" field.

func (*DepartmentUpsertBulk) SetUpdatedAt

func (u *DepartmentUpsertBulk) SetUpdatedAt(v time.Time) *DepartmentUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsertBulk) SetUpdatedBy

func (u *DepartmentUpsertBulk) SetUpdatedBy(v int64) *DepartmentUpsertBulk

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the DepartmentCreateBulk.OnConflict documentation for more info.

func (*DepartmentUpsertBulk) UpdateAttributes

func (u *DepartmentUpsertBulk) UpdateAttributes() *DepartmentUpsertBulk

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateCreatedBy

func (u *DepartmentUpsertBulk) UpdateCreatedBy() *DepartmentUpsertBulk

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateDeletedAt

func (u *DepartmentUpsertBulk) UpdateDeletedAt() *DepartmentUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateName

func (u *DepartmentUpsertBulk) UpdateName() *DepartmentUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateNewValues

func (u *DepartmentUpsertBulk) UpdateNewValues() *DepartmentUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Department.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(department.FieldID)
		}),
	).
	Exec(ctx)

func (*DepartmentUpsertBulk) UpdateParentID

func (u *DepartmentUpsertBulk) UpdateParentID() *DepartmentUpsertBulk

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdatePath

func (u *DepartmentUpsertBulk) UpdatePath() *DepartmentUpsertBulk

UpdatePath sets the "path" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateTenantID

func (u *DepartmentUpsertBulk) UpdateTenantID() *DepartmentUpsertBulk

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateUpdatedAt

func (u *DepartmentUpsertBulk) UpdateUpdatedAt() *DepartmentUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*DepartmentUpsertBulk) UpdateUpdatedBy

func (u *DepartmentUpsertBulk) UpdateUpdatedBy() *DepartmentUpsertBulk

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type DepartmentUpsertOne

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

DepartmentUpsertOne is the builder for "upsert"-ing

one Department node.

func (*DepartmentUpsertOne) AddCreatedBy

func (u *DepartmentUpsertOne) AddCreatedBy(v int64) *DepartmentUpsertOne

AddCreatedBy adds v to the "created_by" field.

func (*DepartmentUpsertOne) AddParentID

func (u *DepartmentUpsertOne) AddParentID(v int64) *DepartmentUpsertOne

AddParentID adds v to the "parent_id" field.

func (*DepartmentUpsertOne) AddUpdatedBy

func (u *DepartmentUpsertOne) AddUpdatedBy(v int64) *DepartmentUpsertOne

AddUpdatedBy adds v to the "updated_by" field.

func (*DepartmentUpsertOne) ClearCreatedBy

func (u *DepartmentUpsertOne) ClearCreatedBy() *DepartmentUpsertOne

ClearCreatedBy clears the value of the "created_by" field.

func (*DepartmentUpsertOne) ClearDeletedAt

func (u *DepartmentUpsertOne) ClearDeletedAt() *DepartmentUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*DepartmentUpsertOne) ClearUpdatedBy

func (u *DepartmentUpsertOne) ClearUpdatedBy() *DepartmentUpsertOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*DepartmentUpsertOne) DoNothing

func (u *DepartmentUpsertOne) DoNothing() *DepartmentUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DepartmentUpsertOne) Exec

Exec executes the query.

func (*DepartmentUpsertOne) ExecX

func (u *DepartmentUpsertOne) ExecX(ctx context.Context)

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

func (*DepartmentUpsertOne) ID

func (u *DepartmentUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*DepartmentUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*DepartmentUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Department.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*DepartmentUpsertOne) SetAttributes

func (u *DepartmentUpsertOne) SetAttributes(v map[string]interface{}) *DepartmentUpsertOne

SetAttributes sets the "attributes" field.

func (*DepartmentUpsertOne) SetCreatedBy

func (u *DepartmentUpsertOne) SetCreatedBy(v int64) *DepartmentUpsertOne

SetCreatedBy sets the "created_by" field.

func (*DepartmentUpsertOne) SetDeletedAt

func (u *DepartmentUpsertOne) SetDeletedAt(v time.Time) *DepartmentUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*DepartmentUpsertOne) SetName

SetName sets the "name" field.

func (*DepartmentUpsertOne) SetParentID

func (u *DepartmentUpsertOne) SetParentID(v int64) *DepartmentUpsertOne

SetParentID sets the "parent_id" field.

func (*DepartmentUpsertOne) SetPath

SetPath sets the "path" field.

func (*DepartmentUpsertOne) SetTenantID

func (u *DepartmentUpsertOne) SetTenantID(v int64) *DepartmentUpsertOne

SetTenantID sets the "tenant_id" field.

func (*DepartmentUpsertOne) SetUpdatedAt

func (u *DepartmentUpsertOne) SetUpdatedAt(v time.Time) *DepartmentUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*DepartmentUpsertOne) SetUpdatedBy

func (u *DepartmentUpsertOne) SetUpdatedBy(v int64) *DepartmentUpsertOne

SetUpdatedBy sets the "updated_by" field.

func (*DepartmentUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the DepartmentCreate.OnConflict documentation for more info.

func (*DepartmentUpsertOne) UpdateAttributes

func (u *DepartmentUpsertOne) UpdateAttributes() *DepartmentUpsertOne

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateCreatedBy

func (u *DepartmentUpsertOne) UpdateCreatedBy() *DepartmentUpsertOne

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateDeletedAt

func (u *DepartmentUpsertOne) UpdateDeletedAt() *DepartmentUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateName

func (u *DepartmentUpsertOne) UpdateName() *DepartmentUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateNewValues

func (u *DepartmentUpsertOne) UpdateNewValues() *DepartmentUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Department.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(department.FieldID)
		}),
	).
	Exec(ctx)

func (*DepartmentUpsertOne) UpdateParentID

func (u *DepartmentUpsertOne) UpdateParentID() *DepartmentUpsertOne

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdatePath

func (u *DepartmentUpsertOne) UpdatePath() *DepartmentUpsertOne

UpdatePath sets the "path" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateTenantID

func (u *DepartmentUpsertOne) UpdateTenantID() *DepartmentUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateUpdatedAt

func (u *DepartmentUpsertOne) UpdateUpdatedAt() *DepartmentUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*DepartmentUpsertOne) UpdateUpdatedBy

func (u *DepartmentUpsertOne) UpdateUpdatedBy() *DepartmentUpsertOne

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type Departments

type Departments []*Department

Departments is a parsable slice of Department.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type Role

type Role struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// 角色编码,如 admin, tenant_admin, sales_manager
	Code string `json:"code,omitempty"`
	// 角色名称
	Name string `json:"name,omitempty"`
	// 租户ID
	TenantID *int64 `json:"tenant_id,omitempty"`
	// 是否系统预置角色(系统预置的不可删除/修改code)
	IsSystem bool `json:"is_system,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// IsActive holds the value of the "is_active" field.
	IsActive bool `json:"is_active,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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) QueryTenant

func (r *Role) QueryTenant() *TenantQuery

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

func (*Role) QueryUserRoles

func (r *Role) QueryUserRoles() *UserRoleQuery

QueryUserRoles queries the "user_roles" edge of the Role entity.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

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

func (*Role) Update

func (r *Role) Update() *RoleUpdateOne

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

func (*Role) Value

func (r *Role) Value(name string) (ent.Value, error)

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

type RoleClient

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

RoleClient is a client for the Role schema.

func NewRoleClient

func NewRoleClient(c config) *RoleClient

NewRoleClient returns a client for the Role from the given config.

func (*RoleClient) Create

func (c *RoleClient) Create() *RoleCreate

Create returns a builder for creating a Role entity.

func (*RoleClient) CreateBulk

func (c *RoleClient) CreateBulk(builders ...*RoleCreate) *RoleCreateBulk

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

func (*RoleClient) Delete

func (c *RoleClient) Delete() *RoleDelete

Delete returns a delete builder for Role.

func (*RoleClient) DeleteOne

func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RoleClient) DeleteOneID

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

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

func (*RoleClient) Get

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

Get returns a Role entity by its id.

func (*RoleClient) GetX

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

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

func (*RoleClient) Hooks

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

Hooks returns the client hooks.

func (*RoleClient) Intercept

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

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

func (*RoleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RoleClient) MapCreateBulk

func (c *RoleClient) MapCreateBulk(slice any, setFunc func(*RoleCreate, int)) *RoleCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*RoleClient) Query

func (c *RoleClient) Query() *RoleQuery

Query returns a query builder for Role.

func (*RoleClient) QueryTenant

func (c *RoleClient) QueryTenant(r *Role) *TenantQuery

QueryTenant queries the tenant edge of a Role.

func (*RoleClient) QueryUserRoles

func (c *RoleClient) QueryUserRoles(r *Role) *UserRoleQuery

QueryUserRoles queries the user_roles edge of a Role.

func (*RoleClient) Update

func (c *RoleClient) Update() *RoleUpdate

Update returns an update builder for Role.

func (*RoleClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*RoleClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) AddUserRoleIDs

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

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*RoleCreate) AddUserRoles

func (rc *RoleCreate) AddUserRoles(u ...*UserRole) *RoleCreate

AddUserRoles adds the "user_roles" edges to the UserRole 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) OnConflict

func (rc *RoleCreate) OnConflict(opts ...sql.ConflictOption) *RoleUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Role.Create().
	SetCode(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.RoleUpsert) {
		SetCode(v+v).
	}).
	Exec(ctx)

func (*RoleCreate) OnConflictColumns

func (rc *RoleCreate) OnConflictColumns(columns ...string) *RoleUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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

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

SetCode sets the "code" field.

func (*RoleCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleCreate) SetDescription

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

SetDescription sets the "description" field.

func (*RoleCreate) SetID

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

SetID sets the "id" field.

func (*RoleCreate) SetIsActive

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

SetIsActive sets the "is_active" field.

func (*RoleCreate) SetIsSystem

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

SetIsSystem sets the "is_system" field.

func (*RoleCreate) SetName

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

SetName sets the "name" field.

func (*RoleCreate) SetNillableCreatedAt

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

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

func (*RoleCreate) SetNillableDescription

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

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

func (*RoleCreate) SetNillableIsActive

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

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RoleCreate) SetNillableIsSystem

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

SetNillableIsSystem sets the "is_system" field if the given value is not nil.

func (*RoleCreate) SetNillableTenantID

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

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*RoleCreate) SetNillableUpdatedAt

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

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

func (*RoleCreate) SetTenant

func (rc *RoleCreate) SetTenant(t *Tenant) *RoleCreate

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

func (*RoleCreate) SetTenantID

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

SetTenantID sets the "tenant_id" field.

func (*RoleCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

type RoleCreateBulk

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

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

func (*RoleCreateBulk) Exec

func (rcb *RoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreateBulk) ExecX

func (rcb *RoleCreateBulk) ExecX(ctx context.Context)

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

func (*RoleCreateBulk) OnConflict

func (rcb *RoleCreateBulk) OnConflict(opts ...sql.ConflictOption) *RoleUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Role.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.RoleUpsert) {
		SetCode(v+v).
	}).
	Exec(ctx)

func (*RoleCreateBulk) OnConflictColumns

func (rcb *RoleCreateBulk) OnConflictColumns(columns ...string) *RoleUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*RoleCreateBulk) Save

func (rcb *RoleCreateBulk) Save(ctx context.Context) ([]*Role, error)

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

func (rcb *RoleCreateBulk) SaveX(ctx context.Context) []*Role

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

type RoleDelete

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

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

func (rd *RoleDelete) Exec(ctx context.Context) (int, error)

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

func (*RoleDelete) ExecX

func (rd *RoleDelete) ExecX(ctx context.Context) int

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

func (*RoleDelete) Where

func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

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

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

func (rdo *RoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

func (rdo *RoleDeleteOne) ExecX(ctx context.Context)

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

func (*RoleDeleteOne) Where

func (rdo *RoleDeleteOne) Where(ps ...predicate.Role) *RoleDeleteOne

Where appends a list predicates to the RoleDelete builder.

type RoleEdges

type RoleEdges struct {
	// UserRoles holds the value of the user_roles edge.
	UserRoles []*UserRole `json:"user_roles,omitempty"`
	// Tenant holds the value of the tenant edge.
	Tenant *Tenant `json:"tenant,omitempty"`
	// contains filtered or unexported fields
}

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

func (RoleEdges) TenantOrErr

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

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

func (RoleEdges) UserRolesOrErr

func (e RoleEdges) UserRolesOrErr() ([]*UserRole, error)

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

type RoleGroupBy

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

RoleGroupBy is the group-by builder for Role entities.

func (*RoleGroupBy) Aggregate

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

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

func (*RoleGroupBy) Bool

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

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

func (*RoleGroupBy) BoolX

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

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

func (*RoleGroupBy) Bools

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

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

func (*RoleGroupBy) BoolsX

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

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

func (*RoleGroupBy) Float64

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

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

func (*RoleGroupBy) Float64X

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

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

func (*RoleGroupBy) Float64s

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

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

func (*RoleGroupBy) Float64sX

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

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

func (*RoleGroupBy) Int

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

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

func (*RoleGroupBy) IntX

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

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

func (*RoleGroupBy) Ints

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

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

func (*RoleGroupBy) IntsX

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

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

func (*RoleGroupBy) Scan

func (rgb *RoleGroupBy) Scan(ctx context.Context, v any) error

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

func (*RoleGroupBy) ScanX

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

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

func (*RoleGroupBy) String

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

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

func (*RoleGroupBy) StringX

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

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

func (*RoleGroupBy) Strings

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

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

func (*RoleGroupBy) StringsX

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

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

type RoleMutation

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

RoleMutation represents an operation that mutates the Role nodes in the graph.

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

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

AddUserRoleIDs adds the "user_roles" edge to the UserRole 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) ClearDescription

func (m *RoleMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*RoleMutation) ClearEdge

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

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

func (*RoleMutation) ClearField

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

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

func (*RoleMutation) ClearTenant

func (m *RoleMutation) ClearTenant()

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

func (*RoleMutation) ClearTenantID

func (m *RoleMutation) ClearTenantID()

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleMutation) ClearUserRoles

func (m *RoleMutation) ClearUserRoles()

ClearUserRoles clears the "user_roles" edge to the UserRole 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) Code

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

Code returns the value of the "code" field in the mutation.

func (*RoleMutation) CreatedAt

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

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

func (*RoleMutation) Description

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

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

func (*RoleMutation) DescriptionCleared

func (m *RoleMutation) DescriptionCleared() bool

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

func (*RoleMutation) EdgeCleared

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

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

func (*RoleMutation) Field

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

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

func (*RoleMutation) FieldCleared

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

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

func (*RoleMutation) Fields

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

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

func (*RoleMutation) ID

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

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

func (*RoleMutation) IDs

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

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

func (*RoleMutation) IsActive

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

IsActive returns the value of the "is_active" field in the mutation.

func (*RoleMutation) IsSystem

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

IsSystem returns the value of the "is_system" field in the mutation.

func (*RoleMutation) Name

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

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

func (*RoleMutation) OldCode

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

OldCode returns the old "code" 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) OldCreatedAt

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

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

func (*RoleMutation) OldDescription

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

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

func (*RoleMutation) OldField

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

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

func (*RoleMutation) OldIsActive

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

OldIsActive returns the old "is_active" 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) OldIsSystem

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

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

func (*RoleMutation) OldName

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

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

func (*RoleMutation) OldTenantID

func (m *RoleMutation) OldTenantID(ctx context.Context) (v *int64, err error)

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

func (*RoleMutation) OldUpdatedAt

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

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

func (*RoleMutation) Op

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) RemoveUserRoleIDs

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

RemoveUserRoleIDs removes the "user_roles" edge to the UserRole 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) RemovedUserRolesIDs

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

RemovedUserRoles returns the removed IDs of the "user_roles" edge to the UserRole entity.

func (*RoleMutation) ResetCode

func (m *RoleMutation) ResetCode()

ResetCode resets all changes to the "code" field.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetDescription

func (m *RoleMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RoleMutation) ResetEdge

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

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

func (*RoleMutation) ResetField

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

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

func (*RoleMutation) ResetIsActive

func (m *RoleMutation) ResetIsActive()

ResetIsActive resets all changes to the "is_active" field.

func (*RoleMutation) ResetIsSystem

func (m *RoleMutation) ResetIsSystem()

ResetIsSystem resets all changes to the "is_system" field.

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetTenant

func (m *RoleMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*RoleMutation) ResetTenantID

func (m *RoleMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) ResetUserRoles

func (m *RoleMutation) ResetUserRoles()

ResetUserRoles resets all changes to the "user_roles" edge.

func (*RoleMutation) SetCode

func (m *RoleMutation) SetCode(s string)

SetCode sets the "code" field.

func (*RoleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetDescription

func (m *RoleMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RoleMutation) SetField

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

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

func (*RoleMutation) SetID

func (m *RoleMutation) SetID(id int64)

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

func (*RoleMutation) SetIsActive

func (m *RoleMutation) SetIsActive(b bool)

SetIsActive sets the "is_active" field.

func (*RoleMutation) SetIsSystem

func (m *RoleMutation) SetIsSystem(b bool)

SetIsSystem sets the "is_system" field.

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetOp

func (m *RoleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RoleMutation) SetTenantID

func (m *RoleMutation) SetTenantID(i int64)

SetTenantID sets the "tenant_id" field.

func (*RoleMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RoleMutation) TenantCleared

func (m *RoleMutation) TenantCleared() bool

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

func (*RoleMutation) TenantID

func (m *RoleMutation) TenantID() (r int64, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (*RoleMutation) TenantIDCleared

func (m *RoleMutation) TenantIDCleared() bool

TenantIDCleared returns if the "tenant_id" field was cleared in this mutation.

func (*RoleMutation) TenantIDs

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

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

func (RoleMutation) Tx

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

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

func (*RoleMutation) Type

func (m *RoleMutation) Type() string

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

func (*RoleMutation) UpdatedAt

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

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

func (*RoleMutation) UserRolesCleared

func (m *RoleMutation) UserRolesCleared() bool

UserRolesCleared reports if the "user_roles" edge to the UserRole entity was cleared.

func (*RoleMutation) UserRolesIDs

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

UserRolesIDs returns the "user_roles" edge IDs in the mutation.

func (*RoleMutation) Where

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

Where appends a list predicates to the RoleMutation builder.

func (*RoleMutation) WhereP

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

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

type RoleQuery

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

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) Aggregate

func (rq *RoleQuery) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate returns a RoleSelect configured with the given aggregations.

func (*RoleQuery) All

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

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

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

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

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

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

func (*RoleQuery) Count

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

Count returns the count of the given query.

func (*RoleQuery) CountX

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

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

func (*RoleQuery) Exist

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

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

func (*RoleQuery) ExistX

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

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

func (*RoleQuery) First

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

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

func (*RoleQuery) FirstID

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

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

func (*RoleQuery) FirstIDX

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

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

func (*RoleQuery) FirstX

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

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

func (*RoleQuery) ForShare

func (rq *RoleQuery) ForShare(opts ...sql.LockOption) *RoleQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*RoleQuery) ForUpdate

func (rq *RoleQuery) ForUpdate(opts ...sql.LockOption) *RoleQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

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

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

func (*RoleQuery) IDs

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

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

func (*RoleQuery) IDsX

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

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

func (*RoleQuery) Limit

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

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

func (*RoleQuery) Offset

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

Offset to start from.

func (*RoleQuery) Only

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

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

func (*RoleQuery) OnlyID

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

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

func (*RoleQuery) OnlyIDX

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

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

func (*RoleQuery) OnlyX

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

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

func (*RoleQuery) Order

func (rq *RoleQuery) Order(o ...role.OrderOption) *RoleQuery

Order specifies how the records should be ordered.

func (*RoleQuery) QueryTenant

func (rq *RoleQuery) QueryTenant() *TenantQuery

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

func (*RoleQuery) QueryUserRoles

func (rq *RoleQuery) QueryUserRoles() *UserRoleQuery

QueryUserRoles chains the current query on the "user_roles" 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 {
	Code string `json:"code,omitempty"`
}

client.Role.Query().
	Select(role.FieldCode).
	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) WithTenant

func (rq *RoleQuery) WithTenant(opts ...func(*TenantQuery)) *RoleQuery

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

func (*RoleQuery) WithUserRoles

func (rq *RoleQuery) WithUserRoles(opts ...func(*UserRoleQuery)) *RoleQuery

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

type RoleSelect

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

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Aggregate

func (rs *RoleSelect) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RoleSelect) Bool

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

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

func (*RoleSelect) BoolX

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

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

func (*RoleSelect) Bools

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

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

func (*RoleSelect) BoolsX

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

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

func (*RoleSelect) Float64

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

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

func (*RoleSelect) Float64X

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

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

func (*RoleSelect) Float64s

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

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

func (*RoleSelect) Float64sX

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

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

func (*RoleSelect) Int

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

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

func (*RoleSelect) IntX

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

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

func (*RoleSelect) Ints

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

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

func (*RoleSelect) IntsX

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

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

func (*RoleSelect) Scan

func (rs *RoleSelect) Scan(ctx context.Context, v any) error

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

func (*RoleSelect) ScanX

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

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

func (*RoleSelect) String

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

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

func (*RoleSelect) StringX

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

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

func (*RoleSelect) Strings

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

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

func (*RoleSelect) StringsX

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

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

type RoleUpdate

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

RoleUpdate is the builder for updating Role entities.

func (*RoleUpdate) AddUserRoleIDs

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

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*RoleUpdate) AddUserRoles

func (ru *RoleUpdate) AddUserRoles(u ...*UserRole) *RoleUpdate

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*RoleUpdate) ClearDescription

func (ru *RoleUpdate) ClearDescription() *RoleUpdate

ClearDescription clears the value of the "description" field.

func (*RoleUpdate) ClearTenant

func (ru *RoleUpdate) ClearTenant() *RoleUpdate

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

func (*RoleUpdate) ClearTenantID

func (ru *RoleUpdate) ClearTenantID() *RoleUpdate

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleUpdate) ClearUserRoles

func (ru *RoleUpdate) ClearUserRoles() *RoleUpdate

ClearUserRoles clears all "user_roles" edges to the UserRole 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) RemoveUserRoleIDs

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

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*RoleUpdate) RemoveUserRoles

func (ru *RoleUpdate) RemoveUserRoles(u ...*UserRole) *RoleUpdate

RemoveUserRoles removes "user_roles" edges to UserRole 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) SetCode

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

SetCode sets the "code" field.

func (*RoleUpdate) SetDescription

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

SetDescription sets the "description" field.

func (*RoleUpdate) SetIsActive

func (ru *RoleUpdate) SetIsActive(b bool) *RoleUpdate

SetIsActive sets the "is_active" field.

func (*RoleUpdate) SetIsSystem

func (ru *RoleUpdate) SetIsSystem(b bool) *RoleUpdate

SetIsSystem sets the "is_system" field.

func (*RoleUpdate) SetName

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

SetName sets the "name" field.

func (*RoleUpdate) SetNillableCode

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

SetNillableCode sets the "code" field if the given value is not nil.

func (*RoleUpdate) SetNillableDescription

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

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

func (*RoleUpdate) SetNillableIsActive

func (ru *RoleUpdate) SetNillableIsActive(b *bool) *RoleUpdate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RoleUpdate) SetNillableIsSystem

func (ru *RoleUpdate) SetNillableIsSystem(b *bool) *RoleUpdate

SetNillableIsSystem sets the "is_system" field if the given value is not nil.

func (*RoleUpdate) SetNillableName

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

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

func (*RoleUpdate) SetNillableTenantID

func (ru *RoleUpdate) SetNillableTenantID(i *int64) *RoleUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*RoleUpdate) SetTenant

func (ru *RoleUpdate) SetTenant(t *Tenant) *RoleUpdate

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

func (*RoleUpdate) SetTenantID

func (ru *RoleUpdate) SetTenantID(i int64) *RoleUpdate

SetTenantID sets the "tenant_id" field.

func (*RoleUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

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

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) AddUserRoleIDs

func (ruo *RoleUpdateOne) AddUserRoleIDs(ids ...int64) *RoleUpdateOne

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*RoleUpdateOne) AddUserRoles

func (ruo *RoleUpdateOne) AddUserRoles(u ...*UserRole) *RoleUpdateOne

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*RoleUpdateOne) ClearDescription

func (ruo *RoleUpdateOne) ClearDescription() *RoleUpdateOne

ClearDescription clears the value of the "description" field.

func (*RoleUpdateOne) ClearTenant

func (ruo *RoleUpdateOne) ClearTenant() *RoleUpdateOne

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

func (*RoleUpdateOne) ClearTenantID

func (ruo *RoleUpdateOne) ClearTenantID() *RoleUpdateOne

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleUpdateOne) ClearUserRoles

func (ruo *RoleUpdateOne) ClearUserRoles() *RoleUpdateOne

ClearUserRoles clears all "user_roles" edges to the UserRole 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) RemoveUserRoleIDs

func (ruo *RoleUpdateOne) RemoveUserRoleIDs(ids ...int64) *RoleUpdateOne

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*RoleUpdateOne) RemoveUserRoles

func (ruo *RoleUpdateOne) RemoveUserRoles(u ...*UserRole) *RoleUpdateOne

RemoveUserRoles removes "user_roles" edges to UserRole 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) SetCode

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

SetCode sets the "code" field.

func (*RoleUpdateOne) SetDescription

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

SetDescription sets the "description" field.

func (*RoleUpdateOne) SetIsActive

func (ruo *RoleUpdateOne) SetIsActive(b bool) *RoleUpdateOne

SetIsActive sets the "is_active" field.

func (*RoleUpdateOne) SetIsSystem

func (ruo *RoleUpdateOne) SetIsSystem(b bool) *RoleUpdateOne

SetIsSystem sets the "is_system" field.

func (*RoleUpdateOne) SetName

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

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableCode

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

SetNillableCode sets the "code" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableDescription

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

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

func (*RoleUpdateOne) SetNillableIsActive

func (ruo *RoleUpdateOne) SetNillableIsActive(b *bool) *RoleUpdateOne

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableIsSystem

func (ruo *RoleUpdateOne) SetNillableIsSystem(b *bool) *RoleUpdateOne

SetNillableIsSystem sets the "is_system" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableName

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

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

func (*RoleUpdateOne) SetNillableTenantID

func (ruo *RoleUpdateOne) SetNillableTenantID(i *int64) *RoleUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*RoleUpdateOne) SetTenant

func (ruo *RoleUpdateOne) SetTenant(t *Tenant) *RoleUpdateOne

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

func (*RoleUpdateOne) SetTenantID

func (ruo *RoleUpdateOne) SetTenantID(i int64) *RoleUpdateOne

SetTenantID sets the "tenant_id" field.

func (*RoleUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpdateOne) Where

func (ruo *RoleUpdateOne) Where(ps ...predicate.Role) *RoleUpdateOne

Where appends a list predicates to the RoleUpdate builder.

type RoleUpsert

type RoleUpsert struct {
	*sql.UpdateSet
}

RoleUpsert is the "OnConflict" setter.

func (*RoleUpsert) ClearDescription

func (u *RoleUpsert) ClearDescription() *RoleUpsert

ClearDescription clears the value of the "description" field.

func (*RoleUpsert) ClearTenantID

func (u *RoleUpsert) ClearTenantID() *RoleUpsert

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleUpsert) SetCode

func (u *RoleUpsert) SetCode(v string) *RoleUpsert

SetCode sets the "code" field.

func (*RoleUpsert) SetDescription

func (u *RoleUpsert) SetDescription(v string) *RoleUpsert

SetDescription sets the "description" field.

func (*RoleUpsert) SetIsActive

func (u *RoleUpsert) SetIsActive(v bool) *RoleUpsert

SetIsActive sets the "is_active" field.

func (*RoleUpsert) SetIsSystem

func (u *RoleUpsert) SetIsSystem(v bool) *RoleUpsert

SetIsSystem sets the "is_system" field.

func (*RoleUpsert) SetName

func (u *RoleUpsert) SetName(v string) *RoleUpsert

SetName sets the "name" field.

func (*RoleUpsert) SetTenantID

func (u *RoleUpsert) SetTenantID(v int64) *RoleUpsert

SetTenantID sets the "tenant_id" field.

func (*RoleUpsert) SetUpdatedAt

func (u *RoleUpsert) SetUpdatedAt(v time.Time) *RoleUpsert

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsert) UpdateCode

func (u *RoleUpsert) UpdateCode() *RoleUpsert

UpdateCode sets the "code" field to the value that was provided on create.

func (*RoleUpsert) UpdateDescription

func (u *RoleUpsert) UpdateDescription() *RoleUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RoleUpsert) UpdateIsActive

func (u *RoleUpsert) UpdateIsActive() *RoleUpsert

UpdateIsActive sets the "is_active" field to the value that was provided on create.

func (*RoleUpsert) UpdateIsSystem

func (u *RoleUpsert) UpdateIsSystem() *RoleUpsert

UpdateIsSystem sets the "is_system" field to the value that was provided on create.

func (*RoleUpsert) UpdateName

func (u *RoleUpsert) UpdateName() *RoleUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsert) UpdateTenantID

func (u *RoleUpsert) UpdateTenantID() *RoleUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*RoleUpsert) UpdateUpdatedAt

func (u *RoleUpsert) UpdateUpdatedAt() *RoleUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type RoleUpsertBulk

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

RoleUpsertBulk is the builder for "upsert"-ing a bulk of Role nodes.

func (*RoleUpsertBulk) ClearDescription

func (u *RoleUpsertBulk) ClearDescription() *RoleUpsertBulk

ClearDescription clears the value of the "description" field.

func (*RoleUpsertBulk) ClearTenantID

func (u *RoleUpsertBulk) ClearTenantID() *RoleUpsertBulk

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleUpsertBulk) DoNothing

func (u *RoleUpsertBulk) DoNothing() *RoleUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*RoleUpsertBulk) Exec

func (u *RoleUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpsertBulk) ExecX

func (u *RoleUpsertBulk) ExecX(ctx context.Context)

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

func (*RoleUpsertBulk) Ignore

func (u *RoleUpsertBulk) Ignore() *RoleUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*RoleUpsertBulk) SetCode

func (u *RoleUpsertBulk) SetCode(v string) *RoleUpsertBulk

SetCode sets the "code" field.

func (*RoleUpsertBulk) SetDescription

func (u *RoleUpsertBulk) SetDescription(v string) *RoleUpsertBulk

SetDescription sets the "description" field.

func (*RoleUpsertBulk) SetIsActive

func (u *RoleUpsertBulk) SetIsActive(v bool) *RoleUpsertBulk

SetIsActive sets the "is_active" field.

func (*RoleUpsertBulk) SetIsSystem

func (u *RoleUpsertBulk) SetIsSystem(v bool) *RoleUpsertBulk

SetIsSystem sets the "is_system" field.

func (*RoleUpsertBulk) SetName

func (u *RoleUpsertBulk) SetName(v string) *RoleUpsertBulk

SetName sets the "name" field.

func (*RoleUpsertBulk) SetTenantID

func (u *RoleUpsertBulk) SetTenantID(v int64) *RoleUpsertBulk

SetTenantID sets the "tenant_id" field.

func (*RoleUpsertBulk) SetUpdatedAt

func (u *RoleUpsertBulk) SetUpdatedAt(v time.Time) *RoleUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsertBulk) Update

func (u *RoleUpsertBulk) Update(set func(*RoleUpsert)) *RoleUpsertBulk

Update allows overriding fields `UPDATE` values. See the RoleCreateBulk.OnConflict documentation for more info.

func (*RoleUpsertBulk) UpdateCode

func (u *RoleUpsertBulk) UpdateCode() *RoleUpsertBulk

UpdateCode sets the "code" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateDescription

func (u *RoleUpsertBulk) UpdateDescription() *RoleUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateIsActive

func (u *RoleUpsertBulk) UpdateIsActive() *RoleUpsertBulk

UpdateIsActive sets the "is_active" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateIsSystem

func (u *RoleUpsertBulk) UpdateIsSystem() *RoleUpsertBulk

UpdateIsSystem sets the "is_system" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateName

func (u *RoleUpsertBulk) UpdateName() *RoleUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateNewValues

func (u *RoleUpsertBulk) UpdateNewValues() *RoleUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(role.FieldID)
		}),
	).
	Exec(ctx)

func (*RoleUpsertBulk) UpdateTenantID

func (u *RoleUpsertBulk) UpdateTenantID() *RoleUpsertBulk

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateUpdatedAt

func (u *RoleUpsertBulk) UpdateUpdatedAt() *RoleUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type RoleUpsertOne

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

RoleUpsertOne is the builder for "upsert"-ing

one Role node.

func (*RoleUpsertOne) ClearDescription

func (u *RoleUpsertOne) ClearDescription() *RoleUpsertOne

ClearDescription clears the value of the "description" field.

func (*RoleUpsertOne) ClearTenantID

func (u *RoleUpsertOne) ClearTenantID() *RoleUpsertOne

ClearTenantID clears the value of the "tenant_id" field.

func (*RoleUpsertOne) DoNothing

func (u *RoleUpsertOne) DoNothing() *RoleUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*RoleUpsertOne) Exec

func (u *RoleUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleUpsertOne) ExecX

func (u *RoleUpsertOne) ExecX(ctx context.Context)

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

func (*RoleUpsertOne) ID

func (u *RoleUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*RoleUpsertOne) IDX

func (u *RoleUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*RoleUpsertOne) Ignore

func (u *RoleUpsertOne) Ignore() *RoleUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Role.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*RoleUpsertOne) SetCode

func (u *RoleUpsertOne) SetCode(v string) *RoleUpsertOne

SetCode sets the "code" field.

func (*RoleUpsertOne) SetDescription

func (u *RoleUpsertOne) SetDescription(v string) *RoleUpsertOne

SetDescription sets the "description" field.

func (*RoleUpsertOne) SetIsActive

func (u *RoleUpsertOne) SetIsActive(v bool) *RoleUpsertOne

SetIsActive sets the "is_active" field.

func (*RoleUpsertOne) SetIsSystem

func (u *RoleUpsertOne) SetIsSystem(v bool) *RoleUpsertOne

SetIsSystem sets the "is_system" field.

func (*RoleUpsertOne) SetName

func (u *RoleUpsertOne) SetName(v string) *RoleUpsertOne

SetName sets the "name" field.

func (*RoleUpsertOne) SetTenantID

func (u *RoleUpsertOne) SetTenantID(v int64) *RoleUpsertOne

SetTenantID sets the "tenant_id" field.

func (*RoleUpsertOne) SetUpdatedAt

func (u *RoleUpsertOne) SetUpdatedAt(v time.Time) *RoleUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*RoleUpsertOne) Update

func (u *RoleUpsertOne) Update(set func(*RoleUpsert)) *RoleUpsertOne

Update allows overriding fields `UPDATE` values. See the RoleCreate.OnConflict documentation for more info.

func (*RoleUpsertOne) UpdateCode

func (u *RoleUpsertOne) UpdateCode() *RoleUpsertOne

UpdateCode sets the "code" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateDescription

func (u *RoleUpsertOne) UpdateDescription() *RoleUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateIsActive

func (u *RoleUpsertOne) UpdateIsActive() *RoleUpsertOne

UpdateIsActive sets the "is_active" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateIsSystem

func (u *RoleUpsertOne) UpdateIsSystem() *RoleUpsertOne

UpdateIsSystem sets the "is_system" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateName

func (u *RoleUpsertOne) UpdateName() *RoleUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateNewValues

func (u *RoleUpsertOne) UpdateNewValues() *RoleUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(role.FieldID)
		}),
	).
	Exec(ctx)

func (*RoleUpsertOne) UpdateTenantID

func (u *RoleUpsertOne) UpdateTenantID() *RoleUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateUpdatedAt

func (u *RoleUpsertOne) UpdateUpdatedAt() *RoleUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

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.
	// Primary Key ID
	ID int64 `json:"id,omitempty"`
	// Name of the tenant
	Name string `json:"name,omitempty"`
	// Owner user ID of the tenant
	OwnerID int64 `json:"owner_id,omitempty"`
	// Tenant type: ROOT(系统租户), NORMAL(普通租户), GROUP(集团型租户), SUB(子租户)
	Type tenant.Type `json:"type,omitempty"`
	// Parent tenant ID for sub-tenants
	ParentID *int64 `json:"parent_id,omitempty"`
	// Tenant hierarchy path using ltree
	Path *string `json:"path,omitempty"`
	// Tenant hierarchy level (0 for root tenants)
	Level int32 `json:"level,omitempty"`
	// Status of the tenant
	Status tenant.Status `json:"status,omitempty"`
	// Expiration time of the tenant
	ExpiredAt *time.Time `json:"expired_at,omitempty"`
	// Tenant attributes and metadata
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	// User who created this record
	CreatedBy *int64 `json:"created_by,omitempty"`
	// User who last updated this record
	UpdatedBy *int64 `json:"updated_by,omitempty"`
	// Creation timestamp of this record
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Last update timestamp of this record
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Timestamp when the record was deleted, if applicable
	DeletedAt *time.Time `json:"deleted_at,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) QueryChildren

func (t *Tenant) QueryChildren() *TenantQuery

QueryChildren queries the "children" edge of the Tenant entity.

func (*Tenant) QueryDepartments

func (t *Tenant) QueryDepartments() *DepartmentQuery

QueryDepartments queries the "departments" edge of the Tenant entity.

func (*Tenant) QueryParent

func (t *Tenant) QueryParent() *TenantQuery

QueryParent queries the "parent" edge of the Tenant entity.

func (*Tenant) QueryRoles

func (t *Tenant) QueryRoles() *RoleQuery

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

func (*Tenant) QueryUserRoles

func (t *Tenant) QueryUserRoles() *UserRoleQuery

QueryUserRoles queries the "user_roles" edge of the Tenant entity.

func (*Tenant) QueryUserTenants

func (t *Tenant) QueryUserTenants() *UserTenantQuery

QueryUserTenants queries the "user_tenants" edge of the Tenant entity.

func (*Tenant) String

func (t *Tenant) String() string

String implements the fmt.Stringer.

func (*Tenant) Unwrap

func (t *Tenant) Unwrap() *Tenant

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

func (*Tenant) Update

func (t *Tenant) Update() *TenantUpdateOne

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

func (*Tenant) Value

func (t *Tenant) Value(name string) (ent.Value, error)

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

type TenantClient

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

TenantClient is a client for the Tenant schema.

func NewTenantClient

func NewTenantClient(c config) *TenantClient

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

func (*TenantClient) Create

func (c *TenantClient) Create() *TenantCreate

Create returns a builder for creating a Tenant entity.

func (*TenantClient) CreateBulk

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

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

func (*TenantClient) Delete

func (c *TenantClient) Delete() *TenantDelete

Delete returns a delete builder for Tenant.

func (*TenantClient) DeleteOne

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

DeleteOne returns a builder for deleting the given entity.

func (*TenantClient) DeleteOneID

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

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

func (*TenantClient) Get

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

Get returns a Tenant entity by its id.

func (*TenantClient) GetX

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

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

func (*TenantClient) Hooks

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

Hooks returns the client hooks.

func (*TenantClient) Intercept

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

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

func (*TenantClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TenantClient) MapCreateBulk

func (c *TenantClient) MapCreateBulk(slice any, setFunc func(*TenantCreate, int)) *TenantCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*TenantClient) Query

func (c *TenantClient) Query() *TenantQuery

Query returns a query builder for Tenant.

func (*TenantClient) QueryChildren

func (c *TenantClient) QueryChildren(t *Tenant) *TenantQuery

QueryChildren queries the children edge of a Tenant.

func (*TenantClient) QueryDepartments

func (c *TenantClient) QueryDepartments(t *Tenant) *DepartmentQuery

QueryDepartments queries the departments edge of a Tenant.

func (*TenantClient) QueryParent

func (c *TenantClient) QueryParent(t *Tenant) *TenantQuery

QueryParent queries the parent edge of a Tenant.

func (*TenantClient) QueryRoles

func (c *TenantClient) QueryRoles(t *Tenant) *RoleQuery

QueryRoles queries the roles edge of a Tenant.

func (*TenantClient) QueryUserRoles

func (c *TenantClient) QueryUserRoles(t *Tenant) *UserRoleQuery

QueryUserRoles queries the user_roles edge of a Tenant.

func (*TenantClient) QueryUserTenants

func (c *TenantClient) QueryUserTenants(t *Tenant) *UserTenantQuery

QueryUserTenants queries the user_tenants 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 int64) *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) AddChildIDs

func (tc *TenantCreate) AddChildIDs(ids ...int64) *TenantCreate

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantCreate) AddChildren

func (tc *TenantCreate) AddChildren(t ...*Tenant) *TenantCreate

AddChildren adds the "children" edges to the Tenant entity.

func (*TenantCreate) AddDepartmentIDs

func (tc *TenantCreate) AddDepartmentIDs(ids ...int64) *TenantCreate

AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.

func (*TenantCreate) AddDepartments

func (tc *TenantCreate) AddDepartments(d ...*Department) *TenantCreate

AddDepartments adds the "departments" edges to the Department entity.

func (*TenantCreate) AddRoleIDs

func (tc *TenantCreate) AddRoleIDs(ids ...int64) *TenantCreate

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

func (*TenantCreate) AddRoles

func (tc *TenantCreate) AddRoles(r ...*Role) *TenantCreate

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

func (*TenantCreate) AddUserRoleIDs

func (tc *TenantCreate) AddUserRoleIDs(ids ...int64) *TenantCreate

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*TenantCreate) AddUserRoles

func (tc *TenantCreate) AddUserRoles(u ...*UserRole) *TenantCreate

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*TenantCreate) AddUserTenantIDs

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

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*TenantCreate) AddUserTenants

func (tc *TenantCreate) AddUserTenants(u ...*UserTenant) *TenantCreate

AddUserTenants adds the "user_tenants" edges to the UserTenant 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) OnConflict

func (tc *TenantCreate) OnConflict(opts ...sql.ConflictOption) *TenantUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tenant.Create().
	SetName(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*TenantCreate) OnConflictColumns

func (tc *TenantCreate) OnConflictColumns(columns ...string) *TenantUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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

func (tc *TenantCreate) SetAttributes(m map[string]interface{}) *TenantCreate

SetAttributes sets the "attributes" field.

func (*TenantCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*TenantCreate) SetCreatedBy

func (tc *TenantCreate) SetCreatedBy(i int64) *TenantCreate

SetCreatedBy sets the "created_by" field.

func (*TenantCreate) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*TenantCreate) SetExpiredAt

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

SetExpiredAt sets the "expired_at" field.

func (*TenantCreate) SetID

func (tc *TenantCreate) SetID(i int64) *TenantCreate

SetID sets the "id" field.

func (*TenantCreate) SetLevel

func (tc *TenantCreate) SetLevel(i int32) *TenantCreate

SetLevel sets the "level" field.

func (*TenantCreate) SetName

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

SetName sets the "name" field.

func (*TenantCreate) SetNillableCreatedAt

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

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

func (*TenantCreate) SetNillableCreatedBy

func (tc *TenantCreate) SetNillableCreatedBy(i *int64) *TenantCreate

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

func (*TenantCreate) SetNillableDeletedAt

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

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

func (*TenantCreate) SetNillableExpiredAt

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

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TenantCreate) SetNillableID

func (tc *TenantCreate) SetNillableID(i *int64) *TenantCreate

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

func (*TenantCreate) SetNillableLevel

func (tc *TenantCreate) SetNillableLevel(i *int32) *TenantCreate

SetNillableLevel sets the "level" field if the given value is not nil.

func (*TenantCreate) SetNillableParentID

func (tc *TenantCreate) SetNillableParentID(i *int64) *TenantCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TenantCreate) SetNillablePath

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

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

func (*TenantCreate) SetNillableStatus

func (tc *TenantCreate) SetNillableStatus(t *tenant.Status) *TenantCreate

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

func (*TenantCreate) SetNillableType

func (tc *TenantCreate) SetNillableType(t *tenant.Type) *TenantCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*TenantCreate) SetNillableUpdatedAt

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

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

func (*TenantCreate) SetNillableUpdatedBy

func (tc *TenantCreate) SetNillableUpdatedBy(i *int64) *TenantCreate

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

func (*TenantCreate) SetOwnerID

func (tc *TenantCreate) SetOwnerID(i int64) *TenantCreate

SetOwnerID sets the "owner_id" field.

func (*TenantCreate) SetParent

func (tc *TenantCreate) SetParent(t *Tenant) *TenantCreate

SetParent sets the "parent" edge to the Tenant entity.

func (*TenantCreate) SetParentID

func (tc *TenantCreate) SetParentID(i int64) *TenantCreate

SetParentID sets the "parent_id" field.

func (*TenantCreate) SetPath

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

SetPath sets the "path" field.

func (*TenantCreate) SetStatus

func (tc *TenantCreate) SetStatus(t tenant.Status) *TenantCreate

SetStatus sets the "status" field.

func (*TenantCreate) SetType

func (tc *TenantCreate) SetType(t tenant.Type) *TenantCreate

SetType sets the "type" field.

func (*TenantCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*TenantCreate) SetUpdatedBy

func (tc *TenantCreate) SetUpdatedBy(i int64) *TenantCreate

SetUpdatedBy sets the "updated_by" 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) OnConflict

func (tcb *TenantCreateBulk) OnConflict(opts ...sql.ConflictOption) *TenantUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Tenant.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.TenantUpsert) {
		SetName(v+v).
	}).
	Exec(ctx)

func (*TenantCreateBulk) OnConflictColumns

func (tcb *TenantCreateBulk) OnConflictColumns(columns ...string) *TenantUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TenantCreateBulk) Save

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

Save creates the Tenant entities in the database.

func (*TenantCreateBulk) SaveX

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

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

type TenantDelete

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

TenantDelete is the builder for deleting a Tenant entity.

func (*TenantDelete) Exec

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

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

func (*TenantDelete) ExecX

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

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

func (*TenantDelete) Where

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

Where appends a list predicates to the TenantDelete builder.

type TenantDeleteOne

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

TenantDeleteOne is the builder for deleting a single Tenant entity.

func (*TenantDeleteOne) Exec

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

Exec executes the deletion query.

func (*TenantDeleteOne) ExecX

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

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

func (*TenantDeleteOne) Where

func (tdo *TenantDeleteOne) Where(ps ...predicate.Tenant) *TenantDeleteOne

Where appends a list predicates to the TenantDelete builder.

type TenantEdges

type TenantEdges struct {
	// UserTenants holds the value of the user_tenants edge.
	UserTenants []*UserTenant `json:"user_tenants,omitempty"`
	// Departments holds the value of the departments edge.
	Departments []*Department `json:"departments,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Tenant `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Tenant `json:"children,omitempty"`
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// UserRoles holds the value of the user_roles edge.
	UserRoles []*UserRole `json:"user_roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (TenantEdges) ChildrenOrErr

func (e TenantEdges) ChildrenOrErr() ([]*Tenant, error)

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

func (TenantEdges) DepartmentsOrErr

func (e TenantEdges) DepartmentsOrErr() ([]*Department, error)

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

func (TenantEdges) ParentOrErr

func (e TenantEdges) ParentOrErr() (*Tenant, error)

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

func (TenantEdges) RolesOrErr

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

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

func (TenantEdges) UserRolesOrErr

func (e TenantEdges) UserRolesOrErr() ([]*UserRole, error)

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

func (TenantEdges) UserTenantsOrErr

func (e TenantEdges) UserTenantsOrErr() ([]*UserTenant, error)

UserTenantsOrErr returns the UserTenants 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 (s *TenantGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*TenantGroupBy) BoolX

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

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

func (*TenantGroupBy) Bools

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

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

func (*TenantGroupBy) BoolsX

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

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

func (*TenantGroupBy) Float64

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

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

func (*TenantGroupBy) Float64X

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

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

func (*TenantGroupBy) Float64s

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

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

func (*TenantGroupBy) Float64sX

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

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

func (*TenantGroupBy) Int

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

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

func (*TenantGroupBy) IntX

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

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

func (*TenantGroupBy) Ints

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

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

func (*TenantGroupBy) IntsX

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

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

func (*TenantGroupBy) Scan

func (tgb *TenantGroupBy) Scan(ctx context.Context, v any) error

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

func (*TenantGroupBy) ScanX

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

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

func (*TenantGroupBy) String

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

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

func (*TenantGroupBy) StringX

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

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

func (*TenantGroupBy) Strings

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

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

func (*TenantGroupBy) StringsX

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

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

type TenantMutation

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

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

func (*TenantMutation) AddChildIDs

func (m *TenantMutation) AddChildIDs(ids ...int64)

AddChildIDs adds the "children" edge to the Tenant entity by ids.

func (*TenantMutation) AddCreatedBy

func (m *TenantMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*TenantMutation) AddDepartmentIDs

func (m *TenantMutation) AddDepartmentIDs(ids ...int64)

AddDepartmentIDs adds the "departments" edge to the Department entity by ids.

func (*TenantMutation) AddField

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

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

func (*TenantMutation) AddLevel

func (m *TenantMutation) AddLevel(i int32)

AddLevel adds i to the "level" field.

func (*TenantMutation) AddOwnerID

func (m *TenantMutation) AddOwnerID(i int64)

AddOwnerID adds i to the "owner_id" field.

func (*TenantMutation) AddRoleIDs

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

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

func (*TenantMutation) AddUpdatedBy

func (m *TenantMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*TenantMutation) AddUserRoleIDs

func (m *TenantMutation) AddUserRoleIDs(ids ...int64)

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by ids.

func (*TenantMutation) AddUserTenantIDs

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

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by ids.

func (*TenantMutation) AddedCreatedBy

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

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

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

func (m *TenantMutation) AddedLevel() (r int32, exists bool)

AddedLevel returns the value that was added to the "level" field in this mutation.

func (*TenantMutation) AddedOwnerID

func (m *TenantMutation) AddedOwnerID() (r int64, exists bool)

AddedOwnerID returns the value that was added to the "owner_id" field in this mutation.

func (*TenantMutation) AddedUpdatedBy

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

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

func (*TenantMutation) Attributes

func (m *TenantMutation) Attributes() (r map[string]interface{}, exists bool)

Attributes returns the value of the "attributes" field in the mutation.

func (*TenantMutation) ChildrenCleared

func (m *TenantMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Tenant entity was cleared.

func (*TenantMutation) ChildrenIDs

func (m *TenantMutation) ChildrenIDs() (ids []int64)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*TenantMutation) ClearChildren

func (m *TenantMutation) ClearChildren()

ClearChildren clears the "children" edge to the Tenant entity.

func (*TenantMutation) ClearCreatedBy

func (m *TenantMutation) ClearCreatedBy()

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantMutation) ClearDeletedAt

func (m *TenantMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantMutation) ClearDepartments

func (m *TenantMutation) ClearDepartments()

ClearDepartments clears the "departments" edge to the Department entity.

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

func (m *TenantMutation) ClearExpiredAt()

ClearExpiredAt clears the value of the "expired_at" field.

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

func (m *TenantMutation) ClearParent()

ClearParent clears the "parent" edge to the Tenant entity.

func (*TenantMutation) ClearParentID

func (m *TenantMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*TenantMutation) ClearPath

func (m *TenantMutation) ClearPath()

ClearPath clears the value of the "path" field.

func (*TenantMutation) ClearRoles

func (m *TenantMutation) ClearRoles()

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

func (*TenantMutation) ClearUpdatedBy

func (m *TenantMutation) ClearUpdatedBy()

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantMutation) ClearUserRoles

func (m *TenantMutation) ClearUserRoles()

ClearUserRoles clears the "user_roles" edge to the UserRole entity.

func (*TenantMutation) ClearUserTenants

func (m *TenantMutation) ClearUserTenants()

ClearUserTenants clears the "user_tenants" edge to the UserTenant entity.

func (*TenantMutation) ClearedEdges

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

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

func (*TenantMutation) ClearedFields

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

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

func (TenantMutation) Client

func (m TenantMutation) Client() *Client

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

func (*TenantMutation) CreatedAt

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

CreatedAt returns the value of the "created_at" field in the mutation.

func (*TenantMutation) CreatedBy

func (m *TenantMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*TenantMutation) CreatedByCleared

func (m *TenantMutation) CreatedByCleared() bool

CreatedByCleared returns if the "created_by" field was cleared in this mutation.

func (*TenantMutation) DeletedAt

func (m *TenantMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*TenantMutation) DeletedAtCleared

func (m *TenantMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*TenantMutation) DepartmentsCleared

func (m *TenantMutation) DepartmentsCleared() bool

DepartmentsCleared reports if the "departments" edge to the Department entity was cleared.

func (*TenantMutation) DepartmentsIDs

func (m *TenantMutation) DepartmentsIDs() (ids []int64)

DepartmentsIDs returns the "departments" edge IDs 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) ExpiredAt

func (m *TenantMutation) ExpiredAt() (r time.Time, exists bool)

ExpiredAt returns the value of the "expired_at" field in the mutation.

func (*TenantMutation) ExpiredAtCleared

func (m *TenantMutation) ExpiredAtCleared() bool

ExpiredAtCleared returns if the "expired_at" field 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) GetType

func (m *TenantMutation) GetType() (r tenant.Type, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*TenantMutation) ID

func (m *TenantMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*TenantMutation) IDs

func (m *TenantMutation) IDs(ctx context.Context) ([]int64, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*TenantMutation) Level

func (m *TenantMutation) Level() (r int32, exists bool)

Level returns the value of the "level" field in the mutation.

func (*TenantMutation) Name

func (m *TenantMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TenantMutation) OldAttributes

func (m *TenantMutation) OldAttributes(ctx context.Context) (v map[string]interface{}, err error)

OldAttributes returns the old "attributes" 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) OldCreatedAt

func (m *TenantMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldCreatedBy

func (m *TenantMutation) OldCreatedBy(ctx context.Context) (v *int64, err error)

OldCreatedBy returns the old "created_by" 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) OldDeletedAt

func (m *TenantMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldExpiredAt

func (m *TenantMutation) OldExpiredAt(ctx context.Context) (v *time.Time, err error)

OldExpiredAt returns the old "expired_at" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) 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) OldLevel

func (m *TenantMutation) OldLevel(ctx context.Context) (v int32, err error)

OldLevel returns the old "level" 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) OldName

func (m *TenantMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldOwnerID

func (m *TenantMutation) OldOwnerID(ctx context.Context) (v int64, err error)

OldOwnerID returns the old "owner_id" 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) OldParentID

func (m *TenantMutation) OldParentID(ctx context.Context) (v *int64, err error)

OldParentID returns the old "parent_id" 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) OldPath

func (m *TenantMutation) OldPath(ctx context.Context) (v *string, err error)

OldPath returns the old "path" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldStatus

func (m *TenantMutation) OldStatus(ctx context.Context) (v tenant.Status, err error)

OldStatus returns the old "status" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldType

func (m *TenantMutation) OldType(ctx context.Context) (v tenant.Type, err error)

OldType returns the old "type" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldUpdatedAt

func (m *TenantMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Tenant entity. If the Tenant object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*TenantMutation) OldUpdatedBy

func (m *TenantMutation) OldUpdatedBy(ctx context.Context) (v *int64, err error)

OldUpdatedBy returns the old "updated_by" 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) OwnerID

func (m *TenantMutation) OwnerID() (r int64, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*TenantMutation) ParentCleared

func (m *TenantMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Tenant entity was cleared.

func (*TenantMutation) ParentID

func (m *TenantMutation) ParentID() (r int64, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*TenantMutation) ParentIDCleared

func (m *TenantMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*TenantMutation) ParentIDs

func (m *TenantMutation) ParentIDs() (ids []int64)

ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.

func (*TenantMutation) Path

func (m *TenantMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*TenantMutation) PathCleared

func (m *TenantMutation) PathCleared() bool

PathCleared returns if the "path" field was cleared in this mutation.

func (*TenantMutation) RemoveChildIDs

func (m *TenantMutation) RemoveChildIDs(ids ...int64)

RemoveChildIDs removes the "children" edge to the Tenant entity by IDs.

func (*TenantMutation) RemoveDepartmentIDs

func (m *TenantMutation) RemoveDepartmentIDs(ids ...int64)

RemoveDepartmentIDs removes the "departments" edge to the Department entity by IDs.

func (*TenantMutation) RemoveRoleIDs

func (m *TenantMutation) RemoveRoleIDs(ids ...int64)

RemoveRoleIDs removes the "roles" edge to the Role entity by IDs.

func (*TenantMutation) RemoveUserRoleIDs

func (m *TenantMutation) RemoveUserRoleIDs(ids ...int64)

RemoveUserRoleIDs removes the "user_roles" edge to the UserRole entity by IDs.

func (*TenantMutation) RemoveUserTenantIDs

func (m *TenantMutation) RemoveUserTenantIDs(ids ...int)

RemoveUserTenantIDs removes the "user_tenants" edge to the UserTenant entity by IDs.

func (*TenantMutation) RemovedChildrenIDs

func (m *TenantMutation) RemovedChildrenIDs() (ids []int64)

RemovedChildren returns the removed IDs of the "children" edge to the Tenant entity.

func (*TenantMutation) RemovedDepartmentsIDs

func (m *TenantMutation) RemovedDepartmentsIDs() (ids []int64)

RemovedDepartments returns the removed IDs of the "departments" edge to the Department entity.

func (*TenantMutation) RemovedEdges

func (m *TenantMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TenantMutation) RemovedIDs

func (m *TenantMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*TenantMutation) RemovedRolesIDs

func (m *TenantMutation) RemovedRolesIDs() (ids []int64)

RemovedRoles returns the removed IDs of the "roles" edge to the Role entity.

func (*TenantMutation) RemovedUserRolesIDs

func (m *TenantMutation) RemovedUserRolesIDs() (ids []int64)

RemovedUserRoles returns the removed IDs of the "user_roles" edge to the UserRole entity.

func (*TenantMutation) RemovedUserTenantsIDs

func (m *TenantMutation) RemovedUserTenantsIDs() (ids []int)

RemovedUserTenants returns the removed IDs of the "user_tenants" edge to the UserTenant entity.

func (*TenantMutation) ResetAttributes

func (m *TenantMutation) ResetAttributes()

ResetAttributes resets all changes to the "attributes" field.

func (*TenantMutation) ResetChildren

func (m *TenantMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*TenantMutation) ResetCreatedAt

func (m *TenantMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TenantMutation) ResetCreatedBy

func (m *TenantMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*TenantMutation) ResetDeletedAt

func (m *TenantMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*TenantMutation) ResetDepartments

func (m *TenantMutation) ResetDepartments()

ResetDepartments resets all changes to the "departments" edge.

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) ResetExpiredAt

func (m *TenantMutation) ResetExpiredAt()

ResetExpiredAt resets all changes to the "expired_at" field.

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) ResetLevel

func (m *TenantMutation) ResetLevel()

ResetLevel resets all changes to the "level" field.

func (*TenantMutation) ResetName

func (m *TenantMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TenantMutation) ResetOwnerID

func (m *TenantMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" field.

func (*TenantMutation) ResetParent

func (m *TenantMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*TenantMutation) ResetParentID

func (m *TenantMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*TenantMutation) ResetPath

func (m *TenantMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*TenantMutation) ResetRoles

func (m *TenantMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*TenantMutation) ResetStatus

func (m *TenantMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*TenantMutation) ResetType

func (m *TenantMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*TenantMutation) ResetUpdatedAt

func (m *TenantMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TenantMutation) ResetUpdatedBy

func (m *TenantMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*TenantMutation) ResetUserRoles

func (m *TenantMutation) ResetUserRoles()

ResetUserRoles resets all changes to the "user_roles" edge.

func (*TenantMutation) ResetUserTenants

func (m *TenantMutation) ResetUserTenants()

ResetUserTenants resets all changes to the "user_tenants" edge.

func (*TenantMutation) RolesCleared

func (m *TenantMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Role entity was cleared.

func (*TenantMutation) RolesIDs

func (m *TenantMutation) RolesIDs() (ids []int64)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*TenantMutation) SetAttributes

func (m *TenantMutation) SetAttributes(value map[string]interface{})

SetAttributes sets the "attributes" field.

func (*TenantMutation) SetCreatedAt

func (m *TenantMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*TenantMutation) SetCreatedBy

func (m *TenantMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*TenantMutation) SetDeletedAt

func (m *TenantMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*TenantMutation) SetExpiredAt

func (m *TenantMutation) SetExpiredAt(t time.Time)

SetExpiredAt sets the "expired_at" field.

func (*TenantMutation) SetField

func (m *TenantMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*TenantMutation) SetID

func (m *TenantMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Tenant entities.

func (*TenantMutation) SetLevel

func (m *TenantMutation) SetLevel(i int32)

SetLevel sets the "level" field.

func (*TenantMutation) SetName

func (m *TenantMutation) SetName(s string)

SetName sets the "name" field.

func (*TenantMutation) SetOp

func (m *TenantMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TenantMutation) SetOwnerID

func (m *TenantMutation) SetOwnerID(i int64)

SetOwnerID sets the "owner_id" field.

func (*TenantMutation) SetParentID

func (m *TenantMutation) SetParentID(i int64)

SetParentID sets the "parent_id" field.

func (*TenantMutation) SetPath

func (m *TenantMutation) SetPath(s string)

SetPath sets the "path" field.

func (*TenantMutation) SetStatus

func (m *TenantMutation) SetStatus(t tenant.Status)

SetStatus sets the "status" field.

func (*TenantMutation) SetType

func (m *TenantMutation) SetType(t tenant.Type)

SetType sets the "type" field.

func (*TenantMutation) SetUpdatedAt

func (m *TenantMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*TenantMutation) SetUpdatedBy

func (m *TenantMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*TenantMutation) Status

func (m *TenantMutation) Status() (r tenant.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (TenantMutation) Tx

func (m TenantMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TenantMutation) Type

func (m *TenantMutation) Type() string

Type returns the node type of this mutation (Tenant).

func (*TenantMutation) UpdatedAt

func (m *TenantMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*TenantMutation) UpdatedBy

func (m *TenantMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*TenantMutation) UpdatedByCleared

func (m *TenantMutation) UpdatedByCleared() bool

UpdatedByCleared returns if the "updated_by" field was cleared in this mutation.

func (*TenantMutation) UserRolesCleared

func (m *TenantMutation) UserRolesCleared() bool

UserRolesCleared reports if the "user_roles" edge to the UserRole entity was cleared.

func (*TenantMutation) UserRolesIDs

func (m *TenantMutation) UserRolesIDs() (ids []int64)

UserRolesIDs returns the "user_roles" edge IDs in the mutation.

func (*TenantMutation) UserTenantsCleared

func (m *TenantMutation) UserTenantsCleared() bool

UserTenantsCleared reports if the "user_tenants" edge to the UserTenant entity was cleared.

func (*TenantMutation) UserTenantsIDs

func (m *TenantMutation) UserTenantsIDs() (ids []int)

UserTenantsIDs returns the "user_tenants" edge IDs in the mutation.

func (*TenantMutation) Where

func (m *TenantMutation) Where(ps ...predicate.Tenant)

Where appends a list predicates to the TenantMutation builder.

func (*TenantMutation) WhereP

func (m *TenantMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the TenantMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type TenantQuery

type TenantQuery struct {
	// contains filtered or unexported fields
}

TenantQuery is the builder for querying Tenant entities.

func (*TenantQuery) Aggregate

func (tq *TenantQuery) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate returns a TenantSelect configured with the given aggregations.

func (*TenantQuery) All

func (tq *TenantQuery) All(ctx context.Context) ([]*Tenant, error)

All executes the query and returns a list of Tenants.

func (*TenantQuery) AllX

func (tq *TenantQuery) AllX(ctx context.Context) []*Tenant

AllX is like All, but panics if an error occurs.

func (*TenantQuery) Clone

func (tq *TenantQuery) Clone() *TenantQuery

Clone returns a duplicate of the TenantQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TenantQuery) Count

func (tq *TenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TenantQuery) CountX

func (tq *TenantQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TenantQuery) Exist

func (tq *TenantQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TenantQuery) ExistX

func (tq *TenantQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TenantQuery) First

func (tq *TenantQuery) First(ctx context.Context) (*Tenant, error)

First returns the first Tenant entity from the query. Returns a *NotFoundError when no Tenant was found.

func (*TenantQuery) FirstID

func (tq *TenantQuery) FirstID(ctx context.Context) (id int64, 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) int64

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) ForShare

func (tq *TenantQuery) ForShare(opts ...sql.LockOption) *TenantQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*TenantQuery) ForUpdate

func (tq *TenantQuery) ForUpdate(opts ...sql.LockOption) *TenantQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

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 {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Tenant.Query().
	GroupBy(tenant.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TenantQuery) IDs

func (tq *TenantQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of Tenant IDs.

func (*TenantQuery) IDsX

func (tq *TenantQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*TenantQuery) Limit

func (tq *TenantQuery) Limit(limit int) *TenantQuery

Limit the number of records to be returned by this query.

func (*TenantQuery) Offset

func (tq *TenantQuery) Offset(offset int) *TenantQuery

Offset to start from.

func (*TenantQuery) Only

func (tq *TenantQuery) Only(ctx context.Context) (*Tenant, error)

Only returns a single Tenant entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Tenant entity is found. Returns a *NotFoundError when no Tenant entities are found.

func (*TenantQuery) OnlyID

func (tq *TenantQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only Tenant ID in the query. Returns a *NotSingularError when more than one Tenant ID is found. Returns a *NotFoundError when no entities are found.

func (*TenantQuery) OnlyIDX

func (tq *TenantQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TenantQuery) OnlyX

func (tq *TenantQuery) OnlyX(ctx context.Context) *Tenant

OnlyX is like Only, but panics if an error occurs.

func (*TenantQuery) Order

func (tq *TenantQuery) Order(o ...tenant.OrderOption) *TenantQuery

Order specifies how the records should be ordered.

func (*TenantQuery) QueryChildren

func (tq *TenantQuery) QueryChildren() *TenantQuery

QueryChildren chains the current query on the "children" edge.

func (*TenantQuery) QueryDepartments

func (tq *TenantQuery) QueryDepartments() *DepartmentQuery

QueryDepartments chains the current query on the "departments" edge.

func (*TenantQuery) QueryParent

func (tq *TenantQuery) QueryParent() *TenantQuery

QueryParent chains the current query on the "parent" edge.

func (*TenantQuery) QueryRoles

func (tq *TenantQuery) QueryRoles() *RoleQuery

QueryRoles chains the current query on the "roles" edge.

func (*TenantQuery) QueryUserRoles

func (tq *TenantQuery) QueryUserRoles() *UserRoleQuery

QueryUserRoles chains the current query on the "user_roles" edge.

func (*TenantQuery) QueryUserTenants

func (tq *TenantQuery) QueryUserTenants() *UserTenantQuery

QueryUserTenants chains the current query on the "user_tenants" 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 {
	Name string `json:"name,omitempty"`
}

client.Tenant.Query().
	Select(tenant.FieldName).
	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) WithChildren

func (tq *TenantQuery) WithChildren(opts ...func(*TenantQuery)) *TenantQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithDepartments

func (tq *TenantQuery) WithDepartments(opts ...func(*DepartmentQuery)) *TenantQuery

WithDepartments tells the query-builder to eager-load the nodes that are connected to the "departments" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithParent

func (tq *TenantQuery) WithParent(opts ...func(*TenantQuery)) *TenantQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithRoles

func (tq *TenantQuery) WithRoles(opts ...func(*RoleQuery)) *TenantQuery

WithRoles tells the query-builder to eager-load the nodes that are connected to the "roles" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithUserRoles

func (tq *TenantQuery) WithUserRoles(opts ...func(*UserRoleQuery)) *TenantQuery

WithUserRoles tells the query-builder to eager-load the nodes that are connected to the "user_roles" edge. The optional arguments are used to configure the query builder of the edge.

func (*TenantQuery) WithUserTenants

func (tq *TenantQuery) WithUserTenants(opts ...func(*UserTenantQuery)) *TenantQuery

WithUserTenants tells the query-builder to eager-load the nodes that are connected to the "user_tenants" edge. The optional arguments are used to configure the query builder of the edge.

type TenantSelect

type TenantSelect struct {
	*TenantQuery
	// contains filtered or unexported fields
}

TenantSelect is the builder for selecting fields of Tenant entities.

func (*TenantSelect) Aggregate

func (ts *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TenantSelect) Bool

func (s *TenantSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TenantSelect) BoolX

func (s *TenantSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TenantSelect) Bools

func (s *TenantSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TenantSelect) BoolsX

func (s *TenantSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TenantSelect) Float64

func (s *TenantSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TenantSelect) Float64X

func (s *TenantSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TenantSelect) Float64s

func (s *TenantSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TenantSelect) Float64sX

func (s *TenantSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TenantSelect) Int

func (s *TenantSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TenantSelect) IntX

func (s *TenantSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TenantSelect) Ints

func (s *TenantSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TenantSelect) IntsX

func (s *TenantSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TenantSelect) Scan

func (ts *TenantSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*TenantSelect) ScanX

func (s *TenantSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*TenantSelect) String

func (s *TenantSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TenantSelect) StringX

func (s *TenantSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TenantSelect) Strings

func (s *TenantSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TenantSelect) StringsX

func (s *TenantSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TenantUpdate

type TenantUpdate struct {
	// contains filtered or unexported fields
}

TenantUpdate is the builder for updating Tenant entities.

func (*TenantUpdate) AddChildIDs

func (tu *TenantUpdate) AddChildIDs(ids ...int64) *TenantUpdate

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantUpdate) AddChildren

func (tu *TenantUpdate) AddChildren(t ...*Tenant) *TenantUpdate

AddChildren adds the "children" edges to the Tenant entity.

func (*TenantUpdate) AddCreatedBy

func (tu *TenantUpdate) AddCreatedBy(i int64) *TenantUpdate

AddCreatedBy adds i to the "created_by" field.

func (*TenantUpdate) AddDepartmentIDs

func (tu *TenantUpdate) AddDepartmentIDs(ids ...int64) *TenantUpdate

AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.

func (*TenantUpdate) AddDepartments

func (tu *TenantUpdate) AddDepartments(d ...*Department) *TenantUpdate

AddDepartments adds the "departments" edges to the Department entity.

func (*TenantUpdate) AddLevel

func (tu *TenantUpdate) AddLevel(i int32) *TenantUpdate

AddLevel adds i to the "level" field.

func (*TenantUpdate) AddOwnerID

func (tu *TenantUpdate) AddOwnerID(i int64) *TenantUpdate

AddOwnerID adds i to the "owner_id" field.

func (*TenantUpdate) AddRoleIDs

func (tu *TenantUpdate) AddRoleIDs(ids ...int64) *TenantUpdate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*TenantUpdate) AddRoles

func (tu *TenantUpdate) AddRoles(r ...*Role) *TenantUpdate

AddRoles adds the "roles" edges to the Role entity.

func (*TenantUpdate) AddUpdatedBy

func (tu *TenantUpdate) AddUpdatedBy(i int64) *TenantUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*TenantUpdate) AddUserRoleIDs

func (tu *TenantUpdate) AddUserRoleIDs(ids ...int64) *TenantUpdate

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*TenantUpdate) AddUserRoles

func (tu *TenantUpdate) AddUserRoles(u ...*UserRole) *TenantUpdate

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*TenantUpdate) AddUserTenantIDs

func (tu *TenantUpdate) AddUserTenantIDs(ids ...int) *TenantUpdate

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*TenantUpdate) AddUserTenants

func (tu *TenantUpdate) AddUserTenants(u ...*UserTenant) *TenantUpdate

AddUserTenants adds the "user_tenants" edges to the UserTenant entity.

func (*TenantUpdate) ClearChildren

func (tu *TenantUpdate) ClearChildren() *TenantUpdate

ClearChildren clears all "children" edges to the Tenant entity.

func (*TenantUpdate) ClearCreatedBy

func (tu *TenantUpdate) ClearCreatedBy() *TenantUpdate

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantUpdate) ClearDeletedAt

func (tu *TenantUpdate) ClearDeletedAt() *TenantUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantUpdate) ClearDepartments

func (tu *TenantUpdate) ClearDepartments() *TenantUpdate

ClearDepartments clears all "departments" edges to the Department entity.

func (*TenantUpdate) ClearExpiredAt

func (tu *TenantUpdate) ClearExpiredAt() *TenantUpdate

ClearExpiredAt clears the value of the "expired_at" field.

func (*TenantUpdate) ClearParent

func (tu *TenantUpdate) ClearParent() *TenantUpdate

ClearParent clears the "parent" edge to the Tenant entity.

func (*TenantUpdate) ClearParentID

func (tu *TenantUpdate) ClearParentID() *TenantUpdate

ClearParentID clears the value of the "parent_id" field.

func (*TenantUpdate) ClearPath

func (tu *TenantUpdate) ClearPath() *TenantUpdate

ClearPath clears the value of the "path" field.

func (*TenantUpdate) ClearRoles

func (tu *TenantUpdate) ClearRoles() *TenantUpdate

ClearRoles clears all "roles" edges to the Role entity.

func (*TenantUpdate) ClearUpdatedBy

func (tu *TenantUpdate) ClearUpdatedBy() *TenantUpdate

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantUpdate) ClearUserRoles

func (tu *TenantUpdate) ClearUserRoles() *TenantUpdate

ClearUserRoles clears all "user_roles" edges to the UserRole entity.

func (*TenantUpdate) ClearUserTenants

func (tu *TenantUpdate) ClearUserTenants() *TenantUpdate

ClearUserTenants clears all "user_tenants" edges to the UserTenant 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) RemoveChildIDs

func (tu *TenantUpdate) RemoveChildIDs(ids ...int64) *TenantUpdate

RemoveChildIDs removes the "children" edge to Tenant entities by IDs.

func (*TenantUpdate) RemoveChildren

func (tu *TenantUpdate) RemoveChildren(t ...*Tenant) *TenantUpdate

RemoveChildren removes "children" edges to Tenant entities.

func (*TenantUpdate) RemoveDepartmentIDs

func (tu *TenantUpdate) RemoveDepartmentIDs(ids ...int64) *TenantUpdate

RemoveDepartmentIDs removes the "departments" edge to Department entities by IDs.

func (*TenantUpdate) RemoveDepartments

func (tu *TenantUpdate) RemoveDepartments(d ...*Department) *TenantUpdate

RemoveDepartments removes "departments" edges to Department entities.

func (*TenantUpdate) RemoveRoleIDs

func (tu *TenantUpdate) RemoveRoleIDs(ids ...int64) *TenantUpdate

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*TenantUpdate) RemoveRoles

func (tu *TenantUpdate) RemoveRoles(r ...*Role) *TenantUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*TenantUpdate) RemoveUserRoleIDs

func (tu *TenantUpdate) RemoveUserRoleIDs(ids ...int64) *TenantUpdate

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*TenantUpdate) RemoveUserRoles

func (tu *TenantUpdate) RemoveUserRoles(u ...*UserRole) *TenantUpdate

RemoveUserRoles removes "user_roles" edges to UserRole entities.

func (*TenantUpdate) RemoveUserTenantIDs

func (tu *TenantUpdate) RemoveUserTenantIDs(ids ...int) *TenantUpdate

RemoveUserTenantIDs removes the "user_tenants" edge to UserTenant entities by IDs.

func (*TenantUpdate) RemoveUserTenants

func (tu *TenantUpdate) RemoveUserTenants(u ...*UserTenant) *TenantUpdate

RemoveUserTenants removes "user_tenants" edges to UserTenant 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) SetAttributes

func (tu *TenantUpdate) SetAttributes(m map[string]interface{}) *TenantUpdate

SetAttributes sets the "attributes" field.

func (*TenantUpdate) SetCreatedBy

func (tu *TenantUpdate) SetCreatedBy(i int64) *TenantUpdate

SetCreatedBy sets the "created_by" field.

func (*TenantUpdate) SetDeletedAt

func (tu *TenantUpdate) SetDeletedAt(t time.Time) *TenantUpdate

SetDeletedAt sets the "deleted_at" field.

func (*TenantUpdate) SetExpiredAt

func (tu *TenantUpdate) SetExpiredAt(t time.Time) *TenantUpdate

SetExpiredAt sets the "expired_at" field.

func (*TenantUpdate) SetLevel

func (tu *TenantUpdate) SetLevel(i int32) *TenantUpdate

SetLevel sets the "level" field.

func (*TenantUpdate) SetName

func (tu *TenantUpdate) SetName(s string) *TenantUpdate

SetName sets the "name" field.

func (*TenantUpdate) SetNillableCreatedBy

func (tu *TenantUpdate) SetNillableCreatedBy(i *int64) *TenantUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*TenantUpdate) SetNillableDeletedAt

func (tu *TenantUpdate) SetNillableDeletedAt(t *time.Time) *TenantUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*TenantUpdate) SetNillableExpiredAt

func (tu *TenantUpdate) SetNillableExpiredAt(t *time.Time) *TenantUpdate

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TenantUpdate) SetNillableLevel

func (tu *TenantUpdate) SetNillableLevel(i *int32) *TenantUpdate

SetNillableLevel sets the "level" field if the given value is not nil.

func (*TenantUpdate) SetNillableName

func (tu *TenantUpdate) SetNillableName(s *string) *TenantUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*TenantUpdate) SetNillableOwnerID

func (tu *TenantUpdate) SetNillableOwnerID(i *int64) *TenantUpdate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*TenantUpdate) SetNillableParentID

func (tu *TenantUpdate) SetNillableParentID(i *int64) *TenantUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TenantUpdate) SetNillablePath

func (tu *TenantUpdate) SetNillablePath(s *string) *TenantUpdate

SetNillablePath sets the "path" field if the given value is not nil.

func (*TenantUpdate) SetNillableStatus

func (tu *TenantUpdate) SetNillableStatus(t *tenant.Status) *TenantUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TenantUpdate) SetNillableType

func (tu *TenantUpdate) SetNillableType(t *tenant.Type) *TenantUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*TenantUpdate) SetNillableUpdatedBy

func (tu *TenantUpdate) SetNillableUpdatedBy(i *int64) *TenantUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*TenantUpdate) SetOwnerID

func (tu *TenantUpdate) SetOwnerID(i int64) *TenantUpdate

SetOwnerID sets the "owner_id" field.

func (*TenantUpdate) SetParent

func (tu *TenantUpdate) SetParent(t *Tenant) *TenantUpdate

SetParent sets the "parent" edge to the Tenant entity.

func (*TenantUpdate) SetParentID

func (tu *TenantUpdate) SetParentID(i int64) *TenantUpdate

SetParentID sets the "parent_id" field.

func (*TenantUpdate) SetPath

func (tu *TenantUpdate) SetPath(s string) *TenantUpdate

SetPath sets the "path" field.

func (*TenantUpdate) SetStatus

func (tu *TenantUpdate) SetStatus(t tenant.Status) *TenantUpdate

SetStatus sets the "status" field.

func (*TenantUpdate) SetType

func (tu *TenantUpdate) SetType(t tenant.Type) *TenantUpdate

SetType sets the "type" field.

func (*TenantUpdate) SetUpdatedAt

func (tu *TenantUpdate) SetUpdatedAt(t time.Time) *TenantUpdate

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpdate) SetUpdatedBy

func (tu *TenantUpdate) SetUpdatedBy(i int64) *TenantUpdate

SetUpdatedBy sets the "updated_by" 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) AddChildIDs

func (tuo *TenantUpdateOne) AddChildIDs(ids ...int64) *TenantUpdateOne

AddChildIDs adds the "children" edge to the Tenant entity by IDs.

func (*TenantUpdateOne) AddChildren

func (tuo *TenantUpdateOne) AddChildren(t ...*Tenant) *TenantUpdateOne

AddChildren adds the "children" edges to the Tenant entity.

func (*TenantUpdateOne) AddCreatedBy

func (tuo *TenantUpdateOne) AddCreatedBy(i int64) *TenantUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*TenantUpdateOne) AddDepartmentIDs

func (tuo *TenantUpdateOne) AddDepartmentIDs(ids ...int64) *TenantUpdateOne

AddDepartmentIDs adds the "departments" edge to the Department entity by IDs.

func (*TenantUpdateOne) AddDepartments

func (tuo *TenantUpdateOne) AddDepartments(d ...*Department) *TenantUpdateOne

AddDepartments adds the "departments" edges to the Department entity.

func (*TenantUpdateOne) AddLevel

func (tuo *TenantUpdateOne) AddLevel(i int32) *TenantUpdateOne

AddLevel adds i to the "level" field.

func (*TenantUpdateOne) AddOwnerID

func (tuo *TenantUpdateOne) AddOwnerID(i int64) *TenantUpdateOne

AddOwnerID adds i to the "owner_id" field.

func (*TenantUpdateOne) AddRoleIDs

func (tuo *TenantUpdateOne) AddRoleIDs(ids ...int64) *TenantUpdateOne

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*TenantUpdateOne) AddRoles

func (tuo *TenantUpdateOne) AddRoles(r ...*Role) *TenantUpdateOne

AddRoles adds the "roles" edges to the Role entity.

func (*TenantUpdateOne) AddUpdatedBy

func (tuo *TenantUpdateOne) AddUpdatedBy(i int64) *TenantUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*TenantUpdateOne) AddUserRoleIDs

func (tuo *TenantUpdateOne) AddUserRoleIDs(ids ...int64) *TenantUpdateOne

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*TenantUpdateOne) AddUserRoles

func (tuo *TenantUpdateOne) AddUserRoles(u ...*UserRole) *TenantUpdateOne

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*TenantUpdateOne) AddUserTenantIDs

func (tuo *TenantUpdateOne) AddUserTenantIDs(ids ...int) *TenantUpdateOne

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*TenantUpdateOne) AddUserTenants

func (tuo *TenantUpdateOne) AddUserTenants(u ...*UserTenant) *TenantUpdateOne

AddUserTenants adds the "user_tenants" edges to the UserTenant entity.

func (*TenantUpdateOne) ClearChildren

func (tuo *TenantUpdateOne) ClearChildren() *TenantUpdateOne

ClearChildren clears all "children" edges to the Tenant entity.

func (*TenantUpdateOne) ClearCreatedBy

func (tuo *TenantUpdateOne) ClearCreatedBy() *TenantUpdateOne

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantUpdateOne) ClearDeletedAt

func (tuo *TenantUpdateOne) ClearDeletedAt() *TenantUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantUpdateOne) ClearDepartments

func (tuo *TenantUpdateOne) ClearDepartments() *TenantUpdateOne

ClearDepartments clears all "departments" edges to the Department entity.

func (*TenantUpdateOne) ClearExpiredAt

func (tuo *TenantUpdateOne) ClearExpiredAt() *TenantUpdateOne

ClearExpiredAt clears the value of the "expired_at" field.

func (*TenantUpdateOne) ClearParent

func (tuo *TenantUpdateOne) ClearParent() *TenantUpdateOne

ClearParent clears the "parent" edge to the Tenant entity.

func (*TenantUpdateOne) ClearParentID

func (tuo *TenantUpdateOne) ClearParentID() *TenantUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*TenantUpdateOne) ClearPath

func (tuo *TenantUpdateOne) ClearPath() *TenantUpdateOne

ClearPath clears the value of the "path" field.

func (*TenantUpdateOne) ClearRoles

func (tuo *TenantUpdateOne) ClearRoles() *TenantUpdateOne

ClearRoles clears all "roles" edges to the Role entity.

func (*TenantUpdateOne) ClearUpdatedBy

func (tuo *TenantUpdateOne) ClearUpdatedBy() *TenantUpdateOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantUpdateOne) ClearUserRoles

func (tuo *TenantUpdateOne) ClearUserRoles() *TenantUpdateOne

ClearUserRoles clears all "user_roles" edges to the UserRole entity.

func (*TenantUpdateOne) ClearUserTenants

func (tuo *TenantUpdateOne) ClearUserTenants() *TenantUpdateOne

ClearUserTenants clears all "user_tenants" edges to the UserTenant 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) RemoveChildIDs

func (tuo *TenantUpdateOne) RemoveChildIDs(ids ...int64) *TenantUpdateOne

RemoveChildIDs removes the "children" edge to Tenant entities by IDs.

func (*TenantUpdateOne) RemoveChildren

func (tuo *TenantUpdateOne) RemoveChildren(t ...*Tenant) *TenantUpdateOne

RemoveChildren removes "children" edges to Tenant entities.

func (*TenantUpdateOne) RemoveDepartmentIDs

func (tuo *TenantUpdateOne) RemoveDepartmentIDs(ids ...int64) *TenantUpdateOne

RemoveDepartmentIDs removes the "departments" edge to Department entities by IDs.

func (*TenantUpdateOne) RemoveDepartments

func (tuo *TenantUpdateOne) RemoveDepartments(d ...*Department) *TenantUpdateOne

RemoveDepartments removes "departments" edges to Department entities.

func (*TenantUpdateOne) RemoveRoleIDs

func (tuo *TenantUpdateOne) RemoveRoleIDs(ids ...int64) *TenantUpdateOne

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*TenantUpdateOne) RemoveRoles

func (tuo *TenantUpdateOne) RemoveRoles(r ...*Role) *TenantUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*TenantUpdateOne) RemoveUserRoleIDs

func (tuo *TenantUpdateOne) RemoveUserRoleIDs(ids ...int64) *TenantUpdateOne

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*TenantUpdateOne) RemoveUserRoles

func (tuo *TenantUpdateOne) RemoveUserRoles(u ...*UserRole) *TenantUpdateOne

RemoveUserRoles removes "user_roles" edges to UserRole entities.

func (*TenantUpdateOne) RemoveUserTenantIDs

func (tuo *TenantUpdateOne) RemoveUserTenantIDs(ids ...int) *TenantUpdateOne

RemoveUserTenantIDs removes the "user_tenants" edge to UserTenant entities by IDs.

func (*TenantUpdateOne) RemoveUserTenants

func (tuo *TenantUpdateOne) RemoveUserTenants(u ...*UserTenant) *TenantUpdateOne

RemoveUserTenants removes "user_tenants" edges to UserTenant 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) SetAttributes

func (tuo *TenantUpdateOne) SetAttributes(m map[string]interface{}) *TenantUpdateOne

SetAttributes sets the "attributes" field.

func (*TenantUpdateOne) SetCreatedBy

func (tuo *TenantUpdateOne) SetCreatedBy(i int64) *TenantUpdateOne

SetCreatedBy sets the "created_by" field.

func (*TenantUpdateOne) SetDeletedAt

func (tuo *TenantUpdateOne) SetDeletedAt(t time.Time) *TenantUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*TenantUpdateOne) SetExpiredAt

func (tuo *TenantUpdateOne) SetExpiredAt(t time.Time) *TenantUpdateOne

SetExpiredAt sets the "expired_at" field.

func (*TenantUpdateOne) SetLevel

func (tuo *TenantUpdateOne) SetLevel(i int32) *TenantUpdateOne

SetLevel sets the "level" field.

func (*TenantUpdateOne) SetName

func (tuo *TenantUpdateOne) SetName(s string) *TenantUpdateOne

SetName sets the "name" field.

func (*TenantUpdateOne) SetNillableCreatedBy

func (tuo *TenantUpdateOne) SetNillableCreatedBy(i *int64) *TenantUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableDeletedAt

func (tuo *TenantUpdateOne) SetNillableDeletedAt(t *time.Time) *TenantUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableExpiredAt

func (tuo *TenantUpdateOne) SetNillableExpiredAt(t *time.Time) *TenantUpdateOne

SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableLevel

func (tuo *TenantUpdateOne) SetNillableLevel(i *int32) *TenantUpdateOne

SetNillableLevel sets the "level" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableName

func (tuo *TenantUpdateOne) SetNillableName(s *string) *TenantUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableOwnerID

func (tuo *TenantUpdateOne) SetNillableOwnerID(i *int64) *TenantUpdateOne

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableParentID

func (tuo *TenantUpdateOne) SetNillableParentID(i *int64) *TenantUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TenantUpdateOne) SetNillablePath

func (tuo *TenantUpdateOne) SetNillablePath(s *string) *TenantUpdateOne

SetNillablePath sets the "path" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableStatus

func (tuo *TenantUpdateOne) SetNillableStatus(t *tenant.Status) *TenantUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableType

func (tuo *TenantUpdateOne) SetNillableType(t *tenant.Type) *TenantUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*TenantUpdateOne) SetNillableUpdatedBy

func (tuo *TenantUpdateOne) SetNillableUpdatedBy(i *int64) *TenantUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*TenantUpdateOne) SetOwnerID

func (tuo *TenantUpdateOne) SetOwnerID(i int64) *TenantUpdateOne

SetOwnerID sets the "owner_id" field.

func (*TenantUpdateOne) SetParent

func (tuo *TenantUpdateOne) SetParent(t *Tenant) *TenantUpdateOne

SetParent sets the "parent" edge to the Tenant entity.

func (*TenantUpdateOne) SetParentID

func (tuo *TenantUpdateOne) SetParentID(i int64) *TenantUpdateOne

SetParentID sets the "parent_id" field.

func (*TenantUpdateOne) SetPath

func (tuo *TenantUpdateOne) SetPath(s string) *TenantUpdateOne

SetPath sets the "path" field.

func (*TenantUpdateOne) SetStatus

func (tuo *TenantUpdateOne) SetStatus(t tenant.Status) *TenantUpdateOne

SetStatus sets the "status" field.

func (*TenantUpdateOne) SetType

func (tuo *TenantUpdateOne) SetType(t tenant.Type) *TenantUpdateOne

SetType sets the "type" field.

func (*TenantUpdateOne) SetUpdatedAt

func (tuo *TenantUpdateOne) SetUpdatedAt(t time.Time) *TenantUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpdateOne) SetUpdatedBy

func (tuo *TenantUpdateOne) SetUpdatedBy(i int64) *TenantUpdateOne

SetUpdatedBy sets the "updated_by" field.

func (*TenantUpdateOne) Where

func (tuo *TenantUpdateOne) Where(ps ...predicate.Tenant) *TenantUpdateOne

Where appends a list predicates to the TenantUpdate builder.

type TenantUpsert

type TenantUpsert struct {
	*sql.UpdateSet
}

TenantUpsert is the "OnConflict" setter.

func (*TenantUpsert) AddCreatedBy

func (u *TenantUpsert) AddCreatedBy(v int64) *TenantUpsert

AddCreatedBy adds v to the "created_by" field.

func (*TenantUpsert) AddLevel

func (u *TenantUpsert) AddLevel(v int32) *TenantUpsert

AddLevel adds v to the "level" field.

func (*TenantUpsert) AddOwnerID

func (u *TenantUpsert) AddOwnerID(v int64) *TenantUpsert

AddOwnerID adds v to the "owner_id" field.

func (*TenantUpsert) AddUpdatedBy

func (u *TenantUpsert) AddUpdatedBy(v int64) *TenantUpsert

AddUpdatedBy adds v to the "updated_by" field.

func (*TenantUpsert) ClearCreatedBy

func (u *TenantUpsert) ClearCreatedBy() *TenantUpsert

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantUpsert) ClearDeletedAt

func (u *TenantUpsert) ClearDeletedAt() *TenantUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantUpsert) ClearExpiredAt

func (u *TenantUpsert) ClearExpiredAt() *TenantUpsert

ClearExpiredAt clears the value of the "expired_at" field.

func (*TenantUpsert) ClearParentID

func (u *TenantUpsert) ClearParentID() *TenantUpsert

ClearParentID clears the value of the "parent_id" field.

func (*TenantUpsert) ClearPath

func (u *TenantUpsert) ClearPath() *TenantUpsert

ClearPath clears the value of the "path" field.

func (*TenantUpsert) ClearUpdatedBy

func (u *TenantUpsert) ClearUpdatedBy() *TenantUpsert

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantUpsert) SetAttributes

func (u *TenantUpsert) SetAttributes(v map[string]interface{}) *TenantUpsert

SetAttributes sets the "attributes" field.

func (*TenantUpsert) SetCreatedBy

func (u *TenantUpsert) SetCreatedBy(v int64) *TenantUpsert

SetCreatedBy sets the "created_by" field.

func (*TenantUpsert) SetDeletedAt

func (u *TenantUpsert) SetDeletedAt(v time.Time) *TenantUpsert

SetDeletedAt sets the "deleted_at" field.

func (*TenantUpsert) SetExpiredAt

func (u *TenantUpsert) SetExpiredAt(v time.Time) *TenantUpsert

SetExpiredAt sets the "expired_at" field.

func (*TenantUpsert) SetLevel

func (u *TenantUpsert) SetLevel(v int32) *TenantUpsert

SetLevel sets the "level" field.

func (*TenantUpsert) SetName

func (u *TenantUpsert) SetName(v string) *TenantUpsert

SetName sets the "name" field.

func (*TenantUpsert) SetOwnerID

func (u *TenantUpsert) SetOwnerID(v int64) *TenantUpsert

SetOwnerID sets the "owner_id" field.

func (*TenantUpsert) SetParentID

func (u *TenantUpsert) SetParentID(v int64) *TenantUpsert

SetParentID sets the "parent_id" field.

func (*TenantUpsert) SetPath

func (u *TenantUpsert) SetPath(v string) *TenantUpsert

SetPath sets the "path" field.

func (*TenantUpsert) SetStatus

func (u *TenantUpsert) SetStatus(v tenant.Status) *TenantUpsert

SetStatus sets the "status" field.

func (*TenantUpsert) SetType

func (u *TenantUpsert) SetType(v tenant.Type) *TenantUpsert

SetType sets the "type" field.

func (*TenantUpsert) SetUpdatedAt

func (u *TenantUpsert) SetUpdatedAt(v time.Time) *TenantUpsert

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpsert) SetUpdatedBy

func (u *TenantUpsert) SetUpdatedBy(v int64) *TenantUpsert

SetUpdatedBy sets the "updated_by" field.

func (*TenantUpsert) UpdateAttributes

func (u *TenantUpsert) UpdateAttributes() *TenantUpsert

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*TenantUpsert) UpdateCreatedBy

func (u *TenantUpsert) UpdateCreatedBy() *TenantUpsert

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*TenantUpsert) UpdateDeletedAt

func (u *TenantUpsert) UpdateDeletedAt() *TenantUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TenantUpsert) UpdateExpiredAt

func (u *TenantUpsert) UpdateExpiredAt() *TenantUpsert

UpdateExpiredAt sets the "expired_at" field to the value that was provided on create.

func (*TenantUpsert) UpdateLevel

func (u *TenantUpsert) UpdateLevel() *TenantUpsert

UpdateLevel sets the "level" field to the value that was provided on create.

func (*TenantUpsert) UpdateName

func (u *TenantUpsert) UpdateName() *TenantUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsert) UpdateOwnerID

func (u *TenantUpsert) UpdateOwnerID() *TenantUpsert

UpdateOwnerID sets the "owner_id" field to the value that was provided on create.

func (*TenantUpsert) UpdateParentID

func (u *TenantUpsert) UpdateParentID() *TenantUpsert

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TenantUpsert) UpdatePath

func (u *TenantUpsert) UpdatePath() *TenantUpsert

UpdatePath sets the "path" field to the value that was provided on create.

func (*TenantUpsert) UpdateStatus

func (u *TenantUpsert) UpdateStatus() *TenantUpsert

UpdateStatus sets the "status" field to the value that was provided on create.

func (*TenantUpsert) UpdateType

func (u *TenantUpsert) UpdateType() *TenantUpsert

UpdateType sets the "type" field to the value that was provided on create.

func (*TenantUpsert) UpdateUpdatedAt

func (u *TenantUpsert) UpdateUpdatedAt() *TenantUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*TenantUpsert) UpdateUpdatedBy

func (u *TenantUpsert) UpdateUpdatedBy() *TenantUpsert

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type TenantUpsertBulk

type TenantUpsertBulk struct {
	// contains filtered or unexported fields
}

TenantUpsertBulk is the builder for "upsert"-ing a bulk of Tenant nodes.

func (*TenantUpsertBulk) AddCreatedBy

func (u *TenantUpsertBulk) AddCreatedBy(v int64) *TenantUpsertBulk

AddCreatedBy adds v to the "created_by" field.

func (*TenantUpsertBulk) AddLevel

func (u *TenantUpsertBulk) AddLevel(v int32) *TenantUpsertBulk

AddLevel adds v to the "level" field.

func (*TenantUpsertBulk) AddOwnerID

func (u *TenantUpsertBulk) AddOwnerID(v int64) *TenantUpsertBulk

AddOwnerID adds v to the "owner_id" field.

func (*TenantUpsertBulk) AddUpdatedBy

func (u *TenantUpsertBulk) AddUpdatedBy(v int64) *TenantUpsertBulk

AddUpdatedBy adds v to the "updated_by" field.

func (*TenantUpsertBulk) ClearCreatedBy

func (u *TenantUpsertBulk) ClearCreatedBy() *TenantUpsertBulk

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantUpsertBulk) ClearDeletedAt

func (u *TenantUpsertBulk) ClearDeletedAt() *TenantUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantUpsertBulk) ClearExpiredAt

func (u *TenantUpsertBulk) ClearExpiredAt() *TenantUpsertBulk

ClearExpiredAt clears the value of the "expired_at" field.

func (*TenantUpsertBulk) ClearParentID

func (u *TenantUpsertBulk) ClearParentID() *TenantUpsertBulk

ClearParentID clears the value of the "parent_id" field.

func (*TenantUpsertBulk) ClearPath

func (u *TenantUpsertBulk) ClearPath() *TenantUpsertBulk

ClearPath clears the value of the "path" field.

func (*TenantUpsertBulk) ClearUpdatedBy

func (u *TenantUpsertBulk) ClearUpdatedBy() *TenantUpsertBulk

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantUpsertBulk) DoNothing

func (u *TenantUpsertBulk) DoNothing() *TenantUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantUpsertBulk) Exec

func (u *TenantUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpsertBulk) ExecX

func (u *TenantUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantUpsertBulk) Ignore

func (u *TenantUpsertBulk) Ignore() *TenantUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TenantUpsertBulk) SetAttributes

func (u *TenantUpsertBulk) SetAttributes(v map[string]interface{}) *TenantUpsertBulk

SetAttributes sets the "attributes" field.

func (*TenantUpsertBulk) SetCreatedBy

func (u *TenantUpsertBulk) SetCreatedBy(v int64) *TenantUpsertBulk

SetCreatedBy sets the "created_by" field.

func (*TenantUpsertBulk) SetDeletedAt

func (u *TenantUpsertBulk) SetDeletedAt(v time.Time) *TenantUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*TenantUpsertBulk) SetExpiredAt

func (u *TenantUpsertBulk) SetExpiredAt(v time.Time) *TenantUpsertBulk

SetExpiredAt sets the "expired_at" field.

func (*TenantUpsertBulk) SetLevel

func (u *TenantUpsertBulk) SetLevel(v int32) *TenantUpsertBulk

SetLevel sets the "level" field.

func (*TenantUpsertBulk) SetName

func (u *TenantUpsertBulk) SetName(v string) *TenantUpsertBulk

SetName sets the "name" field.

func (*TenantUpsertBulk) SetOwnerID

func (u *TenantUpsertBulk) SetOwnerID(v int64) *TenantUpsertBulk

SetOwnerID sets the "owner_id" field.

func (*TenantUpsertBulk) SetParentID

func (u *TenantUpsertBulk) SetParentID(v int64) *TenantUpsertBulk

SetParentID sets the "parent_id" field.

func (*TenantUpsertBulk) SetPath

func (u *TenantUpsertBulk) SetPath(v string) *TenantUpsertBulk

SetPath sets the "path" field.

func (*TenantUpsertBulk) SetStatus

SetStatus sets the "status" field.

func (*TenantUpsertBulk) SetType

SetType sets the "type" field.

func (*TenantUpsertBulk) SetUpdatedAt

func (u *TenantUpsertBulk) SetUpdatedAt(v time.Time) *TenantUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpsertBulk) SetUpdatedBy

func (u *TenantUpsertBulk) SetUpdatedBy(v int64) *TenantUpsertBulk

SetUpdatedBy sets the "updated_by" field.

func (*TenantUpsertBulk) Update

func (u *TenantUpsertBulk) Update(set func(*TenantUpsert)) *TenantUpsertBulk

Update allows overriding fields `UPDATE` values. See the TenantCreateBulk.OnConflict documentation for more info.

func (*TenantUpsertBulk) UpdateAttributes

func (u *TenantUpsertBulk) UpdateAttributes() *TenantUpsertBulk

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateCreatedBy

func (u *TenantUpsertBulk) UpdateCreatedBy() *TenantUpsertBulk

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateDeletedAt

func (u *TenantUpsertBulk) UpdateDeletedAt() *TenantUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateExpiredAt

func (u *TenantUpsertBulk) UpdateExpiredAt() *TenantUpsertBulk

UpdateExpiredAt sets the "expired_at" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateLevel

func (u *TenantUpsertBulk) UpdateLevel() *TenantUpsertBulk

UpdateLevel sets the "level" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateName

func (u *TenantUpsertBulk) UpdateName() *TenantUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateNewValues

func (u *TenantUpsertBulk) UpdateNewValues() *TenantUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tenant.FieldID)
		}),
	).
	Exec(ctx)

func (*TenantUpsertBulk) UpdateOwnerID

func (u *TenantUpsertBulk) UpdateOwnerID() *TenantUpsertBulk

UpdateOwnerID sets the "owner_id" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateParentID

func (u *TenantUpsertBulk) UpdateParentID() *TenantUpsertBulk

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdatePath

func (u *TenantUpsertBulk) UpdatePath() *TenantUpsertBulk

UpdatePath sets the "path" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateStatus

func (u *TenantUpsertBulk) UpdateStatus() *TenantUpsertBulk

UpdateStatus sets the "status" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateType

func (u *TenantUpsertBulk) UpdateType() *TenantUpsertBulk

UpdateType sets the "type" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateUpdatedAt

func (u *TenantUpsertBulk) UpdateUpdatedAt() *TenantUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*TenantUpsertBulk) UpdateUpdatedBy

func (u *TenantUpsertBulk) UpdateUpdatedBy() *TenantUpsertBulk

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type TenantUpsertOne

type TenantUpsertOne struct {
	// contains filtered or unexported fields
}

TenantUpsertOne is the builder for "upsert"-ing

one Tenant node.

func (*TenantUpsertOne) AddCreatedBy

func (u *TenantUpsertOne) AddCreatedBy(v int64) *TenantUpsertOne

AddCreatedBy adds v to the "created_by" field.

func (*TenantUpsertOne) AddLevel

func (u *TenantUpsertOne) AddLevel(v int32) *TenantUpsertOne

AddLevel adds v to the "level" field.

func (*TenantUpsertOne) AddOwnerID

func (u *TenantUpsertOne) AddOwnerID(v int64) *TenantUpsertOne

AddOwnerID adds v to the "owner_id" field.

func (*TenantUpsertOne) AddUpdatedBy

func (u *TenantUpsertOne) AddUpdatedBy(v int64) *TenantUpsertOne

AddUpdatedBy adds v to the "updated_by" field.

func (*TenantUpsertOne) ClearCreatedBy

func (u *TenantUpsertOne) ClearCreatedBy() *TenantUpsertOne

ClearCreatedBy clears the value of the "created_by" field.

func (*TenantUpsertOne) ClearDeletedAt

func (u *TenantUpsertOne) ClearDeletedAt() *TenantUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TenantUpsertOne) ClearExpiredAt

func (u *TenantUpsertOne) ClearExpiredAt() *TenantUpsertOne

ClearExpiredAt clears the value of the "expired_at" field.

func (*TenantUpsertOne) ClearParentID

func (u *TenantUpsertOne) ClearParentID() *TenantUpsertOne

ClearParentID clears the value of the "parent_id" field.

func (*TenantUpsertOne) ClearPath

func (u *TenantUpsertOne) ClearPath() *TenantUpsertOne

ClearPath clears the value of the "path" field.

func (*TenantUpsertOne) ClearUpdatedBy

func (u *TenantUpsertOne) ClearUpdatedBy() *TenantUpsertOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*TenantUpsertOne) DoNothing

func (u *TenantUpsertOne) DoNothing() *TenantUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TenantUpsertOne) Exec

func (u *TenantUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*TenantUpsertOne) ExecX

func (u *TenantUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TenantUpsertOne) ID

func (u *TenantUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TenantUpsertOne) IDX

func (u *TenantUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*TenantUpsertOne) Ignore

func (u *TenantUpsertOne) Ignore() *TenantUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Tenant.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TenantUpsertOne) SetAttributes

func (u *TenantUpsertOne) SetAttributes(v map[string]interface{}) *TenantUpsertOne

SetAttributes sets the "attributes" field.

func (*TenantUpsertOne) SetCreatedBy

func (u *TenantUpsertOne) SetCreatedBy(v int64) *TenantUpsertOne

SetCreatedBy sets the "created_by" field.

func (*TenantUpsertOne) SetDeletedAt

func (u *TenantUpsertOne) SetDeletedAt(v time.Time) *TenantUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*TenantUpsertOne) SetExpiredAt

func (u *TenantUpsertOne) SetExpiredAt(v time.Time) *TenantUpsertOne

SetExpiredAt sets the "expired_at" field.

func (*TenantUpsertOne) SetLevel

func (u *TenantUpsertOne) SetLevel(v int32) *TenantUpsertOne

SetLevel sets the "level" field.

func (*TenantUpsertOne) SetName

func (u *TenantUpsertOne) SetName(v string) *TenantUpsertOne

SetName sets the "name" field.

func (*TenantUpsertOne) SetOwnerID

func (u *TenantUpsertOne) SetOwnerID(v int64) *TenantUpsertOne

SetOwnerID sets the "owner_id" field.

func (*TenantUpsertOne) SetParentID

func (u *TenantUpsertOne) SetParentID(v int64) *TenantUpsertOne

SetParentID sets the "parent_id" field.

func (*TenantUpsertOne) SetPath

func (u *TenantUpsertOne) SetPath(v string) *TenantUpsertOne

SetPath sets the "path" field.

func (*TenantUpsertOne) SetStatus

func (u *TenantUpsertOne) SetStatus(v tenant.Status) *TenantUpsertOne

SetStatus sets the "status" field.

func (*TenantUpsertOne) SetType

func (u *TenantUpsertOne) SetType(v tenant.Type) *TenantUpsertOne

SetType sets the "type" field.

func (*TenantUpsertOne) SetUpdatedAt

func (u *TenantUpsertOne) SetUpdatedAt(v time.Time) *TenantUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*TenantUpsertOne) SetUpdatedBy

func (u *TenantUpsertOne) SetUpdatedBy(v int64) *TenantUpsertOne

SetUpdatedBy sets the "updated_by" field.

func (*TenantUpsertOne) Update

func (u *TenantUpsertOne) Update(set func(*TenantUpsert)) *TenantUpsertOne

Update allows overriding fields `UPDATE` values. See the TenantCreate.OnConflict documentation for more info.

func (*TenantUpsertOne) UpdateAttributes

func (u *TenantUpsertOne) UpdateAttributes() *TenantUpsertOne

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateCreatedBy

func (u *TenantUpsertOne) UpdateCreatedBy() *TenantUpsertOne

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateDeletedAt

func (u *TenantUpsertOne) UpdateDeletedAt() *TenantUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateExpiredAt

func (u *TenantUpsertOne) UpdateExpiredAt() *TenantUpsertOne

UpdateExpiredAt sets the "expired_at" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateLevel

func (u *TenantUpsertOne) UpdateLevel() *TenantUpsertOne

UpdateLevel sets the "level" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateName

func (u *TenantUpsertOne) UpdateName() *TenantUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateNewValues

func (u *TenantUpsertOne) UpdateNewValues() *TenantUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Tenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(tenant.FieldID)
		}),
	).
	Exec(ctx)

func (*TenantUpsertOne) UpdateOwnerID

func (u *TenantUpsertOne) UpdateOwnerID() *TenantUpsertOne

UpdateOwnerID sets the "owner_id" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateParentID

func (u *TenantUpsertOne) UpdateParentID() *TenantUpsertOne

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TenantUpsertOne) UpdatePath

func (u *TenantUpsertOne) UpdatePath() *TenantUpsertOne

UpdatePath sets the "path" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateStatus

func (u *TenantUpsertOne) UpdateStatus() *TenantUpsertOne

UpdateStatus sets the "status" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateType

func (u *TenantUpsertOne) UpdateType() *TenantUpsertOne

UpdateType sets the "type" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateUpdatedAt

func (u *TenantUpsertOne) UpdateUpdatedAt() *TenantUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*TenantUpsertOne) UpdateUpdatedBy

func (u *TenantUpsertOne) UpdateUpdatedBy() *TenantUpsertOne

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

type Tenants

type Tenants []*Tenant

Tenants is a parsable slice of Tenant.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

ent aliases to avoid import conflicts in user's code.

type Traverser

type Traverser = ent.Traverser

ent aliases to avoid import conflicts in user's code.

type Tx

type Tx struct {

	// CasbinRule is the client for interacting with the CasbinRule builders.
	CasbinRule *CasbinRuleClient
	// Department is the client for interacting with the Department builders.
	Department *DepartmentClient
	// 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
	// UserAccount is the client for interacting with the UserAccount builders.
	UserAccount *UserAccountClient
	// UserDepartment is the client for interacting with the UserDepartment builders.
	UserDepartment *UserDepartmentClient
	// UserRole is the client for interacting with the UserRole builders.
	UserRole *UserRoleClient
	// UserTenant is the client for interacting with the UserTenant builders.
	UserTenant *UserTenantClient
	// 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.
	// Primary Key ID
	ID int64 `json:"id,omitempty"`
	// Username of the user
	Username string `json:"username,omitempty"`
	// Email address of the user
	Email *string `json:"email,omitempty"`
	// Phone number of the user
	Phone *string `json:"phone,omitempty"`
	// Password of the user
	Password *string `json:"-"`
	// Status of the user
	Status user.Status `json:"status,omitempty"`
	// Full name of the user
	FullName *string `json:"full_name,omitempty"`
	// User gender
	Gender user.Gender `json:"gender,omitempty"`
	// Avatar URL of the user
	Avatar *string `json:"avatar,omitempty"`
	// Preferred language of the user
	Language string `json:"language,omitempty"`
	// Preferred timezone of the user
	Timezone string `json:"timezone,omitempty"`
	// User who created this record
	CreatedBy *int64 `json:"created_by,omitempty"`
	// User who last updated this record
	UpdatedBy *int64 `json:"updated_by,omitempty"`
	// Creation timestamp of this record
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Last update timestamp of this record
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Timestamp when the record was deleted, if applicable
	DeletedAt *time.Time `json:"deleted_at,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) QueryAccounts

func (u *User) QueryAccounts() *UserAccountQuery

QueryAccounts queries the "accounts" edge of the User entity.

func (*User) QueryUserDepartments

func (u *User) QueryUserDepartments() *UserDepartmentQuery

QueryUserDepartments queries the "user_departments" edge of the User entity.

func (*User) QueryUserRoles

func (u *User) QueryUserRoles() *UserRoleQuery

QueryUserRoles queries the "user_roles" edge of the User entity.

func (*User) QueryUserTenants

func (u *User) QueryUserTenants() *UserTenantQuery

QueryUserTenants queries the "user_tenants" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the User. This includes values selected through modifiers, order, etc.

type UserAccount

type UserAccount struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Reference to SysUser ID
	UserID int64 `json:"user_id,omitempty"`
	// Social media platform (e.g., Twitter, Facebook)
	Platform string `json:"platform,omitempty"`
	// User's account identifier on the platform
	Identifier string `json:"identifier,omitempty"`
	// User's name on the platform
	Name *string `json:"name,omitempty"`
	// Record creation timestamp
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Record last update timestamp
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Soft delete flag, null if not deleted
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserAccountQuery when eager-loading is set.
	Edges UserAccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserAccount is the model entity for the UserAccount schema.

func (*UserAccount) QueryUser

func (ua *UserAccount) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserAccount entity.

func (*UserAccount) String

func (ua *UserAccount) String() string

String implements the fmt.Stringer.

func (*UserAccount) Unwrap

func (ua *UserAccount) Unwrap() *UserAccount

Unwrap unwraps the UserAccount 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 (*UserAccount) Update

func (ua *UserAccount) Update() *UserAccountUpdateOne

Update returns a builder for updating this UserAccount. Note that you need to call UserAccount.Unwrap() before calling this method if this UserAccount was returned from a transaction, and the transaction was committed or rolled back.

func (*UserAccount) Value

func (ua *UserAccount) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserAccount. This includes values selected through modifiers, order, etc.

type UserAccountClient

type UserAccountClient struct {
	// contains filtered or unexported fields
}

UserAccountClient is a client for the UserAccount schema.

func NewUserAccountClient

func NewUserAccountClient(c config) *UserAccountClient

NewUserAccountClient returns a client for the UserAccount from the given config.

func (*UserAccountClient) Create

func (c *UserAccountClient) Create() *UserAccountCreate

Create returns a builder for creating a UserAccount entity.

func (*UserAccountClient) CreateBulk

func (c *UserAccountClient) CreateBulk(builders ...*UserAccountCreate) *UserAccountCreateBulk

CreateBulk returns a builder for creating a bulk of UserAccount entities.

func (*UserAccountClient) Delete

func (c *UserAccountClient) Delete() *UserAccountDelete

Delete returns a delete builder for UserAccount.

func (*UserAccountClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserAccountClient) DeleteOneID

func (c *UserAccountClient) DeleteOneID(id int) *UserAccountDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserAccountClient) Get

func (c *UserAccountClient) Get(ctx context.Context, id int) (*UserAccount, error)

Get returns a UserAccount entity by its id.

func (*UserAccountClient) GetX

func (c *UserAccountClient) GetX(ctx context.Context, id int) *UserAccount

GetX is like Get, but panics if an error occurs.

func (*UserAccountClient) Hooks

func (c *UserAccountClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserAccountClient) Intercept

func (c *UserAccountClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `useraccount.Intercept(f(g(h())))`.

func (*UserAccountClient) Interceptors

func (c *UserAccountClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserAccountClient) MapCreateBulk

func (c *UserAccountClient) MapCreateBulk(slice any, setFunc func(*UserAccountCreate, int)) *UserAccountCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserAccountClient) Query

func (c *UserAccountClient) Query() *UserAccountQuery

Query returns a query builder for UserAccount.

func (*UserAccountClient) QueryUser

func (c *UserAccountClient) QueryUser(ua *UserAccount) *UserQuery

QueryUser queries the user edge of a UserAccount.

func (*UserAccountClient) Update

func (c *UserAccountClient) Update() *UserAccountUpdate

Update returns an update builder for UserAccount.

func (*UserAccountClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserAccountClient) UpdateOneID

func (c *UserAccountClient) UpdateOneID(id int) *UserAccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserAccountClient) Use

func (c *UserAccountClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `useraccount.Hooks(f(g(h())))`.

type UserAccountCreate

type UserAccountCreate struct {
	// contains filtered or unexported fields
}

UserAccountCreate is the builder for creating a UserAccount entity.

func (*UserAccountCreate) Exec

func (uac *UserAccountCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserAccountCreate) ExecX

func (uac *UserAccountCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountCreate) Mutation

func (uac *UserAccountCreate) Mutation() *UserAccountMutation

Mutation returns the UserAccountMutation object of the builder.

func (*UserAccountCreate) OnConflict

func (uac *UserAccountCreate) OnConflict(opts ...sql.ConflictOption) *UserAccountUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserAccount.Create().
	SetUserID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserAccountUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserAccountCreate) OnConflictColumns

func (uac *UserAccountCreate) OnConflictColumns(columns ...string) *UserAccountUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserAccount.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserAccountCreate) Save

func (uac *UserAccountCreate) Save(ctx context.Context) (*UserAccount, error)

Save creates the UserAccount in the database.

func (*UserAccountCreate) SaveX

func (uac *UserAccountCreate) SaveX(ctx context.Context) *UserAccount

SaveX calls Save and panics if Save returns an error.

func (*UserAccountCreate) SetCreatedAt

func (uac *UserAccountCreate) SetCreatedAt(t time.Time) *UserAccountCreate

SetCreatedAt sets the "created_at" field.

func (*UserAccountCreate) SetDeletedAt

func (uac *UserAccountCreate) SetDeletedAt(t time.Time) *UserAccountCreate

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountCreate) SetIdentifier

func (uac *UserAccountCreate) SetIdentifier(s string) *UserAccountCreate

SetIdentifier sets the "identifier" field.

func (*UserAccountCreate) SetName

func (uac *UserAccountCreate) SetName(s string) *UserAccountCreate

SetName sets the "name" field.

func (*UserAccountCreate) SetNillableCreatedAt

func (uac *UserAccountCreate) SetNillableCreatedAt(t *time.Time) *UserAccountCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserAccountCreate) SetNillableDeletedAt

func (uac *UserAccountCreate) SetNillableDeletedAt(t *time.Time) *UserAccountCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserAccountCreate) SetNillableUpdatedAt

func (uac *UserAccountCreate) SetNillableUpdatedAt(t *time.Time) *UserAccountCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserAccountCreate) SetPlatform

func (uac *UserAccountCreate) SetPlatform(s string) *UserAccountCreate

SetPlatform sets the "platform" field.

func (*UserAccountCreate) SetUpdatedAt

func (uac *UserAccountCreate) SetUpdatedAt(t time.Time) *UserAccountCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountCreate) SetUser

func (uac *UserAccountCreate) SetUser(u *User) *UserAccountCreate

SetUser sets the "user" edge to the User entity.

func (*UserAccountCreate) SetUserID

func (uac *UserAccountCreate) SetUserID(i int64) *UserAccountCreate

SetUserID sets the "user_id" field.

type UserAccountCreateBulk

type UserAccountCreateBulk struct {
	// contains filtered or unexported fields
}

UserAccountCreateBulk is the builder for creating many UserAccount entities in bulk.

func (*UserAccountCreateBulk) Exec

func (uacb *UserAccountCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserAccountCreateBulk) ExecX

func (uacb *UserAccountCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserAccount.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserAccountUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserAccountCreateBulk) OnConflictColumns

func (uacb *UserAccountCreateBulk) OnConflictColumns(columns ...string) *UserAccountUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserAccount.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserAccountCreateBulk) Save

func (uacb *UserAccountCreateBulk) Save(ctx context.Context) ([]*UserAccount, error)

Save creates the UserAccount entities in the database.

func (*UserAccountCreateBulk) SaveX

func (uacb *UserAccountCreateBulk) SaveX(ctx context.Context) []*UserAccount

SaveX is like Save, but panics if an error occurs.

type UserAccountDelete

type UserAccountDelete struct {
	// contains filtered or unexported fields
}

UserAccountDelete is the builder for deleting a UserAccount entity.

func (*UserAccountDelete) Exec

func (uad *UserAccountDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserAccountDelete) ExecX

func (uad *UserAccountDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountDelete) Where

Where appends a list predicates to the UserAccountDelete builder.

type UserAccountDeleteOne

type UserAccountDeleteOne struct {
	// contains filtered or unexported fields
}

UserAccountDeleteOne is the builder for deleting a single UserAccount entity.

func (*UserAccountDeleteOne) Exec

func (uado *UserAccountDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserAccountDeleteOne) ExecX

func (uado *UserAccountDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountDeleteOne) Where

Where appends a list predicates to the UserAccountDelete builder.

type UserAccountEdges

type UserAccountEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

UserAccountEdges holds the relations/edges for other nodes in the graph.

func (UserAccountEdges) UserOrErr

func (e UserAccountEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserAccountGroupBy

type UserAccountGroupBy struct {
	// contains filtered or unexported fields
}

UserAccountGroupBy is the group-by builder for UserAccount entities.

func (*UserAccountGroupBy) Aggregate

func (uagb *UserAccountGroupBy) Aggregate(fns ...AggregateFunc) *UserAccountGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserAccountGroupBy) Bool

func (s *UserAccountGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) BoolX

func (s *UserAccountGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserAccountGroupBy) Bools

func (s *UserAccountGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) BoolsX

func (s *UserAccountGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserAccountGroupBy) Float64

func (s *UserAccountGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) Float64X

func (s *UserAccountGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserAccountGroupBy) Float64s

func (s *UserAccountGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) Float64sX

func (s *UserAccountGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserAccountGroupBy) Int

func (s *UserAccountGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) IntX

func (s *UserAccountGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserAccountGroupBy) Ints

func (s *UserAccountGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) IntsX

func (s *UserAccountGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserAccountGroupBy) Scan

func (uagb *UserAccountGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserAccountGroupBy) ScanX

func (s *UserAccountGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserAccountGroupBy) String

func (s *UserAccountGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) StringX

func (s *UserAccountGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserAccountGroupBy) Strings

func (s *UserAccountGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserAccountGroupBy) StringsX

func (s *UserAccountGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserAccountMutation

type UserAccountMutation struct {
	// contains filtered or unexported fields
}

UserAccountMutation represents an operation that mutates the UserAccount nodes in the graph.

func (*UserAccountMutation) AddField

func (m *UserAccountMutation) 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 (*UserAccountMutation) AddedEdges

func (m *UserAccountMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserAccountMutation) AddedField

func (m *UserAccountMutation) 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 (*UserAccountMutation) AddedFields

func (m *UserAccountMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserAccountMutation) AddedIDs

func (m *UserAccountMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserAccountMutation) ClearDeletedAt

func (m *UserAccountMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountMutation) ClearEdge

func (m *UserAccountMutation) 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 (*UserAccountMutation) ClearField

func (m *UserAccountMutation) 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 (*UserAccountMutation) ClearUser

func (m *UserAccountMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserAccountMutation) ClearedEdges

func (m *UserAccountMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserAccountMutation) ClearedFields

func (m *UserAccountMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserAccountMutation) Client

func (m UserAccountMutation) 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 (*UserAccountMutation) CreatedAt

func (m *UserAccountMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserAccountMutation) DeletedAt

func (m *UserAccountMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*UserAccountMutation) DeletedAtCleared

func (m *UserAccountMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*UserAccountMutation) EdgeCleared

func (m *UserAccountMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserAccountMutation) Field

func (m *UserAccountMutation) 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 (*UserAccountMutation) FieldCleared

func (m *UserAccountMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserAccountMutation) Fields

func (m *UserAccountMutation) 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 (*UserAccountMutation) ID

func (m *UserAccountMutation) 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 (*UserAccountMutation) IDs

func (m *UserAccountMutation) 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 (*UserAccountMutation) Identifier

func (m *UserAccountMutation) Identifier() (r string, exists bool)

Identifier returns the value of the "identifier" field in the mutation.

func (*UserAccountMutation) Name

func (m *UserAccountMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserAccountMutation) OldCreatedAt

func (m *UserAccountMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldDeletedAt

func (m *UserAccountMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldField

func (m *UserAccountMutation) 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 (*UserAccountMutation) OldIdentifier

func (m *UserAccountMutation) OldIdentifier(ctx context.Context) (v string, err error)

OldIdentifier returns the old "identifier" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldName

func (m *UserAccountMutation) OldName(ctx context.Context) (v *string, err error)

OldName returns the old "name" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldPlatform

func (m *UserAccountMutation) OldPlatform(ctx context.Context) (v string, err error)

OldPlatform returns the old "platform" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldUpdatedAt

func (m *UserAccountMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) OldUserID

func (m *UserAccountMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the UserAccount entity. If the UserAccount 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 (*UserAccountMutation) Op

func (m *UserAccountMutation) Op() Op

Op returns the operation name.

func (*UserAccountMutation) Platform

func (m *UserAccountMutation) Platform() (r string, exists bool)

Platform returns the value of the "platform" field in the mutation.

func (*UserAccountMutation) RemovedEdges

func (m *UserAccountMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserAccountMutation) RemovedIDs

func (m *UserAccountMutation) 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 (*UserAccountMutation) ResetCreatedAt

func (m *UserAccountMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserAccountMutation) ResetDeletedAt

func (m *UserAccountMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*UserAccountMutation) ResetEdge

func (m *UserAccountMutation) 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 (*UserAccountMutation) ResetField

func (m *UserAccountMutation) 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 (*UserAccountMutation) ResetIdentifier

func (m *UserAccountMutation) ResetIdentifier()

ResetIdentifier resets all changes to the "identifier" field.

func (*UserAccountMutation) ResetName

func (m *UserAccountMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserAccountMutation) ResetPlatform

func (m *UserAccountMutation) ResetPlatform()

ResetPlatform resets all changes to the "platform" field.

func (*UserAccountMutation) ResetUpdatedAt

func (m *UserAccountMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserAccountMutation) ResetUser

func (m *UserAccountMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserAccountMutation) ResetUserID

func (m *UserAccountMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserAccountMutation) SetCreatedAt

func (m *UserAccountMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserAccountMutation) SetDeletedAt

func (m *UserAccountMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountMutation) SetField

func (m *UserAccountMutation) 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 (*UserAccountMutation) SetIdentifier

func (m *UserAccountMutation) SetIdentifier(s string)

SetIdentifier sets the "identifier" field.

func (*UserAccountMutation) SetName

func (m *UserAccountMutation) SetName(s string)

SetName sets the "name" field.

func (*UserAccountMutation) SetOp

func (m *UserAccountMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserAccountMutation) SetPlatform

func (m *UserAccountMutation) SetPlatform(s string)

SetPlatform sets the "platform" field.

func (*UserAccountMutation) SetUpdatedAt

func (m *UserAccountMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountMutation) SetUserID

func (m *UserAccountMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (UserAccountMutation) Tx

func (m UserAccountMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserAccountMutation) Type

func (m *UserAccountMutation) Type() string

Type returns the node type of this mutation (UserAccount).

func (*UserAccountMutation) UpdatedAt

func (m *UserAccountMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserAccountMutation) UserCleared

func (m *UserAccountMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserAccountMutation) UserID

func (m *UserAccountMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserAccountMutation) UserIDs

func (m *UserAccountMutation) UserIDs() (ids []int64)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*UserAccountMutation) Where

func (m *UserAccountMutation) Where(ps ...predicate.UserAccount)

Where appends a list predicates to the UserAccountMutation builder.

func (*UserAccountMutation) WhereP

func (m *UserAccountMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserAccountMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserAccountQuery

type UserAccountQuery struct {
	// contains filtered or unexported fields
}

UserAccountQuery is the builder for querying UserAccount entities.

func (*UserAccountQuery) Aggregate

func (uaq *UserAccountQuery) Aggregate(fns ...AggregateFunc) *UserAccountSelect

Aggregate returns a UserAccountSelect configured with the given aggregations.

func (*UserAccountQuery) All

func (uaq *UserAccountQuery) All(ctx context.Context) ([]*UserAccount, error)

All executes the query and returns a list of UserAccounts.

func (*UserAccountQuery) AllX

func (uaq *UserAccountQuery) AllX(ctx context.Context) []*UserAccount

AllX is like All, but panics if an error occurs.

func (*UserAccountQuery) Clone

func (uaq *UserAccountQuery) Clone() *UserAccountQuery

Clone returns a duplicate of the UserAccountQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserAccountQuery) Count

func (uaq *UserAccountQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserAccountQuery) CountX

func (uaq *UserAccountQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserAccountQuery) Exist

func (uaq *UserAccountQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserAccountQuery) ExistX

func (uaq *UserAccountQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserAccountQuery) First

func (uaq *UserAccountQuery) First(ctx context.Context) (*UserAccount, error)

First returns the first UserAccount entity from the query. Returns a *NotFoundError when no UserAccount was found.

func (*UserAccountQuery) FirstID

func (uaq *UserAccountQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UserAccount ID from the query. Returns a *NotFoundError when no UserAccount ID was found.

func (*UserAccountQuery) FirstIDX

func (uaq *UserAccountQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserAccountQuery) FirstX

func (uaq *UserAccountQuery) FirstX(ctx context.Context) *UserAccount

FirstX is like First, but panics if an error occurs.

func (*UserAccountQuery) ForShare

func (uaq *UserAccountQuery) ForShare(opts ...sql.LockOption) *UserAccountQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserAccountQuery) ForUpdate

func (uaq *UserAccountQuery) ForUpdate(opts ...sql.LockOption) *UserAccountQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserAccountQuery) GroupBy

func (uaq *UserAccountQuery) GroupBy(field string, fields ...string) *UserAccountGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserAccount.Query().
	GroupBy(useraccount.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserAccountQuery) IDs

func (uaq *UserAccountQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of UserAccount IDs.

func (*UserAccountQuery) IDsX

func (uaq *UserAccountQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserAccountQuery) Limit

func (uaq *UserAccountQuery) Limit(limit int) *UserAccountQuery

Limit the number of records to be returned by this query.

func (*UserAccountQuery) Offset

func (uaq *UserAccountQuery) Offset(offset int) *UserAccountQuery

Offset to start from.

func (*UserAccountQuery) Only

func (uaq *UserAccountQuery) Only(ctx context.Context) (*UserAccount, error)

Only returns a single UserAccount entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserAccount entity is found. Returns a *NotFoundError when no UserAccount entities are found.

func (*UserAccountQuery) OnlyID

func (uaq *UserAccountQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UserAccount ID in the query. Returns a *NotSingularError when more than one UserAccount ID is found. Returns a *NotFoundError when no entities are found.

func (*UserAccountQuery) OnlyIDX

func (uaq *UserAccountQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserAccountQuery) OnlyX

func (uaq *UserAccountQuery) OnlyX(ctx context.Context) *UserAccount

OnlyX is like Only, but panics if an error occurs.

func (*UserAccountQuery) Order

Order specifies how the records should be ordered.

func (*UserAccountQuery) QueryUser

func (uaq *UserAccountQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserAccountQuery) Select

func (uaq *UserAccountQuery) Select(fields ...string) *UserAccountSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
}

client.UserAccount.Query().
	Select(useraccount.FieldUserID).
	Scan(ctx, &v)

func (*UserAccountQuery) Unique

func (uaq *UserAccountQuery) Unique(unique bool) *UserAccountQuery

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 (*UserAccountQuery) Where

Where adds a new predicate for the UserAccountQuery builder.

func (*UserAccountQuery) WithUser

func (uaq *UserAccountQuery) WithUser(opts ...func(*UserQuery)) *UserAccountQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type UserAccountSelect

type UserAccountSelect struct {
	*UserAccountQuery
	// contains filtered or unexported fields
}

UserAccountSelect is the builder for selecting fields of UserAccount entities.

func (*UserAccountSelect) Aggregate

func (uas *UserAccountSelect) Aggregate(fns ...AggregateFunc) *UserAccountSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserAccountSelect) Bool

func (s *UserAccountSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) BoolX

func (s *UserAccountSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserAccountSelect) Bools

func (s *UserAccountSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) BoolsX

func (s *UserAccountSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserAccountSelect) Float64

func (s *UserAccountSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) Float64X

func (s *UserAccountSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserAccountSelect) Float64s

func (s *UserAccountSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) Float64sX

func (s *UserAccountSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserAccountSelect) Int

func (s *UserAccountSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) IntX

func (s *UserAccountSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserAccountSelect) Ints

func (s *UserAccountSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) IntsX

func (s *UserAccountSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserAccountSelect) Scan

func (uas *UserAccountSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserAccountSelect) ScanX

func (s *UserAccountSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserAccountSelect) String

func (s *UserAccountSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) StringX

func (s *UserAccountSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserAccountSelect) Strings

func (s *UserAccountSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserAccountSelect) StringsX

func (s *UserAccountSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserAccountUpdate

type UserAccountUpdate struct {
	// contains filtered or unexported fields
}

UserAccountUpdate is the builder for updating UserAccount entities.

func (*UserAccountUpdate) ClearDeletedAt

func (uau *UserAccountUpdate) ClearDeletedAt() *UserAccountUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountUpdate) ClearUser

func (uau *UserAccountUpdate) ClearUser() *UserAccountUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserAccountUpdate) Exec

func (uau *UserAccountUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserAccountUpdate) ExecX

func (uau *UserAccountUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountUpdate) Mutation

func (uau *UserAccountUpdate) Mutation() *UserAccountMutation

Mutation returns the UserAccountMutation object of the builder.

func (*UserAccountUpdate) Save

func (uau *UserAccountUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserAccountUpdate) SaveX

func (uau *UserAccountUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserAccountUpdate) SetCreatedAt

func (uau *UserAccountUpdate) SetCreatedAt(t time.Time) *UserAccountUpdate

SetCreatedAt sets the "created_at" field.

func (*UserAccountUpdate) SetDeletedAt

func (uau *UserAccountUpdate) SetDeletedAt(t time.Time) *UserAccountUpdate

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountUpdate) SetIdentifier

func (uau *UserAccountUpdate) SetIdentifier(s string) *UserAccountUpdate

SetIdentifier sets the "identifier" field.

func (*UserAccountUpdate) SetName

func (uau *UserAccountUpdate) SetName(s string) *UserAccountUpdate

SetName sets the "name" field.

func (*UserAccountUpdate) SetNillableCreatedAt

func (uau *UserAccountUpdate) SetNillableCreatedAt(t *time.Time) *UserAccountUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserAccountUpdate) SetNillableDeletedAt

func (uau *UserAccountUpdate) SetNillableDeletedAt(t *time.Time) *UserAccountUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserAccountUpdate) SetNillableIdentifier

func (uau *UserAccountUpdate) SetNillableIdentifier(s *string) *UserAccountUpdate

SetNillableIdentifier sets the "identifier" field if the given value is not nil.

func (*UserAccountUpdate) SetNillableName

func (uau *UserAccountUpdate) SetNillableName(s *string) *UserAccountUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UserAccountUpdate) SetNillablePlatform

func (uau *UserAccountUpdate) SetNillablePlatform(s *string) *UserAccountUpdate

SetNillablePlatform sets the "platform" field if the given value is not nil.

func (*UserAccountUpdate) SetNillableUserID

func (uau *UserAccountUpdate) SetNillableUserID(i *int64) *UserAccountUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserAccountUpdate) SetPlatform

func (uau *UserAccountUpdate) SetPlatform(s string) *UserAccountUpdate

SetPlatform sets the "platform" field.

func (*UserAccountUpdate) SetUpdatedAt

func (uau *UserAccountUpdate) SetUpdatedAt(t time.Time) *UserAccountUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountUpdate) SetUser

func (uau *UserAccountUpdate) SetUser(u *User) *UserAccountUpdate

SetUser sets the "user" edge to the User entity.

func (*UserAccountUpdate) SetUserID

func (uau *UserAccountUpdate) SetUserID(i int64) *UserAccountUpdate

SetUserID sets the "user_id" field.

func (*UserAccountUpdate) Where

Where appends a list predicates to the UserAccountUpdate builder.

type UserAccountUpdateOne

type UserAccountUpdateOne struct {
	// contains filtered or unexported fields
}

UserAccountUpdateOne is the builder for updating a single UserAccount entity.

func (*UserAccountUpdateOne) ClearDeletedAt

func (uauo *UserAccountUpdateOne) ClearDeletedAt() *UserAccountUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountUpdateOne) ClearUser

func (uauo *UserAccountUpdateOne) ClearUser() *UserAccountUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserAccountUpdateOne) Exec

func (uauo *UserAccountUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserAccountUpdateOne) ExecX

func (uauo *UserAccountUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountUpdateOne) Mutation

func (uauo *UserAccountUpdateOne) Mutation() *UserAccountMutation

Mutation returns the UserAccountMutation object of the builder.

func (*UserAccountUpdateOne) Save

Save executes the query and returns the updated UserAccount entity.

func (*UserAccountUpdateOne) SaveX

func (uauo *UserAccountUpdateOne) SaveX(ctx context.Context) *UserAccount

SaveX is like Save, but panics if an error occurs.

func (*UserAccountUpdateOne) Select

func (uauo *UserAccountUpdateOne) Select(field string, fields ...string) *UserAccountUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserAccountUpdateOne) SetCreatedAt

func (uauo *UserAccountUpdateOne) SetCreatedAt(t time.Time) *UserAccountUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserAccountUpdateOne) SetDeletedAt

func (uauo *UserAccountUpdateOne) SetDeletedAt(t time.Time) *UserAccountUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountUpdateOne) SetIdentifier

func (uauo *UserAccountUpdateOne) SetIdentifier(s string) *UserAccountUpdateOne

SetIdentifier sets the "identifier" field.

func (*UserAccountUpdateOne) SetName

SetName sets the "name" field.

func (*UserAccountUpdateOne) SetNillableCreatedAt

func (uauo *UserAccountUpdateOne) SetNillableCreatedAt(t *time.Time) *UserAccountUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserAccountUpdateOne) SetNillableDeletedAt

func (uauo *UserAccountUpdateOne) SetNillableDeletedAt(t *time.Time) *UserAccountUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserAccountUpdateOne) SetNillableIdentifier

func (uauo *UserAccountUpdateOne) SetNillableIdentifier(s *string) *UserAccountUpdateOne

SetNillableIdentifier sets the "identifier" field if the given value is not nil.

func (*UserAccountUpdateOne) SetNillableName

func (uauo *UserAccountUpdateOne) SetNillableName(s *string) *UserAccountUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UserAccountUpdateOne) SetNillablePlatform

func (uauo *UserAccountUpdateOne) SetNillablePlatform(s *string) *UserAccountUpdateOne

SetNillablePlatform sets the "platform" field if the given value is not nil.

func (*UserAccountUpdateOne) SetNillableUserID

func (uauo *UserAccountUpdateOne) SetNillableUserID(i *int64) *UserAccountUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserAccountUpdateOne) SetPlatform

func (uauo *UserAccountUpdateOne) SetPlatform(s string) *UserAccountUpdateOne

SetPlatform sets the "platform" field.

func (*UserAccountUpdateOne) SetUpdatedAt

func (uauo *UserAccountUpdateOne) SetUpdatedAt(t time.Time) *UserAccountUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountUpdateOne) SetUser

func (uauo *UserAccountUpdateOne) SetUser(u *User) *UserAccountUpdateOne

SetUser sets the "user" edge to the User entity.

func (*UserAccountUpdateOne) SetUserID

func (uauo *UserAccountUpdateOne) SetUserID(i int64) *UserAccountUpdateOne

SetUserID sets the "user_id" field.

func (*UserAccountUpdateOne) Where

Where appends a list predicates to the UserAccountUpdate builder.

type UserAccountUpsert

type UserAccountUpsert struct {
	*sql.UpdateSet
}

UserAccountUpsert is the "OnConflict" setter.

func (*UserAccountUpsert) ClearDeletedAt

func (u *UserAccountUpsert) ClearDeletedAt() *UserAccountUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountUpsert) SetCreatedAt

func (u *UserAccountUpsert) SetCreatedAt(v time.Time) *UserAccountUpsert

SetCreatedAt sets the "created_at" field.

func (*UserAccountUpsert) SetDeletedAt

func (u *UserAccountUpsert) SetDeletedAt(v time.Time) *UserAccountUpsert

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountUpsert) SetIdentifier

func (u *UserAccountUpsert) SetIdentifier(v string) *UserAccountUpsert

SetIdentifier sets the "identifier" field.

func (*UserAccountUpsert) SetName

SetName sets the "name" field.

func (*UserAccountUpsert) SetPlatform

func (u *UserAccountUpsert) SetPlatform(v string) *UserAccountUpsert

SetPlatform sets the "platform" field.

func (*UserAccountUpsert) SetUpdatedAt

func (u *UserAccountUpsert) SetUpdatedAt(v time.Time) *UserAccountUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountUpsert) SetUserID

func (u *UserAccountUpsert) SetUserID(v int64) *UserAccountUpsert

SetUserID sets the "user_id" field.

func (*UserAccountUpsert) UpdateCreatedAt

func (u *UserAccountUpsert) UpdateCreatedAt() *UserAccountUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserAccountUpsert) UpdateDeletedAt

func (u *UserAccountUpsert) UpdateDeletedAt() *UserAccountUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserAccountUpsert) UpdateIdentifier

func (u *UserAccountUpsert) UpdateIdentifier() *UserAccountUpsert

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*UserAccountUpsert) UpdateName

func (u *UserAccountUpsert) UpdateName() *UserAccountUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*UserAccountUpsert) UpdatePlatform

func (u *UserAccountUpsert) UpdatePlatform() *UserAccountUpsert

UpdatePlatform sets the "platform" field to the value that was provided on create.

func (*UserAccountUpsert) UpdateUpdatedAt

func (u *UserAccountUpsert) UpdateUpdatedAt() *UserAccountUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserAccountUpsert) UpdateUserID

func (u *UserAccountUpsert) UpdateUserID() *UserAccountUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserAccountUpsertBulk

type UserAccountUpsertBulk struct {
	// contains filtered or unexported fields
}

UserAccountUpsertBulk is the builder for "upsert"-ing a bulk of UserAccount nodes.

func (*UserAccountUpsertBulk) ClearDeletedAt

func (u *UserAccountUpsertBulk) ClearDeletedAt() *UserAccountUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserAccountUpsertBulk) Exec

Exec executes the query.

func (*UserAccountUpsertBulk) ExecX

func (u *UserAccountUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserAccount.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserAccountUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*UserAccountUpsertBulk) SetDeletedAt

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountUpsertBulk) SetIdentifier

func (u *UserAccountUpsertBulk) SetIdentifier(v string) *UserAccountUpsertBulk

SetIdentifier sets the "identifier" field.

func (*UserAccountUpsertBulk) SetName

SetName sets the "name" field.

func (*UserAccountUpsertBulk) SetPlatform

SetPlatform sets the "platform" field.

func (*UserAccountUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountUpsertBulk) SetUserID

SetUserID sets the "user_id" field.

func (*UserAccountUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the UserAccountCreateBulk.OnConflict documentation for more info.

func (*UserAccountUpsertBulk) UpdateCreatedAt

func (u *UserAccountUpsertBulk) UpdateCreatedAt() *UserAccountUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateDeletedAt

func (u *UserAccountUpsertBulk) UpdateDeletedAt() *UserAccountUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateIdentifier

func (u *UserAccountUpsertBulk) UpdateIdentifier() *UserAccountUpsertBulk

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateName

UpdateName sets the "name" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateNewValues

func (u *UserAccountUpsertBulk) UpdateNewValues() *UserAccountUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserAccount.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserAccountUpsertBulk) UpdatePlatform

func (u *UserAccountUpsertBulk) UpdatePlatform() *UserAccountUpsertBulk

UpdatePlatform sets the "platform" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateUpdatedAt

func (u *UserAccountUpsertBulk) UpdateUpdatedAt() *UserAccountUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserAccountUpsertBulk) UpdateUserID

func (u *UserAccountUpsertBulk) UpdateUserID() *UserAccountUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserAccountUpsertOne

type UserAccountUpsertOne struct {
	// contains filtered or unexported fields
}

UserAccountUpsertOne is the builder for "upsert"-ing

one UserAccount node.

func (*UserAccountUpsertOne) ClearDeletedAt

func (u *UserAccountUpsertOne) ClearDeletedAt() *UserAccountUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserAccountUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserAccountUpsertOne) Exec

Exec executes the query.

func (*UserAccountUpsertOne) ExecX

func (u *UserAccountUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserAccountUpsertOne) ID

func (u *UserAccountUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserAccountUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*UserAccountUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserAccount.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserAccountUpsertOne) SetCreatedAt

func (u *UserAccountUpsertOne) SetCreatedAt(v time.Time) *UserAccountUpsertOne

SetCreatedAt sets the "created_at" field.

func (*UserAccountUpsertOne) SetDeletedAt

func (u *UserAccountUpsertOne) SetDeletedAt(v time.Time) *UserAccountUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*UserAccountUpsertOne) SetIdentifier

func (u *UserAccountUpsertOne) SetIdentifier(v string) *UserAccountUpsertOne

SetIdentifier sets the "identifier" field.

func (*UserAccountUpsertOne) SetName

SetName sets the "name" field.

func (*UserAccountUpsertOne) SetPlatform

SetPlatform sets the "platform" field.

func (*UserAccountUpsertOne) SetUpdatedAt

func (u *UserAccountUpsertOne) SetUpdatedAt(v time.Time) *UserAccountUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserAccountUpsertOne) SetUserID

SetUserID sets the "user_id" field.

func (*UserAccountUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the UserAccountCreate.OnConflict documentation for more info.

func (*UserAccountUpsertOne) UpdateCreatedAt

func (u *UserAccountUpsertOne) UpdateCreatedAt() *UserAccountUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateDeletedAt

func (u *UserAccountUpsertOne) UpdateDeletedAt() *UserAccountUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateIdentifier

func (u *UserAccountUpsertOne) UpdateIdentifier() *UserAccountUpsertOne

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateName

func (u *UserAccountUpsertOne) UpdateName() *UserAccountUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateNewValues

func (u *UserAccountUpsertOne) UpdateNewValues() *UserAccountUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserAccount.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserAccountUpsertOne) UpdatePlatform

func (u *UserAccountUpsertOne) UpdatePlatform() *UserAccountUpsertOne

UpdatePlatform sets the "platform" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateUpdatedAt

func (u *UserAccountUpsertOne) UpdateUpdatedAt() *UserAccountUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserAccountUpsertOne) UpdateUserID

func (u *UserAccountUpsertOne) UpdateUserID() *UserAccountUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserAccounts

type UserAccounts []*UserAccount

UserAccounts is a parsable slice of UserAccount.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int64) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int64) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int64) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAccounts

func (c *UserClient) QueryAccounts(u *User) *UserAccountQuery

QueryAccounts queries the accounts edge of a User.

func (*UserClient) QueryUserDepartments

func (c *UserClient) QueryUserDepartments(u *User) *UserDepartmentQuery

QueryUserDepartments queries the user_departments edge of a User.

func (*UserClient) QueryUserRoles

func (c *UserClient) QueryUserRoles(u *User) *UserRoleQuery

QueryUserRoles queries the user_roles edge of a User.

func (*UserClient) QueryUserTenants

func (c *UserClient) QueryUserTenants(u *User) *UserTenantQuery

QueryUserTenants queries the user_tenants edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAccountIDs

func (uc *UserCreate) AddAccountIDs(ids ...int) *UserCreate

AddAccountIDs adds the "accounts" edge to the UserAccount entity by IDs.

func (*UserCreate) AddAccounts

func (uc *UserCreate) AddAccounts(u ...*UserAccount) *UserCreate

AddAccounts adds the "accounts" edges to the UserAccount entity.

func (*UserCreate) AddUserDepartmentIDs

func (uc *UserCreate) AddUserDepartmentIDs(ids ...int) *UserCreate

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*UserCreate) AddUserDepartments

func (uc *UserCreate) AddUserDepartments(u ...*UserDepartment) *UserCreate

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*UserCreate) AddUserRoleIDs

func (uc *UserCreate) AddUserRoleIDs(ids ...int64) *UserCreate

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*UserCreate) AddUserRoles

func (uc *UserCreate) AddUserRoles(u ...*UserRole) *UserCreate

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*UserCreate) AddUserTenantIDs

func (uc *UserCreate) AddUserTenantIDs(ids ...int) *UserCreate

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*UserCreate) AddUserTenants

func (uc *UserCreate) AddUserTenants(u ...*UserTenant) *UserCreate

AddUserTenants adds the "user_tenants" edges to the UserTenant 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) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.Create().
	SetUsername(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetUsername(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAvatar

func (uc *UserCreate) SetAvatar(s string) *UserCreate

SetAvatar sets the "avatar" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetCreatedBy

func (uc *UserCreate) SetCreatedBy(i int64) *UserCreate

SetCreatedBy sets the "created_by" field.

func (*UserCreate) SetDeletedAt

func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate

SetDeletedAt sets the "deleted_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetFullName

func (uc *UserCreate) SetFullName(s string) *UserCreate

SetFullName sets the "full_name" field.

func (*UserCreate) SetGender

func (uc *UserCreate) SetGender(u user.Gender) *UserCreate

SetGender sets the "gender" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int64) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetLanguage

func (uc *UserCreate) SetLanguage(s string) *UserCreate

SetLanguage sets the "language" field.

func (*UserCreate) SetNillableAvatar

func (uc *UserCreate) SetNillableAvatar(s *string) *UserCreate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedBy

func (uc *UserCreate) SetNillableCreatedBy(i *int64) *UserCreate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserCreate) SetNillableDeletedAt

func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate

SetNillableDeletedAt sets the "deleted_at" 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) SetNillableFullName

func (uc *UserCreate) SetNillableFullName(s *string) *UserCreate

SetNillableFullName sets the "full_name" field if the given value is not nil.

func (*UserCreate) SetNillableGender

func (uc *UserCreate) SetNillableGender(u *user.Gender) *UserCreate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(i *int64) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableLanguage

func (uc *UserCreate) SetNillableLanguage(s *string) *UserCreate

SetNillableLanguage sets the "language" field if the given value is not nil.

func (*UserCreate) SetNillablePassword

func (uc *UserCreate) SetNillablePassword(s *string) *UserCreate

SetNillablePassword sets the "password" 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) SetNillableStatus

func (uc *UserCreate) SetNillableStatus(u *user.Status) *UserCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserCreate) SetNillableTimezone

func (uc *UserCreate) SetNillableTimezone(s *string) *UserCreate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedBy

func (uc *UserCreate) SetNillableUpdatedBy(i *int64) *UserCreate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetPhone

func (uc *UserCreate) SetPhone(s string) *UserCreate

SetPhone sets the "phone" field.

func (*UserCreate) SetStatus

func (uc *UserCreate) SetStatus(u user.Status) *UserCreate

SetStatus sets the "status" field.

func (*UserCreate) SetTimezone

func (uc *UserCreate) SetTimezone(s string) *UserCreate

SetTimezone sets the "timezone" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUpdatedBy

func (uc *UserCreate) SetUpdatedBy(i int64) *UserCreate

SetUpdatedBy sets the "updated_by" field.

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) OnConflict

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetUsername(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserDepartment

type UserDepartment struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// SysUser ID
	UserID int64 `json:"user_id,omitempty"`
	// Department ID
	DeptID int64 `json:"dept_id,omitempty"`
	// Tenant ID
	TenantID int64 `json:"tenant_id,omitempty"`
	// Attributes holds the value of the "attributes" field.
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserDepartmentQuery when eager-loading is set.
	Edges UserDepartmentEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserDepartment is the model entity for the UserDepartment schema.

func (*UserDepartment) QueryDepartment

func (ud *UserDepartment) QueryDepartment() *DepartmentQuery

QueryDepartment queries the "department" edge of the UserDepartment entity.

func (*UserDepartment) QueryUser

func (ud *UserDepartment) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserDepartment entity.

func (*UserDepartment) String

func (ud *UserDepartment) String() string

String implements the fmt.Stringer.

func (*UserDepartment) Unwrap

func (ud *UserDepartment) Unwrap() *UserDepartment

Unwrap unwraps the UserDepartment 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 (*UserDepartment) Update

Update returns a builder for updating this UserDepartment. Note that you need to call UserDepartment.Unwrap() before calling this method if this UserDepartment was returned from a transaction, and the transaction was committed or rolled back.

func (*UserDepartment) Value

func (ud *UserDepartment) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserDepartment. This includes values selected through modifiers, order, etc.

type UserDepartmentClient

type UserDepartmentClient struct {
	// contains filtered or unexported fields
}

UserDepartmentClient is a client for the UserDepartment schema.

func NewUserDepartmentClient

func NewUserDepartmentClient(c config) *UserDepartmentClient

NewUserDepartmentClient returns a client for the UserDepartment from the given config.

func (*UserDepartmentClient) Create

Create returns a builder for creating a UserDepartment entity.

func (*UserDepartmentClient) CreateBulk

CreateBulk returns a builder for creating a bulk of UserDepartment entities.

func (*UserDepartmentClient) Delete

Delete returns a delete builder for UserDepartment.

func (*UserDepartmentClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserDepartmentClient) DeleteOneID

func (c *UserDepartmentClient) DeleteOneID(id int) *UserDepartmentDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserDepartmentClient) Get

Get returns a UserDepartment entity by its id.

func (*UserDepartmentClient) GetX

GetX is like Get, but panics if an error occurs.

func (*UserDepartmentClient) Hooks

func (c *UserDepartmentClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserDepartmentClient) Intercept

func (c *UserDepartmentClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `userdepartment.Intercept(f(g(h())))`.

func (*UserDepartmentClient) Interceptors

func (c *UserDepartmentClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserDepartmentClient) MapCreateBulk

func (c *UserDepartmentClient) MapCreateBulk(slice any, setFunc func(*UserDepartmentCreate, int)) *UserDepartmentCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserDepartmentClient) Query

Query returns a query builder for UserDepartment.

func (*UserDepartmentClient) QueryDepartment

func (c *UserDepartmentClient) QueryDepartment(ud *UserDepartment) *DepartmentQuery

QueryDepartment queries the department edge of a UserDepartment.

func (*UserDepartmentClient) QueryUser

func (c *UserDepartmentClient) QueryUser(ud *UserDepartment) *UserQuery

QueryUser queries the user edge of a UserDepartment.

func (*UserDepartmentClient) Update

Update returns an update builder for UserDepartment.

func (*UserDepartmentClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserDepartmentClient) UpdateOneID

func (c *UserDepartmentClient) UpdateOneID(id int) *UserDepartmentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserDepartmentClient) Use

func (c *UserDepartmentClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `userdepartment.Hooks(f(g(h())))`.

type UserDepartmentCreate

type UserDepartmentCreate struct {
	// contains filtered or unexported fields
}

UserDepartmentCreate is the builder for creating a UserDepartment entity.

func (*UserDepartmentCreate) Exec

func (udc *UserDepartmentCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserDepartmentCreate) ExecX

func (udc *UserDepartmentCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentCreate) Mutation

Mutation returns the UserDepartmentMutation object of the builder.

func (*UserDepartmentCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserDepartment.Create().
	SetUserID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserDepartmentUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserDepartmentCreate) OnConflictColumns

func (udc *UserDepartmentCreate) OnConflictColumns(columns ...string) *UserDepartmentUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserDepartment.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserDepartmentCreate) Save

Save creates the UserDepartment in the database.

func (*UserDepartmentCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*UserDepartmentCreate) SetAttributes

func (udc *UserDepartmentCreate) SetAttributes(m map[string]interface{}) *UserDepartmentCreate

SetAttributes sets the "attributes" field.

func (*UserDepartmentCreate) SetDepartment

func (udc *UserDepartmentCreate) SetDepartment(d *Department) *UserDepartmentCreate

SetDepartment sets the "department" edge to the Department entity.

func (*UserDepartmentCreate) SetDepartmentID

func (udc *UserDepartmentCreate) SetDepartmentID(id int64) *UserDepartmentCreate

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*UserDepartmentCreate) SetDeptID

func (udc *UserDepartmentCreate) SetDeptID(i int64) *UserDepartmentCreate

SetDeptID sets the "dept_id" field.

func (*UserDepartmentCreate) SetTenantID

func (udc *UserDepartmentCreate) SetTenantID(i int64) *UserDepartmentCreate

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentCreate) SetUser

SetUser sets the "user" edge to the User entity.

func (*UserDepartmentCreate) SetUserID

func (udc *UserDepartmentCreate) SetUserID(i int64) *UserDepartmentCreate

SetUserID sets the "user_id" field.

type UserDepartmentCreateBulk

type UserDepartmentCreateBulk struct {
	// contains filtered or unexported fields
}

UserDepartmentCreateBulk is the builder for creating many UserDepartment entities in bulk.

func (*UserDepartmentCreateBulk) Exec

Exec executes the query.

func (*UserDepartmentCreateBulk) ExecX

func (udcb *UserDepartmentCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserDepartment.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserDepartmentUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserDepartmentCreateBulk) OnConflictColumns

func (udcb *UserDepartmentCreateBulk) OnConflictColumns(columns ...string) *UserDepartmentUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserDepartment.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserDepartmentCreateBulk) Save

Save creates the UserDepartment entities in the database.

func (*UserDepartmentCreateBulk) SaveX

SaveX is like Save, but panics if an error occurs.

type UserDepartmentDelete

type UserDepartmentDelete struct {
	// contains filtered or unexported fields
}

UserDepartmentDelete is the builder for deleting a UserDepartment entity.

func (*UserDepartmentDelete) Exec

func (udd *UserDepartmentDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDepartmentDelete) ExecX

func (udd *UserDepartmentDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentDelete) Where

Where appends a list predicates to the UserDepartmentDelete builder.

type UserDepartmentDeleteOne

type UserDepartmentDeleteOne struct {
	// contains filtered or unexported fields
}

UserDepartmentDeleteOne is the builder for deleting a single UserDepartment entity.

func (*UserDepartmentDeleteOne) Exec

func (uddo *UserDepartmentDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDepartmentDeleteOne) ExecX

func (uddo *UserDepartmentDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentDeleteOne) Where

Where appends a list predicates to the UserDepartmentDelete builder.

type UserDepartmentEdges

type UserDepartmentEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Department holds the value of the department edge.
	Department *Department `json:"department,omitempty"`
	// contains filtered or unexported fields
}

UserDepartmentEdges holds the relations/edges for other nodes in the graph.

func (UserDepartmentEdges) DepartmentOrErr

func (e UserDepartmentEdges) DepartmentOrErr() (*Department, error)

DepartmentOrErr returns the Department value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserDepartmentEdges) UserOrErr

func (e UserDepartmentEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserDepartmentGroupBy

type UserDepartmentGroupBy struct {
	// contains filtered or unexported fields
}

UserDepartmentGroupBy is the group-by builder for UserDepartment entities.

func (*UserDepartmentGroupBy) Aggregate

Aggregate adds the given aggregation functions to the group-by query.

func (*UserDepartmentGroupBy) Bool

func (s *UserDepartmentGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) BoolX

func (s *UserDepartmentGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserDepartmentGroupBy) Bools

func (s *UserDepartmentGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) BoolsX

func (s *UserDepartmentGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserDepartmentGroupBy) Float64

func (s *UserDepartmentGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) Float64X

func (s *UserDepartmentGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserDepartmentGroupBy) Float64s

func (s *UserDepartmentGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) Float64sX

func (s *UserDepartmentGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserDepartmentGroupBy) Int

func (s *UserDepartmentGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) IntX

func (s *UserDepartmentGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserDepartmentGroupBy) Ints

func (s *UserDepartmentGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) IntsX

func (s *UserDepartmentGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserDepartmentGroupBy) Scan

func (udgb *UserDepartmentGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserDepartmentGroupBy) ScanX

func (s *UserDepartmentGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserDepartmentGroupBy) String

func (s *UserDepartmentGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) StringX

func (s *UserDepartmentGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserDepartmentGroupBy) Strings

func (s *UserDepartmentGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserDepartmentGroupBy) StringsX

func (s *UserDepartmentGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserDepartmentMutation

type UserDepartmentMutation struct {
	// contains filtered or unexported fields
}

UserDepartmentMutation represents an operation that mutates the UserDepartment nodes in the graph.

func (*UserDepartmentMutation) AddField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) AddTenantID

func (m *UserDepartmentMutation) AddTenantID(i int64)

AddTenantID adds i to the "tenant_id" field.

func (*UserDepartmentMutation) AddedEdges

func (m *UserDepartmentMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserDepartmentMutation) AddedField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) AddedFields

func (m *UserDepartmentMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserDepartmentMutation) AddedIDs

func (m *UserDepartmentMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserDepartmentMutation) AddedTenantID

func (m *UserDepartmentMutation) AddedTenantID() (r int64, exists bool)

AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.

func (*UserDepartmentMutation) Attributes

func (m *UserDepartmentMutation) Attributes() (r map[string]interface{}, exists bool)

Attributes returns the value of the "attributes" field in the mutation.

func (*UserDepartmentMutation) ClearDepartment

func (m *UserDepartmentMutation) ClearDepartment()

ClearDepartment clears the "department" edge to the Department entity.

func (*UserDepartmentMutation) ClearEdge

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ClearField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ClearUser

func (m *UserDepartmentMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserDepartmentMutation) ClearedEdges

func (m *UserDepartmentMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserDepartmentMutation) ClearedFields

func (m *UserDepartmentMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserDepartmentMutation) Client

func (m UserDepartmentMutation) 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 (*UserDepartmentMutation) DepartmentCleared

func (m *UserDepartmentMutation) DepartmentCleared() bool

DepartmentCleared reports if the "department" edge to the Department entity was cleared.

func (*UserDepartmentMutation) DepartmentID

func (m *UserDepartmentMutation) DepartmentID() (id int64, exists bool)

DepartmentID returns the "department" edge ID in the mutation.

func (*UserDepartmentMutation) DepartmentIDs

func (m *UserDepartmentMutation) DepartmentIDs() (ids []int64)

DepartmentIDs returns the "department" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use DepartmentID instead. It exists only for internal usage by the builders.

func (*UserDepartmentMutation) DeptID

func (m *UserDepartmentMutation) DeptID() (r int64, exists bool)

DeptID returns the value of the "dept_id" field in the mutation.

func (*UserDepartmentMutation) EdgeCleared

func (m *UserDepartmentMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserDepartmentMutation) Field

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) FieldCleared

func (m *UserDepartmentMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserDepartmentMutation) Fields

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ID

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) IDs

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) OldAttributes

func (m *UserDepartmentMutation) OldAttributes(ctx context.Context) (v map[string]interface{}, err error)

OldAttributes returns the old "attributes" field's value of the UserDepartment entity. If the UserDepartment 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 (*UserDepartmentMutation) OldDeptID

func (m *UserDepartmentMutation) OldDeptID(ctx context.Context) (v int64, err error)

OldDeptID returns the old "dept_id" field's value of the UserDepartment entity. If the UserDepartment 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 (*UserDepartmentMutation) OldField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) OldTenantID

func (m *UserDepartmentMutation) OldTenantID(ctx context.Context) (v int64, err error)

OldTenantID returns the old "tenant_id" field's value of the UserDepartment entity. If the UserDepartment 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 (*UserDepartmentMutation) OldUserID

func (m *UserDepartmentMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the UserDepartment entity. If the UserDepartment 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 (*UserDepartmentMutation) Op

func (m *UserDepartmentMutation) Op() Op

Op returns the operation name.

func (*UserDepartmentMutation) RemovedEdges

func (m *UserDepartmentMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserDepartmentMutation) RemovedIDs

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ResetAttributes

func (m *UserDepartmentMutation) ResetAttributes()

ResetAttributes resets all changes to the "attributes" field.

func (*UserDepartmentMutation) ResetDepartment

func (m *UserDepartmentMutation) ResetDepartment()

ResetDepartment resets all changes to the "department" edge.

func (*UserDepartmentMutation) ResetDeptID

func (m *UserDepartmentMutation) ResetDeptID()

ResetDeptID resets all changes to the "dept_id" field.

func (*UserDepartmentMutation) ResetEdge

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ResetField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) ResetTenantID

func (m *UserDepartmentMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*UserDepartmentMutation) ResetUser

func (m *UserDepartmentMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserDepartmentMutation) ResetUserID

func (m *UserDepartmentMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserDepartmentMutation) SetAttributes

func (m *UserDepartmentMutation) SetAttributes(value map[string]interface{})

SetAttributes sets the "attributes" field.

func (*UserDepartmentMutation) SetDepartmentID

func (m *UserDepartmentMutation) SetDepartmentID(id int64)

SetDepartmentID sets the "department" edge to the Department entity by id.

func (*UserDepartmentMutation) SetDeptID

func (m *UserDepartmentMutation) SetDeptID(i int64)

SetDeptID sets the "dept_id" field.

func (*UserDepartmentMutation) SetField

func (m *UserDepartmentMutation) 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 (*UserDepartmentMutation) SetOp

func (m *UserDepartmentMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserDepartmentMutation) SetTenantID

func (m *UserDepartmentMutation) SetTenantID(i int64)

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentMutation) SetUserID

func (m *UserDepartmentMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*UserDepartmentMutation) TenantID

func (m *UserDepartmentMutation) TenantID() (r int64, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (UserDepartmentMutation) Tx

func (m UserDepartmentMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserDepartmentMutation) Type

func (m *UserDepartmentMutation) Type() string

Type returns the node type of this mutation (UserDepartment).

func (*UserDepartmentMutation) UserCleared

func (m *UserDepartmentMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserDepartmentMutation) UserID

func (m *UserDepartmentMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserDepartmentMutation) UserIDs

func (m *UserDepartmentMutation) UserIDs() (ids []int64)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*UserDepartmentMutation) Where

Where appends a list predicates to the UserDepartmentMutation builder.

func (*UserDepartmentMutation) WhereP

func (m *UserDepartmentMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserDepartmentMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserDepartmentQuery

type UserDepartmentQuery struct {
	// contains filtered or unexported fields
}

UserDepartmentQuery is the builder for querying UserDepartment entities.

func (*UserDepartmentQuery) Aggregate

func (udq *UserDepartmentQuery) Aggregate(fns ...AggregateFunc) *UserDepartmentSelect

Aggregate returns a UserDepartmentSelect configured with the given aggregations.

func (*UserDepartmentQuery) All

All executes the query and returns a list of UserDepartments.

func (*UserDepartmentQuery) AllX

AllX is like All, but panics if an error occurs.

func (*UserDepartmentQuery) Clone

Clone returns a duplicate of the UserDepartmentQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserDepartmentQuery) Count

func (udq *UserDepartmentQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserDepartmentQuery) CountX

func (udq *UserDepartmentQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserDepartmentQuery) Exist

func (udq *UserDepartmentQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserDepartmentQuery) ExistX

func (udq *UserDepartmentQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserDepartmentQuery) First

First returns the first UserDepartment entity from the query. Returns a *NotFoundError when no UserDepartment was found.

func (*UserDepartmentQuery) FirstID

func (udq *UserDepartmentQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UserDepartment ID from the query. Returns a *NotFoundError when no UserDepartment ID was found.

func (*UserDepartmentQuery) FirstIDX

func (udq *UserDepartmentQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserDepartmentQuery) FirstX

FirstX is like First, but panics if an error occurs.

func (*UserDepartmentQuery) ForShare

func (udq *UserDepartmentQuery) ForShare(opts ...sql.LockOption) *UserDepartmentQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserDepartmentQuery) ForUpdate

func (udq *UserDepartmentQuery) ForUpdate(opts ...sql.LockOption) *UserDepartmentQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserDepartmentQuery) GroupBy

func (udq *UserDepartmentQuery) GroupBy(field string, fields ...string) *UserDepartmentGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserDepartment.Query().
	GroupBy(userdepartment.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserDepartmentQuery) IDs

func (udq *UserDepartmentQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of UserDepartment IDs.

func (*UserDepartmentQuery) IDsX

func (udq *UserDepartmentQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserDepartmentQuery) Limit

func (udq *UserDepartmentQuery) Limit(limit int) *UserDepartmentQuery

Limit the number of records to be returned by this query.

func (*UserDepartmentQuery) Offset

func (udq *UserDepartmentQuery) Offset(offset int) *UserDepartmentQuery

Offset to start from.

func (*UserDepartmentQuery) Only

Only returns a single UserDepartment entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserDepartment entity is found. Returns a *NotFoundError when no UserDepartment entities are found.

func (*UserDepartmentQuery) OnlyID

func (udq *UserDepartmentQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UserDepartment ID in the query. Returns a *NotSingularError when more than one UserDepartment ID is found. Returns a *NotFoundError when no entities are found.

func (*UserDepartmentQuery) OnlyIDX

func (udq *UserDepartmentQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserDepartmentQuery) OnlyX

OnlyX is like Only, but panics if an error occurs.

func (*UserDepartmentQuery) Order

Order specifies how the records should be ordered.

func (*UserDepartmentQuery) QueryDepartment

func (udq *UserDepartmentQuery) QueryDepartment() *DepartmentQuery

QueryDepartment chains the current query on the "department" edge.

func (*UserDepartmentQuery) QueryUser

func (udq *UserDepartmentQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserDepartmentQuery) Select

func (udq *UserDepartmentQuery) Select(fields ...string) *UserDepartmentSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
}

client.UserDepartment.Query().
	Select(userdepartment.FieldUserID).
	Scan(ctx, &v)

func (*UserDepartmentQuery) Unique

func (udq *UserDepartmentQuery) Unique(unique bool) *UserDepartmentQuery

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 (*UserDepartmentQuery) Where

Where adds a new predicate for the UserDepartmentQuery builder.

func (*UserDepartmentQuery) WithDepartment

func (udq *UserDepartmentQuery) WithDepartment(opts ...func(*DepartmentQuery)) *UserDepartmentQuery

WithDepartment tells the query-builder to eager-load the nodes that are connected to the "department" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserDepartmentQuery) WithUser

func (udq *UserDepartmentQuery) WithUser(opts ...func(*UserQuery)) *UserDepartmentQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type UserDepartmentSelect

type UserDepartmentSelect struct {
	*UserDepartmentQuery
	// contains filtered or unexported fields
}

UserDepartmentSelect is the builder for selecting fields of UserDepartment entities.

func (*UserDepartmentSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*UserDepartmentSelect) Bool

func (s *UserDepartmentSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) BoolX

func (s *UserDepartmentSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserDepartmentSelect) Bools

func (s *UserDepartmentSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) BoolsX

func (s *UserDepartmentSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserDepartmentSelect) Float64

func (s *UserDepartmentSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) Float64X

func (s *UserDepartmentSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserDepartmentSelect) Float64s

func (s *UserDepartmentSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) Float64sX

func (s *UserDepartmentSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserDepartmentSelect) Int

func (s *UserDepartmentSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) IntX

func (s *UserDepartmentSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserDepartmentSelect) Ints

func (s *UserDepartmentSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) IntsX

func (s *UserDepartmentSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserDepartmentSelect) Scan

func (uds *UserDepartmentSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserDepartmentSelect) ScanX

func (s *UserDepartmentSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserDepartmentSelect) String

func (s *UserDepartmentSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) StringX

func (s *UserDepartmentSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserDepartmentSelect) Strings

func (s *UserDepartmentSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserDepartmentSelect) StringsX

func (s *UserDepartmentSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserDepartmentUpdate

type UserDepartmentUpdate struct {
	// contains filtered or unexported fields
}

UserDepartmentUpdate is the builder for updating UserDepartment entities.

func (*UserDepartmentUpdate) AddTenantID

func (udu *UserDepartmentUpdate) AddTenantID(i int64) *UserDepartmentUpdate

AddTenantID adds i to the "tenant_id" field.

func (*UserDepartmentUpdate) ClearDepartment

func (udu *UserDepartmentUpdate) ClearDepartment() *UserDepartmentUpdate

ClearDepartment clears the "department" edge to the Department entity.

func (*UserDepartmentUpdate) ClearUser

func (udu *UserDepartmentUpdate) ClearUser() *UserDepartmentUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserDepartmentUpdate) Exec

func (udu *UserDepartmentUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserDepartmentUpdate) ExecX

func (udu *UserDepartmentUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentUpdate) Mutation

Mutation returns the UserDepartmentMutation object of the builder.

func (*UserDepartmentUpdate) Save

func (udu *UserDepartmentUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserDepartmentUpdate) SaveX

func (udu *UserDepartmentUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserDepartmentUpdate) SetAttributes

func (udu *UserDepartmentUpdate) SetAttributes(m map[string]interface{}) *UserDepartmentUpdate

SetAttributes sets the "attributes" field.

func (*UserDepartmentUpdate) SetDepartment

func (udu *UserDepartmentUpdate) SetDepartment(d *Department) *UserDepartmentUpdate

SetDepartment sets the "department" edge to the Department entity.

func (*UserDepartmentUpdate) SetDepartmentID

func (udu *UserDepartmentUpdate) SetDepartmentID(id int64) *UserDepartmentUpdate

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*UserDepartmentUpdate) SetDeptID

func (udu *UserDepartmentUpdate) SetDeptID(i int64) *UserDepartmentUpdate

SetDeptID sets the "dept_id" field.

func (*UserDepartmentUpdate) SetNillableDeptID

func (udu *UserDepartmentUpdate) SetNillableDeptID(i *int64) *UserDepartmentUpdate

SetNillableDeptID sets the "dept_id" field if the given value is not nil.

func (*UserDepartmentUpdate) SetNillableTenantID

func (udu *UserDepartmentUpdate) SetNillableTenantID(i *int64) *UserDepartmentUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserDepartmentUpdate) SetNillableUserID

func (udu *UserDepartmentUpdate) SetNillableUserID(i *int64) *UserDepartmentUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserDepartmentUpdate) SetTenantID

func (udu *UserDepartmentUpdate) SetTenantID(i int64) *UserDepartmentUpdate

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentUpdate) SetUser

SetUser sets the "user" edge to the User entity.

func (*UserDepartmentUpdate) SetUserID

func (udu *UserDepartmentUpdate) SetUserID(i int64) *UserDepartmentUpdate

SetUserID sets the "user_id" field.

func (*UserDepartmentUpdate) Where

Where appends a list predicates to the UserDepartmentUpdate builder.

type UserDepartmentUpdateOne

type UserDepartmentUpdateOne struct {
	// contains filtered or unexported fields
}

UserDepartmentUpdateOne is the builder for updating a single UserDepartment entity.

func (*UserDepartmentUpdateOne) AddTenantID

AddTenantID adds i to the "tenant_id" field.

func (*UserDepartmentUpdateOne) ClearDepartment

func (uduo *UserDepartmentUpdateOne) ClearDepartment() *UserDepartmentUpdateOne

ClearDepartment clears the "department" edge to the Department entity.

func (*UserDepartmentUpdateOne) ClearUser

ClearUser clears the "user" edge to the User entity.

func (*UserDepartmentUpdateOne) Exec

func (uduo *UserDepartmentUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserDepartmentUpdateOne) ExecX

func (uduo *UserDepartmentUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentUpdateOne) Mutation

Mutation returns the UserDepartmentMutation object of the builder.

func (*UserDepartmentUpdateOne) Save

Save executes the query and returns the updated UserDepartment entity.

func (*UserDepartmentUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*UserDepartmentUpdateOne) Select

func (uduo *UserDepartmentUpdateOne) Select(field string, fields ...string) *UserDepartmentUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserDepartmentUpdateOne) SetAttributes

func (uduo *UserDepartmentUpdateOne) SetAttributes(m map[string]interface{}) *UserDepartmentUpdateOne

SetAttributes sets the "attributes" field.

func (*UserDepartmentUpdateOne) SetDepartment

SetDepartment sets the "department" edge to the Department entity.

func (*UserDepartmentUpdateOne) SetDepartmentID

func (uduo *UserDepartmentUpdateOne) SetDepartmentID(id int64) *UserDepartmentUpdateOne

SetDepartmentID sets the "department" edge to the Department entity by ID.

func (*UserDepartmentUpdateOne) SetDeptID

SetDeptID sets the "dept_id" field.

func (*UserDepartmentUpdateOne) SetNillableDeptID

func (uduo *UserDepartmentUpdateOne) SetNillableDeptID(i *int64) *UserDepartmentUpdateOne

SetNillableDeptID sets the "dept_id" field if the given value is not nil.

func (*UserDepartmentUpdateOne) SetNillableTenantID

func (uduo *UserDepartmentUpdateOne) SetNillableTenantID(i *int64) *UserDepartmentUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserDepartmentUpdateOne) SetNillableUserID

func (uduo *UserDepartmentUpdateOne) SetNillableUserID(i *int64) *UserDepartmentUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserDepartmentUpdateOne) SetTenantID

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentUpdateOne) SetUser

SetUser sets the "user" edge to the User entity.

func (*UserDepartmentUpdateOne) SetUserID

SetUserID sets the "user_id" field.

func (*UserDepartmentUpdateOne) Where

Where appends a list predicates to the UserDepartmentUpdate builder.

type UserDepartmentUpsert

type UserDepartmentUpsert struct {
	*sql.UpdateSet
}

UserDepartmentUpsert is the "OnConflict" setter.

func (*UserDepartmentUpsert) AddTenantID

func (u *UserDepartmentUpsert) AddTenantID(v int64) *UserDepartmentUpsert

AddTenantID adds v to the "tenant_id" field.

func (*UserDepartmentUpsert) SetAttributes

func (u *UserDepartmentUpsert) SetAttributes(v map[string]interface{}) *UserDepartmentUpsert

SetAttributes sets the "attributes" field.

func (*UserDepartmentUpsert) SetDeptID

SetDeptID sets the "dept_id" field.

func (*UserDepartmentUpsert) SetTenantID

func (u *UserDepartmentUpsert) SetTenantID(v int64) *UserDepartmentUpsert

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentUpsert) SetUserID

SetUserID sets the "user_id" field.

func (*UserDepartmentUpsert) UpdateAttributes

func (u *UserDepartmentUpsert) UpdateAttributes() *UserDepartmentUpsert

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*UserDepartmentUpsert) UpdateDeptID

func (u *UserDepartmentUpsert) UpdateDeptID() *UserDepartmentUpsert

UpdateDeptID sets the "dept_id" field to the value that was provided on create.

func (*UserDepartmentUpsert) UpdateTenantID

func (u *UserDepartmentUpsert) UpdateTenantID() *UserDepartmentUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserDepartmentUpsert) UpdateUserID

func (u *UserDepartmentUpsert) UpdateUserID() *UserDepartmentUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserDepartmentUpsertBulk

type UserDepartmentUpsertBulk struct {
	// contains filtered or unexported fields
}

UserDepartmentUpsertBulk is the builder for "upsert"-ing a bulk of UserDepartment nodes.

func (*UserDepartmentUpsertBulk) AddTenantID

AddTenantID adds v to the "tenant_id" field.

func (*UserDepartmentUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserDepartmentUpsertBulk) Exec

Exec executes the query.

func (*UserDepartmentUpsertBulk) ExecX

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserDepartment.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserDepartmentUpsertBulk) SetAttributes

func (u *UserDepartmentUpsertBulk) SetAttributes(v map[string]interface{}) *UserDepartmentUpsertBulk

SetAttributes sets the "attributes" field.

func (*UserDepartmentUpsertBulk) SetDeptID

SetDeptID sets the "dept_id" field.

func (*UserDepartmentUpsertBulk) SetTenantID

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentUpsertBulk) SetUserID

SetUserID sets the "user_id" field.

func (*UserDepartmentUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the UserDepartmentCreateBulk.OnConflict documentation for more info.

func (*UserDepartmentUpsertBulk) UpdateAttributes

func (u *UserDepartmentUpsertBulk) UpdateAttributes() *UserDepartmentUpsertBulk

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*UserDepartmentUpsertBulk) UpdateDeptID

UpdateDeptID sets the "dept_id" field to the value that was provided on create.

func (*UserDepartmentUpsertBulk) UpdateNewValues

func (u *UserDepartmentUpsertBulk) UpdateNewValues() *UserDepartmentUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserDepartment.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserDepartmentUpsertBulk) UpdateTenantID

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserDepartmentUpsertBulk) UpdateUserID

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserDepartmentUpsertOne

type UserDepartmentUpsertOne struct {
	// contains filtered or unexported fields
}

UserDepartmentUpsertOne is the builder for "upsert"-ing

one UserDepartment node.

func (*UserDepartmentUpsertOne) AddTenantID

AddTenantID adds v to the "tenant_id" field.

func (*UserDepartmentUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserDepartmentUpsertOne) Exec

Exec executes the query.

func (*UserDepartmentUpsertOne) ExecX

func (u *UserDepartmentUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDepartmentUpsertOne) ID

func (u *UserDepartmentUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserDepartmentUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*UserDepartmentUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserDepartment.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserDepartmentUpsertOne) SetAttributes

func (u *UserDepartmentUpsertOne) SetAttributes(v map[string]interface{}) *UserDepartmentUpsertOne

SetAttributes sets the "attributes" field.

func (*UserDepartmentUpsertOne) SetDeptID

SetDeptID sets the "dept_id" field.

func (*UserDepartmentUpsertOne) SetTenantID

SetTenantID sets the "tenant_id" field.

func (*UserDepartmentUpsertOne) SetUserID

SetUserID sets the "user_id" field.

func (*UserDepartmentUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the UserDepartmentCreate.OnConflict documentation for more info.

func (*UserDepartmentUpsertOne) UpdateAttributes

func (u *UserDepartmentUpsertOne) UpdateAttributes() *UserDepartmentUpsertOne

UpdateAttributes sets the "attributes" field to the value that was provided on create.

func (*UserDepartmentUpsertOne) UpdateDeptID

UpdateDeptID sets the "dept_id" field to the value that was provided on create.

func (*UserDepartmentUpsertOne) UpdateNewValues

func (u *UserDepartmentUpsertOne) UpdateNewValues() *UserDepartmentUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserDepartment.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserDepartmentUpsertOne) UpdateTenantID

func (u *UserDepartmentUpsertOne) UpdateTenantID() *UserDepartmentUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserDepartmentUpsertOne) UpdateUserID

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserDepartments

type UserDepartments []*UserDepartment

UserDepartments is a parsable slice of UserDepartment.

type UserEdges

type UserEdges struct {
	// Accounts holds the value of the accounts edge.
	Accounts []*UserAccount `json:"accounts,omitempty"`
	// UserTenants holds the value of the user_tenants edge.
	UserTenants []*UserTenant `json:"user_tenants,omitempty"`
	// UserDepartments holds the value of the user_departments edge.
	UserDepartments []*UserDepartment `json:"user_departments,omitempty"`
	// UserRoles holds the value of the user_roles edge.
	UserRoles []*UserRole `json:"user_roles,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AccountsOrErr

func (e UserEdges) AccountsOrErr() ([]*UserAccount, error)

AccountsOrErr returns the Accounts value or an error if the edge was not loaded in eager-loading.

func (UserEdges) UserDepartmentsOrErr

func (e UserEdges) UserDepartmentsOrErr() ([]*UserDepartment, error)

UserDepartmentsOrErr returns the UserDepartments value or an error if the edge was not loaded in eager-loading.

func (UserEdges) UserRolesOrErr

func (e UserEdges) UserRolesOrErr() ([]*UserRole, error)

UserRolesOrErr returns the UserRoles value or an error if the edge was not loaded in eager-loading.

func (UserEdges) UserTenantsOrErr

func (e UserEdges) UserTenantsOrErr() ([]*UserTenant, error)

UserTenantsOrErr returns the UserTenants 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 (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AccountsCleared

func (m *UserMutation) AccountsCleared() bool

AccountsCleared reports if the "accounts" edge to the UserAccount entity was cleared.

func (*UserMutation) AccountsIDs

func (m *UserMutation) AccountsIDs() (ids []int)

AccountsIDs returns the "accounts" edge IDs in the mutation.

func (*UserMutation) AddAccountIDs

func (m *UserMutation) AddAccountIDs(ids ...int)

AddAccountIDs adds the "accounts" edge to the UserAccount entity by ids.

func (*UserMutation) AddCreatedBy

func (m *UserMutation) AddCreatedBy(i int64)

AddCreatedBy adds i to the "created_by" field.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddUpdatedBy

func (m *UserMutation) AddUpdatedBy(i int64)

AddUpdatedBy adds i to the "updated_by" field.

func (*UserMutation) AddUserDepartmentIDs

func (m *UserMutation) AddUserDepartmentIDs(ids ...int)

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by ids.

func (*UserMutation) AddUserRoleIDs

func (m *UserMutation) AddUserRoleIDs(ids ...int64)

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by ids.

func (*UserMutation) AddUserTenantIDs

func (m *UserMutation) AddUserTenantIDs(ids ...int)

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by ids.

func (*UserMutation) AddedCreatedBy

func (m *UserMutation) AddedCreatedBy() (r int64, exists bool)

AddedCreatedBy returns the value that was added to the "created_by" field in this mutation.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) AddedUpdatedBy

func (m *UserMutation) AddedUpdatedBy() (r int64, exists bool)

AddedUpdatedBy returns the value that was added to the "updated_by" field in this mutation.

func (*UserMutation) Avatar

func (m *UserMutation) Avatar() (r string, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*UserMutation) AvatarCleared

func (m *UserMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*UserMutation) ClearAccounts

func (m *UserMutation) ClearAccounts()

ClearAccounts clears the "accounts" edge to the UserAccount entity.

func (*UserMutation) ClearAvatar

func (m *UserMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UserMutation) ClearCreatedBy

func (m *UserMutation) ClearCreatedBy()

ClearCreatedBy clears the value of the "created_by" field.

func (*UserMutation) ClearDeletedAt

func (m *UserMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) 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) ClearFullName

func (m *UserMutation) ClearFullName()

ClearFullName clears the value of the "full_name" field.

func (*UserMutation) ClearPassword

func (m *UserMutation) ClearPassword()

ClearPassword clears the value of the "password" field.

func (*UserMutation) ClearPhone

func (m *UserMutation) ClearPhone()

ClearPhone clears the value of the "phone" field.

func (*UserMutation) ClearUpdatedBy

func (m *UserMutation) ClearUpdatedBy()

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserMutation) ClearUserDepartments

func (m *UserMutation) ClearUserDepartments()

ClearUserDepartments clears the "user_departments" edge to the UserDepartment entity.

func (*UserMutation) ClearUserRoles

func (m *UserMutation) ClearUserRoles()

ClearUserRoles clears the "user_roles" edge to the UserRole entity.

func (*UserMutation) ClearUserTenants

func (m *UserMutation) ClearUserTenants()

ClearUserTenants clears the "user_tenants" edge to the UserTenant entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) CreatedBy

func (m *UserMutation) CreatedBy() (r int64, exists bool)

CreatedBy returns the value of the "created_by" field in the mutation.

func (*UserMutation) CreatedByCleared

func (m *UserMutation) CreatedByCleared() bool

CreatedByCleared returns if the "created_by" field was cleared in this mutation.

func (*UserMutation) DeletedAt

func (m *UserMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*UserMutation) DeletedAtCleared

func (m *UserMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this 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) FullName

func (m *UserMutation) FullName() (r string, exists bool)

FullName returns the value of the "full_name" field in the mutation.

func (*UserMutation) FullNameCleared

func (m *UserMutation) FullNameCleared() bool

FullNameCleared returns if the "full_name" field was cleared in this mutation.

func (*UserMutation) Gender

func (m *UserMutation) Gender() (r user.Gender, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int64, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) Language

func (m *UserMutation) Language() (r string, exists bool)

Language returns the value of the "language" field in the mutation.

func (*UserMutation) OldAvatar

func (m *UserMutation) OldAvatar(ctx context.Context) (v *string, err error)

OldAvatar returns the old "avatar" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedBy

func (m *UserMutation) OldCreatedBy(ctx context.Context) (v *int64, err error)

OldCreatedBy returns the old "created_by" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldDeletedAt

func (m *UserMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v *string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) 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) OldFullName

func (m *UserMutation) OldFullName(ctx context.Context) (v *string, err error)

OldFullName returns the old "full_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) OldGender

func (m *UserMutation) OldGender(ctx context.Context) (v user.Gender, err error)

OldGender returns the old "gender" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLanguage

func (m *UserMutation) OldLanguage(ctx context.Context) (v string, err error)

OldLanguage returns the old "language" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v *string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) 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 user.Status, 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) OldTimezone

func (m *UserMutation) OldTimezone(ctx context.Context) (v string, err error)

OldTimezone returns the old "timezone" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedBy

func (m *UserMutation) OldUpdatedBy(ctx context.Context) (v *int64, err error)

OldUpdatedBy returns the old "updated_by" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) 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) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) PasswordCleared

func (m *UserMutation) PasswordCleared() bool

PasswordCleared returns if the "password" field was cleared in this 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) RemoveAccountIDs

func (m *UserMutation) RemoveAccountIDs(ids ...int)

RemoveAccountIDs removes the "accounts" edge to the UserAccount entity by IDs.

func (*UserMutation) RemoveUserDepartmentIDs

func (m *UserMutation) RemoveUserDepartmentIDs(ids ...int)

RemoveUserDepartmentIDs removes the "user_departments" edge to the UserDepartment entity by IDs.

func (*UserMutation) RemoveUserRoleIDs

func (m *UserMutation) RemoveUserRoleIDs(ids ...int64)

RemoveUserRoleIDs removes the "user_roles" edge to the UserRole entity by IDs.

func (*UserMutation) RemoveUserTenantIDs

func (m *UserMutation) RemoveUserTenantIDs(ids ...int)

RemoveUserTenantIDs removes the "user_tenants" edge to the UserTenant entity by IDs.

func (*UserMutation) RemovedAccountsIDs

func (m *UserMutation) RemovedAccountsIDs() (ids []int)

RemovedAccounts returns the removed IDs of the "accounts" edge to the UserAccount entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedUserDepartmentsIDs

func (m *UserMutation) RemovedUserDepartmentsIDs() (ids []int)

RemovedUserDepartments returns the removed IDs of the "user_departments" edge to the UserDepartment entity.

func (*UserMutation) RemovedUserRolesIDs

func (m *UserMutation) RemovedUserRolesIDs() (ids []int64)

RemovedUserRoles returns the removed IDs of the "user_roles" edge to the UserRole entity.

func (*UserMutation) RemovedUserTenantsIDs

func (m *UserMutation) RemovedUserTenantsIDs() (ids []int)

RemovedUserTenants returns the removed IDs of the "user_tenants" edge to the UserTenant entity.

func (*UserMutation) ResetAccounts

func (m *UserMutation) ResetAccounts()

ResetAccounts resets all changes to the "accounts" edge.

func (*UserMutation) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetCreatedBy

func (m *UserMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" field.

func (*UserMutation) ResetDeletedAt

func (m *UserMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) 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) ResetFullName

func (m *UserMutation) ResetFullName()

ResetFullName resets all changes to the "full_name" field.

func (*UserMutation) ResetGender

func (m *UserMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*UserMutation) ResetLanguage

func (m *UserMutation) ResetLanguage()

ResetLanguage resets all changes to the "language" field.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPhone

func (m *UserMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*UserMutation) ResetStatus

func (m *UserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*UserMutation) ResetTimezone

func (m *UserMutation) ResetTimezone()

ResetTimezone resets all changes to the "timezone" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUpdatedBy

func (m *UserMutation) ResetUpdatedBy()

ResetUpdatedBy resets all changes to the "updated_by" field.

func (*UserMutation) ResetUserDepartments

func (m *UserMutation) ResetUserDepartments()

ResetUserDepartments resets all changes to the "user_departments" edge.

func (*UserMutation) ResetUserRoles

func (m *UserMutation) ResetUserRoles()

ResetUserRoles resets all changes to the "user_roles" edge.

func (*UserMutation) ResetUserTenants

func (m *UserMutation) ResetUserTenants()

ResetUserTenants resets all changes to the "user_tenants" edge.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetCreatedBy

func (m *UserMutation) SetCreatedBy(i int64)

SetCreatedBy sets the "created_by" field.

func (*UserMutation) SetDeletedAt

func (m *UserMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" 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) SetFullName

func (m *UserMutation) SetFullName(s string)

SetFullName sets the "full_name" field.

func (*UserMutation) SetGender

func (m *UserMutation) SetGender(u user.Gender)

SetGender sets the "gender" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetLanguage

func (m *UserMutation) SetLanguage(s string)

SetLanguage sets the "language" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetPhone

func (m *UserMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*UserMutation) SetStatus

func (m *UserMutation) SetStatus(u user.Status)

SetStatus sets the "status" field.

func (*UserMutation) SetTimezone

func (m *UserMutation) SetTimezone(s string)

SetTimezone sets the "timezone" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUpdatedBy

func (m *UserMutation) SetUpdatedBy(i int64)

SetUpdatedBy sets the "updated_by" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*UserMutation) Status

func (m *UserMutation) Status() (r user.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*UserMutation) Timezone

func (m *UserMutation) Timezone() (r string, exists bool)

Timezone returns the value of the "timezone" field in the mutation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) UpdatedBy

func (m *UserMutation) UpdatedBy() (r int64, exists bool)

UpdatedBy returns the value of the "updated_by" field in the mutation.

func (*UserMutation) UpdatedByCleared

func (m *UserMutation) UpdatedByCleared() bool

UpdatedByCleared returns if the "updated_by" field was cleared in this mutation.

func (*UserMutation) UserDepartmentsCleared

func (m *UserMutation) UserDepartmentsCleared() bool

UserDepartmentsCleared reports if the "user_departments" edge to the UserDepartment entity was cleared.

func (*UserMutation) UserDepartmentsIDs

func (m *UserMutation) UserDepartmentsIDs() (ids []int)

UserDepartmentsIDs returns the "user_departments" edge IDs in the mutation.

func (*UserMutation) UserRolesCleared

func (m *UserMutation) UserRolesCleared() bool

UserRolesCleared reports if the "user_roles" edge to the UserRole entity was cleared.

func (*UserMutation) UserRolesIDs

func (m *UserMutation) UserRolesIDs() (ids []int64)

UserRolesIDs returns the "user_roles" edge IDs in the mutation.

func (*UserMutation) UserTenantsCleared

func (m *UserMutation) UserTenantsCleared() bool

UserTenantsCleared reports if the "user_tenants" edge to the UserTenant entity was cleared.

func (*UserMutation) UserTenantsIDs

func (m *UserMutation) UserTenantsIDs() (ids []int)

UserTenantsIDs returns the "user_tenants" edge IDs in the mutation.

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) ForShare

func (uq *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserQuery) ForUpdate

func (uq *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

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) (ids []int64, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAccounts

func (uq *UserQuery) QueryAccounts() *UserAccountQuery

QueryAccounts chains the current query on the "accounts" edge.

func (*UserQuery) QueryUserDepartments

func (uq *UserQuery) QueryUserDepartments() *UserDepartmentQuery

QueryUserDepartments chains the current query on the "user_departments" edge.

func (*UserQuery) QueryUserRoles

func (uq *UserQuery) QueryUserRoles() *UserRoleQuery

QueryUserRoles chains the current query on the "user_roles" edge.

func (*UserQuery) QueryUserTenants

func (uq *UserQuery) QueryUserTenants() *UserTenantQuery

QueryUserTenants chains the current query on the "user_tenants" 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) WithAccounts

func (uq *UserQuery) WithAccounts(opts ...func(*UserAccountQuery)) *UserQuery

WithAccounts tells the query-builder to eager-load the nodes that are connected to the "accounts" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithUserDepartments

func (uq *UserQuery) WithUserDepartments(opts ...func(*UserDepartmentQuery)) *UserQuery

WithUserDepartments tells the query-builder to eager-load the nodes that are connected to the "user_departments" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithUserRoles

func (uq *UserQuery) WithUserRoles(opts ...func(*UserRoleQuery)) *UserQuery

WithUserRoles tells the query-builder to eager-load the nodes that are connected to the "user_roles" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithUserTenants

func (uq *UserQuery) WithUserTenants(opts ...func(*UserTenantQuery)) *UserQuery

WithUserTenants tells the query-builder to eager-load the nodes that are connected to the "user_tenants" edge. The optional arguments are used to configure the query builder of the edge.

type UserRole

type UserRole struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// 用户ID
	UserID int64 `json:"user_id,omitempty"`
	// 角色ID
	RoleID int64 `json:"role_id,omitempty"`
	// 租户ID
	TenantID *int64 `json:"tenant_id,omitempty"`
	// GrantedAt holds the value of the "granted_at" field.
	GrantedAt time.Time `json:"granted_at,omitempty"`
	// 过期时间,NULL表示永久有效
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserRoleQuery when eager-loading is set.
	Edges UserRoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserRole is the model entity for the UserRole schema.

func (*UserRole) QueryRole

func (ur *UserRole) QueryRole() *RoleQuery

QueryRole queries the "role" edge of the UserRole entity.

func (*UserRole) QueryTenant

func (ur *UserRole) QueryTenant() *TenantQuery

QueryTenant queries the "tenant" edge of the UserRole entity.

func (*UserRole) QueryUser

func (ur *UserRole) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserRole entity.

func (*UserRole) String

func (ur *UserRole) String() string

String implements the fmt.Stringer.

func (*UserRole) Unwrap

func (ur *UserRole) Unwrap() *UserRole

Unwrap unwraps the UserRole entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*UserRole) Update

func (ur *UserRole) Update() *UserRoleUpdateOne

Update returns a builder for updating this UserRole. Note that you need to call UserRole.Unwrap() before calling this method if this UserRole was returned from a transaction, and the transaction was committed or rolled back.

func (*UserRole) Value

func (ur *UserRole) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserRole. This includes values selected through modifiers, order, etc.

type UserRoleClient

type UserRoleClient struct {
	// contains filtered or unexported fields
}

UserRoleClient is a client for the UserRole schema.

func NewUserRoleClient

func NewUserRoleClient(c config) *UserRoleClient

NewUserRoleClient returns a client for the UserRole from the given config.

func (*UserRoleClient) Create

func (c *UserRoleClient) Create() *UserRoleCreate

Create returns a builder for creating a UserRole entity.

func (*UserRoleClient) CreateBulk

func (c *UserRoleClient) CreateBulk(builders ...*UserRoleCreate) *UserRoleCreateBulk

CreateBulk returns a builder for creating a bulk of UserRole entities.

func (*UserRoleClient) Delete

func (c *UserRoleClient) Delete() *UserRoleDelete

Delete returns a delete builder for UserRole.

func (*UserRoleClient) DeleteOne

func (c *UserRoleClient) DeleteOne(ur *UserRole) *UserRoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserRoleClient) DeleteOneID

func (c *UserRoleClient) DeleteOneID(id int64) *UserRoleDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserRoleClient) Get

func (c *UserRoleClient) Get(ctx context.Context, id int64) (*UserRole, error)

Get returns a UserRole entity by its id.

func (*UserRoleClient) GetX

func (c *UserRoleClient) GetX(ctx context.Context, id int64) *UserRole

GetX is like Get, but panics if an error occurs.

func (*UserRoleClient) Hooks

func (c *UserRoleClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserRoleClient) Intercept

func (c *UserRoleClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `userrole.Intercept(f(g(h())))`.

func (*UserRoleClient) Interceptors

func (c *UserRoleClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserRoleClient) MapCreateBulk

func (c *UserRoleClient) MapCreateBulk(slice any, setFunc func(*UserRoleCreate, int)) *UserRoleCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserRoleClient) Query

func (c *UserRoleClient) Query() *UserRoleQuery

Query returns a query builder for UserRole.

func (*UserRoleClient) QueryRole

func (c *UserRoleClient) QueryRole(ur *UserRole) *RoleQuery

QueryRole queries the role edge of a UserRole.

func (*UserRoleClient) QueryTenant

func (c *UserRoleClient) QueryTenant(ur *UserRole) *TenantQuery

QueryTenant queries the tenant edge of a UserRole.

func (*UserRoleClient) QueryUser

func (c *UserRoleClient) QueryUser(ur *UserRole) *UserQuery

QueryUser queries the user edge of a UserRole.

func (*UserRoleClient) Update

func (c *UserRoleClient) Update() *UserRoleUpdate

Update returns an update builder for UserRole.

func (*UserRoleClient) UpdateOne

func (c *UserRoleClient) UpdateOne(ur *UserRole) *UserRoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserRoleClient) UpdateOneID

func (c *UserRoleClient) UpdateOneID(id int64) *UserRoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserRoleClient) Use

func (c *UserRoleClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `userrole.Hooks(f(g(h())))`.

type UserRoleCreate

type UserRoleCreate struct {
	// contains filtered or unexported fields
}

UserRoleCreate is the builder for creating a UserRole entity.

func (*UserRoleCreate) Exec

func (urc *UserRoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleCreate) ExecX

func (urc *UserRoleCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleCreate) Mutation

func (urc *UserRoleCreate) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleCreate) OnConflict

func (urc *UserRoleCreate) OnConflict(opts ...sql.ConflictOption) *UserRoleUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserRole.Create().
	SetUserID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserRoleUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserRoleCreate) OnConflictColumns

func (urc *UserRoleCreate) OnConflictColumns(columns ...string) *UserRoleUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserRole.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserRoleCreate) Save

func (urc *UserRoleCreate) Save(ctx context.Context) (*UserRole, error)

Save creates the UserRole in the database.

func (*UserRoleCreate) SaveX

func (urc *UserRoleCreate) SaveX(ctx context.Context) *UserRole

SaveX calls Save and panics if Save returns an error.

func (*UserRoleCreate) SetExpiresAt

func (urc *UserRoleCreate) SetExpiresAt(t time.Time) *UserRoleCreate

SetExpiresAt sets the "expires_at" field.

func (*UserRoleCreate) SetGrantedAt

func (urc *UserRoleCreate) SetGrantedAt(t time.Time) *UserRoleCreate

SetGrantedAt sets the "granted_at" field.

func (*UserRoleCreate) SetID

func (urc *UserRoleCreate) SetID(i int64) *UserRoleCreate

SetID sets the "id" field.

func (*UserRoleCreate) SetNillableExpiresAt

func (urc *UserRoleCreate) SetNillableExpiresAt(t *time.Time) *UserRoleCreate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*UserRoleCreate) SetNillableGrantedAt

func (urc *UserRoleCreate) SetNillableGrantedAt(t *time.Time) *UserRoleCreate

SetNillableGrantedAt sets the "granted_at" field if the given value is not nil.

func (*UserRoleCreate) SetNillableTenantID

func (urc *UserRoleCreate) SetNillableTenantID(i *int64) *UserRoleCreate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserRoleCreate) SetRole

func (urc *UserRoleCreate) SetRole(r *Role) *UserRoleCreate

SetRole sets the "role" edge to the Role entity.

func (*UserRoleCreate) SetRoleID

func (urc *UserRoleCreate) SetRoleID(i int64) *UserRoleCreate

SetRoleID sets the "role_id" field.

func (*UserRoleCreate) SetTenant

func (urc *UserRoleCreate) SetTenant(t *Tenant) *UserRoleCreate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserRoleCreate) SetTenantID

func (urc *UserRoleCreate) SetTenantID(i int64) *UserRoleCreate

SetTenantID sets the "tenant_id" field.

func (*UserRoleCreate) SetUser

func (urc *UserRoleCreate) SetUser(u *User) *UserRoleCreate

SetUser sets the "user" edge to the User entity.

func (*UserRoleCreate) SetUserID

func (urc *UserRoleCreate) SetUserID(i int64) *UserRoleCreate

SetUserID sets the "user_id" field.

type UserRoleCreateBulk

type UserRoleCreateBulk struct {
	// contains filtered or unexported fields
}

UserRoleCreateBulk is the builder for creating many UserRole entities in bulk.

func (*UserRoleCreateBulk) Exec

func (urcb *UserRoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleCreateBulk) ExecX

func (urcb *UserRoleCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleCreateBulk) OnConflict

func (urcb *UserRoleCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserRoleUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserRole.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserRoleUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserRoleCreateBulk) OnConflictColumns

func (urcb *UserRoleCreateBulk) OnConflictColumns(columns ...string) *UserRoleUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserRole.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserRoleCreateBulk) Save

func (urcb *UserRoleCreateBulk) Save(ctx context.Context) ([]*UserRole, error)

Save creates the UserRole entities in the database.

func (*UserRoleCreateBulk) SaveX

func (urcb *UserRoleCreateBulk) SaveX(ctx context.Context) []*UserRole

SaveX is like Save, but panics if an error occurs.

type UserRoleDelete

type UserRoleDelete struct {
	// contains filtered or unexported fields
}

UserRoleDelete is the builder for deleting a UserRole entity.

func (*UserRoleDelete) Exec

func (urd *UserRoleDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserRoleDelete) ExecX

func (urd *UserRoleDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleDelete) Where

func (urd *UserRoleDelete) Where(ps ...predicate.UserRole) *UserRoleDelete

Where appends a list predicates to the UserRoleDelete builder.

type UserRoleDeleteOne

type UserRoleDeleteOne struct {
	// contains filtered or unexported fields
}

UserRoleDeleteOne is the builder for deleting a single UserRole entity.

func (*UserRoleDeleteOne) Exec

func (urdo *UserRoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserRoleDeleteOne) ExecX

func (urdo *UserRoleDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleDeleteOne) Where

Where appends a list predicates to the UserRoleDelete builder.

type UserRoleEdges

type UserRoleEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Role holds the value of the role edge.
	Role *Role `json:"role,omitempty"`
	// Tenant holds the value of the tenant edge.
	Tenant *Tenant `json:"tenant,omitempty"`
	// contains filtered or unexported fields
}

UserRoleEdges holds the relations/edges for other nodes in the graph.

func (UserRoleEdges) RoleOrErr

func (e UserRoleEdges) RoleOrErr() (*Role, error)

RoleOrErr returns the Role value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserRoleEdges) TenantOrErr

func (e UserRoleEdges) TenantOrErr() (*Tenant, error)

TenantOrErr returns the Tenant value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserRoleEdges) UserOrErr

func (e UserRoleEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserRoleGroupBy

type UserRoleGroupBy struct {
	// contains filtered or unexported fields
}

UserRoleGroupBy is the group-by builder for UserRole entities.

func (*UserRoleGroupBy) Aggregate

func (urgb *UserRoleGroupBy) Aggregate(fns ...AggregateFunc) *UserRoleGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserRoleGroupBy) Bool

func (s *UserRoleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) BoolX

func (s *UserRoleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserRoleGroupBy) Bools

func (s *UserRoleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) BoolsX

func (s *UserRoleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserRoleGroupBy) Float64

func (s *UserRoleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) Float64X

func (s *UserRoleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserRoleGroupBy) Float64s

func (s *UserRoleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) Float64sX

func (s *UserRoleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserRoleGroupBy) Int

func (s *UserRoleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) IntX

func (s *UserRoleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserRoleGroupBy) Ints

func (s *UserRoleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) IntsX

func (s *UserRoleGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserRoleGroupBy) Scan

func (urgb *UserRoleGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserRoleGroupBy) ScanX

func (s *UserRoleGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserRoleGroupBy) String

func (s *UserRoleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) StringX

func (s *UserRoleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserRoleGroupBy) Strings

func (s *UserRoleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserRoleGroupBy) StringsX

func (s *UserRoleGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserRoleMutation

type UserRoleMutation struct {
	// contains filtered or unexported fields
}

UserRoleMutation represents an operation that mutates the UserRole nodes in the graph.

func (*UserRoleMutation) AddField

func (m *UserRoleMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserRoleMutation) AddedEdges

func (m *UserRoleMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserRoleMutation) AddedField

func (m *UserRoleMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserRoleMutation) AddedFields

func (m *UserRoleMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserRoleMutation) AddedIDs

func (m *UserRoleMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserRoleMutation) ClearEdge

func (m *UserRoleMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserRoleMutation) ClearExpiresAt

func (m *UserRoleMutation) ClearExpiresAt()

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleMutation) ClearField

func (m *UserRoleMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserRoleMutation) ClearRole

func (m *UserRoleMutation) ClearRole()

ClearRole clears the "role" edge to the Role entity.

func (*UserRoleMutation) ClearTenant

func (m *UserRoleMutation) ClearTenant()

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserRoleMutation) ClearTenantID

func (m *UserRoleMutation) ClearTenantID()

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleMutation) ClearUser

func (m *UserRoleMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserRoleMutation) ClearedEdges

func (m *UserRoleMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserRoleMutation) ClearedFields

func (m *UserRoleMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserRoleMutation) Client

func (m UserRoleMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserRoleMutation) EdgeCleared

func (m *UserRoleMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserRoleMutation) ExpiresAt

func (m *UserRoleMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*UserRoleMutation) ExpiresAtCleared

func (m *UserRoleMutation) ExpiresAtCleared() bool

ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.

func (*UserRoleMutation) Field

func (m *UserRoleMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserRoleMutation) FieldCleared

func (m *UserRoleMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserRoleMutation) Fields

func (m *UserRoleMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserRoleMutation) GrantedAt

func (m *UserRoleMutation) GrantedAt() (r time.Time, exists bool)

GrantedAt returns the value of the "granted_at" field in the mutation.

func (*UserRoleMutation) ID

func (m *UserRoleMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserRoleMutation) IDs

func (m *UserRoleMutation) IDs(ctx context.Context) ([]int64, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserRoleMutation) OldExpiresAt

func (m *UserRoleMutation) OldExpiresAt(ctx context.Context) (v *time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the UserRole entity. If the UserRole object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserRoleMutation) OldField

func (m *UserRoleMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserRoleMutation) OldGrantedAt

func (m *UserRoleMutation) OldGrantedAt(ctx context.Context) (v time.Time, err error)

OldGrantedAt returns the old "granted_at" field's value of the UserRole entity. If the UserRole object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserRoleMutation) OldRoleID

func (m *UserRoleMutation) OldRoleID(ctx context.Context) (v int64, err error)

OldRoleID returns the old "role_id" field's value of the UserRole entity. If the UserRole object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserRoleMutation) OldTenantID

func (m *UserRoleMutation) OldTenantID(ctx context.Context) (v *int64, err error)

OldTenantID returns the old "tenant_id" field's value of the UserRole entity. If the UserRole object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserRoleMutation) OldUserID

func (m *UserRoleMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the UserRole entity. If the UserRole object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserRoleMutation) Op

func (m *UserRoleMutation) Op() Op

Op returns the operation name.

func (*UserRoleMutation) RemovedEdges

func (m *UserRoleMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserRoleMutation) RemovedIDs

func (m *UserRoleMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserRoleMutation) ResetEdge

func (m *UserRoleMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserRoleMutation) ResetExpiresAt

func (m *UserRoleMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*UserRoleMutation) ResetField

func (m *UserRoleMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserRoleMutation) ResetGrantedAt

func (m *UserRoleMutation) ResetGrantedAt()

ResetGrantedAt resets all changes to the "granted_at" field.

func (*UserRoleMutation) ResetRole

func (m *UserRoleMutation) ResetRole()

ResetRole resets all changes to the "role" edge.

func (*UserRoleMutation) ResetRoleID

func (m *UserRoleMutation) ResetRoleID()

ResetRoleID resets all changes to the "role_id" field.

func (*UserRoleMutation) ResetTenant

func (m *UserRoleMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*UserRoleMutation) ResetTenantID

func (m *UserRoleMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*UserRoleMutation) ResetUser

func (m *UserRoleMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserRoleMutation) ResetUserID

func (m *UserRoleMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserRoleMutation) RoleCleared

func (m *UserRoleMutation) RoleCleared() bool

RoleCleared reports if the "role" edge to the Role entity was cleared.

func (*UserRoleMutation) RoleID

func (m *UserRoleMutation) RoleID() (r int64, exists bool)

RoleID returns the value of the "role_id" field in the mutation.

func (*UserRoleMutation) RoleIDs

func (m *UserRoleMutation) RoleIDs() (ids []int64)

RoleIDs returns the "role" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use RoleID instead. It exists only for internal usage by the builders.

func (*UserRoleMutation) SetExpiresAt

func (m *UserRoleMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*UserRoleMutation) SetField

func (m *UserRoleMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserRoleMutation) SetGrantedAt

func (m *UserRoleMutation) SetGrantedAt(t time.Time)

SetGrantedAt sets the "granted_at" field.

func (*UserRoleMutation) SetID

func (m *UserRoleMutation) SetID(id int64)

SetID sets the value of the id field. Note that this operation is only accepted on creation of UserRole entities.

func (*UserRoleMutation) SetOp

func (m *UserRoleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserRoleMutation) SetRoleID

func (m *UserRoleMutation) SetRoleID(i int64)

SetRoleID sets the "role_id" field.

func (*UserRoleMutation) SetTenantID

func (m *UserRoleMutation) SetTenantID(i int64)

SetTenantID sets the "tenant_id" field.

func (*UserRoleMutation) SetUserID

func (m *UserRoleMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*UserRoleMutation) TenantCleared

func (m *UserRoleMutation) TenantCleared() bool

TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.

func (*UserRoleMutation) TenantID

func (m *UserRoleMutation) TenantID() (r int64, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (*UserRoleMutation) TenantIDCleared

func (m *UserRoleMutation) TenantIDCleared() bool

TenantIDCleared returns if the "tenant_id" field was cleared in this mutation.

func (*UserRoleMutation) TenantIDs

func (m *UserRoleMutation) TenantIDs() (ids []int64)

TenantIDs returns the "tenant" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use TenantID instead. It exists only for internal usage by the builders.

func (UserRoleMutation) Tx

func (m UserRoleMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserRoleMutation) Type

func (m *UserRoleMutation) Type() string

Type returns the node type of this mutation (UserRole).

func (*UserRoleMutation) UserCleared

func (m *UserRoleMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserRoleMutation) UserID

func (m *UserRoleMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserRoleMutation) UserIDs

func (m *UserRoleMutation) UserIDs() (ids []int64)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*UserRoleMutation) Where

func (m *UserRoleMutation) Where(ps ...predicate.UserRole)

Where appends a list predicates to the UserRoleMutation builder.

func (*UserRoleMutation) WhereP

func (m *UserRoleMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserRoleMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserRoleQuery

type UserRoleQuery struct {
	// contains filtered or unexported fields
}

UserRoleQuery is the builder for querying UserRole entities.

func (*UserRoleQuery) Aggregate

func (urq *UserRoleQuery) Aggregate(fns ...AggregateFunc) *UserRoleSelect

Aggregate returns a UserRoleSelect configured with the given aggregations.

func (*UserRoleQuery) All

func (urq *UserRoleQuery) All(ctx context.Context) ([]*UserRole, error)

All executes the query and returns a list of UserRoles.

func (*UserRoleQuery) AllX

func (urq *UserRoleQuery) AllX(ctx context.Context) []*UserRole

AllX is like All, but panics if an error occurs.

func (*UserRoleQuery) Clone

func (urq *UserRoleQuery) Clone() *UserRoleQuery

Clone returns a duplicate of the UserRoleQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserRoleQuery) Count

func (urq *UserRoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserRoleQuery) CountX

func (urq *UserRoleQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserRoleQuery) Exist

func (urq *UserRoleQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserRoleQuery) ExistX

func (urq *UserRoleQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserRoleQuery) First

func (urq *UserRoleQuery) First(ctx context.Context) (*UserRole, error)

First returns the first UserRole entity from the query. Returns a *NotFoundError when no UserRole was found.

func (*UserRoleQuery) FirstID

func (urq *UserRoleQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first UserRole ID from the query. Returns a *NotFoundError when no UserRole ID was found.

func (*UserRoleQuery) FirstIDX

func (urq *UserRoleQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserRoleQuery) FirstX

func (urq *UserRoleQuery) FirstX(ctx context.Context) *UserRole

FirstX is like First, but panics if an error occurs.

func (*UserRoleQuery) ForShare

func (urq *UserRoleQuery) ForShare(opts ...sql.LockOption) *UserRoleQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserRoleQuery) ForUpdate

func (urq *UserRoleQuery) ForUpdate(opts ...sql.LockOption) *UserRoleQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserRoleQuery) GroupBy

func (urq *UserRoleQuery) GroupBy(field string, fields ...string) *UserRoleGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserRole.Query().
	GroupBy(userrole.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserRoleQuery) IDs

func (urq *UserRoleQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of UserRole IDs.

func (*UserRoleQuery) IDsX

func (urq *UserRoleQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*UserRoleQuery) Limit

func (urq *UserRoleQuery) Limit(limit int) *UserRoleQuery

Limit the number of records to be returned by this query.

func (*UserRoleQuery) Offset

func (urq *UserRoleQuery) Offset(offset int) *UserRoleQuery

Offset to start from.

func (*UserRoleQuery) Only

func (urq *UserRoleQuery) Only(ctx context.Context) (*UserRole, error)

Only returns a single UserRole entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserRole entity is found. Returns a *NotFoundError when no UserRole entities are found.

func (*UserRoleQuery) OnlyID

func (urq *UserRoleQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only UserRole ID in the query. Returns a *NotSingularError when more than one UserRole ID is found. Returns a *NotFoundError when no entities are found.

func (*UserRoleQuery) OnlyIDX

func (urq *UserRoleQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserRoleQuery) OnlyX

func (urq *UserRoleQuery) OnlyX(ctx context.Context) *UserRole

OnlyX is like Only, but panics if an error occurs.

func (*UserRoleQuery) Order

func (urq *UserRoleQuery) Order(o ...userrole.OrderOption) *UserRoleQuery

Order specifies how the records should be ordered.

func (*UserRoleQuery) QueryRole

func (urq *UserRoleQuery) QueryRole() *RoleQuery

QueryRole chains the current query on the "role" edge.

func (*UserRoleQuery) QueryTenant

func (urq *UserRoleQuery) QueryTenant() *TenantQuery

QueryTenant chains the current query on the "tenant" edge.

func (*UserRoleQuery) QueryUser

func (urq *UserRoleQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserRoleQuery) Select

func (urq *UserRoleQuery) Select(fields ...string) *UserRoleSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
}

client.UserRole.Query().
	Select(userrole.FieldUserID).
	Scan(ctx, &v)

func (*UserRoleQuery) Unique

func (urq *UserRoleQuery) Unique(unique bool) *UserRoleQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserRoleQuery) Where

func (urq *UserRoleQuery) Where(ps ...predicate.UserRole) *UserRoleQuery

Where adds a new predicate for the UserRoleQuery builder.

func (*UserRoleQuery) WithRole

func (urq *UserRoleQuery) WithRole(opts ...func(*RoleQuery)) *UserRoleQuery

WithRole tells the query-builder to eager-load the nodes that are connected to the "role" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserRoleQuery) WithTenant

func (urq *UserRoleQuery) WithTenant(opts ...func(*TenantQuery)) *UserRoleQuery

WithTenant tells the query-builder to eager-load the nodes that are connected to the "tenant" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserRoleQuery) WithUser

func (urq *UserRoleQuery) WithUser(opts ...func(*UserQuery)) *UserRoleQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type UserRoleSelect

type UserRoleSelect struct {
	*UserRoleQuery
	// contains filtered or unexported fields
}

UserRoleSelect is the builder for selecting fields of UserRole entities.

func (*UserRoleSelect) Aggregate

func (urs *UserRoleSelect) Aggregate(fns ...AggregateFunc) *UserRoleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserRoleSelect) Bool

func (s *UserRoleSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) BoolX

func (s *UserRoleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserRoleSelect) Bools

func (s *UserRoleSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) BoolsX

func (s *UserRoleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserRoleSelect) Float64

func (s *UserRoleSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) Float64X

func (s *UserRoleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserRoleSelect) Float64s

func (s *UserRoleSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) Float64sX

func (s *UserRoleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserRoleSelect) Int

func (s *UserRoleSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) IntX

func (s *UserRoleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserRoleSelect) Ints

func (s *UserRoleSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) IntsX

func (s *UserRoleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserRoleSelect) Scan

func (urs *UserRoleSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserRoleSelect) ScanX

func (s *UserRoleSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserRoleSelect) String

func (s *UserRoleSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) StringX

func (s *UserRoleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserRoleSelect) Strings

func (s *UserRoleSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserRoleSelect) StringsX

func (s *UserRoleSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserRoleUpdate

type UserRoleUpdate struct {
	// contains filtered or unexported fields
}

UserRoleUpdate is the builder for updating UserRole entities.

func (*UserRoleUpdate) ClearExpiresAt

func (uru *UserRoleUpdate) ClearExpiresAt() *UserRoleUpdate

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleUpdate) ClearRole

func (uru *UserRoleUpdate) ClearRole() *UserRoleUpdate

ClearRole clears the "role" edge to the Role entity.

func (*UserRoleUpdate) ClearTenant

func (uru *UserRoleUpdate) ClearTenant() *UserRoleUpdate

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserRoleUpdate) ClearTenantID

func (uru *UserRoleUpdate) ClearTenantID() *UserRoleUpdate

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleUpdate) ClearUser

func (uru *UserRoleUpdate) ClearUser() *UserRoleUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserRoleUpdate) Exec

func (uru *UserRoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleUpdate) ExecX

func (uru *UserRoleUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpdate) Mutation

func (uru *UserRoleUpdate) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleUpdate) Save

func (uru *UserRoleUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserRoleUpdate) SaveX

func (uru *UserRoleUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserRoleUpdate) SetExpiresAt

func (uru *UserRoleUpdate) SetExpiresAt(t time.Time) *UserRoleUpdate

SetExpiresAt sets the "expires_at" field.

func (*UserRoleUpdate) SetNillableExpiresAt

func (uru *UserRoleUpdate) SetNillableExpiresAt(t *time.Time) *UserRoleUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*UserRoleUpdate) SetNillableRoleID

func (uru *UserRoleUpdate) SetNillableRoleID(i *int64) *UserRoleUpdate

SetNillableRoleID sets the "role_id" field if the given value is not nil.

func (*UserRoleUpdate) SetNillableTenantID

func (uru *UserRoleUpdate) SetNillableTenantID(i *int64) *UserRoleUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserRoleUpdate) SetNillableUserID

func (uru *UserRoleUpdate) SetNillableUserID(i *int64) *UserRoleUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserRoleUpdate) SetRole

func (uru *UserRoleUpdate) SetRole(r *Role) *UserRoleUpdate

SetRole sets the "role" edge to the Role entity.

func (*UserRoleUpdate) SetRoleID

func (uru *UserRoleUpdate) SetRoleID(i int64) *UserRoleUpdate

SetRoleID sets the "role_id" field.

func (*UserRoleUpdate) SetTenant

func (uru *UserRoleUpdate) SetTenant(t *Tenant) *UserRoleUpdate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserRoleUpdate) SetTenantID

func (uru *UserRoleUpdate) SetTenantID(i int64) *UserRoleUpdate

SetTenantID sets the "tenant_id" field.

func (*UserRoleUpdate) SetUser

func (uru *UserRoleUpdate) SetUser(u *User) *UserRoleUpdate

SetUser sets the "user" edge to the User entity.

func (*UserRoleUpdate) SetUserID

func (uru *UserRoleUpdate) SetUserID(i int64) *UserRoleUpdate

SetUserID sets the "user_id" field.

func (*UserRoleUpdate) Where

func (uru *UserRoleUpdate) Where(ps ...predicate.UserRole) *UserRoleUpdate

Where appends a list predicates to the UserRoleUpdate builder.

type UserRoleUpdateOne

type UserRoleUpdateOne struct {
	// contains filtered or unexported fields
}

UserRoleUpdateOne is the builder for updating a single UserRole entity.

func (*UserRoleUpdateOne) ClearExpiresAt

func (uruo *UserRoleUpdateOne) ClearExpiresAt() *UserRoleUpdateOne

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleUpdateOne) ClearRole

func (uruo *UserRoleUpdateOne) ClearRole() *UserRoleUpdateOne

ClearRole clears the "role" edge to the Role entity.

func (*UserRoleUpdateOne) ClearTenant

func (uruo *UserRoleUpdateOne) ClearTenant() *UserRoleUpdateOne

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserRoleUpdateOne) ClearTenantID

func (uruo *UserRoleUpdateOne) ClearTenantID() *UserRoleUpdateOne

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleUpdateOne) ClearUser

func (uruo *UserRoleUpdateOne) ClearUser() *UserRoleUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserRoleUpdateOne) Exec

func (uruo *UserRoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserRoleUpdateOne) ExecX

func (uruo *UserRoleUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpdateOne) Mutation

func (uruo *UserRoleUpdateOne) Mutation() *UserRoleMutation

Mutation returns the UserRoleMutation object of the builder.

func (*UserRoleUpdateOne) Save

func (uruo *UserRoleUpdateOne) Save(ctx context.Context) (*UserRole, error)

Save executes the query and returns the updated UserRole entity.

func (*UserRoleUpdateOne) SaveX

func (uruo *UserRoleUpdateOne) SaveX(ctx context.Context) *UserRole

SaveX is like Save, but panics if an error occurs.

func (*UserRoleUpdateOne) Select

func (uruo *UserRoleUpdateOne) Select(field string, fields ...string) *UserRoleUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserRoleUpdateOne) SetExpiresAt

func (uruo *UserRoleUpdateOne) SetExpiresAt(t time.Time) *UserRoleUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*UserRoleUpdateOne) SetNillableExpiresAt

func (uruo *UserRoleUpdateOne) SetNillableExpiresAt(t *time.Time) *UserRoleUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*UserRoleUpdateOne) SetNillableRoleID

func (uruo *UserRoleUpdateOne) SetNillableRoleID(i *int64) *UserRoleUpdateOne

SetNillableRoleID sets the "role_id" field if the given value is not nil.

func (*UserRoleUpdateOne) SetNillableTenantID

func (uruo *UserRoleUpdateOne) SetNillableTenantID(i *int64) *UserRoleUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserRoleUpdateOne) SetNillableUserID

func (uruo *UserRoleUpdateOne) SetNillableUserID(i *int64) *UserRoleUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserRoleUpdateOne) SetRole

func (uruo *UserRoleUpdateOne) SetRole(r *Role) *UserRoleUpdateOne

SetRole sets the "role" edge to the Role entity.

func (*UserRoleUpdateOne) SetRoleID

func (uruo *UserRoleUpdateOne) SetRoleID(i int64) *UserRoleUpdateOne

SetRoleID sets the "role_id" field.

func (*UserRoleUpdateOne) SetTenant

func (uruo *UserRoleUpdateOne) SetTenant(t *Tenant) *UserRoleUpdateOne

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserRoleUpdateOne) SetTenantID

func (uruo *UserRoleUpdateOne) SetTenantID(i int64) *UserRoleUpdateOne

SetTenantID sets the "tenant_id" field.

func (*UserRoleUpdateOne) SetUser

func (uruo *UserRoleUpdateOne) SetUser(u *User) *UserRoleUpdateOne

SetUser sets the "user" edge to the User entity.

func (*UserRoleUpdateOne) SetUserID

func (uruo *UserRoleUpdateOne) SetUserID(i int64) *UserRoleUpdateOne

SetUserID sets the "user_id" field.

func (*UserRoleUpdateOne) Where

Where appends a list predicates to the UserRoleUpdate builder.

type UserRoleUpsert

type UserRoleUpsert struct {
	*sql.UpdateSet
}

UserRoleUpsert is the "OnConflict" setter.

func (*UserRoleUpsert) ClearExpiresAt

func (u *UserRoleUpsert) ClearExpiresAt() *UserRoleUpsert

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleUpsert) ClearTenantID

func (u *UserRoleUpsert) ClearTenantID() *UserRoleUpsert

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleUpsert) SetExpiresAt

func (u *UserRoleUpsert) SetExpiresAt(v time.Time) *UserRoleUpsert

SetExpiresAt sets the "expires_at" field.

func (*UserRoleUpsert) SetRoleID

func (u *UserRoleUpsert) SetRoleID(v int64) *UserRoleUpsert

SetRoleID sets the "role_id" field.

func (*UserRoleUpsert) SetTenantID

func (u *UserRoleUpsert) SetTenantID(v int64) *UserRoleUpsert

SetTenantID sets the "tenant_id" field.

func (*UserRoleUpsert) SetUserID

func (u *UserRoleUpsert) SetUserID(v int64) *UserRoleUpsert

SetUserID sets the "user_id" field.

func (*UserRoleUpsert) UpdateExpiresAt

func (u *UserRoleUpsert) UpdateExpiresAt() *UserRoleUpsert

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*UserRoleUpsert) UpdateRoleID

func (u *UserRoleUpsert) UpdateRoleID() *UserRoleUpsert

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*UserRoleUpsert) UpdateTenantID

func (u *UserRoleUpsert) UpdateTenantID() *UserRoleUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserRoleUpsert) UpdateUserID

func (u *UserRoleUpsert) UpdateUserID() *UserRoleUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserRoleUpsertBulk

type UserRoleUpsertBulk struct {
	// contains filtered or unexported fields
}

UserRoleUpsertBulk is the builder for "upsert"-ing a bulk of UserRole nodes.

func (*UserRoleUpsertBulk) ClearExpiresAt

func (u *UserRoleUpsertBulk) ClearExpiresAt() *UserRoleUpsertBulk

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleUpsertBulk) ClearTenantID

func (u *UserRoleUpsertBulk) ClearTenantID() *UserRoleUpsertBulk

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleUpsertBulk) DoNothing

func (u *UserRoleUpsertBulk) DoNothing() *UserRoleUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserRoleUpsertBulk) Exec

func (u *UserRoleUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleUpsertBulk) ExecX

func (u *UserRoleUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserRole.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserRoleUpsertBulk) SetExpiresAt

func (u *UserRoleUpsertBulk) SetExpiresAt(v time.Time) *UserRoleUpsertBulk

SetExpiresAt sets the "expires_at" field.

func (*UserRoleUpsertBulk) SetRoleID

func (u *UserRoleUpsertBulk) SetRoleID(v int64) *UserRoleUpsertBulk

SetRoleID sets the "role_id" field.

func (*UserRoleUpsertBulk) SetTenantID

func (u *UserRoleUpsertBulk) SetTenantID(v int64) *UserRoleUpsertBulk

SetTenantID sets the "tenant_id" field.

func (*UserRoleUpsertBulk) SetUserID

func (u *UserRoleUpsertBulk) SetUserID(v int64) *UserRoleUpsertBulk

SetUserID sets the "user_id" field.

func (*UserRoleUpsertBulk) Update

func (u *UserRoleUpsertBulk) Update(set func(*UserRoleUpsert)) *UserRoleUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserRoleCreateBulk.OnConflict documentation for more info.

func (*UserRoleUpsertBulk) UpdateExpiresAt

func (u *UserRoleUpsertBulk) UpdateExpiresAt() *UserRoleUpsertBulk

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*UserRoleUpsertBulk) UpdateNewValues

func (u *UserRoleUpsertBulk) UpdateNewValues() *UserRoleUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserRole.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(userrole.FieldID)
		}),
	).
	Exec(ctx)

func (*UserRoleUpsertBulk) UpdateRoleID

func (u *UserRoleUpsertBulk) UpdateRoleID() *UserRoleUpsertBulk

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*UserRoleUpsertBulk) UpdateTenantID

func (u *UserRoleUpsertBulk) UpdateTenantID() *UserRoleUpsertBulk

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserRoleUpsertBulk) UpdateUserID

func (u *UserRoleUpsertBulk) UpdateUserID() *UserRoleUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserRoleUpsertOne

type UserRoleUpsertOne struct {
	// contains filtered or unexported fields
}

UserRoleUpsertOne is the builder for "upsert"-ing

one UserRole node.

func (*UserRoleUpsertOne) ClearExpiresAt

func (u *UserRoleUpsertOne) ClearExpiresAt() *UserRoleUpsertOne

ClearExpiresAt clears the value of the "expires_at" field.

func (*UserRoleUpsertOne) ClearTenantID

func (u *UserRoleUpsertOne) ClearTenantID() *UserRoleUpsertOne

ClearTenantID clears the value of the "tenant_id" field.

func (*UserRoleUpsertOne) DoNothing

func (u *UserRoleUpsertOne) DoNothing() *UserRoleUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserRoleUpsertOne) Exec

func (u *UserRoleUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserRoleUpsertOne) ExecX

func (u *UserRoleUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserRoleUpsertOne) ID

func (u *UserRoleUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserRoleUpsertOne) IDX

func (u *UserRoleUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*UserRoleUpsertOne) Ignore

func (u *UserRoleUpsertOne) Ignore() *UserRoleUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserRole.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserRoleUpsertOne) SetExpiresAt

func (u *UserRoleUpsertOne) SetExpiresAt(v time.Time) *UserRoleUpsertOne

SetExpiresAt sets the "expires_at" field.

func (*UserRoleUpsertOne) SetRoleID

func (u *UserRoleUpsertOne) SetRoleID(v int64) *UserRoleUpsertOne

SetRoleID sets the "role_id" field.

func (*UserRoleUpsertOne) SetTenantID

func (u *UserRoleUpsertOne) SetTenantID(v int64) *UserRoleUpsertOne

SetTenantID sets the "tenant_id" field.

func (*UserRoleUpsertOne) SetUserID

func (u *UserRoleUpsertOne) SetUserID(v int64) *UserRoleUpsertOne

SetUserID sets the "user_id" field.

func (*UserRoleUpsertOne) Update

func (u *UserRoleUpsertOne) Update(set func(*UserRoleUpsert)) *UserRoleUpsertOne

Update allows overriding fields `UPDATE` values. See the UserRoleCreate.OnConflict documentation for more info.

func (*UserRoleUpsertOne) UpdateExpiresAt

func (u *UserRoleUpsertOne) UpdateExpiresAt() *UserRoleUpsertOne

UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.

func (*UserRoleUpsertOne) UpdateNewValues

func (u *UserRoleUpsertOne) UpdateNewValues() *UserRoleUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.UserRole.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(userrole.FieldID)
		}),
	).
	Exec(ctx)

func (*UserRoleUpsertOne) UpdateRoleID

func (u *UserRoleUpsertOne) UpdateRoleID() *UserRoleUpsertOne

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*UserRoleUpsertOne) UpdateTenantID

func (u *UserRoleUpsertOne) UpdateTenantID() *UserRoleUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserRoleUpsertOne) UpdateUserID

func (u *UserRoleUpsertOne) UpdateUserID() *UserRoleUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserRoles

type UserRoles []*UserRole

UserRoles is a parsable slice of UserRole.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserTenant

type UserTenant struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// SysUser ID
	UserID int64 `json:"user_id,omitempty"`
	// Tenant ID
	TenantID int64 `json:"tenant_id,omitempty"`
	// RoleLabels holds the value of the "role_labels" field.
	RoleLabels []string `json:"role_labels,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserTenantQuery when eager-loading is set.
	Edges UserTenantEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserTenant is the model entity for the UserTenant schema.

func (*UserTenant) QueryTenant

func (ut *UserTenant) QueryTenant() *TenantQuery

QueryTenant queries the "tenant" edge of the UserTenant entity.

func (*UserTenant) QueryUser

func (ut *UserTenant) QueryUser() *UserQuery

QueryUser queries the "user" edge of the UserTenant entity.

func (*UserTenant) String

func (ut *UserTenant) String() string

String implements the fmt.Stringer.

func (*UserTenant) Unwrap

func (ut *UserTenant) Unwrap() *UserTenant

Unwrap unwraps the UserTenant 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 (*UserTenant) Update

func (ut *UserTenant) Update() *UserTenantUpdateOne

Update returns a builder for updating this UserTenant. Note that you need to call UserTenant.Unwrap() before calling this method if this UserTenant was returned from a transaction, and the transaction was committed or rolled back.

func (*UserTenant) Value

func (ut *UserTenant) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the UserTenant. This includes values selected through modifiers, order, etc.

type UserTenantClient

type UserTenantClient struct {
	// contains filtered or unexported fields
}

UserTenantClient is a client for the UserTenant schema.

func NewUserTenantClient

func NewUserTenantClient(c config) *UserTenantClient

NewUserTenantClient returns a client for the UserTenant from the given config.

func (*UserTenantClient) Create

func (c *UserTenantClient) Create() *UserTenantCreate

Create returns a builder for creating a UserTenant entity.

func (*UserTenantClient) CreateBulk

func (c *UserTenantClient) CreateBulk(builders ...*UserTenantCreate) *UserTenantCreateBulk

CreateBulk returns a builder for creating a bulk of UserTenant entities.

func (*UserTenantClient) Delete

func (c *UserTenantClient) Delete() *UserTenantDelete

Delete returns a delete builder for UserTenant.

func (*UserTenantClient) DeleteOne

func (c *UserTenantClient) DeleteOne(ut *UserTenant) *UserTenantDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserTenantClient) DeleteOneID

func (c *UserTenantClient) DeleteOneID(id int) *UserTenantDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserTenantClient) Get

func (c *UserTenantClient) Get(ctx context.Context, id int) (*UserTenant, error)

Get returns a UserTenant entity by its id.

func (*UserTenantClient) GetX

func (c *UserTenantClient) GetX(ctx context.Context, id int) *UserTenant

GetX is like Get, but panics if an error occurs.

func (*UserTenantClient) Hooks

func (c *UserTenantClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserTenantClient) Intercept

func (c *UserTenantClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `usertenant.Intercept(f(g(h())))`.

func (*UserTenantClient) Interceptors

func (c *UserTenantClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserTenantClient) MapCreateBulk

func (c *UserTenantClient) MapCreateBulk(slice any, setFunc func(*UserTenantCreate, int)) *UserTenantCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserTenantClient) Query

func (c *UserTenantClient) Query() *UserTenantQuery

Query returns a query builder for UserTenant.

func (*UserTenantClient) QueryTenant

func (c *UserTenantClient) QueryTenant(ut *UserTenant) *TenantQuery

QueryTenant queries the tenant edge of a UserTenant.

func (*UserTenantClient) QueryUser

func (c *UserTenantClient) QueryUser(ut *UserTenant) *UserQuery

QueryUser queries the user edge of a UserTenant.

func (*UserTenantClient) Update

func (c *UserTenantClient) Update() *UserTenantUpdate

Update returns an update builder for UserTenant.

func (*UserTenantClient) UpdateOne

func (c *UserTenantClient) UpdateOne(ut *UserTenant) *UserTenantUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserTenantClient) UpdateOneID

func (c *UserTenantClient) UpdateOneID(id int) *UserTenantUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserTenantClient) Use

func (c *UserTenantClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `usertenant.Hooks(f(g(h())))`.

type UserTenantCreate

type UserTenantCreate struct {
	// contains filtered or unexported fields
}

UserTenantCreate is the builder for creating a UserTenant entity.

func (*UserTenantCreate) Exec

func (utc *UserTenantCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserTenantCreate) ExecX

func (utc *UserTenantCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantCreate) Mutation

func (utc *UserTenantCreate) Mutation() *UserTenantMutation

Mutation returns the UserTenantMutation object of the builder.

func (*UserTenantCreate) OnConflict

func (utc *UserTenantCreate) OnConflict(opts ...sql.ConflictOption) *UserTenantUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserTenant.Create().
	SetUserID(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserTenantUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserTenantCreate) OnConflictColumns

func (utc *UserTenantCreate) OnConflictColumns(columns ...string) *UserTenantUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserTenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserTenantCreate) Save

func (utc *UserTenantCreate) Save(ctx context.Context) (*UserTenant, error)

Save creates the UserTenant in the database.

func (*UserTenantCreate) SaveX

func (utc *UserTenantCreate) SaveX(ctx context.Context) *UserTenant

SaveX calls Save and panics if Save returns an error.

func (*UserTenantCreate) SetRoleLabels

func (utc *UserTenantCreate) SetRoleLabels(s []string) *UserTenantCreate

SetRoleLabels sets the "role_labels" field.

func (*UserTenantCreate) SetTenant

func (utc *UserTenantCreate) SetTenant(t *Tenant) *UserTenantCreate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserTenantCreate) SetTenantID

func (utc *UserTenantCreate) SetTenantID(i int64) *UserTenantCreate

SetTenantID sets the "tenant_id" field.

func (*UserTenantCreate) SetUser

func (utc *UserTenantCreate) SetUser(u *User) *UserTenantCreate

SetUser sets the "user" edge to the User entity.

func (*UserTenantCreate) SetUserID

func (utc *UserTenantCreate) SetUserID(i int64) *UserTenantCreate

SetUserID sets the "user_id" field.

type UserTenantCreateBulk

type UserTenantCreateBulk struct {
	// contains filtered or unexported fields
}

UserTenantCreateBulk is the builder for creating many UserTenant entities in bulk.

func (*UserTenantCreateBulk) Exec

func (utcb *UserTenantCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserTenantCreateBulk) ExecX

func (utcb *UserTenantCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantCreateBulk) OnConflict

func (utcb *UserTenantCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserTenantUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.UserTenant.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserTenantUpsert) {
		SetUserID(v+v).
	}).
	Exec(ctx)

func (*UserTenantCreateBulk) OnConflictColumns

func (utcb *UserTenantCreateBulk) OnConflictColumns(columns ...string) *UserTenantUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.UserTenant.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserTenantCreateBulk) Save

func (utcb *UserTenantCreateBulk) Save(ctx context.Context) ([]*UserTenant, error)

Save creates the UserTenant entities in the database.

func (*UserTenantCreateBulk) SaveX

func (utcb *UserTenantCreateBulk) SaveX(ctx context.Context) []*UserTenant

SaveX is like Save, but panics if an error occurs.

type UserTenantDelete

type UserTenantDelete struct {
	// contains filtered or unexported fields
}

UserTenantDelete is the builder for deleting a UserTenant entity.

func (*UserTenantDelete) Exec

func (utd *UserTenantDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserTenantDelete) ExecX

func (utd *UserTenantDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantDelete) Where

Where appends a list predicates to the UserTenantDelete builder.

type UserTenantDeleteOne

type UserTenantDeleteOne struct {
	// contains filtered or unexported fields
}

UserTenantDeleteOne is the builder for deleting a single UserTenant entity.

func (*UserTenantDeleteOne) Exec

func (utdo *UserTenantDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserTenantDeleteOne) ExecX

func (utdo *UserTenantDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantDeleteOne) Where

Where appends a list predicates to the UserTenantDelete builder.

type UserTenantEdges

type UserTenantEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Tenant holds the value of the tenant edge.
	Tenant *Tenant `json:"tenant,omitempty"`
	// contains filtered or unexported fields
}

UserTenantEdges holds the relations/edges for other nodes in the graph.

func (UserTenantEdges) TenantOrErr

func (e UserTenantEdges) TenantOrErr() (*Tenant, error)

TenantOrErr returns the Tenant value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserTenantEdges) UserOrErr

func (e UserTenantEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type UserTenantGroupBy

type UserTenantGroupBy struct {
	// contains filtered or unexported fields
}

UserTenantGroupBy is the group-by builder for UserTenant entities.

func (*UserTenantGroupBy) Aggregate

func (utgb *UserTenantGroupBy) Aggregate(fns ...AggregateFunc) *UserTenantGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserTenantGroupBy) Bool

func (s *UserTenantGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) BoolX

func (s *UserTenantGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserTenantGroupBy) Bools

func (s *UserTenantGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) BoolsX

func (s *UserTenantGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserTenantGroupBy) Float64

func (s *UserTenantGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) Float64X

func (s *UserTenantGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserTenantGroupBy) Float64s

func (s *UserTenantGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) Float64sX

func (s *UserTenantGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserTenantGroupBy) Int

func (s *UserTenantGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) IntX

func (s *UserTenantGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserTenantGroupBy) Ints

func (s *UserTenantGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) IntsX

func (s *UserTenantGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserTenantGroupBy) Scan

func (utgb *UserTenantGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserTenantGroupBy) ScanX

func (s *UserTenantGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserTenantGroupBy) String

func (s *UserTenantGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) StringX

func (s *UserTenantGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserTenantGroupBy) Strings

func (s *UserTenantGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserTenantGroupBy) StringsX

func (s *UserTenantGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserTenantMutation

type UserTenantMutation struct {
	// contains filtered or unexported fields
}

UserTenantMutation represents an operation that mutates the UserTenant nodes in the graph.

func (*UserTenantMutation) AddField

func (m *UserTenantMutation) 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 (*UserTenantMutation) AddedEdges

func (m *UserTenantMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserTenantMutation) AddedField

func (m *UserTenantMutation) 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 (*UserTenantMutation) AddedFields

func (m *UserTenantMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserTenantMutation) AddedIDs

func (m *UserTenantMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserTenantMutation) AppendRoleLabels

func (m *UserTenantMutation) AppendRoleLabels(s []string)

AppendRoleLabels adds s to the "role_labels" field.

func (*UserTenantMutation) AppendedRoleLabels

func (m *UserTenantMutation) AppendedRoleLabels() ([]string, bool)

AppendedRoleLabels returns the list of values that were appended to the "role_labels" field in this mutation.

func (*UserTenantMutation) ClearEdge

func (m *UserTenantMutation) 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 (*UserTenantMutation) ClearField

func (m *UserTenantMutation) 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 (*UserTenantMutation) ClearRoleLabels

func (m *UserTenantMutation) ClearRoleLabels()

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantMutation) ClearTenant

func (m *UserTenantMutation) ClearTenant()

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserTenantMutation) ClearUser

func (m *UserTenantMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*UserTenantMutation) ClearedEdges

func (m *UserTenantMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserTenantMutation) ClearedFields

func (m *UserTenantMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserTenantMutation) Client

func (m UserTenantMutation) 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 (*UserTenantMutation) EdgeCleared

func (m *UserTenantMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserTenantMutation) Field

func (m *UserTenantMutation) 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 (*UserTenantMutation) FieldCleared

func (m *UserTenantMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserTenantMutation) Fields

func (m *UserTenantMutation) 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 (*UserTenantMutation) ID

func (m *UserTenantMutation) 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 (*UserTenantMutation) IDs

func (m *UserTenantMutation) 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 (*UserTenantMutation) OldField

func (m *UserTenantMutation) 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 (*UserTenantMutation) OldRoleLabels

func (m *UserTenantMutation) OldRoleLabels(ctx context.Context) (v []string, err error)

OldRoleLabels returns the old "role_labels" field's value of the UserTenant entity. If the UserTenant 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 (*UserTenantMutation) OldTenantID

func (m *UserTenantMutation) OldTenantID(ctx context.Context) (v int64, err error)

OldTenantID returns the old "tenant_id" field's value of the UserTenant entity. If the UserTenant 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 (*UserTenantMutation) OldUserID

func (m *UserTenantMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" field's value of the UserTenant entity. If the UserTenant 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 (*UserTenantMutation) Op

func (m *UserTenantMutation) Op() Op

Op returns the operation name.

func (*UserTenantMutation) RemovedEdges

func (m *UserTenantMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserTenantMutation) RemovedIDs

func (m *UserTenantMutation) 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 (*UserTenantMutation) ResetEdge

func (m *UserTenantMutation) 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 (*UserTenantMutation) ResetField

func (m *UserTenantMutation) 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 (*UserTenantMutation) ResetRoleLabels

func (m *UserTenantMutation) ResetRoleLabels()

ResetRoleLabels resets all changes to the "role_labels" field.

func (*UserTenantMutation) ResetTenant

func (m *UserTenantMutation) ResetTenant()

ResetTenant resets all changes to the "tenant" edge.

func (*UserTenantMutation) ResetTenantID

func (m *UserTenantMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*UserTenantMutation) ResetUser

func (m *UserTenantMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserTenantMutation) ResetUserID

func (m *UserTenantMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserTenantMutation) RoleLabels

func (m *UserTenantMutation) RoleLabels() (r []string, exists bool)

RoleLabels returns the value of the "role_labels" field in the mutation.

func (*UserTenantMutation) RoleLabelsCleared

func (m *UserTenantMutation) RoleLabelsCleared() bool

RoleLabelsCleared returns if the "role_labels" field was cleared in this mutation.

func (*UserTenantMutation) SetField

func (m *UserTenantMutation) 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 (*UserTenantMutation) SetOp

func (m *UserTenantMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserTenantMutation) SetRoleLabels

func (m *UserTenantMutation) SetRoleLabels(s []string)

SetRoleLabels sets the "role_labels" field.

func (*UserTenantMutation) SetTenantID

func (m *UserTenantMutation) SetTenantID(i int64)

SetTenantID sets the "tenant_id" field.

func (*UserTenantMutation) SetUserID

func (m *UserTenantMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*UserTenantMutation) TenantCleared

func (m *UserTenantMutation) TenantCleared() bool

TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.

func (*UserTenantMutation) TenantID

func (m *UserTenantMutation) TenantID() (r int64, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (*UserTenantMutation) TenantIDs

func (m *UserTenantMutation) TenantIDs() (ids []int64)

TenantIDs returns the "tenant" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use TenantID instead. It exists only for internal usage by the builders.

func (UserTenantMutation) Tx

func (m UserTenantMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserTenantMutation) Type

func (m *UserTenantMutation) Type() string

Type returns the node type of this mutation (UserTenant).

func (*UserTenantMutation) UserCleared

func (m *UserTenantMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*UserTenantMutation) UserID

func (m *UserTenantMutation) UserID() (r int64, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*UserTenantMutation) UserIDs

func (m *UserTenantMutation) UserIDs() (ids []int64)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*UserTenantMutation) Where

func (m *UserTenantMutation) Where(ps ...predicate.UserTenant)

Where appends a list predicates to the UserTenantMutation builder.

func (*UserTenantMutation) WhereP

func (m *UserTenantMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserTenantMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserTenantQuery

type UserTenantQuery struct {
	// contains filtered or unexported fields
}

UserTenantQuery is the builder for querying UserTenant entities.

func (*UserTenantQuery) Aggregate

func (utq *UserTenantQuery) Aggregate(fns ...AggregateFunc) *UserTenantSelect

Aggregate returns a UserTenantSelect configured with the given aggregations.

func (*UserTenantQuery) All

func (utq *UserTenantQuery) All(ctx context.Context) ([]*UserTenant, error)

All executes the query and returns a list of UserTenants.

func (*UserTenantQuery) AllX

func (utq *UserTenantQuery) AllX(ctx context.Context) []*UserTenant

AllX is like All, but panics if an error occurs.

func (*UserTenantQuery) Clone

func (utq *UserTenantQuery) Clone() *UserTenantQuery

Clone returns a duplicate of the UserTenantQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserTenantQuery) Count

func (utq *UserTenantQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserTenantQuery) CountX

func (utq *UserTenantQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserTenantQuery) Exist

func (utq *UserTenantQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserTenantQuery) ExistX

func (utq *UserTenantQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserTenantQuery) First

func (utq *UserTenantQuery) First(ctx context.Context) (*UserTenant, error)

First returns the first UserTenant entity from the query. Returns a *NotFoundError when no UserTenant was found.

func (*UserTenantQuery) FirstID

func (utq *UserTenantQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UserTenant ID from the query. Returns a *NotFoundError when no UserTenant ID was found.

func (*UserTenantQuery) FirstIDX

func (utq *UserTenantQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserTenantQuery) FirstX

func (utq *UserTenantQuery) FirstX(ctx context.Context) *UserTenant

FirstX is like First, but panics if an error occurs.

func (*UserTenantQuery) ForShare

func (utq *UserTenantQuery) ForShare(opts ...sql.LockOption) *UserTenantQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserTenantQuery) ForUpdate

func (utq *UserTenantQuery) ForUpdate(opts ...sql.LockOption) *UserTenantQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserTenantQuery) GroupBy

func (utq *UserTenantQuery) GroupBy(field string, fields ...string) *UserTenantGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserTenant.Query().
	GroupBy(usertenant.FieldUserID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserTenantQuery) IDs

func (utq *UserTenantQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of UserTenant IDs.

func (*UserTenantQuery) IDsX

func (utq *UserTenantQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserTenantQuery) Limit

func (utq *UserTenantQuery) Limit(limit int) *UserTenantQuery

Limit the number of records to be returned by this query.

func (*UserTenantQuery) Offset

func (utq *UserTenantQuery) Offset(offset int) *UserTenantQuery

Offset to start from.

func (*UserTenantQuery) Only

func (utq *UserTenantQuery) Only(ctx context.Context) (*UserTenant, error)

Only returns a single UserTenant entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UserTenant entity is found. Returns a *NotFoundError when no UserTenant entities are found.

func (*UserTenantQuery) OnlyID

func (utq *UserTenantQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UserTenant ID in the query. Returns a *NotSingularError when more than one UserTenant ID is found. Returns a *NotFoundError when no entities are found.

func (*UserTenantQuery) OnlyIDX

func (utq *UserTenantQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserTenantQuery) OnlyX

func (utq *UserTenantQuery) OnlyX(ctx context.Context) *UserTenant

OnlyX is like Only, but panics if an error occurs.

func (*UserTenantQuery) Order

Order specifies how the records should be ordered.

func (*UserTenantQuery) QueryTenant

func (utq *UserTenantQuery) QueryTenant() *TenantQuery

QueryTenant chains the current query on the "tenant" edge.

func (*UserTenantQuery) QueryUser

func (utq *UserTenantQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*UserTenantQuery) Select

func (utq *UserTenantQuery) Select(fields ...string) *UserTenantSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	UserID int64 `json:"user_id,omitempty"`
}

client.UserTenant.Query().
	Select(usertenant.FieldUserID).
	Scan(ctx, &v)

func (*UserTenantQuery) Unique

func (utq *UserTenantQuery) Unique(unique bool) *UserTenantQuery

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 (*UserTenantQuery) Where

Where adds a new predicate for the UserTenantQuery builder.

func (*UserTenantQuery) WithTenant

func (utq *UserTenantQuery) WithTenant(opts ...func(*TenantQuery)) *UserTenantQuery

WithTenant tells the query-builder to eager-load the nodes that are connected to the "tenant" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserTenantQuery) WithUser

func (utq *UserTenantQuery) WithUser(opts ...func(*UserQuery)) *UserTenantQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type UserTenantSelect

type UserTenantSelect struct {
	*UserTenantQuery
	// contains filtered or unexported fields
}

UserTenantSelect is the builder for selecting fields of UserTenant entities.

func (*UserTenantSelect) Aggregate

func (uts *UserTenantSelect) Aggregate(fns ...AggregateFunc) *UserTenantSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserTenantSelect) Bool

func (s *UserTenantSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) BoolX

func (s *UserTenantSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserTenantSelect) Bools

func (s *UserTenantSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) BoolsX

func (s *UserTenantSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserTenantSelect) Float64

func (s *UserTenantSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) Float64X

func (s *UserTenantSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserTenantSelect) Float64s

func (s *UserTenantSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) Float64sX

func (s *UserTenantSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserTenantSelect) Int

func (s *UserTenantSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) IntX

func (s *UserTenantSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserTenantSelect) Ints

func (s *UserTenantSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) IntsX

func (s *UserTenantSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserTenantSelect) Scan

func (uts *UserTenantSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserTenantSelect) ScanX

func (s *UserTenantSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserTenantSelect) String

func (s *UserTenantSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) StringX

func (s *UserTenantSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserTenantSelect) Strings

func (s *UserTenantSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserTenantSelect) StringsX

func (s *UserTenantSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserTenantUpdate

type UserTenantUpdate struct {
	// contains filtered or unexported fields
}

UserTenantUpdate is the builder for updating UserTenant entities.

func (*UserTenantUpdate) AppendRoleLabels

func (utu *UserTenantUpdate) AppendRoleLabels(s []string) *UserTenantUpdate

AppendRoleLabels appends s to the "role_labels" field.

func (*UserTenantUpdate) ClearRoleLabels

func (utu *UserTenantUpdate) ClearRoleLabels() *UserTenantUpdate

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantUpdate) ClearTenant

func (utu *UserTenantUpdate) ClearTenant() *UserTenantUpdate

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserTenantUpdate) ClearUser

func (utu *UserTenantUpdate) ClearUser() *UserTenantUpdate

ClearUser clears the "user" edge to the User entity.

func (*UserTenantUpdate) Exec

func (utu *UserTenantUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserTenantUpdate) ExecX

func (utu *UserTenantUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantUpdate) Mutation

func (utu *UserTenantUpdate) Mutation() *UserTenantMutation

Mutation returns the UserTenantMutation object of the builder.

func (*UserTenantUpdate) Save

func (utu *UserTenantUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserTenantUpdate) SaveX

func (utu *UserTenantUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserTenantUpdate) SetNillableTenantID

func (utu *UserTenantUpdate) SetNillableTenantID(i *int64) *UserTenantUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserTenantUpdate) SetNillableUserID

func (utu *UserTenantUpdate) SetNillableUserID(i *int64) *UserTenantUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserTenantUpdate) SetRoleLabels

func (utu *UserTenantUpdate) SetRoleLabels(s []string) *UserTenantUpdate

SetRoleLabels sets the "role_labels" field.

func (*UserTenantUpdate) SetTenant

func (utu *UserTenantUpdate) SetTenant(t *Tenant) *UserTenantUpdate

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserTenantUpdate) SetTenantID

func (utu *UserTenantUpdate) SetTenantID(i int64) *UserTenantUpdate

SetTenantID sets the "tenant_id" field.

func (*UserTenantUpdate) SetUser

func (utu *UserTenantUpdate) SetUser(u *User) *UserTenantUpdate

SetUser sets the "user" edge to the User entity.

func (*UserTenantUpdate) SetUserID

func (utu *UserTenantUpdate) SetUserID(i int64) *UserTenantUpdate

SetUserID sets the "user_id" field.

func (*UserTenantUpdate) Where

Where appends a list predicates to the UserTenantUpdate builder.

type UserTenantUpdateOne

type UserTenantUpdateOne struct {
	// contains filtered or unexported fields
}

UserTenantUpdateOne is the builder for updating a single UserTenant entity.

func (*UserTenantUpdateOne) AppendRoleLabels

func (utuo *UserTenantUpdateOne) AppendRoleLabels(s []string) *UserTenantUpdateOne

AppendRoleLabels appends s to the "role_labels" field.

func (*UserTenantUpdateOne) ClearRoleLabels

func (utuo *UserTenantUpdateOne) ClearRoleLabels() *UserTenantUpdateOne

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantUpdateOne) ClearTenant

func (utuo *UserTenantUpdateOne) ClearTenant() *UserTenantUpdateOne

ClearTenant clears the "tenant" edge to the Tenant entity.

func (*UserTenantUpdateOne) ClearUser

func (utuo *UserTenantUpdateOne) ClearUser() *UserTenantUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*UserTenantUpdateOne) Exec

func (utuo *UserTenantUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserTenantUpdateOne) ExecX

func (utuo *UserTenantUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantUpdateOne) Mutation

func (utuo *UserTenantUpdateOne) Mutation() *UserTenantMutation

Mutation returns the UserTenantMutation object of the builder.

func (*UserTenantUpdateOne) Save

func (utuo *UserTenantUpdateOne) Save(ctx context.Context) (*UserTenant, error)

Save executes the query and returns the updated UserTenant entity.

func (*UserTenantUpdateOne) SaveX

func (utuo *UserTenantUpdateOne) SaveX(ctx context.Context) *UserTenant

SaveX is like Save, but panics if an error occurs.

func (*UserTenantUpdateOne) Select

func (utuo *UserTenantUpdateOne) Select(field string, fields ...string) *UserTenantUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserTenantUpdateOne) SetNillableTenantID

func (utuo *UserTenantUpdateOne) SetNillableTenantID(i *int64) *UserTenantUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*UserTenantUpdateOne) SetNillableUserID

func (utuo *UserTenantUpdateOne) SetNillableUserID(i *int64) *UserTenantUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*UserTenantUpdateOne) SetRoleLabels

func (utuo *UserTenantUpdateOne) SetRoleLabels(s []string) *UserTenantUpdateOne

SetRoleLabels sets the "role_labels" field.

func (*UserTenantUpdateOne) SetTenant

func (utuo *UserTenantUpdateOne) SetTenant(t *Tenant) *UserTenantUpdateOne

SetTenant sets the "tenant" edge to the Tenant entity.

func (*UserTenantUpdateOne) SetTenantID

func (utuo *UserTenantUpdateOne) SetTenantID(i int64) *UserTenantUpdateOne

SetTenantID sets the "tenant_id" field.

func (*UserTenantUpdateOne) SetUser

func (utuo *UserTenantUpdateOne) SetUser(u *User) *UserTenantUpdateOne

SetUser sets the "user" edge to the User entity.

func (*UserTenantUpdateOne) SetUserID

func (utuo *UserTenantUpdateOne) SetUserID(i int64) *UserTenantUpdateOne

SetUserID sets the "user_id" field.

func (*UserTenantUpdateOne) Where

Where appends a list predicates to the UserTenantUpdate builder.

type UserTenantUpsert

type UserTenantUpsert struct {
	*sql.UpdateSet
}

UserTenantUpsert is the "OnConflict" setter.

func (*UserTenantUpsert) ClearRoleLabels

func (u *UserTenantUpsert) ClearRoleLabels() *UserTenantUpsert

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantUpsert) SetRoleLabels

func (u *UserTenantUpsert) SetRoleLabels(v []string) *UserTenantUpsert

SetRoleLabels sets the "role_labels" field.

func (*UserTenantUpsert) SetTenantID

func (u *UserTenantUpsert) SetTenantID(v int64) *UserTenantUpsert

SetTenantID sets the "tenant_id" field.

func (*UserTenantUpsert) SetUserID

func (u *UserTenantUpsert) SetUserID(v int64) *UserTenantUpsert

SetUserID sets the "user_id" field.

func (*UserTenantUpsert) UpdateRoleLabels

func (u *UserTenantUpsert) UpdateRoleLabels() *UserTenantUpsert

UpdateRoleLabels sets the "role_labels" field to the value that was provided on create.

func (*UserTenantUpsert) UpdateTenantID

func (u *UserTenantUpsert) UpdateTenantID() *UserTenantUpsert

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserTenantUpsert) UpdateUserID

func (u *UserTenantUpsert) UpdateUserID() *UserTenantUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserTenantUpsertBulk

type UserTenantUpsertBulk struct {
	// contains filtered or unexported fields
}

UserTenantUpsertBulk is the builder for "upsert"-ing a bulk of UserTenant nodes.

func (*UserTenantUpsertBulk) ClearRoleLabels

func (u *UserTenantUpsertBulk) ClearRoleLabels() *UserTenantUpsertBulk

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserTenantUpsertBulk) Exec

Exec executes the query.

func (*UserTenantUpsertBulk) ExecX

func (u *UserTenantUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserTenant.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserTenantUpsertBulk) SetRoleLabels

func (u *UserTenantUpsertBulk) SetRoleLabels(v []string) *UserTenantUpsertBulk

SetRoleLabels sets the "role_labels" field.

func (*UserTenantUpsertBulk) SetTenantID

func (u *UserTenantUpsertBulk) SetTenantID(v int64) *UserTenantUpsertBulk

SetTenantID sets the "tenant_id" field.

func (*UserTenantUpsertBulk) SetUserID

SetUserID sets the "user_id" field.

func (*UserTenantUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the UserTenantCreateBulk.OnConflict documentation for more info.

func (*UserTenantUpsertBulk) UpdateNewValues

func (u *UserTenantUpsertBulk) UpdateNewValues() *UserTenantUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserTenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserTenantUpsertBulk) UpdateRoleLabels

func (u *UserTenantUpsertBulk) UpdateRoleLabels() *UserTenantUpsertBulk

UpdateRoleLabels sets the "role_labels" field to the value that was provided on create.

func (*UserTenantUpsertBulk) UpdateTenantID

func (u *UserTenantUpsertBulk) UpdateTenantID() *UserTenantUpsertBulk

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserTenantUpsertBulk) UpdateUserID

func (u *UserTenantUpsertBulk) UpdateUserID() *UserTenantUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserTenantUpsertOne

type UserTenantUpsertOne struct {
	// contains filtered or unexported fields
}

UserTenantUpsertOne is the builder for "upsert"-ing

one UserTenant node.

func (*UserTenantUpsertOne) ClearRoleLabels

func (u *UserTenantUpsertOne) ClearRoleLabels() *UserTenantUpsertOne

ClearRoleLabels clears the value of the "role_labels" field.

func (*UserTenantUpsertOne) DoNothing

func (u *UserTenantUpsertOne) DoNothing() *UserTenantUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserTenantUpsertOne) Exec

Exec executes the query.

func (*UserTenantUpsertOne) ExecX

func (u *UserTenantUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserTenantUpsertOne) ID

func (u *UserTenantUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserTenantUpsertOne) IDX

func (u *UserTenantUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*UserTenantUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.UserTenant.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserTenantUpsertOne) SetRoleLabels

func (u *UserTenantUpsertOne) SetRoleLabels(v []string) *UserTenantUpsertOne

SetRoleLabels sets the "role_labels" field.

func (*UserTenantUpsertOne) SetTenantID

func (u *UserTenantUpsertOne) SetTenantID(v int64) *UserTenantUpsertOne

SetTenantID sets the "tenant_id" field.

func (*UserTenantUpsertOne) SetUserID

SetUserID sets the "user_id" field.

func (*UserTenantUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the UserTenantCreate.OnConflict documentation for more info.

func (*UserTenantUpsertOne) UpdateNewValues

func (u *UserTenantUpsertOne) UpdateNewValues() *UserTenantUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.UserTenant.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserTenantUpsertOne) UpdateRoleLabels

func (u *UserTenantUpsertOne) UpdateRoleLabels() *UserTenantUpsertOne

UpdateRoleLabels sets the "role_labels" field to the value that was provided on create.

func (*UserTenantUpsertOne) UpdateTenantID

func (u *UserTenantUpsertOne) UpdateTenantID() *UserTenantUpsertOne

UpdateTenantID sets the "tenant_id" field to the value that was provided on create.

func (*UserTenantUpsertOne) UpdateUserID

func (u *UserTenantUpsertOne) UpdateUserID() *UserTenantUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type UserTenants

type UserTenants []*UserTenant

UserTenants is a parsable slice of UserTenant.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAccountIDs

func (uu *UserUpdate) AddAccountIDs(ids ...int) *UserUpdate

AddAccountIDs adds the "accounts" edge to the UserAccount entity by IDs.

func (*UserUpdate) AddAccounts

func (uu *UserUpdate) AddAccounts(u ...*UserAccount) *UserUpdate

AddAccounts adds the "accounts" edges to the UserAccount entity.

func (*UserUpdate) AddCreatedBy

func (uu *UserUpdate) AddCreatedBy(i int64) *UserUpdate

AddCreatedBy adds i to the "created_by" field.

func (*UserUpdate) AddUpdatedBy

func (uu *UserUpdate) AddUpdatedBy(i int64) *UserUpdate

AddUpdatedBy adds i to the "updated_by" field.

func (*UserUpdate) AddUserDepartmentIDs

func (uu *UserUpdate) AddUserDepartmentIDs(ids ...int) *UserUpdate

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*UserUpdate) AddUserDepartments

func (uu *UserUpdate) AddUserDepartments(u ...*UserDepartment) *UserUpdate

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*UserUpdate) AddUserRoleIDs

func (uu *UserUpdate) AddUserRoleIDs(ids ...int64) *UserUpdate

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*UserUpdate) AddUserRoles

func (uu *UserUpdate) AddUserRoles(u ...*UserRole) *UserUpdate

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*UserUpdate) AddUserTenantIDs

func (uu *UserUpdate) AddUserTenantIDs(ids ...int) *UserUpdate

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*UserUpdate) AddUserTenants

func (uu *UserUpdate) AddUserTenants(u ...*UserTenant) *UserUpdate

AddUserTenants adds the "user_tenants" edges to the UserTenant entity.

func (*UserUpdate) ClearAccounts

func (uu *UserUpdate) ClearAccounts() *UserUpdate

ClearAccounts clears all "accounts" edges to the UserAccount entity.

func (*UserUpdate) ClearAvatar

func (uu *UserUpdate) ClearAvatar() *UserUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdate) ClearCreatedBy

func (uu *UserUpdate) ClearCreatedBy() *UserUpdate

ClearCreatedBy clears the value of the "created_by" field.

func (*UserUpdate) ClearDeletedAt

func (uu *UserUpdate) ClearDeletedAt() *UserUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of the "email" field.

func (*UserUpdate) ClearFullName

func (uu *UserUpdate) ClearFullName() *UserUpdate

ClearFullName clears the value of the "full_name" field.

func (*UserUpdate) ClearPassword

func (uu *UserUpdate) ClearPassword() *UserUpdate

ClearPassword clears the value of the "password" field.

func (*UserUpdate) ClearPhone

func (uu *UserUpdate) ClearPhone() *UserUpdate

ClearPhone clears the value of the "phone" field.

func (*UserUpdate) ClearUpdatedBy

func (uu *UserUpdate) ClearUpdatedBy() *UserUpdate

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserUpdate) ClearUserDepartments

func (uu *UserUpdate) ClearUserDepartments() *UserUpdate

ClearUserDepartments clears all "user_departments" edges to the UserDepartment entity.

func (*UserUpdate) ClearUserRoles

func (uu *UserUpdate) ClearUserRoles() *UserUpdate

ClearUserRoles clears all "user_roles" edges to the UserRole entity.

func (*UserUpdate) ClearUserTenants

func (uu *UserUpdate) ClearUserTenants() *UserUpdate

ClearUserTenants clears all "user_tenants" edges to the UserTenant entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAccountIDs

func (uu *UserUpdate) RemoveAccountIDs(ids ...int) *UserUpdate

RemoveAccountIDs removes the "accounts" edge to UserAccount entities by IDs.

func (*UserUpdate) RemoveAccounts

func (uu *UserUpdate) RemoveAccounts(u ...*UserAccount) *UserUpdate

RemoveAccounts removes "accounts" edges to UserAccount entities.

func (*UserUpdate) RemoveUserDepartmentIDs

func (uu *UserUpdate) RemoveUserDepartmentIDs(ids ...int) *UserUpdate

RemoveUserDepartmentIDs removes the "user_departments" edge to UserDepartment entities by IDs.

func (*UserUpdate) RemoveUserDepartments

func (uu *UserUpdate) RemoveUserDepartments(u ...*UserDepartment) *UserUpdate

RemoveUserDepartments removes "user_departments" edges to UserDepartment entities.

func (*UserUpdate) RemoveUserRoleIDs

func (uu *UserUpdate) RemoveUserRoleIDs(ids ...int64) *UserUpdate

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*UserUpdate) RemoveUserRoles

func (uu *UserUpdate) RemoveUserRoles(u ...*UserRole) *UserUpdate

RemoveUserRoles removes "user_roles" edges to UserRole entities.

func (*UserUpdate) RemoveUserTenantIDs

func (uu *UserUpdate) RemoveUserTenantIDs(ids ...int) *UserUpdate

RemoveUserTenantIDs removes the "user_tenants" edge to UserTenant entities by IDs.

func (*UserUpdate) RemoveUserTenants

func (uu *UserUpdate) RemoveUserTenants(u ...*UserTenant) *UserUpdate

RemoveUserTenants removes "user_tenants" edges to UserTenant entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAvatar

func (uu *UserUpdate) SetAvatar(s string) *UserUpdate

SetAvatar sets the "avatar" field.

func (*UserUpdate) SetCreatedBy

func (uu *UserUpdate) SetCreatedBy(i int64) *UserUpdate

SetCreatedBy sets the "created_by" field.

func (*UserUpdate) SetDeletedAt

func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate

SetDeletedAt sets the "deleted_at" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetFullName

func (uu *UserUpdate) SetFullName(s string) *UserUpdate

SetFullName sets the "full_name" field.

func (*UserUpdate) SetGender

func (uu *UserUpdate) SetGender(u user.Gender) *UserUpdate

SetGender sets the "gender" field.

func (*UserUpdate) SetLanguage

func (uu *UserUpdate) SetLanguage(s string) *UserUpdate

SetLanguage sets the "language" field.

func (*UserUpdate) SetNillableAvatar

func (uu *UserUpdate) SetNillableAvatar(s *string) *UserUpdate

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdate) SetNillableCreatedBy

func (uu *UserUpdate) SetNillableCreatedBy(i *int64) *UserUpdate

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserUpdate) SetNillableDeletedAt

func (uu *UserUpdate) SetNillableDeletedAt(t *time.Time) *UserUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableFullName

func (uu *UserUpdate) SetNillableFullName(s *string) *UserUpdate

SetNillableFullName sets the "full_name" field if the given value is not nil.

func (*UserUpdate) SetNillableGender

func (uu *UserUpdate) SetNillableGender(u *user.Gender) *UserUpdate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdate) SetNillableLanguage

func (uu *UserUpdate) SetNillableLanguage(s *string) *UserUpdate

SetNillableLanguage sets the "language" field if the given value is not nil.

func (*UserUpdate) SetNillablePassword

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillablePhone

func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdate) SetNillableStatus

func (uu *UserUpdate) SetNillableStatus(u *user.Status) *UserUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdate) SetNillableTimezone

func (uu *UserUpdate) SetNillableTimezone(s *string) *UserUpdate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserUpdate) SetNillableUpdatedBy

func (uu *UserUpdate) SetNillableUpdatedBy(i *int64) *UserUpdate

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername

func (uu *UserUpdate) SetNillableUsername(s *string) *UserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetPhone

func (uu *UserUpdate) SetPhone(s string) *UserUpdate

SetPhone sets the "phone" field.

func (*UserUpdate) SetStatus

func (uu *UserUpdate) SetStatus(u user.Status) *UserUpdate

SetStatus sets the "status" field.

func (*UserUpdate) SetTimezone

func (uu *UserUpdate) SetTimezone(s string) *UserUpdate

SetTimezone sets the "timezone" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUpdatedBy

func (uu *UserUpdate) SetUpdatedBy(i int64) *UserUpdate

SetUpdatedBy sets the "updated_by" field.

func (*UserUpdate) 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) AddAccountIDs

func (uuo *UserUpdateOne) AddAccountIDs(ids ...int) *UserUpdateOne

AddAccountIDs adds the "accounts" edge to the UserAccount entity by IDs.

func (*UserUpdateOne) AddAccounts

func (uuo *UserUpdateOne) AddAccounts(u ...*UserAccount) *UserUpdateOne

AddAccounts adds the "accounts" edges to the UserAccount entity.

func (*UserUpdateOne) AddCreatedBy

func (uuo *UserUpdateOne) AddCreatedBy(i int64) *UserUpdateOne

AddCreatedBy adds i to the "created_by" field.

func (*UserUpdateOne) AddUpdatedBy

func (uuo *UserUpdateOne) AddUpdatedBy(i int64) *UserUpdateOne

AddUpdatedBy adds i to the "updated_by" field.

func (*UserUpdateOne) AddUserDepartmentIDs

func (uuo *UserUpdateOne) AddUserDepartmentIDs(ids ...int) *UserUpdateOne

AddUserDepartmentIDs adds the "user_departments" edge to the UserDepartment entity by IDs.

func (*UserUpdateOne) AddUserDepartments

func (uuo *UserUpdateOne) AddUserDepartments(u ...*UserDepartment) *UserUpdateOne

AddUserDepartments adds the "user_departments" edges to the UserDepartment entity.

func (*UserUpdateOne) AddUserRoleIDs

func (uuo *UserUpdateOne) AddUserRoleIDs(ids ...int64) *UserUpdateOne

AddUserRoleIDs adds the "user_roles" edge to the UserRole entity by IDs.

func (*UserUpdateOne) AddUserRoles

func (uuo *UserUpdateOne) AddUserRoles(u ...*UserRole) *UserUpdateOne

AddUserRoles adds the "user_roles" edges to the UserRole entity.

func (*UserUpdateOne) AddUserTenantIDs

func (uuo *UserUpdateOne) AddUserTenantIDs(ids ...int) *UserUpdateOne

AddUserTenantIDs adds the "user_tenants" edge to the UserTenant entity by IDs.

func (*UserUpdateOne) AddUserTenants

func (uuo *UserUpdateOne) AddUserTenants(u ...*UserTenant) *UserUpdateOne

AddUserTenants adds the "user_tenants" edges to the UserTenant entity.

func (*UserUpdateOne) ClearAccounts

func (uuo *UserUpdateOne) ClearAccounts() *UserUpdateOne

ClearAccounts clears all "accounts" edges to the UserAccount entity.

func (*UserUpdateOne) ClearAvatar

func (uuo *UserUpdateOne) ClearAvatar() *UserUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdateOne) ClearCreatedBy

func (uuo *UserUpdateOne) ClearCreatedBy() *UserUpdateOne

ClearCreatedBy clears the value of the "created_by" field.

func (*UserUpdateOne) ClearDeletedAt

func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of the "email" field.

func (*UserUpdateOne) ClearFullName

func (uuo *UserUpdateOne) ClearFullName() *UserUpdateOne

ClearFullName clears the value of the "full_name" field.

func (*UserUpdateOne) ClearPassword

func (uuo *UserUpdateOne) ClearPassword() *UserUpdateOne

ClearPassword clears the value of the "password" field.

func (*UserUpdateOne) ClearPhone

func (uuo *UserUpdateOne) ClearPhone() *UserUpdateOne

ClearPhone clears the value of the "phone" field.

func (*UserUpdateOne) ClearUpdatedBy

func (uuo *UserUpdateOne) ClearUpdatedBy() *UserUpdateOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserUpdateOne) ClearUserDepartments

func (uuo *UserUpdateOne) ClearUserDepartments() *UserUpdateOne

ClearUserDepartments clears all "user_departments" edges to the UserDepartment entity.

func (*UserUpdateOne) ClearUserRoles

func (uuo *UserUpdateOne) ClearUserRoles() *UserUpdateOne

ClearUserRoles clears all "user_roles" edges to the UserRole entity.

func (*UserUpdateOne) ClearUserTenants

func (uuo *UserUpdateOne) ClearUserTenants() *UserUpdateOne

ClearUserTenants clears all "user_tenants" edges to the UserTenant entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAccountIDs

func (uuo *UserUpdateOne) RemoveAccountIDs(ids ...int) *UserUpdateOne

RemoveAccountIDs removes the "accounts" edge to UserAccount entities by IDs.

func (*UserUpdateOne) RemoveAccounts

func (uuo *UserUpdateOne) RemoveAccounts(u ...*UserAccount) *UserUpdateOne

RemoveAccounts removes "accounts" edges to UserAccount entities.

func (*UserUpdateOne) RemoveUserDepartmentIDs

func (uuo *UserUpdateOne) RemoveUserDepartmentIDs(ids ...int) *UserUpdateOne

RemoveUserDepartmentIDs removes the "user_departments" edge to UserDepartment entities by IDs.

func (*UserUpdateOne) RemoveUserDepartments

func (uuo *UserUpdateOne) RemoveUserDepartments(u ...*UserDepartment) *UserUpdateOne

RemoveUserDepartments removes "user_departments" edges to UserDepartment entities.

func (*UserUpdateOne) RemoveUserRoleIDs

func (uuo *UserUpdateOne) RemoveUserRoleIDs(ids ...int64) *UserUpdateOne

RemoveUserRoleIDs removes the "user_roles" edge to UserRole entities by IDs.

func (*UserUpdateOne) RemoveUserRoles

func (uuo *UserUpdateOne) RemoveUserRoles(u ...*UserRole) *UserUpdateOne

RemoveUserRoles removes "user_roles" edges to UserRole entities.

func (*UserUpdateOne) RemoveUserTenantIDs

func (uuo *UserUpdateOne) RemoveUserTenantIDs(ids ...int) *UserUpdateOne

RemoveUserTenantIDs removes the "user_tenants" edge to UserTenant entities by IDs.

func (*UserUpdateOne) RemoveUserTenants

func (uuo *UserUpdateOne) RemoveUserTenants(u ...*UserTenant) *UserUpdateOne

RemoveUserTenants removes "user_tenants" edges to UserTenant entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAvatar

func (uuo *UserUpdateOne) SetAvatar(s string) *UserUpdateOne

SetAvatar sets the "avatar" field.

func (*UserUpdateOne) SetCreatedBy

func (uuo *UserUpdateOne) SetCreatedBy(i int64) *UserUpdateOne

SetCreatedBy sets the "created_by" field.

func (*UserUpdateOne) SetDeletedAt

func (uuo *UserUpdateOne) SetDeletedAt(t time.Time) *UserUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetFullName

func (uuo *UserUpdateOne) SetFullName(s string) *UserUpdateOne

SetFullName sets the "full_name" field.

func (*UserUpdateOne) SetGender

func (uuo *UserUpdateOne) SetGender(u user.Gender) *UserUpdateOne

SetGender sets the "gender" field.

func (*UserUpdateOne) SetLanguage

func (uuo *UserUpdateOne) SetLanguage(s string) *UserUpdateOne

SetLanguage sets the "language" field.

func (*UserUpdateOne) SetNillableAvatar

func (uuo *UserUpdateOne) SetNillableAvatar(s *string) *UserUpdateOne

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCreatedBy

func (uuo *UserUpdateOne) SetNillableCreatedBy(i *int64) *UserUpdateOne

SetNillableCreatedBy sets the "created_by" field if the given value is not nil.

func (*UserUpdateOne) SetNillableDeletedAt

func (uuo *UserUpdateOne) SetNillableDeletedAt(t *time.Time) *UserUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableFullName

func (uuo *UserUpdateOne) SetNillableFullName(s *string) *UserUpdateOne

SetNillableFullName sets the "full_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableGender

func (uuo *UserUpdateOne) SetNillableGender(u *user.Gender) *UserUpdateOne

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLanguage

func (uuo *UserUpdateOne) SetNillableLanguage(s *string) *UserUpdateOne

SetNillableLanguage sets the "language" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePassword

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhone

func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdateOne) SetNillableStatus

func (uuo *UserUpdateOne) SetNillableStatus(u *user.Status) *UserUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*UserUpdateOne) SetNillableTimezone

func (uuo *UserUpdateOne) SetNillableTimezone(s *string) *UserUpdateOne

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUpdatedBy

func (uuo *UserUpdateOne) SetNillableUpdatedBy(i *int64) *UserUpdateOne

SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername

func (uuo *UserUpdateOne) SetNillableUsername(s *string) *UserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetPhone

func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne

SetPhone sets the "phone" field.

func (*UserUpdateOne) SetStatus

func (uuo *UserUpdateOne) SetStatus(u user.Status) *UserUpdateOne

SetStatus sets the "status" field.

func (*UserUpdateOne) SetTimezone

func (uuo *UserUpdateOne) SetTimezone(s string) *UserUpdateOne

SetTimezone sets the "timezone" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUpdatedBy

func (uuo *UserUpdateOne) SetUpdatedBy(i int64) *UserUpdateOne

SetUpdatedBy sets the "updated_by" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) AddCreatedBy

func (u *UserUpsert) AddCreatedBy(v int64) *UserUpsert

AddCreatedBy adds v to the "created_by" field.

func (*UserUpsert) AddUpdatedBy

func (u *UserUpsert) AddUpdatedBy(v int64) *UserUpsert

AddUpdatedBy adds v to the "updated_by" field.

func (*UserUpsert) ClearAvatar

func (u *UserUpsert) ClearAvatar() *UserUpsert

ClearAvatar clears the value of the "avatar" field.

func (*UserUpsert) ClearCreatedBy

func (u *UserUpsert) ClearCreatedBy() *UserUpsert

ClearCreatedBy clears the value of the "created_by" field.

func (*UserUpsert) ClearDeletedAt

func (u *UserUpsert) ClearDeletedAt() *UserUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsert) ClearEmail

func (u *UserUpsert) ClearEmail() *UserUpsert

ClearEmail clears the value of the "email" field.

func (*UserUpsert) ClearFullName

func (u *UserUpsert) ClearFullName() *UserUpsert

ClearFullName clears the value of the "full_name" field.

func (*UserUpsert) ClearPassword

func (u *UserUpsert) ClearPassword() *UserUpsert

ClearPassword clears the value of the "password" field.

func (*UserUpsert) ClearPhone

func (u *UserUpsert) ClearPhone() *UserUpsert

ClearPhone clears the value of the "phone" field.

func (*UserUpsert) ClearUpdatedBy

func (u *UserUpsert) ClearUpdatedBy() *UserUpsert

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserUpsert) SetAvatar

func (u *UserUpsert) SetAvatar(v string) *UserUpsert

SetAvatar sets the "avatar" field.

func (*UserUpsert) SetCreatedBy

func (u *UserUpsert) SetCreatedBy(v int64) *UserUpsert

SetCreatedBy sets the "created_by" field.

func (*UserUpsert) SetDeletedAt

func (u *UserUpsert) SetDeletedAt(v time.Time) *UserUpsert

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsert) SetEmail

func (u *UserUpsert) SetEmail(v string) *UserUpsert

SetEmail sets the "email" field.

func (*UserUpsert) SetFullName

func (u *UserUpsert) SetFullName(v string) *UserUpsert

SetFullName sets the "full_name" field.

func (*UserUpsert) SetGender

func (u *UserUpsert) SetGender(v user.Gender) *UserUpsert

SetGender sets the "gender" field.

func (*UserUpsert) SetLanguage

func (u *UserUpsert) SetLanguage(v string) *UserUpsert

SetLanguage sets the "language" field.

func (*UserUpsert) SetPassword

func (u *UserUpsert) SetPassword(v string) *UserUpsert

SetPassword sets the "password" field.

func (*UserUpsert) SetPhone

func (u *UserUpsert) SetPhone(v string) *UserUpsert

SetPhone sets the "phone" field.

func (*UserUpsert) SetStatus

func (u *UserUpsert) SetStatus(v user.Status) *UserUpsert

SetStatus sets the "status" field.

func (*UserUpsert) SetTimezone

func (u *UserUpsert) SetTimezone(v string) *UserUpsert

SetTimezone sets the "timezone" field.

func (*UserUpsert) SetUpdatedAt

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) SetUpdatedBy

func (u *UserUpsert) SetUpdatedBy(v int64) *UserUpsert

SetUpdatedBy sets the "updated_by" field.

func (*UserUpsert) SetUsername

func (u *UserUpsert) SetUsername(v string) *UserUpsert

SetUsername sets the "username" field.

func (*UserUpsert) UpdateAvatar

func (u *UserUpsert) UpdateAvatar() *UserUpsert

UpdateAvatar sets the "avatar" field to the value that was provided on create.

func (*UserUpsert) UpdateCreatedBy

func (u *UserUpsert) UpdateCreatedBy() *UserUpsert

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*UserUpsert) UpdateDeletedAt

func (u *UserUpsert) UpdateDeletedAt() *UserUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsert) UpdateEmail

func (u *UserUpsert) UpdateEmail() *UserUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsert) UpdateFullName

func (u *UserUpsert) UpdateFullName() *UserUpsert

UpdateFullName sets the "full_name" field to the value that was provided on create.

func (*UserUpsert) UpdateGender

func (u *UserUpsert) UpdateGender() *UserUpsert

UpdateGender sets the "gender" field to the value that was provided on create.

func (*UserUpsert) UpdateLanguage

func (u *UserUpsert) UpdateLanguage() *UserUpsert

UpdateLanguage sets the "language" field to the value that was provided on create.

func (*UserUpsert) UpdatePassword

func (u *UserUpsert) UpdatePassword() *UserUpsert

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsert) UpdatePhone

func (u *UserUpsert) UpdatePhone() *UserUpsert

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsert) UpdateStatus

func (u *UserUpsert) UpdateStatus() *UserUpsert

UpdateStatus sets the "status" field to the value that was provided on create.

func (*UserUpsert) UpdateTimezone

func (u *UserUpsert) UpdateTimezone() *UserUpsert

UpdateTimezone sets the "timezone" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedAt

func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedBy

func (u *UserUpsert) UpdateUpdatedBy() *UserUpsert

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

func (*UserUpsert) UpdateUsername

func (u *UserUpsert) UpdateUsername() *UserUpsert

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertBulk

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) AddCreatedBy

func (u *UserUpsertBulk) AddCreatedBy(v int64) *UserUpsertBulk

AddCreatedBy adds v to the "created_by" field.

func (*UserUpsertBulk) AddUpdatedBy

func (u *UserUpsertBulk) AddUpdatedBy(v int64) *UserUpsertBulk

AddUpdatedBy adds v to the "updated_by" field.

func (*UserUpsertBulk) ClearAvatar

func (u *UserUpsertBulk) ClearAvatar() *UserUpsertBulk

ClearAvatar clears the value of the "avatar" field.

func (*UserUpsertBulk) ClearCreatedBy

func (u *UserUpsertBulk) ClearCreatedBy() *UserUpsertBulk

ClearCreatedBy clears the value of the "created_by" field.

func (*UserUpsertBulk) ClearDeletedAt

func (u *UserUpsertBulk) ClearDeletedAt() *UserUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsertBulk) ClearEmail

func (u *UserUpsertBulk) ClearEmail() *UserUpsertBulk

ClearEmail clears the value of the "email" field.

func (*UserUpsertBulk) ClearFullName

func (u *UserUpsertBulk) ClearFullName() *UserUpsertBulk

ClearFullName clears the value of the "full_name" field.

func (*UserUpsertBulk) ClearPassword

func (u *UserUpsertBulk) ClearPassword() *UserUpsertBulk

ClearPassword clears the value of the "password" field.

func (*UserUpsertBulk) ClearPhone

func (u *UserUpsertBulk) ClearPhone() *UserUpsertBulk

ClearPhone clears the value of the "phone" field.

func (*UserUpsertBulk) ClearUpdatedBy

func (u *UserUpsertBulk) ClearUpdatedBy() *UserUpsertBulk

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX

func (u *UserUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetAvatar

func (u *UserUpsertBulk) SetAvatar(v string) *UserUpsertBulk

SetAvatar sets the "avatar" field.

func (*UserUpsertBulk) SetCreatedBy

func (u *UserUpsertBulk) SetCreatedBy(v int64) *UserUpsertBulk

SetCreatedBy sets the "created_by" field.

func (*UserUpsertBulk) SetDeletedAt

func (u *UserUpsertBulk) SetDeletedAt(v time.Time) *UserUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsertBulk) SetEmail

func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk

SetEmail sets the "email" field.

func (*UserUpsertBulk) SetFullName

func (u *UserUpsertBulk) SetFullName(v string) *UserUpsertBulk

SetFullName sets the "full_name" field.

func (*UserUpsertBulk) SetGender

func (u *UserUpsertBulk) SetGender(v user.Gender) *UserUpsertBulk

SetGender sets the "gender" field.

func (*UserUpsertBulk) SetLanguage

func (u *UserUpsertBulk) SetLanguage(v string) *UserUpsertBulk

SetLanguage sets the "language" field.

func (*UserUpsertBulk) SetPassword

func (u *UserUpsertBulk) SetPassword(v string) *UserUpsertBulk

SetPassword sets the "password" field.

func (*UserUpsertBulk) SetPhone

func (u *UserUpsertBulk) SetPhone(v string) *UserUpsertBulk

SetPhone sets the "phone" field.

func (*UserUpsertBulk) SetStatus

func (u *UserUpsertBulk) SetStatus(v user.Status) *UserUpsertBulk

SetStatus sets the "status" field.

func (*UserUpsertBulk) SetTimezone

func (u *UserUpsertBulk) SetTimezone(v string) *UserUpsertBulk

SetTimezone sets the "timezone" field.

func (*UserUpsertBulk) SetUpdatedAt

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertBulk) SetUpdatedBy

func (u *UserUpsertBulk) SetUpdatedBy(v int64) *UserUpsertBulk

SetUpdatedBy sets the "updated_by" field.

func (*UserUpsertBulk) SetUsername

func (u *UserUpsertBulk) SetUsername(v string) *UserUpsertBulk

SetUsername sets the "username" field.

func (*UserUpsertBulk) Update

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateAvatar

func (u *UserUpsertBulk) UpdateAvatar() *UserUpsertBulk

UpdateAvatar sets the "avatar" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateCreatedBy

func (u *UserUpsertBulk) UpdateCreatedBy() *UserUpsertBulk

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateDeletedAt

func (u *UserUpsertBulk) UpdateDeletedAt() *UserUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateEmail

func (u *UserUpsertBulk) UpdateEmail() *UserUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateFullName

func (u *UserUpsertBulk) UpdateFullName() *UserUpsertBulk

UpdateFullName sets the "full_name" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateGender

func (u *UserUpsertBulk) UpdateGender() *UserUpsertBulk

UpdateGender sets the "gender" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateLanguage

func (u *UserUpsertBulk) UpdateLanguage() *UserUpsertBulk

UpdateLanguage sets the "language" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdatePassword

func (u *UserUpsertBulk) UpdatePassword() *UserUpsertBulk

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertBulk) UpdatePhone

func (u *UserUpsertBulk) UpdatePhone() *UserUpsertBulk

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateStatus

func (u *UserUpsertBulk) UpdateStatus() *UserUpsertBulk

UpdateStatus sets the "status" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateTimezone

func (u *UserUpsertBulk) UpdateTimezone() *UserUpsertBulk

UpdateTimezone sets the "timezone" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedAt

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedBy

func (u *UserUpsertBulk) UpdateUpdatedBy() *UserUpsertBulk

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUsername

func (u *UserUpsertBulk) UpdateUsername() *UserUpsertBulk

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertOne

type UserUpsertOne struct {
	// contains filtered or unexported fields
}

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) AddCreatedBy

func (u *UserUpsertOne) AddCreatedBy(v int64) *UserUpsertOne

AddCreatedBy adds v to the "created_by" field.

func (*UserUpsertOne) AddUpdatedBy

func (u *UserUpsertOne) AddUpdatedBy(v int64) *UserUpsertOne

AddUpdatedBy adds v to the "updated_by" field.

func (*UserUpsertOne) ClearAvatar

func (u *UserUpsertOne) ClearAvatar() *UserUpsertOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpsertOne) ClearCreatedBy

func (u *UserUpsertOne) ClearCreatedBy() *UserUpsertOne

ClearCreatedBy clears the value of the "created_by" field.

func (*UserUpsertOne) ClearDeletedAt

func (u *UserUpsertOne) ClearDeletedAt() *UserUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsertOne) ClearEmail

func (u *UserUpsertOne) ClearEmail() *UserUpsertOne

ClearEmail clears the value of the "email" field.

func (*UserUpsertOne) ClearFullName

func (u *UserUpsertOne) ClearFullName() *UserUpsertOne

ClearFullName clears the value of the "full_name" field.

func (*UserUpsertOne) ClearPassword

func (u *UserUpsertOne) ClearPassword() *UserUpsertOne

ClearPassword clears the value of the "password" field.

func (*UserUpsertOne) ClearPhone

func (u *UserUpsertOne) ClearPhone() *UserUpsertOne

ClearPhone clears the value of the "phone" field.

func (*UserUpsertOne) ClearUpdatedBy

func (u *UserUpsertOne) ClearUpdatedBy() *UserUpsertOne

ClearUpdatedBy clears the value of the "updated_by" field.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX

func (u *UserUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertOne) ID

func (u *UserUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetAvatar

func (u *UserUpsertOne) SetAvatar(v string) *UserUpsertOne

SetAvatar sets the "avatar" field.

func (*UserUpsertOne) SetCreatedBy

func (u *UserUpsertOne) SetCreatedBy(v int64) *UserUpsertOne

SetCreatedBy sets the "created_by" field.

func (*UserUpsertOne) SetDeletedAt

func (u *UserUpsertOne) SetDeletedAt(v time.Time) *UserUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsertOne) SetEmail

func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne

SetEmail sets the "email" field.

func (*UserUpsertOne) SetFullName

func (u *UserUpsertOne) SetFullName(v string) *UserUpsertOne

SetFullName sets the "full_name" field.

func (*UserUpsertOne) SetGender

func (u *UserUpsertOne) SetGender(v user.Gender) *UserUpsertOne

SetGender sets the "gender" field.

func (*UserUpsertOne) SetLanguage

func (u *UserUpsertOne) SetLanguage(v string) *UserUpsertOne

SetLanguage sets the "language" field.

func (*UserUpsertOne) SetPassword

func (u *UserUpsertOne) SetPassword(v string) *UserUpsertOne

SetPassword sets the "password" field.

func (*UserUpsertOne) SetPhone

func (u *UserUpsertOne) SetPhone(v string) *UserUpsertOne

SetPhone sets the "phone" field.

func (*UserUpsertOne) SetStatus

func (u *UserUpsertOne) SetStatus(v user.Status) *UserUpsertOne

SetStatus sets the "status" field.

func (*UserUpsertOne) SetTimezone

func (u *UserUpsertOne) SetTimezone(v string) *UserUpsertOne

SetTimezone sets the "timezone" field.

func (*UserUpsertOne) SetUpdatedAt

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertOne) SetUpdatedBy

func (u *UserUpsertOne) SetUpdatedBy(v int64) *UserUpsertOne

SetUpdatedBy sets the "updated_by" field.

func (*UserUpsertOne) SetUsername

func (u *UserUpsertOne) SetUsername(v string) *UserUpsertOne

SetUsername sets the "username" field.

func (*UserUpsertOne) Update

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateAvatar

func (u *UserUpsertOne) UpdateAvatar() *UserUpsertOne

UpdateAvatar sets the "avatar" field to the value that was provided on create.

func (*UserUpsertOne) UpdateCreatedBy

func (u *UserUpsertOne) UpdateCreatedBy() *UserUpsertOne

UpdateCreatedBy sets the "created_by" field to the value that was provided on create.

func (*UserUpsertOne) UpdateDeletedAt

func (u *UserUpsertOne) UpdateDeletedAt() *UserUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateEmail

func (u *UserUpsertOne) UpdateEmail() *UserUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertOne) UpdateFullName

func (u *UserUpsertOne) UpdateFullName() *UserUpsertOne

UpdateFullName sets the "full_name" field to the value that was provided on create.

func (*UserUpsertOne) UpdateGender

func (u *UserUpsertOne) UpdateGender() *UserUpsertOne

UpdateGender sets the "gender" field to the value that was provided on create.

func (*UserUpsertOne) UpdateLanguage

func (u *UserUpsertOne) UpdateLanguage() *UserUpsertOne

UpdateLanguage sets the "language" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdatePassword

func (u *UserUpsertOne) UpdatePassword() *UserUpsertOne

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertOne) UpdatePhone

func (u *UserUpsertOne) UpdatePhone() *UserUpsertOne

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsertOne) UpdateStatus

func (u *UserUpsertOne) UpdateStatus() *UserUpsertOne

UpdateStatus sets the "status" field to the value that was provided on create.

func (*UserUpsertOne) UpdateTimezone

func (u *UserUpsertOne) UpdateTimezone() *UserUpsertOne

UpdateTimezone sets the "timezone" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedAt

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedBy

func (u *UserUpsertOne) UpdateUpdatedBy() *UserUpsertOne

UpdateUpdatedBy sets the "updated_by" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUsername

func (u *UserUpsertOne) UpdateUsername() *UserUpsertOne

UpdateUsername sets the "username" field to the value that was provided on create.

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
ent/schema/casbin_rule.go
ent/schema/casbin_rule.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL