generated

package
v0.0.0-...-595c5f8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeAccount  = "Account"
	TypeAuthRole = "AuthRole"
)

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 Account

type Account struct {

	// ID of the ent.
	ID ulid.ULID `json:"id,omitempty"`
	// AuthID holds the value of the "auth_id" field.
	AuthID *string `json:"auth_id,omitempty"`
	// Nickname holds the value of the "nickname" field.
	Nickname string `json:"nickname,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Password holds the value of the "password" field.
	Password *string `json:"password,omitempty"`
	// PasswordUpdatedAt holds the value of the "password_updated_at" field.
	PasswordUpdatedAt time.Time `json:"password_updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AccountQuery when eager-loading is set.
	Edges AccountEdges `json:"edges"`
	// contains filtered or unexported fields
}

Account is the model entity for the Account schema.

func (*Account) QueryAuthRoles

func (a *Account) QueryAuthRoles() *AuthRoleQuery

QueryAuthRoles queries the "auth_roles" edge of the Account entity.

func (*Account) String

func (a *Account) String() string

String implements the fmt.Stringer.

func (*Account) Unwrap

func (a *Account) Unwrap() *Account

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

func (a *Account) Update() *AccountUpdateOne

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

type AccountClient

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

AccountClient is a client for the Account schema.

func NewAccountClient

func NewAccountClient(c config) *AccountClient

NewAccountClient returns a client for the Account from the given config.

func (*AccountClient) Create

func (c *AccountClient) Create() *AccountCreate

Create returns a builder for creating a Account entity.

func (*AccountClient) CreateBulk

func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk

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

func (*AccountClient) Delete

func (c *AccountClient) Delete() *AccountDelete

Delete returns a delete builder for Account.

func (*AccountClient) DeleteOne

func (c *AccountClient) DeleteOne(a *Account) *AccountDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AccountClient) DeleteOneID

func (c *AccountClient) DeleteOneID(id ulid.ULID) *AccountDeleteOne

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

func (*AccountClient) Get

func (c *AccountClient) Get(ctx context.Context, id ulid.ULID) (*Account, error)

Get returns a Account entity by its id.

func (*AccountClient) GetX

func (c *AccountClient) GetX(ctx context.Context, id ulid.ULID) *Account

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

func (*AccountClient) Hooks

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

Hooks returns the client hooks.

func (*AccountClient) Query

func (c *AccountClient) Query() *AccountQuery

Query returns a query builder for Account.

func (*AccountClient) QueryAuthRoles

func (c *AccountClient) QueryAuthRoles(a *Account) *AuthRoleQuery

QueryAuthRoles queries the auth_roles edge of a Account.

func (*AccountClient) Update

func (c *AccountClient) Update() *AccountUpdate

Update returns an update builder for Account.

func (*AccountClient) UpdateOne

func (c *AccountClient) UpdateOne(a *Account) *AccountUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AccountClient) UpdateOneID

func (c *AccountClient) UpdateOneID(id ulid.ULID) *AccountUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AccountClient) Use

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

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

type AccountCreate

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

AccountCreate is the builder for creating a Account entity.

func (*AccountCreate) AddAuthRoleIDs

func (ac *AccountCreate) AddAuthRoleIDs(ids ...ulid.ULID) *AccountCreate

AddAuthRoleIDs adds the "auth_roles" edge to the AuthRole entity by IDs.

func (*AccountCreate) AddAuthRoles

func (ac *AccountCreate) AddAuthRoles(a ...*AuthRole) *AccountCreate

AddAuthRoles adds the "auth_roles" edges to the AuthRole entity.

func (*AccountCreate) Exec

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

Exec executes the query.

func (*AccountCreate) ExecX

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

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

func (*AccountCreate) Mutation

func (ac *AccountCreate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountCreate) Save

func (ac *AccountCreate) Save(ctx context.Context) (*Account, error)

Save creates the Account in the database.

func (*AccountCreate) SaveX

func (ac *AccountCreate) SaveX(ctx context.Context) *Account

SaveX calls Save and panics if Save returns an error.

func (*AccountCreate) SetAuthID

func (ac *AccountCreate) SetAuthID(s string) *AccountCreate

SetAuthID sets the "auth_id" field.

func (*AccountCreate) SetEmail

func (ac *AccountCreate) SetEmail(s string) *AccountCreate

SetEmail sets the "email" field.

func (*AccountCreate) SetID

func (ac *AccountCreate) SetID(u ulid.ULID) *AccountCreate

SetID sets the "id" field.

func (*AccountCreate) SetNickname

func (ac *AccountCreate) SetNickname(s string) *AccountCreate

SetNickname sets the "nickname" field.

func (*AccountCreate) SetNillableAuthID

func (ac *AccountCreate) SetNillableAuthID(s *string) *AccountCreate

SetNillableAuthID sets the "auth_id" field if the given value is not nil.

func (*AccountCreate) SetNillableID

func (ac *AccountCreate) SetNillableID(u *ulid.ULID) *AccountCreate

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

func (*AccountCreate) SetNillablePassword

func (ac *AccountCreate) SetNillablePassword(s *string) *AccountCreate

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

func (*AccountCreate) SetNillablePasswordUpdatedAt

func (ac *AccountCreate) SetNillablePasswordUpdatedAt(t *time.Time) *AccountCreate

SetNillablePasswordUpdatedAt sets the "password_updated_at" field if the given value is not nil.

func (*AccountCreate) SetPassword

func (ac *AccountCreate) SetPassword(s string) *AccountCreate

SetPassword sets the "password" field.

func (*AccountCreate) SetPasswordUpdatedAt

func (ac *AccountCreate) SetPasswordUpdatedAt(t time.Time) *AccountCreate

SetPasswordUpdatedAt sets the "password_updated_at" field.

type AccountCreateBulk

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

AccountCreateBulk is the builder for creating many Account entities in bulk.

func (*AccountCreateBulk) Exec

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

Exec executes the query.

func (*AccountCreateBulk) ExecX

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

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

func (*AccountCreateBulk) Save

func (acb *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error)

Save creates the Account entities in the database.

func (*AccountCreateBulk) SaveX

func (acb *AccountCreateBulk) SaveX(ctx context.Context) []*Account

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

type AccountDelete

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

AccountDelete is the builder for deleting a Account entity.

func (*AccountDelete) Exec

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

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

func (*AccountDelete) ExecX

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

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

func (*AccountDelete) Where

