ent

package
v0.0.0-...-2c00ec0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 20 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.
	TypeOrg         = "Org"
	TypeRole        = "Role"
	TypeRoleBinding = "RoleBinding"
	TypeUser        = "User"
)

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Org is the client for interacting with the Org builders.
	Org *OrgClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// RoleBinding is the client for interacting with the RoleBinding builders.
	RoleBinding *RoleBindingClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	Org.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Org

type Org struct {

	// ID of the ent.
	// ID
	ID string `json:"id,omitempty"`
	// delete time stamp
	DeleteTime int64 `json:"delete_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// 组织名称
	Name string `json:"name,omitempty"`
	// 显示名称
	DisplayName string `json:"display_name,omitempty"`
	// 描述
	Description string `json:"description,omitempty"`
	Logo string `json:"logo,omitempty"`
	// 状态
	Status string `json:"status,omitempty"`
	// 类型
	Type string `json:"type,omitempty"`
	// contains filtered or unexported fields
}

Org is the model entity for the Org schema.

func (*Org) String

func (o *Org) String() string

String implements the fmt.Stringer.

func (*Org) Unwrap

func (o *Org) Unwrap() *Org

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

func (o *Org) Update() *OrgUpdateOne

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

func (*Org) Value

func (o *Org) Value(name string) (ent.Value, error)

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

type OrgClient

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

OrgClient is a client for the Org schema.

func NewOrgClient

func NewOrgClient(c config) *OrgClient

NewOrgClient returns a client for the Org from the given config.

func (*OrgClient) Create

func (c *OrgClient) Create() *OrgCreate

Create returns a builder for creating a Org entity.

func (*OrgClient) CreateBulk

func (c *OrgClient) CreateBulk(builders ...*OrgCreate) *OrgCreateBulk

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

func (*OrgClient) Delete

func (c *OrgClient) Delete() *OrgDelete

Delete returns a delete builder for Org.

func (*OrgClient) DeleteOne

func (c *OrgClient) DeleteOne(o *Org) *OrgDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*OrgClient) DeleteOneID

func (c *OrgClient) DeleteOneID(id string) *OrgDeleteOne

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

func (*OrgClient) Get

func (c *OrgClient) Get(ctx context.Context, id string) (*Org, error)

Get returns a Org entity by its id.

func (*OrgClient) GetX

func (c *OrgClient) GetX(ctx context.Context, id string) *Org

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

func (*OrgClient) Hooks

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

Hooks returns the client hooks.

func (*OrgClient) Intercept

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

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

func (*OrgClient) Interceptors

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

Interceptors returns the client interceptors.

func (*OrgClient) MapCreateBulk

func (c *OrgClient) MapCreateBulk(slice any, setFunc func(*OrgCreate, int)) *OrgCreateBulk

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

func (c *OrgClient) Query() *OrgQuery

Query returns a query builder for Org.

func (*OrgClient) Update

func (c *OrgClient) Update() *OrgUpdate

Update returns an update builder for Org.

func (*OrgClient) UpdateOne

func (c *OrgClient) UpdateOne(o *Org) *OrgUpdateOne

UpdateOne returns an update builder for the given entity.

func (*OrgClient) UpdateOneID

func (c *OrgClient) UpdateOneID(id string) *OrgUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OrgClient) Use

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

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

type OrgCreate

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

OrgCreate is the builder for creating a Org entity.

func (*OrgCreate) Exec

func (oc *OrgCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrgCreate) ExecX

func (oc *OrgCreate) ExecX(ctx context.Context)

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

func (*OrgCreate) Mutation

func (oc *OrgCreate) Mutation() *OrgMutation

Mutation returns the OrgMutation object of the builder.

func (*OrgCreate) Save

func (oc *OrgCreate) Save(ctx context.Context) (*Org, error)

Save creates the Org in the database.

func (*OrgCreate) SaveX

func (oc *OrgCreate) SaveX(ctx context.Context) *Org

SaveX calls Save and panics if Save returns an error.

func (*OrgCreate) SetCreateTime

func (oc *OrgCreate) SetCreateTime(t time.Time) *OrgCreate

SetCreateTime sets the "create_time" field.

func (*OrgCreate) SetDeleteTime

func (oc *OrgCreate) SetDeleteTime(i int64) *OrgCreate

SetDeleteTime sets the "delete_time" field.

func (*OrgCreate) SetDescription

func (oc *OrgCreate) SetDescription(s string) *OrgCreate

SetDescription sets the "description" field.

func (*OrgCreate) SetDisplayName

func (oc *OrgCreate) SetDisplayName(s string) *OrgCreate

SetDisplayName sets the "display_name" field.

func (*OrgCreate) SetID

func (oc *OrgCreate) SetID(s string) *OrgCreate

SetID sets the "id" field.

func (oc *OrgCreate) SetLogo(s string) *OrgCreate

SetLogo sets the "logo" field.

func (*OrgCreate) SetName

func (oc *OrgCreate) SetName(s string) *OrgCreate

SetName sets the "name" field.

func (*OrgCreate) SetNillableCreateTime

func (oc *OrgCreate) SetNillableCreateTime(t *time.Time) *OrgCreate

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

func (*OrgCreate) SetNillableDeleteTime

func (oc *OrgCreate) SetNillableDeleteTime(i *int64) *OrgCreate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*OrgCreate) SetNillableDescription

func (oc *OrgCreate) SetNillableDescription(s *string) *OrgCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*OrgCreate) SetNillableDisplayName

func (oc *OrgCreate) SetNillableDisplayName(s *string) *OrgCreate

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

func (*OrgCreate) SetNillableID

func (oc *OrgCreate) SetNillableID(s *string) *OrgCreate

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

func (*OrgCreate) SetNillableUpdateTime

func (oc *OrgCreate) SetNillableUpdateTime(t *time.Time) *OrgCreate

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

func (*OrgCreate) SetStatus

func (oc *OrgCreate) SetStatus(s string) *OrgCreate

SetStatus sets the "status" field.

func (*OrgCreate) SetType

func (oc *OrgCreate) SetType(s string) *OrgCreate

SetType sets the "type" field.

func (*OrgCreate) SetUpdateTime

func (oc *OrgCreate) SetUpdateTime(t time.Time) *OrgCreate

SetUpdateTime sets the "update_time" field.

type OrgCreateBulk

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

OrgCreateBulk is the builder for creating many Org entities in bulk.

func (*OrgCreateBulk) Exec

func (ocb *OrgCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*OrgCreateBulk) ExecX

func (ocb *OrgCreateBulk) ExecX(ctx context.Context)

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

func (*OrgCreateBulk) Save

func (ocb *OrgCreateBulk) Save(ctx context.Context) ([]*Org, error)

Save creates the Org entities in the database.

func (*OrgCreateBulk) SaveX

func (ocb *OrgCreateBulk) SaveX(ctx context.Context) []*Org

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

type OrgDelete

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

OrgDelete is the builder for deleting a Org entity.

func (*OrgDelete) Exec

func (od *OrgDelete) Exec(ctx context.Context) (int, error)

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

func (*OrgDelete) ExecX

func (od *OrgDelete) ExecX(ctx context.Context) int

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

func (*OrgDelete) Where

func (od *OrgDelete) Where(ps ...predicate.Org) *OrgDelete

Where appends a list predicates to the OrgDelete builder.

type OrgDeleteOne

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

OrgDeleteOne is the builder for deleting a single Org entity.

func (*OrgDeleteOne) Exec

func (odo *OrgDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OrgDeleteOne) ExecX

func (odo *OrgDeleteOne) ExecX(ctx context.Context)

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

func (*OrgDeleteOne) Where

func (odo *OrgDeleteOne) Where(ps ...predicate.Org) *OrgDeleteOne

Where appends a list predicates to the OrgDelete builder.

type OrgGroupBy

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

OrgGroupBy is the group-by builder for Org entities.

func (*OrgGroupBy) Aggregate

func (ogb *OrgGroupBy) Aggregate(fns ...AggregateFunc) *OrgGroupBy

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

func (*OrgGroupBy) Bool

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

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

func (*OrgGroupBy) BoolX

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

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

func (*OrgGroupBy) Bools

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

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

func (*OrgGroupBy) BoolsX

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

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

func (*OrgGroupBy) Float64

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

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

func (*OrgGroupBy) Float64X

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

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

func (*OrgGroupBy) Float64s

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

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

func (*OrgGroupBy) Float64sX

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

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

func (*OrgGroupBy) Int

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

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

func (*OrgGroupBy) IntX

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

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

func (*OrgGroupBy) Ints

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

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

func (*OrgGroupBy) IntsX

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

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

func (*OrgGroupBy) Scan

func (ogb *OrgGroupBy) Scan(ctx context.Context, v any) error

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

func (*OrgGroupBy) ScanX

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

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

func (*OrgGroupBy) String

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

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

func (*OrgGroupBy) StringX

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

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

func (*OrgGroupBy) Strings

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

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

func (*OrgGroupBy) StringsX

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

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

type OrgMutation

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

OrgMutation represents an operation that mutates the Org nodes in the graph.

func (*OrgMutation) AddDeleteTime

func (m *OrgMutation) AddDeleteTime(i int64)

AddDeleteTime adds i to the "delete_time" field.

func (*OrgMutation) AddField

func (m *OrgMutation) 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 (*OrgMutation) AddedDeleteTime

func (m *OrgMutation) AddedDeleteTime() (r int64, exists bool)

AddedDeleteTime returns the value that was added to the "delete_time" field in this mutation.

func (*OrgMutation) AddedEdges

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

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

func (*OrgMutation) AddedField

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

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

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

func (*OrgMutation) AddedIDs

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

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

func (*OrgMutation) ClearDescription

func (m *OrgMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*OrgMutation) ClearDisplayName

func (m *OrgMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" field.

func (*OrgMutation) ClearEdge

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

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

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

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

func (*OrgMutation) ClearedFields

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

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

func (OrgMutation) Client

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

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

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

func (*OrgMutation) DeleteTime

func (m *OrgMutation) DeleteTime() (r int64, exists bool)

DeleteTime returns the value of the "delete_time" field in the mutation.

func (*OrgMutation) Description

func (m *OrgMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*OrgMutation) DescriptionCleared

func (m *OrgMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*OrgMutation) DisplayName

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

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

func (*OrgMutation) DisplayNameCleared

func (m *OrgMutation) DisplayNameCleared() bool

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

func (*OrgMutation) EdgeCleared

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

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

func (*OrgMutation) Field

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

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

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

func (*OrgMutation) Fields

func (m *OrgMutation) 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 (*OrgMutation) GetType

func (m *OrgMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*OrgMutation) ID

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

func (m *OrgMutation) IDs(ctx context.Context) ([]string, 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 (m *OrgMutation) Logo() (r string, exists bool)

Logo returns the value of the "logo" field in the mutation.

func (*OrgMutation) Name

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

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

func (*OrgMutation) OldCreateTime

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

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

func (m *OrgMutation) OldDeleteTime(ctx context.Context) (v int64, err error)

OldDeleteTime returns the old "delete_time" field's value of the Org entity. If the Org 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 (*OrgMutation) OldDescription

func (m *OrgMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Org entity. If the Org 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 (*OrgMutation) OldDisplayName

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

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

func (m *OrgMutation) 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 (m *OrgMutation) OldLogo(ctx context.Context) (v string, err error)

OldLogo returns the old "logo" field's value of the Org entity. If the Org 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 (*OrgMutation) OldName

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

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

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

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

func (m *OrgMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Org entity. If the Org 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 (*OrgMutation) OldUpdateTime

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

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

func (m *OrgMutation) Op() Op

Op returns the operation name.

func (*OrgMutation) RemovedEdges

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

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

func (*OrgMutation) RemovedIDs

func (m *OrgMutation) 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 (*OrgMutation) ResetCreateTime

func (m *OrgMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*OrgMutation) ResetDeleteTime

func (m *OrgMutation) ResetDeleteTime()

ResetDeleteTime resets all changes to the "delete_time" field.

func (*OrgMutation) ResetDescription

func (m *OrgMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*OrgMutation) ResetDisplayName

func (m *OrgMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*OrgMutation) ResetEdge

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

func (m *OrgMutation) 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 (m *OrgMutation) ResetLogo()

ResetLogo resets all changes to the "logo" field.

func (*OrgMutation) ResetName

func (m *OrgMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*OrgMutation) ResetStatus

func (m *OrgMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*OrgMutation) ResetType

func (m *OrgMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*OrgMutation) ResetUpdateTime

func (m *OrgMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*OrgMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*OrgMutation) SetDeleteTime

func (m *OrgMutation) SetDeleteTime(i int64)

SetDeleteTime sets the "delete_time" field.

func (*OrgMutation) SetDescription

func (m *OrgMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*OrgMutation) SetDisplayName

func (m *OrgMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" field.

func (*OrgMutation) SetField

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

func (m *OrgMutation) SetID(id string)

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

func (m *OrgMutation) SetLogo(s string)

SetLogo sets the "logo" field.

func (*OrgMutation) SetName

func (m *OrgMutation) SetName(s string)

SetName sets the "name" field.

func (*OrgMutation) SetOp

func (m *OrgMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*OrgMutation) SetStatus

func (m *OrgMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*OrgMutation) SetType

func (m *OrgMutation) SetType(s string)

SetType sets the "type" field.

func (*OrgMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*OrgMutation) Status

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

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

func (OrgMutation) Tx

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

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

func (*OrgMutation) Type

func (m *OrgMutation) Type() string

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

func (*OrgMutation) UpdateTime

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

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

func (*OrgMutation) Where

func (m *OrgMutation) Where(ps ...predicate.Org)

Where appends a list predicates to the OrgMutation builder.

func (*OrgMutation) WhereP

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

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

type OrgQuery

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

OrgQuery is the builder for querying Org entities.

func (*OrgQuery) Aggregate

func (oq *OrgQuery) Aggregate(fns ...AggregateFunc) *OrgSelect

Aggregate returns a OrgSelect configured with the given aggregations.

func (*OrgQuery) All

func (oq *OrgQuery) All(ctx context.Context) ([]*Org, error)

All executes the query and returns a list of Orgs.

func (*OrgQuery) AllX

func (oq *OrgQuery) AllX(ctx context.Context) []*Org

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

func (*OrgQuery) Clone

func (oq *OrgQuery) Clone() *OrgQuery

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

func (*OrgQuery) Count

func (oq *OrgQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OrgQuery) CountX

func (oq *OrgQuery) CountX(ctx context.Context) int

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

func (*OrgQuery) Exist

func (oq *OrgQuery) Exist(ctx context.Context) (bool, error)

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

func (*OrgQuery) ExistX

func (oq *OrgQuery) ExistX(ctx context.Context) bool

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

func (*OrgQuery) First

func (oq *OrgQuery) First(ctx context.Context) (*Org, error)

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

func (*OrgQuery) FirstID

func (oq *OrgQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*OrgQuery) FirstIDX

func (oq *OrgQuery) FirstIDX(ctx context.Context) string

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

func (*OrgQuery) FirstX

func (oq *OrgQuery) FirstX(ctx context.Context) *Org

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

func (*OrgQuery) GroupBy

func (oq *OrgQuery) GroupBy(field string, fields ...string) *OrgGroupBy

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

client.Org.Query().
	GroupBy(org.FieldDeleteTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OrgQuery) IDs

func (oq *OrgQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*OrgQuery) IDsX

func (oq *OrgQuery) IDsX(ctx context.Context) []string

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

func (*OrgQuery) Limit

func (oq *OrgQuery) Limit(limit int) *OrgQuery

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

func (*OrgQuery) Offset

func (oq *OrgQuery) Offset(offset int) *OrgQuery

Offset to start from.

func (*OrgQuery) Only

func (oq *OrgQuery) Only(ctx context.Context) (*Org, error)

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

func (*OrgQuery) OnlyID

func (oq *OrgQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*OrgQuery) OnlyIDX

func (oq *OrgQuery) OnlyIDX(ctx context.Context) string

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

func (*OrgQuery) OnlyX

func (oq *OrgQuery) OnlyX(ctx context.Context) *Org

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

func (*OrgQuery) Order

func (oq *OrgQuery) Order(o ...org.OrderOption) *OrgQuery

Order specifies how the records should be ordered.

func (*OrgQuery) Select

func (oq *OrgQuery) Select(fields ...string) *OrgSelect

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

client.Org.Query().
	Select(org.FieldDeleteTime).
	Scan(ctx, &v)

func (*OrgQuery) Unique

func (oq *OrgQuery) Unique(unique bool) *OrgQuery

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

func (oq *OrgQuery) Where(ps ...predicate.Org) *OrgQuery

Where adds a new predicate for the OrgQuery builder.

type OrgSelect

type OrgSelect struct {
	*OrgQuery
	// contains filtered or unexported fields
}

OrgSelect is the builder for selecting fields of Org entities.

func (*OrgSelect) Aggregate

func (os *OrgSelect) Aggregate(fns ...AggregateFunc) *OrgSelect

Aggregate adds the given aggregation functions to the selector query.

func (*OrgSelect) Bool

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

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

func (*OrgSelect) BoolX

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

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

func (*OrgSelect) Bools

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

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

func (*OrgSelect) BoolsX

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

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

func (*OrgSelect) Float64

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

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

func (*OrgSelect) Float64X

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

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

func (*OrgSelect) Float64s

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

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

func (*OrgSelect) Float64sX

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

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

func (*OrgSelect) Int

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

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

func (*OrgSelect) IntX

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

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

func (*OrgSelect) Ints

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

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

func (*OrgSelect) IntsX

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

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

func (*OrgSelect) Scan

func (os *OrgSelect) Scan(ctx context.Context, v any) error

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

func (*OrgSelect) ScanX

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

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

func (*OrgSelect) String

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

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

func (*OrgSelect) StringX

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

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

func (*OrgSelect) Strings

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

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

func (*OrgSelect) StringsX

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

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

type OrgUpdate

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

OrgUpdate is the builder for updating Org entities.

func (*OrgUpdate) AddDeleteTime

func (ou *OrgUpdate) AddDeleteTime(i int64) *OrgUpdate

AddDeleteTime adds i to the "delete_time" field.

func (*OrgUpdate) ClearDescription

func (ou *OrgUpdate) ClearDescription() *OrgUpdate

ClearDescription clears the value of the "description" field.

func (*OrgUpdate) ClearDisplayName

func (ou *OrgUpdate) ClearDisplayName() *OrgUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*OrgUpdate) Exec

func (ou *OrgUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrgUpdate) ExecX

func (ou *OrgUpdate) ExecX(ctx context.Context)

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

func (*OrgUpdate) Mutation

func (ou *OrgUpdate) Mutation() *OrgMutation

Mutation returns the OrgMutation object of the builder.

func (*OrgUpdate) Save

func (ou *OrgUpdate) Save(ctx context.Context) (int, error)

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

func (*OrgUpdate) SaveX

func (ou *OrgUpdate) SaveX(ctx context.Context) int

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

func (*OrgUpdate) SetDeleteTime

func (ou *OrgUpdate) SetDeleteTime(i int64) *OrgUpdate

SetDeleteTime sets the "delete_time" field.

func (*OrgUpdate) SetDescription

func (ou *OrgUpdate) SetDescription(s string) *OrgUpdate

SetDescription sets the "description" field.

func (*OrgUpdate) SetDisplayName

func (ou *OrgUpdate) SetDisplayName(s string) *OrgUpdate

SetDisplayName sets the "display_name" field.

func (ou *OrgUpdate) SetLogo(s string) *OrgUpdate

SetLogo sets the "logo" field.

func (*OrgUpdate) SetName

func (ou *OrgUpdate) SetName(s string) *OrgUpdate

SetName sets the "name" field.

func (*OrgUpdate) SetNillableDeleteTime

func (ou *OrgUpdate) SetNillableDeleteTime(i *int64) *OrgUpdate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*OrgUpdate) SetNillableDescription

func (ou *OrgUpdate) SetNillableDescription(s *string) *OrgUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*OrgUpdate) SetNillableDisplayName

func (ou *OrgUpdate) SetNillableDisplayName(s *string) *OrgUpdate

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

func (ou *OrgUpdate) SetNillableLogo(s *string) *OrgUpdate

SetNillableLogo sets the "logo" field if the given value is not nil.

func (*OrgUpdate) SetNillableName

func (ou *OrgUpdate) SetNillableName(s *string) *OrgUpdate

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

func (*OrgUpdate) SetNillableStatus

func (ou *OrgUpdate) SetNillableStatus(s *string) *OrgUpdate

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

func (*OrgUpdate) SetNillableType

func (ou *OrgUpdate) SetNillableType(s *string) *OrgUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*OrgUpdate) SetStatus

func (ou *OrgUpdate) SetStatus(s string) *OrgUpdate

SetStatus sets the "status" field.

func (*OrgUpdate) SetType

func (ou *OrgUpdate) SetType(s string) *OrgUpdate

SetType sets the "type" field.

func (*OrgUpdate) SetUpdateTime

func (ou *OrgUpdate) SetUpdateTime(t time.Time) *OrgUpdate

SetUpdateTime sets the "update_time" field.

func (*OrgUpdate) Where

func (ou *OrgUpdate) Where(ps ...predicate.Org) *OrgUpdate

Where appends a list predicates to the OrgUpdate builder.

type OrgUpdateOne

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

OrgUpdateOne is the builder for updating a single Org entity.

func (*OrgUpdateOne) AddDeleteTime

func (ouo *OrgUpdateOne) AddDeleteTime(i int64) *OrgUpdateOne

AddDeleteTime adds i to the "delete_time" field.

func (*OrgUpdateOne) ClearDescription

func (ouo *OrgUpdateOne) ClearDescription() *OrgUpdateOne

ClearDescription clears the value of the "description" field.

func (*OrgUpdateOne) ClearDisplayName

func (ouo *OrgUpdateOne) ClearDisplayName() *OrgUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*OrgUpdateOne) Exec

func (ouo *OrgUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OrgUpdateOne) ExecX

func (ouo *OrgUpdateOne) ExecX(ctx context.Context)

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

func (*OrgUpdateOne) Mutation

func (ouo *OrgUpdateOne) Mutation() *OrgMutation

Mutation returns the OrgMutation object of the builder.

func (*OrgUpdateOne) Save

func (ouo *OrgUpdateOne) Save(ctx context.Context) (*Org, error)

Save executes the query and returns the updated Org entity.

func (*OrgUpdateOne) SaveX

func (ouo *OrgUpdateOne) SaveX(ctx context.Context) *Org

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

func (*OrgUpdateOne) Select

func (ouo *OrgUpdateOne) Select(field string, fields ...string) *OrgUpdateOne

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

func (*OrgUpdateOne) SetDeleteTime

func (ouo *OrgUpdateOne) SetDeleteTime(i int64) *OrgUpdateOne

SetDeleteTime sets the "delete_time" field.

func (*OrgUpdateOne) SetDescription

func (ouo *OrgUpdateOne) SetDescription(s string) *OrgUpdateOne

SetDescription sets the "description" field.

func (*OrgUpdateOne) SetDisplayName

func (ouo *OrgUpdateOne) SetDisplayName(s string) *OrgUpdateOne

SetDisplayName sets the "display_name" field.

func (ouo *OrgUpdateOne) SetLogo(s string) *OrgUpdateOne

SetLogo sets the "logo" field.

func (*OrgUpdateOne) SetName

func (ouo *OrgUpdateOne) SetName(s string) *OrgUpdateOne

SetName sets the "name" field.

func (*OrgUpdateOne) SetNillableDeleteTime

func (ouo *OrgUpdateOne) SetNillableDeleteTime(i *int64) *OrgUpdateOne

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*OrgUpdateOne) SetNillableDescription

func (ouo *OrgUpdateOne) SetNillableDescription(s *string) *OrgUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*OrgUpdateOne) SetNillableDisplayName

func (ouo *OrgUpdateOne) SetNillableDisplayName(s *string) *OrgUpdateOne

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

func (ouo *OrgUpdateOne) SetNillableLogo(s *string) *OrgUpdateOne

SetNillableLogo sets the "logo" field if the given value is not nil.

func (*OrgUpdateOne) SetNillableName

func (ouo *OrgUpdateOne) SetNillableName(s *string) *OrgUpdateOne

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

func (*OrgUpdateOne) SetNillableStatus

func (ouo *OrgUpdateOne) SetNillableStatus(s *string) *OrgUpdateOne

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

func (*OrgUpdateOne) SetNillableType

func (ouo *OrgUpdateOne) SetNillableType(s *string) *OrgUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*OrgUpdateOne) SetStatus

func (ouo *OrgUpdateOne) SetStatus(s string) *OrgUpdateOne

SetStatus sets the "status" field.

func (*OrgUpdateOne) SetType

func (ouo *OrgUpdateOne) SetType(s string) *OrgUpdateOne

SetType sets the "type" field.

func (*OrgUpdateOne) SetUpdateTime

func (ouo *OrgUpdateOne) SetUpdateTime(t time.Time) *OrgUpdateOne

SetUpdateTime sets the "update_time" field.

func (*OrgUpdateOne) Where

func (ouo *OrgUpdateOne) Where(ps ...predicate.Org) *OrgUpdateOne

Where appends a list predicates to the OrgUpdate builder.

type Orgs

type Orgs []*Org

Orgs is a parsable slice of Org.

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
	ID string `json:"id,omitempty"`
	// delete time stamp
	DeleteTime int64 `json:"delete_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// 角色名称
	Name string `json:"name,omitempty"`
	// 角色显示名称
	DisplayName string `json:"display_name,omitempty"`
	// 角色描述
	Remark string `json:"remark,omitempty"`
	// 删除标志(0代表存在)
	DeletedTime int64 `json:"deleted_time,omitempty"`
	// contains filtered or unexported fields
}

