ent

package
v0.0.0-...-9e197ba Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 19 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.
	TypeToDo = "ToDo"
	TypeUser = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// ToDo is the client for interacting with the ToDo builders.
	ToDo *ToDoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	ToDo.
	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(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

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 ToDo

type ToDo struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// TodoUUID holds the value of the "todo_uuid" field.
	TodoUUID uuid.UUID `json:"todo_uuid,omitempty"`
	// UserUUID holds the value of the "user_uuid" field.
	UserUUID uuid.UUID `json:"user_uuid,omitempty"`
	// TodoTitle holds the value of the "todo_title" field.
	TodoTitle string `json:"todo_title,omitempty"`
	// TodoContext holds the value of the "todo_context" field.
	TodoContext string `json:"todo_context,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// CratedAt holds the value of the "crated_at" field.
	CratedAt time.Time `json:"crated_at,omitempty"`
	// contains filtered or unexported fields
}

ToDo is the model entity for the ToDo schema.

func (*ToDo) String

func (td *ToDo) String() string

String implements the fmt.Stringer.

func (*ToDo) Unwrap

func (td *ToDo) Unwrap() *ToDo

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

func (td *ToDo) Update() *ToDoUpdateOne

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

type ToDoClient

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

ToDoClient is a client for the ToDo schema.

func NewToDoClient

func NewToDoClient(c config) *ToDoClient

NewToDoClient returns a client for the ToDo from the given config.

func (*ToDoClient) Create

func (c *ToDoClient) Create() *ToDoCreate

Create returns a builder for creating a ToDo entity.

func (*ToDoClient) CreateBulk

func (c *ToDoClient) CreateBulk(builders ...*ToDoCreate) *ToDoCreateBulk

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

func (*ToDoClient) Delete

func (c *ToDoClient) Delete() *ToDoDelete

Delete returns a delete builder for ToDo.

func (*ToDoClient) DeleteOne

func (c *ToDoClient) DeleteOne(td *ToDo) *ToDoDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ToDoClient) DeleteOneID

func (c *ToDoClient) DeleteOneID(id int) *ToDoDeleteOne

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

func (*ToDoClient) Get

func (c *ToDoClient) Get(ctx context.Context, id int) (*ToDo, error)

Get returns a ToDo entity by its id.

func (*ToDoClient) GetX

func (c *ToDoClient) GetX(ctx context.Context, id int) *ToDo

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

func (*ToDoClient) Hooks

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

Hooks returns the client hooks.

func (*ToDoClient) Query

func (c *ToDoClient) Query() *ToDoQuery

Query returns a query builder for ToDo.

func (*ToDoClient) Update

func (c *ToDoClient) Update() *ToDoUpdate

Update returns an update builder for ToDo.

func (*ToDoClient) UpdateOne

func (c *ToDoClient) UpdateOne(td *ToDo) *ToDoUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ToDoClient) UpdateOneID

func (c *ToDoClient) UpdateOneID(id int) *ToDoUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ToDoClient) Use

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

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

type ToDoCreate

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

ToDoCreate is the builder for creating a ToDo entity.

func (*ToDoCreate) Exec

func (tdc *ToDoCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToDoCreate) ExecX

func (tdc *ToDoCreate) ExecX(ctx context.Context)

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

func (*ToDoCreate) Mutation

func (tdc *ToDoCreate) Mutation() *ToDoMutation

Mutation returns the ToDoMutation object of the builder.

func (*ToDoCreate) Save

func (tdc *ToDoCreate) Save(ctx context.Context) (*ToDo, error)

Save creates the ToDo in the database.

func (*ToDoCreate) SaveX

func (tdc *ToDoCreate) SaveX(ctx context.Context) *ToDo

SaveX calls Save and panics if Save returns an error.

func (*ToDoCreate) SetCratedAt

func (tdc *ToDoCreate) SetCratedAt(t time.Time) *ToDoCreate

SetCratedAt sets the "crated_at" field.

func (*ToDoCreate) SetNillableCratedAt

func (tdc *ToDoCreate) SetNillableCratedAt(t *time.Time) *ToDoCreate

SetNillableCratedAt sets the "crated_at" field if the given value is not nil.

func (*ToDoCreate) SetNillableTodoUUID

func (tdc *ToDoCreate) SetNillableTodoUUID(u *uuid.UUID) *ToDoCreate

SetNillableTodoUUID sets the "todo_uuid" field if the given value is not nil.

func (*ToDoCreate) SetNillableUpdatedAt

func (tdc *ToDoCreate) SetNillableUpdatedAt(t *time.Time) *ToDoCreate

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

func (*ToDoCreate) SetNillableUserUUID

func (tdc *ToDoCreate) SetNillableUserUUID(u *uuid.UUID) *ToDoCreate

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*ToDoCreate) SetTodoContext

func (tdc *ToDoCreate) SetTodoContext(s string) *ToDoCreate

SetTodoContext sets the "todo_context" field.

func (*ToDoCreate) SetTodoTitle

func (tdc *ToDoCreate) SetTodoTitle(s string) *ToDoCreate

SetTodoTitle sets the "todo_title" field.

func (*ToDoCreate) SetTodoUUID

func (tdc *ToDoCreate) SetTodoUUID(u uuid.UUID) *ToDoCreate

SetTodoUUID sets the "todo_uuid" field.

func (*ToDoCreate) SetUpdatedAt

func (tdc *ToDoCreate) SetUpdatedAt(t time.Time) *ToDoCreate

SetUpdatedAt sets the "updated_at" field.

func (*ToDoCreate) SetUserUUID

func (tdc *ToDoCreate) SetUserUUID(u uuid.UUID) *ToDoCreate

SetUserUUID sets the "user_uuid" field.

type ToDoCreateBulk

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

ToDoCreateBulk is the builder for creating many ToDo entities in bulk.

func (*ToDoCreateBulk) Exec

func (tdcb *ToDoCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ToDoCreateBulk) ExecX

func (tdcb *ToDoCreateBulk) ExecX(ctx context.Context)

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

func (*ToDoCreateBulk) Save

func (tdcb *ToDoCreateBulk) Save(ctx context.Context) ([]*ToDo, error)

Save creates the ToDo entities in the database.

func (*ToDoCreateBulk) SaveX

func (tdcb *ToDoCreateBulk) SaveX(ctx context.Context) []*ToDo

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

type ToDoDelete

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

ToDoDelete is the builder for deleting a ToDo entity.

func (*ToDoDelete) Exec

func (tdd *ToDoDelete) Exec(ctx context.Context) (int, error)

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

func (*ToDoDelete) ExecX

func (tdd *ToDoDelete) ExecX(ctx context.Context) int

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

func (*ToDoDelete) Where

func (tdd *ToDoDelete) Where(ps ...predicate.ToDo) *ToDoDelete

Where appends a list predicates to the ToDoDelete builder.

type ToDoDeleteOne

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

ToDoDeleteOne is the builder for deleting a single ToDo entity.

func (*ToDoDeleteOne) Exec

func (tddo *ToDoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ToDoDeleteOne) ExecX

func (tddo *ToDoDeleteOne) ExecX(ctx context.Context)

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

type ToDoGroupBy

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

ToDoGroupBy is the group-by builder for ToDo entities.

func (*ToDoGroupBy) Aggregate

func (tdgb *ToDoGroupBy) Aggregate(fns ...AggregateFunc) *ToDoGroupBy

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

func (*ToDoGroupBy) Bool

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

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

func (*ToDoGroupBy) BoolX

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

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

func (*ToDoGroupBy) Bools

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

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

func (*ToDoGroupBy) BoolsX

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

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

func (*ToDoGroupBy) Float64

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

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

func (*ToDoGroupBy) Float64X

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

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

func (*ToDoGroupBy) Float64s

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

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

func (*ToDoGroupBy) Float64sX

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

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

func (*ToDoGroupBy) Int

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

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

func (*ToDoGroupBy) IntX

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

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

func (*ToDoGroupBy) Ints

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

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

func (*ToDoGroupBy) IntsX

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

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

func (*ToDoGroupBy) Scan

func (tdgb *ToDoGroupBy) Scan(ctx context.Context, v any) error

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

func (*ToDoGroupBy) ScanX

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

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

func (*ToDoGroupBy) String

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

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

func (*ToDoGroupBy) StringX

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

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

func (*ToDoGroupBy) Strings

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

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

func (*ToDoGroupBy) StringsX

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

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

type ToDoMutation

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

ToDoMutation represents an operation that mutates the ToDo nodes in the graph.

func (*ToDoMutation) AddField

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

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

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

func (*ToDoMutation) AddedField

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

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

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

func (*ToDoMutation) AddedIDs

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

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

func (*ToDoMutation) ClearEdge

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

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

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

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

func (*ToDoMutation) ClearedFields

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

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

func (ToDoMutation) Client

func (m ToDoMutation) 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 (*ToDoMutation) CratedAt

func (m *ToDoMutation) CratedAt() (r time.Time, exists bool)

CratedAt returns the value of the "crated_at" field in the mutation.

func (*ToDoMutation) EdgeCleared

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

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

func (*ToDoMutation) Field

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

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

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

func (*ToDoMutation) Fields

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

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

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

func (*ToDoMutation) IDs

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

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

func (*ToDoMutation) OldCratedAt

func (m *ToDoMutation) OldCratedAt(ctx context.Context) (v time.Time, err error)

OldCratedAt returns the old "crated_at" field's value of the ToDo entity. If the ToDo 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 (*ToDoMutation) OldField

func (m *ToDoMutation) 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 (*ToDoMutation) OldTodoContext

func (m *ToDoMutation) OldTodoContext(ctx context.Context) (v string, err error)

OldTodoContext returns the old "todo_context" field's value of the ToDo entity. If the ToDo 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 (*ToDoMutation) OldTodoTitle

func (m *ToDoMutation) OldTodoTitle(ctx context.Context) (v string, err error)

OldTodoTitle returns the old "todo_title" field's value of the ToDo entity. If the ToDo 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 (*ToDoMutation) OldTodoUUID

func (m *ToDoMutation) OldTodoUUID(ctx context.Context) (v uuid.UUID, err error)

OldTodoUUID returns the old "todo_uuid" field's value of the ToDo entity. If the ToDo 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 (*ToDoMutation) OldUpdatedAt

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

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

func (m *ToDoMutation) OldUserUUID(ctx context.Context) (v uuid.UUID, err error)

OldUserUUID returns the old "user_uuid" field's value of the ToDo entity. If the ToDo 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 (*ToDoMutation) Op

func (m *ToDoMutation) Op() Op

Op returns the operation name.

func (*ToDoMutation) RemovedEdges

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

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

func (*ToDoMutation) RemovedIDs

func (m *ToDoMutation) 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 (*ToDoMutation) ResetCratedAt

func (m *ToDoMutation) ResetCratedAt()

ResetCratedAt resets all changes to the "crated_at" field.

func (*ToDoMutation) ResetEdge

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

func (m *ToDoMutation) 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 (*ToDoMutation) ResetTodoContext

func (m *ToDoMutation) ResetTodoContext()

ResetTodoContext resets all changes to the "todo_context" field.

func (*ToDoMutation) ResetTodoTitle

func (m *ToDoMutation) ResetTodoTitle()

ResetTodoTitle resets all changes to the "todo_title" field.

func (*ToDoMutation) ResetTodoUUID

func (m *ToDoMutation) ResetTodoUUID()

ResetTodoUUID resets all changes to the "todo_uuid" field.

func (*ToDoMutation) ResetUpdatedAt

func (m *ToDoMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ToDoMutation) ResetUserUUID

func (m *ToDoMutation) ResetUserUUID()

ResetUserUUID resets all changes to the "user_uuid" field.

func (*ToDoMutation) SetCratedAt

func (m *ToDoMutation) SetCratedAt(t time.Time)

SetCratedAt sets the "crated_at" field.

func (*ToDoMutation) SetField

func (m *ToDoMutation) 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 (*ToDoMutation) SetTodoContext

func (m *ToDoMutation) SetTodoContext(s string)

SetTodoContext sets the "todo_context" field.

func (*ToDoMutation) SetTodoTitle

func (m *ToDoMutation) SetTodoTitle(s string)

SetTodoTitle sets the "todo_title" field.

func (*ToDoMutation) SetTodoUUID

func (m *ToDoMutation) SetTodoUUID(u uuid.UUID)

SetTodoUUID sets the "todo_uuid" field.

func (*ToDoMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ToDoMutation) SetUserUUID

func (m *ToDoMutation) SetUserUUID(u uuid.UUID)

SetUserUUID sets the "user_uuid" field.

func (*ToDoMutation) TodoContext

func (m *ToDoMutation) TodoContext() (r string, exists bool)

TodoContext returns the value of the "todo_context" field in the mutation.

func (*ToDoMutation) TodoTitle

func (m *ToDoMutation) TodoTitle() (r string, exists bool)

TodoTitle returns the value of the "todo_title" field in the mutation.

func (*ToDoMutation) TodoUUID

func (m *ToDoMutation) TodoUUID() (r uuid.UUID, exists bool)

TodoUUID returns the value of the "todo_uuid" field in the mutation.

func (ToDoMutation) Tx

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

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

func (*ToDoMutation) Type

func (m *ToDoMutation) Type() string

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

func (*ToDoMutation) UpdatedAt

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

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

func (*ToDoMutation) UserUUID

func (m *ToDoMutation) UserUUID() (r uuid.UUID, exists bool)

UserUUID returns the value of the "user_uuid" field in the mutation.

func (*ToDoMutation) Where

func (m *ToDoMutation) Where(ps ...predicate.ToDo)

Where appends a list predicates to the ToDoMutation builder.

type ToDoQuery

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

ToDoQuery is the builder for querying ToDo entities.

func (*ToDoQuery) Aggregate

func (tdq *ToDoQuery) Aggregate(fns ...AggregateFunc) *ToDoSelect

Aggregate returns a ToDoSelect configured with the given aggregations.

func (*ToDoQuery) All

func (tdq *ToDoQuery) All(ctx context.Context) ([]*ToDo, error)

All executes the query and returns a list of ToDos.

func (*ToDoQuery) AllX

func (tdq *ToDoQuery) AllX(ctx context.Context) []*ToDo

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

func (*ToDoQuery) Clone

func (tdq *ToDoQuery) Clone() *ToDoQuery

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

func (*ToDoQuery) Count

func (tdq *ToDoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ToDoQuery) CountX

func (tdq *ToDoQuery) CountX(ctx context.Context) int

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

func (*ToDoQuery) Exist

func (tdq *ToDoQuery) Exist(ctx context.Context) (bool, error)

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

func (*ToDoQuery) ExistX

func (tdq *ToDoQuery) ExistX(ctx context.Context) bool

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

func (*ToDoQuery) First

func (tdq *ToDoQuery) First(ctx context.Context) (*ToDo, error)

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

func (*ToDoQuery) FirstID

func (tdq *ToDoQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ToDoQuery) FirstIDX

func (tdq *ToDoQuery) FirstIDX(ctx context.Context) int

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

func (*ToDoQuery) FirstX

func (tdq *ToDoQuery) FirstX(ctx context.Context) *ToDo

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

func (*ToDoQuery) GroupBy

func (tdq *ToDoQuery) GroupBy(field string, fields ...string) *ToDoGroupBy

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 {
	TodoUUID uuid.UUID `json:"todo_uuid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.ToDo.Query().
	GroupBy(todo.FieldTodoUUID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ToDoQuery) IDs

func (tdq *ToDoQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ToDoQuery) IDsX

func (tdq *ToDoQuery) IDsX(ctx context.Context) []int

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

func (*ToDoQuery) Limit

func (tdq *ToDoQuery) Limit(limit int) *ToDoQuery

Limit adds a limit step to the query.

func (*ToDoQuery) Offset

func (tdq *ToDoQuery) Offset(offset int) *ToDoQuery

Offset adds an offset step to the query.

func (*ToDoQuery) Only

func (tdq *ToDoQuery) Only(ctx context.Context) (*ToDo, error)

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

func (*ToDoQuery) OnlyID

func (tdq *ToDoQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ToDoQuery) OnlyIDX

func (tdq *ToDoQuery) OnlyIDX(ctx context.Context) int

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

func (*ToDoQuery) OnlyX

func (tdq *ToDoQuery) OnlyX(ctx context.Context) *ToDo

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

func (*ToDoQuery) Order

func (tdq *ToDoQuery) Order(o ...OrderFunc) *ToDoQuery

Order adds an order step to the query.

func (*ToDoQuery) Select

func (tdq *ToDoQuery) Select(fields ...string) *ToDoSelect

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 {
	TodoUUID uuid.UUID `json:"todo_uuid,omitempty"`
}

client.ToDo.Query().
	Select(todo.FieldTodoUUID).
	Scan(ctx, &v)

func (*ToDoQuery) Unique

func (tdq *ToDoQuery) Unique(unique bool) *ToDoQuery

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

func (tdq *ToDoQuery) Where(ps ...predicate.ToDo) *ToDoQuery

Where adds a new predicate for the ToDoQuery builder.

type ToDoSelect

type ToDoSelect struct {
	*ToDoQuery
	// contains filtered or unexported fields
}

ToDoSelect is the builder for selecting fields of ToDo entities.

func (*ToDoSelect) Aggregate

func (tds *ToDoSelect) Aggregate(fns ...AggregateFunc) *ToDoSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ToDoSelect) Bool

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

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

func (*ToDoSelect) BoolX

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

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

func (*ToDoSelect) Bools

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

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

func (*ToDoSelect) BoolsX

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

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

func (*ToDoSelect) Float64

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

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

func (*ToDoSelect) Float64X

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

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

func (*ToDoSelect) Float64s

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

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

func (*ToDoSelect) Float64sX

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

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

func (*ToDoSelect) Int

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

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

func (*ToDoSelect) IntX

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

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

func (*ToDoSelect) Ints

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

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

func (*ToDoSelect) IntsX

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

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

func (*ToDoSelect) Scan

func (tds *ToDoSelect) Scan(ctx context.Context, v any) error

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

func (*ToDoSelect) ScanX

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

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

func (*ToDoSelect) String

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

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

func (*ToDoSelect) StringX

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

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

func (*ToDoSelect) Strings

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

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

func (*ToDoSelect) StringsX

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

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

type ToDoUpdate

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

ToDoUpdate is the builder for updating ToDo entities.

func (*ToDoUpdate) Exec

func (tdu *ToDoUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToDoUpdate) ExecX

func (tdu *ToDoUpdate) ExecX(ctx context.Context)

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

func (*ToDoUpdate) Mutation

func (tdu *ToDoUpdate) Mutation() *ToDoMutation

Mutation returns the ToDoMutation object of the builder.

func (*ToDoUpdate) Save

func (tdu *ToDoUpdate) Save(ctx context.Context) (int, error)

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

func (*ToDoUpdate) SaveX

func (tdu *ToDoUpdate) SaveX(ctx context.Context) int

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

func (*ToDoUpdate) SetCratedAt

func (tdu *ToDoUpdate) SetCratedAt(t time.Time) *ToDoUpdate

SetCratedAt sets the "crated_at" field.

func (*ToDoUpdate) SetNillableTodoUUID

func (tdu *ToDoUpdate) SetNillableTodoUUID(u *uuid.UUID) *ToDoUpdate

SetNillableTodoUUID sets the "todo_uuid" field if the given value is not nil.

func (*ToDoUpdate) SetNillableUserUUID

func (tdu *ToDoUpdate) SetNillableUserUUID(u *uuid.UUID) *ToDoUpdate

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*ToDoUpdate) SetTodoContext

func (tdu *ToDoUpdate) SetTodoContext(s string) *ToDoUpdate

SetTodoContext sets the "todo_context" field.

func (*ToDoUpdate) SetTodoTitle

func (tdu *ToDoUpdate) SetTodoTitle(s string) *ToDoUpdate

SetTodoTitle sets the "todo_title" field.

func (*ToDoUpdate) SetTodoUUID

func (tdu *ToDoUpdate) SetTodoUUID(u uuid.UUID) *ToDoUpdate

SetTodoUUID sets the "todo_uuid" field.

func (*ToDoUpdate) SetUpdatedAt

func (tdu *ToDoUpdate) SetUpdatedAt(t time.Time) *ToDoUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ToDoUpdate) SetUserUUID

func (tdu *ToDoUpdate) SetUserUUID(u uuid.UUID) *ToDoUpdate

SetUserUUID sets the "user_uuid" field.

func (*ToDoUpdate) Where

func (tdu *ToDoUpdate) Where(ps ...predicate.ToDo) *ToDoUpdate

Where appends a list predicates to the ToDoUpdate builder.

type ToDoUpdateOne

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

ToDoUpdateOne is the builder for updating a single ToDo entity.

func (*ToDoUpdateOne) Exec

func (tduo *ToDoUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ToDoUpdateOne) ExecX

func (tduo *ToDoUpdateOne) ExecX(ctx context.Context)

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

func (*ToDoUpdateOne) Mutation

func (tduo *ToDoUpdateOne) Mutation() *ToDoMutation

Mutation returns the ToDoMutation object of the builder.

func (*ToDoUpdateOne) Save

func (tduo *ToDoUpdateOne) Save(ctx context.Context) (*ToDo, error)

Save executes the query and returns the updated ToDo entity.

func (*ToDoUpdateOne) SaveX

func (tduo *ToDoUpdateOne) SaveX(ctx context.Context) *ToDo

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

func (*ToDoUpdateOne) Select

func (tduo *ToDoUpdateOne) Select(field string, fields ...string) *ToDoUpdateOne

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

func (*ToDoUpdateOne) SetCratedAt

func (tduo *ToDoUpdateOne) SetCratedAt(t time.Time) *ToDoUpdateOne

SetCratedAt sets the "crated_at" field.

func (*ToDoUpdateOne) SetNillableTodoUUID

func (tduo *ToDoUpdateOne) SetNillableTodoUUID(u *uuid.UUID) *ToDoUpdateOne

SetNillableTodoUUID sets the "todo_uuid" field if the given value is not nil.

func (*ToDoUpdateOne) SetNillableUserUUID

func (tduo *ToDoUpdateOne) SetNillableUserUUID(u *uuid.UUID) *ToDoUpdateOne

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*ToDoUpdateOne) SetTodoContext

func (tduo *ToDoUpdateOne) SetTodoContext(s string) *ToDoUpdateOne

SetTodoContext sets the "todo_context" field.

func (*ToDoUpdateOne) SetTodoTitle

func (tduo *ToDoUpdateOne) SetTodoTitle(s string) *ToDoUpdateOne

SetTodoTitle sets the "todo_title" field.

func (*ToDoUpdateOne) SetTodoUUID

func (tduo *ToDoUpdateOne) SetTodoUUID(u uuid.UUID) *ToDoUpdateOne

SetTodoUUID sets the "todo_uuid" field.

func (*ToDoUpdateOne) SetUpdatedAt

func (tduo *ToDoUpdateOne) SetUpdatedAt(t time.Time) *ToDoUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ToDoUpdateOne) SetUserUUID

func (tduo *ToDoUpdateOne) SetUserUUID(u uuid.UUID) *ToDoUpdateOne

SetUserUUID sets the "user_uuid" field.

type ToDos

type ToDos []*ToDo

ToDos is a parsable slice of ToDo.

type Tx

type Tx struct {

	// ToDo is the client for interacting with the ToDo builders.
	ToDo *ToDoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// UserUUID holds the value of the "user_uuid" field.
	UserUUID uuid.UUID `json:"user_uuid,omitempty"`
	// UserEmail holds the value of the "user_email" field.
	UserEmail string `json:"user_email,omitempty"`
	// UserPassword holds the value of the "user_password" field.
	UserPassword string `json:"user_password,omitempty"`
	// UserNickname holds the value of the "user_nickname" field.
	UserNickname string `json:"user_nickname,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"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableUserEmail

func (uc *UserCreate) SetNillableUserEmail(s *string) *UserCreate

SetNillableUserEmail sets the "user_email" field if the given value is not nil.

func (*UserCreate) SetNillableUserNickname

func (uc *UserCreate) SetNillableUserNickname(s *string) *UserCreate

SetNillableUserNickname sets the "user_nickname" field if the given value is not nil.

func (*UserCreate) SetNillableUserPassword

func (uc *UserCreate) SetNillableUserPassword(s *string) *UserCreate

SetNillableUserPassword sets the "user_password" field if the given value is not nil.

func (*UserCreate) SetNillableUserUUID

func (uc *UserCreate) SetNillableUserUUID(u *uuid.UUID) *UserCreate

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUserEmail

func (uc *UserCreate) SetUserEmail(s string) *UserCreate

SetUserEmail sets the "user_email" field.

func (*UserCreate) SetUserNickname

func (uc *UserCreate) SetUserNickname(s string) *UserCreate

SetUserNickname sets the "user_nickname" field.

func (*UserCreate) SetUserPassword

func (uc *UserCreate) SetUserPassword(s string) *UserCreate

SetUserPassword sets the "user_password" field.

func (*UserCreate) SetUserUUID

func (uc *UserCreate) SetUserUUID(u uuid.UUID) *UserCreate

SetUserUUID sets the "user_uuid" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

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

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

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

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

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

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) ClearEdge

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

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

func (*UserMutation) ClearField

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

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

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

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

func (*UserMutation) CreatedAt

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

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

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Field

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

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

func (*UserMutation) FieldCleared

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

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

func (*UserMutation) Fields

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

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

func (*UserMutation) ID

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

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

func (*UserMutation) IDs

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

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

func (*UserMutation) OldCreatedAt

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

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

func (*UserMutation) OldField

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

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

func (*UserMutation) OldUpdatedAt

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

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

func (*UserMutation) OldUserEmail

func (m *UserMutation) OldUserEmail(ctx context.Context) (v string, err error)

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

func (*UserMutation) OldUserNickname

func (m *UserMutation) OldUserNickname(ctx context.Context) (v string, err error)

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

func (*UserMutation) OldUserPassword

func (m *UserMutation) OldUserPassword(ctx context.Context) (v string, err error)

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

func (*UserMutation) OldUserUUID

func (m *UserMutation) OldUserUUID(ctx context.Context) (v uuid.UUID, err error)

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

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

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

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

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

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

func (*UserMutation) ResetField

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

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

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUserEmail

func (m *UserMutation) ResetUserEmail()

ResetUserEmail resets all changes to the "user_email" field.

func (*UserMutation) ResetUserNickname

func (m *UserMutation) ResetUserNickname()

ResetUserNickname resets all changes to the "user_nickname" field.

func (*UserMutation) ResetUserPassword

func (m *UserMutation) ResetUserPassword()

ResetUserPassword resets all changes to the "user_password" field.

func (*UserMutation) ResetUserUUID

func (m *UserMutation) ResetUserUUID()

ResetUserUUID resets all changes to the "user_uuid" field.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetField

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

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

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUserEmail

func (m *UserMutation) SetUserEmail(s string)

SetUserEmail sets the "user_email" field.

func (*UserMutation) SetUserNickname

func (m *UserMutation) SetUserNickname(s string)

SetUserNickname sets the "user_nickname" field.

func (*UserMutation) SetUserPassword

func (m *UserMutation) SetUserPassword(s string)

SetUserPassword sets the "user_password" field.

func (*UserMutation) SetUserUUID

func (m *UserMutation) SetUserUUID(u uuid.UUID)

SetUserUUID sets the "user_uuid" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdatedAt

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

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

func (*UserMutation) UserEmail

func (m *UserMutation) UserEmail() (r string, exists bool)

UserEmail returns the value of the "user_email" field in the mutation.

func (*UserMutation) UserNickname

func (m *UserMutation) UserNickname() (r string, exists bool)

UserNickname returns the value of the "user_nickname" field in the mutation.

func (*UserMutation) UserPassword

func (m *UserMutation) UserPassword() (r string, exists bool)

UserPassword returns the value of the "user_password" field in the mutation.

func (*UserMutation) UserUUID

func (m *UserMutation) UserUUID() (r uuid.UUID, exists bool)

UserUUID returns the value of the "user_uuid" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

var v []struct {
	UserUUID uuid.UUID `json:"user_uuid,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldUserUUID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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

Example:

var v []struct {
	UserUUID uuid.UUID `json:"user_uuid,omitempty"`
}

client.User.Query().
	Select(user.FieldUserUUID).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

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

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetNillableUserEmail

func (uu *UserUpdate) SetNillableUserEmail(s *string) *UserUpdate

SetNillableUserEmail sets the "user_email" field if the given value is not nil.

func (*UserUpdate) SetNillableUserNickname

func (uu *UserUpdate) SetNillableUserNickname(s *string) *UserUpdate

SetNillableUserNickname sets the "user_nickname" field if the given value is not nil.

func (*UserUpdate) SetNillableUserPassword

func (uu *UserUpdate) SetNillableUserPassword(s *string) *UserUpdate

SetNillableUserPassword sets the "user_password" field if the given value is not nil.

func (*UserUpdate) SetNillableUserUUID

func (uu *UserUpdate) SetNillableUserUUID(u *uuid.UUID) *UserUpdate

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUserEmail

func (uu *UserUpdate) SetUserEmail(s string) *UserUpdate

SetUserEmail sets the "user_email" field.

func (*UserUpdate) SetUserNickname

func (uu *UserUpdate) SetUserNickname(s string) *UserUpdate

SetUserNickname sets the "user_nickname" field.

func (*UserUpdate) SetUserPassword

func (uu *UserUpdate) SetUserPassword(s string) *UserUpdate

SetUserPassword sets the "user_password" field.

func (*UserUpdate) SetUserUUID

func (uu *UserUpdate) SetUserUUID(u uuid.UUID) *UserUpdate

SetUserUUID sets the "user_uuid" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetNillableUserEmail

func (uuo *UserUpdateOne) SetNillableUserEmail(s *string) *UserUpdateOne

SetNillableUserEmail sets the "user_email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUserNickname

func (uuo *UserUpdateOne) SetNillableUserNickname(s *string) *UserUpdateOne

SetNillableUserNickname sets the "user_nickname" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUserPassword

func (uuo *UserUpdateOne) SetNillableUserPassword(s *string) *UserUpdateOne

SetNillableUserPassword sets the "user_password" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUserUUID

func (uuo *UserUpdateOne) SetNillableUserUUID(u *uuid.UUID) *UserUpdateOne

SetNillableUserUUID sets the "user_uuid" field if the given value is not nil.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUserEmail

func (uuo *UserUpdateOne) SetUserEmail(s string) *UserUpdateOne

SetUserEmail sets the "user_email" field.

func (*UserUpdateOne) SetUserNickname

func (uuo *UserUpdateOne) SetUserNickname(s string) *UserUpdateOne

SetUserNickname sets the "user_nickname" field.

func (*UserUpdateOne) SetUserPassword

func (uuo *UserUpdateOne) SetUserPassword(s string) *UserUpdateOne

SetUserPassword sets the "user_password" field.

func (*UserUpdateOne) SetUserUUID

func (uuo *UserUpdateOne) SetUserUUID(u uuid.UUID) *UserUpdateOne

SetUserUUID sets the "user_uuid" field.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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