func (ad *AccountDelete) Where(ps ...predicate.Account) *AccountDelete

Where appends a list predicates to the AccountDelete builder.

type AccountDeleteOne

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

AccountDeleteOne is the builder for deleting a single Account entity.

func (*AccountDeleteOne) Exec

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

Exec executes the deletion query.

func (*AccountDeleteOne) ExecX

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

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

type AccountEdges

type AccountEdges struct {
	// AuthRoles holds the value of the auth_roles edge.
	AuthRoles []*AuthRole `json:"auth_roles,omitempty"`
	// contains filtered or unexported fields
}

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

func (AccountEdges) AuthRolesOrErr

func (e AccountEdges) AuthRolesOrErr() ([]*AuthRole, error)

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

type AccountGroupBy

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

AccountGroupBy is the group-by builder for Account entities.

func (*AccountGroupBy) Aggregate

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

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

func (*AccountGroupBy) Bool

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

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

func (*AccountGroupBy) BoolX

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

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

func (*AccountGroupBy) Bools

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

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

func (*AccountGroupBy) BoolsX

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

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

func (*AccountGroupBy) Float64

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

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

func (*AccountGroupBy) Float64X

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

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

func (*AccountGroupBy) Float64s

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

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

func (*AccountGroupBy) Float64sX

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

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

func (*AccountGroupBy) Int

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

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

func (*AccountGroupBy) IntX

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

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

func (*AccountGroupBy) Ints

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

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

func (*AccountGroupBy) IntsX

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

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

func (*AccountGroupBy) Scan

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

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

func (*AccountGroupBy) ScanX

func (s *AccountGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AccountGroupBy) String

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

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

func (*AccountGroupBy) StringX

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

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

func (*AccountGroupBy) Strings

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

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

func (*AccountGroupBy) StringsX

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

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

type AccountMutation

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

AccountMutation represents an operation that mutates the Account nodes in the graph.

func (*AccountMutation) AddAuthRoleIDs

func (m *AccountMutation) AddAuthRoleIDs(ids ...ulid.ULID)

AddAuthRoleIDs adds the "auth_roles" edge to the AuthRole entity by ids.

func (*AccountMutation) AddField

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

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

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

func (*AccountMutation) AddedField

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

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

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

func (*AccountMutation) AddedIDs

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

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

func (*AccountMutation) AuthID

func (m *AccountMutation) AuthID() (r string, exists bool)

AuthID returns the value of the "auth_id" field in the mutation.

func (*AccountMutation) AuthIDCleared

func (m *AccountMutation) AuthIDCleared() bool

AuthIDCleared returns if the "auth_id" field was cleared in this mutation.

func (*AccountMutation) AuthRolesCleared

func (m *AccountMutation) AuthRolesCleared() bool

AuthRolesCleared reports if the "auth_roles" edge to the AuthRole entity was cleared.

func (*AccountMutation) AuthRolesIDs

func (m *AccountMutation) AuthRolesIDs() (ids []ulid.ULID)

AuthRolesIDs returns the "auth_roles" edge IDs in the mutation.

func (*AccountMutation) ClearAuthID

func (m *AccountMutation) ClearAuthID()

ClearAuthID clears the value of the "auth_id" field.

func (*AccountMutation) ClearAuthRoles

func (m *AccountMutation) ClearAuthRoles()

ClearAuthRoles clears the "auth_roles" edge to the AuthRole entity.

func (*AccountMutation) ClearEdge

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

func (m *AccountMutation) 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 (*AccountMutation) ClearPassword

func (m *AccountMutation) ClearPassword()

ClearPassword clears the value of the "password" field.

func (*AccountMutation) ClearedEdges

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

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

func (*AccountMutation) ClearedFields

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

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

func (AccountMutation) Client

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

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

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

func (*AccountMutation) Email

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

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

func (*AccountMutation) Field

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

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

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

func (*AccountMutation) Fields

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

func (m *AccountMutation) ID() (id ulid.ULID, 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 (*AccountMutation) IDs

func (m *AccountMutation) IDs(ctx context.Context) ([]ulid.ULID, 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 (*AccountMutation) Nickname

func (m *AccountMutation) Nickname() (r string, exists bool)

Nickname returns the value of the "nickname" field in the mutation.

func (*AccountMutation) OldAuthID

func (m *AccountMutation) OldAuthID(ctx context.Context) (v *string, err error)

OldAuthID returns the old "auth_id" field's value of the Account entity. If the Account 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 (*AccountMutation) OldEmail

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

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

func (m *AccountMutation) 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 (*AccountMutation) OldNickname

func (m *AccountMutation) OldNickname(ctx context.Context) (v string, err error)

OldNickname returns the old "nickname" field's value of the Account entity. If the Account 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 (*AccountMutation) OldPassword

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

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

func (m *AccountMutation) OldPasswordUpdatedAt(ctx context.Context) (v time.Time, err error)

OldPasswordUpdatedAt returns the old "password_updated_at" field's value of the Account entity. If the Account 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 (*AccountMutation) Op

func (m *AccountMutation) Op() Op

Op returns the operation name.

func (*AccountMutation) Password

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

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

func (*AccountMutation) PasswordCleared

func (m *AccountMutation) PasswordCleared() bool

PasswordCleared returns if the "password" field was cleared in this mutation.

func (*AccountMutation) PasswordUpdatedAt

func (m *AccountMutation) PasswordUpdatedAt() (r time.Time, exists bool)

PasswordUpdatedAt returns the value of the "password_updated_at" field in the mutation.

func (*AccountMutation) RemoveAuthRoleIDs

func (m *AccountMutation) RemoveAuthRoleIDs(ids ...ulid.ULID)

RemoveAuthRoleIDs removes the "auth_roles" edge to the AuthRole entity by IDs.

func (*AccountMutation) RemovedAuthRolesIDs

func (m *AccountMutation) RemovedAuthRolesIDs() (ids []ulid.ULID)

RemovedAuthRoles returns the removed IDs of the "auth_roles" edge to the AuthRole entity.

func (*AccountMutation) RemovedEdges

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

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

func (*AccountMutation) RemovedIDs

func (m *AccountMutation) 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 (*AccountMutation) ResetAuthID

func (m *AccountMutation) ResetAuthID()

ResetAuthID resets all changes to the "auth_id" field.

func (*AccountMutation) ResetAuthRoles

func (m *AccountMutation) ResetAuthRoles()

ResetAuthRoles resets all changes to the "auth_roles" edge.

func (*AccountMutation) ResetEdge

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

func (m *AccountMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*AccountMutation) ResetField

func (m *AccountMutation) 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 (*AccountMutation) ResetNickname

func (m *AccountMutation) ResetNickname()

ResetNickname resets all changes to the "nickname" field.

func (*AccountMutation) ResetPassword

func (m *AccountMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*AccountMutation) ResetPasswordUpdatedAt

func (m *AccountMutation) ResetPasswordUpdatedAt()

ResetPasswordUpdatedAt resets all changes to the "password_updated_at" field.

func (*AccountMutation) SetAuthID

func (m *AccountMutation) SetAuthID(s string)

SetAuthID sets the "auth_id" field.

func (*AccountMutation) SetEmail

func (m *AccountMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*AccountMutation) SetField

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

func (m *AccountMutation) SetID(id ulid.ULID)

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

func (*AccountMutation) SetNickname

func (m *AccountMutation) SetNickname(s string)

SetNickname sets the "nickname" field.

func (*AccountMutation) SetPassword

func (m *AccountMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*AccountMutation) SetPasswordUpdatedAt

func (m *AccountMutation) SetPasswordUpdatedAt(t time.Time)

SetPasswordUpdatedAt sets the "password_updated_at" field.

func (AccountMutation) Tx

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

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

func (*AccountMutation) Type

func (m *AccountMutation) Type() string

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

func (*AccountMutation) Where

func (m *AccountMutation) Where(ps ...predicate.Account)

Where appends a list predicates to the AccountMutation builder.

type AccountQuery

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

AccountQuery is the builder for querying Account entities.

func (*AccountQuery) All

func (aq *AccountQuery) All(ctx context.Context) ([]*Account, error)

All executes the query and returns a list of Accounts.

func (*AccountQuery) AllX

func (aq *AccountQuery) AllX(ctx context.Context) []*Account

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

func (*AccountQuery) Clone

func (aq *AccountQuery) Clone() *AccountQuery

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

func (*AccountQuery) Count

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

Count returns the count of the given query.

func (*AccountQuery) CountX

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

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

func (*AccountQuery) Exist

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

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

func (*AccountQuery) ExistX

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

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

func (*AccountQuery) First

func (aq *AccountQuery) First(ctx context.Context) (*Account, error)

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

func (*AccountQuery) FirstID

func (aq *AccountQuery) FirstID(ctx context.Context) (id ulid.ULID, err error)

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

func (*AccountQuery) FirstIDX

func (aq *AccountQuery) FirstIDX(ctx context.Context) ulid.ULID

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

func (*AccountQuery) FirstX

func (aq *AccountQuery) FirstX(ctx context.Context) *Account

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

func (*AccountQuery) GroupBy

func (aq *AccountQuery) GroupBy(field string, fields ...string) *AccountGroupBy

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

client.Account.Query().
	GroupBy(account.FieldAuthID).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*AccountQuery) IDs

func (aq *AccountQuery) IDs(ctx context.Context) ([]ulid.ULID, error)

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

func (*AccountQuery) IDsX

func (aq *AccountQuery) IDsX(ctx context.Context) []ulid.ULID

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

func (*AccountQuery) Limit

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

Limit adds a limit step to the query.

func (*AccountQuery) Offset

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

Offset adds an offset step to the query.

func (*AccountQuery) Only

func (aq *AccountQuery) Only(ctx context.Context) (*Account, error)

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

func (*AccountQuery) OnlyID

func (aq *AccountQuery) OnlyID(ctx context.Context) (id ulid.ULID, err error)

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

func (*AccountQuery) OnlyIDX

func (aq *AccountQuery) OnlyIDX(ctx context.Context) ulid.ULID

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

func (*AccountQuery) OnlyX

func (aq *AccountQuery) OnlyX(ctx context.Context) *Account

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

func (*AccountQuery) Order

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

Order adds an order step to the query.

func (*AccountQuery) QueryAuthRoles

func (aq *AccountQuery) QueryAuthRoles() *AuthRoleQuery

QueryAuthRoles chains the current query on the "auth_roles" edge.

func (*AccountQuery) Select

func (aq *AccountQuery) Select(fields ...string) *AccountSelect

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

client.Account.Query().
	Select(account.FieldAuthID).
	Scan(ctx, &v)

func (*AccountQuery) Unique

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

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

func (aq *AccountQuery) Where(ps ...predicate.Account) *AccountQuery

Where adds a new predicate for the AccountQuery builder.

func (*AccountQuery) WithAuthRoles

func (aq *AccountQuery) WithAuthRoles(opts ...func(*AuthRoleQuery)) *AccountQuery

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

type AccountSelect

type AccountSelect struct {
	*AccountQuery
	// contains filtered or unexported fields
}

AccountSelect is the builder for selecting fields of Account entities.

func (*AccountSelect) Bool

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

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

func (*AccountSelect) BoolX

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

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

func (*AccountSelect) Bools

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

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

func (*AccountSelect) BoolsX

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

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

func (*AccountSelect) Float64

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

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

func (*AccountSelect) Float64X

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

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

func (*AccountSelect) Float64s

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

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

func (*AccountSelect) Float64sX

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

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

func (*AccountSelect) Int

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

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

func (*AccountSelect) IntX

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

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

func (*AccountSelect) Ints

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

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

func (*AccountSelect) IntsX

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

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

func (*AccountSelect) Scan

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

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

func (*AccountSelect) ScanX

func (s *AccountSelect) ScanX(ctx context.Context, v interface{})

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

func (*AccountSelect) String

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

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

func (*AccountSelect) StringX

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

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

func (*AccountSelect) Strings

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

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

func (*AccountSelect) StringsX

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

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

type AccountUpdate

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

AccountUpdate is the builder for updating Account entities.

func (*AccountUpdate) AddAuthRoleIDs

func (au *AccountUpdate) AddAuthRoleIDs(ids ...ulid.ULID) *AccountUpdate

AddAuthRoleIDs adds the "auth_roles" edge to the AuthRole entity by IDs.

func (*AccountUpdate) AddAuthRoles

func (au *AccountUpdate) AddAuthRoles(a ...*AuthRole) *AccountUpdate

AddAuthRoles adds the "auth_roles" edges to the AuthRole entity.

func (*AccountUpdate) ClearAuthID

func (au *AccountUpdate) ClearAuthID() *AccountUpdate

ClearAuthID clears the value of the "auth_id" field.

func (*AccountUpdate) ClearAuthRoles

func (au *AccountUpdate) ClearAuthRoles() *AccountUpdate

ClearAuthRoles clears all "auth_roles" edges to the AuthRole entity.

func (*AccountUpdate) ClearPassword

func (au *AccountUpdate) ClearPassword() *AccountUpdate

ClearPassword clears the value of the "password" field.

func (*AccountUpdate) Exec

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

Exec executes the query.

func (*AccountUpdate) ExecX

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

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

func (*AccountUpdate) Mutation

func (au *AccountUpdate) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdate) RemoveAuthRoleIDs

func (au *AccountUpdate) RemoveAuthRoleIDs(ids ...ulid.ULID) *AccountUpdate

RemoveAuthRoleIDs removes the "auth_roles" edge to AuthRole entities by IDs.

func (*AccountUpdate) RemoveAuthRoles

func (au *AccountUpdate) RemoveAuthRoles(a ...*AuthRole) *AccountUpdate

RemoveAuthRoles removes "auth_roles" edges to AuthRole entities.

func (*AccountUpdate) Save

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

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

func (*AccountUpdate) SaveX

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

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

func (*AccountUpdate) SetAuthID

func (au *AccountUpdate) SetAuthID(s string) *AccountUpdate

SetAuthID sets the "auth_id" field.

func (*AccountUpdate) SetEmail

func (au *AccountUpdate) SetEmail(s string) *AccountUpdate

SetEmail sets the "email" field.

func (*AccountUpdate) SetNickname

func (au *AccountUpdate) SetNickname(s string) *AccountUpdate

SetNickname sets the "nickname" field.

func (*AccountUpdate) SetNillableAuthID

func (au *AccountUpdate) SetNillableAuthID(s *string) *AccountUpdate

SetNillableAuthID sets the "auth_id" field if the given value is not nil.

func (*AccountUpdate) SetNillablePassword

func (au *AccountUpdate) SetNillablePassword(s *string) *AccountUpdate

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

func (*AccountUpdate) SetPassword

func (au *AccountUpdate) SetPassword(s string) *AccountUpdate

SetPassword sets the "password" field.

func (*AccountUpdate) SetPasswordUpdatedAt

func (au *AccountUpdate) SetPasswordUpdatedAt(t time.Time) *AccountUpdate

SetPasswordUpdatedAt sets the "password_updated_at" field.

func (*AccountUpdate) Where

func (au *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate

Where appends a list predicates to the AccountUpdate builder.

type AccountUpdateOne

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

AccountUpdateOne is the builder for updating a single Account entity.

func (*AccountUpdateOne) AddAuthRoleIDs

func (auo *AccountUpdateOne) AddAuthRoleIDs(ids ...ulid.ULID) *AccountUpdateOne

AddAuthRoleIDs adds the "auth_roles" edge to the AuthRole entity by IDs.

func (*AccountUpdateOne) AddAuthRoles

func (auo *AccountUpdateOne) AddAuthRoles(a ...*AuthRole) *AccountUpdateOne

AddAuthRoles adds the "auth_roles" edges to the AuthRole entity.

func (*AccountUpdateOne) ClearAuthID

func (auo *AccountUpdateOne) ClearAuthID() *AccountUpdateOne

ClearAuthID clears the value of the "auth_id" field.

func (*AccountUpdateOne) ClearAuthRoles

func (auo *AccountUpdateOne) ClearAuthRoles() *AccountUpdateOne

ClearAuthRoles clears all "auth_roles" edges to the AuthRole entity.

func (*AccountUpdateOne) ClearPassword

func (auo *AccountUpdateOne) ClearPassword() *AccountUpdateOne

ClearPassword clears the value of the "password" field.

func (*AccountUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AccountUpdateOne) ExecX

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

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

func (*AccountUpdateOne) Mutation

func (auo *AccountUpdateOne) Mutation() *AccountMutation

Mutation returns the AccountMutation object of the builder.

func (*AccountUpdateOne) RemoveAuthRoleIDs

func (auo *AccountUpdateOne) RemoveAuthRoleIDs(ids ...ulid.ULID) *AccountUpdateOne

RemoveAuthRoleIDs removes the "auth_roles" edge to AuthRole entities by IDs.

func (*AccountUpdateOne) RemoveAuthRoles

func (auo *AccountUpdateOne) RemoveAuthRoles(a ...*AuthRole) *AccountUpdateOne

RemoveAuthRoles removes "auth_roles" edges to AuthRole entities.

func (*AccountUpdateOne) Save

func (auo *AccountUpdateOne) Save(ctx context.Context) (*Account, error)

Save executes the query and returns the updated Account entity.

func (*AccountUpdateOne) SaveX

func (auo *AccountUpdateOne) SaveX(ctx context.Context) *Account

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

func (*AccountUpdateOne) Select

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

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

func (*AccountUpdateOne) SetAuthID

func (auo *AccountUpdateOne) SetAuthID(s string) *AccountUpdateOne

SetAuthID sets the "auth_id" field.

func (*AccountUpdateOne) SetEmail

func (auo *AccountUpdateOne) SetEmail(s string) *AccountUpdateOne

SetEmail sets the "email" field.

func (*AccountUpdateOne) SetNickname

func (auo *AccountUpdateOne) SetNickname(s string) *AccountUpdateOne

SetNickname sets the "nickname" field.

func (*AccountUpdateOne) SetNillableAuthID

func (auo *AccountUpdateOne) SetNillableAuthID(s *string) *AccountUpdateOne

SetNillableAuthID sets the "auth_id" field if the given value is not nil.

func (*AccountUpdateOne) SetNillablePassword

func (auo *AccountUpdateOne) SetNillablePassword(s *string) *AccountUpdateOne

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

func (*AccountUpdateOne) SetPassword

func (auo *AccountUpdateOne) SetPassword(s string) *AccountUpdateOne

SetPassword sets the "password" field.

func (*AccountUpdateOne) SetPasswordUpdatedAt

func (auo *AccountUpdateOne) SetPasswordUpdatedAt(t time.Time) *AccountUpdateOne

SetPasswordUpdatedAt sets the "password_updated_at" field.

type Accounts

type Accounts []*Account

Accounts is a parsable slice of Account.

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(generated.As(generated.Sum(field1), "sum_field1"), (generated.As(generated.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 AuthRole

type AuthRole struct {

	// ID of the ent.
	ID ulid.ULID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Role holds the value of the "role" field.
	Role auth.AuthRole `json:"role,omitempty"`
	// Description holds the value of the "description" field.
	Description *string `json:"description,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuthRoleQuery when eager-loading is set.
	Edges AuthRoleEdges `json:"edges"`
	// contains filtered or unexported fields
}

AuthRole is the model entity for the AuthRole schema.

func (*AuthRole) QueryAccounts

func (ar *AuthRole) QueryAccounts() *AccountQuery

QueryAccounts queries the "accounts" edge of the AuthRole entity.

func (*AuthRole) String

func (ar *AuthRole) String() string

String implements the fmt.Stringer.

func (*AuthRole) Unwrap

func (ar *AuthRole) Unwrap() *AuthRole

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

func (ar *AuthRole) Update() *AuthRoleUpdateOne

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

type AuthRoleClient

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

AuthRoleClient is a client for the AuthRole schema.

func NewAuthRoleClient

func NewAuthRoleClient(c config) *AuthRoleClient

NewAuthRoleClient returns a client for the AuthRole from the given config.

func (*AuthRoleClient) Create

func (c *AuthRoleClient) Create() *AuthRoleCreate

Create returns a builder for creating a AuthRole entity.

func (*AuthRoleClient) CreateBulk

func (c *AuthRoleClient) CreateBulk(builders ...*AuthRoleCreate) *AuthRoleCreateBulk

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

func (*AuthRoleClient) Delete

func (c *AuthRoleClient) Delete() *AuthRoleDelete

Delete returns a delete builder for AuthRole.

func (*AuthRoleClient) DeleteOne

func (c *AuthRoleClient) DeleteOne(ar *AuthRole) *AuthRoleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AuthRoleClient) DeleteOneID

func (c *AuthRoleClient) DeleteOneID(id ulid.ULID) *AuthRoleDeleteOne

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

func (*AuthRoleClient) Get

func (c *AuthRoleClient) Get(ctx context.Context, id ulid.ULID) (*AuthRole, error)

Get returns a AuthRole entity by its id.

func (*AuthRoleClient) GetX

func (c *AuthRoleClient) GetX(ctx context.Context, id ulid.ULID) *AuthRole

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

func (*AuthRoleClient) Hooks

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

Hooks returns the client hooks.

func (*AuthRoleClient) Query

func (c *AuthRoleClient) Query() *AuthRoleQuery

Query returns a query builder for AuthRole.

func (*AuthRoleClient) QueryAccounts

func (c *AuthRoleClient) QueryAccounts(ar *AuthRole) *AccountQuery

QueryAccounts queries the accounts edge of a AuthRole.

func (*AuthRoleClient) Update

func (c *AuthRoleClient) Update() *AuthRoleUpdate

Update returns an update builder for AuthRole.

func (*AuthRoleClient) UpdateOne

func (c *AuthRoleClient) UpdateOne(ar *AuthRole) *AuthRoleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuthRoleClient) UpdateOneID

func (c *AuthRoleClient) UpdateOneID(id ulid.ULID) *AuthRoleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuthRoleClient) Use

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

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

type AuthRoleCreate

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

AuthRoleCreate is the builder for creating a AuthRole entity.

func (*AuthRoleCreate) AddAccountIDs

func (arc *AuthRoleCreate) AddAccountIDs(ids ...ulid.ULID) *AuthRoleCreate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*AuthRoleCreate) AddAccounts

func (arc *AuthRoleCreate) AddAccounts(a ...*Account) *AuthRoleCreate

AddAccounts adds the "accounts" edges to the Account entity.

func (*AuthRoleCreate) Exec

func (arc *AuthRoleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthRoleCreate) ExecX

func (arc *AuthRoleCreate) ExecX(ctx context.Context)

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

func (*AuthRoleCreate) Mutation

func (arc *AuthRoleCreate) Mutation() *AuthRoleMutation

Mutation returns the AuthRoleMutation object of the builder.

func (*AuthRoleCreate) Save

func (arc *AuthRoleCreate) Save(ctx context.Context) (*AuthRole, error)

Save creates the AuthRole in the database.

func (*AuthRoleCreate) SaveX

func (arc *AuthRoleCreate) SaveX(ctx context.Context) *AuthRole

SaveX calls Save and panics if Save returns an error.

func (*AuthRoleCreate) SetCreatedAt

func (arc *AuthRoleCreate) SetCreatedAt(t time.Time) *AuthRoleCreate

SetCreatedAt sets the "created_at" field.

func (*AuthRoleCreate) SetDescription

func (arc *AuthRoleCreate) SetDescription(s string) *AuthRoleCreate

SetDescription sets the "description" field.

func (*AuthRoleCreate) SetID

func (arc *AuthRoleCreate) SetID(u ulid.ULID) *AuthRoleCreate

SetID sets the "id" field.

func (*AuthRoleCreate) SetNillableCreatedAt

func (arc *AuthRoleCreate) SetNillableCreatedAt(t *time.Time) *AuthRoleCreate

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

func (*AuthRoleCreate) SetNillableDescription

func (arc *AuthRoleCreate) SetNillableDescription(s *string) *AuthRoleCreate

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

func (*AuthRoleCreate) SetNillableID

func (arc *AuthRoleCreate) SetNillableID(u *ulid.ULID) *AuthRoleCreate

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

func (*AuthRoleCreate) SetNillableUpdatedAt

func (arc *AuthRoleCreate) SetNillableUpdatedAt(t *time.Time) *AuthRoleCreate

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

func (*AuthRoleCreate) SetRole

func (arc *AuthRoleCreate) SetRole(ar auth.AuthRole) *AuthRoleCreate

SetRole sets the "role" field.

func (*AuthRoleCreate) SetUpdatedAt

func (arc *AuthRoleCreate) SetUpdatedAt(t time.Time) *AuthRoleCreate

SetUpdatedAt sets the "updated_at" field.

type AuthRoleCreateBulk

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

AuthRoleCreateBulk is the builder for creating many AuthRole entities in bulk.

func (*AuthRoleCreateBulk) Exec

func (arcb *AuthRoleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthRoleCreateBulk) ExecX

func (arcb *AuthRoleCreateBulk) ExecX(ctx context.Context)

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

func (*AuthRoleCreateBulk) Save

func (arcb *AuthRoleCreateBulk) Save(ctx context.Context) ([]*AuthRole, error)

Save creates the AuthRole entities in the database.

func (*AuthRoleCreateBulk) SaveX

func (arcb *AuthRoleCreateBulk) SaveX(ctx context.Context) []*AuthRole

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

type AuthRoleDelete

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

AuthRoleDelete is the builder for deleting a AuthRole entity.

func (*AuthRoleDelete) Exec

func (ard *AuthRoleDelete) Exec(ctx context.Context) (int, error)

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

func (*AuthRoleDelete) ExecX

func (ard *AuthRoleDelete) ExecX(ctx context.Context) int

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

func (*AuthRoleDelete) Where

func (ard *AuthRoleDelete) Where(ps ...predicate.AuthRole) *AuthRoleDelete

Where appends a list predicates to the AuthRoleDelete builder.

type AuthRoleDeleteOne

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

AuthRoleDeleteOne is the builder for deleting a single AuthRole entity.

func (*AuthRoleDeleteOne) Exec

func (ardo *AuthRoleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AuthRoleDeleteOne) ExecX

func (ardo *AuthRoleDeleteOne) ExecX(ctx context.Context)

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

type AuthRoleEdges

type AuthRoleEdges struct {
	// Accounts holds the value of the accounts edge.
	Accounts []*Account `json:"accounts,omitempty"`
	// contains filtered or unexported fields
}

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

func (AuthRoleEdges) AccountsOrErr

func (e AuthRoleEdges) AccountsOrErr() ([]*Account, error)

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

type AuthRoleGroupBy

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

AuthRoleGroupBy is the group-by builder for AuthRole entities.

func (*AuthRoleGroupBy) Aggregate

func (argb *AuthRoleGroupBy) Aggregate(fns ...AggregateFunc) *AuthRoleGroupBy

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

func (*AuthRoleGroupBy) Bool

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

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

func (*AuthRoleGroupBy) BoolX

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

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

func (*AuthRoleGroupBy) Bools

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

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

func (*AuthRoleGroupBy) BoolsX

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

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

func (*AuthRoleGroupBy) Float64

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

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

func (*AuthRoleGroupBy) Float64X

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

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

func (*AuthRoleGroupBy) Float64s

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

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

func (*AuthRoleGroupBy) Float64sX

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

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

func (*AuthRoleGroupBy) Int

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

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

func (*AuthRoleGroupBy) IntX

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

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

func (*AuthRoleGroupBy) Ints

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

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

func (*AuthRoleGroupBy) IntsX

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

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

func (*AuthRoleGroupBy) Scan

func (argb *AuthRoleGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AuthRoleGroupBy) ScanX

func (s *AuthRoleGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AuthRoleGroupBy) String

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

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

func (*AuthRoleGroupBy) StringX

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

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

func (*AuthRoleGroupBy) Strings

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

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

func (*AuthRoleGroupBy) StringsX

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

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

type AuthRoleMutation

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

AuthRoleMutation represents an operation that mutates the AuthRole nodes in the graph.

func (*AuthRoleMutation) AccountsCleared

func (m *AuthRoleMutation) AccountsCleared() bool

AccountsCleared reports if the "accounts" edge to the Account entity was cleared.

func (*AuthRoleMutation) AccountsIDs

func (m *AuthRoleMutation) AccountsIDs() (ids []ulid.ULID)

AccountsIDs returns the "accounts" edge IDs in the mutation.

func (*AuthRoleMutation) AddAccountIDs

func (m *AuthRoleMutation) AddAccountIDs(ids ...ulid.ULID)

AddAccountIDs adds the "accounts" edge to the Account entity by ids.

func (*AuthRoleMutation) AddField

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

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

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

func (*AuthRoleMutation) AddedField

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

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

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

func (*AuthRoleMutation) AddedIDs

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

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

func (*AuthRoleMutation) ClearAccounts

func (m *AuthRoleMutation) ClearAccounts()

ClearAccounts clears the "accounts" edge to the Account entity.

func (*AuthRoleMutation) ClearDescription

func (m *AuthRoleMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*AuthRoleMutation) ClearEdge

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

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

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

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

func (*AuthRoleMutation) ClearedFields

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

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

func (AuthRoleMutation) Client

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

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

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

func (*AuthRoleMutation) Description

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

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

func (*AuthRoleMutation) DescriptionCleared

func (m *AuthRoleMutation) DescriptionCleared() bool

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

func (*AuthRoleMutation) EdgeCleared

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

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

func (*AuthRoleMutation) Field

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

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

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

func (*AuthRoleMutation) Fields

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

func (m *AuthRoleMutation) ID() (id ulid.ULID, 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 (*AuthRoleMutation) IDs

func (m *AuthRoleMutation) IDs(ctx context.Context) ([]ulid.ULID, 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 (*AuthRoleMutation) OldCreatedAt

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

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

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

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

func (m *AuthRoleMutation) 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 (*AuthRoleMutation) OldRole

func (m *AuthRoleMutation) OldRole(ctx context.Context) (v auth.AuthRole, err error)

OldRole returns the old "role" field's value of the AuthRole entity. If the AuthRole 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 (*AuthRoleMutation) OldUpdatedAt

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

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

func (m *AuthRoleMutation) Op() Op

Op returns the operation name.

func (*AuthRoleMutation) RemoveAccountIDs

func (m *AuthRoleMutation) RemoveAccountIDs(ids ...ulid.ULID)

RemoveAccountIDs removes the "accounts" edge to the Account entity by IDs.

func (*AuthRoleMutation) RemovedAccountsIDs

func (m *AuthRoleMutation) RemovedAccountsIDs() (ids []ulid.ULID)

RemovedAccounts returns the removed IDs of the "accounts" edge to the Account entity.

func (*AuthRoleMutation) RemovedEdges

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

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

func (*AuthRoleMutation) RemovedIDs

func (m *AuthRoleMutation) 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 (*AuthRoleMutation) ResetAccounts

func (m *AuthRoleMutation) ResetAccounts()

ResetAccounts resets all changes to the "accounts" edge.

func (*AuthRoleMutation) ResetCreatedAt

func (m *AuthRoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AuthRoleMutation) ResetDescription

func (m *AuthRoleMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*AuthRoleMutation) ResetEdge

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

func (m *AuthRoleMutation) 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 (*AuthRoleMutation) ResetRole

func (m *AuthRoleMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*AuthRoleMutation) ResetUpdatedAt

func (m *AuthRoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AuthRoleMutation) Role

func (m *AuthRoleMutation) Role() (r auth.AuthRole, exists bool)

Role returns the value of the "role" field in the mutation.

func (*AuthRoleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AuthRoleMutation) SetDescription

func (m *AuthRoleMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*AuthRoleMutation) SetField

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

func (m *AuthRoleMutation) SetID(id ulid.ULID)

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

func (*AuthRoleMutation) SetRole

func (m *AuthRoleMutation) SetRole(ar auth.AuthRole)

SetRole sets the "role" field.

func (*AuthRoleMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (AuthRoleMutation) Tx

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

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

func (*AuthRoleMutation) Type

func (m *AuthRoleMutation) Type() string

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

func (*AuthRoleMutation) UpdatedAt

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

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

func (*AuthRoleMutation) Where

func (m *AuthRoleMutation) Where(ps ...predicate.AuthRole)

Where appends a list predicates to the AuthRoleMutation builder.

type AuthRoleQuery

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

AuthRoleQuery is the builder for querying AuthRole entities.

func (*AuthRoleQuery) All

func (arq *AuthRoleQuery) All(ctx context.Context) ([]*AuthRole, error)

All executes the query and returns a list of AuthRoles.

func (*AuthRoleQuery) AllX

func (arq *AuthRoleQuery) AllX(ctx context.Context) []*AuthRole

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

func (*AuthRoleQuery) Clone

func (arq *AuthRoleQuery) Clone() *AuthRoleQuery

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

func (*AuthRoleQuery) Count

func (arq *AuthRoleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AuthRoleQuery) CountX

func (arq *AuthRoleQuery) CountX(ctx context.Context) int

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

func (*AuthRoleQuery) Exist

func (arq *AuthRoleQuery) Exist(ctx context.Context) (bool, error)

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

func (*AuthRoleQuery) ExistX

func (arq *AuthRoleQuery) ExistX(ctx context.Context) bool

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

func (*AuthRoleQuery) First

func (arq *AuthRoleQuery) First(ctx context.Context) (*AuthRole, error)

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

func (*AuthRoleQuery) FirstID

func (arq *AuthRoleQuery) FirstID(ctx context.Context) (id ulid.ULID, err error)

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

func (*AuthRoleQuery) FirstIDX

func (arq *AuthRoleQuery) FirstIDX(ctx context.Context) ulid.ULID

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

func (*AuthRoleQuery) FirstX

func (arq *AuthRoleQuery) FirstX(ctx context.Context) *AuthRole

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

func (*AuthRoleQuery) GroupBy

func (arq *AuthRoleQuery) GroupBy(field string, fields ...string) *AuthRoleGroupBy

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

Example:

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

client.AuthRole.Query().
	GroupBy(authrole.FieldCreatedAt).
	Aggregate(generated.Count()).
	Scan(ctx, &v)

func (*AuthRoleQuery) IDs

func (arq *AuthRoleQuery) IDs(ctx context.Context) ([]ulid.ULID, error)

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

func (*AuthRoleQuery) IDsX

func (arq *AuthRoleQuery) IDsX(ctx context.Context) []ulid.ULID

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

func (*AuthRoleQuery) Limit

func (arq *AuthRoleQuery) Limit(limit int) *AuthRoleQuery

Limit adds a limit step to the query.

func (*AuthRoleQuery) Offset

func (arq *AuthRoleQuery) Offset(offset int) *AuthRoleQuery

Offset adds an offset step to the query.

func (*AuthRoleQuery) Only

func (arq *AuthRoleQuery) Only(ctx context.Context) (*AuthRole, error)

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

func (*AuthRoleQuery) OnlyID

func (arq *AuthRoleQuery) OnlyID(ctx context.Context) (id ulid.ULID, err error)

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

func (*AuthRoleQuery) OnlyIDX

func (arq *AuthRoleQuery) OnlyIDX(ctx context.Context) ulid.ULID

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

func (*AuthRoleQuery) OnlyX

func (arq *AuthRoleQuery) OnlyX(ctx context.Context) *AuthRole

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

func (*AuthRoleQuery) Order

func (arq *AuthRoleQuery) Order(o ...OrderFunc) *AuthRoleQuery

Order adds an order step to the query.

func (*AuthRoleQuery) QueryAccounts

func (arq *AuthRoleQuery) QueryAccounts() *AccountQuery

QueryAccounts chains the current query on the "accounts" edge.

func (*AuthRoleQuery) Select

func (arq *AuthRoleQuery) Select(fields ...string) *AuthRoleSelect

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

Example:

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

client.AuthRole.Query().
	Select(authrole.FieldCreatedAt).
	Scan(ctx, &v)

func (*AuthRoleQuery) Unique

func (arq *AuthRoleQuery) Unique(unique bool) *AuthRoleQuery

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

func (arq *AuthRoleQuery) Where(ps ...predicate.AuthRole) *AuthRoleQuery

Where adds a new predicate for the AuthRoleQuery builder.

func (*AuthRoleQuery) WithAccounts

func (arq *AuthRoleQuery) WithAccounts(opts ...func(*AccountQuery)) *AuthRoleQuery

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

type AuthRoleSelect

type AuthRoleSelect struct {
	*AuthRoleQuery
	// contains filtered or unexported fields
}

AuthRoleSelect is the builder for selecting fields of AuthRole entities.

func (*AuthRoleSelect) Bool

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

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

func (*AuthRoleSelect) BoolX

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

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

func (*AuthRoleSelect) Bools

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

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

func (*AuthRoleSelect) BoolsX

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

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

func (*AuthRoleSelect) Float64

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

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

func (*AuthRoleSelect) Float64X

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

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

func (*AuthRoleSelect) Float64s

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

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

func (*AuthRoleSelect) Float64sX

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

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

func (*AuthRoleSelect) Int

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

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

func (*AuthRoleSelect) IntX

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

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

func (*AuthRoleSelect) Ints

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

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

func (*AuthRoleSelect) IntsX

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

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

func (*AuthRoleSelect) Scan

func (ars *AuthRoleSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AuthRoleSelect) ScanX

func (s *AuthRoleSelect) ScanX(ctx context.Context, v interface{})

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

func (*AuthRoleSelect) String

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

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

func (*AuthRoleSelect) StringX

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

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

func (*AuthRoleSelect) Strings

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

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

func (*AuthRoleSelect) StringsX

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

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

type AuthRoleUpdate

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

AuthRoleUpdate is the builder for updating AuthRole entities.

func (*AuthRoleUpdate) AddAccountIDs

func (aru *AuthRoleUpdate) AddAccountIDs(ids ...ulid.ULID) *AuthRoleUpdate

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*AuthRoleUpdate) AddAccounts

func (aru *AuthRoleUpdate) AddAccounts(a ...*Account) *AuthRoleUpdate

AddAccounts adds the "accounts" edges to the Account entity.

func (*AuthRoleUpdate) ClearAccounts

func (aru *AuthRoleUpdate) ClearAccounts() *AuthRoleUpdate

ClearAccounts clears all "accounts" edges to the Account entity.

func (*AuthRoleUpdate) ClearDescription

func (aru *AuthRoleUpdate) ClearDescription() *AuthRoleUpdate

ClearDescription clears the value of the "description" field.

func (*AuthRoleUpdate) Exec

func (aru *AuthRoleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthRoleUpdate) ExecX

func (aru *AuthRoleUpdate) ExecX(ctx context.Context)

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

func (*AuthRoleUpdate) Mutation

func (aru *AuthRoleUpdate) Mutation() *AuthRoleMutation

Mutation returns the AuthRoleMutation object of the builder.

func (*AuthRoleUpdate) RemoveAccountIDs

func (aru *AuthRoleUpdate) RemoveAccountIDs(ids ...ulid.ULID) *AuthRoleUpdate

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*AuthRoleUpdate) RemoveAccounts

func (aru *AuthRoleUpdate) RemoveAccounts(a ...*Account) *AuthRoleUpdate

RemoveAccounts removes "accounts" edges to Account entities.

func (*AuthRoleUpdate) Save

func (aru *AuthRoleUpdate) Save(ctx context.Context) (int, error)

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

func (*AuthRoleUpdate) SaveX

func (aru *AuthRoleUpdate) SaveX(ctx context.Context) int

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

func (*AuthRoleUpdate) SetDescription

func (aru *AuthRoleUpdate) SetDescription(s string) *AuthRoleUpdate

SetDescription sets the "description" field.

func (*AuthRoleUpdate) SetNillableDescription

func (aru *AuthRoleUpdate) SetNillableDescription(s *string) *AuthRoleUpdate

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

func (*AuthRoleUpdate) SetRole

func (aru *AuthRoleUpdate) SetRole(ar auth.AuthRole) *AuthRoleUpdate

SetRole sets the "role" field.

func (*AuthRoleUpdate) SetUpdatedAt

func (aru *AuthRoleUpdate) SetUpdatedAt(t time.Time) *AuthRoleUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AuthRoleUpdate) Where

func (aru *AuthRoleUpdate) Where(ps ...predicate.AuthRole) *AuthRoleUpdate

Where appends a list predicates to the AuthRoleUpdate builder.

type AuthRoleUpdateOne

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

AuthRoleUpdateOne is the builder for updating a single AuthRole entity.

func (*AuthRoleUpdateOne) AddAccountIDs

func (aruo *AuthRoleUpdateOne) AddAccountIDs(ids ...ulid.ULID) *AuthRoleUpdateOne

AddAccountIDs adds the "accounts" edge to the Account entity by IDs.

func (*AuthRoleUpdateOne) AddAccounts

func (aruo *AuthRoleUpdateOne) AddAccounts(a ...*Account) *AuthRoleUpdateOne

AddAccounts adds the "accounts" edges to the Account entity.

func (*AuthRoleUpdateOne) ClearAccounts

func (aruo *AuthRoleUpdateOne) ClearAccounts() *AuthRoleUpdateOne

ClearAccounts clears all "accounts" edges to the Account entity.

func (*AuthRoleUpdateOne) ClearDescription

func (aruo *AuthRoleUpdateOne) ClearDescription() *AuthRoleUpdateOne

ClearDescription clears the value of the "description" field.

func (*AuthRoleUpdateOne) Exec

func (aruo *AuthRoleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AuthRoleUpdateOne) ExecX

func (aruo *AuthRoleUpdateOne) ExecX(ctx context.Context)

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

func (*AuthRoleUpdateOne) Mutation

func (aruo *AuthRoleUpdateOne) Mutation() *AuthRoleMutation

Mutation returns the AuthRoleMutation object of the builder.

func (*AuthRoleUpdateOne) RemoveAccountIDs

func (aruo *AuthRoleUpdateOne) RemoveAccountIDs(ids ...ulid.ULID) *AuthRoleUpdateOne

RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.

func (*AuthRoleUpdateOne) RemoveAccounts

func (aruo *AuthRoleUpdateOne) RemoveAccounts(a ...*Account) *AuthRoleUpdateOne

RemoveAccounts removes "accounts" edges to Account entities.

func (*AuthRoleUpdateOne) Save

func (aruo *AuthRoleUpdateOne) Save(ctx context.Context) (*AuthRole, error)

Save executes the query and returns the updated AuthRole entity.

func (*AuthRoleUpdateOne) SaveX

func (aruo *AuthRoleUpdateOne) SaveX(ctx context.Context) *AuthRole

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

func (*AuthRoleUpdateOne) Select

func (aruo *AuthRoleUpdateOne) Select(field string, fields ...string) *AuthRoleUpdateOne

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

func (*AuthRoleUpdateOne) SetDescription

func (aruo *AuthRoleUpdateOne) SetDescription(s string) *AuthRoleUpdateOne

SetDescription sets the "description" field.

func (*AuthRoleUpdateOne) SetNillableDescription

func (aruo *AuthRoleUpdateOne) SetNillableDescription(s *string) *AuthRoleUpdateOne

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

func (*AuthRoleUpdateOne) SetRole

func (aruo *AuthRoleUpdateOne) SetRole(ar auth.AuthRole) *AuthRoleUpdateOne

SetRole sets the "role" field.

func (*AuthRoleUpdateOne) SetUpdatedAt

func (aruo *AuthRoleUpdateOne) SetUpdatedAt(t time.Time) *AuthRoleUpdateOne

SetUpdatedAt sets the "updated_at" field.

type AuthRoles

type AuthRoles []*AuthRole

AuthRoles is a parsable slice of AuthRole.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// AuthRole is the client for interacting with the AuthRole builders.
	AuthRole *AuthRoleClient
	// 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().
	Account.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

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

type Tx struct {

	// Account is the client for interacting with the Account builders.
	Account *AccountClient
	// AuthRole is the client for interacting with the AuthRole builders.
	AuthRole *AuthRoleClient
	// 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 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