Role is the model entity for the Role schema.

func (*Role) String

func (r *Role) String() string

String implements the fmt.Stringer.

func (*Role) Unwrap

func (r *Role) Unwrap() *Role

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

func (*Role) Update

func (r *Role) Update() *RoleUpdateOne

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

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 RoleBinding

type RoleBinding struct {

	// ID of the ent.
	// ID
	ID string `json:"id,omitempty"`
	// delete time stamp
	DeleteTime int64 `json:"delete_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// 角色名称
	Name string `json:"name,omitempty"`
	// 角色显示名称
	DisplayName string `json:"display_name,omitempty"`
	// 角色名称
	RoleName string `json:"role_name,omitempty"`
	// 用户名称
	UserID string `json:"user_id,omitempty"`
	// 删除标志(0代表存在)
	DeletedTime int64 `json:"deleted_time,omitempty"`
	// contains filtered or unexported fields
}

RoleBinding is the model entity for the RoleBinding schema.

func (*RoleBinding) String

func (rb *RoleBinding) String() string

String implements the fmt.Stringer.

func (*RoleBinding) Unwrap

func (rb *RoleBinding) Unwrap() *RoleBinding

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

func (rb *RoleBinding) Update() *RoleBindingUpdateOne

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

func (*RoleBinding) Value

func (rb *RoleBinding) Value(name string) (ent.Value, error)

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

type RoleBindingClient

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

RoleBindingClient is a client for the RoleBinding schema.

func NewRoleBindingClient

func NewRoleBindingClient(c config) *RoleBindingClient

NewRoleBindingClient returns a client for the RoleBinding from the given config.

func (*RoleBindingClient) Create

func (c *RoleBindingClient) Create() *RoleBindingCreate

Create returns a builder for creating a RoleBinding entity.

func (*RoleBindingClient) CreateBulk

func (c *RoleBindingClient) CreateBulk(builders ...*RoleBindingCreate) *RoleBindingCreateBulk

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

func (*RoleBindingClient) Delete

func (c *RoleBindingClient) Delete() *RoleBindingDelete

Delete returns a delete builder for RoleBinding.

func (*RoleBindingClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RoleBindingClient) DeleteOneID

func (c *RoleBindingClient) DeleteOneID(id string) *RoleBindingDeleteOne

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

func (*RoleBindingClient) Get

Get returns a RoleBinding entity by its id.

func (*RoleBindingClient) GetX

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

func (*RoleBindingClient) Hooks

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

Hooks returns the client hooks.

func (*RoleBindingClient) Intercept

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

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

func (*RoleBindingClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RoleBindingClient) MapCreateBulk

func (c *RoleBindingClient) MapCreateBulk(slice any, setFunc func(*RoleBindingCreate, int)) *RoleBindingCreateBulk

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

func (c *RoleBindingClient) Query() *RoleBindingQuery

Query returns a query builder for RoleBinding.

func (*RoleBindingClient) Update

func (c *RoleBindingClient) Update() *RoleBindingUpdate

Update returns an update builder for RoleBinding.

func (*RoleBindingClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*RoleBindingClient) UpdateOneID

func (c *RoleBindingClient) UpdateOneID(id string) *RoleBindingUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RoleBindingClient) Use

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

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

type RoleBindingCreate

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

RoleBindingCreate is the builder for creating a RoleBinding entity.

func (*RoleBindingCreate) Exec

func (rbc *RoleBindingCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleBindingCreate) ExecX

func (rbc *RoleBindingCreate) ExecX(ctx context.Context)

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

func (*RoleBindingCreate) Mutation

func (rbc *RoleBindingCreate) Mutation() *RoleBindingMutation

Mutation returns the RoleBindingMutation object of the builder.

func (*RoleBindingCreate) Save

func (rbc *RoleBindingCreate) Save(ctx context.Context) (*RoleBinding, error)

Save creates the RoleBinding in the database.

func (*RoleBindingCreate) SaveX

func (rbc *RoleBindingCreate) SaveX(ctx context.Context) *RoleBinding

SaveX calls Save and panics if Save returns an error.

func (*RoleBindingCreate) SetCreateTime

func (rbc *RoleBindingCreate) SetCreateTime(t time.Time) *RoleBindingCreate

SetCreateTime sets the "create_time" field.

func (*RoleBindingCreate) SetDeleteTime

func (rbc *RoleBindingCreate) SetDeleteTime(i int64) *RoleBindingCreate

SetDeleteTime sets the "delete_time" field.

func (*RoleBindingCreate) SetDeletedTime

func (rbc *RoleBindingCreate) SetDeletedTime(i int64) *RoleBindingCreate

SetDeletedTime sets the "deleted_time" field.

func (*RoleBindingCreate) SetDisplayName

func (rbc *RoleBindingCreate) SetDisplayName(s string) *RoleBindingCreate

SetDisplayName sets the "display_name" field.

func (*RoleBindingCreate) SetID

SetID sets the "id" field.

func (*RoleBindingCreate) SetName

func (rbc *RoleBindingCreate) SetName(s string) *RoleBindingCreate

SetName sets the "name" field.

func (*RoleBindingCreate) SetNillableCreateTime

func (rbc *RoleBindingCreate) SetNillableCreateTime(t *time.Time) *RoleBindingCreate

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

func (*RoleBindingCreate) SetNillableDeleteTime

func (rbc *RoleBindingCreate) SetNillableDeleteTime(i *int64) *RoleBindingCreate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleBindingCreate) SetNillableDeletedTime

func (rbc *RoleBindingCreate) SetNillableDeletedTime(i *int64) *RoleBindingCreate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*RoleBindingCreate) SetNillableDisplayName

func (rbc *RoleBindingCreate) SetNillableDisplayName(s *string) *RoleBindingCreate

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

func (*RoleBindingCreate) SetNillableID

func (rbc *RoleBindingCreate) SetNillableID(s *string) *RoleBindingCreate

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

func (*RoleBindingCreate) SetNillableUpdateTime

func (rbc *RoleBindingCreate) SetNillableUpdateTime(t *time.Time) *RoleBindingCreate

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

func (*RoleBindingCreate) SetRoleName

func (rbc *RoleBindingCreate) SetRoleName(s string) *RoleBindingCreate

SetRoleName sets the "role_name" field.

func (*RoleBindingCreate) SetUpdateTime

func (rbc *RoleBindingCreate) SetUpdateTime(t time.Time) *RoleBindingCreate

SetUpdateTime sets the "update_time" field.

func (*RoleBindingCreate) SetUserID

func (rbc *RoleBindingCreate) SetUserID(s string) *RoleBindingCreate

SetUserID sets the "user_id" field.

type RoleBindingCreateBulk

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

RoleBindingCreateBulk is the builder for creating many RoleBinding entities in bulk.

func (*RoleBindingCreateBulk) Exec

func (rbcb *RoleBindingCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleBindingCreateBulk) ExecX

func (rbcb *RoleBindingCreateBulk) ExecX(ctx context.Context)

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

func (*RoleBindingCreateBulk) Save

func (rbcb *RoleBindingCreateBulk) Save(ctx context.Context) ([]*RoleBinding, error)

Save creates the RoleBinding entities in the database.

func (*RoleBindingCreateBulk) SaveX

func (rbcb *RoleBindingCreateBulk) SaveX(ctx context.Context) []*RoleBinding

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

type RoleBindingDelete

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

RoleBindingDelete is the builder for deleting a RoleBinding entity.

func (*RoleBindingDelete) Exec

func (rbd *RoleBindingDelete) Exec(ctx context.Context) (int, error)

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

func (*RoleBindingDelete) ExecX

func (rbd *RoleBindingDelete) ExecX(ctx context.Context) int

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

func (*RoleBindingDelete) Where

Where appends a list predicates to the RoleBindingDelete builder.

type RoleBindingDeleteOne

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

RoleBindingDeleteOne is the builder for deleting a single RoleBinding entity.

func (*RoleBindingDeleteOne) Exec

func (rbdo *RoleBindingDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleBindingDeleteOne) ExecX

func (rbdo *RoleBindingDeleteOne) ExecX(ctx context.Context)

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

func (*RoleBindingDeleteOne) Where

Where appends a list predicates to the RoleBindingDelete builder.

type RoleBindingGroupBy

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

RoleBindingGroupBy is the group-by builder for RoleBinding entities.

func (*RoleBindingGroupBy) Aggregate

func (rbgb *RoleBindingGroupBy) Aggregate(fns ...AggregateFunc) *RoleBindingGroupBy

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

func (*RoleBindingGroupBy) Bool

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

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

func (*RoleBindingGroupBy) BoolX

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

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

func (*RoleBindingGroupBy) Bools

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

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

func (*RoleBindingGroupBy) BoolsX

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

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

func (*RoleBindingGroupBy) Float64

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

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

func (*RoleBindingGroupBy) Float64X

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

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

func (*RoleBindingGroupBy) Float64s

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

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

func (*RoleBindingGroupBy) Float64sX

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

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

func (*RoleBindingGroupBy) Int

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

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

func (*RoleBindingGroupBy) IntX

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

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

func (*RoleBindingGroupBy) Ints

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

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

func (*RoleBindingGroupBy) IntsX

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

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

func (*RoleBindingGroupBy) Scan

func (rbgb *RoleBindingGroupBy) Scan(ctx context.Context, v any) error

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

func (*RoleBindingGroupBy) ScanX

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

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

func (*RoleBindingGroupBy) String

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

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

func (*RoleBindingGroupBy) StringX

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

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

func (*RoleBindingGroupBy) Strings

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

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

func (*RoleBindingGroupBy) StringsX

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

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

type RoleBindingMutation

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

RoleBindingMutation represents an operation that mutates the RoleBinding nodes in the graph.

func (*RoleBindingMutation) AddDeleteTime

func (m *RoleBindingMutation) AddDeleteTime(i int64)

AddDeleteTime adds i to the "delete_time" field.

func (*RoleBindingMutation) AddDeletedTime

func (m *RoleBindingMutation) AddDeletedTime(i int64)

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleBindingMutation) AddField

func (m *RoleBindingMutation) 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 (*RoleBindingMutation) AddedDeleteTime

func (m *RoleBindingMutation) AddedDeleteTime() (r int64, exists bool)

AddedDeleteTime returns the value that was added to the "delete_time" field in this mutation.

func (*RoleBindingMutation) AddedDeletedTime

func (m *RoleBindingMutation) AddedDeletedTime() (r int64, exists bool)

AddedDeletedTime returns the value that was added to the "deleted_time" field in this mutation.

func (*RoleBindingMutation) AddedEdges

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

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

func (*RoleBindingMutation) AddedField

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

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

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

func (*RoleBindingMutation) AddedIDs

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

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

func (*RoleBindingMutation) ClearDeletedTime

func (m *RoleBindingMutation) ClearDeletedTime()

ClearDeletedTime clears the value of the "deleted_time" field.

func (*RoleBindingMutation) ClearDisplayName

func (m *RoleBindingMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" field.

func (*RoleBindingMutation) ClearEdge

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

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

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

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

func (*RoleBindingMutation) ClearedFields

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

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

func (RoleBindingMutation) Client

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

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

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

func (*RoleBindingMutation) DeleteTime

func (m *RoleBindingMutation) DeleteTime() (r int64, exists bool)

DeleteTime returns the value of the "delete_time" field in the mutation.

func (*RoleBindingMutation) DeletedTime

func (m *RoleBindingMutation) DeletedTime() (r int64, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*RoleBindingMutation) DeletedTimeCleared

func (m *RoleBindingMutation) DeletedTimeCleared() bool

DeletedTimeCleared returns if the "deleted_time" field was cleared in this mutation.

func (*RoleBindingMutation) DisplayName

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

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

func (*RoleBindingMutation) DisplayNameCleared

func (m *RoleBindingMutation) DisplayNameCleared() bool

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

func (*RoleBindingMutation) EdgeCleared

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

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

func (*RoleBindingMutation) Field

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

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

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

func (*RoleBindingMutation) Fields

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

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

func (m *RoleBindingMutation) IDs(ctx context.Context) ([]string, 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 (*RoleBindingMutation) Name

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

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

func (*RoleBindingMutation) OldCreateTime

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

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

func (m *RoleBindingMutation) OldDeleteTime(ctx context.Context) (v int64, err error)

OldDeleteTime returns the old "delete_time" field's value of the RoleBinding entity. If the RoleBinding 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 (*RoleBindingMutation) OldDeletedTime

func (m *RoleBindingMutation) OldDeletedTime(ctx context.Context) (v int64, err error)

OldDeletedTime returns the old "deleted_time" field's value of the RoleBinding entity. If the RoleBinding 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 (*RoleBindingMutation) OldDisplayName

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

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

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

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

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

func (m *RoleBindingMutation) OldRoleName(ctx context.Context) (v string, err error)

OldRoleName returns the old "role_name" field's value of the RoleBinding entity. If the RoleBinding 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 (*RoleBindingMutation) OldUpdateTime

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

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

func (m *RoleBindingMutation) OldUserID(ctx context.Context) (v string, err error)

OldUserID returns the old "user_id" field's value of the RoleBinding entity. If the RoleBinding 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 (*RoleBindingMutation) Op

func (m *RoleBindingMutation) Op() Op

Op returns the operation name.

func (*RoleBindingMutation) RemovedEdges

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

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

func (*RoleBindingMutation) RemovedIDs

func (m *RoleBindingMutation) 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 (*RoleBindingMutation) ResetCreateTime

func (m *RoleBindingMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*RoleBindingMutation) ResetDeleteTime

func (m *RoleBindingMutation) ResetDeleteTime()

ResetDeleteTime resets all changes to the "delete_time" field.

func (*RoleBindingMutation) ResetDeletedTime

func (m *RoleBindingMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*RoleBindingMutation) ResetDisplayName

func (m *RoleBindingMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*RoleBindingMutation) ResetEdge

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

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

func (m *RoleBindingMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleBindingMutation) ResetRoleName

func (m *RoleBindingMutation) ResetRoleName()

ResetRoleName resets all changes to the "role_name" field.

func (*RoleBindingMutation) ResetUpdateTime

func (m *RoleBindingMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*RoleBindingMutation) ResetUserID

func (m *RoleBindingMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*RoleBindingMutation) RoleName

func (m *RoleBindingMutation) RoleName() (r string, exists bool)

RoleName returns the value of the "role_name" field in the mutation.

func (*RoleBindingMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*RoleBindingMutation) SetDeleteTime

func (m *RoleBindingMutation) SetDeleteTime(i int64)

SetDeleteTime sets the "delete_time" field.

func (*RoleBindingMutation) SetDeletedTime

func (m *RoleBindingMutation) SetDeletedTime(i int64)

SetDeletedTime sets the "deleted_time" field.

func (*RoleBindingMutation) SetDisplayName

func (m *RoleBindingMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" field.

func (*RoleBindingMutation) SetField

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

func (m *RoleBindingMutation) SetID(id string)

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

func (*RoleBindingMutation) SetName

func (m *RoleBindingMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleBindingMutation) SetOp

func (m *RoleBindingMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RoleBindingMutation) SetRoleName

func (m *RoleBindingMutation) SetRoleName(s string)

SetRoleName sets the "role_name" field.

func (*RoleBindingMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*RoleBindingMutation) SetUserID

func (m *RoleBindingMutation) SetUserID(s string)

SetUserID sets the "user_id" field.

func (RoleBindingMutation) Tx

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

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

func (*RoleBindingMutation) Type

func (m *RoleBindingMutation) Type() string

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

func (*RoleBindingMutation) UpdateTime

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

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

func (*RoleBindingMutation) UserID

func (m *RoleBindingMutation) UserID() (r string, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*RoleBindingMutation) Where

func (m *RoleBindingMutation) Where(ps ...predicate.RoleBinding)

Where appends a list predicates to the RoleBindingMutation builder.

func (*RoleBindingMutation) WhereP

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

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

type RoleBindingQuery

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

RoleBindingQuery is the builder for querying RoleBinding entities.

func (*RoleBindingQuery) Aggregate

func (rbq *RoleBindingQuery) Aggregate(fns ...AggregateFunc) *RoleBindingSelect

Aggregate returns a RoleBindingSelect configured with the given aggregations.

func (*RoleBindingQuery) All

func (rbq *RoleBindingQuery) All(ctx context.Context) ([]*RoleBinding, error)

All executes the query and returns a list of RoleBindings.

func (*RoleBindingQuery) AllX

func (rbq *RoleBindingQuery) AllX(ctx context.Context) []*RoleBinding

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

func (*RoleBindingQuery) Clone

func (rbq *RoleBindingQuery) Clone() *RoleBindingQuery

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

func (*RoleBindingQuery) Count

func (rbq *RoleBindingQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RoleBindingQuery) CountX

func (rbq *RoleBindingQuery) CountX(ctx context.Context) int

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

func (*RoleBindingQuery) Exist

func (rbq *RoleBindingQuery) Exist(ctx context.Context) (bool, error)

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

func (*RoleBindingQuery) ExistX

func (rbq *RoleBindingQuery) ExistX(ctx context.Context) bool

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

func (*RoleBindingQuery) First

func (rbq *RoleBindingQuery) First(ctx context.Context) (*RoleBinding, error)

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

func (*RoleBindingQuery) FirstID

func (rbq *RoleBindingQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*RoleBindingQuery) FirstIDX

func (rbq *RoleBindingQuery) FirstIDX(ctx context.Context) string

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

func (*RoleBindingQuery) FirstX

func (rbq *RoleBindingQuery) FirstX(ctx context.Context) *RoleBinding

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

func (*RoleBindingQuery) GroupBy

func (rbq *RoleBindingQuery) GroupBy(field string, fields ...string) *RoleBindingGroupBy

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

client.RoleBinding.Query().
	GroupBy(rolebinding.FieldDeleteTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RoleBindingQuery) IDs

func (rbq *RoleBindingQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*RoleBindingQuery) IDsX

func (rbq *RoleBindingQuery) IDsX(ctx context.Context) []string

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

func (*RoleBindingQuery) Limit

func (rbq *RoleBindingQuery) Limit(limit int) *RoleBindingQuery

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

func (*RoleBindingQuery) Offset

func (rbq *RoleBindingQuery) Offset(offset int) *RoleBindingQuery

Offset to start from.

func (*RoleBindingQuery) Only

func (rbq *RoleBindingQuery) Only(ctx context.Context) (*RoleBinding, error)

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

func (*RoleBindingQuery) OnlyID

func (rbq *RoleBindingQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*RoleBindingQuery) OnlyIDX

func (rbq *RoleBindingQuery) OnlyIDX(ctx context.Context) string

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

func (*RoleBindingQuery) OnlyX

func (rbq *RoleBindingQuery) OnlyX(ctx context.Context) *RoleBinding

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

func (*RoleBindingQuery) Order

Order specifies how the records should be ordered.

func (*RoleBindingQuery) Select

func (rbq *RoleBindingQuery) Select(fields ...string) *RoleBindingSelect

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

client.RoleBinding.Query().
	Select(rolebinding.FieldDeleteTime).
	Scan(ctx, &v)

func (*RoleBindingQuery) Unique

func (rbq *RoleBindingQuery) Unique(unique bool) *RoleBindingQuery

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

Where adds a new predicate for the RoleBindingQuery builder.

type RoleBindingSelect

type RoleBindingSelect struct {
	*RoleBindingQuery
	// contains filtered or unexported fields
}

RoleBindingSelect is the builder for selecting fields of RoleBinding entities.

func (*RoleBindingSelect) Aggregate

func (rbs *RoleBindingSelect) Aggregate(fns ...AggregateFunc) *RoleBindingSelect

Aggregate adds the given aggregation functions to the selector query.

func (*RoleBindingSelect) Bool

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

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

func (*RoleBindingSelect) BoolX

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

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

func (*RoleBindingSelect) Bools

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

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

func (*RoleBindingSelect) BoolsX

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

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

func (*RoleBindingSelect) Float64

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

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

func (*RoleBindingSelect) Float64X

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

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

func (*RoleBindingSelect) Float64s

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

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

func (*RoleBindingSelect) Float64sX

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

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

func (*RoleBindingSelect) Int

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

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

func (*RoleBindingSelect) IntX

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

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

func (*RoleBindingSelect) Ints

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

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

func (*RoleBindingSelect) IntsX

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

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

func (*RoleBindingSelect) Scan

func (rbs *RoleBindingSelect) Scan(ctx context.Context, v any) error

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

func (*RoleBindingSelect) ScanX

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

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

func (*RoleBindingSelect) String

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

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

func (*RoleBindingSelect) StringX

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

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

func (*RoleBindingSelect) Strings

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

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

func (*RoleBindingSelect) StringsX

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

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

type RoleBindingUpdate

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

RoleBindingUpdate is the builder for updating RoleBinding entities.

func (*RoleBindingUpdate) AddDeleteTime

func (rbu *RoleBindingUpdate) AddDeleteTime(i int64) *RoleBindingUpdate

AddDeleteTime adds i to the "delete_time" field.

func (*RoleBindingUpdate) AddDeletedTime

func (rbu *RoleBindingUpdate) AddDeletedTime(i int64) *RoleBindingUpdate

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleBindingUpdate) ClearDeletedTime

func (rbu *RoleBindingUpdate) ClearDeletedTime() *RoleBindingUpdate

ClearDeletedTime clears the value of the "deleted_time" field.

func (*RoleBindingUpdate) ClearDisplayName

func (rbu *RoleBindingUpdate) ClearDisplayName() *RoleBindingUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*RoleBindingUpdate) Exec

func (rbu *RoleBindingUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleBindingUpdate) ExecX

func (rbu *RoleBindingUpdate) ExecX(ctx context.Context)

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

func (*RoleBindingUpdate) Mutation

func (rbu *RoleBindingUpdate) Mutation() *RoleBindingMutation

Mutation returns the RoleBindingMutation object of the builder.

func (*RoleBindingUpdate) Save

func (rbu *RoleBindingUpdate) Save(ctx context.Context) (int, error)

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

func (*RoleBindingUpdate) SaveX

func (rbu *RoleBindingUpdate) SaveX(ctx context.Context) int

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

func (*RoleBindingUpdate) SetDeleteTime

func (rbu *RoleBindingUpdate) SetDeleteTime(i int64) *RoleBindingUpdate

SetDeleteTime sets the "delete_time" field.

func (*RoleBindingUpdate) SetDeletedTime

func (rbu *RoleBindingUpdate) SetDeletedTime(i int64) *RoleBindingUpdate

SetDeletedTime sets the "deleted_time" field.

func (*RoleBindingUpdate) SetDisplayName

func (rbu *RoleBindingUpdate) SetDisplayName(s string) *RoleBindingUpdate

SetDisplayName sets the "display_name" field.

func (*RoleBindingUpdate) SetName

func (rbu *RoleBindingUpdate) SetName(s string) *RoleBindingUpdate

SetName sets the "name" field.

func (*RoleBindingUpdate) SetNillableDeleteTime

func (rbu *RoleBindingUpdate) SetNillableDeleteTime(i *int64) *RoleBindingUpdate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleBindingUpdate) SetNillableDeletedTime

func (rbu *RoleBindingUpdate) SetNillableDeletedTime(i *int64) *RoleBindingUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*RoleBindingUpdate) SetNillableDisplayName

func (rbu *RoleBindingUpdate) SetNillableDisplayName(s *string) *RoleBindingUpdate

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

func (*RoleBindingUpdate) SetNillableName

func (rbu *RoleBindingUpdate) SetNillableName(s *string) *RoleBindingUpdate

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

func (*RoleBindingUpdate) SetNillableRoleName

func (rbu *RoleBindingUpdate) SetNillableRoleName(s *string) *RoleBindingUpdate

SetNillableRoleName sets the "role_name" field if the given value is not nil.

func (*RoleBindingUpdate) SetNillableUserID

func (rbu *RoleBindingUpdate) SetNillableUserID(s *string) *RoleBindingUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*RoleBindingUpdate) SetRoleName

func (rbu *RoleBindingUpdate) SetRoleName(s string) *RoleBindingUpdate

SetRoleName sets the "role_name" field.

func (*RoleBindingUpdate) SetUpdateTime

func (rbu *RoleBindingUpdate) SetUpdateTime(t time.Time) *RoleBindingUpdate

SetUpdateTime sets the "update_time" field.

func (*RoleBindingUpdate) SetUserID

func (rbu *RoleBindingUpdate) SetUserID(s string) *RoleBindingUpdate

SetUserID sets the "user_id" field.

func (*RoleBindingUpdate) Where

Where appends a list predicates to the RoleBindingUpdate builder.

type RoleBindingUpdateOne

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

RoleBindingUpdateOne is the builder for updating a single RoleBinding entity.

func (*RoleBindingUpdateOne) AddDeleteTime

func (rbuo *RoleBindingUpdateOne) AddDeleteTime(i int64) *RoleBindingUpdateOne

AddDeleteTime adds i to the "delete_time" field.

func (*RoleBindingUpdateOne) AddDeletedTime

func (rbuo *RoleBindingUpdateOne) AddDeletedTime(i int64) *RoleBindingUpdateOne

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleBindingUpdateOne) ClearDeletedTime

func (rbuo *RoleBindingUpdateOne) ClearDeletedTime() *RoleBindingUpdateOne

ClearDeletedTime clears the value of the "deleted_time" field.

func (*RoleBindingUpdateOne) ClearDisplayName

func (rbuo *RoleBindingUpdateOne) ClearDisplayName() *RoleBindingUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*RoleBindingUpdateOne) Exec

func (rbuo *RoleBindingUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RoleBindingUpdateOne) ExecX

func (rbuo *RoleBindingUpdateOne) ExecX(ctx context.Context)

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

func (*RoleBindingUpdateOne) Mutation

func (rbuo *RoleBindingUpdateOne) Mutation() *RoleBindingMutation

Mutation returns the RoleBindingMutation object of the builder.

func (*RoleBindingUpdateOne) Save

Save executes the query and returns the updated RoleBinding entity.

func (*RoleBindingUpdateOne) SaveX

func (rbuo *RoleBindingUpdateOne) SaveX(ctx context.Context) *RoleBinding

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

func (*RoleBindingUpdateOne) Select

func (rbuo *RoleBindingUpdateOne) Select(field string, fields ...string) *RoleBindingUpdateOne

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

func (*RoleBindingUpdateOne) SetDeleteTime

func (rbuo *RoleBindingUpdateOne) SetDeleteTime(i int64) *RoleBindingUpdateOne

SetDeleteTime sets the "delete_time" field.

func (*RoleBindingUpdateOne) SetDeletedTime

func (rbuo *RoleBindingUpdateOne) SetDeletedTime(i int64) *RoleBindingUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*RoleBindingUpdateOne) SetDisplayName

func (rbuo *RoleBindingUpdateOne) SetDisplayName(s string) *RoleBindingUpdateOne

SetDisplayName sets the "display_name" field.

func (*RoleBindingUpdateOne) SetName

SetName sets the "name" field.

func (*RoleBindingUpdateOne) SetNillableDeleteTime

func (rbuo *RoleBindingUpdateOne) SetNillableDeleteTime(i *int64) *RoleBindingUpdateOne

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleBindingUpdateOne) SetNillableDeletedTime

func (rbuo *RoleBindingUpdateOne) SetNillableDeletedTime(i *int64) *RoleBindingUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*RoleBindingUpdateOne) SetNillableDisplayName

func (rbuo *RoleBindingUpdateOne) SetNillableDisplayName(s *string) *RoleBindingUpdateOne

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

func (*RoleBindingUpdateOne) SetNillableName

func (rbuo *RoleBindingUpdateOne) SetNillableName(s *string) *RoleBindingUpdateOne

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

func (*RoleBindingUpdateOne) SetNillableRoleName

func (rbuo *RoleBindingUpdateOne) SetNillableRoleName(s *string) *RoleBindingUpdateOne

SetNillableRoleName sets the "role_name" field if the given value is not nil.

func (*RoleBindingUpdateOne) SetNillableUserID

func (rbuo *RoleBindingUpdateOne) SetNillableUserID(s *string) *RoleBindingUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*RoleBindingUpdateOne) SetRoleName

func (rbuo *RoleBindingUpdateOne) SetRoleName(s string) *RoleBindingUpdateOne

SetRoleName sets the "role_name" field.

func (*RoleBindingUpdateOne) SetUpdateTime

func (rbuo *RoleBindingUpdateOne) SetUpdateTime(t time.Time) *RoleBindingUpdateOne

SetUpdateTime sets the "update_time" field.

func (*RoleBindingUpdateOne) SetUserID

func (rbuo *RoleBindingUpdateOne) SetUserID(s string) *RoleBindingUpdateOne

SetUserID sets the "user_id" field.

func (*RoleBindingUpdateOne) Where

Where appends a list predicates to the RoleBindingUpdate builder.

type RoleBindings

type RoleBindings []*RoleBinding

RoleBindings is a parsable slice of RoleBinding.

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

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

func (*RoleClient) Get

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

Get returns a Role entity by its id.

func (*RoleClient) GetX

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

UpdateOneID returns an update builder for the given id.

func (*RoleClient) Use

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

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

type RoleCreate

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

RoleCreate is the builder for creating a Role entity.

func (*RoleCreate) Exec

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

Exec executes the query.

func (*RoleCreate) ExecX

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

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

func (*RoleCreate) Mutation

func (rc *RoleCreate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleCreate) Save

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

Save creates the Role in the database.

func (*RoleCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*RoleCreate) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*RoleCreate) SetDeleteTime

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

SetDeleteTime sets the "delete_time" field.

func (*RoleCreate) SetDeletedTime

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

SetDeletedTime sets the "deleted_time" field.

func (*RoleCreate) SetDisplayName

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

SetDisplayName sets the "display_name" field.

func (*RoleCreate) SetID

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

SetID sets the "id" field.

func (*RoleCreate) SetName

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

SetName sets the "name" field.

func (*RoleCreate) SetNillableCreateTime

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

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

func (*RoleCreate) SetNillableDeleteTime

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

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleCreate) SetNillableDisplayName

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

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

func (*RoleCreate) SetNillableID

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

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

func (*RoleCreate) SetNillableRemark

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

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

func (*RoleCreate) SetNillableUpdateTime

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

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

func (*RoleCreate) SetRemark

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

SetRemark sets the "remark" field.

func (*RoleCreate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

type RoleCreateBulk

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

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

func (*RoleCreateBulk) Exec

func (rcb *RoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RoleCreateBulk) ExecX

func (rcb *RoleCreateBulk) ExecX(ctx context.Context)

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

func (*RoleCreateBulk) Save

func (rcb *RoleCreateBulk) Save(ctx context.Context) ([]*Role, error)

Save creates the Role entities in the database.

func (*RoleCreateBulk) SaveX

func (rcb *RoleCreateBulk) SaveX(ctx context.Context) []*Role

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

type RoleDelete

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

RoleDelete is the builder for deleting a Role entity.

func (*RoleDelete) Exec

func (rd *RoleDelete) Exec(ctx context.Context) (int, error)

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

func (*RoleDelete) ExecX

func (rd *RoleDelete) ExecX(ctx context.Context) int

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

func (*RoleDelete) Where

func (rd *RoleDelete) Where(ps ...predicate.Role) *RoleDelete

Where appends a list predicates to the RoleDelete builder.

type RoleDeleteOne

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

RoleDeleteOne is the builder for deleting a single Role entity.

func (*RoleDeleteOne) Exec

func (rdo *RoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RoleDeleteOne) ExecX

func (rdo *RoleDeleteOne) ExecX(ctx context.Context)

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

func (*RoleDeleteOne) Where

func (rdo *RoleDeleteOne) Where(ps ...predicate.Role) *RoleDeleteOne

Where appends a list predicates to the RoleDelete builder.

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

func (m *RoleMutation) AddDeleteTime(i int64)

AddDeleteTime adds i to the "delete_time" field.

func (*RoleMutation) AddDeletedTime

func (m *RoleMutation) AddDeletedTime(i int64)

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleMutation) AddField

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

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

func (*RoleMutation) AddedDeleteTime

func (m *RoleMutation) AddedDeleteTime() (r int64, exists bool)

AddedDeleteTime returns the value that was added to the "delete_time" field in this mutation.

func (*RoleMutation) AddedDeletedTime

func (m *RoleMutation) AddedDeletedTime() (r int64, exists bool)

AddedDeletedTime returns the value that was added to the "deleted_time" field in this mutation.

func (*RoleMutation) AddedEdges

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

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

func (*RoleMutation) AddedField

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

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

func (*RoleMutation) AddedFields

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

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

func (*RoleMutation) AddedIDs

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

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

func (*RoleMutation) ClearDisplayName

func (m *RoleMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" 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) ClearRemark

func (m *RoleMutation) ClearRemark()

ClearRemark clears the value of the "remark" field.

func (*RoleMutation) ClearedEdges

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

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

func (*RoleMutation) ClearedFields

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

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

func (RoleMutation) Client

func (m RoleMutation) Client() *Client

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

func (*RoleMutation) CreateTime

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

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

func (*RoleMutation) DeleteTime

func (m *RoleMutation) DeleteTime() (r int64, exists bool)

DeleteTime returns the value of the "delete_time" field in the mutation.

func (*RoleMutation) DeletedTime

func (m *RoleMutation) DeletedTime() (r int64, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*RoleMutation) DisplayName

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

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

func (*RoleMutation) DisplayNameCleared

func (m *RoleMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the "display_name" 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 string, 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) ([]string, error)

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

func (*RoleMutation) Name

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

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

func (*RoleMutation) OldCreateTime

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

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

func (*RoleMutation) OldDeleteTime

func (m *RoleMutation) OldDeleteTime(ctx context.Context) (v int64, err error)

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

func (*RoleMutation) OldDeletedTime

func (m *RoleMutation) OldDeletedTime(ctx context.Context) (v int64, err error)

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

func (*RoleMutation) OldDisplayName

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

OldDisplayName returns the old "display_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) OldField

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

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

func (*RoleMutation) OldName

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

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

func (*RoleMutation) OldRemark

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

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

func (*RoleMutation) OldUpdateTime

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

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

func (*RoleMutation) Op

func (m *RoleMutation) Op() Op

Op returns the operation name.

func (*RoleMutation) Remark

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

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

func (*RoleMutation) RemarkCleared

func (m *RoleMutation) RemarkCleared() bool

RemarkCleared returns if the "remark" field was cleared in this mutation.

func (*RoleMutation) RemovedEdges

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

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

func (*RoleMutation) RemovedIDs

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

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

func (*RoleMutation) ResetCreateTime

func (m *RoleMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*RoleMutation) ResetDeleteTime

func (m *RoleMutation) ResetDeleteTime()

ResetDeleteTime resets all changes to the "delete_time" field.

func (*RoleMutation) ResetDeletedTime

func (m *RoleMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*RoleMutation) ResetDisplayName

func (m *RoleMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*RoleMutation) ResetEdge

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

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

func (*RoleMutation) ResetField

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

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

func (*RoleMutation) ResetName

func (m *RoleMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RoleMutation) ResetRemark

func (m *RoleMutation) ResetRemark()

ResetRemark resets all changes to the "remark" field.

func (*RoleMutation) ResetUpdateTime

func (m *RoleMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*RoleMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*RoleMutation) SetDeleteTime

func (m *RoleMutation) SetDeleteTime(i int64)

SetDeleteTime sets the "delete_time" field.

func (*RoleMutation) SetDeletedTime

func (m *RoleMutation) SetDeletedTime(i int64)

SetDeletedTime sets the "deleted_time" field.

func (*RoleMutation) SetDisplayName

func (m *RoleMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" 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 string)

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

func (*RoleMutation) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetOp

func (m *RoleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RoleMutation) SetRemark

func (m *RoleMutation) SetRemark(s string)

SetRemark sets the "remark" field.

func (*RoleMutation) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (RoleMutation) Tx

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

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

func (*RoleMutation) Type

func (m *RoleMutation) Type() string

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

func (*RoleMutation) UpdateTime

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

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

func (*RoleMutation) Where

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

Where appends a list predicates to the RoleMutation builder.

func (*RoleMutation) WhereP

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

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

type RoleQuery

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

RoleQuery is the builder for querying Role entities.

func (*RoleQuery) Aggregate

func (rq *RoleQuery) Aggregate(fns ...AggregateFunc) *RoleSelect

Aggregate returns a RoleSelect configured with the given aggregations.

func (*RoleQuery) All

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

All executes the query and returns a list of Roles.

func (*RoleQuery) AllX

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

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

func (*RoleQuery) Clone

func (rq *RoleQuery) Clone() *RoleQuery

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

func (*RoleQuery) Count

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

Count returns the count of the given query.

func (*RoleQuery) CountX

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

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

func (*RoleQuery) Exist

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

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

func (*RoleQuery) ExistX

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

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

func (*RoleQuery) First

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

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

func (*RoleQuery) FirstID

func (rq *RoleQuery) FirstID(ctx context.Context) (id string, 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) string

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

func (*RoleQuery) FirstX

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

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

func (*RoleQuery) GroupBy

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

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

Example:

var v []struct {
	DeleteTime int64 `json:"delete_time,omitempty"`
	Count int `json:"count,omitempty"`
}

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

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*RoleQuery) IDsX

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

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

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) 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 {
	DeleteTime int64 `json:"delete_time,omitempty"`
}

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

func (*RoleQuery) Unique

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

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

func (*RoleQuery) Where

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

Where adds a new predicate for the RoleQuery builder.

type RoleSelect

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

RoleSelect is the builder for selecting fields of Role entities.

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

func (ru *RoleUpdate) AddDeleteTime(i int64) *RoleUpdate

AddDeleteTime adds i to the "delete_time" field.

func (*RoleUpdate) AddDeletedTime

func (ru *RoleUpdate) AddDeletedTime(i int64) *RoleUpdate

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleUpdate) ClearDisplayName

func (ru *RoleUpdate) ClearDisplayName() *RoleUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*RoleUpdate) ClearRemark

func (ru *RoleUpdate) ClearRemark() *RoleUpdate

ClearRemark clears the value of the "remark" field.

func (*RoleUpdate) Exec

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

Exec executes the query.

func (*RoleUpdate) ExecX

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

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

func (*RoleUpdate) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) Save

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

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

func (*RoleUpdate) SaveX

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

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

func (*RoleUpdate) SetDeleteTime

func (ru *RoleUpdate) SetDeleteTime(i int64) *RoleUpdate

SetDeleteTime sets the "delete_time" field.

func (*RoleUpdate) SetDeletedTime

func (ru *RoleUpdate) SetDeletedTime(i int64) *RoleUpdate

SetDeletedTime sets the "deleted_time" field.

func (*RoleUpdate) SetDisplayName

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

SetDisplayName sets the "display_name" field.

func (*RoleUpdate) SetName

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

SetName sets the "name" field.

func (*RoleUpdate) SetNillableDeleteTime

func (ru *RoleUpdate) SetNillableDeleteTime(i *int64) *RoleUpdate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleUpdate) SetNillableDeletedTime

func (ru *RoleUpdate) SetNillableDeletedTime(i *int64) *RoleUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*RoleUpdate) SetNillableDisplayName

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

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

func (*RoleUpdate) SetNillableName

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

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

func (*RoleUpdate) SetNillableRemark

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

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

func (*RoleUpdate) SetRemark

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

SetRemark sets the "remark" field.

func (*RoleUpdate) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*RoleUpdate) Where

func (ru *RoleUpdate) Where(ps ...predicate.Role) *RoleUpdate

Where appends a list predicates to the RoleUpdate builder.

type RoleUpdateOne

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

RoleUpdateOne is the builder for updating a single Role entity.

func (*RoleUpdateOne) AddDeleteTime

func (ruo *RoleUpdateOne) AddDeleteTime(i int64) *RoleUpdateOne

AddDeleteTime adds i to the "delete_time" field.

func (*RoleUpdateOne) AddDeletedTime

func (ruo *RoleUpdateOne) AddDeletedTime(i int64) *RoleUpdateOne

AddDeletedTime adds i to the "deleted_time" field.

func (*RoleUpdateOne) ClearDisplayName

func (ruo *RoleUpdateOne) ClearDisplayName() *RoleUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*RoleUpdateOne) ClearRemark

func (ruo *RoleUpdateOne) ClearRemark() *RoleUpdateOne

ClearRemark clears the value of the "remark" field.

func (*RoleUpdateOne) Exec

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

Exec executes the query on the entity.

func (*RoleUpdateOne) ExecX

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

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

func (*RoleUpdateOne) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) Save

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

Save executes the query and returns the updated Role entity.

func (*RoleUpdateOne) SaveX

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

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

func (*RoleUpdateOne) Select

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

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

func (*RoleUpdateOne) SetDeleteTime

func (ruo *RoleUpdateOne) SetDeleteTime(i int64) *RoleUpdateOne

SetDeleteTime sets the "delete_time" field.

func (*RoleUpdateOne) SetDeletedTime

func (ruo *RoleUpdateOne) SetDeletedTime(i int64) *RoleUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*RoleUpdateOne) SetDisplayName

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

SetDisplayName sets the "display_name" field.

func (*RoleUpdateOne) SetName

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

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableDeleteTime

func (ruo *RoleUpdateOne) SetNillableDeleteTime(i *int64) *RoleUpdateOne

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableDeletedTime

func (ruo *RoleUpdateOne) SetNillableDeletedTime(i *int64) *RoleUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableDisplayName

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

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

func (*RoleUpdateOne) SetNillableName

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

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

func (*RoleUpdateOne) SetNillableRemark

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

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

func (*RoleUpdateOne) SetRemark

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

SetRemark sets the "remark" field.

func (*RoleUpdateOne) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (*RoleUpdateOne) Where

func (ruo *RoleUpdateOne) Where(ps ...predicate.Role) *RoleUpdateOne

Where appends a list predicates to the RoleUpdate builder.

type Roles

type Roles []*Role

Roles is a parsable slice of Role.

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

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

	// Org is the client for interacting with the Org builders.
	Org *OrgClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// RoleBinding is the client for interacting with the RoleBinding builders.
	RoleBinding *RoleBindingClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	// ID
	ID string `json:"id,omitempty"`
	// delete time stamp
	DeleteTime int64 `json:"delete_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// 用户账号
	Name string `json:"name,omitempty"`
	// 显示名称
	DisplayName string `json:"display_name,omitempty"`
	// 用户邮箱
	Email string `json:"email,omitempty"`
	// 手机号码
	Phone string `json:"phone,omitempty"`
	// 用户性别(0保密 1男 2女)
	Gender string `json:"gender,omitempty"`
	// 头像路径
	Avatar string `json:"avatar,omitempty"`
	// 密码
	Password string `json:"-"`
	// 锁定标志(0锁定 1正常)
	NonLocked int `json:"non_locked,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

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

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

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAvatar

func (uc *UserCreate) SetAvatar(s string) *UserCreate

SetAvatar sets the "avatar" field.

func (*UserCreate) SetCreateTime

func (uc *UserCreate) SetCreateTime(t time.Time) *UserCreate

SetCreateTime sets the "create_time" field.

func (*UserCreate) SetDeleteTime

func (uc *UserCreate) SetDeleteTime(i int64) *UserCreate

SetDeleteTime sets the "delete_time" field.

func (*UserCreate) SetDisplayName

func (uc *UserCreate) SetDisplayName(s string) *UserCreate

SetDisplayName sets the "display_name" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetGender

func (uc *UserCreate) SetGender(s string) *UserCreate

SetGender sets the "gender" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(s string) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" 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) SetNillableCreateTime

func (uc *UserCreate) SetNillableCreateTime(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableDeleteTime

func (uc *UserCreate) SetNillableDeleteTime(i *int64) *UserCreate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*UserCreate) SetNillableDisplayName

func (uc *UserCreate) SetNillableDisplayName(s *string) *UserCreate

SetNillableDisplayName sets the "display_name" 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) SetNillableGender

func (uc *UserCreate) SetNillableGender(s *string) *UserCreate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(s *string) *UserCreate

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

func (*UserCreate) SetNillableName

func (uc *UserCreate) SetNillableName(s *string) *UserCreate

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

func (*UserCreate) SetNillableNonLocked

func (uc *UserCreate) SetNillableNonLocked(i *int) *UserCreate

SetNillableNonLocked sets the "non_locked" 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) SetNillableUpdateTime

func (uc *UserCreate) SetNillableUpdateTime(t *time.Time) *UserCreate

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

func (*UserCreate) SetNonLocked

func (uc *UserCreate) SetNonLocked(i int) *UserCreate

SetNonLocked sets the "non_locked" field.

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

func (uc *UserCreate) SetUpdateTime(t time.Time) *UserCreate

SetUpdateTime sets the "update_time" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

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

func (m *UserMutation) AddDeleteTime(i int64)

AddDeleteTime adds i to the "delete_time" 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) AddNonLocked

func (m *UserMutation) AddNonLocked(i int)

AddNonLocked adds i to the "non_locked" field.

func (*UserMutation) AddedDeleteTime

func (m *UserMutation) AddedDeleteTime() (r int64, exists bool)

AddedDeleteTime returns the value that was added to the "delete_time" 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) AddedNonLocked

func (m *UserMutation) AddedNonLocked() (r int, exists bool)

AddedNonLocked returns the value that was added to the "non_locked" 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) ClearAvatar

func (m *UserMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UserMutation) ClearDisplayName

func (m *UserMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" 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) ClearGender

func (m *UserMutation) ClearGender()

ClearGender clears the value of the "gender" field.

func (*UserMutation) ClearName

func (m *UserMutation) ClearName()

ClearName clears the value of the "name" field.

func (*UserMutation) ClearNonLocked

func (m *UserMutation) ClearNonLocked()

ClearNonLocked clears the value of the "non_locked" 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) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

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

func (*UserMutation) CreateTime

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

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

func (*UserMutation) DeleteTime

func (m *UserMutation) DeleteTime() (r int64, exists bool)

DeleteTime returns the value of the "delete_time" field in the mutation.

func (*UserMutation) DisplayName

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

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

func (*UserMutation) DisplayNameCleared

func (m *UserMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the "display_name" 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) Gender

func (m *UserMutation) Gender() (r string, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*UserMutation) GenderCleared

func (m *UserMutation) GenderCleared() bool

GenderCleared returns if the "gender" field was cleared in this mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id string, 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) ([]string, 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) Name

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

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

func (*UserMutation) NameCleared

func (m *UserMutation) NameCleared() bool

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

func (*UserMutation) NonLocked

func (m *UserMutation) NonLocked() (r int, exists bool)

NonLocked returns the value of the "non_locked" field in the mutation.

func (*UserMutation) NonLockedCleared

func (m *UserMutation) NonLockedCleared() bool

NonLockedCleared returns if the "non_locked" field was cleared in this 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) OldCreateTime

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

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

func (*UserMutation) OldDeleteTime

func (m *UserMutation) OldDeleteTime(ctx context.Context) (v int64, err error)

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

func (*UserMutation) OldDisplayName

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

OldDisplayName returns the old "display_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) 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) OldGender

func (m *UserMutation) OldGender(ctx context.Context) (v string, 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) OldName

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

OldName returns the old "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) OldNonLocked

func (m *UserMutation) OldNonLocked(ctx context.Context) (v int, err error)

OldNonLocked returns the old "non_locked" 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) OldUpdateTime

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

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

func (*UserMutation) 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) 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) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetCreateTime

func (m *UserMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*UserMutation) ResetDeleteTime

func (m *UserMutation) ResetDeleteTime()

ResetDeleteTime resets all changes to the "delete_time" field.

func (*UserMutation) ResetDisplayName

func (m *UserMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" 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) ResetGender

func (m *UserMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetNonLocked

func (m *UserMutation) ResetNonLocked()

ResetNonLocked resets all changes to the "non_locked" 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) ResetUpdateTime

func (m *UserMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetCreateTime

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

SetCreateTime sets the "create_time" field.

func (*UserMutation) SetDeleteTime

func (m *UserMutation) SetDeleteTime(i int64)

SetDeleteTime sets the "delete_time" field.

func (*UserMutation) SetDisplayName

func (m *UserMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" 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) SetGender

func (m *UserMutation) SetGender(s string)

SetGender sets the "gender" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id string)

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

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetNonLocked

func (m *UserMutation) SetNonLocked(i int)

SetNonLocked sets the "non_locked" 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) SetUpdateTime

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

SetUpdateTime sets the "update_time" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdateTime

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

UpdateTime returns the value of the "update_time" 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 string, 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) string

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

var v []struct {
	DeleteTime int64 `json:"delete_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldDeleteTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []string

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

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) 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 {
	DeleteTime int64 `json:"delete_time,omitempty"`
}

client.User.Query().
	Select(user.FieldDeleteTime).
	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.

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 UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddDeleteTime

func (uu *UserUpdate) AddDeleteTime(i int64) *UserUpdate

AddDeleteTime adds i to the "delete_time" field.

func (*UserUpdate) AddNonLocked

func (uu *UserUpdate) AddNonLocked(i int) *UserUpdate

AddNonLocked adds i to the "non_locked" field.

func (*UserUpdate) ClearAvatar

func (uu *UserUpdate) ClearAvatar() *UserUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdate) ClearDisplayName

func (uu *UserUpdate) ClearDisplayName() *UserUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of the "email" field.

func (*UserUpdate) ClearGender

func (uu *UserUpdate) ClearGender() *UserUpdate

ClearGender clears the value of the "gender" field.

func (*UserUpdate) ClearName

func (uu *UserUpdate) ClearName() *UserUpdate

ClearName clears the value of the "name" field.

func (*UserUpdate) ClearNonLocked

func (uu *UserUpdate) ClearNonLocked() *UserUpdate

ClearNonLocked clears the value of the "non_locked" 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) 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) 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) SetDeleteTime

func (uu *UserUpdate) SetDeleteTime(i int64) *UserUpdate

SetDeleteTime sets the "delete_time" field.

func (*UserUpdate) SetDisplayName

func (uu *UserUpdate) SetDisplayName(s string) *UserUpdate

SetDisplayName sets the "display_name" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetGender

func (uu *UserUpdate) SetGender(s string) *UserUpdate

SetGender sets the "gender" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" 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) SetNillableDeleteTime

func (uu *UserUpdate) SetNillableDeleteTime(i *int64) *UserUpdate

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*UserUpdate) SetNillableDisplayName

func (uu *UserUpdate) SetNillableDisplayName(s *string) *UserUpdate

SetNillableDisplayName sets the "display_name" 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) SetNillableGender

func (uu *UserUpdate) SetNillableGender(s *string) *UserUpdate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

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

func (*UserUpdate) SetNillableNonLocked

func (uu *UserUpdate) SetNillableNonLocked(i *int) *UserUpdate

SetNillableNonLocked sets the "non_locked" 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) SetNonLocked

func (uu *UserUpdate) SetNonLocked(i int) *UserUpdate

SetNonLocked sets the "non_locked" field.

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

func (uu *UserUpdate) SetUpdateTime(t time.Time) *UserUpdate

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

func (uuo *UserUpdateOne) AddDeleteTime(i int64) *UserUpdateOne

AddDeleteTime adds i to the "delete_time" field.

func (*UserUpdateOne) AddNonLocked

func (uuo *UserUpdateOne) AddNonLocked(i int) *UserUpdateOne

AddNonLocked adds i to the "non_locked" field.

func (*UserUpdateOne) ClearAvatar

func (uuo *UserUpdateOne) ClearAvatar() *UserUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdateOne) ClearDisplayName

func (uuo *UserUpdateOne) ClearDisplayName() *UserUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of the "email" field.

func (*UserUpdateOne) ClearGender

func (uuo *UserUpdateOne) ClearGender() *UserUpdateOne

ClearGender clears the value of the "gender" field.

func (*UserUpdateOne) ClearName

func (uuo *UserUpdateOne) ClearName() *UserUpdateOne

ClearName clears the value of the "name" field.

func (*UserUpdateOne) ClearNonLocked

func (uuo *UserUpdateOne) ClearNonLocked() *UserUpdateOne

ClearNonLocked clears the value of the "non_locked" 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) 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) 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) SetDeleteTime

func (uuo *UserUpdateOne) SetDeleteTime(i int64) *UserUpdateOne

SetDeleteTime sets the "delete_time" field.

func (*UserUpdateOne) SetDisplayName

func (uuo *UserUpdateOne) SetDisplayName(s string) *UserUpdateOne

SetDisplayName sets the "display_name" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetGender

func (uuo *UserUpdateOne) SetGender(s string) *UserUpdateOne

SetGender sets the "gender" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" 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) SetNillableDeleteTime

func (uuo *UserUpdateOne) SetNillableDeleteTime(i *int64) *UserUpdateOne

SetNillableDeleteTime sets the "delete_time" field if the given value is not nil.

func (*UserUpdateOne) SetNillableDisplayName

func (uuo *UserUpdateOne) SetNillableDisplayName(s *string) *UserUpdateOne

SetNillableDisplayName sets the "display_name" 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) SetNillableGender

func (uuo *UserUpdateOne) SetNillableGender(s *string) *UserUpdateOne

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

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

func (*UserUpdateOne) SetNillableNonLocked

func (uuo *UserUpdateOne) SetNillableNonLocked(i *int) *UserUpdateOne

SetNillableNonLocked sets the "non_locked" 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) SetNonLocked

func (uuo *UserUpdateOne) SetNonLocked(i int) *UserUpdateOne

SetNonLocked sets the "non_locked" field.

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

func (uuo *UserUpdateOne) SetUpdateTime(t time.Time) *UserUpdateOne

SetUpdateTime sets the "update_time" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL