ent

package
v0.0.0-...-544bbf9 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 16 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.
	TypeAccountUser = "AccountUser"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AccountUser

type AccountUser struct {

	// ID of the ent.
	// 账号id
	ID int64 `json:"id,omitempty"`
	// Email holds the value of the "email" field.
	// 邮箱
	Email string `json:"email,omitempty"`
	// Phone holds the value of the "phone" field.
	// 手机号
	Phone string `json:"phone,omitempty"`
	// Username holds the value of the "username" field.
	// 用户名
	Username string `json:"username,omitempty"`
	// Password holds the value of the "password" field.
	// 密码
	Password string `json:"password,omitempty"`
	// CreateAt holds the value of the "create_at" field.
	// 创建时间
	CreateAt int32 `json:"create_at,omitempty"`
	// CreateIPAt holds the value of the "create_ip_at" field.
	// 创建ip
	CreateIPAt string `json:"create_ip_at,omitempty"`
	// LastLoginAt holds the value of the "last_login_at" field.
	// 最后一次登录时间
	LastLoginAt int32 `json:"last_login_at,omitempty"`
	// LastLoginIPAt holds the value of the "last_login_ip_at" field.
	// 最后一次登录ip
	LastLoginIPAt string `json:"last_login_ip_at,omitempty"`
	// LoginTimes holds the value of the "login_times" field.
	// 登录次数
	LoginTimes int32 `json:"login_times,omitempty"`
	// Status holds the value of the "status" field.
	// 状态 1:enable, 0:disable, -1:deleted
	Status int8 `json:"status,omitempty"`
	// contains filtered or unexported fields
}

AccountUser is the model entity for the AccountUser schema.

func (*AccountUser) String

func (au *AccountUser) String() string

String implements the fmt.Stringer.

func (*AccountUser) Unwrap

func (au *AccountUser) Unwrap() *AccountUser

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

func (au *AccountUser) Update() *AccountUserUpdateOne

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

type AccountUserClient

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

AccountUserClient is a client for the AccountUser schema.

func NewAccountUserClient

func NewAccountUserClient(c config) *AccountUserClient

NewAccountUserClient returns a client for the AccountUser from the given config.

func (*AccountUserClient) Create

func (c *AccountUserClient) Create() *AccountUserCreate

Create returns a create builder for AccountUser.

func (*AccountUserClient) CreateBulk

func (c *AccountUserClient) CreateBulk(builders ...*AccountUserCreate) *AccountUserCreateBulk

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

func (*AccountUserClient) Delete

func (c *AccountUserClient) Delete() *AccountUserDelete

Delete returns a delete builder for AccountUser.

func (*AccountUserClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AccountUserClient) DeleteOneID

func (c *AccountUserClient) DeleteOneID(id int64) *AccountUserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AccountUserClient) Get

Get returns a AccountUser entity by its id.

func (*AccountUserClient) GetX

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

func (*AccountUserClient) Hooks

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

Hooks returns the client hooks.

func (*AccountUserClient) Query

func (c *AccountUserClient) Query() *AccountUserQuery

Query returns a query builder for AccountUser.

func (*AccountUserClient) Update

func (c *AccountUserClient) Update() *AccountUserUpdate

Update returns an update builder for AccountUser.

func (*AccountUserClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountUserClient) UpdateOneID

func (c *AccountUserClient) UpdateOneID(id int64) *AccountUserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountUserClient) Use

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

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

type AccountUserCreate

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

AccountUserCreate is the builder for creating a AccountUser entity.

func (*AccountUserCreate) Exec

func (auc *AccountUserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUserCreate) ExecX

func (auc *AccountUserCreate) ExecX(ctx context.Context)

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

func (*AccountUserCreate) Mutation

func (auc *AccountUserCreate) Mutation() *AccountUserMutation

Mutation returns the AccountUserMutation object of the builder.

func (*AccountUserCreate) Save

func (auc *AccountUserCreate) Save(ctx context.Context) (*AccountUser, error)

Save creates the AccountUser in the database.

func (*AccountUserCreate) SaveX

func (auc *AccountUserCreate) SaveX(ctx context.Context) *AccountUser

SaveX calls Save and panics if Save returns an error.

func (*AccountUserCreate) SetCreateAt

func (auc *AccountUserCreate) SetCreateAt(i int32) *AccountUserCreate

SetCreateAt sets the "create_at" field.

func (*AccountUserCreate) SetCreateIPAt

func (auc *AccountUserCreate) SetCreateIPAt(s string) *AccountUserCreate

