ent

package
v0.0.0-...-d470ab9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeAddress = "Address"
	TypeUser    = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type Address

type Address struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Street holds the value of the "street" field.
	Street string `json:"street,omitempty"`
	// District holds the value of the "district" field.
	District string `json:"district,omitempty"`
	// City holds the value of the "city" field.
	City string `json:"city,omitempty"`
	// Country holds the value of the "country" field.
	Country string `json:"country,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
}

Address is the model entity for the Address schema.

func (*Address) String

func (a *Address) String() string

String implements the fmt.Stringer.

func (*Address) Unwrap

func (a *Address) Unwrap() *Address

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

func (a *Address) Update() *AddressUpdateOne

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

func (*Address) Value

func (a *Address) Value(name string) (ent.Value, error)

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

type AddressClient

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

AddressClient is a client for the Address schema.

func NewAddressClient

func NewAddressClient(c config) *AddressClient

NewAddressClient returns a client for the Address from the given config.

func (*AddressClient) Create

func (c *AddressClient) Create() *AddressCreate

Create returns a builder for creating a Address entity.

func (*AddressClient) CreateBulk

func (c *AddressClient) CreateBulk(builders ...*AddressCreate) *AddressCreateBulk

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

func (*AddressClient) Delete

func (c *AddressClient) Delete() *AddressDelete

Delete returns a delete builder for Address.

func (*AddressClient) DeleteOne

func (c *AddressClient) DeleteOne(a *Address) *AddressDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AddressClient) DeleteOneID

func (c *AddressClient) DeleteOneID(id int) *AddressDeleteOne

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

func (*AddressClient) Get

func (c *AddressClient) Get(ctx context.Context, id int) (*Address, error)

Get returns a Address entity by its id.

func (*AddressClient) GetX

func (c *AddressClient) GetX(ctx context.Context, id int) *Address

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

func (*AddressClient) Hooks

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

Hooks returns the client hooks.

func (*AddressClient) Intercept

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

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

func (*AddressClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AddressClient) MapCreateBulk

func (c *AddressClient) MapCreateBulk(slice any, setFunc func(*AddressCreate, int)) *AddressCreateBulk

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

func (*AddressClient) Query

func (c *AddressClient) Query() *AddressQuery

Query returns a query builder for Address.

func (*AddressClient) Update

func (c *AddressClient) Update() *AddressUpdate

Update returns an update builder for Address.

func (*AddressClient) UpdateOne

func (c *AddressClient) UpdateOne(a *Address) *AddressUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AddressClient) UpdateOneID

func (c *AddressClient) UpdateOneID(id int) *AddressUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AddressClient) Use

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

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

type AddressCreate

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

AddressCreate is the builder for creating a Address entity.

func (*AddressCreate) Exec

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

Exec executes the query.

func (*AddressCreate) ExecX

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

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

func (*AddressCreate) Mutation

func (ac *AddressCreate) Mutation() *AddressMutation

Mutation returns the AddressMutation object of the builder.

func (*AddressCreate) Save

func (ac *AddressCreate) Save(ctx context.Context) (*Address, error)

Save creates the Address in the database.

func (*AddressCreate) SaveX

func (ac *AddressCreate) SaveX(ctx context.Context) *Address

SaveX calls Save and panics if Save returns an error.

func (*AddressCreate) SetCity

func (ac *AddressCreate) SetCity(s string) *AddressCreate

SetCity sets the "city" field.

func (*AddressCreate) SetCountry

func (ac *AddressCreate) SetCountry(s string) *AddressCreate

SetCountry sets the "country" field.

func (*AddressCreate) SetCreatedAt

func (ac *AddressCreate) SetCreatedAt(t time.Time) *AddressCreate

SetCreatedAt sets the "created_at" field.

func (*AddressCreate) SetDistrict

func (ac *AddressCreate) SetDistrict(s string) *AddressCreate

SetDistrict sets the "district" field.

func (*AddressCreate) SetID

func (ac *AddressCreate) SetID(i int) *AddressCreate

SetID sets the "id" field.

func (*AddressCreate) SetNillableCreatedAt

func (ac *AddressCreate) SetNillableCreatedAt(t *time.Time) *AddressCreate

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

func (*AddressCreate) SetNillableUpdatedAt

func (ac *AddressCreate) SetNillableUpdatedAt(t *time.Time) *AddressCreate

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

func (*AddressCreate) SetStreet

func (ac *AddressCreate) SetStreet(s string) *AddressCreate

SetStreet sets the "street" field.

func (*AddressCreate) SetUpdatedAt

func (ac *AddressCreate) SetUpdatedAt(t time.Time) *AddressCreate

SetUpdatedAt sets the "updated_at" field.

type AddressCreateBulk

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

AddressCreateBulk is the builder for creating many Address entities in bulk.

func (*AddressCreateBulk) Exec

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

Exec executes the query.

func (*AddressCreateBulk) ExecX

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

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

func (*AddressCreateBulk) Save

func (acb *AddressCreateBulk) Save(ctx context.Context) ([]*Address, error)

Save creates the Address entities in the database.

func (*AddressCreateBulk) SaveX

func (acb *AddressCreateBulk) SaveX(ctx context.Context) []*Address

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

type AddressDelete

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

AddressDelete is the builder for deleting a Address entity.

func (*AddressDelete) Exec

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

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

func (*AddressDelete) ExecX

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

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

func (*AddressDelete) Where

func (ad *AddressDelete) Where(ps ...predicate.Address) *AddressDelete

Where appends a list predicates to the AddressDelete builder.

type AddressDeleteOne

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

AddressDeleteOne is the builder for deleting a single Address entity.

func (*AddressDeleteOne) Exec

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

Exec executes the deletion query.

func (*AddressDeleteOne) ExecX

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

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

func (*AddressDeleteOne) Where

Where appends a list predicates to the AddressDelete builder.

type AddressGroupBy

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

AddressGroupBy is the group-by builder for Address entities.

func (*AddressGroupBy) Aggregate

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

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

func (*AddressGroupBy) Bool

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

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

func (*AddressGroupBy) BoolX

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

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

func (*AddressGroupBy) Bools

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

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

func (*AddressGroupBy) BoolsX

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

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

func (*AddressGroupBy) Float64

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

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

func (*AddressGroupBy) Float64X

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

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

func (*AddressGroupBy) Float64s

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

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

func (*AddressGroupBy) Float64sX

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

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

func (*AddressGroupBy) Int

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

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

func (*AddressGroupBy) IntX

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

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

func (*AddressGroupBy) Ints

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

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

func (*AddressGroupBy) IntsX

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

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

func (*AddressGroupBy) Scan

func (agb *AddressGroupBy) Scan(ctx context.Context, v any) error

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

func (*AddressGroupBy) ScanX

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

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

func (*AddressGroupBy) String

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

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

func (*AddressGroupBy) StringX

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

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

func (*AddressGroupBy) Strings

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

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

func (*AddressGroupBy) StringsX

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

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

type AddressMutation

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

AddressMutation represents an operation that mutates the Address nodes in the graph.

func (*AddressMutation) AddField

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

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

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

func (*AddressMutation) AddedField

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

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

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

func (*AddressMutation) AddedIDs

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

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

func (*AddressMutation) City

func (m *AddressMutation) City() (r string, exists bool)

City returns the value of the "city" field in the mutation.

func (*AddressMutation) ClearEdge

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

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

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

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

func (*AddressMutation) ClearedFields

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

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

func (AddressMutation) Client

func (m AddressMutation) 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 (*AddressMutation) Country

func (m *AddressMutation) Country() (r string, exists bool)

Country returns the value of the "country" field in the mutation.

func (*AddressMutation) CreatedAt

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

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

func (*AddressMutation) District

func (m *AddressMutation) District() (r string, exists bool)

District returns the value of the "district" field in the mutation.

func (*AddressMutation) EdgeCleared

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

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

func (*AddressMutation) Field

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

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

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

func (*AddressMutation) Fields

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

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

func (m *AddressMutation) 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 (*AddressMutation) OldCity

func (m *AddressMutation) OldCity(ctx context.Context) (v string, err error)

OldCity returns the old "city" field's value of the Address entity. If the Address 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 (*AddressMutation) OldCountry

func (m *AddressMutation) OldCountry(ctx context.Context) (v string, err error)

OldCountry returns the old "country" field's value of the Address entity. If the Address 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 (*AddressMutation) OldCreatedAt

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

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

func (m *AddressMutation) OldDistrict(ctx context.Context) (v string, err error)

OldDistrict returns the old "district" field's value of the Address entity. If the Address 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 (*AddressMutation) OldField

func (m *AddressMutation) 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 (*AddressMutation) OldStreet

func (m *AddressMutation) OldStreet(ctx context.Context) (v string, err error)

OldStreet returns the old "street" field's value of the Address entity. If the Address 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 (*AddressMutation) OldUpdatedAt

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

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

func (m *AddressMutation) Op() Op

Op returns the operation name.

func (*AddressMutation) RemovedEdges

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

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

func (*AddressMutation) RemovedIDs

func (m *AddressMutation) 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 (*AddressMutation) ResetCity

func (m *AddressMutation) ResetCity()

ResetCity resets all changes to the "city" field.

func (*AddressMutation) ResetCountry

func (m *AddressMutation) ResetCountry()

ResetCountry resets all changes to the "country" field.

func (*AddressMutation) ResetCreatedAt

func (m *AddressMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AddressMutation) ResetDistrict

func (m *AddressMutation) ResetDistrict()

ResetDistrict resets all changes to the "district" field.

func (*AddressMutation) ResetEdge

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

func (m *AddressMutation) 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 (*AddressMutation) ResetStreet

func (m *AddressMutation) ResetStreet()

ResetStreet resets all changes to the "street" field.

func (*AddressMutation) ResetUpdatedAt

func (m *AddressMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AddressMutation) SetCity

func (m *AddressMutation) SetCity(s string)

SetCity sets the "city" field.

func (*AddressMutation) SetCountry

func (m *AddressMutation) SetCountry(s string)

SetCountry sets the "country" field.

func (*AddressMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*AddressMutation) SetDistrict

func (m *AddressMutation) SetDistrict(s string)

SetDistrict sets the "district" field.

func (*AddressMutation) SetField

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

func (m *AddressMutation) SetID(id int)

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

func (*AddressMutation) SetOp

func (m *AddressMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AddressMutation) SetStreet

func (m *AddressMutation) SetStreet(s string)

SetStreet sets the "street" field.

func (*AddressMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*AddressMutation) Street

func (m *AddressMutation) Street() (r string, exists bool)

Street returns the value of the "street" field in the mutation.

func (AddressMutation) Tx

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

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

func (*AddressMutation) Type

func (m *AddressMutation) Type() string

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

func (*AddressMutation) UpdatedAt

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

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

func (*AddressMutation) Where

func (m *AddressMutation) Where(ps ...predicate.Address)

Where appends a list predicates to the AddressMutation builder.

func (*AddressMutation) WhereP

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

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

type AddressQuery

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

AddressQuery is the builder for querying Address entities.

func (*AddressQuery) Aggregate

func (aq *AddressQuery) Aggregate(fns ...AggregateFunc) *AddressSelect

Aggregate returns a AddressSelect configured with the given aggregations.

func (*AddressQuery) All

func (aq *AddressQuery) All(ctx context.Context) ([]*Address, error)

All executes the query and returns a list of Addresses.

func (*AddressQuery) AllX

func (aq *AddressQuery) AllX(ctx context.Context) []*Address

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

func (*AddressQuery) Clone

func (aq *AddressQuery) Clone() *AddressQuery

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

func (*AddressQuery) Count

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

Count returns the count of the given query.

func (*AddressQuery) CountX

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

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

func (*AddressQuery) Exist

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

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

func (*AddressQuery) ExistX

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

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

func (*AddressQuery) First

func (aq *AddressQuery) First(ctx context.Context) (*Address, error)

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

func (*AddressQuery) FirstID

func (aq *AddressQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*AddressQuery) FirstIDX

func (aq *AddressQuery) FirstIDX(ctx context.Context) int

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

func (*AddressQuery) FirstX

func (aq *AddressQuery) FirstX(ctx context.Context) *Address

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

func (*AddressQuery) GroupBy

func (aq *AddressQuery) GroupBy(field string, fields ...string) *AddressGroupBy

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

client.Address.Query().
	GroupBy(address.FieldStreet).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AddressQuery) IDs

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

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

func (*AddressQuery) IDsX

func (aq *AddressQuery) IDsX(ctx context.Context) []int

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

func (*AddressQuery) Limit

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

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

func (*AddressQuery) Offset

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

Offset to start from.

func (*AddressQuery) Only

func (aq *AddressQuery) Only(ctx context.Context) (*Address, error)

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

func (*AddressQuery) OnlyID

func (aq *AddressQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*AddressQuery) OnlyIDX

func (aq *AddressQuery) OnlyIDX(ctx context.Context) int

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

func (*AddressQuery) OnlyX

func (aq *AddressQuery) OnlyX(ctx context.Context) *Address

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

func (*AddressQuery) Order

func (aq *AddressQuery) Order(o ...address.OrderOption) *AddressQuery

Order specifies how the records should be ordered.

func (*AddressQuery) Select

func (aq *AddressQuery) Select(fields ...string) *AddressSelect

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

client.Address.Query().
	Select(address.FieldStreet).
	Scan(ctx, &v)

func (*AddressQuery) Unique

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

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

func (aq *AddressQuery) Where(ps ...predicate.Address) *AddressQuery

Where adds a new predicate for the AddressQuery builder.

type AddressSelect

type AddressSelect struct {
	*AddressQuery
	// contains filtered or unexported fields
}

AddressSelect is the builder for selecting fields of Address entities.

func (*AddressSelect) Aggregate

func (as *AddressSelect) Aggregate(fns ...AggregateFunc) *AddressSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AddressSelect) Bool

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

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

func (*AddressSelect) BoolX

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

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

func (*AddressSelect) Bools

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

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

func (*AddressSelect) BoolsX

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

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

func (*AddressSelect) Float64

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

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

func (*AddressSelect) Float64X

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

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

func (*AddressSelect) Float64s

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

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

func (*AddressSelect) Float64sX

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

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

func (*AddressSelect) Int

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

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

func (*AddressSelect) IntX

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

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

func (*AddressSelect) Ints

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

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

func (*AddressSelect) IntsX

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

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

func (*AddressSelect) Scan

func (as *AddressSelect) Scan(ctx context.Context, v any) error

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

func (*AddressSelect) ScanX

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

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

func (*AddressSelect) String

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

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

func (*AddressSelect) StringX

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

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

func (*AddressSelect) Strings

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

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

func (*AddressSelect) StringsX

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

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

type AddressUpdate

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

AddressUpdate is the builder for updating Address entities.

func (*AddressUpdate) Exec

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

Exec executes the query.

func (*AddressUpdate) ExecX

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

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

func (*AddressUpdate) Mutation

func (au *AddressUpdate) Mutation() *AddressMutation

Mutation returns the AddressMutation object of the builder.

func (*AddressUpdate) Save

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

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

func (*AddressUpdate) SaveX

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

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

func (*AddressUpdate) SetCity

func (au *AddressUpdate) SetCity(s string) *AddressUpdate

SetCity sets the "city" field.

func (*AddressUpdate) SetCountry

func (au *AddressUpdate) SetCountry(s string) *AddressUpdate

SetCountry sets the "country" field.

func (*AddressUpdate) SetDistrict

func (au *AddressUpdate) SetDistrict(s string) *AddressUpdate

SetDistrict sets the "district" field.

func (*AddressUpdate) SetNillableCity

func (au *AddressUpdate) SetNillableCity(s *string) *AddressUpdate

SetNillableCity sets the "city" field if the given value is not nil.

func (*AddressUpdate) SetNillableCountry

func (au *AddressUpdate) SetNillableCountry(s *string) *AddressUpdate

SetNillableCountry sets the "country" field if the given value is not nil.

func (*AddressUpdate) SetNillableDistrict

func (au *AddressUpdate) SetNillableDistrict(s *string) *AddressUpdate

SetNillableDistrict sets the "district" field if the given value is not nil.

func (*AddressUpdate) SetNillableStreet

func (au *AddressUpdate) SetNillableStreet(s *string) *AddressUpdate

SetNillableStreet sets the "street" field if the given value is not nil.

func (*AddressUpdate) SetStreet

func (au *AddressUpdate) SetStreet(s string) *AddressUpdate

SetStreet sets the "street" field.

func (*AddressUpdate) SetUpdatedAt

func (au *AddressUpdate) SetUpdatedAt(t time.Time) *AddressUpdate

SetUpdatedAt sets the "updated_at" field.

func (*AddressUpdate) Where

func (au *AddressUpdate) Where(ps ...predicate.Address) *AddressUpdate

Where appends a list predicates to the AddressUpdate builder.

type AddressUpdateOne

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

AddressUpdateOne is the builder for updating a single Address entity.

func (*AddressUpdateOne) Exec

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

Exec executes the query on the entity.

func (*AddressUpdateOne) ExecX

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

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

func (*AddressUpdateOne) Mutation

func (auo *AddressUpdateOne) Mutation() *AddressMutation

Mutation returns the AddressMutation object of the builder.

func (*AddressUpdateOne) Save

func (auo *AddressUpdateOne) Save(ctx context.Context) (*Address, error)

Save executes the query and returns the updated Address entity.

func (*AddressUpdateOne) SaveX

func (auo *AddressUpdateOne) SaveX(ctx context.Context) *Address

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

func (*AddressUpdateOne) Select

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

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

func (*AddressUpdateOne) SetCity

func (auo *AddressUpdateOne) SetCity(s string) *AddressUpdateOne

SetCity sets the "city" field.

func (*AddressUpdateOne) SetCountry

func (auo *AddressUpdateOne) SetCountry(s string) *AddressUpdateOne

SetCountry sets the "country" field.

func (*AddressUpdateOne) SetDistrict

func (auo *AddressUpdateOne) SetDistrict(s string) *AddressUpdateOne

SetDistrict sets the "district" field.

func (*AddressUpdateOne) SetNillableCity

func (auo *AddressUpdateOne) SetNillableCity(s *string) *AddressUpdateOne

SetNillableCity sets the "city" field if the given value is not nil.

func (*AddressUpdateOne) SetNillableCountry

func (auo *AddressUpdateOne) SetNillableCountry(s *string) *AddressUpdateOne

SetNillableCountry sets the "country" field if the given value is not nil.

func (*AddressUpdateOne) SetNillableDistrict

func (auo *AddressUpdateOne) SetNillableDistrict(s *string) *AddressUpdateOne

SetNillableDistrict sets the "district" field if the given value is not nil.

func (*AddressUpdateOne) SetNillableStreet

func (auo *AddressUpdateOne) SetNillableStreet(s *string) *AddressUpdateOne

SetNillableStreet sets the "street" field if the given value is not nil.

func (*AddressUpdateOne) SetStreet

func (auo *AddressUpdateOne) SetStreet(s string) *AddressUpdateOne

SetStreet sets the "street" field.

func (*AddressUpdateOne) SetUpdatedAt

func (auo *AddressUpdateOne) SetUpdatedAt(t time.Time) *AddressUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*AddressUpdateOne) Where

Where appends a list predicates to the AddressUpdate builder.

type Addresses

type Addresses []*Address

Addresses is a parsable slice of Address.

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

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Address is the client for interacting with the Address builders.
	Address *AddressClient
	// 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 uuid.UUID `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Avatar holds the value of the "avatar" field.
	Avatar string `json:"avatar,omitempty"`
	// BirthDay holds the value of the "birth_day" field.
	BirthDay string `json:"birth_day,omitempty"`
	// FirstName holds the value of the "first_name" field.
	FirstName string `json:"first_name,omitempty"`
	// LastName holds the value of the "last_name" field.
	LastName string `json:"last_name,omitempty"`
	// PhoneNumber holds the value of the "phone_number" field.
	PhoneNumber string `json:"phone_number,omitempty"`
	// Gender holds the value of the "gender" field.
	Gender int `json:"gender,omitempty"`
	// Status holds the value of the "status" field.
	Status string `json:"status,omitempty"`
	// Address holds the value of the "address" field.
	Address string `json:"address,omitempty"`
	// Street holds the value of the "street" field.
	Street string `json:"street,omitempty"`
	// DistrictID holds the value of the "district_id" field.
	DistrictID string `json:"district_id,omitempty"`
	// CityID holds the value of the "city_id" field.
	CityID string `json:"city_id,omitempty"`
	// CountryCode holds the value of the "country_code" field.
	CountryCode string `json:"country_code,omitempty"`
	// HashPassword holds the value of the "hash_password" field.
	HashPassword string `json:"hash_password,omitempty"`
	// Verified holds the value of the "verified" field.
	Verified bool `json:"verified,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.

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

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

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

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

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

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

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

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

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *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) SetAddress

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

SetAddress sets the "address" field.

func (*UserCreate) SetAvatar

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

SetAvatar sets the "avatar" field.

func (*UserCreate) SetBirthDay

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

SetBirthDay sets the "birth_day" field.

func (*UserCreate) SetCityID

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

SetCityID sets the "city_id" field.

func (*UserCreate) SetCountryCode

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

SetCountryCode sets the "country_code" field.

func (*UserCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetDistrictID

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

SetDistrictID sets the "district_id" field.

func (*UserCreate) SetEmail

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

SetEmail sets the "email" field.

func (*UserCreate) SetFirstName

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

SetFirstName sets the "first_name" field.

func (*UserCreate) SetGender

func (uc *UserCreate) SetGender(i int) *UserCreate

SetGender sets the "gender" field.

func (*UserCreate) SetHashPassword

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

SetHashPassword sets the "hash_password" field.

func (*UserCreate) SetID

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

SetID sets the "id" field.

func (*UserCreate) SetLastName

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

SetLastName sets the "last_name" field.

func (*UserCreate) SetNillableAddress

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

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserCreate) SetNillableAvatar

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

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserCreate) SetNillableBirthDay

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

SetNillableBirthDay sets the "birth_day" field if the given value is not nil.

func (*UserCreate) SetNillableCityID

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

SetNillableCityID sets the "city_id" field if the given value is not nil.

func (*UserCreate) SetNillableCountryCode

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

SetNillableCountryCode sets the "country_code" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedAt

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

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

func (*UserCreate) SetNillableDistrictID

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

SetNillableDistrictID sets the "district_id" field if the given value is not nil.

func (*UserCreate) SetNillableFirstName

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

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*UserCreate) SetNillableGender

func (uc *UserCreate) SetNillableGender(i *int) *UserCreate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserCreate) SetNillableID

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

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

func (*UserCreate) SetNillableLastName

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

SetNillableLastName sets the "last_name" field if the given value is not nil.

func (*UserCreate) SetNillablePhoneNumber

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

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserCreate) SetNillableStreet

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

SetNillableStreet sets the "street" 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) SetNillableVerified

func (uc *UserCreate) SetNillableVerified(b *bool) *UserCreate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserCreate) SetPhoneNumber

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

SetPhoneNumber sets the "phone_number" field.

func (*UserCreate) SetStatus

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

SetStatus sets the "status" field.

func (*UserCreate) SetStreet

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

SetStreet sets the "street" field.

func (*UserCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUsername

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

SetUsername sets the "username" field.

func (*UserCreate) SetVerified

func (uc *UserCreate) SetVerified(b bool) *UserCreate

SetVerified sets the "verified" field.

type UserCreateBulk

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

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

func (*UserCreateBulk) Exec

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

Exec executes the query.

func (*UserCreateBulk) ExecX

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

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

func (*UserCreateBulk) Save

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

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

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

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

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

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

func (*UserDelete) ExecX

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

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

func (*UserDelete) Where

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

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

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

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

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

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

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

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

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

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

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

func (*UserMutation) 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) AddGender

func (m *UserMutation) AddGender(i int)

AddGender adds i to the "gender" field.

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

func (m *UserMutation) AddedGender() (r int, exists bool)

AddedGender returns the value that was added to the "gender" field in 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) Address

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

Address returns the value of the "address" field in the mutation.

func (*UserMutation) AddressCleared

func (m *UserMutation) AddressCleared() bool

AddressCleared returns if the "address" field was cleared in this mutation.

func (*UserMutation) Avatar

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

Avatar returns the value of the "avatar" field in the mutation.

func (*UserMutation) AvatarCleared

func (m *UserMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*UserMutation) BirthDay

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

BirthDay returns the value of the "birth_day" field in the mutation.

func (*UserMutation) BirthDayCleared

func (m *UserMutation) BirthDayCleared() bool

BirthDayCleared returns if the "birth_day" field was cleared in this mutation.

func (*UserMutation) CityID

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

CityID returns the value of the "city_id" field in the mutation.

func (*UserMutation) CityIDCleared

func (m *UserMutation) CityIDCleared() bool

CityIDCleared returns if the "city_id" field was cleared in this mutation.

func (*UserMutation) ClearAddress

func (m *UserMutation) ClearAddress()

ClearAddress clears the value of the "address" field.

func (*UserMutation) ClearAvatar

func (m *UserMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UserMutation) ClearBirthDay

func (m *UserMutation) ClearBirthDay()

ClearBirthDay clears the value of the "birth_day" field.

func (*UserMutation) ClearCityID

func (m *UserMutation) ClearCityID()

ClearCityID clears the value of the "city_id" field.

func (*UserMutation) ClearCountryCode

func (m *UserMutation) ClearCountryCode()

ClearCountryCode clears the value of the "country_code" field.

func (*UserMutation) ClearDistrictID

func (m *UserMutation) ClearDistrictID()

ClearDistrictID clears the value of the "district_id" field.

func (*UserMutation) ClearEdge

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

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

func (*UserMutation) 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) ClearFirstName

func (m *UserMutation) ClearFirstName()

ClearFirstName clears the value of the "first_name" field.

func (*UserMutation) ClearGender

func (m *UserMutation) ClearGender()

ClearGender clears the value of the "gender" field.

func (*UserMutation) ClearLastName

func (m *UserMutation) ClearLastName()

ClearLastName clears the value of the "last_name" field.

func (*UserMutation) ClearPhoneNumber

func (m *UserMutation) ClearPhoneNumber()

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserMutation) ClearStreet

func (m *UserMutation) ClearStreet()

ClearStreet clears the value of the "street" field.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

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

func (*UserMutation) CountryCode

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

CountryCode returns the value of the "country_code" field in the mutation.

func (*UserMutation) CountryCodeCleared

func (m *UserMutation) CountryCodeCleared() bool

CountryCodeCleared returns if the "country_code" field was cleared in this mutation.

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

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

DistrictID returns the value of the "district_id" field in the mutation.

func (*UserMutation) DistrictIDCleared

func (m *UserMutation) DistrictIDCleared() bool

DistrictIDCleared returns if the "district_id" field was cleared in this mutation.

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Email

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

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

func (*UserMutation) 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) FirstName

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

FirstName returns the value of the "first_name" field in the mutation.

func (*UserMutation) FirstNameCleared

func (m *UserMutation) FirstNameCleared() bool

FirstNameCleared returns if the "first_name" field was cleared in this mutation.

func (*UserMutation) Gender

func (m *UserMutation) Gender() (r int, exists bool)

Gender returns the value of the "gender" field in the mutation.

func (*UserMutation) GenderCleared

func (m *UserMutation) GenderCleared() bool

GenderCleared returns if the "gender" field was cleared in this mutation.

func (*UserMutation) HashPassword

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

HashPassword returns the value of the "hash_password" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id uuid.UUID, 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) ([]uuid.UUID, 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) LastName

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

LastName returns the value of the "last_name" field in the mutation.

func (*UserMutation) LastNameCleared

func (m *UserMutation) LastNameCleared() bool

LastNameCleared returns if the "last_name" field was cleared in this mutation.

func (*UserMutation) OldAddress

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

OldAddress returns the old "address" 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) OldAvatar

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

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

func (*UserMutation) OldBirthDay

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

OldBirthDay returns the old "birth_day" 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) OldCityID

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

OldCityID returns the old "city_id" 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) OldCountryCode

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

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

func (*UserMutation) OldCreatedAt

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

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

func (*UserMutation) OldDistrictID

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

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

func (*UserMutation) OldEmail

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

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

func (*UserMutation) OldField

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

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

func (*UserMutation) OldFirstName

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

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

func (*UserMutation) OldGender

func (m *UserMutation) OldGender(ctx context.Context) (v int, err error)

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

func (*UserMutation) OldHashPassword

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

OldHashPassword returns the old "hash_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) OldLastName

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

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

func (*UserMutation) OldPhoneNumber

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

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

func (*UserMutation) OldStatus

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

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

func (*UserMutation) OldStreet

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

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

func (*UserMutation) OldUpdatedAt

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

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

func (*UserMutation) OldUsername

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

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

func (*UserMutation) OldVerified

func (m *UserMutation) OldVerified(ctx context.Context) (v bool, err error)

OldVerified returns the old "verified" 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) PhoneNumber

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

PhoneNumber returns the value of the "phone_number" field in the mutation.

func (*UserMutation) PhoneNumberCleared

func (m *UserMutation) PhoneNumberCleared() bool

PhoneNumberCleared returns if the "phone_number" field was cleared in this mutation.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

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

func (*UserMutation) ResetAddress

func (m *UserMutation) ResetAddress()

ResetAddress resets all changes to the "address" field.

func (*UserMutation) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetBirthDay

func (m *UserMutation) ResetBirthDay()

ResetBirthDay resets all changes to the "birth_day" field.

func (*UserMutation) ResetCityID

func (m *UserMutation) ResetCityID()

ResetCityID resets all changes to the "city_id" field.

func (*UserMutation) ResetCountryCode

func (m *UserMutation) ResetCountryCode()

ResetCountryCode resets all changes to the "country_code" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetDistrictID

func (m *UserMutation) ResetDistrictID()

ResetDistrictID resets all changes to the "district_id" field.

func (*UserMutation) ResetEdge

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

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

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

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

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

func (*UserMutation) ResetFirstName

func (m *UserMutation) ResetFirstName()

ResetFirstName resets all changes to the "first_name" field.

func (*UserMutation) ResetGender

func (m *UserMutation) ResetGender()

ResetGender resets all changes to the "gender" field.

func (*UserMutation) ResetHashPassword

func (m *UserMutation) ResetHashPassword()

ResetHashPassword resets all changes to the "hash_password" field.

func (*UserMutation) ResetLastName

func (m *UserMutation) ResetLastName()

ResetLastName resets all changes to the "last_name" field.

func (*UserMutation) ResetPhoneNumber

func (m *UserMutation) ResetPhoneNumber()

ResetPhoneNumber resets all changes to the "phone_number" field.

func (*UserMutation) ResetStatus

func (m *UserMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*UserMutation) ResetStreet

func (m *UserMutation) ResetStreet()

ResetStreet resets all changes to the "street" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) ResetVerified

func (m *UserMutation) ResetVerified()

ResetVerified resets all changes to the "verified" field.

func (*UserMutation) SetAddress

func (m *UserMutation) SetAddress(s string)

SetAddress sets the "address" field.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(s string)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetBirthDay

func (m *UserMutation) SetBirthDay(s string)

SetBirthDay sets the "birth_day" field.

func (*UserMutation) SetCityID

func (m *UserMutation) SetCityID(s string)

SetCityID sets the "city_id" field.

func (*UserMutation) SetCountryCode

func (m *UserMutation) SetCountryCode(s string)

SetCountryCode sets the "country_code" field.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetDistrictID

func (m *UserMutation) SetDistrictID(s string)

SetDistrictID sets the "district_id" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

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

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

func (*UserMutation) SetFirstName

func (m *UserMutation) SetFirstName(s string)

SetFirstName sets the "first_name" field.

func (*UserMutation) SetGender

func (m *UserMutation) SetGender(i int)

SetGender sets the "gender" field.

func (*UserMutation) SetHashPassword

func (m *UserMutation) SetHashPassword(s string)

SetHashPassword sets the "hash_password" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id uuid.UUID)

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

func (*UserMutation) SetLastName

func (m *UserMutation) SetLastName(s string)

SetLastName sets the "last_name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPhoneNumber

func (m *UserMutation) SetPhoneNumber(s string)

SetPhoneNumber sets the "phone_number" field.

func (*UserMutation) SetStatus

func (m *UserMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*UserMutation) SetStreet

func (m *UserMutation) SetStreet(s string)

SetStreet sets the "street" field.

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*UserMutation) SetVerified

func (m *UserMutation) SetVerified(b bool)

SetVerified sets the "verified" field.

func (*UserMutation) Status

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

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

func (*UserMutation) Street

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

Street returns the value of the "street" field in the mutation.

func (*UserMutation) StreetCleared

func (m *UserMutation) StreetCleared() bool

StreetCleared returns if the "street" field was cleared in this mutation.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdatedAt

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

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

func (*UserMutation) Username

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

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

func (*UserMutation) Verified

func (m *UserMutation) Verified() (r bool, exists bool)

Verified returns the value of the "verified" field in the mutation.

func (*UserMutation) Where

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

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

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

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

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

All executes the query and returns a list of Users.

func (*UserQuery) AllX

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

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

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

Count returns the count of the given query.

func (*UserQuery) CountX

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

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

func (*UserQuery) Exist

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

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

func (*UserQuery) ExistX

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

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

func (*UserQuery) First

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

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, 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) uuid.UUID

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

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

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*UserQuery) IDsX

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

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

func (*UserQuery) Limit

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

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

func (*UserQuery) Offset

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

Offset to start from.

func (*UserQuery) Only

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

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, 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) uuid.UUID

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

func (*UserQuery) OnlyX

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

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) Select

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

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

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

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

func (*UserQuery) Unique

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

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

func (*UserQuery) Where

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

Where adds a new predicate for the UserQuery builder.

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

func (uu *UserUpdate) AddGender(i int) *UserUpdate

AddGender adds i to the "gender" field.

func (*UserUpdate) ClearAddress

func (uu *UserUpdate) ClearAddress() *UserUpdate

ClearAddress clears the value of the "address" field.

func (*UserUpdate) ClearAvatar

func (uu *UserUpdate) ClearAvatar() *UserUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdate) ClearBirthDay

func (uu *UserUpdate) ClearBirthDay() *UserUpdate

ClearBirthDay clears the value of the "birth_day" field.

func (*UserUpdate) ClearCityID

func (uu *UserUpdate) ClearCityID() *UserUpdate

ClearCityID clears the value of the "city_id" field.

func (*UserUpdate) ClearCountryCode

func (uu *UserUpdate) ClearCountryCode() *UserUpdate

ClearCountryCode clears the value of the "country_code" field.

func (*UserUpdate) ClearDistrictID

func (uu *UserUpdate) ClearDistrictID() *UserUpdate

ClearDistrictID clears the value of the "district_id" field.

func (*UserUpdate) ClearFirstName

func (uu *UserUpdate) ClearFirstName() *UserUpdate

ClearFirstName clears the value of the "first_name" field.

func (*UserUpdate) ClearGender

func (uu *UserUpdate) ClearGender() *UserUpdate

ClearGender clears the value of the "gender" field.

func (*UserUpdate) ClearLastName

func (uu *UserUpdate) ClearLastName() *UserUpdate

ClearLastName clears the value of the "last_name" field.

func (*UserUpdate) ClearPhoneNumber

func (uu *UserUpdate) ClearPhoneNumber() *UserUpdate

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserUpdate) ClearStreet

func (uu *UserUpdate) ClearStreet() *UserUpdate

ClearStreet clears the value of the "street" field.

func (*UserUpdate) Exec

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

Exec executes the query.

func (*UserUpdate) ExecX

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

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

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

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

func (*UserUpdate) SaveX

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

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

func (*UserUpdate) SetAddress

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

SetAddress sets the "address" field.

func (*UserUpdate) SetAvatar

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

SetAvatar sets the "avatar" field.

func (*UserUpdate) SetBirthDay

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

SetBirthDay sets the "birth_day" field.

func (*UserUpdate) SetCityID

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

SetCityID sets the "city_id" field.

func (*UserUpdate) SetCountryCode

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

SetCountryCode sets the "country_code" field.

func (*UserUpdate) SetDistrictID

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

SetDistrictID sets the "district_id" field.

func (*UserUpdate) SetEmail

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

SetEmail sets the "email" field.

func (*UserUpdate) SetFirstName

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

SetFirstName sets the "first_name" field.

func (*UserUpdate) SetGender

func (uu *UserUpdate) SetGender(i int) *UserUpdate

SetGender sets the "gender" field.

func (*UserUpdate) SetHashPassword

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

SetHashPassword sets the "hash_password" field.

func (*UserUpdate) SetLastName

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

SetLastName sets the "last_name" field.

func (*UserUpdate) SetNillableAddress

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

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserUpdate) SetNillableAvatar

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

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdate) SetNillableBirthDay

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

SetNillableBirthDay sets the "birth_day" field if the given value is not nil.

func (*UserUpdate) SetNillableCityID

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

SetNillableCityID sets the "city_id" field if the given value is not nil.

func (*UserUpdate) SetNillableCountryCode

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

SetNillableCountryCode sets the "country_code" field if the given value is not nil.

func (*UserUpdate) SetNillableDistrictID

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

SetNillableDistrictID sets the "district_id" field if the given value is not nil.

func (*UserUpdate) SetNillableEmail

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

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

func (*UserUpdate) SetNillableFirstName

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

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*UserUpdate) SetNillableGender

func (uu *UserUpdate) SetNillableGender(i *int) *UserUpdate

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdate) SetNillableHashPassword

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

SetNillableHashPassword sets the "hash_password" field if the given value is not nil.

func (*UserUpdate) SetNillableLastName

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

SetNillableLastName sets the "last_name" field if the given value is not nil.

func (*UserUpdate) SetNillablePhoneNumber

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

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserUpdate) SetNillableStatus

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

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

func (*UserUpdate) SetNillableStreet

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

SetNillableStreet sets the "street" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername

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

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

func (*UserUpdate) SetNillableVerified

func (uu *UserUpdate) SetNillableVerified(b *bool) *UserUpdate

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdate) SetPhoneNumber

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

SetPhoneNumber sets the "phone_number" field.

func (*UserUpdate) SetStatus

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

SetStatus sets the "status" field.

func (*UserUpdate) SetStreet

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

SetStreet sets the "street" field.

func (*UserUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUsername

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

SetUsername sets the "username" field.

func (*UserUpdate) SetVerified

func (uu *UserUpdate) SetVerified(b bool) *UserUpdate

SetVerified sets the "verified" 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) AddGender

func (uuo *UserUpdateOne) AddGender(i int) *UserUpdateOne

AddGender adds i to the "gender" field.

func (*UserUpdateOne) ClearAddress

func (uuo *UserUpdateOne) ClearAddress() *UserUpdateOne

ClearAddress clears the value of the "address" field.

func (*UserUpdateOne) ClearAvatar

func (uuo *UserUpdateOne) ClearAvatar() *UserUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdateOne) ClearBirthDay

func (uuo *UserUpdateOne) ClearBirthDay() *UserUpdateOne

ClearBirthDay clears the value of the "birth_day" field.

func (*UserUpdateOne) ClearCityID

func (uuo *UserUpdateOne) ClearCityID() *UserUpdateOne

ClearCityID clears the value of the "city_id" field.

func (*UserUpdateOne) ClearCountryCode

func (uuo *UserUpdateOne) ClearCountryCode() *UserUpdateOne

ClearCountryCode clears the value of the "country_code" field.

func (*UserUpdateOne) ClearDistrictID

func (uuo *UserUpdateOne) ClearDistrictID() *UserUpdateOne

ClearDistrictID clears the value of the "district_id" field.

func (*UserUpdateOne) ClearFirstName

func (uuo *UserUpdateOne) ClearFirstName() *UserUpdateOne

ClearFirstName clears the value of the "first_name" field.

func (*UserUpdateOne) ClearGender

func (uuo *UserUpdateOne) ClearGender() *UserUpdateOne

ClearGender clears the value of the "gender" field.

func (*UserUpdateOne) ClearLastName

func (uuo *UserUpdateOne) ClearLastName() *UserUpdateOne

ClearLastName clears the value of the "last_name" field.

func (*UserUpdateOne) ClearPhoneNumber

func (uuo *UserUpdateOne) ClearPhoneNumber() *UserUpdateOne

ClearPhoneNumber clears the value of the "phone_number" field.

func (*UserUpdateOne) ClearStreet

func (uuo *UserUpdateOne) ClearStreet() *UserUpdateOne

ClearStreet clears the value of the "street" field.

func (*UserUpdateOne) Exec

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

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

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

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

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

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

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

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

func (*UserUpdateOne) Select

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

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

func (*UserUpdateOne) SetAddress

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

SetAddress sets the "address" field.

func (*UserUpdateOne) SetAvatar

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

SetAvatar sets the "avatar" field.

func (*UserUpdateOne) SetBirthDay

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

SetBirthDay sets the "birth_day" field.

func (*UserUpdateOne) SetCityID

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

SetCityID sets the "city_id" field.

func (*UserUpdateOne) SetCountryCode

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

SetCountryCode sets the "country_code" field.

func (*UserUpdateOne) SetDistrictID

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

SetDistrictID sets the "district_id" field.

func (*UserUpdateOne) SetEmail

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

SetEmail sets the "email" field.

func (*UserUpdateOne) SetFirstName

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

SetFirstName sets the "first_name" field.

func (*UserUpdateOne) SetGender

func (uuo *UserUpdateOne) SetGender(i int) *UserUpdateOne

SetGender sets the "gender" field.

func (*UserUpdateOne) SetHashPassword

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

SetHashPassword sets the "hash_password" field.

func (*UserUpdateOne) SetLastName

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

SetLastName sets the "last_name" field.

func (*UserUpdateOne) SetNillableAddress

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

SetNillableAddress sets the "address" field if the given value is not nil.

func (*UserUpdateOne) SetNillableAvatar

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

SetNillableAvatar sets the "avatar" field if the given value is not nil.

func (*UserUpdateOne) SetNillableBirthDay

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

SetNillableBirthDay sets the "birth_day" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCityID

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

SetNillableCityID sets the "city_id" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCountryCode

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

SetNillableCountryCode sets the "country_code" field if the given value is not nil.

func (*UserUpdateOne) SetNillableDistrictID

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

SetNillableDistrictID sets the "district_id" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

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

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

func (*UserUpdateOne) SetNillableFirstName

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

SetNillableFirstName sets the "first_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableGender

func (uuo *UserUpdateOne) SetNillableGender(i *int) *UserUpdateOne

SetNillableGender sets the "gender" field if the given value is not nil.

func (*UserUpdateOne) SetNillableHashPassword

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

SetNillableHashPassword sets the "hash_password" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLastName

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

SetNillableLastName sets the "last_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhoneNumber

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

SetNillablePhoneNumber sets the "phone_number" field if the given value is not nil.

func (*UserUpdateOne) SetNillableStatus

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

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

func (*UserUpdateOne) SetNillableStreet

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

SetNillableStreet sets the "street" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername

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

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

func (*UserUpdateOne) SetNillableVerified

func (uuo *UserUpdateOne) SetNillableVerified(b *bool) *UserUpdateOne

SetNillableVerified sets the "verified" field if the given value is not nil.

func (*UserUpdateOne) SetPhoneNumber

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

SetPhoneNumber sets the "phone_number" field.

func (*UserUpdateOne) SetStatus

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

SetStatus sets the "status" field.

func (*UserUpdateOne) SetStreet

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

SetStreet sets the "street" field.

func (*UserUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUsername

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

SetUsername sets the "username" field.

func (*UserUpdateOne) SetVerified

func (uuo *UserUpdateOne) SetVerified(b bool) *UserUpdateOne

SetVerified sets the "verified" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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