SetCreateIPAt sets the "create_ip_at" field.

func (*AccountUserCreate) SetEmail

func (auc *AccountUserCreate) SetEmail(s string) *AccountUserCreate

SetEmail sets the "email" field.

func (*AccountUserCreate) SetID

func (auc *AccountUserCreate) SetID(i int64) *AccountUserCreate

SetID sets the "id" field.

func (*AccountUserCreate) SetLastLoginAt

func (auc *AccountUserCreate) SetLastLoginAt(i int32) *AccountUserCreate

SetLastLoginAt sets the "last_login_at" field.

func (*AccountUserCreate) SetLastLoginIPAt

func (auc *AccountUserCreate) SetLastLoginIPAt(s string) *AccountUserCreate

SetLastLoginIPAt sets the "last_login_ip_at" field.

func (*AccountUserCreate) SetLoginTimes

func (auc *AccountUserCreate) SetLoginTimes(i int32) *AccountUserCreate

SetLoginTimes sets the "login_times" field.

func (*AccountUserCreate) SetNillableCreateAt

func (auc *AccountUserCreate) SetNillableCreateAt(i *int32) *AccountUserCreate

SetNillableCreateAt sets the "create_at" field if the given value is not nil.

func (*AccountUserCreate) SetNillableCreateIPAt

func (auc *AccountUserCreate) SetNillableCreateIPAt(s *string) *AccountUserCreate

SetNillableCreateIPAt sets the "create_ip_at" field if the given value is not nil.

func (*AccountUserCreate) SetNillableEmail

func (auc *AccountUserCreate) SetNillableEmail(s *string) *AccountUserCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*AccountUserCreate) SetNillableLastLoginAt

func (auc *AccountUserCreate) SetNillableLastLoginAt(i *int32) *AccountUserCreate

SetNillableLastLoginAt sets the "last_login_at" field if the given value is not nil.

func (*AccountUserCreate) SetNillableLastLoginIPAt

func (auc *AccountUserCreate) SetNillableLastLoginIPAt(s *string) *AccountUserCreate

SetNillableLastLoginIPAt sets the "last_login_ip_at" field if the given value is not nil.

func (*AccountUserCreate) SetNillableLoginTimes

func (auc *AccountUserCreate) SetNillableLoginTimes(i *int32) *AccountUserCreate

SetNillableLoginTimes sets the "login_times" field if the given value is not nil.

func (*AccountUserCreate) SetNillablePassword

func (auc *AccountUserCreate) SetNillablePassword(s *string) *AccountUserCreate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*AccountUserCreate) SetNillablePhone

func (auc *AccountUserCreate) SetNillablePhone(s *string) *AccountUserCreate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*AccountUserCreate) SetNillableStatus

func (auc *AccountUserCreate) SetNillableStatus(i *int8) *AccountUserCreate

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

func (*AccountUserCreate) SetNillableUsername

func (auc *AccountUserCreate) SetNillableUsername(s *string) *AccountUserCreate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AccountUserCreate) SetPassword

func (auc *AccountUserCreate) SetPassword(s string) *AccountUserCreate

SetPassword sets the "password" field.

func (*AccountUserCreate) SetPhone

func (auc *AccountUserCreate) SetPhone(s string) *AccountUserCreate

SetPhone sets the "phone" field.

func (*AccountUserCreate) SetStatus

func (auc *AccountUserCreate) SetStatus(i int8) *AccountUserCreate

SetStatus sets the "status" field.

func (*AccountUserCreate) SetUsername

func (auc *AccountUserCreate) SetUsername(s string) *AccountUserCreate

SetUsername sets the "username" field.

type AccountUserCreateBulk

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

AccountUserCreateBulk is the builder for creating many AccountUser entities in bulk.

func (*AccountUserCreateBulk) Exec

func (aucb *AccountUserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUserCreateBulk) ExecX

func (aucb *AccountUserCreateBulk) ExecX(ctx context.Context)

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

func (*AccountUserCreateBulk) Save

func (aucb *AccountUserCreateBulk) Save(ctx context.Context) ([]*AccountUser, error)

Save creates the AccountUser entities in the database.

func (*AccountUserCreateBulk) SaveX

func (aucb *AccountUserCreateBulk) SaveX(ctx context.Context) []*AccountUser

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

type AccountUserDelete

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

AccountUserDelete is the builder for deleting a AccountUser entity.

func (*AccountUserDelete) Exec

func (aud *AccountUserDelete) Exec(ctx context.Context) (int, error)

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

func (*AccountUserDelete) ExecX

func (aud *AccountUserDelete) ExecX(ctx context.Context) int

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

func (*AccountUserDelete) Where

Where appends a list predicates to the AccountUserDelete builder.

type AccountUserDeleteOne

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

AccountUserDeleteOne is the builder for deleting a single AccountUser entity.

func (*AccountUserDeleteOne) Exec

func (audo *AccountUserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AccountUserDeleteOne) ExecX

func (audo *AccountUserDeleteOne) ExecX(ctx context.Context)

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

type AccountUserGroupBy

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

AccountUserGroupBy is the group-by builder for AccountUser entities.

func (*AccountUserGroupBy) Aggregate

func (augb *AccountUserGroupBy) Aggregate(fns ...AggregateFunc) *AccountUserGroupBy

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

func (*AccountUserGroupBy) Bool

func (augb *AccountUserGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*AccountUserGroupBy) BoolX

func (augb *AccountUserGroupBy) BoolX(ctx context.Context) bool

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

func (*AccountUserGroupBy) Bools

func (augb *AccountUserGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*AccountUserGroupBy) BoolsX

func (augb *AccountUserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*AccountUserGroupBy) Float64

func (augb *AccountUserGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*AccountUserGroupBy) Float64X

func (augb *AccountUserGroupBy) Float64X(ctx context.Context) float64

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

func (*AccountUserGroupBy) Float64s

func (augb *AccountUserGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*AccountUserGroupBy) Float64sX

func (augb *AccountUserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*AccountUserGroupBy) Int

func (augb *AccountUserGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*AccountUserGroupBy) IntX

func (augb *AccountUserGroupBy) IntX(ctx context.Context) int

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

func (*AccountUserGroupBy) Ints

func (augb *AccountUserGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*AccountUserGroupBy) IntsX

func (augb *AccountUserGroupBy) IntsX(ctx context.Context) []int

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

func (*AccountUserGroupBy) Scan

func (augb *AccountUserGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AccountUserGroupBy) ScanX

func (augb *AccountUserGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AccountUserGroupBy) String

func (augb *AccountUserGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*AccountUserGroupBy) StringX

func (augb *AccountUserGroupBy) StringX(ctx context.Context) string

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

func (*AccountUserGroupBy) Strings

func (augb *AccountUserGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*AccountUserGroupBy) StringsX

func (augb *AccountUserGroupBy) StringsX(ctx context.Context) []string

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

type AccountUserMutation

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

AccountUserMutation represents an operation that mutates the AccountUser nodes in the graph.

func (*AccountUserMutation) AddCreateAt

func (m *AccountUserMutation) AddCreateAt(i int32)

AddCreateAt adds i to the "create_at" field.

func (*AccountUserMutation) AddField

func (m *AccountUserMutation) 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 (*AccountUserMutation) AddLastLoginAt

func (m *AccountUserMutation) AddLastLoginAt(i int32)

AddLastLoginAt adds i to the "last_login_at" field.

func (*AccountUserMutation) AddLoginTimes

func (m *AccountUserMutation) AddLoginTimes(i int32)

AddLoginTimes adds i to the "login_times" field.

func (*AccountUserMutation) AddStatus

func (m *AccountUserMutation) AddStatus(i int8)

AddStatus adds i to the "status" field.

func (*AccountUserMutation) AddedCreateAt

func (m *AccountUserMutation) AddedCreateAt() (r int32, exists bool)

AddedCreateAt returns the value that was added to the "create_at" field in this mutation.

func (*AccountUserMutation) AddedEdges

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

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

func (*AccountUserMutation) AddedField

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

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

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

func (*AccountUserMutation) AddedIDs

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

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

func (*AccountUserMutation) AddedLastLoginAt

func (m *AccountUserMutation) AddedLastLoginAt() (r int32, exists bool)

AddedLastLoginAt returns the value that was added to the "last_login_at" field in this mutation.

func (*AccountUserMutation) AddedLoginTimes

func (m *AccountUserMutation) AddedLoginTimes() (r int32, exists bool)

AddedLoginTimes returns the value that was added to the "login_times" field in this mutation.

func (*AccountUserMutation) AddedStatus

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

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

func (*AccountUserMutation) ClearEdge

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

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

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

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

func (*AccountUserMutation) ClearedFields

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

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

func (AccountUserMutation) Client

func (m AccountUserMutation) 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 (*AccountUserMutation) CreateAt

func (m *AccountUserMutation) CreateAt() (r int32, exists bool)

CreateAt returns the value of the "create_at" field in the mutation.

func (*AccountUserMutation) CreateIPAt

func (m *AccountUserMutation) CreateIPAt() (r string, exists bool)

CreateIPAt returns the value of the "create_ip_at" field in the mutation.

func (*AccountUserMutation) EdgeCleared

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

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

func (*AccountUserMutation) Email

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

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

func (*AccountUserMutation) Field

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

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

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

func (*AccountUserMutation) Fields

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

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

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

func (*AccountUserMutation) LastLoginAt

func (m *AccountUserMutation) LastLoginAt() (r int32, exists bool)

LastLoginAt returns the value of the "last_login_at" field in the mutation.

func (*AccountUserMutation) LastLoginIPAt

func (m *AccountUserMutation) LastLoginIPAt() (r string, exists bool)

LastLoginIPAt returns the value of the "last_login_ip_at" field in the mutation.

func (*AccountUserMutation) LoginTimes

func (m *AccountUserMutation) LoginTimes() (r int32, exists bool)

LoginTimes returns the value of the "login_times" field in the mutation.

func (*AccountUserMutation) OldCreateAt

func (m *AccountUserMutation) OldCreateAt(ctx context.Context) (v int32, err error)

OldCreateAt returns the old "create_at" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldCreateIPAt

func (m *AccountUserMutation) OldCreateIPAt(ctx context.Context) (v string, err error)

OldCreateIPAt returns the old "create_ip_at" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldEmail

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

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

func (m *AccountUserMutation) 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 (*AccountUserMutation) OldLastLoginAt

func (m *AccountUserMutation) OldLastLoginAt(ctx context.Context) (v int32, err error)

OldLastLoginAt returns the old "last_login_at" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldLastLoginIPAt

func (m *AccountUserMutation) OldLastLoginIPAt(ctx context.Context) (v string, err error)

OldLastLoginIPAt returns the old "last_login_ip_at" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldLoginTimes

func (m *AccountUserMutation) OldLoginTimes(ctx context.Context) (v int32, err error)

OldLoginTimes returns the old "login_times" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldPassword

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

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

func (m *AccountUserMutation) OldPhone(ctx context.Context) (v string, err error)

OldPhone returns the old "phone" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) OldStatus

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

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

func (m *AccountUserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the AccountUser entity. If the AccountUser 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 (*AccountUserMutation) Op

func (m *AccountUserMutation) Op() Op

Op returns the operation name.

func (*AccountUserMutation) Password

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

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

func (*AccountUserMutation) Phone

func (m *AccountUserMutation) Phone() (r string, exists bool)

Phone returns the value of the "phone" field in the mutation.

func (*AccountUserMutation) RemovedEdges

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

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

func (*AccountUserMutation) RemovedIDs

func (m *AccountUserMutation) 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 (*AccountUserMutation) ResetCreateAt

func (m *AccountUserMutation) ResetCreateAt()

ResetCreateAt resets all changes to the "create_at" field.

func (*AccountUserMutation) ResetCreateIPAt

func (m *AccountUserMutation) ResetCreateIPAt()

ResetCreateIPAt resets all changes to the "create_ip_at" field.

func (*AccountUserMutation) ResetEdge

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

func (m *AccountUserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*AccountUserMutation) ResetField

func (m *AccountUserMutation) 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 (*AccountUserMutation) ResetLastLoginAt

func (m *AccountUserMutation) ResetLastLoginAt()

ResetLastLoginAt resets all changes to the "last_login_at" field.

func (*AccountUserMutation) ResetLastLoginIPAt

func (m *AccountUserMutation) ResetLastLoginIPAt()

ResetLastLoginIPAt resets all changes to the "last_login_ip_at" field.

func (*AccountUserMutation) ResetLoginTimes

func (m *AccountUserMutation) ResetLoginTimes()

ResetLoginTimes resets all changes to the "login_times" field.

func (*AccountUserMutation) ResetPassword

func (m *AccountUserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*AccountUserMutation) ResetPhone

func (m *AccountUserMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*AccountUserMutation) ResetStatus

func (m *AccountUserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*AccountUserMutation) ResetUsername

func (m *AccountUserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*AccountUserMutation) SetCreateAt

func (m *AccountUserMutation) SetCreateAt(i int32)

SetCreateAt sets the "create_at" field.

func (*AccountUserMutation) SetCreateIPAt

func (m *AccountUserMutation) SetCreateIPAt(s string)

SetCreateIPAt sets the "create_ip_at" field.

func (*AccountUserMutation) SetEmail

func (m *AccountUserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*AccountUserMutation) SetField

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

func (m *AccountUserMutation) SetID(id int64)

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

func (*AccountUserMutation) SetLastLoginAt

func (m *AccountUserMutation) SetLastLoginAt(i int32)

SetLastLoginAt sets the "last_login_at" field.

func (*AccountUserMutation) SetLastLoginIPAt

func (m *AccountUserMutation) SetLastLoginIPAt(s string)

SetLastLoginIPAt sets the "last_login_ip_at" field.

func (*AccountUserMutation) SetLoginTimes

func (m *AccountUserMutation) SetLoginTimes(i int32)

SetLoginTimes sets the "login_times" field.

func (*AccountUserMutation) SetPassword

func (m *AccountUserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*AccountUserMutation) SetPhone

func (m *AccountUserMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*AccountUserMutation) SetStatus

func (m *AccountUserMutation) SetStatus(i int8)

SetStatus sets the "status" field.

func (*AccountUserMutation) SetUsername

func (m *AccountUserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*AccountUserMutation) Status

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

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

func (AccountUserMutation) Tx

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

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

func (*AccountUserMutation) Type

func (m *AccountUserMutation) Type() string

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

func (*AccountUserMutation) Username

func (m *AccountUserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*AccountUserMutation) Where

func (m *AccountUserMutation) Where(ps ...predicate.AccountUser)

Where appends a list predicates to the AccountUserMutation builder.

type AccountUserQuery

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

AccountUserQuery is the builder for querying AccountUser entities.

func (*AccountUserQuery) All

func (auq *AccountUserQuery) All(ctx context.Context) ([]*AccountUser, error)

All executes the query and returns a list of AccountUsers.

func (*AccountUserQuery) AllX

func (auq *AccountUserQuery) AllX(ctx context.Context) []*AccountUser

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

func (*AccountUserQuery) Clone

func (auq *AccountUserQuery) Clone() *AccountUserQuery

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

func (*AccountUserQuery) Count

func (auq *AccountUserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AccountUserQuery) CountX

func (auq *AccountUserQuery) CountX(ctx context.Context) int

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

func (*AccountUserQuery) Exist

func (auq *AccountUserQuery) Exist(ctx context.Context) (bool, error)

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

func (*AccountUserQuery) ExistX

func (auq *AccountUserQuery) ExistX(ctx context.Context) bool

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

func (*AccountUserQuery) First

func (auq *AccountUserQuery) First(ctx context.Context) (*AccountUser, error)

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

func (*AccountUserQuery) FirstID

func (auq *AccountUserQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*AccountUserQuery) FirstIDX

func (auq *AccountUserQuery) FirstIDX(ctx context.Context) int64

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

func (*AccountUserQuery) FirstX

func (auq *AccountUserQuery) FirstX(ctx context.Context) *AccountUser

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

func (*AccountUserQuery) GroupBy

func (auq *AccountUserQuery) GroupBy(field string, fields ...string) *AccountUserGroupBy

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

client.AccountUser.Query().
	GroupBy(accountuser.FieldEmail).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AccountUserQuery) IDs

func (auq *AccountUserQuery) IDs(ctx context.Context) ([]int64, error)

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

func (*AccountUserQuery) IDsX

func (auq *AccountUserQuery) IDsX(ctx context.Context) []int64

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

func (*AccountUserQuery) Limit

func (auq *AccountUserQuery) Limit(limit int) *AccountUserQuery

Limit adds a limit step to the query.

func (*AccountUserQuery) Offset

func (auq *AccountUserQuery) Offset(offset int) *AccountUserQuery

Offset adds an offset step to the query.

func (*AccountUserQuery) Only

func (auq *AccountUserQuery) Only(ctx context.Context) (*AccountUser, error)

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

func (*AccountUserQuery) OnlyID

func (auq *AccountUserQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*AccountUserQuery) OnlyIDX

func (auq *AccountUserQuery) OnlyIDX(ctx context.Context) int64

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

func (*AccountUserQuery) OnlyX

func (auq *AccountUserQuery) OnlyX(ctx context.Context) *AccountUser

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

func (*AccountUserQuery) Order

func (auq *AccountUserQuery) Order(o ...OrderFunc) *AccountUserQuery

Order adds an order step to the query.

func (*AccountUserQuery) Select

func (auq *AccountUserQuery) Select(fields ...string) *AccountUserSelect

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

client.AccountUser.Query().
	Select(accountuser.FieldEmail).
	Scan(ctx, &v)

func (*AccountUserQuery) Unique

func (auq *AccountUserQuery) Unique(unique bool) *AccountUserQuery

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

Where adds a new predicate for the AccountUserQuery builder.

type AccountUserSelect

type AccountUserSelect struct {
	*AccountUserQuery
	// contains filtered or unexported fields
}

AccountUserSelect is the builder for selecting fields of AccountUser entities.

func (*AccountUserSelect) Bool

func (aus *AccountUserSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*AccountUserSelect) BoolX

func (aus *AccountUserSelect) BoolX(ctx context.Context) bool

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

func (*AccountUserSelect) Bools

func (aus *AccountUserSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*AccountUserSelect) BoolsX

func (aus *AccountUserSelect) BoolsX(ctx context.Context) []bool

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

func (*AccountUserSelect) Float64

func (aus *AccountUserSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*AccountUserSelect) Float64X

func (aus *AccountUserSelect) Float64X(ctx context.Context) float64

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

func (*AccountUserSelect) Float64s

func (aus *AccountUserSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*AccountUserSelect) Float64sX

func (aus *AccountUserSelect) Float64sX(ctx context.Context) []float64

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

func (*AccountUserSelect) Int

func (aus *AccountUserSelect) Int(ctx context.Context) (_ int, err error)

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

func (*AccountUserSelect) IntX

func (aus *AccountUserSelect) IntX(ctx context.Context) int

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

func (*AccountUserSelect) Ints

func (aus *AccountUserSelect) Ints(ctx context.Context) ([]int, error)

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

func (*AccountUserSelect) IntsX

func (aus *AccountUserSelect) IntsX(ctx context.Context) []int

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

func (*AccountUserSelect) Scan

func (aus *AccountUserSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AccountUserSelect) ScanX

func (aus *AccountUserSelect) ScanX(ctx context.Context, v interface{})

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

func (*AccountUserSelect) String

func (aus *AccountUserSelect) String(ctx context.Context) (_ string, err error)

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

func (*AccountUserSelect) StringX

func (aus *AccountUserSelect) StringX(ctx context.Context) string

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

func (*AccountUserSelect) Strings

func (aus *AccountUserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*AccountUserSelect) StringsX

func (aus *AccountUserSelect) StringsX(ctx context.Context) []string

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

type AccountUserUpdate

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

AccountUserUpdate is the builder for updating AccountUser entities.

func (*AccountUserUpdate) AddCreateAt

func (auu *AccountUserUpdate) AddCreateAt(i int32) *AccountUserUpdate

AddCreateAt adds i to the "create_at" field.

func (*AccountUserUpdate) AddLastLoginAt

func (auu *AccountUserUpdate) AddLastLoginAt(i int32) *AccountUserUpdate

AddLastLoginAt adds i to the "last_login_at" field.

func (*AccountUserUpdate) AddLoginTimes

func (auu *AccountUserUpdate) AddLoginTimes(i int32) *AccountUserUpdate

AddLoginTimes adds i to the "login_times" field.

func (*AccountUserUpdate) AddStatus

func (auu *AccountUserUpdate) AddStatus(i int8) *AccountUserUpdate

AddStatus adds i to the "status" field.

func (*AccountUserUpdate) Exec

func (auu *AccountUserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AccountUserUpdate) ExecX

func (auu *AccountUserUpdate) ExecX(ctx context.Context)

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

func (*AccountUserUpdate) Mutation

func (auu *AccountUserUpdate) Mutation() *AccountUserMutation

Mutation returns the AccountUserMutation object of the builder.

func (*AccountUserUpdate) Save

func (auu *AccountUserUpdate) Save(ctx context.Context) (int, error)

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

func (*AccountUserUpdate) SaveX

func (auu *AccountUserUpdate) SaveX(ctx context.Context) int

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

func (*AccountUserUpdate) SetCreateAt

func (auu *AccountUserUpdate) SetCreateAt(i int32) *AccountUserUpdate

SetCreateAt sets the "create_at" field.

func (*AccountUserUpdate) SetCreateIPAt

func (auu *AccountUserUpdate) SetCreateIPAt(s string) *AccountUserUpdate

SetCreateIPAt sets the "create_ip_at" field.

func (*AccountUserUpdate) SetEmail

func (auu *AccountUserUpdate) SetEmail(s string) *AccountUserUpdate

SetEmail sets the "email" field.

func (*AccountUserUpdate) SetLastLoginAt

func (auu *AccountUserUpdate) SetLastLoginAt(i int32) *AccountUserUpdate

SetLastLoginAt sets the "last_login_at" field.

func (*AccountUserUpdate) SetLastLoginIPAt

func (auu *AccountUserUpdate) SetLastLoginIPAt(s string) *AccountUserUpdate

SetLastLoginIPAt sets the "last_login_ip_at" field.

func (*AccountUserUpdate) SetLoginTimes

func (auu *AccountUserUpdate) SetLoginTimes(i int32) *AccountUserUpdate

SetLoginTimes sets the "login_times" field.

func (*AccountUserUpdate) SetNillableCreateAt

func (auu *AccountUserUpdate) SetNillableCreateAt(i *int32) *AccountUserUpdate

SetNillableCreateAt sets the "create_at" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableCreateIPAt

func (auu *AccountUserUpdate) SetNillableCreateIPAt(s *string) *AccountUserUpdate

SetNillableCreateIPAt sets the "create_ip_at" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableEmail

func (auu *AccountUserUpdate) SetNillableEmail(s *string) *AccountUserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableLastLoginAt

func (auu *AccountUserUpdate) SetNillableLastLoginAt(i *int32) *AccountUserUpdate

SetNillableLastLoginAt sets the "last_login_at" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableLastLoginIPAt

func (auu *AccountUserUpdate) SetNillableLastLoginIPAt(s *string) *AccountUserUpdate

SetNillableLastLoginIPAt sets the "last_login_ip_at" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableLoginTimes

func (auu *AccountUserUpdate) SetNillableLoginTimes(i *int32) *AccountUserUpdate

SetNillableLoginTimes sets the "login_times" field if the given value is not nil.

func (*AccountUserUpdate) SetNillablePassword

func (auu *AccountUserUpdate) SetNillablePassword(s *string) *AccountUserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*AccountUserUpdate) SetNillablePhone

func (auu *AccountUserUpdate) SetNillablePhone(s *string) *AccountUserUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*AccountUserUpdate) SetNillableStatus

func (auu *AccountUserUpdate) SetNillableStatus(i *int8) *AccountUserUpdate

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

func (*AccountUserUpdate) SetNillableUsername

func (auu *AccountUserUpdate) SetNillableUsername(s *string) *AccountUserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AccountUserUpdate) SetPassword

func (auu *AccountUserUpdate) SetPassword(s string) *AccountUserUpdate

SetPassword sets the "password" field.

func (*AccountUserUpdate) SetPhone

func (auu *AccountUserUpdate) SetPhone(s string) *AccountUserUpdate

SetPhone sets the "phone" field.

func (*AccountUserUpdate) SetStatus

func (auu *AccountUserUpdate) SetStatus(i int8) *AccountUserUpdate

SetStatus sets the "status" field.

func (*AccountUserUpdate) SetUsername

func (auu *AccountUserUpdate) SetUsername(s string) *AccountUserUpdate

SetUsername sets the "username" field.

func (*AccountUserUpdate) Where

Where appends a list predicates to the AccountUserUpdate builder.

type AccountUserUpdateOne

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

AccountUserUpdateOne is the builder for updating a single AccountUser entity.

func (*AccountUserUpdateOne) AddCreateAt

func (auuo *AccountUserUpdateOne) AddCreateAt(i int32) *AccountUserUpdateOne

AddCreateAt adds i to the "create_at" field.

func (*AccountUserUpdateOne) AddLastLoginAt

func (auuo *AccountUserUpdateOne) AddLastLoginAt(i int32) *AccountUserUpdateOne

AddLastLoginAt adds i to the "last_login_at" field.

func (*AccountUserUpdateOne) AddLoginTimes

func (auuo *AccountUserUpdateOne) AddLoginTimes(i int32) *AccountUserUpdateOne

AddLoginTimes adds i to the "login_times" field.

func (*AccountUserUpdateOne) AddStatus

func (auuo *AccountUserUpdateOne) AddStatus(i int8) *AccountUserUpdateOne

AddStatus adds i to the "status" field.

func (*AccountUserUpdateOne) Exec

func (auuo *AccountUserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AccountUserUpdateOne) ExecX

func (auuo *AccountUserUpdateOne) ExecX(ctx context.Context)

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

func (*AccountUserUpdateOne) Mutation

func (auuo *AccountUserUpdateOne) Mutation() *AccountUserMutation

Mutation returns the AccountUserMutation object of the builder.

func (*AccountUserUpdateOne) Save

Save executes the query and returns the updated AccountUser entity.

func (*AccountUserUpdateOne) SaveX

func (auuo *AccountUserUpdateOne) SaveX(ctx context.Context) *AccountUser

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

func (*AccountUserUpdateOne) Select

func (auuo *AccountUserUpdateOne) Select(field string, fields ...string) *AccountUserUpdateOne

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

func (*AccountUserUpdateOne) SetCreateAt

func (auuo *AccountUserUpdateOne) SetCreateAt(i int32) *AccountUserUpdateOne

SetCreateAt sets the "create_at" field.

func (*AccountUserUpdateOne) SetCreateIPAt

func (auuo *AccountUserUpdateOne) SetCreateIPAt(s string) *AccountUserUpdateOne

SetCreateIPAt sets the "create_ip_at" field.

func (*AccountUserUpdateOne) SetEmail

SetEmail sets the "email" field.

func (*AccountUserUpdateOne) SetLastLoginAt

func (auuo *AccountUserUpdateOne) SetLastLoginAt(i int32) *AccountUserUpdateOne

SetLastLoginAt sets the "last_login_at" field.

func (*AccountUserUpdateOne) SetLastLoginIPAt

func (auuo *AccountUserUpdateOne) SetLastLoginIPAt(s string) *AccountUserUpdateOne

SetLastLoginIPAt sets the "last_login_ip_at" field.

func (*AccountUserUpdateOne) SetLoginTimes

func (auuo *AccountUserUpdateOne) SetLoginTimes(i int32) *AccountUserUpdateOne

SetLoginTimes sets the "login_times" field.

func (*AccountUserUpdateOne) SetNillableCreateAt

func (auuo *AccountUserUpdateOne) SetNillableCreateAt(i *int32) *AccountUserUpdateOne

SetNillableCreateAt sets the "create_at" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableCreateIPAt

func (auuo *AccountUserUpdateOne) SetNillableCreateIPAt(s *string) *AccountUserUpdateOne

SetNillableCreateIPAt sets the "create_ip_at" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableEmail

func (auuo *AccountUserUpdateOne) SetNillableEmail(s *string) *AccountUserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableLastLoginAt

func (auuo *AccountUserUpdateOne) SetNillableLastLoginAt(i *int32) *AccountUserUpdateOne

SetNillableLastLoginAt sets the "last_login_at" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableLastLoginIPAt

func (auuo *AccountUserUpdateOne) SetNillableLastLoginIPAt(s *string) *AccountUserUpdateOne

SetNillableLastLoginIPAt sets the "last_login_ip_at" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableLoginTimes

func (auuo *AccountUserUpdateOne) SetNillableLoginTimes(i *int32) *AccountUserUpdateOne

SetNillableLoginTimes sets the "login_times" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillablePassword

func (auuo *AccountUserUpdateOne) SetNillablePassword(s *string) *AccountUserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillablePhone

func (auuo *AccountUserUpdateOne) SetNillablePhone(s *string) *AccountUserUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*AccountUserUpdateOne) SetNillableStatus

func (auuo *AccountUserUpdateOne) SetNillableStatus(i *int8) *AccountUserUpdateOne

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

func (*AccountUserUpdateOne) SetNillableUsername

func (auuo *AccountUserUpdateOne) SetNillableUsername(s *string) *AccountUserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*AccountUserUpdateOne) SetPassword

func (auuo *AccountUserUpdateOne) SetPassword(s string) *AccountUserUpdateOne

SetPassword sets the "password" field.

func (*AccountUserUpdateOne) SetPhone

SetPhone sets the "phone" field.

func (*AccountUserUpdateOne) SetStatus

func (auuo *AccountUserUpdateOne) SetStatus(i int8) *AccountUserUpdateOne

SetStatus sets the "status" field.

func (*AccountUserUpdateOne) SetUsername

func (auuo *AccountUserUpdateOne) SetUsername(s string) *AccountUserUpdateOne

SetUsername sets the "username" field.

type AccountUsers

type AccountUsers []*AccountUser

AccountUsers is a parsable slice of AccountUser.

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
	// AccountUser is the client for interacting with the AccountUser builders.
	AccountUser *AccountUserClient
	// 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().
	AccountUser.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Committer method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

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

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollbacker method.

type Tx

type Tx struct {

	// AccountUser is the client for interacting with the AccountUser builders.
	AccountUser *AccountUserClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL