ent

package
v0.0.0-...-f15602e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 27 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"
	TypeCart         = "Cart"
	TypeCategory     = "Category"
	TypeOrder        = "Order"
	TypeOrderProduct = "OrderProduct"
	TypeProduct      = "Product"
	TypeProductImage = "ProductImage"
	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.

View Source
var Migrations embed.FS

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 int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int64 `json:"user_id,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"`
	// Flat holds the value of the "flat" field.
	Flat int `json:"flat,omitempty"`
	// House holds the value of the "house" field.
	House int `json:"house,omitempty"`
	// Letter holds the value of the "letter" field.
	Letter string `json:"letter,omitempty"`
	// Postcode holds the value of the "postcode" field.
	Postcode int `json:"postcode,omitempty"`
	// Street holds the value of the "street" field.
	Street string `json:"street,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AddressQuery when eager-loading is set.
	Edges AddressEdges `json:"edges"`
	// contains filtered or unexported fields
}

Address is the model entity for the Address schema.

func (*Address) QueryUsers

func (a *Address) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Address entity.

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 int64) *AddressDeleteOne

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

func (*AddressClient) Get

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

Get returns a Address entity by its id.

func (*AddressClient) GetX

func (c *AddressClient) GetX(ctx context.Context, id int64) *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) QueryUsers

func (c *AddressClient) QueryUsers(a *Address) *UserQuery

QueryUsers queries the users edge of a 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 int64) *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) OnConflict

func (ac *AddressCreate) OnConflict(opts ...sql.ConflictOption) *AddressUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Address.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.AddressUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*AddressCreate) OnConflictColumns

func (ac *AddressCreate) OnConflictColumns(columns ...string) *AddressUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Address.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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

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

SetFlat sets the "flat" field.

func (*AddressCreate) SetHouse

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

SetHouse sets the "house" field.

func (*AddressCreate) SetLetter

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

SetLetter sets the "letter" 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) SetNillableFlat

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

SetNillableFlat sets the "flat" field if the given value is not nil.

func (*AddressCreate) SetNillableLetter

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

SetNillableLetter sets the "letter" 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) SetPostcode

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

SetPostcode sets the "postcode" field.

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.

func (*AddressCreate) SetUserID

func (ac *AddressCreate) SetUserID(i int64) *AddressCreate

SetUserID sets the "user_id" field.

func (*AddressCreate) SetUsers

func (ac *AddressCreate) SetUsers(u *User) *AddressCreate

SetUsers sets the "users" edge to the User entity.

func (*AddressCreate) SetUsersID

func (ac *AddressCreate) SetUsersID(id int64) *AddressCreate

SetUsersID sets the "users" edge to the User entity by ID.

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

func (acb *AddressCreateBulk) OnConflict(opts ...sql.ConflictOption) *AddressUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Address.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.AddressUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*AddressCreateBulk) OnConflictColumns

func (acb *AddressCreateBulk) OnConflictColumns(columns ...string) *AddressUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Address.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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 AddressEdges

type AddressEdges struct {
	// Users holds the value of the users edge.
	Users *User `json:"users,omitempty"`
	// contains filtered or unexported fields
}

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

func (AddressEdges) UsersOrErr

func (e AddressEdges) UsersOrErr() (*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

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

func (m *AddressMutation) AddFlat(i int)

AddFlat adds i to the "flat" field.

func (*AddressMutation) AddHouse

func (m *AddressMutation) AddHouse(i int)

AddHouse adds i to the "house" field.

func (*AddressMutation) AddPostcode

func (m *AddressMutation) AddPostcode(i int)

AddPostcode adds i to the "postcode" field.

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

func (m *AddressMutation) AddedFlat() (r int, exists bool)

AddedFlat returns the value that was added to the "flat" field in this mutation.

func (*AddressMutation) AddedHouse

func (m *AddressMutation) AddedHouse() (r int, exists bool)

AddedHouse returns the value that was added to the "house" field in 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) AddedPostcode

func (m *AddressMutation) AddedPostcode() (r int, exists bool)

AddedPostcode returns the value that was added to the "postcode" field 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) ClearFlat

func (m *AddressMutation) ClearFlat()

ClearFlat clears the value of the "flat" field.

func (*AddressMutation) ClearLetter

func (m *AddressMutation) ClearLetter()

ClearLetter clears the value of the "letter" field.

func (*AddressMutation) ClearUsers

func (m *AddressMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

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

func (m *AddressMutation) Flat() (r int, exists bool)

Flat returns the value of the "flat" field in the mutation.

func (*AddressMutation) FlatCleared

func (m *AddressMutation) FlatCleared() bool

FlatCleared returns if the "flat" field was cleared in this mutation.

func (*AddressMutation) House

func (m *AddressMutation) House() (r int, exists bool)

House returns the value of the "house" field in the mutation.

func (*AddressMutation) ID

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

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

func (*AddressMutation) IDs

func (m *AddressMutation) IDs(ctx context.Context) ([]int64, 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) Letter

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

Letter returns the value of the "letter" field in the mutation.

func (*AddressMutation) LetterCleared

func (m *AddressMutation) LetterCleared() bool

LetterCleared returns if the "letter" field was cleared in this 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) 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) OldFlat

func (m *AddressMutation) OldFlat(ctx context.Context) (v int, err error)

OldFlat returns the old "flat" 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) OldHouse

func (m *AddressMutation) OldHouse(ctx context.Context) (v int, err error)

OldHouse returns the old "house" 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) OldLetter

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

OldLetter returns the old "letter" 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) OldPostcode

func (m *AddressMutation) OldPostcode(ctx context.Context) (v int, err error)

OldPostcode returns the old "postcode" 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) 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) OldUserID

func (m *AddressMutation) OldUserID(ctx context.Context) (v int64, err error)

OldUserID returns the old "user_id" 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) Postcode

func (m *AddressMutation) Postcode() (r int, exists bool)

Postcode returns the value of the "postcode" field in the mutation.

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

func (m *AddressMutation) ResetFlat()

ResetFlat resets all changes to the "flat" field.

func (*AddressMutation) ResetHouse

func (m *AddressMutation) ResetHouse()

ResetHouse resets all changes to the "house" field.

func (*AddressMutation) ResetLetter

func (m *AddressMutation) ResetLetter()

ResetLetter resets all changes to the "letter" field.

func (*AddressMutation) ResetPostcode

func (m *AddressMutation) ResetPostcode()

ResetPostcode resets all changes to the "postcode" field.

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

func (m *AddressMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*AddressMutation) ResetUsers

func (m *AddressMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

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

func (m *AddressMutation) SetFlat(i int)

SetFlat sets the "flat" field.

func (*AddressMutation) SetHouse

func (m *AddressMutation) SetHouse(i int)

SetHouse sets the "house" field.

func (*AddressMutation) SetLetter

func (m *AddressMutation) SetLetter(s string)

SetLetter sets the "letter" field.

func (*AddressMutation) SetOp

func (m *AddressMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AddressMutation) SetPostcode

func (m *AddressMutation) SetPostcode(i int)

SetPostcode sets the "postcode" field.

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

func (m *AddressMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*AddressMutation) SetUsersID

func (m *AddressMutation) SetUsersID(id int64)

SetUsersID sets the "users" edge to the User entity by id.

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

func (m *AddressMutation) UserID() (r int64, exists bool)

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

func (*AddressMutation) UsersCleared

func (m *AddressMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*AddressMutation) UsersID

func (m *AddressMutation) UsersID() (id int64, exists bool)

UsersID returns the "users" edge ID in the mutation.

func (*AddressMutation) UsersIDs

func (m *AddressMutation) UsersIDs() (ids []int64)

UsersIDs returns the "users" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UsersID instead. It exists only for internal usage by the builders.

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 int64, 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) int64

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

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

func (*AddressQuery) IDs

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

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

func (*AddressQuery) IDsX

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

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 int64, 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) int64

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

func (aq *AddressQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Address.Query().
	Select(address.FieldCreatedAt).
	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.

func (*AddressQuery) WithUsers

func (aq *AddressQuery) WithUsers(opts ...func(*UserQuery)) *AddressQuery

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

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

func (au *AddressUpdate) AddFlat(i int) *AddressUpdate

AddFlat adds i to the "flat" field.

func (*AddressUpdate) AddHouse

func (au *AddressUpdate) AddHouse(i int) *AddressUpdate

AddHouse adds i to the "house" field.

func (*AddressUpdate) AddPostcode

func (au *AddressUpdate) AddPostcode(i int) *AddressUpdate

AddPostcode adds i to the "postcode" field.

func (*AddressUpdate) ClearFlat

func (au *AddressUpdate) ClearFlat() *AddressUpdate

ClearFlat clears the value of the "flat" field.

func (*AddressUpdate) ClearLetter

func (au *AddressUpdate) ClearLetter() *AddressUpdate

ClearLetter clears the value of the "letter" field.

func (*AddressUpdate) ClearUsers

func (au *AddressUpdate) ClearUsers() *AddressUpdate

ClearUsers clears the "users" edge to the User entity.

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

func (au *AddressUpdate) SetFlat(i int) *AddressUpdate

SetFlat sets the "flat" field.

func (*AddressUpdate) SetHouse

func (au *AddressUpdate) SetHouse(i int) *AddressUpdate

SetHouse sets the "house" field.

func (*AddressUpdate) SetLetter

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

SetLetter sets the "letter" 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) SetNillableFlat

func (au *AddressUpdate) SetNillableFlat(i *int) *AddressUpdate

SetNillableFlat sets the "flat" field if the given value is not nil.

func (*AddressUpdate) SetNillableHouse

func (au *AddressUpdate) SetNillableHouse(i *int) *AddressUpdate

SetNillableHouse sets the "house" field if the given value is not nil.

func (*AddressUpdate) SetNillableLetter

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

SetNillableLetter sets the "letter" field if the given value is not nil.

func (*AddressUpdate) SetNillablePostcode

func (au *AddressUpdate) SetNillablePostcode(i *int) *AddressUpdate

SetNillablePostcode sets the "postcode" 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) SetNillableUserID

func (au *AddressUpdate) SetNillableUserID(i *int64) *AddressUpdate

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

func (*AddressUpdate) SetPostcode

func (au *AddressUpdate) SetPostcode(i int) *AddressUpdate

SetPostcode sets the "postcode" field.

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

func (au *AddressUpdate) SetUserID(i int64) *AddressUpdate

SetUserID sets the "user_id" field.

func (*AddressUpdate) SetUsers

func (au *AddressUpdate) SetUsers(u *User) *AddressUpdate

SetUsers sets the "users" edge to the User entity.

func (*AddressUpdate) SetUsersID

func (au *AddressUpdate) SetUsersID(id int64) *AddressUpdate

SetUsersID sets the "users" edge to the User entity by ID.

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

func (auo *AddressUpdateOne) AddFlat(i int) *AddressUpdateOne

AddFlat adds i to the "flat" field.

func (*AddressUpdateOne) AddHouse

func (auo *AddressUpdateOne) AddHouse(i int) *AddressUpdateOne

AddHouse adds i to the "house" field.

func (*AddressUpdateOne) AddPostcode

func (auo *AddressUpdateOne) AddPostcode(i int) *AddressUpdateOne

AddPostcode adds i to the "postcode" field.

func (*AddressUpdateOne) ClearFlat

func (auo *AddressUpdateOne) ClearFlat() *AddressUpdateOne

ClearFlat clears the value of the "flat" field.

func (*AddressUpdateOne) ClearLetter

func (auo *AddressUpdateOne) ClearLetter() *AddressUpdateOne

ClearLetter clears the value of the "letter" field.

func (*AddressUpdateOne) ClearUsers

func (auo *AddressUpdateOne) ClearUsers() *AddressUpdateOne

ClearUsers clears the "users" edge to the User 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) SetFlat

func (auo *AddressUpdateOne) SetFlat(i int) *AddressUpdateOne

SetFlat sets the "flat" field.

func (*AddressUpdateOne) SetHouse

func (auo *AddressUpdateOne) SetHouse(i int) *AddressUpdateOne

SetHouse sets the "house" field.

func (*AddressUpdateOne) SetLetter

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

SetLetter sets the "letter" 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) SetNillableFlat

func (auo *AddressUpdateOne) SetNillableFlat(i *int) *AddressUpdateOne

SetNillableFlat sets the "flat" field if the given value is not nil.

func (*AddressUpdateOne) SetNillableHouse

func (auo *AddressUpdateOne) SetNillableHouse(i *int) *AddressUpdateOne

SetNillableHouse sets the "house" field if the given value is not nil.

func (*AddressUpdateOne) SetNillableLetter

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

SetNillableLetter sets the "letter" field if the given value is not nil.

func (*AddressUpdateOne) SetNillablePostcode

func (auo *AddressUpdateOne) SetNillablePostcode(i *int) *AddressUpdateOne

SetNillablePostcode sets the "postcode" 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) SetNillableUserID

func (auo *AddressUpdateOne) SetNillableUserID(i *int64) *AddressUpdateOne

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

func (*AddressUpdateOne) SetPostcode

func (auo *AddressUpdateOne) SetPostcode(i int) *AddressUpdateOne

SetPostcode sets the "postcode" field.

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

func (auo *AddressUpdateOne) SetUserID(i int64) *AddressUpdateOne

SetUserID sets the "user_id" field.

func (*AddressUpdateOne) SetUsers

func (auo *AddressUpdateOne) SetUsers(u *User) *AddressUpdateOne

SetUsers sets the "users" edge to the User entity.

func (*AddressUpdateOne) SetUsersID

func (auo *AddressUpdateOne) SetUsersID(id int64) *AddressUpdateOne

SetUsersID sets the "users" edge to the User entity by ID.

func (*AddressUpdateOne) Where

Where appends a list predicates to the AddressUpdate builder.

type AddressUpsert

type AddressUpsert struct {
	*sql.UpdateSet
}

AddressUpsert is the "OnConflict" setter.

func (*AddressUpsert) AddFlat

func (u *AddressUpsert) AddFlat(v int) *AddressUpsert

AddFlat adds v to the "flat" field.

func (*AddressUpsert) AddHouse

func (u *AddressUpsert) AddHouse(v int) *AddressUpsert

AddHouse adds v to the "house" field.

func (*AddressUpsert) AddPostcode

func (u *AddressUpsert) AddPostcode(v int) *AddressUpsert

AddPostcode adds v to the "postcode" field.

func (*AddressUpsert) ClearFlat

func (u *AddressUpsert) ClearFlat() *AddressUpsert

ClearFlat clears the value of the "flat" field.

func (*AddressUpsert) ClearLetter

func (u *AddressUpsert) ClearLetter() *AddressUpsert

ClearLetter clears the value of the "letter" field.

func (*AddressUpsert) SetCity

func (u *AddressUpsert) SetCity(v string) *AddressUpsert

SetCity sets the "city" field.

func (*AddressUpsert) SetCountry

func (u *AddressUpsert) SetCountry(v string) *AddressUpsert

SetCountry sets the "country" field.

func (*AddressUpsert) SetFlat

func (u *AddressUpsert) SetFlat(v int) *AddressUpsert

SetFlat sets the "flat" field.

func (*AddressUpsert) SetHouse

func (u *AddressUpsert) SetHouse(v int) *AddressUpsert

SetHouse sets the "house" field.

func (*AddressUpsert) SetLetter

func (u *AddressUpsert) SetLetter(v string) *AddressUpsert

SetLetter sets the "letter" field.

func (*AddressUpsert) SetPostcode

func (u *AddressUpsert) SetPostcode(v int) *AddressUpsert

SetPostcode sets the "postcode" field.

func (*AddressUpsert) SetStreet

func (u *AddressUpsert) SetStreet(v string) *AddressUpsert

SetStreet sets the "street" field.

func (*AddressUpsert) SetUpdatedAt

func (u *AddressUpsert) SetUpdatedAt(v time.Time) *AddressUpsert

SetUpdatedAt sets the "updated_at" field.

func (*AddressUpsert) SetUserID

func (u *AddressUpsert) SetUserID(v int64) *AddressUpsert

SetUserID sets the "user_id" field.

func (*AddressUpsert) UpdateCity

func (u *AddressUpsert) UpdateCity() *AddressUpsert

UpdateCity sets the "city" field to the value that was provided on create.

func (*AddressUpsert) UpdateCountry

func (u *AddressUpsert) UpdateCountry() *AddressUpsert

UpdateCountry sets the "country" field to the value that was provided on create.

func (*AddressUpsert) UpdateFlat

func (u *AddressUpsert) UpdateFlat() *AddressUpsert

UpdateFlat sets the "flat" field to the value that was provided on create.

func (*AddressUpsert) UpdateHouse

func (u *AddressUpsert) UpdateHouse() *AddressUpsert

UpdateHouse sets the "house" field to the value that was provided on create.

func (*AddressUpsert) UpdateLetter

func (u *AddressUpsert) UpdateLetter() *AddressUpsert

UpdateLetter sets the "letter" field to the value that was provided on create.

func (*AddressUpsert) UpdatePostcode

func (u *AddressUpsert) UpdatePostcode() *AddressUpsert

UpdatePostcode sets the "postcode" field to the value that was provided on create.

func (*AddressUpsert) UpdateStreet

func (u *AddressUpsert) UpdateStreet() *AddressUpsert

UpdateStreet sets the "street" field to the value that was provided on create.

func (*AddressUpsert) UpdateUpdatedAt

func (u *AddressUpsert) UpdateUpdatedAt() *AddressUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*AddressUpsert) UpdateUserID

func (u *AddressUpsert) UpdateUserID() *AddressUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type AddressUpsertBulk

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

AddressUpsertBulk is the builder for "upsert"-ing a bulk of Address nodes.

func (*AddressUpsertBulk) AddFlat

func (u *AddressUpsertBulk) AddFlat(v int) *AddressUpsertBulk

AddFlat adds v to the "flat" field.

func (*AddressUpsertBulk) AddHouse

func (u *AddressUpsertBulk) AddHouse(v int) *AddressUpsertBulk

AddHouse adds v to the "house" field.

func (*AddressUpsertBulk) AddPostcode

func (u *AddressUpsertBulk) AddPostcode(v int) *AddressUpsertBulk

AddPostcode adds v to the "postcode" field.

func (*AddressUpsertBulk) ClearFlat

func (u *AddressUpsertBulk) ClearFlat() *AddressUpsertBulk

ClearFlat clears the value of the "flat" field.

func (*AddressUpsertBulk) ClearLetter

func (u *AddressUpsertBulk) ClearLetter() *AddressUpsertBulk

ClearLetter clears the value of the "letter" field.

func (*AddressUpsertBulk) DoNothing

func (u *AddressUpsertBulk) DoNothing() *AddressUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*AddressUpsertBulk) Exec

func (u *AddressUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AddressUpsertBulk) ExecX

func (u *AddressUpsertBulk) ExecX(ctx context.Context)

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

func (*AddressUpsertBulk) Ignore

func (u *AddressUpsertBulk) Ignore() *AddressUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Address.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*AddressUpsertBulk) SetCity

SetCity sets the "city" field.

func (*AddressUpsertBulk) SetCountry

func (u *AddressUpsertBulk) SetCountry(v string) *AddressUpsertBulk

SetCountry sets the "country" field.

func (*AddressUpsertBulk) SetFlat

func (u *AddressUpsertBulk) SetFlat(v int) *AddressUpsertBulk

SetFlat sets the "flat" field.

func (*AddressUpsertBulk) SetHouse

func (u *AddressUpsertBulk) SetHouse(v int) *AddressUpsertBulk

SetHouse sets the "house" field.

func (*AddressUpsertBulk) SetLetter

func (u *AddressUpsertBulk) SetLetter(v string) *AddressUpsertBulk

SetLetter sets the "letter" field.

func (*AddressUpsertBulk) SetPostcode

func (u *AddressUpsertBulk) SetPostcode(v int) *AddressUpsertBulk

SetPostcode sets the "postcode" field.

func (*AddressUpsertBulk) SetStreet

func (u *AddressUpsertBulk) SetStreet(v string) *AddressUpsertBulk

SetStreet sets the "street" field.

func (*AddressUpsertBulk) SetUpdatedAt

func (u *AddressUpsertBulk) SetUpdatedAt(v time.Time) *AddressUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*AddressUpsertBulk) SetUserID

func (u *AddressUpsertBulk) SetUserID(v int64) *AddressUpsertBulk

SetUserID sets the "user_id" field.

func (*AddressUpsertBulk) Update

func (u *AddressUpsertBulk) Update(set func(*AddressUpsert)) *AddressUpsertBulk

Update allows overriding fields `UPDATE` values. See the AddressCreateBulk.OnConflict documentation for more info.

func (*AddressUpsertBulk) UpdateCity

func (u *AddressUpsertBulk) UpdateCity() *AddressUpsertBulk

UpdateCity sets the "city" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateCountry

func (u *AddressUpsertBulk) UpdateCountry() *AddressUpsertBulk

UpdateCountry sets the "country" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateFlat

func (u *AddressUpsertBulk) UpdateFlat() *AddressUpsertBulk

UpdateFlat sets the "flat" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateHouse

func (u *AddressUpsertBulk) UpdateHouse() *AddressUpsertBulk

UpdateHouse sets the "house" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateLetter

func (u *AddressUpsertBulk) UpdateLetter() *AddressUpsertBulk

UpdateLetter sets the "letter" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateNewValues

func (u *AddressUpsertBulk) UpdateNewValues() *AddressUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Address.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*AddressUpsertBulk) UpdatePostcode

func (u *AddressUpsertBulk) UpdatePostcode() *AddressUpsertBulk

UpdatePostcode sets the "postcode" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateStreet

func (u *AddressUpsertBulk) UpdateStreet() *AddressUpsertBulk

UpdateStreet sets the "street" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateUpdatedAt

func (u *AddressUpsertBulk) UpdateUpdatedAt() *AddressUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*AddressUpsertBulk) UpdateUserID

func (u *AddressUpsertBulk) UpdateUserID() *AddressUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type AddressUpsertOne

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

AddressUpsertOne is the builder for "upsert"-ing

one Address node.

func (*AddressUpsertOne) AddFlat

func (u *AddressUpsertOne) AddFlat(v int) *AddressUpsertOne

AddFlat adds v to the "flat" field.

func (*AddressUpsertOne) AddHouse

func (u *AddressUpsertOne) AddHouse(v int) *AddressUpsertOne

AddHouse adds v to the "house" field.

func (*AddressUpsertOne) AddPostcode

func (u *AddressUpsertOne) AddPostcode(v int) *AddressUpsertOne

AddPostcode adds v to the "postcode" field.

func (*AddressUpsertOne) ClearFlat

func (u *AddressUpsertOne) ClearFlat() *AddressUpsertOne

ClearFlat clears the value of the "flat" field.

func (*AddressUpsertOne) ClearLetter

func (u *AddressUpsertOne) ClearLetter() *AddressUpsertOne

ClearLetter clears the value of the "letter" field.

func (*AddressUpsertOne) DoNothing

func (u *AddressUpsertOne) DoNothing() *AddressUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*AddressUpsertOne) Exec

func (u *AddressUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*AddressUpsertOne) ExecX

func (u *AddressUpsertOne) ExecX(ctx context.Context)

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

func (*AddressUpsertOne) ID

func (u *AddressUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*AddressUpsertOne) IDX

func (u *AddressUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*AddressUpsertOne) Ignore

func (u *AddressUpsertOne) Ignore() *AddressUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Address.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*AddressUpsertOne) SetCity

func (u *AddressUpsertOne) SetCity(v string) *AddressUpsertOne

SetCity sets the "city" field.

func (*AddressUpsertOne) SetCountry

func (u *AddressUpsertOne) SetCountry(v string) *AddressUpsertOne

SetCountry sets the "country" field.

func (*AddressUpsertOne) SetFlat

func (u *AddressUpsertOne) SetFlat(v int) *AddressUpsertOne

SetFlat sets the "flat" field.

func (*AddressUpsertOne) SetHouse

func (u *AddressUpsertOne) SetHouse(v int) *AddressUpsertOne

SetHouse sets the "house" field.

func (*AddressUpsertOne) SetLetter

func (u *AddressUpsertOne) SetLetter(v string) *AddressUpsertOne

SetLetter sets the "letter" field.

func (*AddressUpsertOne) SetPostcode

func (u *AddressUpsertOne) SetPostcode(v int) *AddressUpsertOne

SetPostcode sets the "postcode" field.

func (*AddressUpsertOne) SetStreet

func (u *AddressUpsertOne) SetStreet(v string) *AddressUpsertOne

SetStreet sets the "street" field.

func (*AddressUpsertOne) SetUpdatedAt

func (u *AddressUpsertOne) SetUpdatedAt(v time.Time) *AddressUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*AddressUpsertOne) SetUserID

func (u *AddressUpsertOne) SetUserID(v int64) *AddressUpsertOne

SetUserID sets the "user_id" field.

func (*AddressUpsertOne) Update

func (u *AddressUpsertOne) Update(set func(*AddressUpsert)) *AddressUpsertOne

Update allows overriding fields `UPDATE` values. See the AddressCreate.OnConflict documentation for more info.

func (*AddressUpsertOne) UpdateCity

func (u *AddressUpsertOne) UpdateCity() *AddressUpsertOne

UpdateCity sets the "city" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateCountry

func (u *AddressUpsertOne) UpdateCountry() *AddressUpsertOne

UpdateCountry sets the "country" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateFlat

func (u *AddressUpsertOne) UpdateFlat() *AddressUpsertOne

UpdateFlat sets the "flat" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateHouse

func (u *AddressUpsertOne) UpdateHouse() *AddressUpsertOne

UpdateHouse sets the "house" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateLetter

func (u *AddressUpsertOne) UpdateLetter() *AddressUpsertOne

UpdateLetter sets the "letter" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateNewValues

func (u *AddressUpsertOne) UpdateNewValues() *AddressUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Address.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*AddressUpsertOne) UpdatePostcode

func (u *AddressUpsertOne) UpdatePostcode() *AddressUpsertOne

UpdatePostcode sets the "postcode" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateStreet

func (u *AddressUpsertOne) UpdateStreet() *AddressUpsertOne

UpdateStreet sets the "street" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateUpdatedAt

func (u *AddressUpsertOne) UpdateUpdatedAt() *AddressUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*AddressUpsertOne) UpdateUserID

func (u *AddressUpsertOne) UpdateUserID() *AddressUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

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 Cart

type Cart struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int64 `json:"user_id,omitempty"`
	// ProductID holds the value of the "product_id" field.
	ProductID int64 `json:"product_id,omitempty"`
	// Amount holds the value of the "amount" field.
	Amount int64 `json:"amount,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CartQuery when eager-loading is set.
	Edges CartEdges `json:"edges"`
	// contains filtered or unexported fields
}

Cart is the model entity for the Cart schema.

func (*Cart) QueryProducts

func (c *Cart) QueryProducts() *ProductQuery

QueryProducts queries the "products" edge of the Cart entity.

func (*Cart) QueryUsers

func (c *Cart) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Cart entity.

func (*Cart) String

func (c *Cart) String() string

String implements the fmt.Stringer.

func (*Cart) Unwrap

func (c *Cart) Unwrap() *Cart

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

func (c *Cart) Update() *CartUpdateOne

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

func (*Cart) Value

func (c *Cart) Value(name string) (ent.Value, error)

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

type CartClient

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

CartClient is a client for the Cart schema.

func NewCartClient

func NewCartClient(c config) *CartClient

NewCartClient returns a client for the Cart from the given config.

func (*CartClient) Create

func (c *CartClient) Create() *CartCreate

Create returns a builder for creating a Cart entity.

func (*CartClient) CreateBulk

func (c *CartClient) CreateBulk(builders ...*CartCreate) *CartCreateBulk

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

func (*CartClient) Delete

func (c *CartClient) Delete() *CartDelete

Delete returns a delete builder for Cart.

func (*CartClient) DeleteOne

func (c *CartClient) DeleteOne(ca *Cart) *CartDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CartClient) DeleteOneID

func (c *CartClient) DeleteOneID(id int64) *CartDeleteOne

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

func (*CartClient) Get

func (c *CartClient) Get(ctx context.Context, id int64) (*Cart, error)

Get returns a Cart entity by its id.

func (*CartClient) GetX

func (c *CartClient) GetX(ctx context.Context, id int64) *Cart

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

func (*CartClient) Hooks

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

Hooks returns the client hooks.

func (*CartClient) Intercept

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

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

func (*CartClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CartClient) MapCreateBulk

func (c *CartClient) MapCreateBulk(slice any, setFunc func(*CartCreate, int)) *CartCreateBulk

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

func (c *CartClient) Query() *CartQuery

Query returns a query builder for Cart.

func (*CartClient) QueryProducts

func (c *CartClient) QueryProducts(ca *Cart) *ProductQuery

QueryProducts queries the products edge of a Cart.

func (*CartClient) QueryUsers

func (c *CartClient) QueryUsers(ca *Cart) *UserQuery

QueryUsers queries the users edge of a Cart.

func (*CartClient) Update

func (c *CartClient) Update() *CartUpdate

Update returns an update builder for Cart.

func (*CartClient) UpdateOne

func (c *CartClient) UpdateOne(ca *Cart) *CartUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CartClient) UpdateOneID

func (c *CartClient) UpdateOneID(id int64) *CartUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CartClient) Use

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

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

type CartCreate

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

CartCreate is the builder for creating a Cart entity.

func (*CartCreate) Exec

func (cc *CartCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CartCreate) ExecX

func (cc *CartCreate) ExecX(ctx context.Context)

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

func (*CartCreate) Mutation

func (cc *CartCreate) Mutation() *CartMutation

Mutation returns the CartMutation object of the builder.

func (*CartCreate) OnConflict

func (cc *CartCreate) OnConflict(opts ...sql.ConflictOption) *CartUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Cart.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CartUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CartCreate) OnConflictColumns

func (cc *CartCreate) OnConflictColumns(columns ...string) *CartUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Cart.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CartCreate) Save

func (cc *CartCreate) Save(ctx context.Context) (*Cart, error)

Save creates the Cart in the database.

func (*CartCreate) SaveX

func (cc *CartCreate) SaveX(ctx context.Context) *Cart

SaveX calls Save and panics if Save returns an error.

func (*CartCreate) SetAmount

func (cc *CartCreate) SetAmount(i int64) *CartCreate

SetAmount sets the "amount" field.

func (*CartCreate) SetCreatedAt

func (cc *CartCreate) SetCreatedAt(t time.Time) *CartCreate

SetCreatedAt sets the "created_at" field.

func (*CartCreate) SetNillableCreatedAt

func (cc *CartCreate) SetNillableCreatedAt(t *time.Time) *CartCreate

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

func (*CartCreate) SetNillableUpdatedAt

func (cc *CartCreate) SetNillableUpdatedAt(t *time.Time) *CartCreate

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

func (*CartCreate) SetProductID

func (cc *CartCreate) SetProductID(i int64) *CartCreate

SetProductID sets the "product_id" field.

func (*CartCreate) SetProducts

func (cc *CartCreate) SetProducts(p *Product) *CartCreate

SetProducts sets the "products" edge to the Product entity.

func (*CartCreate) SetProductsID

func (cc *CartCreate) SetProductsID(id int64) *CartCreate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*CartCreate) SetUpdatedAt

func (cc *CartCreate) SetUpdatedAt(t time.Time) *CartCreate

SetUpdatedAt sets the "updated_at" field.

func (*CartCreate) SetUserID

func (cc *CartCreate) SetUserID(i int64) *CartCreate

SetUserID sets the "user_id" field.

func (*CartCreate) SetUsers

func (cc *CartCreate) SetUsers(u *User) *CartCreate

SetUsers sets the "users" edge to the User entity.

func (*CartCreate) SetUsersID

func (cc *CartCreate) SetUsersID(id int64) *CartCreate

SetUsersID sets the "users" edge to the User entity by ID.

type CartCreateBulk

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

CartCreateBulk is the builder for creating many Cart entities in bulk.

func (*CartCreateBulk) Exec

func (ccb *CartCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CartCreateBulk) ExecX

func (ccb *CartCreateBulk) ExecX(ctx context.Context)

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

func (*CartCreateBulk) OnConflict

func (ccb *CartCreateBulk) OnConflict(opts ...sql.ConflictOption) *CartUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Cart.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CartUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CartCreateBulk) OnConflictColumns

func (ccb *CartCreateBulk) OnConflictColumns(columns ...string) *CartUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Cart.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CartCreateBulk) Save

func (ccb *CartCreateBulk) Save(ctx context.Context) ([]*Cart, error)

Save creates the Cart entities in the database.

func (*CartCreateBulk) SaveX

func (ccb *CartCreateBulk) SaveX(ctx context.Context) []*Cart

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

type CartDelete

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

CartDelete is the builder for deleting a Cart entity.

func (*CartDelete) Exec

func (cd *CartDelete) Exec(ctx context.Context) (int, error)

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

func (*CartDelete) ExecX

func (cd *CartDelete) ExecX(ctx context.Context) int

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

func (*CartDelete) Where

func (cd *CartDelete) Where(ps ...predicate.Cart) *CartDelete

Where appends a list predicates to the CartDelete builder.

type CartDeleteOne

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

CartDeleteOne is the builder for deleting a single Cart entity.

func (*CartDeleteOne) Exec

func (cdo *CartDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CartDeleteOne) ExecX

func (cdo *CartDeleteOne) ExecX(ctx context.Context)

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

func (*CartDeleteOne) Where

func (cdo *CartDeleteOne) Where(ps ...predicate.Cart) *CartDeleteOne

Where appends a list predicates to the CartDelete builder.

type CartEdges

type CartEdges struct {
	// Users holds the value of the users edge.
	Users *User `json:"users,omitempty"`
	// Products holds the value of the products edge.
	Products *Product `json:"products,omitempty"`
	// contains filtered or unexported fields
}

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

func (CartEdges) ProductsOrErr

func (e CartEdges) ProductsOrErr() (*Product, error)

ProductsOrErr returns the Products value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (CartEdges) UsersOrErr

func (e CartEdges) UsersOrErr() (*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type CartGroupBy

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

CartGroupBy is the group-by builder for Cart entities.

func (*CartGroupBy) Aggregate

func (cgb *CartGroupBy) Aggregate(fns ...AggregateFunc) *CartGroupBy

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

func (*CartGroupBy) Bool

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

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

func (*CartGroupBy) BoolX

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

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

func (*CartGroupBy) Bools

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

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

func (*CartGroupBy) BoolsX

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

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

func (*CartGroupBy) Float64

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

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

func (*CartGroupBy) Float64X

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

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

func (*CartGroupBy) Float64s

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

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

func (*CartGroupBy) Float64sX

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

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

func (*CartGroupBy) Int

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

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

func (*CartGroupBy) IntX

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

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

func (*CartGroupBy) Ints

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

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

func (*CartGroupBy) IntsX

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

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

func (*CartGroupBy) Scan

func (cgb *CartGroupBy) Scan(ctx context.Context, v any) error

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

func (*CartGroupBy) ScanX

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

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

func (*CartGroupBy) String

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

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

func (*CartGroupBy) StringX

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

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

func (*CartGroupBy) Strings

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

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

func (*CartGroupBy) StringsX

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

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

type CartMutation

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

CartMutation represents an operation that mutates the Cart nodes in the graph.

func (*CartMutation) AddAmount

func (m *CartMutation) AddAmount(i int64)

AddAmount adds i to the "amount" field.

func (*CartMutation) AddField

func (m *CartMutation) 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 (*CartMutation) AddedAmount

func (m *CartMutation) AddedAmount() (r int64, exists bool)

AddedAmount returns the value that was added to the "amount" field in this mutation.

func (*CartMutation) AddedEdges

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

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

func (*CartMutation) AddedField

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

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

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

func (*CartMutation) AddedIDs

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

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

func (*CartMutation) Amount

func (m *CartMutation) Amount() (r int64, exists bool)

Amount returns the value of the "amount" field in the mutation.

func (*CartMutation) ClearEdge

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

func (m *CartMutation) 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 (*CartMutation) ClearProducts

func (m *CartMutation) ClearProducts()

ClearProducts clears the "products" edge to the Product entity.

func (*CartMutation) ClearUsers

func (m *CartMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*CartMutation) ClearedEdges

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

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

func (*CartMutation) ClearedFields

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

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

func (CartMutation) Client

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

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

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

func (*CartMutation) EdgeCleared

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

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

func (*CartMutation) Field

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

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

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

func (*CartMutation) Fields

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

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

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

func (*CartMutation) IDs

func (m *CartMutation) IDs(ctx context.Context) ([]int64, 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 (*CartMutation) OldAmount

func (m *CartMutation) OldAmount(ctx context.Context) (v int64, err error)

OldAmount returns the old "amount" field's value of the Cart entity. If the Cart 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 (*CartMutation) OldCreatedAt

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

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

func (m *CartMutation) 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 (*CartMutation) OldProductID

func (m *CartMutation) OldProductID(ctx context.Context) (v int64, err error)

OldProductID returns the old "product_id" field's value of the Cart entity. If the Cart 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 (*CartMutation) OldUpdatedAt

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

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

func (m *CartMutation) OldUserID(ctx context.Context) (v int64, err error)

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

func (m *CartMutation) Op() Op

Op returns the operation name.

func (*CartMutation) ProductID

func (m *CartMutation) ProductID() (r int64, exists bool)

ProductID returns the value of the "product_id" field in the mutation.

func (*CartMutation) ProductsCleared

func (m *CartMutation) ProductsCleared() bool

ProductsCleared reports if the "products" edge to the Product entity was cleared.

func (*CartMutation) ProductsID

func (m *CartMutation) ProductsID() (id int64, exists bool)

ProductsID returns the "products" edge ID in the mutation.

func (*CartMutation) ProductsIDs

func (m *CartMutation) ProductsIDs() (ids []int64)

ProductsIDs returns the "products" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ProductsID instead. It exists only for internal usage by the builders.

func (*CartMutation) RemovedEdges

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

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

func (*CartMutation) RemovedIDs

func (m *CartMutation) 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 (*CartMutation) ResetAmount

func (m *CartMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*CartMutation) ResetCreatedAt

func (m *CartMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CartMutation) ResetEdge

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

func (m *CartMutation) 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 (*CartMutation) ResetProductID

func (m *CartMutation) ResetProductID()

ResetProductID resets all changes to the "product_id" field.

func (*CartMutation) ResetProducts

func (m *CartMutation) ResetProducts()

ResetProducts resets all changes to the "products" edge.

func (*CartMutation) ResetUpdatedAt

func (m *CartMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CartMutation) ResetUserID

func (m *CartMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*CartMutation) ResetUsers

func (m *CartMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*CartMutation) SetAmount

func (m *CartMutation) SetAmount(i int64)

SetAmount sets the "amount" field.

func (*CartMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CartMutation) SetField

func (m *CartMutation) 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 (*CartMutation) SetOp

func (m *CartMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CartMutation) SetProductID

func (m *CartMutation) SetProductID(i int64)

SetProductID sets the "product_id" field.

func (*CartMutation) SetProductsID

func (m *CartMutation) SetProductsID(id int64)

SetProductsID sets the "products" edge to the Product entity by id.

func (*CartMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CartMutation) SetUserID

func (m *CartMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*CartMutation) SetUsersID

func (m *CartMutation) SetUsersID(id int64)

SetUsersID sets the "users" edge to the User entity by id.

func (CartMutation) Tx

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

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

func (*CartMutation) Type

func (m *CartMutation) Type() string

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

func (*CartMutation) UpdatedAt

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

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

func (*CartMutation) UserID

func (m *CartMutation) UserID() (r int64, exists bool)

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

func (*CartMutation) UsersCleared

func (m *CartMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*CartMutation) UsersID

func (m *CartMutation) UsersID() (id int64, exists bool)

UsersID returns the "users" edge ID in the mutation.

func (*CartMutation) UsersIDs

func (m *CartMutation) UsersIDs() (ids []int64)

UsersIDs returns the "users" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UsersID instead. It exists only for internal usage by the builders.

func (*CartMutation) Where

func (m *CartMutation) Where(ps ...predicate.Cart)

Where appends a list predicates to the CartMutation builder.

func (*CartMutation) WhereP

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

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

type CartQuery

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

CartQuery is the builder for querying Cart entities.

func (*CartQuery) Aggregate

func (cq *CartQuery) Aggregate(fns ...AggregateFunc) *CartSelect

Aggregate returns a CartSelect configured with the given aggregations.

func (*CartQuery) All

func (cq *CartQuery) All(ctx context.Context) ([]*Cart, error)

All executes the query and returns a list of Carts.

func (*CartQuery) AllX

func (cq *CartQuery) AllX(ctx context.Context) []*Cart

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

func (*CartQuery) Clone

func (cq *CartQuery) Clone() *CartQuery

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

func (*CartQuery) Count

func (cq *CartQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CartQuery) CountX

func (cq *CartQuery) CountX(ctx context.Context) int

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

func (*CartQuery) Exist

func (cq *CartQuery) Exist(ctx context.Context) (bool, error)

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

func (*CartQuery) ExistX

func (cq *CartQuery) ExistX(ctx context.Context) bool

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

func (*CartQuery) First

func (cq *CartQuery) First(ctx context.Context) (*Cart, error)

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

func (*CartQuery) FirstID

func (cq *CartQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*CartQuery) FirstIDX

func (cq *CartQuery) FirstIDX(ctx context.Context) int64

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

func (*CartQuery) FirstX

func (cq *CartQuery) FirstX(ctx context.Context) *Cart

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

func (*CartQuery) GroupBy

func (cq *CartQuery) GroupBy(field string, fields ...string) *CartGroupBy

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

Example:

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

client.Cart.Query().
	GroupBy(cart.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CartQuery) IDs

func (cq *CartQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*CartQuery) IDsX

func (cq *CartQuery) IDsX(ctx context.Context) []int64

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

func (*CartQuery) Limit

func (cq *CartQuery) Limit(limit int) *CartQuery

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

func (*CartQuery) Offset

func (cq *CartQuery) Offset(offset int) *CartQuery

Offset to start from.

func (*CartQuery) Only

func (cq *CartQuery) Only(ctx context.Context) (*Cart, error)

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

func (*CartQuery) OnlyID

func (cq *CartQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*CartQuery) OnlyIDX

func (cq *CartQuery) OnlyIDX(ctx context.Context) int64

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

func (*CartQuery) OnlyX

func (cq *CartQuery) OnlyX(ctx context.Context) *Cart

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

func (*CartQuery) Order

func (cq *CartQuery) Order(o ...cart.OrderOption) *CartQuery

Order specifies how the records should be ordered.

func (*CartQuery) QueryProducts

func (cq *CartQuery) QueryProducts() *ProductQuery

QueryProducts chains the current query on the "products" edge.

func (*CartQuery) QueryUsers

func (cq *CartQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*CartQuery) Select

func (cq *CartQuery) Select(fields ...string) *CartSelect

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

Example:

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

client.Cart.Query().
	Select(cart.FieldCreatedAt).
	Scan(ctx, &v)

func (*CartQuery) Unique

func (cq *CartQuery) Unique(unique bool) *CartQuery

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

func (cq *CartQuery) Where(ps ...predicate.Cart) *CartQuery

Where adds a new predicate for the CartQuery builder.

func (*CartQuery) WithProducts

func (cq *CartQuery) WithProducts(opts ...func(*ProductQuery)) *CartQuery

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

func (*CartQuery) WithUsers

func (cq *CartQuery) WithUsers(opts ...func(*UserQuery)) *CartQuery

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

type CartSelect

type CartSelect struct {
	*CartQuery
	// contains filtered or unexported fields
}

CartSelect is the builder for selecting fields of Cart entities.

func (*CartSelect) Aggregate

func (cs *CartSelect) Aggregate(fns ...AggregateFunc) *CartSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CartSelect) Bool

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

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

func (*CartSelect) BoolX

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

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

func (*CartSelect) Bools

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

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

func (*CartSelect) BoolsX

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

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

func (*CartSelect) Float64

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

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

func (*CartSelect) Float64X

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

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

func (*CartSelect) Float64s

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

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

func (*CartSelect) Float64sX

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

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

func (*CartSelect) Int

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

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

func (*CartSelect) IntX

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

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

func (*CartSelect) Ints

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

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

func (*CartSelect) IntsX

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

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

func (*CartSelect) Scan

func (cs *CartSelect) Scan(ctx context.Context, v any) error

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

func (*CartSelect) ScanX

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

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

func (*CartSelect) String

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

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

func (*CartSelect) StringX

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

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

func (*CartSelect) Strings

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

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

func (*CartSelect) StringsX

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

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

type CartUpdate

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

CartUpdate is the builder for updating Cart entities.

func (*CartUpdate) AddAmount

func (cu *CartUpdate) AddAmount(i int64) *CartUpdate

AddAmount adds i to the "amount" field.

func (*CartUpdate) ClearProducts

func (cu *CartUpdate) ClearProducts() *CartUpdate

ClearProducts clears the "products" edge to the Product entity.

func (*CartUpdate) ClearUsers

func (cu *CartUpdate) ClearUsers() *CartUpdate

ClearUsers clears the "users" edge to the User entity.

func (*CartUpdate) Exec

func (cu *CartUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CartUpdate) ExecX

func (cu *CartUpdate) ExecX(ctx context.Context)

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

func (*CartUpdate) Mutation

func (cu *CartUpdate) Mutation() *CartMutation

Mutation returns the CartMutation object of the builder.

func (*CartUpdate) Save

func (cu *CartUpdate) Save(ctx context.Context) (int, error)

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

func (*CartUpdate) SaveX

func (cu *CartUpdate) SaveX(ctx context.Context) int

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

func (*CartUpdate) SetAmount

func (cu *CartUpdate) SetAmount(i int64) *CartUpdate

SetAmount sets the "amount" field.

func (*CartUpdate) SetNillableAmount

func (cu *CartUpdate) SetNillableAmount(i *int64) *CartUpdate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*CartUpdate) SetNillableProductID

func (cu *CartUpdate) SetNillableProductID(i *int64) *CartUpdate

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*CartUpdate) SetNillableUserID

func (cu *CartUpdate) SetNillableUserID(i *int64) *CartUpdate

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

func (*CartUpdate) SetProductID

func (cu *CartUpdate) SetProductID(i int64) *CartUpdate

SetProductID sets the "product_id" field.

func (*CartUpdate) SetProducts

func (cu *CartUpdate) SetProducts(p *Product) *CartUpdate

SetProducts sets the "products" edge to the Product entity.

func (*CartUpdate) SetProductsID

func (cu *CartUpdate) SetProductsID(id int64) *CartUpdate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*CartUpdate) SetUpdatedAt

func (cu *CartUpdate) SetUpdatedAt(t time.Time) *CartUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CartUpdate) SetUserID

func (cu *CartUpdate) SetUserID(i int64) *CartUpdate

SetUserID sets the "user_id" field.

func (*CartUpdate) SetUsers

func (cu *CartUpdate) SetUsers(u *User) *CartUpdate

SetUsers sets the "users" edge to the User entity.

func (*CartUpdate) SetUsersID

func (cu *CartUpdate) SetUsersID(id int64) *CartUpdate

SetUsersID sets the "users" edge to the User entity by ID.

func (*CartUpdate) Where

func (cu *CartUpdate) Where(ps ...predicate.Cart) *CartUpdate

Where appends a list predicates to the CartUpdate builder.

type CartUpdateOne

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

CartUpdateOne is the builder for updating a single Cart entity.

func (*CartUpdateOne) AddAmount

func (cuo *CartUpdateOne) AddAmount(i int64) *CartUpdateOne

AddAmount adds i to the "amount" field.

func (*CartUpdateOne) ClearProducts

func (cuo *CartUpdateOne) ClearProducts() *CartUpdateOne

ClearProducts clears the "products" edge to the Product entity.

func (*CartUpdateOne) ClearUsers

func (cuo *CartUpdateOne) ClearUsers() *CartUpdateOne

ClearUsers clears the "users" edge to the User entity.

func (*CartUpdateOne) Exec

func (cuo *CartUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CartUpdateOne) ExecX

func (cuo *CartUpdateOne) ExecX(ctx context.Context)

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

func (*CartUpdateOne) Mutation

func (cuo *CartUpdateOne) Mutation() *CartMutation

Mutation returns the CartMutation object of the builder.

func (*CartUpdateOne) Save

func (cuo *CartUpdateOne) Save(ctx context.Context) (*Cart, error)

Save executes the query and returns the updated Cart entity.

func (*CartUpdateOne) SaveX

func (cuo *CartUpdateOne) SaveX(ctx context.Context) *Cart

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

func (*CartUpdateOne) Select

func (cuo *CartUpdateOne) Select(field string, fields ...string) *CartUpdateOne

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

func (*CartUpdateOne) SetAmount

func (cuo *CartUpdateOne) SetAmount(i int64) *CartUpdateOne

SetAmount sets the "amount" field.

func (*CartUpdateOne) SetNillableAmount

func (cuo *CartUpdateOne) SetNillableAmount(i *int64) *CartUpdateOne

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*CartUpdateOne) SetNillableProductID

func (cuo *CartUpdateOne) SetNillableProductID(i *int64) *CartUpdateOne

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*CartUpdateOne) SetNillableUserID

func (cuo *CartUpdateOne) SetNillableUserID(i *int64) *CartUpdateOne

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

func (*CartUpdateOne) SetProductID

func (cuo *CartUpdateOne) SetProductID(i int64) *CartUpdateOne

SetProductID sets the "product_id" field.

func (*CartUpdateOne) SetProducts

func (cuo *CartUpdateOne) SetProducts(p *Product) *CartUpdateOne

SetProducts sets the "products" edge to the Product entity.

func (*CartUpdateOne) SetProductsID

func (cuo *CartUpdateOne) SetProductsID(id int64) *CartUpdateOne

SetProductsID sets the "products" edge to the Product entity by ID.

func (*CartUpdateOne) SetUpdatedAt

func (cuo *CartUpdateOne) SetUpdatedAt(t time.Time) *CartUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CartUpdateOne) SetUserID

func (cuo *CartUpdateOne) SetUserID(i int64) *CartUpdateOne

SetUserID sets the "user_id" field.

func (*CartUpdateOne) SetUsers

func (cuo *CartUpdateOne) SetUsers(u *User) *CartUpdateOne

SetUsers sets the "users" edge to the User entity.

func (*CartUpdateOne) SetUsersID

func (cuo *CartUpdateOne) SetUsersID(id int64) *CartUpdateOne

SetUsersID sets the "users" edge to the User entity by ID.

func (*CartUpdateOne) Where

func (cuo *CartUpdateOne) Where(ps ...predicate.Cart) *CartUpdateOne

Where appends a list predicates to the CartUpdate builder.

type CartUpsert

type CartUpsert struct {
	*sql.UpdateSet
}

CartUpsert is the "OnConflict" setter.

func (*CartUpsert) AddAmount

func (u *CartUpsert) AddAmount(v int64) *CartUpsert

AddAmount adds v to the "amount" field.

func (*CartUpsert) SetAmount

func (u *CartUpsert) SetAmount(v int64) *CartUpsert

SetAmount sets the "amount" field.

func (*CartUpsert) SetProductID

func (u *CartUpsert) SetProductID(v int64) *CartUpsert

SetProductID sets the "product_id" field.

func (*CartUpsert) SetUpdatedAt

func (u *CartUpsert) SetUpdatedAt(v time.Time) *CartUpsert

SetUpdatedAt sets the "updated_at" field.

func (*CartUpsert) SetUserID

func (u *CartUpsert) SetUserID(v int64) *CartUpsert

SetUserID sets the "user_id" field.

func (*CartUpsert) UpdateAmount

func (u *CartUpsert) UpdateAmount() *CartUpsert

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*CartUpsert) UpdateProductID

func (u *CartUpsert) UpdateProductID() *CartUpsert

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*CartUpsert) UpdateUpdatedAt

func (u *CartUpsert) UpdateUpdatedAt() *CartUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*CartUpsert) UpdateUserID

func (u *CartUpsert) UpdateUserID() *CartUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type CartUpsertBulk

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

CartUpsertBulk is the builder for "upsert"-ing a bulk of Cart nodes.

func (*CartUpsertBulk) AddAmount

func (u *CartUpsertBulk) AddAmount(v int64) *CartUpsertBulk

AddAmount adds v to the "amount" field.

func (*CartUpsertBulk) DoNothing

func (u *CartUpsertBulk) DoNothing() *CartUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CartUpsertBulk) Exec

func (u *CartUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CartUpsertBulk) ExecX

func (u *CartUpsertBulk) ExecX(ctx context.Context)

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

func (*CartUpsertBulk) Ignore

func (u *CartUpsertBulk) Ignore() *CartUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Cart.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*CartUpsertBulk) SetAmount

func (u *CartUpsertBulk) SetAmount(v int64) *CartUpsertBulk

SetAmount sets the "amount" field.

func (*CartUpsertBulk) SetProductID

func (u *CartUpsertBulk) SetProductID(v int64) *CartUpsertBulk

SetProductID sets the "product_id" field.

func (*CartUpsertBulk) SetUpdatedAt

func (u *CartUpsertBulk) SetUpdatedAt(v time.Time) *CartUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*CartUpsertBulk) SetUserID

func (u *CartUpsertBulk) SetUserID(v int64) *CartUpsertBulk

SetUserID sets the "user_id" field.

func (*CartUpsertBulk) Update

func (u *CartUpsertBulk) Update(set func(*CartUpsert)) *CartUpsertBulk

Update allows overriding fields `UPDATE` values. See the CartCreateBulk.OnConflict documentation for more info.

func (*CartUpsertBulk) UpdateAmount

func (u *CartUpsertBulk) UpdateAmount() *CartUpsertBulk

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*CartUpsertBulk) UpdateNewValues

func (u *CartUpsertBulk) UpdateNewValues() *CartUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Cart.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CartUpsertBulk) UpdateProductID

func (u *CartUpsertBulk) UpdateProductID() *CartUpsertBulk

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*CartUpsertBulk) UpdateUpdatedAt

func (u *CartUpsertBulk) UpdateUpdatedAt() *CartUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*CartUpsertBulk) UpdateUserID

func (u *CartUpsertBulk) UpdateUserID() *CartUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type CartUpsertOne

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

CartUpsertOne is the builder for "upsert"-ing

one Cart node.

func (*CartUpsertOne) AddAmount

func (u *CartUpsertOne) AddAmount(v int64) *CartUpsertOne

AddAmount adds v to the "amount" field.

func (*CartUpsertOne) DoNothing

func (u *CartUpsertOne) DoNothing() *CartUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CartUpsertOne) Exec

func (u *CartUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*CartUpsertOne) ExecX

func (u *CartUpsertOne) ExecX(ctx context.Context)

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

func (*CartUpsertOne) ID

func (u *CartUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*CartUpsertOne) IDX

func (u *CartUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*CartUpsertOne) Ignore

func (u *CartUpsertOne) Ignore() *CartUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Cart.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*CartUpsertOne) SetAmount

func (u *CartUpsertOne) SetAmount(v int64) *CartUpsertOne

SetAmount sets the "amount" field.

func (*CartUpsertOne) SetProductID

func (u *CartUpsertOne) SetProductID(v int64) *CartUpsertOne

SetProductID sets the "product_id" field.

func (*CartUpsertOne) SetUpdatedAt

func (u *CartUpsertOne) SetUpdatedAt(v time.Time) *CartUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*CartUpsertOne) SetUserID

func (u *CartUpsertOne) SetUserID(v int64) *CartUpsertOne

SetUserID sets the "user_id" field.

func (*CartUpsertOne) Update

func (u *CartUpsertOne) Update(set func(*CartUpsert)) *CartUpsertOne

Update allows overriding fields `UPDATE` values. See the CartCreate.OnConflict documentation for more info.

func (*CartUpsertOne) UpdateAmount

func (u *CartUpsertOne) UpdateAmount() *CartUpsertOne

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*CartUpsertOne) UpdateNewValues

func (u *CartUpsertOne) UpdateNewValues() *CartUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Cart.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CartUpsertOne) UpdateProductID

func (u *CartUpsertOne) UpdateProductID() *CartUpsertOne

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*CartUpsertOne) UpdateUpdatedAt

func (u *CartUpsertOne) UpdateUpdatedAt() *CartUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*CartUpsertOne) UpdateUserID

func (u *CartUpsertOne) UpdateUserID() *CartUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type Carts

type Carts []*Cart

Carts is a parsable slice of Cart.

type Categories

type Categories []*Category

Categories is a parsable slice of Category.

type Category

type Category struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CategoryQuery when eager-loading is set.
	Edges CategoryEdges `json:"edges"`
	// contains filtered or unexported fields
}

Category is the model entity for the Category schema.

func (*Category) QueryProducts

func (c *Category) QueryProducts() *ProductQuery

QueryProducts queries the "products" edge of the Category entity.

func (*Category) String

func (c *Category) String() string

String implements the fmt.Stringer.

func (*Category) Unwrap

func (c *Category) Unwrap() *Category

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

func (c *Category) Update() *CategoryUpdateOne

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

func (*Category) Value

func (c *Category) Value(name string) (ent.Value, error)

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

type CategoryClient

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

CategoryClient is a client for the Category schema.

func NewCategoryClient

func NewCategoryClient(c config) *CategoryClient

NewCategoryClient returns a client for the Category from the given config.

func (*CategoryClient) Create

func (c *CategoryClient) Create() *CategoryCreate

Create returns a builder for creating a Category entity.

func (*CategoryClient) CreateBulk

func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk

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

func (*CategoryClient) Delete

func (c *CategoryClient) Delete() *CategoryDelete

Delete returns a delete builder for Category.

func (*CategoryClient) DeleteOne

func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CategoryClient) DeleteOneID

func (c *CategoryClient) DeleteOneID(id int64) *CategoryDeleteOne

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

func (*CategoryClient) Get

func (c *CategoryClient) Get(ctx context.Context, id int64) (*Category, error)

Get returns a Category entity by its id.

func (*CategoryClient) GetX

func (c *CategoryClient) GetX(ctx context.Context, id int64) *Category

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

func (*CategoryClient) Hooks

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

Hooks returns the client hooks.

func (*CategoryClient) Intercept

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

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

func (*CategoryClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CategoryClient) MapCreateBulk

func (c *CategoryClient) MapCreateBulk(slice any, setFunc func(*CategoryCreate, int)) *CategoryCreateBulk

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

func (c *CategoryClient) Query() *CategoryQuery

Query returns a query builder for Category.

func (*CategoryClient) QueryProducts

func (c *CategoryClient) QueryProducts(ca *Category) *ProductQuery

QueryProducts queries the products edge of a Category.

func (*CategoryClient) Update

func (c *CategoryClient) Update() *CategoryUpdate

Update returns an update builder for Category.

func (*CategoryClient) UpdateOne

func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CategoryClient) UpdateOneID

func (c *CategoryClient) UpdateOneID(id int64) *CategoryUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CategoryClient) Use

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

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

type CategoryCreate

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

CategoryCreate is the builder for creating a Category entity.

func (*CategoryCreate) AddProductIDs

func (cc *CategoryCreate) AddProductIDs(ids ...int64) *CategoryCreate

AddProductIDs adds the "products" edge to the Product entity by IDs.

func (*CategoryCreate) AddProducts

func (cc *CategoryCreate) AddProducts(p ...*Product) *CategoryCreate

AddProducts adds the "products" edges to the Product entity.

func (*CategoryCreate) Exec

func (cc *CategoryCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryCreate) ExecX

func (cc *CategoryCreate) ExecX(ctx context.Context)

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

func (*CategoryCreate) Mutation

func (cc *CategoryCreate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryCreate) OnConflict

func (cc *CategoryCreate) OnConflict(opts ...sql.ConflictOption) *CategoryUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Category.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CategoryUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CategoryCreate) OnConflictColumns

func (cc *CategoryCreate) OnConflictColumns(columns ...string) *CategoryUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Category.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CategoryCreate) Save

func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error)

Save creates the Category in the database.

func (*CategoryCreate) SaveX

func (cc *CategoryCreate) SaveX(ctx context.Context) *Category

SaveX calls Save and panics if Save returns an error.

func (*CategoryCreate) SetCreatedAt

func (cc *CategoryCreate) SetCreatedAt(t time.Time) *CategoryCreate

SetCreatedAt sets the "created_at" field.

func (*CategoryCreate) SetName

func (cc *CategoryCreate) SetName(s string) *CategoryCreate

SetName sets the "name" field.

func (*CategoryCreate) SetNillableCreatedAt

func (cc *CategoryCreate) SetNillableCreatedAt(t *time.Time) *CategoryCreate

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

func (*CategoryCreate) SetNillableUpdatedAt

func (cc *CategoryCreate) SetNillableUpdatedAt(t *time.Time) *CategoryCreate

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

func (*CategoryCreate) SetUpdatedAt

func (cc *CategoryCreate) SetUpdatedAt(t time.Time) *CategoryCreate

SetUpdatedAt sets the "updated_at" field.

type CategoryCreateBulk

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

CategoryCreateBulk is the builder for creating many Category entities in bulk.

func (*CategoryCreateBulk) Exec

func (ccb *CategoryCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryCreateBulk) ExecX

func (ccb *CategoryCreateBulk) ExecX(ctx context.Context)

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

func (*CategoryCreateBulk) OnConflict

func (ccb *CategoryCreateBulk) OnConflict(opts ...sql.ConflictOption) *CategoryUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Category.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.CategoryUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CategoryCreateBulk) OnConflictColumns

func (ccb *CategoryCreateBulk) OnConflictColumns(columns ...string) *CategoryUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Category.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*CategoryCreateBulk) Save

func (ccb *CategoryCreateBulk) Save(ctx context.Context) ([]*Category, error)

Save creates the Category entities in the database.

func (*CategoryCreateBulk) SaveX

func (ccb *CategoryCreateBulk) SaveX(ctx context.Context) []*Category

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

type CategoryDelete

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

CategoryDelete is the builder for deleting a Category entity.

func (*CategoryDelete) Exec

func (cd *CategoryDelete) Exec(ctx context.Context) (int, error)

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

func (*CategoryDelete) ExecX

func (cd *CategoryDelete) ExecX(ctx context.Context) int

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

func (*CategoryDelete) Where

func (cd *CategoryDelete) Where(ps ...predicate.Category) *CategoryDelete

Where appends a list predicates to the CategoryDelete builder.

type CategoryDeleteOne

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

CategoryDeleteOne is the builder for deleting a single Category entity.

func (*CategoryDeleteOne) Exec

func (cdo *CategoryDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CategoryDeleteOne) ExecX

func (cdo *CategoryDeleteOne) ExecX(ctx context.Context)

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

func (*CategoryDeleteOne) Where

Where appends a list predicates to the CategoryDelete builder.

type CategoryEdges

type CategoryEdges struct {
	// Products holds the value of the products edge.
	Products []*Product `json:"products,omitempty"`
	// contains filtered or unexported fields
}

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

func (CategoryEdges) ProductsOrErr

func (e CategoryEdges) ProductsOrErr() ([]*Product, error)

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

type CategoryGroupBy

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

CategoryGroupBy is the group-by builder for Category entities.

func (*CategoryGroupBy) Aggregate

func (cgb *CategoryGroupBy) Aggregate(fns ...AggregateFunc) *CategoryGroupBy

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

func (*CategoryGroupBy) Bool

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

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

func (*CategoryGroupBy) BoolX

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

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

func (*CategoryGroupBy) Bools

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

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

func (*CategoryGroupBy) BoolsX

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

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

func (*CategoryGroupBy) Float64

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

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

func (*CategoryGroupBy) Float64X

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

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

func (*CategoryGroupBy) Float64s

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

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

func (*CategoryGroupBy) Float64sX

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

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

func (*CategoryGroupBy) Int

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

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

func (*CategoryGroupBy) IntX

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

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

func (*CategoryGroupBy) Ints

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

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

func (*CategoryGroupBy) IntsX

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

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

func (*CategoryGroupBy) Scan

func (cgb *CategoryGroupBy) Scan(ctx context.Context, v any) error

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

func (*CategoryGroupBy) ScanX

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

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

func (*CategoryGroupBy) String

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

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

func (*CategoryGroupBy) StringX

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

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

func (*CategoryGroupBy) Strings

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

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

func (*CategoryGroupBy) StringsX

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

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

type CategoryMutation

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

CategoryMutation represents an operation that mutates the Category nodes in the graph.

func (*CategoryMutation) AddField

func (m *CategoryMutation) 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 (*CategoryMutation) AddProductIDs

func (m *CategoryMutation) AddProductIDs(ids ...int64)

AddProductIDs adds the "products" edge to the Product entity by ids.

func (*CategoryMutation) AddedEdges

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

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

func (*CategoryMutation) AddedField

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

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

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

func (*CategoryMutation) AddedIDs

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

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

func (*CategoryMutation) ClearEdge

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

func (m *CategoryMutation) 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 (*CategoryMutation) ClearProducts

func (m *CategoryMutation) ClearProducts()

ClearProducts clears the "products" edge to the Product entity.

func (*CategoryMutation) ClearedEdges

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

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

func (*CategoryMutation) ClearedFields

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

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

func (CategoryMutation) Client

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

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

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

func (*CategoryMutation) EdgeCleared

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

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

func (*CategoryMutation) Field

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

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

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

func (*CategoryMutation) Fields

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

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

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

func (*CategoryMutation) IDs

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

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

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

func (*CategoryMutation) OldCreatedAt

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

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

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

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

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

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

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

func (m *CategoryMutation) Op() Op

Op returns the operation name.

func (*CategoryMutation) ProductsCleared

func (m *CategoryMutation) ProductsCleared() bool

ProductsCleared reports if the "products" edge to the Product entity was cleared.

func (*CategoryMutation) ProductsIDs

func (m *CategoryMutation) ProductsIDs() (ids []int64)

ProductsIDs returns the "products" edge IDs in the mutation.

func (*CategoryMutation) RemoveProductIDs

func (m *CategoryMutation) RemoveProductIDs(ids ...int64)

RemoveProductIDs removes the "products" edge to the Product entity by IDs.

func (*CategoryMutation) RemovedEdges

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

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

func (*CategoryMutation) RemovedIDs

func (m *CategoryMutation) 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 (*CategoryMutation) RemovedProductsIDs

func (m *CategoryMutation) RemovedProductsIDs() (ids []int64)

RemovedProducts returns the removed IDs of the "products" edge to the Product entity.

func (*CategoryMutation) ResetCreatedAt

func (m *CategoryMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CategoryMutation) ResetEdge

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

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

func (m *CategoryMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CategoryMutation) ResetProducts

func (m *CategoryMutation) ResetProducts()

ResetProducts resets all changes to the "products" edge.

func (*CategoryMutation) ResetUpdatedAt

func (m *CategoryMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CategoryMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CategoryMutation) SetField

func (m *CategoryMutation) 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 (*CategoryMutation) SetName

func (m *CategoryMutation) SetName(s string)

SetName sets the "name" field.

func (*CategoryMutation) SetOp

func (m *CategoryMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CategoryMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (CategoryMutation) Tx

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

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

func (*CategoryMutation) Type

func (m *CategoryMutation) Type() string

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

func (*CategoryMutation) UpdatedAt

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

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

func (*CategoryMutation) Where

func (m *CategoryMutation) Where(ps ...predicate.Category)

Where appends a list predicates to the CategoryMutation builder.

func (*CategoryMutation) WhereP

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

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

type CategoryQuery

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

CategoryQuery is the builder for querying Category entities.

func (*CategoryQuery) Aggregate

func (cq *CategoryQuery) Aggregate(fns ...AggregateFunc) *CategorySelect

Aggregate returns a CategorySelect configured with the given aggregations.

func (*CategoryQuery) All

func (cq *CategoryQuery) All(ctx context.Context) ([]*Category, error)

All executes the query and returns a list of Categories.

func (*CategoryQuery) AllX

func (cq *CategoryQuery) AllX(ctx context.Context) []*Category

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

func (*CategoryQuery) Clone

func (cq *CategoryQuery) Clone() *CategoryQuery

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

func (*CategoryQuery) Count

func (cq *CategoryQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CategoryQuery) CountX

func (cq *CategoryQuery) CountX(ctx context.Context) int

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

func (*CategoryQuery) Exist

func (cq *CategoryQuery) Exist(ctx context.Context) (bool, error)

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

func (*CategoryQuery) ExistX

func (cq *CategoryQuery) ExistX(ctx context.Context) bool

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

func (*CategoryQuery) First

func (cq *CategoryQuery) First(ctx context.Context) (*Category, error)

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

func (*CategoryQuery) FirstID

func (cq *CategoryQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*CategoryQuery) FirstIDX

func (cq *CategoryQuery) FirstIDX(ctx context.Context) int64

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

func (*CategoryQuery) FirstX

func (cq *CategoryQuery) FirstX(ctx context.Context) *Category

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

func (*CategoryQuery) GroupBy

func (cq *CategoryQuery) GroupBy(field string, fields ...string) *CategoryGroupBy

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

Example:

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

client.Category.Query().
	GroupBy(category.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CategoryQuery) IDs

func (cq *CategoryQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*CategoryQuery) IDsX

func (cq *CategoryQuery) IDsX(ctx context.Context) []int64

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

func (*CategoryQuery) Limit

func (cq *CategoryQuery) Limit(limit int) *CategoryQuery

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

func (*CategoryQuery) Offset

func (cq *CategoryQuery) Offset(offset int) *CategoryQuery

Offset to start from.

func (*CategoryQuery) Only

func (cq *CategoryQuery) Only(ctx context.Context) (*Category, error)

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

func (*CategoryQuery) OnlyID

func (cq *CategoryQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*CategoryQuery) OnlyIDX

func (cq *CategoryQuery) OnlyIDX(ctx context.Context) int64

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

func (*CategoryQuery) OnlyX

func (cq *CategoryQuery) OnlyX(ctx context.Context) *Category

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

func (*CategoryQuery) Order

Order specifies how the records should be ordered.

func (*CategoryQuery) QueryProducts

func (cq *CategoryQuery) QueryProducts() *ProductQuery

QueryProducts chains the current query on the "products" edge.

func (*CategoryQuery) Select

func (cq *CategoryQuery) Select(fields ...string) *CategorySelect

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

Example:

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

client.Category.Query().
	Select(category.FieldCreatedAt).
	Scan(ctx, &v)

func (*CategoryQuery) Unique

func (cq *CategoryQuery) Unique(unique bool) *CategoryQuery

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

func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery

Where adds a new predicate for the CategoryQuery builder.

func (*CategoryQuery) WithProducts

func (cq *CategoryQuery) WithProducts(opts ...func(*ProductQuery)) *CategoryQuery

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

type CategorySelect

type CategorySelect struct {
	*CategoryQuery
	// contains filtered or unexported fields
}

CategorySelect is the builder for selecting fields of Category entities.

func (*CategorySelect) Aggregate

func (cs *CategorySelect) Aggregate(fns ...AggregateFunc) *CategorySelect

Aggregate adds the given aggregation functions to the selector query.

func (*CategorySelect) Bool

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

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

func (*CategorySelect) BoolX

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

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

func (*CategorySelect) Bools

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

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

func (*CategorySelect) BoolsX

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

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

func (*CategorySelect) Float64

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

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

func (*CategorySelect) Float64X

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

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

func (*CategorySelect) Float64s

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

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

func (*CategorySelect) Float64sX

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

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

func (*CategorySelect) Int

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

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

func (*CategorySelect) IntX

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

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

func (*CategorySelect) Ints

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

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

func (*CategorySelect) IntsX

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

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

func (*CategorySelect) Scan

func (cs *CategorySelect) Scan(ctx context.Context, v any) error

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

func (*CategorySelect) ScanX

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

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

func (*CategorySelect) String

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

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

func (*CategorySelect) StringX

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

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

func (*CategorySelect) Strings

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

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

func (*CategorySelect) StringsX

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

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

type CategoryUpdate

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

CategoryUpdate is the builder for updating Category entities.

func (*CategoryUpdate) AddProductIDs

func (cu *CategoryUpdate) AddProductIDs(ids ...int64) *CategoryUpdate

AddProductIDs adds the "products" edge to the Product entity by IDs.

func (*CategoryUpdate) AddProducts

func (cu *CategoryUpdate) AddProducts(p ...*Product) *CategoryUpdate

AddProducts adds the "products" edges to the Product entity.

func (*CategoryUpdate) ClearProducts

func (cu *CategoryUpdate) ClearProducts() *CategoryUpdate

ClearProducts clears all "products" edges to the Product entity.

func (*CategoryUpdate) Exec

func (cu *CategoryUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpdate) ExecX

func (cu *CategoryUpdate) ExecX(ctx context.Context)

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

func (*CategoryUpdate) Mutation

func (cu *CategoryUpdate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdate) RemoveProductIDs

func (cu *CategoryUpdate) RemoveProductIDs(ids ...int64) *CategoryUpdate

RemoveProductIDs removes the "products" edge to Product entities by IDs.

func (*CategoryUpdate) RemoveProducts

func (cu *CategoryUpdate) RemoveProducts(p ...*Product) *CategoryUpdate

RemoveProducts removes "products" edges to Product entities.

func (*CategoryUpdate) Save

func (cu *CategoryUpdate) Save(ctx context.Context) (int, error)

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

func (*CategoryUpdate) SaveX

func (cu *CategoryUpdate) SaveX(ctx context.Context) int

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

func (*CategoryUpdate) SetName

func (cu *CategoryUpdate) SetName(s string) *CategoryUpdate

SetName sets the "name" field.

func (*CategoryUpdate) SetNillableName

func (cu *CategoryUpdate) SetNillableName(s *string) *CategoryUpdate

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

func (*CategoryUpdate) SetUpdatedAt

func (cu *CategoryUpdate) SetUpdatedAt(t time.Time) *CategoryUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpdate) Where

func (cu *CategoryUpdate) Where(ps ...predicate.Category) *CategoryUpdate

Where appends a list predicates to the CategoryUpdate builder.

type CategoryUpdateOne

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

CategoryUpdateOne is the builder for updating a single Category entity.

func (*CategoryUpdateOne) AddProductIDs

func (cuo *CategoryUpdateOne) AddProductIDs(ids ...int64) *CategoryUpdateOne

AddProductIDs adds the "products" edge to the Product entity by IDs.

func (*CategoryUpdateOne) AddProducts

func (cuo *CategoryUpdateOne) AddProducts(p ...*Product) *CategoryUpdateOne

AddProducts adds the "products" edges to the Product entity.

func (*CategoryUpdateOne) ClearProducts

func (cuo *CategoryUpdateOne) ClearProducts() *CategoryUpdateOne

ClearProducts clears all "products" edges to the Product entity.

func (*CategoryUpdateOne) Exec

func (cuo *CategoryUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CategoryUpdateOne) ExecX

func (cuo *CategoryUpdateOne) ExecX(ctx context.Context)

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

func (*CategoryUpdateOne) Mutation

func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdateOne) RemoveProductIDs

func (cuo *CategoryUpdateOne) RemoveProductIDs(ids ...int64) *CategoryUpdateOne

RemoveProductIDs removes the "products" edge to Product entities by IDs.

func (*CategoryUpdateOne) RemoveProducts

func (cuo *CategoryUpdateOne) RemoveProducts(p ...*Product) *CategoryUpdateOne

RemoveProducts removes "products" edges to Product entities.

func (*CategoryUpdateOne) Save

func (cuo *CategoryUpdateOne) Save(ctx context.Context) (*Category, error)

Save executes the query and returns the updated Category entity.

func (*CategoryUpdateOne) SaveX

func (cuo *CategoryUpdateOne) SaveX(ctx context.Context) *Category

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

func (*CategoryUpdateOne) Select

func (cuo *CategoryUpdateOne) Select(field string, fields ...string) *CategoryUpdateOne

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

func (*CategoryUpdateOne) SetName

func (cuo *CategoryUpdateOne) SetName(s string) *CategoryUpdateOne

SetName sets the "name" field.

func (*CategoryUpdateOne) SetNillableName

func (cuo *CategoryUpdateOne) SetNillableName(s *string) *CategoryUpdateOne

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

func (*CategoryUpdateOne) SetUpdatedAt

func (cuo *CategoryUpdateOne) SetUpdatedAt(t time.Time) *CategoryUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpdateOne) Where

Where appends a list predicates to the CategoryUpdate builder.

type CategoryUpsert

type CategoryUpsert struct {
	*sql.UpdateSet
}

CategoryUpsert is the "OnConflict" setter.

func (*CategoryUpsert) SetName

func (u *CategoryUpsert) SetName(v string) *CategoryUpsert

SetName sets the "name" field.

func (*CategoryUpsert) SetUpdatedAt

func (u *CategoryUpsert) SetUpdatedAt(v time.Time) *CategoryUpsert

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsert) UpdateName

func (u *CategoryUpsert) UpdateName() *CategoryUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsert) UpdateUpdatedAt

func (u *CategoryUpsert) UpdateUpdatedAt() *CategoryUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type CategoryUpsertBulk

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

CategoryUpsertBulk is the builder for "upsert"-ing a bulk of Category nodes.

func (*CategoryUpsertBulk) DoNothing

func (u *CategoryUpsertBulk) DoNothing() *CategoryUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CategoryUpsertBulk) Exec

func (u *CategoryUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpsertBulk) ExecX

func (u *CategoryUpsertBulk) ExecX(ctx context.Context)

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

func (*CategoryUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Category.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*CategoryUpsertBulk) SetName

SetName sets the "name" field.

func (*CategoryUpsertBulk) SetUpdatedAt

func (u *CategoryUpsertBulk) SetUpdatedAt(v time.Time) *CategoryUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsertBulk) Update

func (u *CategoryUpsertBulk) Update(set func(*CategoryUpsert)) *CategoryUpsertBulk

Update allows overriding fields `UPDATE` values. See the CategoryCreateBulk.OnConflict documentation for more info.

func (*CategoryUpsertBulk) UpdateName

func (u *CategoryUpsertBulk) UpdateName() *CategoryUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsertBulk) UpdateNewValues

func (u *CategoryUpsertBulk) UpdateNewValues() *CategoryUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Category.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CategoryUpsertBulk) UpdateUpdatedAt

func (u *CategoryUpsertBulk) UpdateUpdatedAt() *CategoryUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type CategoryUpsertOne

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

CategoryUpsertOne is the builder for "upsert"-ing

one Category node.

func (*CategoryUpsertOne) DoNothing

func (u *CategoryUpsertOne) DoNothing() *CategoryUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*CategoryUpsertOne) Exec

func (u *CategoryUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpsertOne) ExecX

func (u *CategoryUpsertOne) ExecX(ctx context.Context)

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

func (*CategoryUpsertOne) ID

func (u *CategoryUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*CategoryUpsertOne) IDX

func (u *CategoryUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*CategoryUpsertOne) Ignore

func (u *CategoryUpsertOne) Ignore() *CategoryUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Category.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*CategoryUpsertOne) SetName

SetName sets the "name" field.

func (*CategoryUpsertOne) SetUpdatedAt

func (u *CategoryUpsertOne) SetUpdatedAt(v time.Time) *CategoryUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*CategoryUpsertOne) Update

func (u *CategoryUpsertOne) Update(set func(*CategoryUpsert)) *CategoryUpsertOne

Update allows overriding fields `UPDATE` values. See the CategoryCreate.OnConflict documentation for more info.

func (*CategoryUpsertOne) UpdateName

func (u *CategoryUpsertOne) UpdateName() *CategoryUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*CategoryUpsertOne) UpdateNewValues

func (u *CategoryUpsertOne) UpdateNewValues() *CategoryUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Category.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CategoryUpsertOne) UpdateUpdatedAt

func (u *CategoryUpsertOne) UpdateUpdatedAt() *CategoryUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

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
	// Cart is the client for interacting with the Cart builders.
	Cart *CartClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// OrderProduct is the client for interacting with the OrderProduct builders.
	OrderProduct *OrderProductClient
	// Product is the client for interacting with the Product builders.
	Product *ProductClient
	// ProductImage is the client for interacting with the ProductImage builders.
	ProductImage *ProductImageClient
	// 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 Order

type Order struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int64 `json:"user_id,omitempty"`
	// Status holds the value of the "status" field.
	Status order.Status `json:"status,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the OrderQuery when eager-loading is set.
	Edges OrderEdges `json:"edges"`
	// contains filtered or unexported fields
}

Order is the model entity for the Order schema.

func (*Order) QueryOrderProducts

func (o *Order) QueryOrderProducts() *OrderProductQuery

QueryOrderProducts queries the "order_products" edge of the Order entity.

func (*Order) QueryUsers

func (o *Order) QueryUsers() *UserQuery

QueryUsers queries the "users" edge of the Order entity.

func (*Order) String

func (o *Order) String() string

String implements the fmt.Stringer.

func (*Order) Unwrap

func (o *Order) Unwrap() *Order

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

func (o *Order) Update() *OrderUpdateOne

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

func (*Order) Value

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

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

type OrderClient

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

OrderClient is a client for the Order schema.

func NewOrderClient

func NewOrderClient(c config) *OrderClient

NewOrderClient returns a client for the Order from the given config.

func (*OrderClient) Create

func (c *OrderClient) Create() *OrderCreate

Create returns a builder for creating a Order entity.

func (*OrderClient) CreateBulk

func (c *OrderClient) CreateBulk(builders ...*OrderCreate) *OrderCreateBulk

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

func (*OrderClient) Delete

func (c *OrderClient) Delete() *OrderDelete

Delete returns a delete builder for Order.

func (*OrderClient) DeleteOne

func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*OrderClient) DeleteOneID

func (c *OrderClient) DeleteOneID(id int64) *OrderDeleteOne

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

func (*OrderClient) Get

func (c *OrderClient) Get(ctx context.Context, id int64) (*Order, error)

Get returns a Order entity by its id.

func (*OrderClient) GetX

func (c *OrderClient) GetX(ctx context.Context, id int64) *Order

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

func (*OrderClient) Hooks

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

Hooks returns the client hooks.

func (*OrderClient) Intercept

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

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

func (*OrderClient) Interceptors

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

Interceptors returns the client interceptors.

func (*OrderClient) MapCreateBulk

func (c *OrderClient) MapCreateBulk(slice any, setFunc func(*OrderCreate, int)) *OrderCreateBulk

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

func (c *OrderClient) Query() *OrderQuery

Query returns a query builder for Order.

func (*OrderClient) QueryOrderProducts

func (c *OrderClient) QueryOrderProducts(o *Order) *OrderProductQuery

QueryOrderProducts queries the order_products edge of a Order.

func (*OrderClient) QueryUsers

func (c *OrderClient) QueryUsers(o *Order) *UserQuery

QueryUsers queries the users edge of a Order.

func (*OrderClient) Update

func (c *OrderClient) Update() *OrderUpdate

Update returns an update builder for Order.

func (*OrderClient) UpdateOne

func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne

UpdateOne returns an update builder for the given entity.

func (*OrderClient) UpdateOneID

func (c *OrderClient) UpdateOneID(id int64) *OrderUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OrderClient) Use

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

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

type OrderCreate

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

OrderCreate is the builder for creating a Order entity.

func (*OrderCreate) AddOrderProductIDs

func (oc *OrderCreate) AddOrderProductIDs(ids ...int64) *OrderCreate

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*OrderCreate) AddOrderProducts

func (oc *OrderCreate) AddOrderProducts(o ...*OrderProduct) *OrderCreate

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*OrderCreate) Exec

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

Exec executes the query.

func (*OrderCreate) ExecX

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

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

func (*OrderCreate) Mutation

func (oc *OrderCreate) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderCreate) OnConflict

func (oc *OrderCreate) OnConflict(opts ...sql.ConflictOption) *OrderUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Order.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.OrderUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*OrderCreate) OnConflictColumns

func (oc *OrderCreate) OnConflictColumns(columns ...string) *OrderUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Order.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*OrderCreate) Save

func (oc *OrderCreate) Save(ctx context.Context) (*Order, error)

Save creates the Order in the database.

func (*OrderCreate) SaveX

func (oc *OrderCreate) SaveX(ctx context.Context) *Order

SaveX calls Save and panics if Save returns an error.

func (*OrderCreate) SetCreatedAt

func (oc *OrderCreate) SetCreatedAt(t time.Time) *OrderCreate

SetCreatedAt sets the "created_at" field.

func (*OrderCreate) SetNillableCreatedAt

func (oc *OrderCreate) SetNillableCreatedAt(t *time.Time) *OrderCreate

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

func (*OrderCreate) SetNillableStatus

func (oc *OrderCreate) SetNillableStatus(o *order.Status) *OrderCreate

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

func (*OrderCreate) SetNillableUpdatedAt

func (oc *OrderCreate) SetNillableUpdatedAt(t *time.Time) *OrderCreate

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

func (*OrderCreate) SetStatus

func (oc *OrderCreate) SetStatus(o order.Status) *OrderCreate

SetStatus sets the "status" field.

func (*OrderCreate) SetUpdatedAt

func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate

SetUpdatedAt sets the "updated_at" field.

func (*OrderCreate) SetUserID

func (oc *OrderCreate) SetUserID(i int64) *OrderCreate

SetUserID sets the "user_id" field.

func (*OrderCreate) SetUsers

func (oc *OrderCreate) SetUsers(u *User) *OrderCreate

SetUsers sets the "users" edge to the User entity.

func (*OrderCreate) SetUsersID

func (oc *OrderCreate) SetUsersID(id int64) *OrderCreate

SetUsersID sets the "users" edge to the User entity by ID.

type OrderCreateBulk

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

OrderCreateBulk is the builder for creating many Order entities in bulk.

func (*OrderCreateBulk) Exec

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

Exec executes the query.

func (*OrderCreateBulk) ExecX

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

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

func (*OrderCreateBulk) OnConflict

func (ocb *OrderCreateBulk) OnConflict(opts ...sql.ConflictOption) *OrderUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Order.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.OrderUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*OrderCreateBulk) OnConflictColumns

func (ocb *OrderCreateBulk) OnConflictColumns(columns ...string) *OrderUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Order.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*OrderCreateBulk) Save

func (ocb *OrderCreateBulk) Save(ctx context.Context) ([]*Order, error)

Save creates the Order entities in the database.

func (*OrderCreateBulk) SaveX

func (ocb *OrderCreateBulk) SaveX(ctx context.Context) []*Order

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

type OrderDelete

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

OrderDelete is the builder for deleting a Order entity.

func (*OrderDelete) Exec

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

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

func (*OrderDelete) ExecX

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

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

func (*OrderDelete) Where

func (od *OrderDelete) Where(ps ...predicate.Order) *OrderDelete

Where appends a list predicates to the OrderDelete builder.

type OrderDeleteOne

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

OrderDeleteOne is the builder for deleting a single Order entity.

func (*OrderDeleteOne) Exec

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

Exec executes the deletion query.

func (*OrderDeleteOne) ExecX

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

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

func (*OrderDeleteOne) Where

func (odo *OrderDeleteOne) Where(ps ...predicate.Order) *OrderDeleteOne

Where appends a list predicates to the OrderDelete builder.

type OrderEdges

type OrderEdges struct {
	// Users holds the value of the users edge.
	Users *User `json:"users,omitempty"`
	// OrderProducts holds the value of the order_products edge.
	OrderProducts []*OrderProduct `json:"order_products,omitempty"`
	// contains filtered or unexported fields
}

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

func (OrderEdges) OrderProductsOrErr

func (e OrderEdges) OrderProductsOrErr() ([]*OrderProduct, error)

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

func (OrderEdges) UsersOrErr

func (e OrderEdges) UsersOrErr() (*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

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 OrderGroupBy

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

OrderGroupBy is the group-by builder for Order entities.

func (*OrderGroupBy) Aggregate

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

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

func (*OrderGroupBy) Bool

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

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

func (*OrderGroupBy) BoolX

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

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

func (*OrderGroupBy) Bools

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

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

func (*OrderGroupBy) BoolsX

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

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

func (*OrderGroupBy) Float64

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

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

func (*OrderGroupBy) Float64X

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

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

func (*OrderGroupBy) Float64s

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

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

func (*OrderGroupBy) Float64sX

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

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

func (*OrderGroupBy) Int

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

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

func (*OrderGroupBy) IntX

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

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

func (*OrderGroupBy) Ints

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

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

func (*OrderGroupBy) IntsX

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

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

func (*OrderGroupBy) Scan

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

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

func (*OrderGroupBy) ScanX

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

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

func (*OrderGroupBy) String

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

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

func (*OrderGroupBy) StringX

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

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

func (*OrderGroupBy) Strings

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

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

func (*OrderGroupBy) StringsX

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

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

type OrderMutation

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

OrderMutation represents an operation that mutates the Order nodes in the graph.

func (*OrderMutation) AddField

func (m *OrderMutation) 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 (*OrderMutation) AddOrderProductIDs

func (m *OrderMutation) AddOrderProductIDs(ids ...int64)

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by ids.

func (*OrderMutation) AddedEdges

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

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

func (*OrderMutation) AddedField

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

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

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

func (*OrderMutation) AddedIDs

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

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

func (*OrderMutation) ClearEdge

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

func (m *OrderMutation) 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 (*OrderMutation) ClearOrderProducts

func (m *OrderMutation) ClearOrderProducts()

ClearOrderProducts clears the "order_products" edge to the OrderProduct entity.

func (*OrderMutation) ClearUsers

func (m *OrderMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

func (*OrderMutation) ClearedEdges

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

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

func (*OrderMutation) ClearedFields

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

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

func (OrderMutation) Client

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

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

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

func (*OrderMutation) EdgeCleared

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

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

func (*OrderMutation) Field

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

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

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

func (*OrderMutation) Fields

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

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

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

func (*OrderMutation) IDs

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

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

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

func (m *OrderMutation) 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 (*OrderMutation) OldStatus

func (m *OrderMutation) OldStatus(ctx context.Context) (v order.Status, err error)

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

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

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

func (m *OrderMutation) OldUserID(ctx context.Context) (v int64, err error)

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

func (m *OrderMutation) Op() Op

Op returns the operation name.

func (*OrderMutation) OrderProductsCleared

func (m *OrderMutation) OrderProductsCleared() bool

OrderProductsCleared reports if the "order_products" edge to the OrderProduct entity was cleared.

func (*OrderMutation) OrderProductsIDs

func (m *OrderMutation) OrderProductsIDs() (ids []int64)

OrderProductsIDs returns the "order_products" edge IDs in the mutation.

func (*OrderMutation) RemoveOrderProductIDs

func (m *OrderMutation) RemoveOrderProductIDs(ids ...int64)

RemoveOrderProductIDs removes the "order_products" edge to the OrderProduct entity by IDs.

func (*OrderMutation) RemovedEdges

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

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

func (*OrderMutation) RemovedIDs

func (m *OrderMutation) 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 (*OrderMutation) RemovedOrderProductsIDs

func (m *OrderMutation) RemovedOrderProductsIDs() (ids []int64)

RemovedOrderProducts returns the removed IDs of the "order_products" edge to the OrderProduct entity.

func (*OrderMutation) ResetCreatedAt

func (m *OrderMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*OrderMutation) ResetEdge

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

func (m *OrderMutation) 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 (*OrderMutation) ResetOrderProducts

func (m *OrderMutation) ResetOrderProducts()

ResetOrderProducts resets all changes to the "order_products" edge.

func (*OrderMutation) ResetStatus

func (m *OrderMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*OrderMutation) ResetUpdatedAt

func (m *OrderMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*OrderMutation) ResetUserID

func (m *OrderMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*OrderMutation) ResetUsers

func (m *OrderMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*OrderMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*OrderMutation) SetField

func (m *OrderMutation) 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 (*OrderMutation) SetOp

func (m *OrderMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*OrderMutation) SetStatus

func (m *OrderMutation) SetStatus(o order.Status)

SetStatus sets the "status" field.

func (*OrderMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*OrderMutation) SetUserID

func (m *OrderMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (*OrderMutation) SetUsersID

func (m *OrderMutation) SetUsersID(id int64)

SetUsersID sets the "users" edge to the User entity by id.

func (*OrderMutation) Status

func (m *OrderMutation) Status() (r order.Status, exists bool)

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

func (OrderMutation) Tx

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

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

func (*OrderMutation) Type

func (m *OrderMutation) Type() string

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

func (*OrderMutation) UpdatedAt

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

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

func (*OrderMutation) UserID

func (m *OrderMutation) UserID() (r int64, exists bool)

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

func (*OrderMutation) UsersCleared

func (m *OrderMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*OrderMutation) UsersID

func (m *OrderMutation) UsersID() (id int64, exists bool)

UsersID returns the "users" edge ID in the mutation.

func (*OrderMutation) UsersIDs

func (m *OrderMutation) UsersIDs() (ids []int64)

UsersIDs returns the "users" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UsersID instead. It exists only for internal usage by the builders.

func (*OrderMutation) Where

func (m *OrderMutation) Where(ps ...predicate.Order)

Where appends a list predicates to the OrderMutation builder.

func (*OrderMutation) WhereP

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

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

type OrderProduct

type OrderProduct struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// OrderID holds the value of the "order_id" field.
	OrderID int64 `json:"order_id,omitempty"`
	// ProductID holds the value of the "product_id" field.
	ProductID int64 `json:"product_id,omitempty"`
	// Amount holds the value of the "amount" field.
	Amount int64 `json:"amount,omitempty"`
	// Price holds the value of the "price" field.
	Price int64 `json:"price,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the OrderProductQuery when eager-loading is set.
	Edges OrderProductEdges `json:"edges"`
	// contains filtered or unexported fields
}

OrderProduct is the model entity for the OrderProduct schema.

func (*OrderProduct) QueryOrders

func (op *OrderProduct) QueryOrders() *OrderQuery

QueryOrders queries the "orders" edge of the OrderProduct entity.

func (*OrderProduct) QueryProducts

func (op *OrderProduct) QueryProducts() *ProductQuery

QueryProducts queries the "products" edge of the OrderProduct entity.

func (*OrderProduct) String

func (op *OrderProduct) String() string

String implements the fmt.Stringer.

func (*OrderProduct) Unwrap

func (op *OrderProduct) Unwrap() *OrderProduct

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

func (op *OrderProduct) Update() *OrderProductUpdateOne

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

func (*OrderProduct) Value

func (op *OrderProduct) Value(name string) (ent.Value, error)

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

type OrderProductClient

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

OrderProductClient is a client for the OrderProduct schema.

func NewOrderProductClient

func NewOrderProductClient(c config) *OrderProductClient

NewOrderProductClient returns a client for the OrderProduct from the given config.

func (*OrderProductClient) Create

Create returns a builder for creating a OrderProduct entity.

func (*OrderProductClient) CreateBulk

func (c *OrderProductClient) CreateBulk(builders ...*OrderProductCreate) *OrderProductCreateBulk

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

func (*OrderProductClient) Delete

Delete returns a delete builder for OrderProduct.

func (*OrderProductClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*OrderProductClient) DeleteOneID

func (c *OrderProductClient) DeleteOneID(id int64) *OrderProductDeleteOne

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

func (*OrderProductClient) Get

Get returns a OrderProduct entity by its id.

func (*OrderProductClient) GetX

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

func (*OrderProductClient) Hooks

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

Hooks returns the client hooks.

func (*OrderProductClient) Intercept

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

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

func (*OrderProductClient) Interceptors

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

Interceptors returns the client interceptors.

func (*OrderProductClient) MapCreateBulk

func (c *OrderProductClient) MapCreateBulk(slice any, setFunc func(*OrderProductCreate, int)) *OrderProductCreateBulk

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

Query returns a query builder for OrderProduct.

func (*OrderProductClient) QueryOrders

func (c *OrderProductClient) QueryOrders(op *OrderProduct) *OrderQuery

QueryOrders queries the orders edge of a OrderProduct.

func (*OrderProductClient) QueryProducts

func (c *OrderProductClient) QueryProducts(op *OrderProduct) *ProductQuery

QueryProducts queries the products edge of a OrderProduct.

func (*OrderProductClient) Update

Update returns an update builder for OrderProduct.

func (*OrderProductClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*OrderProductClient) UpdateOneID

func (c *OrderProductClient) UpdateOneID(id int64) *OrderProductUpdateOne

UpdateOneID returns an update builder for the given id.

func (*OrderProductClient) Use

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

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

type OrderProductCreate

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

OrderProductCreate is the builder for creating a OrderProduct entity.

func (*OrderProductCreate) Exec

func (opc *OrderProductCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderProductCreate) ExecX

func (opc *OrderProductCreate) ExecX(ctx context.Context)

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

func (*OrderProductCreate) Mutation

func (opc *OrderProductCreate) Mutation() *OrderProductMutation

Mutation returns the OrderProductMutation object of the builder.

func (*OrderProductCreate) OnConflict

func (opc *OrderProductCreate) OnConflict(opts ...sql.ConflictOption) *OrderProductUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.OrderProduct.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.OrderProductUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*OrderProductCreate) OnConflictColumns

func (opc *OrderProductCreate) OnConflictColumns(columns ...string) *OrderProductUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.OrderProduct.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*OrderProductCreate) Save

Save creates the OrderProduct in the database.

func (*OrderProductCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*OrderProductCreate) SetAmount

func (opc *OrderProductCreate) SetAmount(i int64) *OrderProductCreate

SetAmount sets the "amount" field.

func (*OrderProductCreate) SetCreatedAt

func (opc *OrderProductCreate) SetCreatedAt(t time.Time) *OrderProductCreate

SetCreatedAt sets the "created_at" field.

func (*OrderProductCreate) SetNillableAmount

func (opc *OrderProductCreate) SetNillableAmount(i *int64) *OrderProductCreate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*OrderProductCreate) SetNillableCreatedAt

func (opc *OrderProductCreate) SetNillableCreatedAt(t *time.Time) *OrderProductCreate

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

func (*OrderProductCreate) SetNillableUpdatedAt

func (opc *OrderProductCreate) SetNillableUpdatedAt(t *time.Time) *OrderProductCreate

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

func (*OrderProductCreate) SetOrderID

func (opc *OrderProductCreate) SetOrderID(i int64) *OrderProductCreate

SetOrderID sets the "order_id" field.

func (*OrderProductCreate) SetOrders

func (opc *OrderProductCreate) SetOrders(o *Order) *OrderProductCreate

SetOrders sets the "orders" edge to the Order entity.

func (*OrderProductCreate) SetOrdersID

func (opc *OrderProductCreate) SetOrdersID(id int64) *OrderProductCreate

SetOrdersID sets the "orders" edge to the Order entity by ID.

func (*OrderProductCreate) SetPrice

func (opc *OrderProductCreate) SetPrice(i int64) *OrderProductCreate

SetPrice sets the "price" field.

func (*OrderProductCreate) SetProductID

func (opc *OrderProductCreate) SetProductID(i int64) *OrderProductCreate

SetProductID sets the "product_id" field.

func (*OrderProductCreate) SetProducts

func (opc *OrderProductCreate) SetProducts(p *Product) *OrderProductCreate

SetProducts sets the "products" edge to the Product entity.

func (*OrderProductCreate) SetProductsID

func (opc *OrderProductCreate) SetProductsID(id int64) *OrderProductCreate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*OrderProductCreate) SetUpdatedAt

func (opc *OrderProductCreate) SetUpdatedAt(t time.Time) *OrderProductCreate

SetUpdatedAt sets the "updated_at" field.

type OrderProductCreateBulk

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

OrderProductCreateBulk is the builder for creating many OrderProduct entities in bulk.

func (*OrderProductCreateBulk) Exec

func (opcb *OrderProductCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderProductCreateBulk) ExecX

func (opcb *OrderProductCreateBulk) ExecX(ctx context.Context)

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

func (*OrderProductCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.OrderProduct.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.OrderProductUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*OrderProductCreateBulk) OnConflictColumns

func (opcb *OrderProductCreateBulk) OnConflictColumns(columns ...string) *OrderProductUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.OrderProduct.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*OrderProductCreateBulk) Save

Save creates the OrderProduct entities in the database.

func (*OrderProductCreateBulk) SaveX

func (opcb *OrderProductCreateBulk) SaveX(ctx context.Context) []*OrderProduct

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

type OrderProductDelete

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

OrderProductDelete is the builder for deleting a OrderProduct entity.

func (*OrderProductDelete) Exec

func (opd *OrderProductDelete) Exec(ctx context.Context) (int, error)

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

func (*OrderProductDelete) ExecX

func (opd *OrderProductDelete) ExecX(ctx context.Context) int

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

func (*OrderProductDelete) Where

Where appends a list predicates to the OrderProductDelete builder.

type OrderProductDeleteOne

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

OrderProductDeleteOne is the builder for deleting a single OrderProduct entity.

func (*OrderProductDeleteOne) Exec

func (opdo *OrderProductDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*OrderProductDeleteOne) ExecX

func (opdo *OrderProductDeleteOne) ExecX(ctx context.Context)

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

func (*OrderProductDeleteOne) Where

Where appends a list predicates to the OrderProductDelete builder.

type OrderProductEdges

type OrderProductEdges struct {
	// Orders holds the value of the orders edge.
	Orders *Order `json:"orders,omitempty"`
	// Products holds the value of the products edge.
	Products *Product `json:"products,omitempty"`
	// contains filtered or unexported fields
}

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

func (OrderProductEdges) OrdersOrErr

func (e OrderProductEdges) OrdersOrErr() (*Order, error)

OrdersOrErr returns the Orders value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (OrderProductEdges) ProductsOrErr

func (e OrderProductEdges) ProductsOrErr() (*Product, error)

ProductsOrErr returns the Products value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type OrderProductGroupBy

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

OrderProductGroupBy is the group-by builder for OrderProduct entities.

func (*OrderProductGroupBy) Aggregate

func (opgb *OrderProductGroupBy) Aggregate(fns ...AggregateFunc) *OrderProductGroupBy

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

func (*OrderProductGroupBy) Bool

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

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

func (*OrderProductGroupBy) BoolX

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

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

func (*OrderProductGroupBy) Bools

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

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

func (*OrderProductGroupBy) BoolsX

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

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

func (*OrderProductGroupBy) Float64

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

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

func (*OrderProductGroupBy) Float64X

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

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

func (*OrderProductGroupBy) Float64s

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

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

func (*OrderProductGroupBy) Float64sX

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

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

func (*OrderProductGroupBy) Int

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

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

func (*OrderProductGroupBy) IntX

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

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

func (*OrderProductGroupBy) Ints

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

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

func (*OrderProductGroupBy) IntsX

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

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

func (*OrderProductGroupBy) Scan

func (opgb *OrderProductGroupBy) Scan(ctx context.Context, v any) error

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

func (*OrderProductGroupBy) ScanX

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

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

func (*OrderProductGroupBy) String

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

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

func (*OrderProductGroupBy) StringX

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

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

func (*OrderProductGroupBy) Strings

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

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

func (*OrderProductGroupBy) StringsX

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

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

type OrderProductMutation

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

OrderProductMutation represents an operation that mutates the OrderProduct nodes in the graph.

func (*OrderProductMutation) AddAmount

func (m *OrderProductMutation) AddAmount(i int64)

AddAmount adds i to the "amount" field.

func (*OrderProductMutation) AddField

func (m *OrderProductMutation) 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 (*OrderProductMutation) AddPrice

func (m *OrderProductMutation) AddPrice(i int64)

AddPrice adds i to the "price" field.

func (*OrderProductMutation) AddedAmount

func (m *OrderProductMutation) AddedAmount() (r int64, exists bool)

AddedAmount returns the value that was added to the "amount" field in this mutation.

func (*OrderProductMutation) AddedEdges

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

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

func (*OrderProductMutation) AddedField

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

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

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

func (*OrderProductMutation) AddedIDs

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

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

func (*OrderProductMutation) AddedPrice

func (m *OrderProductMutation) AddedPrice() (r int64, exists bool)

AddedPrice returns the value that was added to the "price" field in this mutation.

func (*OrderProductMutation) Amount

func (m *OrderProductMutation) Amount() (r int64, exists bool)

Amount returns the value of the "amount" field in the mutation.

func (*OrderProductMutation) ClearEdge

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

func (m *OrderProductMutation) 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 (*OrderProductMutation) ClearOrders

func (m *OrderProductMutation) ClearOrders()

ClearOrders clears the "orders" edge to the Order entity.

func (*OrderProductMutation) ClearProducts

func (m *OrderProductMutation) ClearProducts()

ClearProducts clears the "products" edge to the Product entity.

func (*OrderProductMutation) ClearedEdges

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

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

func (*OrderProductMutation) ClearedFields

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

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

func (OrderProductMutation) Client

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

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

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

func (*OrderProductMutation) EdgeCleared

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

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

func (*OrderProductMutation) Field

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

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

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

func (*OrderProductMutation) Fields

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

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

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

func (*OrderProductMutation) IDs

func (m *OrderProductMutation) IDs(ctx context.Context) ([]int64, 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 (*OrderProductMutation) OldAmount

func (m *OrderProductMutation) OldAmount(ctx context.Context) (v int64, err error)

OldAmount returns the old "amount" field's value of the OrderProduct entity. If the OrderProduct 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 (*OrderProductMutation) OldCreatedAt

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

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

func (m *OrderProductMutation) 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 (*OrderProductMutation) OldOrderID

func (m *OrderProductMutation) OldOrderID(ctx context.Context) (v int64, err error)

OldOrderID returns the old "order_id" field's value of the OrderProduct entity. If the OrderProduct 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 (*OrderProductMutation) OldPrice

func (m *OrderProductMutation) OldPrice(ctx context.Context) (v int64, err error)

OldPrice returns the old "price" field's value of the OrderProduct entity. If the OrderProduct 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 (*OrderProductMutation) OldProductID

func (m *OrderProductMutation) OldProductID(ctx context.Context) (v int64, err error)

OldProductID returns the old "product_id" field's value of the OrderProduct entity. If the OrderProduct 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 (*OrderProductMutation) OldUpdatedAt

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

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

func (m *OrderProductMutation) Op() Op

Op returns the operation name.

func (*OrderProductMutation) OrderID

func (m *OrderProductMutation) OrderID() (r int64, exists bool)

OrderID returns the value of the "order_id" field in the mutation.

func (*OrderProductMutation) OrdersCleared

func (m *OrderProductMutation) OrdersCleared() bool

OrdersCleared reports if the "orders" edge to the Order entity was cleared.

func (*OrderProductMutation) OrdersID

func (m *OrderProductMutation) OrdersID() (id int64, exists bool)

OrdersID returns the "orders" edge ID in the mutation.

func (*OrderProductMutation) OrdersIDs

func (m *OrderProductMutation) OrdersIDs() (ids []int64)

OrdersIDs returns the "orders" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use OrdersID instead. It exists only for internal usage by the builders.

func (*OrderProductMutation) Price

func (m *OrderProductMutation) Price() (r int64, exists bool)

Price returns the value of the "price" field in the mutation.

func (*OrderProductMutation) ProductID

func (m *OrderProductMutation) ProductID() (r int64, exists bool)

ProductID returns the value of the "product_id" field in the mutation.

func (*OrderProductMutation) ProductsCleared

func (m *OrderProductMutation) ProductsCleared() bool

ProductsCleared reports if the "products" edge to the Product entity was cleared.

func (*OrderProductMutation) ProductsID

func (m *OrderProductMutation) ProductsID() (id int64, exists bool)

ProductsID returns the "products" edge ID in the mutation.

func (*OrderProductMutation) ProductsIDs

func (m *OrderProductMutation) ProductsIDs() (ids []int64)

ProductsIDs returns the "products" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ProductsID instead. It exists only for internal usage by the builders.

func (*OrderProductMutation) RemovedEdges

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

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

func (*OrderProductMutation) RemovedIDs

func (m *OrderProductMutation) 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 (*OrderProductMutation) ResetAmount

func (m *OrderProductMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*OrderProductMutation) ResetCreatedAt

func (m *OrderProductMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*OrderProductMutation) ResetEdge

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

func (m *OrderProductMutation) 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 (*OrderProductMutation) ResetOrderID

func (m *OrderProductMutation) ResetOrderID()

ResetOrderID resets all changes to the "order_id" field.

func (*OrderProductMutation) ResetOrders

func (m *OrderProductMutation) ResetOrders()

ResetOrders resets all changes to the "orders" edge.

func (*OrderProductMutation) ResetPrice

func (m *OrderProductMutation) ResetPrice()

ResetPrice resets all changes to the "price" field.

func (*OrderProductMutation) ResetProductID

func (m *OrderProductMutation) ResetProductID()

ResetProductID resets all changes to the "product_id" field.

func (*OrderProductMutation) ResetProducts

func (m *OrderProductMutation) ResetProducts()

ResetProducts resets all changes to the "products" edge.

func (*OrderProductMutation) ResetUpdatedAt

func (m *OrderProductMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*OrderProductMutation) SetAmount

func (m *OrderProductMutation) SetAmount(i int64)

SetAmount sets the "amount" field.

func (*OrderProductMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*OrderProductMutation) SetField

func (m *OrderProductMutation) 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 (*OrderProductMutation) SetOp

func (m *OrderProductMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*OrderProductMutation) SetOrderID

func (m *OrderProductMutation) SetOrderID(i int64)

SetOrderID sets the "order_id" field.

func (*OrderProductMutation) SetOrdersID

func (m *OrderProductMutation) SetOrdersID(id int64)

SetOrdersID sets the "orders" edge to the Order entity by id.

func (*OrderProductMutation) SetPrice

func (m *OrderProductMutation) SetPrice(i int64)

SetPrice sets the "price" field.

func (*OrderProductMutation) SetProductID

func (m *OrderProductMutation) SetProductID(i int64)

SetProductID sets the "product_id" field.

func (*OrderProductMutation) SetProductsID

func (m *OrderProductMutation) SetProductsID(id int64)

SetProductsID sets the "products" edge to the Product entity by id.

func (*OrderProductMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (OrderProductMutation) Tx

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

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

func (*OrderProductMutation) Type

func (m *OrderProductMutation) Type() string

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

func (*OrderProductMutation) UpdatedAt

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

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

func (*OrderProductMutation) Where

Where appends a list predicates to the OrderProductMutation builder.

func (*OrderProductMutation) WhereP

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

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

type OrderProductQuery

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

OrderProductQuery is the builder for querying OrderProduct entities.

func (*OrderProductQuery) Aggregate

func (opq *OrderProductQuery) Aggregate(fns ...AggregateFunc) *OrderProductSelect

Aggregate returns a OrderProductSelect configured with the given aggregations.

func (*OrderProductQuery) All

func (opq *OrderProductQuery) All(ctx context.Context) ([]*OrderProduct, error)

All executes the query and returns a list of OrderProducts.

func (*OrderProductQuery) AllX

func (opq *OrderProductQuery) AllX(ctx context.Context) []*OrderProduct

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

func (*OrderProductQuery) Clone

func (opq *OrderProductQuery) Clone() *OrderProductQuery

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

func (*OrderProductQuery) Count

func (opq *OrderProductQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*OrderProductQuery) CountX

func (opq *OrderProductQuery) CountX(ctx context.Context) int

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

func (*OrderProductQuery) Exist

func (opq *OrderProductQuery) Exist(ctx context.Context) (bool, error)

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

func (*OrderProductQuery) ExistX

func (opq *OrderProductQuery) ExistX(ctx context.Context) bool

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

func (*OrderProductQuery) First

func (opq *OrderProductQuery) First(ctx context.Context) (*OrderProduct, error)

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

func (*OrderProductQuery) FirstID

func (opq *OrderProductQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*OrderProductQuery) FirstIDX

func (opq *OrderProductQuery) FirstIDX(ctx context.Context) int64

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

func (*OrderProductQuery) FirstX

func (opq *OrderProductQuery) FirstX(ctx context.Context) *OrderProduct

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

func (*OrderProductQuery) GroupBy

func (opq *OrderProductQuery) GroupBy(field string, fields ...string) *OrderProductGroupBy

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

Example:

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

client.OrderProduct.Query().
	GroupBy(orderproduct.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OrderProductQuery) IDs

func (opq *OrderProductQuery) IDs(ctx context.Context) (ids []int64, err error)

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

func (*OrderProductQuery) IDsX

func (opq *OrderProductQuery) IDsX(ctx context.Context) []int64

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

func (*OrderProductQuery) Limit

func (opq *OrderProductQuery) Limit(limit int) *OrderProductQuery

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

func (*OrderProductQuery) Offset

func (opq *OrderProductQuery) Offset(offset int) *OrderProductQuery

Offset to start from.

func (*OrderProductQuery) Only

func (opq *OrderProductQuery) Only(ctx context.Context) (*OrderProduct, error)

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

func (*OrderProductQuery) OnlyID

func (opq *OrderProductQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*OrderProductQuery) OnlyIDX

func (opq *OrderProductQuery) OnlyIDX(ctx context.Context) int64

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

func (*OrderProductQuery) OnlyX

func (opq *OrderProductQuery) OnlyX(ctx context.Context) *OrderProduct

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

func (*OrderProductQuery) Order

Order specifies how the records should be ordered.

func (*OrderProductQuery) QueryOrders

func (opq *OrderProductQuery) QueryOrders() *OrderQuery

QueryOrders chains the current query on the "orders" edge.

func (*OrderProductQuery) QueryProducts

func (opq *OrderProductQuery) QueryProducts() *ProductQuery

QueryProducts chains the current query on the "products" edge.

func (*OrderProductQuery) Select

func (opq *OrderProductQuery) Select(fields ...string) *OrderProductSelect

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

Example:

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

client.OrderProduct.Query().
	Select(orderproduct.FieldCreatedAt).
	Scan(ctx, &v)

func (*OrderProductQuery) Unique

func (opq *OrderProductQuery) Unique(unique bool) *OrderProductQuery

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

Where adds a new predicate for the OrderProductQuery builder.

func (*OrderProductQuery) WithOrders

func (opq *OrderProductQuery) WithOrders(opts ...func(*OrderQuery)) *OrderProductQuery

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

func (*OrderProductQuery) WithProducts

func (opq *OrderProductQuery) WithProducts(opts ...func(*ProductQuery)) *OrderProductQuery

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

type OrderProductSelect

type OrderProductSelect struct {
	*OrderProductQuery
	// contains filtered or unexported fields
}

OrderProductSelect is the builder for selecting fields of OrderProduct entities.

func (*OrderProductSelect) Aggregate

func (ops *OrderProductSelect) Aggregate(fns ...AggregateFunc) *OrderProductSelect

Aggregate adds the given aggregation functions to the selector query.

func (*OrderProductSelect) Bool

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

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

func (*OrderProductSelect) BoolX

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

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

func (*OrderProductSelect) Bools

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

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

func (*OrderProductSelect) BoolsX

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

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

func (*OrderProductSelect) Float64

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

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

func (*OrderProductSelect) Float64X

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

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

func (*OrderProductSelect) Float64s

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

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

func (*OrderProductSelect) Float64sX

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

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

func (*OrderProductSelect) Int

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

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

func (*OrderProductSelect) IntX

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

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

func (*OrderProductSelect) Ints

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

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

func (*OrderProductSelect) IntsX

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

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

func (*OrderProductSelect) Scan

func (ops *OrderProductSelect) Scan(ctx context.Context, v any) error

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

func (*OrderProductSelect) ScanX

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

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

func (*OrderProductSelect) String

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

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

func (*OrderProductSelect) StringX

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

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

func (*OrderProductSelect) Strings

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

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

func (*OrderProductSelect) StringsX

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

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

type OrderProductUpdate

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

OrderProductUpdate is the builder for updating OrderProduct entities.

func (*OrderProductUpdate) AddAmount

func (opu *OrderProductUpdate) AddAmount(i int64) *OrderProductUpdate

AddAmount adds i to the "amount" field.

func (*OrderProductUpdate) AddPrice

func (opu *OrderProductUpdate) AddPrice(i int64) *OrderProductUpdate

AddPrice adds i to the "price" field.

func (*OrderProductUpdate) ClearOrders

func (opu *OrderProductUpdate) ClearOrders() *OrderProductUpdate

ClearOrders clears the "orders" edge to the Order entity.

func (*OrderProductUpdate) ClearProducts

func (opu *OrderProductUpdate) ClearProducts() *OrderProductUpdate

ClearProducts clears the "products" edge to the Product entity.

func (*OrderProductUpdate) Exec

func (opu *OrderProductUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderProductUpdate) ExecX

func (opu *OrderProductUpdate) ExecX(ctx context.Context)

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

func (*OrderProductUpdate) Mutation

func (opu *OrderProductUpdate) Mutation() *OrderProductMutation

Mutation returns the OrderProductMutation object of the builder.

func (*OrderProductUpdate) Save

func (opu *OrderProductUpdate) Save(ctx context.Context) (int, error)

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

func (*OrderProductUpdate) SaveX

func (opu *OrderProductUpdate) SaveX(ctx context.Context) int

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

func (*OrderProductUpdate) SetAmount

func (opu *OrderProductUpdate) SetAmount(i int64) *OrderProductUpdate

SetAmount sets the "amount" field.

func (*OrderProductUpdate) SetNillableAmount

func (opu *OrderProductUpdate) SetNillableAmount(i *int64) *OrderProductUpdate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*OrderProductUpdate) SetNillableOrderID

func (opu *OrderProductUpdate) SetNillableOrderID(i *int64) *OrderProductUpdate

SetNillableOrderID sets the "order_id" field if the given value is not nil.

func (*OrderProductUpdate) SetNillablePrice

func (opu *OrderProductUpdate) SetNillablePrice(i *int64) *OrderProductUpdate

SetNillablePrice sets the "price" field if the given value is not nil.

func (*OrderProductUpdate) SetNillableProductID

func (opu *OrderProductUpdate) SetNillableProductID(i *int64) *OrderProductUpdate

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*OrderProductUpdate) SetOrderID

func (opu *OrderProductUpdate) SetOrderID(i int64) *OrderProductUpdate

SetOrderID sets the "order_id" field.

func (*OrderProductUpdate) SetOrders

func (opu *OrderProductUpdate) SetOrders(o *Order) *OrderProductUpdate

SetOrders sets the "orders" edge to the Order entity.

func (*OrderProductUpdate) SetOrdersID

func (opu *OrderProductUpdate) SetOrdersID(id int64) *OrderProductUpdate

SetOrdersID sets the "orders" edge to the Order entity by ID.

func (*OrderProductUpdate) SetPrice

func (opu *OrderProductUpdate) SetPrice(i int64) *OrderProductUpdate

SetPrice sets the "price" field.

func (*OrderProductUpdate) SetProductID

func (opu *OrderProductUpdate) SetProductID(i int64) *OrderProductUpdate

SetProductID sets the "product_id" field.

func (*OrderProductUpdate) SetProducts

func (opu *OrderProductUpdate) SetProducts(p *Product) *OrderProductUpdate

SetProducts sets the "products" edge to the Product entity.

func (*OrderProductUpdate) SetProductsID

func (opu *OrderProductUpdate) SetProductsID(id int64) *OrderProductUpdate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*OrderProductUpdate) SetUpdatedAt

func (opu *OrderProductUpdate) SetUpdatedAt(t time.Time) *OrderProductUpdate

SetUpdatedAt sets the "updated_at" field.

func (*OrderProductUpdate) Where

Where appends a list predicates to the OrderProductUpdate builder.

type OrderProductUpdateOne

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

OrderProductUpdateOne is the builder for updating a single OrderProduct entity.

func (*OrderProductUpdateOne) AddAmount

AddAmount adds i to the "amount" field.

func (*OrderProductUpdateOne) AddPrice

AddPrice adds i to the "price" field.

func (*OrderProductUpdateOne) ClearOrders

func (opuo *OrderProductUpdateOne) ClearOrders() *OrderProductUpdateOne

ClearOrders clears the "orders" edge to the Order entity.

func (*OrderProductUpdateOne) ClearProducts

func (opuo *OrderProductUpdateOne) ClearProducts() *OrderProductUpdateOne

ClearProducts clears the "products" edge to the Product entity.

func (*OrderProductUpdateOne) Exec

func (opuo *OrderProductUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*OrderProductUpdateOne) ExecX

func (opuo *OrderProductUpdateOne) ExecX(ctx context.Context)

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

func (*OrderProductUpdateOne) Mutation

func (opuo *OrderProductUpdateOne) Mutation() *OrderProductMutation

Mutation returns the OrderProductMutation object of the builder.

func (*OrderProductUpdateOne) Save

Save executes the query and returns the updated OrderProduct entity.

func (*OrderProductUpdateOne) SaveX

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

func (*OrderProductUpdateOne) Select

func (opuo *OrderProductUpdateOne) Select(field string, fields ...string) *OrderProductUpdateOne

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

func (*OrderProductUpdateOne) SetAmount

SetAmount sets the "amount" field.

func (*OrderProductUpdateOne) SetNillableAmount

func (opuo *OrderProductUpdateOne) SetNillableAmount(i *int64) *OrderProductUpdateOne

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*OrderProductUpdateOne) SetNillableOrderID

func (opuo *OrderProductUpdateOne) SetNillableOrderID(i *int64) *OrderProductUpdateOne

SetNillableOrderID sets the "order_id" field if the given value is not nil.

func (*OrderProductUpdateOne) SetNillablePrice

func (opuo *OrderProductUpdateOne) SetNillablePrice(i *int64) *OrderProductUpdateOne

SetNillablePrice sets the "price" field if the given value is not nil.

func (*OrderProductUpdateOne) SetNillableProductID

func (opuo *OrderProductUpdateOne) SetNillableProductID(i *int64) *OrderProductUpdateOne

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*OrderProductUpdateOne) SetOrderID

func (opuo *OrderProductUpdateOne) SetOrderID(i int64) *OrderProductUpdateOne

SetOrderID sets the "order_id" field.

func (*OrderProductUpdateOne) SetOrders

func (opuo *OrderProductUpdateOne) SetOrders(o *Order) *OrderProductUpdateOne

SetOrders sets the "orders" edge to the Order entity.

func (*OrderProductUpdateOne) SetOrdersID

func (opuo *OrderProductUpdateOne) SetOrdersID(id int64) *OrderProductUpdateOne

SetOrdersID sets the "orders" edge to the Order entity by ID.

func (*OrderProductUpdateOne) SetPrice

SetPrice sets the "price" field.

func (*OrderProductUpdateOne) SetProductID

func (opuo *OrderProductUpdateOne) SetProductID(i int64) *OrderProductUpdateOne

SetProductID sets the "product_id" field.

func (*OrderProductUpdateOne) SetProducts

func (opuo *OrderProductUpdateOne) SetProducts(p *Product) *OrderProductUpdateOne

SetProducts sets the "products" edge to the Product entity.

func (*OrderProductUpdateOne) SetProductsID

func (opuo *OrderProductUpdateOne) SetProductsID(id int64) *OrderProductUpdateOne

SetProductsID sets the "products" edge to the Product entity by ID.

func (*OrderProductUpdateOne) SetUpdatedAt

func (opuo *OrderProductUpdateOne) SetUpdatedAt(t time.Time) *OrderProductUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*OrderProductUpdateOne) Where

Where appends a list predicates to the OrderProductUpdate builder.

type OrderProductUpsert

type OrderProductUpsert struct {
	*sql.UpdateSet
}

OrderProductUpsert is the "OnConflict" setter.

func (*OrderProductUpsert) AddAmount

func (u *OrderProductUpsert) AddAmount(v int64) *OrderProductUpsert

AddAmount adds v to the "amount" field.

func (*OrderProductUpsert) AddPrice

AddPrice adds v to the "price" field.

func (*OrderProductUpsert) SetAmount

func (u *OrderProductUpsert) SetAmount(v int64) *OrderProductUpsert

SetAmount sets the "amount" field.

func (*OrderProductUpsert) SetOrderID

func (u *OrderProductUpsert) SetOrderID(v int64) *OrderProductUpsert

SetOrderID sets the "order_id" field.

func (*OrderProductUpsert) SetPrice

SetPrice sets the "price" field.

func (*OrderProductUpsert) SetProductID

func (u *OrderProductUpsert) SetProductID(v int64) *OrderProductUpsert

SetProductID sets the "product_id" field.

func (*OrderProductUpsert) SetUpdatedAt

func (u *OrderProductUpsert) SetUpdatedAt(v time.Time) *OrderProductUpsert

SetUpdatedAt sets the "updated_at" field.

func (*OrderProductUpsert) UpdateAmount

func (u *OrderProductUpsert) UpdateAmount() *OrderProductUpsert

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*OrderProductUpsert) UpdateOrderID

func (u *OrderProductUpsert) UpdateOrderID() *OrderProductUpsert

UpdateOrderID sets the "order_id" field to the value that was provided on create.

func (*OrderProductUpsert) UpdatePrice

func (u *OrderProductUpsert) UpdatePrice() *OrderProductUpsert

UpdatePrice sets the "price" field to the value that was provided on create.

func (*OrderProductUpsert) UpdateProductID

func (u *OrderProductUpsert) UpdateProductID() *OrderProductUpsert

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*OrderProductUpsert) UpdateUpdatedAt

func (u *OrderProductUpsert) UpdateUpdatedAt() *OrderProductUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type OrderProductUpsertBulk

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

OrderProductUpsertBulk is the builder for "upsert"-ing a bulk of OrderProduct nodes.

func (*OrderProductUpsertBulk) AddAmount

AddAmount adds v to the "amount" field.

func (*OrderProductUpsertBulk) AddPrice

AddPrice adds v to the "price" field.

func (*OrderProductUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*OrderProductUpsertBulk) Exec

Exec executes the query.

func (*OrderProductUpsertBulk) ExecX

func (u *OrderProductUpsertBulk) ExecX(ctx context.Context)

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

func (*OrderProductUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.OrderProduct.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*OrderProductUpsertBulk) SetAmount

SetAmount sets the "amount" field.

func (*OrderProductUpsertBulk) SetOrderID

SetOrderID sets the "order_id" field.

func (*OrderProductUpsertBulk) SetPrice

SetPrice sets the "price" field.

func (*OrderProductUpsertBulk) SetProductID

SetProductID sets the "product_id" field.

func (*OrderProductUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*OrderProductUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the OrderProductCreateBulk.OnConflict documentation for more info.

func (*OrderProductUpsertBulk) UpdateAmount

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*OrderProductUpsertBulk) UpdateNewValues

func (u *OrderProductUpsertBulk) UpdateNewValues() *OrderProductUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.OrderProduct.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*OrderProductUpsertBulk) UpdateOrderID

func (u *OrderProductUpsertBulk) UpdateOrderID() *OrderProductUpsertBulk

UpdateOrderID sets the "order_id" field to the value that was provided on create.

func (*OrderProductUpsertBulk) UpdatePrice

UpdatePrice sets the "price" field to the value that was provided on create.

func (*OrderProductUpsertBulk) UpdateProductID

func (u *OrderProductUpsertBulk) UpdateProductID() *OrderProductUpsertBulk

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*OrderProductUpsertBulk) UpdateUpdatedAt

func (u *OrderProductUpsertBulk) UpdateUpdatedAt() *OrderProductUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type OrderProductUpsertOne

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

OrderProductUpsertOne is the builder for "upsert"-ing

one OrderProduct node.

func (*OrderProductUpsertOne) AddAmount

AddAmount adds v to the "amount" field.

func (*OrderProductUpsertOne) AddPrice

AddPrice adds v to the "price" field.

func (*OrderProductUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*OrderProductUpsertOne) Exec

Exec executes the query.

func (*OrderProductUpsertOne) ExecX

func (u *OrderProductUpsertOne) ExecX(ctx context.Context)

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

func (*OrderProductUpsertOne) ID

func (u *OrderProductUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*OrderProductUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*OrderProductUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.OrderProduct.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*OrderProductUpsertOne) SetAmount

SetAmount sets the "amount" field.

func (*OrderProductUpsertOne) SetOrderID

SetOrderID sets the "order_id" field.

func (*OrderProductUpsertOne) SetPrice

SetPrice sets the "price" field.

func (*OrderProductUpsertOne) SetProductID

SetProductID sets the "product_id" field.

func (*OrderProductUpsertOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*OrderProductUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the OrderProductCreate.OnConflict documentation for more info.

func (*OrderProductUpsertOne) UpdateAmount

func (u *OrderProductUpsertOne) UpdateAmount() *OrderProductUpsertOne

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*OrderProductUpsertOne) UpdateNewValues

func (u *OrderProductUpsertOne) UpdateNewValues() *OrderProductUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.OrderProduct.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*OrderProductUpsertOne) UpdateOrderID

func (u *OrderProductUpsertOne) UpdateOrderID() *OrderProductUpsertOne

UpdateOrderID sets the "order_id" field to the value that was provided on create.

func (*OrderProductUpsertOne) UpdatePrice

func (u *OrderProductUpsertOne) UpdatePrice() *OrderProductUpsertOne

UpdatePrice sets the "price" field to the value that was provided on create.

func (*OrderProductUpsertOne) UpdateProductID

func (u *OrderProductUpsertOne) UpdateProductID() *OrderProductUpsertOne

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*OrderProductUpsertOne) UpdateUpdatedAt

func (u *OrderProductUpsertOne) UpdateUpdatedAt() *OrderProductUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type OrderProducts

type OrderProducts []*OrderProduct

OrderProducts is a parsable slice of OrderProduct.

type OrderQuery

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

OrderQuery is the builder for querying Order entities.

func (*OrderQuery) Aggregate

func (oq *OrderQuery) Aggregate(fns ...AggregateFunc) *OrderSelect

Aggregate returns a OrderSelect configured with the given aggregations.

func (*OrderQuery) All

func (oq *OrderQuery) All(ctx context.Context) ([]*Order, error)

All executes the query and returns a list of Orders.

func (*OrderQuery) AllX

func (oq *OrderQuery) AllX(ctx context.Context) []*Order

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

func (*OrderQuery) Clone

func (oq *OrderQuery) Clone() *OrderQuery

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

func (*OrderQuery) Count

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

Count returns the count of the given query.

func (*OrderQuery) CountX

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

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

func (*OrderQuery) Exist

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

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

func (*OrderQuery) ExistX

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

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

func (*OrderQuery) First

func (oq *OrderQuery) First(ctx context.Context) (*Order, error)

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

func (*OrderQuery) FirstID

func (oq *OrderQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*OrderQuery) FirstIDX

func (oq *OrderQuery) FirstIDX(ctx context.Context) int64

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

func (*OrderQuery) FirstX

func (oq *OrderQuery) FirstX(ctx context.Context) *Order

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

func (*OrderQuery) GroupBy

func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy

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

Example:

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

client.Order.Query().
	GroupBy(order.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*OrderQuery) IDs

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

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

func (*OrderQuery) IDsX

func (oq *OrderQuery) IDsX(ctx context.Context) []int64

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

func (*OrderQuery) Limit

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

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

func (*OrderQuery) Offset

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

Offset to start from.

func (*OrderQuery) Only

func (oq *OrderQuery) Only(ctx context.Context) (*Order, error)

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

func (*OrderQuery) OnlyID

func (oq *OrderQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*OrderQuery) OnlyIDX

func (oq *OrderQuery) OnlyIDX(ctx context.Context) int64

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

func (*OrderQuery) OnlyX

func (oq *OrderQuery) OnlyX(ctx context.Context) *Order

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

func (*OrderQuery) Order

func (oq *OrderQuery) Order(o ...order.OrderOption) *OrderQuery

Order specifies how the records should be ordered.

func (*OrderQuery) QueryOrderProducts

func (oq *OrderQuery) QueryOrderProducts() *OrderProductQuery

QueryOrderProducts chains the current query on the "order_products" edge.

func (*OrderQuery) QueryUsers

func (oq *OrderQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" edge.

func (*OrderQuery) Select

func (oq *OrderQuery) Select(fields ...string) *OrderSelect

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

Example:

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

client.Order.Query().
	Select(order.FieldCreatedAt).
	Scan(ctx, &v)

func (*OrderQuery) Unique

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

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

func (oq *OrderQuery) Where(ps ...predicate.Order) *OrderQuery

Where adds a new predicate for the OrderQuery builder.

func (*OrderQuery) WithOrderProducts

func (oq *OrderQuery) WithOrderProducts(opts ...func(*OrderProductQuery)) *OrderQuery

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

func (*OrderQuery) WithUsers

func (oq *OrderQuery) WithUsers(opts ...func(*UserQuery)) *OrderQuery

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

type OrderSelect

type OrderSelect struct {
	*OrderQuery
	// contains filtered or unexported fields
}

OrderSelect is the builder for selecting fields of Order entities.

func (*OrderSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*OrderSelect) Bool

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

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

func (*OrderSelect) BoolX

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

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

func (*OrderSelect) Bools

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

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

func (*OrderSelect) BoolsX

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

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

func (*OrderSelect) Float64

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

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

func (*OrderSelect) Float64X

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

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

func (*OrderSelect) Float64s

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

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

func (*OrderSelect) Float64sX

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

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

func (*OrderSelect) Int

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

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

func (*OrderSelect) IntX

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

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

func (*OrderSelect) Ints

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

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

func (*OrderSelect) IntsX

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

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

func (*OrderSelect) Scan

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

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

func (*OrderSelect) ScanX

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

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

func (*OrderSelect) String

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

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

func (*OrderSelect) StringX

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

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

func (*OrderSelect) Strings

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

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

func (*OrderSelect) StringsX

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

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

type OrderUpdate

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

OrderUpdate is the builder for updating Order entities.

func (*OrderUpdate) AddOrderProductIDs

func (ou *OrderUpdate) AddOrderProductIDs(ids ...int64) *OrderUpdate

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*OrderUpdate) AddOrderProducts

func (ou *OrderUpdate) AddOrderProducts(o ...*OrderProduct) *OrderUpdate

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*OrderUpdate) ClearOrderProducts

func (ou *OrderUpdate) ClearOrderProducts() *OrderUpdate

ClearOrderProducts clears all "order_products" edges to the OrderProduct entity.

func (*OrderUpdate) ClearUsers

func (ou *OrderUpdate) ClearUsers() *OrderUpdate

ClearUsers clears the "users" edge to the User entity.

func (*OrderUpdate) Exec

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

Exec executes the query.

func (*OrderUpdate) ExecX

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

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

func (*OrderUpdate) Mutation

func (ou *OrderUpdate) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderUpdate) RemoveOrderProductIDs

func (ou *OrderUpdate) RemoveOrderProductIDs(ids ...int64) *OrderUpdate

RemoveOrderProductIDs removes the "order_products" edge to OrderProduct entities by IDs.

func (*OrderUpdate) RemoveOrderProducts

func (ou *OrderUpdate) RemoveOrderProducts(o ...*OrderProduct) *OrderUpdate

RemoveOrderProducts removes "order_products" edges to OrderProduct entities.

func (*OrderUpdate) Save

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

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

func (*OrderUpdate) SaveX

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

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

func (*OrderUpdate) SetNillableStatus

func (ou *OrderUpdate) SetNillableStatus(o *order.Status) *OrderUpdate

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

func (*OrderUpdate) SetNillableUserID

func (ou *OrderUpdate) SetNillableUserID(i *int64) *OrderUpdate

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

func (*OrderUpdate) SetStatus

func (ou *OrderUpdate) SetStatus(o order.Status) *OrderUpdate

SetStatus sets the "status" field.

func (*OrderUpdate) SetUpdatedAt

func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpdate) SetUserID

func (ou *OrderUpdate) SetUserID(i int64) *OrderUpdate

SetUserID sets the "user_id" field.

func (*OrderUpdate) SetUsers

func (ou *OrderUpdate) SetUsers(u *User) *OrderUpdate

SetUsers sets the "users" edge to the User entity.

func (*OrderUpdate) SetUsersID

func (ou *OrderUpdate) SetUsersID(id int64) *OrderUpdate

SetUsersID sets the "users" edge to the User entity by ID.

func (*OrderUpdate) Where

func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate

Where appends a list predicates to the OrderUpdate builder.

type OrderUpdateOne

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

OrderUpdateOne is the builder for updating a single Order entity.

func (*OrderUpdateOne) AddOrderProductIDs

func (ouo *OrderUpdateOne) AddOrderProductIDs(ids ...int64) *OrderUpdateOne

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*OrderUpdateOne) AddOrderProducts

func (ouo *OrderUpdateOne) AddOrderProducts(o ...*OrderProduct) *OrderUpdateOne

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*OrderUpdateOne) ClearOrderProducts

func (ouo *OrderUpdateOne) ClearOrderProducts() *OrderUpdateOne

ClearOrderProducts clears all "order_products" edges to the OrderProduct entity.

func (*OrderUpdateOne) ClearUsers

func (ouo *OrderUpdateOne) ClearUsers() *OrderUpdateOne

ClearUsers clears the "users" edge to the User entity.

func (*OrderUpdateOne) Exec

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

Exec executes the query on the entity.

func (*OrderUpdateOne) ExecX

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

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

func (*OrderUpdateOne) Mutation

func (ouo *OrderUpdateOne) Mutation() *OrderMutation

Mutation returns the OrderMutation object of the builder.

func (*OrderUpdateOne) RemoveOrderProductIDs

func (ouo *OrderUpdateOne) RemoveOrderProductIDs(ids ...int64) *OrderUpdateOne

RemoveOrderProductIDs removes the "order_products" edge to OrderProduct entities by IDs.

func (*OrderUpdateOne) RemoveOrderProducts

func (ouo *OrderUpdateOne) RemoveOrderProducts(o ...*OrderProduct) *OrderUpdateOne

RemoveOrderProducts removes "order_products" edges to OrderProduct entities.

func (*OrderUpdateOne) Save

func (ouo *OrderUpdateOne) Save(ctx context.Context) (*Order, error)

Save executes the query and returns the updated Order entity.

func (*OrderUpdateOne) SaveX

func (ouo *OrderUpdateOne) SaveX(ctx context.Context) *Order

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

func (*OrderUpdateOne) Select

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

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

func (*OrderUpdateOne) SetNillableStatus

func (ouo *OrderUpdateOne) SetNillableStatus(o *order.Status) *OrderUpdateOne

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

func (*OrderUpdateOne) SetNillableUserID

func (ouo *OrderUpdateOne) SetNillableUserID(i *int64) *OrderUpdateOne

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

func (*OrderUpdateOne) SetStatus

func (ouo *OrderUpdateOne) SetStatus(o order.Status) *OrderUpdateOne

SetStatus sets the "status" field.

func (*OrderUpdateOne) SetUpdatedAt

func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *OrderUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpdateOne) SetUserID

func (ouo *OrderUpdateOne) SetUserID(i int64) *OrderUpdateOne

SetUserID sets the "user_id" field.

func (*OrderUpdateOne) SetUsers

func (ouo *OrderUpdateOne) SetUsers(u *User) *OrderUpdateOne

SetUsers sets the "users" edge to the User entity.

func (*OrderUpdateOne) SetUsersID

func (ouo *OrderUpdateOne) SetUsersID(id int64) *OrderUpdateOne

SetUsersID sets the "users" edge to the User entity by ID.

func (*OrderUpdateOne) Where

func (ouo *OrderUpdateOne) Where(ps ...predicate.Order) *OrderUpdateOne

Where appends a list predicates to the OrderUpdate builder.

type OrderUpsert

type OrderUpsert struct {
	*sql.UpdateSet
}

OrderUpsert is the "OnConflict" setter.

func (*OrderUpsert) SetStatus

func (u *OrderUpsert) SetStatus(v order.Status) *OrderUpsert

SetStatus sets the "status" field.

func (*OrderUpsert) SetUpdatedAt

func (u *OrderUpsert) SetUpdatedAt(v time.Time) *OrderUpsert

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpsert) SetUserID

func (u *OrderUpsert) SetUserID(v int64) *OrderUpsert

SetUserID sets the "user_id" field.

func (*OrderUpsert) UpdateStatus

func (u *OrderUpsert) UpdateStatus() *OrderUpsert

UpdateStatus sets the "status" field to the value that was provided on create.

func (*OrderUpsert) UpdateUpdatedAt

func (u *OrderUpsert) UpdateUpdatedAt() *OrderUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*OrderUpsert) UpdateUserID

func (u *OrderUpsert) UpdateUserID() *OrderUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type OrderUpsertBulk

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

OrderUpsertBulk is the builder for "upsert"-ing a bulk of Order nodes.

func (*OrderUpsertBulk) DoNothing

func (u *OrderUpsertBulk) DoNothing() *OrderUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*OrderUpsertBulk) Exec

func (u *OrderUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderUpsertBulk) ExecX

func (u *OrderUpsertBulk) ExecX(ctx context.Context)

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

func (*OrderUpsertBulk) Ignore

func (u *OrderUpsertBulk) Ignore() *OrderUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Order.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*OrderUpsertBulk) SetStatus

func (u *OrderUpsertBulk) SetStatus(v order.Status) *OrderUpsertBulk

SetStatus sets the "status" field.

func (*OrderUpsertBulk) SetUpdatedAt

func (u *OrderUpsertBulk) SetUpdatedAt(v time.Time) *OrderUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpsertBulk) SetUserID

func (u *OrderUpsertBulk) SetUserID(v int64) *OrderUpsertBulk

SetUserID sets the "user_id" field.

func (*OrderUpsertBulk) Update

func (u *OrderUpsertBulk) Update(set func(*OrderUpsert)) *OrderUpsertBulk

Update allows overriding fields `UPDATE` values. See the OrderCreateBulk.OnConflict documentation for more info.

func (*OrderUpsertBulk) UpdateNewValues

func (u *OrderUpsertBulk) UpdateNewValues() *OrderUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Order.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*OrderUpsertBulk) UpdateStatus

func (u *OrderUpsertBulk) UpdateStatus() *OrderUpsertBulk

UpdateStatus sets the "status" field to the value that was provided on create.

func (*OrderUpsertBulk) UpdateUpdatedAt

func (u *OrderUpsertBulk) UpdateUpdatedAt() *OrderUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*OrderUpsertBulk) UpdateUserID

func (u *OrderUpsertBulk) UpdateUserID() *OrderUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type OrderUpsertOne

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

OrderUpsertOne is the builder for "upsert"-ing

one Order node.

func (*OrderUpsertOne) DoNothing

func (u *OrderUpsertOne) DoNothing() *OrderUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*OrderUpsertOne) Exec

func (u *OrderUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*OrderUpsertOne) ExecX

func (u *OrderUpsertOne) ExecX(ctx context.Context)

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

func (*OrderUpsertOne) ID

func (u *OrderUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*OrderUpsertOne) IDX

func (u *OrderUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*OrderUpsertOne) Ignore

func (u *OrderUpsertOne) Ignore() *OrderUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Order.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*OrderUpsertOne) SetStatus

func (u *OrderUpsertOne) SetStatus(v order.Status) *OrderUpsertOne

SetStatus sets the "status" field.

func (*OrderUpsertOne) SetUpdatedAt

func (u *OrderUpsertOne) SetUpdatedAt(v time.Time) *OrderUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*OrderUpsertOne) SetUserID

func (u *OrderUpsertOne) SetUserID(v int64) *OrderUpsertOne

SetUserID sets the "user_id" field.

func (*OrderUpsertOne) Update

func (u *OrderUpsertOne) Update(set func(*OrderUpsert)) *OrderUpsertOne

Update allows overriding fields `UPDATE` values. See the OrderCreate.OnConflict documentation for more info.

func (*OrderUpsertOne) UpdateNewValues

func (u *OrderUpsertOne) UpdateNewValues() *OrderUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Order.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*OrderUpsertOne) UpdateStatus

func (u *OrderUpsertOne) UpdateStatus() *OrderUpsertOne

UpdateStatus sets the "status" field to the value that was provided on create.

func (*OrderUpsertOne) UpdateUpdatedAt

func (u *OrderUpsertOne) UpdateUpdatedAt() *OrderUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*OrderUpsertOne) UpdateUserID

func (u *OrderUpsertOne) UpdateUserID() *OrderUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type Orders

type Orders []*Order

Orders is a parsable slice of Order.

type Policy

type Policy = ent.Policy

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

type Product

type Product struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// CategoryID holds the value of the "category_id" field.
	CategoryID int64 `json:"category_id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Amount holds the value of the "amount" field.
	Amount int64 `json:"amount,omitempty"`
	// Price holds the value of the "price" field.
	Price int64 `json:"price,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProductQuery when eager-loading is set.
	Edges ProductEdges `json:"edges"`
	// contains filtered or unexported fields
}

Product is the model entity for the Product schema.

func (*Product) QueryCarts

func (pr *Product) QueryCarts() *CartQuery

QueryCarts queries the "carts" edge of the Product entity.

func (*Product) QueryCategories

func (pr *Product) QueryCategories() *CategoryQuery

QueryCategories queries the "categories" edge of the Product entity.

func (*Product) QueryOrderProducts

func (pr *Product) QueryOrderProducts() *OrderProductQuery

QueryOrderProducts queries the "order_products" edge of the Product entity.

func (*Product) QueryProductImages

func (pr *Product) QueryProductImages() *ProductImageQuery

QueryProductImages queries the "product_images" edge of the Product entity.

func (*Product) String

func (pr *Product) String() string

String implements the fmt.Stringer.

func (*Product) Unwrap

func (pr *Product) Unwrap() *Product

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

func (pr *Product) Update() *ProductUpdateOne

Update returns a builder for updating this Product. Note that you need to call Product.Unwrap() before calling this method if this Product was returned from a transaction, and the transaction was committed or rolled back.

func (*Product) Value

func (pr *Product) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Product. This includes values selected through modifiers, order, etc.

type ProductClient

type ProductClient struct {
	// contains filtered or unexported fields
}

ProductClient is a client for the Product schema.

func NewProductClient

func NewProductClient(c config) *ProductClient

NewProductClient returns a client for the Product from the given config.

func (*ProductClient) Create

func (c *ProductClient) Create() *ProductCreate

Create returns a builder for creating a Product entity.

func (*ProductClient) CreateBulk

func (c *ProductClient) CreateBulk(builders ...*ProductCreate) *ProductCreateBulk

CreateBulk returns a builder for creating a bulk of Product entities.

func (*ProductClient) Delete

func (c *ProductClient) Delete() *ProductDelete

Delete returns a delete builder for Product.

func (*ProductClient) DeleteOne

func (c *ProductClient) DeleteOne(pr *Product) *ProductDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProductClient) DeleteOneID

func (c *ProductClient) DeleteOneID(id int64) *ProductDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*ProductClient) Get

func (c *ProductClient) Get(ctx context.Context, id int64) (*Product, error)

Get returns a Product entity by its id.

func (*ProductClient) GetX

func (c *ProductClient) GetX(ctx context.Context, id int64) *Product

GetX is like Get, but panics if an error occurs.

func (*ProductClient) Hooks

func (c *ProductClient) Hooks() []Hook

Hooks returns the client hooks.

func (*ProductClient) Intercept

func (c *ProductClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `product.Intercept(f(g(h())))`.

func (*ProductClient) Interceptors

func (c *ProductClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*ProductClient) MapCreateBulk

func (c *ProductClient) MapCreateBulk(slice any, setFunc func(*ProductCreate, int)) *ProductCreateBulk

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 (*ProductClient) Query

func (c *ProductClient) Query() *ProductQuery

Query returns a query builder for Product.

func (*ProductClient) QueryCarts

func (c *ProductClient) QueryCarts(pr *Product) *CartQuery

QueryCarts queries the carts edge of a Product.

func (*ProductClient) QueryCategories

func (c *ProductClient) QueryCategories(pr *Product) *CategoryQuery

QueryCategories queries the categories edge of a Product.

func (*ProductClient) QueryOrderProducts

func (c *ProductClient) QueryOrderProducts(pr *Product) *OrderProductQuery

QueryOrderProducts queries the order_products edge of a Product.

func (*ProductClient) QueryProductImages

func (c *ProductClient) QueryProductImages(pr *Product) *ProductImageQuery

QueryProductImages queries the product_images edge of a Product.

func (*ProductClient) Update

func (c *ProductClient) Update() *ProductUpdate

Update returns an update builder for Product.

func (*ProductClient) UpdateOne

func (c *ProductClient) UpdateOne(pr *Product) *ProductUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProductClient) UpdateOneID

func (c *ProductClient) UpdateOneID(id int64) *ProductUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProductClient) Use

func (c *ProductClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `product.Hooks(f(g(h())))`.

type ProductCreate

type ProductCreate struct {
	// contains filtered or unexported fields
}

ProductCreate is the builder for creating a Product entity.

func (*ProductCreate) AddCartIDs

func (pc *ProductCreate) AddCartIDs(ids ...int64) *ProductCreate

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*ProductCreate) AddCarts

func (pc *ProductCreate) AddCarts(c ...*Cart) *ProductCreate

AddCarts adds the "carts" edges to the Cart entity.

func (*ProductCreate) AddOrderProductIDs

func (pc *ProductCreate) AddOrderProductIDs(ids ...int64) *ProductCreate

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*ProductCreate) AddOrderProducts

func (pc *ProductCreate) AddOrderProducts(o ...*OrderProduct) *ProductCreate

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*ProductCreate) AddProductImageIDs

func (pc *ProductCreate) AddProductImageIDs(ids ...int64) *ProductCreate

AddProductImageIDs adds the "product_images" edge to the ProductImage entity by IDs.

func (*ProductCreate) AddProductImages

func (pc *ProductCreate) AddProductImages(p ...*ProductImage) *ProductCreate

AddProductImages adds the "product_images" edges to the ProductImage entity.

func (*ProductCreate) Exec

func (pc *ProductCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductCreate) ExecX

func (pc *ProductCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductCreate) Mutation

func (pc *ProductCreate) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductCreate) OnConflict

func (pc *ProductCreate) OnConflict(opts ...sql.ConflictOption) *ProductUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Product.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ProductUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ProductCreate) OnConflictColumns

func (pc *ProductCreate) OnConflictColumns(columns ...string) *ProductUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Product.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ProductCreate) Save

func (pc *ProductCreate) Save(ctx context.Context) (*Product, error)

Save creates the Product in the database.

func (*ProductCreate) SaveX

func (pc *ProductCreate) SaveX(ctx context.Context) *Product

SaveX calls Save and panics if Save returns an error.

func (*ProductCreate) SetAmount

func (pc *ProductCreate) SetAmount(i int64) *ProductCreate

SetAmount sets the "amount" field.

func (*ProductCreate) SetCategories

func (pc *ProductCreate) SetCategories(c *Category) *ProductCreate

SetCategories sets the "categories" edge to the Category entity.

func (*ProductCreate) SetCategoriesID

func (pc *ProductCreate) SetCategoriesID(id int64) *ProductCreate

SetCategoriesID sets the "categories" edge to the Category entity by ID.

func (*ProductCreate) SetCategoryID

func (pc *ProductCreate) SetCategoryID(i int64) *ProductCreate

SetCategoryID sets the "category_id" field.

func (*ProductCreate) SetCreatedAt

func (pc *ProductCreate) SetCreatedAt(t time.Time) *ProductCreate

SetCreatedAt sets the "created_at" field.

func (*ProductCreate) SetDescription

func (pc *ProductCreate) SetDescription(s string) *ProductCreate

SetDescription sets the "description" field.

func (*ProductCreate) SetName

func (pc *ProductCreate) SetName(s string) *ProductCreate

SetName sets the "name" field.

func (*ProductCreate) SetNillableAmount

func (pc *ProductCreate) SetNillableAmount(i *int64) *ProductCreate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*ProductCreate) SetNillableCreatedAt

func (pc *ProductCreate) SetNillableCreatedAt(t *time.Time) *ProductCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ProductCreate) SetNillableDescription

func (pc *ProductCreate) SetNillableDescription(s *string) *ProductCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProductCreate) SetNillableUpdatedAt

func (pc *ProductCreate) SetNillableUpdatedAt(t *time.Time) *ProductCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*ProductCreate) SetPrice

func (pc *ProductCreate) SetPrice(i int64) *ProductCreate

SetPrice sets the "price" field.

func (*ProductCreate) SetUpdatedAt

func (pc *ProductCreate) SetUpdatedAt(t time.Time) *ProductCreate

SetUpdatedAt sets the "updated_at" field.

type ProductCreateBulk

type ProductCreateBulk struct {
	// contains filtered or unexported fields
}

ProductCreateBulk is the builder for creating many Product entities in bulk.

func (*ProductCreateBulk) Exec

func (pcb *ProductCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductCreateBulk) ExecX

func (pcb *ProductCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductCreateBulk) OnConflict

func (pcb *ProductCreateBulk) OnConflict(opts ...sql.ConflictOption) *ProductUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Product.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ProductUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ProductCreateBulk) OnConflictColumns

func (pcb *ProductCreateBulk) OnConflictColumns(columns ...string) *ProductUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Product.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ProductCreateBulk) Save

func (pcb *ProductCreateBulk) Save(ctx context.Context) ([]*Product, error)

Save creates the Product entities in the database.

func (*ProductCreateBulk) SaveX

func (pcb *ProductCreateBulk) SaveX(ctx context.Context) []*Product

SaveX is like Save, but panics if an error occurs.

type ProductDelete

type ProductDelete struct {
	// contains filtered or unexported fields
}

ProductDelete is the builder for deleting a Product entity.

func (*ProductDelete) Exec

func (pd *ProductDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*ProductDelete) ExecX

func (pd *ProductDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*ProductDelete) Where

func (pd *ProductDelete) Where(ps ...predicate.Product) *ProductDelete

Where appends a list predicates to the ProductDelete builder.

type ProductDeleteOne

type ProductDeleteOne struct {
	// contains filtered or unexported fields
}

ProductDeleteOne is the builder for deleting a single Product entity.

func (*ProductDeleteOne) Exec

func (pdo *ProductDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ProductDeleteOne) ExecX

func (pdo *ProductDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductDeleteOne) Where

Where appends a list predicates to the ProductDelete builder.

type ProductEdges

type ProductEdges struct {
	// Categories holds the value of the categories edge.
	Categories *Category `json:"categories,omitempty"`
	// Carts holds the value of the carts edge.
	Carts []*Cart `json:"carts,omitempty"`
	// ProductImages holds the value of the product_images edge.
	ProductImages []*ProductImage `json:"product_images,omitempty"`
	// OrderProducts holds the value of the order_products edge.
	OrderProducts []*OrderProduct `json:"order_products,omitempty"`
	// contains filtered or unexported fields
}

ProductEdges holds the relations/edges for other nodes in the graph.

func (ProductEdges) CartsOrErr

func (e ProductEdges) CartsOrErr() ([]*Cart, error)

CartsOrErr returns the Carts value or an error if the edge was not loaded in eager-loading.

func (ProductEdges) CategoriesOrErr

func (e ProductEdges) CategoriesOrErr() (*Category, error)

CategoriesOrErr returns the Categories value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (ProductEdges) OrderProductsOrErr

func (e ProductEdges) OrderProductsOrErr() ([]*OrderProduct, error)

OrderProductsOrErr returns the OrderProducts value or an error if the edge was not loaded in eager-loading.

func (ProductEdges) ProductImagesOrErr

func (e ProductEdges) ProductImagesOrErr() ([]*ProductImage, error)

ProductImagesOrErr returns the ProductImages value or an error if the edge was not loaded in eager-loading.

type ProductGroupBy

type ProductGroupBy struct {
	// contains filtered or unexported fields
}

ProductGroupBy is the group-by builder for Product entities.

func (*ProductGroupBy) Aggregate

func (pgb *ProductGroupBy) Aggregate(fns ...AggregateFunc) *ProductGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*ProductGroupBy) Bool

func (s *ProductGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) BoolX

func (s *ProductGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ProductGroupBy) Bools

func (s *ProductGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) BoolsX

func (s *ProductGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ProductGroupBy) Float64

func (s *ProductGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) Float64X

func (s *ProductGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ProductGroupBy) Float64s

func (s *ProductGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) Float64sX

func (s *ProductGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ProductGroupBy) Int

func (s *ProductGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) IntX

func (s *ProductGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ProductGroupBy) Ints

func (s *ProductGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) IntsX

func (s *ProductGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ProductGroupBy) Scan

func (pgb *ProductGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductGroupBy) ScanX

func (s *ProductGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductGroupBy) String

func (s *ProductGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) StringX

func (s *ProductGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductGroupBy) Strings

func (s *ProductGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductGroupBy) StringsX

func (s *ProductGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductImage

type ProductImage struct {

	// ID of the ent.
	ID int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// ProductID holds the value of the "product_id" field.
	ProductID int64 `json:"product_id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProductImageQuery when eager-loading is set.
	Edges ProductImageEdges `json:"edges"`
	// contains filtered or unexported fields
}

ProductImage is the model entity for the ProductImage schema.

func (*ProductImage) QueryProducts

func (pi *ProductImage) QueryProducts() *ProductQuery

QueryProducts queries the "products" edge of the ProductImage entity.

func (*ProductImage) String

func (pi *ProductImage) String() string

String implements the fmt.Stringer.

func (*ProductImage) Unwrap

func (pi *ProductImage) Unwrap() *ProductImage

Unwrap unwraps the ProductImage 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 (*ProductImage) Update

func (pi *ProductImage) Update() *ProductImageUpdateOne

Update returns a builder for updating this ProductImage. Note that you need to call ProductImage.Unwrap() before calling this method if this ProductImage was returned from a transaction, and the transaction was committed or rolled back.

func (*ProductImage) Value

func (pi *ProductImage) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the ProductImage. This includes values selected through modifiers, order, etc.

type ProductImageClient

type ProductImageClient struct {
	// contains filtered or unexported fields
}

ProductImageClient is a client for the ProductImage schema.

func NewProductImageClient

func NewProductImageClient(c config) *ProductImageClient

NewProductImageClient returns a client for the ProductImage from the given config.

func (*ProductImageClient) Create

Create returns a builder for creating a ProductImage entity.

func (*ProductImageClient) CreateBulk

func (c *ProductImageClient) CreateBulk(builders ...*ProductImageCreate) *ProductImageCreateBulk

CreateBulk returns a builder for creating a bulk of ProductImage entities.

func (*ProductImageClient) Delete

Delete returns a delete builder for ProductImage.

func (*ProductImageClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProductImageClient) DeleteOneID

func (c *ProductImageClient) DeleteOneID(id int64) *ProductImageDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*ProductImageClient) Get

Get returns a ProductImage entity by its id.

func (*ProductImageClient) GetX

GetX is like Get, but panics if an error occurs.

func (*ProductImageClient) Hooks

func (c *ProductImageClient) Hooks() []Hook

Hooks returns the client hooks.

func (*ProductImageClient) Intercept

func (c *ProductImageClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `productimage.Intercept(f(g(h())))`.

func (*ProductImageClient) Interceptors

func (c *ProductImageClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*ProductImageClient) MapCreateBulk

func (c *ProductImageClient) MapCreateBulk(slice any, setFunc func(*ProductImageCreate, int)) *ProductImageCreateBulk

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 (*ProductImageClient) Query

Query returns a query builder for ProductImage.

func (*ProductImageClient) QueryProducts

func (c *ProductImageClient) QueryProducts(pi *ProductImage) *ProductQuery

QueryProducts queries the products edge of a ProductImage.

func (*ProductImageClient) Update

Update returns an update builder for ProductImage.

func (*ProductImageClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProductImageClient) UpdateOneID

func (c *ProductImageClient) UpdateOneID(id int64) *ProductImageUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProductImageClient) Use

func (c *ProductImageClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `productimage.Hooks(f(g(h())))`.

type ProductImageCreate

type ProductImageCreate struct {
	// contains filtered or unexported fields
}

ProductImageCreate is the builder for creating a ProductImage entity.

func (*ProductImageCreate) Exec

func (pic *ProductImageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductImageCreate) ExecX

func (pic *ProductImageCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageCreate) Mutation

func (pic *ProductImageCreate) Mutation() *ProductImageMutation

Mutation returns the ProductImageMutation object of the builder.

func (*ProductImageCreate) OnConflict

func (pic *ProductImageCreate) OnConflict(opts ...sql.ConflictOption) *ProductImageUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.ProductImage.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ProductImageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ProductImageCreate) OnConflictColumns

func (pic *ProductImageCreate) OnConflictColumns(columns ...string) *ProductImageUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.ProductImage.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ProductImageCreate) Save

Save creates the ProductImage in the database.

func (*ProductImageCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*ProductImageCreate) SetCreatedAt

func (pic *ProductImageCreate) SetCreatedAt(t time.Time) *ProductImageCreate

SetCreatedAt sets the "created_at" field.

func (*ProductImageCreate) SetName

func (pic *ProductImageCreate) SetName(s string) *ProductImageCreate

SetName sets the "name" field.

func (*ProductImageCreate) SetNillableCreatedAt

func (pic *ProductImageCreate) SetNillableCreatedAt(t *time.Time) *ProductImageCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*ProductImageCreate) SetNillableUpdatedAt

func (pic *ProductImageCreate) SetNillableUpdatedAt(t *time.Time) *ProductImageCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*ProductImageCreate) SetProductID

func (pic *ProductImageCreate) SetProductID(i int64) *ProductImageCreate

SetProductID sets the "product_id" field.

func (*ProductImageCreate) SetProducts

func (pic *ProductImageCreate) SetProducts(p *Product) *ProductImageCreate

SetProducts sets the "products" edge to the Product entity.

func (*ProductImageCreate) SetProductsID

func (pic *ProductImageCreate) SetProductsID(id int64) *ProductImageCreate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*ProductImageCreate) SetUpdatedAt

func (pic *ProductImageCreate) SetUpdatedAt(t time.Time) *ProductImageCreate

SetUpdatedAt sets the "updated_at" field.

type ProductImageCreateBulk

type ProductImageCreateBulk struct {
	// contains filtered or unexported fields
}

ProductImageCreateBulk is the builder for creating many ProductImage entities in bulk.

func (*ProductImageCreateBulk) Exec

func (picb *ProductImageCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductImageCreateBulk) ExecX

func (picb *ProductImageCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.ProductImage.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.ProductImageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*ProductImageCreateBulk) OnConflictColumns

func (picb *ProductImageCreateBulk) OnConflictColumns(columns ...string) *ProductImageUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.ProductImage.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*ProductImageCreateBulk) Save

Save creates the ProductImage entities in the database.

func (*ProductImageCreateBulk) SaveX

func (picb *ProductImageCreateBulk) SaveX(ctx context.Context) []*ProductImage

SaveX is like Save, but panics if an error occurs.

type ProductImageDelete

type ProductImageDelete struct {
	// contains filtered or unexported fields
}

ProductImageDelete is the builder for deleting a ProductImage entity.

func (*ProductImageDelete) Exec

func (pid *ProductImageDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*ProductImageDelete) ExecX

func (pid *ProductImageDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageDelete) Where

Where appends a list predicates to the ProductImageDelete builder.

type ProductImageDeleteOne

type ProductImageDeleteOne struct {
	// contains filtered or unexported fields
}

ProductImageDeleteOne is the builder for deleting a single ProductImage entity.

func (*ProductImageDeleteOne) Exec

func (pido *ProductImageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ProductImageDeleteOne) ExecX

func (pido *ProductImageDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageDeleteOne) Where

Where appends a list predicates to the ProductImageDelete builder.

type ProductImageEdges

type ProductImageEdges struct {
	// Products holds the value of the products edge.
	Products *Product `json:"products,omitempty"`
	// contains filtered or unexported fields
}

ProductImageEdges holds the relations/edges for other nodes in the graph.

func (ProductImageEdges) ProductsOrErr

func (e ProductImageEdges) ProductsOrErr() (*Product, error)

ProductsOrErr returns the Products value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type ProductImageGroupBy

type ProductImageGroupBy struct {
	// contains filtered or unexported fields
}

ProductImageGroupBy is the group-by builder for ProductImage entities.

func (*ProductImageGroupBy) Aggregate

func (pigb *ProductImageGroupBy) Aggregate(fns ...AggregateFunc) *ProductImageGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*ProductImageGroupBy) Bool

func (s *ProductImageGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) BoolX

func (s *ProductImageGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ProductImageGroupBy) Bools

func (s *ProductImageGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) BoolsX

func (s *ProductImageGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ProductImageGroupBy) Float64

func (s *ProductImageGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) Float64X

func (s *ProductImageGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ProductImageGroupBy) Float64s

func (s *ProductImageGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) Float64sX

func (s *ProductImageGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ProductImageGroupBy) Int

func (s *ProductImageGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) IntX

func (s *ProductImageGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ProductImageGroupBy) Ints

func (s *ProductImageGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) IntsX

func (s *ProductImageGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ProductImageGroupBy) Scan

func (pigb *ProductImageGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductImageGroupBy) ScanX

func (s *ProductImageGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductImageGroupBy) String

func (s *ProductImageGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) StringX

func (s *ProductImageGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductImageGroupBy) Strings

func (s *ProductImageGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductImageGroupBy) StringsX

func (s *ProductImageGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductImageMutation

type ProductImageMutation struct {
	// contains filtered or unexported fields
}

ProductImageMutation represents an operation that mutates the ProductImage nodes in the graph.

func (*ProductImageMutation) AddField

func (m *ProductImageMutation) 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 (*ProductImageMutation) AddedEdges

func (m *ProductImageMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*ProductImageMutation) AddedField

func (m *ProductImageMutation) 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 (*ProductImageMutation) AddedFields

func (m *ProductImageMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*ProductImageMutation) AddedIDs

func (m *ProductImageMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ProductImageMutation) ClearEdge

func (m *ProductImageMutation) 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 (*ProductImageMutation) ClearField

func (m *ProductImageMutation) 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 (*ProductImageMutation) ClearProducts

func (m *ProductImageMutation) ClearProducts()

ClearProducts clears the "products" edge to the Product entity.

func (*ProductImageMutation) ClearedEdges

func (m *ProductImageMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*ProductImageMutation) ClearedFields

func (m *ProductImageMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (ProductImageMutation) Client

func (m ProductImageMutation) 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 (*ProductImageMutation) CreatedAt

func (m *ProductImageMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ProductImageMutation) EdgeCleared

func (m *ProductImageMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ProductImageMutation) Field

func (m *ProductImageMutation) 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 (*ProductImageMutation) FieldCleared

func (m *ProductImageMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ProductImageMutation) Fields

func (m *ProductImageMutation) 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 (*ProductImageMutation) ID

func (m *ProductImageMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ProductImageMutation) IDs

func (m *ProductImageMutation) IDs(ctx context.Context) ([]int64, 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 (*ProductImageMutation) Name

func (m *ProductImageMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ProductImageMutation) OldCreatedAt

func (m *ProductImageMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the ProductImage entity. If the ProductImage 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 (*ProductImageMutation) OldField

func (m *ProductImageMutation) 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 (*ProductImageMutation) OldName

func (m *ProductImageMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the ProductImage entity. If the ProductImage 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 (*ProductImageMutation) OldProductID

func (m *ProductImageMutation) OldProductID(ctx context.Context) (v int64, err error)

OldProductID returns the old "product_id" field's value of the ProductImage entity. If the ProductImage 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 (*ProductImageMutation) OldUpdatedAt

func (m *ProductImageMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the ProductImage entity. If the ProductImage 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 (*ProductImageMutation) Op

func (m *ProductImageMutation) Op() Op

Op returns the operation name.

func (*ProductImageMutation) ProductID

func (m *ProductImageMutation) ProductID() (r int64, exists bool)

ProductID returns the value of the "product_id" field in the mutation.

func (*ProductImageMutation) ProductsCleared

func (m *ProductImageMutation) ProductsCleared() bool

ProductsCleared reports if the "products" edge to the Product entity was cleared.

func (*ProductImageMutation) ProductsID

func (m *ProductImageMutation) ProductsID() (id int64, exists bool)

ProductsID returns the "products" edge ID in the mutation.

func (*ProductImageMutation) ProductsIDs

func (m *ProductImageMutation) ProductsIDs() (ids []int64)

ProductsIDs returns the "products" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ProductsID instead. It exists only for internal usage by the builders.

func (*ProductImageMutation) RemovedEdges

func (m *ProductImageMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*ProductImageMutation) RemovedIDs

func (m *ProductImageMutation) 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 (*ProductImageMutation) ResetCreatedAt

func (m *ProductImageMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ProductImageMutation) ResetEdge

func (m *ProductImageMutation) 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 (*ProductImageMutation) ResetField

func (m *ProductImageMutation) 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 (*ProductImageMutation) ResetName

func (m *ProductImageMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ProductImageMutation) ResetProductID

func (m *ProductImageMutation) ResetProductID()

ResetProductID resets all changes to the "product_id" field.

func (*ProductImageMutation) ResetProducts

func (m *ProductImageMutation) ResetProducts()

ResetProducts resets all changes to the "products" edge.

func (*ProductImageMutation) ResetUpdatedAt

func (m *ProductImageMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ProductImageMutation) SetCreatedAt

func (m *ProductImageMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ProductImageMutation) SetField

func (m *ProductImageMutation) 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 (*ProductImageMutation) SetName

func (m *ProductImageMutation) SetName(s string)

SetName sets the "name" field.

func (*ProductImageMutation) SetOp

func (m *ProductImageMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ProductImageMutation) SetProductID

func (m *ProductImageMutation) SetProductID(i int64)

SetProductID sets the "product_id" field.

func (*ProductImageMutation) SetProductsID

func (m *ProductImageMutation) SetProductsID(id int64)

SetProductsID sets the "products" edge to the Product entity by id.

func (*ProductImageMutation) SetUpdatedAt

func (m *ProductImageMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (ProductImageMutation) Tx

func (m ProductImageMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ProductImageMutation) Type

func (m *ProductImageMutation) Type() string

Type returns the node type of this mutation (ProductImage).

func (*ProductImageMutation) UpdatedAt

func (m *ProductImageMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*ProductImageMutation) Where

Where appends a list predicates to the ProductImageMutation builder.

func (*ProductImageMutation) WhereP

func (m *ProductImageMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ProductImageMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ProductImageQuery

type ProductImageQuery struct {
	// contains filtered or unexported fields
}

ProductImageQuery is the builder for querying ProductImage entities.

func (*ProductImageQuery) Aggregate

func (piq *ProductImageQuery) Aggregate(fns ...AggregateFunc) *ProductImageSelect

Aggregate returns a ProductImageSelect configured with the given aggregations.

func (*ProductImageQuery) All

func (piq *ProductImageQuery) All(ctx context.Context) ([]*ProductImage, error)

All executes the query and returns a list of ProductImages.

func (*ProductImageQuery) AllX

func (piq *ProductImageQuery) AllX(ctx context.Context) []*ProductImage

AllX is like All, but panics if an error occurs.

func (*ProductImageQuery) Clone

func (piq *ProductImageQuery) Clone() *ProductImageQuery

Clone returns a duplicate of the ProductImageQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ProductImageQuery) Count

func (piq *ProductImageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProductImageQuery) CountX

func (piq *ProductImageQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ProductImageQuery) Exist

func (piq *ProductImageQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ProductImageQuery) ExistX

func (piq *ProductImageQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ProductImageQuery) First

func (piq *ProductImageQuery) First(ctx context.Context) (*ProductImage, error)

First returns the first ProductImage entity from the query. Returns a *NotFoundError when no ProductImage was found.

func (*ProductImageQuery) FirstID

func (piq *ProductImageQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first ProductImage ID from the query. Returns a *NotFoundError when no ProductImage ID was found.

func (*ProductImageQuery) FirstIDX

func (piq *ProductImageQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*ProductImageQuery) FirstX

func (piq *ProductImageQuery) FirstX(ctx context.Context) *ProductImage

FirstX is like First, but panics if an error occurs.

func (*ProductImageQuery) GroupBy

func (piq *ProductImageQuery) GroupBy(field string, fields ...string) *ProductImageGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.ProductImage.Query().
	GroupBy(productimage.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProductImageQuery) IDs

func (piq *ProductImageQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of ProductImage IDs.

func (*ProductImageQuery) IDsX

func (piq *ProductImageQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*ProductImageQuery) Limit

func (piq *ProductImageQuery) Limit(limit int) *ProductImageQuery

Limit the number of records to be returned by this query.

func (*ProductImageQuery) Offset

func (piq *ProductImageQuery) Offset(offset int) *ProductImageQuery

Offset to start from.

func (*ProductImageQuery) Only

func (piq *ProductImageQuery) Only(ctx context.Context) (*ProductImage, error)

Only returns a single ProductImage entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one ProductImage entity is found. Returns a *NotFoundError when no ProductImage entities are found.

func (*ProductImageQuery) OnlyID

func (piq *ProductImageQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only ProductImage ID in the query. Returns a *NotSingularError when more than one ProductImage ID is found. Returns a *NotFoundError when no entities are found.

func (*ProductImageQuery) OnlyIDX

func (piq *ProductImageQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ProductImageQuery) OnlyX

func (piq *ProductImageQuery) OnlyX(ctx context.Context) *ProductImage

OnlyX is like Only, but panics if an error occurs.

func (*ProductImageQuery) Order

Order specifies how the records should be ordered.

func (*ProductImageQuery) QueryProducts

func (piq *ProductImageQuery) QueryProducts() *ProductQuery

QueryProducts chains the current query on the "products" edge.

func (*ProductImageQuery) Select

func (piq *ProductImageQuery) Select(fields ...string) *ProductImageSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.ProductImage.Query().
	Select(productimage.FieldCreatedAt).
	Scan(ctx, &v)

func (*ProductImageQuery) Unique

func (piq *ProductImageQuery) Unique(unique bool) *ProductImageQuery

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 (*ProductImageQuery) Where

Where adds a new predicate for the ProductImageQuery builder.

func (*ProductImageQuery) WithProducts

func (piq *ProductImageQuery) WithProducts(opts ...func(*ProductQuery)) *ProductImageQuery

WithProducts tells the query-builder to eager-load the nodes that are connected to the "products" edge. The optional arguments are used to configure the query builder of the edge.

type ProductImageSelect

type ProductImageSelect struct {
	*ProductImageQuery
	// contains filtered or unexported fields
}

ProductImageSelect is the builder for selecting fields of ProductImage entities.

func (*ProductImageSelect) Aggregate

func (pis *ProductImageSelect) Aggregate(fns ...AggregateFunc) *ProductImageSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ProductImageSelect) Bool

func (s *ProductImageSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) BoolX

func (s *ProductImageSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ProductImageSelect) Bools

func (s *ProductImageSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) BoolsX

func (s *ProductImageSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ProductImageSelect) Float64

func (s *ProductImageSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) Float64X

func (s *ProductImageSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ProductImageSelect) Float64s

func (s *ProductImageSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) Float64sX

func (s *ProductImageSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ProductImageSelect) Int

func (s *ProductImageSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) IntX

func (s *ProductImageSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ProductImageSelect) Ints

func (s *ProductImageSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) IntsX

func (s *ProductImageSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ProductImageSelect) Scan

func (pis *ProductImageSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductImageSelect) ScanX

func (s *ProductImageSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductImageSelect) String

func (s *ProductImageSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) StringX

func (s *ProductImageSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductImageSelect) Strings

func (s *ProductImageSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductImageSelect) StringsX

func (s *ProductImageSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductImageUpdate

type ProductImageUpdate struct {
	// contains filtered or unexported fields
}

ProductImageUpdate is the builder for updating ProductImage entities.

func (*ProductImageUpdate) ClearProducts

func (piu *ProductImageUpdate) ClearProducts() *ProductImageUpdate

ClearProducts clears the "products" edge to the Product entity.

func (*ProductImageUpdate) Exec

func (piu *ProductImageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductImageUpdate) ExecX

func (piu *ProductImageUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageUpdate) Mutation

func (piu *ProductImageUpdate) Mutation() *ProductImageMutation

Mutation returns the ProductImageMutation object of the builder.

func (*ProductImageUpdate) Save

func (piu *ProductImageUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ProductImageUpdate) SaveX

func (piu *ProductImageUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ProductImageUpdate) SetName

func (piu *ProductImageUpdate) SetName(s string) *ProductImageUpdate

SetName sets the "name" field.

func (*ProductImageUpdate) SetNillableName

func (piu *ProductImageUpdate) SetNillableName(s *string) *ProductImageUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductImageUpdate) SetNillableProductID

func (piu *ProductImageUpdate) SetNillableProductID(i *int64) *ProductImageUpdate

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*ProductImageUpdate) SetProductID

func (piu *ProductImageUpdate) SetProductID(i int64) *ProductImageUpdate

SetProductID sets the "product_id" field.

func (*ProductImageUpdate) SetProducts

func (piu *ProductImageUpdate) SetProducts(p *Product) *ProductImageUpdate

SetProducts sets the "products" edge to the Product entity.

func (*ProductImageUpdate) SetProductsID

func (piu *ProductImageUpdate) SetProductsID(id int64) *ProductImageUpdate

SetProductsID sets the "products" edge to the Product entity by ID.

func (*ProductImageUpdate) SetUpdatedAt

func (piu *ProductImageUpdate) SetUpdatedAt(t time.Time) *ProductImageUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ProductImageUpdate) Where

Where appends a list predicates to the ProductImageUpdate builder.

type ProductImageUpdateOne

type ProductImageUpdateOne struct {
	// contains filtered or unexported fields
}

ProductImageUpdateOne is the builder for updating a single ProductImage entity.

func (*ProductImageUpdateOne) ClearProducts

func (piuo *ProductImageUpdateOne) ClearProducts() *ProductImageUpdateOne

ClearProducts clears the "products" edge to the Product entity.

func (*ProductImageUpdateOne) Exec

func (piuo *ProductImageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ProductImageUpdateOne) ExecX

func (piuo *ProductImageUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageUpdateOne) Mutation

func (piuo *ProductImageUpdateOne) Mutation() *ProductImageMutation

Mutation returns the ProductImageMutation object of the builder.

func (*ProductImageUpdateOne) Save

Save executes the query and returns the updated ProductImage entity.

func (*ProductImageUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*ProductImageUpdateOne) Select

func (piuo *ProductImageUpdateOne) Select(field string, fields ...string) *ProductImageUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ProductImageUpdateOne) SetName

SetName sets the "name" field.

func (*ProductImageUpdateOne) SetNillableName

func (piuo *ProductImageUpdateOne) SetNillableName(s *string) *ProductImageUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductImageUpdateOne) SetNillableProductID

func (piuo *ProductImageUpdateOne) SetNillableProductID(i *int64) *ProductImageUpdateOne

SetNillableProductID sets the "product_id" field if the given value is not nil.

func (*ProductImageUpdateOne) SetProductID

func (piuo *ProductImageUpdateOne) SetProductID(i int64) *ProductImageUpdateOne

SetProductID sets the "product_id" field.

func (*ProductImageUpdateOne) SetProducts

func (piuo *ProductImageUpdateOne) SetProducts(p *Product) *ProductImageUpdateOne

SetProducts sets the "products" edge to the Product entity.

func (*ProductImageUpdateOne) SetProductsID

func (piuo *ProductImageUpdateOne) SetProductsID(id int64) *ProductImageUpdateOne

SetProductsID sets the "products" edge to the Product entity by ID.

func (*ProductImageUpdateOne) SetUpdatedAt

func (piuo *ProductImageUpdateOne) SetUpdatedAt(t time.Time) *ProductImageUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ProductImageUpdateOne) Where

Where appends a list predicates to the ProductImageUpdate builder.

type ProductImageUpsert

type ProductImageUpsert struct {
	*sql.UpdateSet
}

ProductImageUpsert is the "OnConflict" setter.

func (*ProductImageUpsert) SetName

SetName sets the "name" field.

func (*ProductImageUpsert) SetProductID

func (u *ProductImageUpsert) SetProductID(v int64) *ProductImageUpsert

SetProductID sets the "product_id" field.

func (*ProductImageUpsert) SetUpdatedAt

func (u *ProductImageUpsert) SetUpdatedAt(v time.Time) *ProductImageUpsert

SetUpdatedAt sets the "updated_at" field.

func (*ProductImageUpsert) UpdateName

func (u *ProductImageUpsert) UpdateName() *ProductImageUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductImageUpsert) UpdateProductID

func (u *ProductImageUpsert) UpdateProductID() *ProductImageUpsert

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*ProductImageUpsert) UpdateUpdatedAt

func (u *ProductImageUpsert) UpdateUpdatedAt() *ProductImageUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ProductImageUpsertBulk

type ProductImageUpsertBulk struct {
	// contains filtered or unexported fields
}

ProductImageUpsertBulk is the builder for "upsert"-ing a bulk of ProductImage nodes.

func (*ProductImageUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ProductImageUpsertBulk) Exec

Exec executes the query.

func (*ProductImageUpsertBulk) ExecX

func (u *ProductImageUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.ProductImage.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*ProductImageUpsertBulk) SetName

SetName sets the "name" field.

func (*ProductImageUpsertBulk) SetProductID

SetProductID sets the "product_id" field.

func (*ProductImageUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*ProductImageUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the ProductImageCreateBulk.OnConflict documentation for more info.

func (*ProductImageUpsertBulk) UpdateName

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductImageUpsertBulk) UpdateNewValues

func (u *ProductImageUpsertBulk) UpdateNewValues() *ProductImageUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.ProductImage.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*ProductImageUpsertBulk) UpdateProductID

func (u *ProductImageUpsertBulk) UpdateProductID() *ProductImageUpsertBulk

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*ProductImageUpsertBulk) UpdateUpdatedAt

func (u *ProductImageUpsertBulk) UpdateUpdatedAt() *ProductImageUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ProductImageUpsertOne

type ProductImageUpsertOne struct {
	// contains filtered or unexported fields
}

ProductImageUpsertOne is the builder for "upsert"-ing

one ProductImage node.

func (*ProductImageUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ProductImageUpsertOne) Exec

Exec executes the query.

func (*ProductImageUpsertOne) ExecX

func (u *ProductImageUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductImageUpsertOne) ID

func (u *ProductImageUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*ProductImageUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*ProductImageUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.ProductImage.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*ProductImageUpsertOne) SetName

SetName sets the "name" field.

func (*ProductImageUpsertOne) SetProductID

SetProductID sets the "product_id" field.

func (*ProductImageUpsertOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*ProductImageUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the ProductImageCreate.OnConflict documentation for more info.

func (*ProductImageUpsertOne) UpdateName

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductImageUpsertOne) UpdateNewValues

func (u *ProductImageUpsertOne) UpdateNewValues() *ProductImageUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.ProductImage.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*ProductImageUpsertOne) UpdateProductID

func (u *ProductImageUpsertOne) UpdateProductID() *ProductImageUpsertOne

UpdateProductID sets the "product_id" field to the value that was provided on create.

func (*ProductImageUpsertOne) UpdateUpdatedAt

func (u *ProductImageUpsertOne) UpdateUpdatedAt() *ProductImageUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ProductImages

type ProductImages []*ProductImage

ProductImages is a parsable slice of ProductImage.

type ProductMutation

type ProductMutation struct {
	// contains filtered or unexported fields
}

ProductMutation represents an operation that mutates the Product nodes in the graph.

func (*ProductMutation) AddAmount

func (m *ProductMutation) AddAmount(i int64)

AddAmount adds i to the "amount" field.

func (*ProductMutation) AddCartIDs

func (m *ProductMutation) AddCartIDs(ids ...int64)

AddCartIDs adds the "carts" edge to the Cart entity by ids.

func (*ProductMutation) AddField

func (m *ProductMutation) 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 (*ProductMutation) AddOrderProductIDs

func (m *ProductMutation) AddOrderProductIDs(ids ...int64)

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by ids.

func (*ProductMutation) AddPrice

func (m *ProductMutation) AddPrice(i int64)

AddPrice adds i to the "price" field.

func (*ProductMutation) AddProductImageIDs

func (m *ProductMutation) AddProductImageIDs(ids ...int64)

AddProductImageIDs adds the "product_images" edge to the ProductImage entity by ids.

func (*ProductMutation) AddedAmount

func (m *ProductMutation) AddedAmount() (r int64, exists bool)

AddedAmount returns the value that was added to the "amount" field in this mutation.

func (*ProductMutation) AddedEdges

func (m *ProductMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*ProductMutation) AddedField

func (m *ProductMutation) 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 (*ProductMutation) AddedFields

func (m *ProductMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*ProductMutation) AddedIDs

func (m *ProductMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*ProductMutation) AddedPrice

func (m *ProductMutation) AddedPrice() (r int64, exists bool)

AddedPrice returns the value that was added to the "price" field in this mutation.

func (*ProductMutation) Amount

func (m *ProductMutation) Amount() (r int64, exists bool)

Amount returns the value of the "amount" field in the mutation.

func (*ProductMutation) CartsCleared

func (m *ProductMutation) CartsCleared() bool

CartsCleared reports if the "carts" edge to the Cart entity was cleared.

func (*ProductMutation) CartsIDs

func (m *ProductMutation) CartsIDs() (ids []int64)

CartsIDs returns the "carts" edge IDs in the mutation.

func (*ProductMutation) CategoriesCleared

func (m *ProductMutation) CategoriesCleared() bool

CategoriesCleared reports if the "categories" edge to the Category entity was cleared.

func (*ProductMutation) CategoriesID

func (m *ProductMutation) CategoriesID() (id int64, exists bool)

CategoriesID returns the "categories" edge ID in the mutation.

func (*ProductMutation) CategoriesIDs

func (m *ProductMutation) CategoriesIDs() (ids []int64)

CategoriesIDs returns the "categories" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CategoriesID instead. It exists only for internal usage by the builders.

func (*ProductMutation) CategoryID

func (m *ProductMutation) CategoryID() (r int64, exists bool)

CategoryID returns the value of the "category_id" field in the mutation.

func (*ProductMutation) ClearCarts

func (m *ProductMutation) ClearCarts()

ClearCarts clears the "carts" edge to the Cart entity.

func (*ProductMutation) ClearCategories

func (m *ProductMutation) ClearCategories()

ClearCategories clears the "categories" edge to the Category entity.

func (*ProductMutation) ClearDescription

func (m *ProductMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*ProductMutation) ClearEdge

func (m *ProductMutation) 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 (*ProductMutation) ClearField

func (m *ProductMutation) 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 (*ProductMutation) ClearOrderProducts

func (m *ProductMutation) ClearOrderProducts()

ClearOrderProducts clears the "order_products" edge to the OrderProduct entity.

func (*ProductMutation) ClearProductImages

func (m *ProductMutation) ClearProductImages()

ClearProductImages clears the "product_images" edge to the ProductImage entity.

func (*ProductMutation) ClearedEdges

func (m *ProductMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*ProductMutation) ClearedFields

func (m *ProductMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (ProductMutation) Client

func (m ProductMutation) 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 (*ProductMutation) CreatedAt

func (m *ProductMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*ProductMutation) Description

func (m *ProductMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*ProductMutation) DescriptionCleared

func (m *ProductMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*ProductMutation) EdgeCleared

func (m *ProductMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*ProductMutation) Field

func (m *ProductMutation) 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 (*ProductMutation) FieldCleared

func (m *ProductMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*ProductMutation) Fields

func (m *ProductMutation) 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 (*ProductMutation) ID

func (m *ProductMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*ProductMutation) IDs

func (m *ProductMutation) IDs(ctx context.Context) ([]int64, 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 (*ProductMutation) Name

func (m *ProductMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ProductMutation) OldAmount

func (m *ProductMutation) OldAmount(ctx context.Context) (v int64, err error)

OldAmount returns the old "amount" field's value of the Product entity. If the Product 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 (*ProductMutation) OldCategoryID

func (m *ProductMutation) OldCategoryID(ctx context.Context) (v int64, err error)

OldCategoryID returns the old "category_id" field's value of the Product entity. If the Product 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 (*ProductMutation) OldCreatedAt

func (m *ProductMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Product entity. If the Product 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 (*ProductMutation) OldDescription

func (m *ProductMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Product entity. If the Product 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 (*ProductMutation) OldField

func (m *ProductMutation) 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 (*ProductMutation) OldName

func (m *ProductMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Product entity. If the Product 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 (*ProductMutation) OldPrice

func (m *ProductMutation) OldPrice(ctx context.Context) (v int64, err error)

OldPrice returns the old "price" field's value of the Product entity. If the Product 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 (*ProductMutation) OldUpdatedAt

func (m *ProductMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Product entity. If the Product 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 (*ProductMutation) Op

func (m *ProductMutation) Op() Op

Op returns the operation name.

func (*ProductMutation) OrderProductsCleared

func (m *ProductMutation) OrderProductsCleared() bool

OrderProductsCleared reports if the "order_products" edge to the OrderProduct entity was cleared.

func (*ProductMutation) OrderProductsIDs

func (m *ProductMutation) OrderProductsIDs() (ids []int64)

OrderProductsIDs returns the "order_products" edge IDs in the mutation.

func (*ProductMutation) Price

func (m *ProductMutation) Price() (r int64, exists bool)

Price returns the value of the "price" field in the mutation.

func (*ProductMutation) ProductImagesCleared

func (m *ProductMutation) ProductImagesCleared() bool

ProductImagesCleared reports if the "product_images" edge to the ProductImage entity was cleared.

func (*ProductMutation) ProductImagesIDs

func (m *ProductMutation) ProductImagesIDs() (ids []int64)

ProductImagesIDs returns the "product_images" edge IDs in the mutation.

func (*ProductMutation) RemoveCartIDs

func (m *ProductMutation) RemoveCartIDs(ids ...int64)

RemoveCartIDs removes the "carts" edge to the Cart entity by IDs.

func (*ProductMutation) RemoveOrderProductIDs

func (m *ProductMutation) RemoveOrderProductIDs(ids ...int64)

RemoveOrderProductIDs removes the "order_products" edge to the OrderProduct entity by IDs.

func (*ProductMutation) RemoveProductImageIDs

func (m *ProductMutation) RemoveProductImageIDs(ids ...int64)

RemoveProductImageIDs removes the "product_images" edge to the ProductImage entity by IDs.

func (*ProductMutation) RemovedCartsIDs

func (m *ProductMutation) RemovedCartsIDs() (ids []int64)

RemovedCarts returns the removed IDs of the "carts" edge to the Cart entity.

func (*ProductMutation) RemovedEdges

func (m *ProductMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*ProductMutation) RemovedIDs

func (m *ProductMutation) 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 (*ProductMutation) RemovedOrderProductsIDs

func (m *ProductMutation) RemovedOrderProductsIDs() (ids []int64)

RemovedOrderProducts returns the removed IDs of the "order_products" edge to the OrderProduct entity.

func (*ProductMutation) RemovedProductImagesIDs

func (m *ProductMutation) RemovedProductImagesIDs() (ids []int64)

RemovedProductImages returns the removed IDs of the "product_images" edge to the ProductImage entity.

func (*ProductMutation) ResetAmount

func (m *ProductMutation) ResetAmount()

ResetAmount resets all changes to the "amount" field.

func (*ProductMutation) ResetCarts

func (m *ProductMutation) ResetCarts()

ResetCarts resets all changes to the "carts" edge.

func (*ProductMutation) ResetCategories

func (m *ProductMutation) ResetCategories()

ResetCategories resets all changes to the "categories" edge.

func (*ProductMutation) ResetCategoryID

func (m *ProductMutation) ResetCategoryID()

ResetCategoryID resets all changes to the "category_id" field.

func (*ProductMutation) ResetCreatedAt

func (m *ProductMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ProductMutation) ResetDescription

func (m *ProductMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ProductMutation) ResetEdge

func (m *ProductMutation) 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 (*ProductMutation) ResetField

func (m *ProductMutation) 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 (*ProductMutation) ResetName

func (m *ProductMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ProductMutation) ResetOrderProducts

func (m *ProductMutation) ResetOrderProducts()

ResetOrderProducts resets all changes to the "order_products" edge.

func (*ProductMutation) ResetPrice

func (m *ProductMutation) ResetPrice()

ResetPrice resets all changes to the "price" field.

func (*ProductMutation) ResetProductImages

func (m *ProductMutation) ResetProductImages()

ResetProductImages resets all changes to the "product_images" edge.

func (*ProductMutation) ResetUpdatedAt

func (m *ProductMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ProductMutation) SetAmount

func (m *ProductMutation) SetAmount(i int64)

SetAmount sets the "amount" field.

func (*ProductMutation) SetCategoriesID

func (m *ProductMutation) SetCategoriesID(id int64)

SetCategoriesID sets the "categories" edge to the Category entity by id.

func (*ProductMutation) SetCategoryID

func (m *ProductMutation) SetCategoryID(i int64)

SetCategoryID sets the "category_id" field.

func (*ProductMutation) SetCreatedAt

func (m *ProductMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*ProductMutation) SetDescription

func (m *ProductMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ProductMutation) SetField

func (m *ProductMutation) 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 (*ProductMutation) SetName

func (m *ProductMutation) SetName(s string)

SetName sets the "name" field.

func (*ProductMutation) SetOp

func (m *ProductMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ProductMutation) SetPrice

func (m *ProductMutation) SetPrice(i int64)

SetPrice sets the "price" field.

func (*ProductMutation) SetUpdatedAt

func (m *ProductMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (ProductMutation) Tx

func (m ProductMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*ProductMutation) Type

func (m *ProductMutation) Type() string

Type returns the node type of this mutation (Product).

func (*ProductMutation) UpdatedAt

func (m *ProductMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*ProductMutation) Where

func (m *ProductMutation) Where(ps ...predicate.Product)

Where appends a list predicates to the ProductMutation builder.

func (*ProductMutation) WhereP

func (m *ProductMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ProductMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ProductQuery

type ProductQuery struct {
	// contains filtered or unexported fields
}

ProductQuery is the builder for querying Product entities.

func (*ProductQuery) Aggregate

func (pq *ProductQuery) Aggregate(fns ...AggregateFunc) *ProductSelect

Aggregate returns a ProductSelect configured with the given aggregations.

func (*ProductQuery) All

func (pq *ProductQuery) All(ctx context.Context) ([]*Product, error)

All executes the query and returns a list of Products.

func (*ProductQuery) AllX

func (pq *ProductQuery) AllX(ctx context.Context) []*Product

AllX is like All, but panics if an error occurs.

func (*ProductQuery) Clone

func (pq *ProductQuery) Clone() *ProductQuery

Clone returns a duplicate of the ProductQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*ProductQuery) Count

func (pq *ProductQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProductQuery) CountX

func (pq *ProductQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*ProductQuery) Exist

func (pq *ProductQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*ProductQuery) ExistX

func (pq *ProductQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*ProductQuery) First

func (pq *ProductQuery) First(ctx context.Context) (*Product, error)

First returns the first Product entity from the query. Returns a *NotFoundError when no Product was found.

func (*ProductQuery) FirstID

func (pq *ProductQuery) FirstID(ctx context.Context) (id int64, err error)

FirstID returns the first Product ID from the query. Returns a *NotFoundError when no Product ID was found.

func (*ProductQuery) FirstIDX

func (pq *ProductQuery) FirstIDX(ctx context.Context) int64

FirstIDX is like FirstID, but panics if an error occurs.

func (*ProductQuery) FirstX

func (pq *ProductQuery) FirstX(ctx context.Context) *Product

FirstX is like First, but panics if an error occurs.

func (*ProductQuery) GroupBy

func (pq *ProductQuery) GroupBy(field string, fields ...string) *ProductGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Product.Query().
	GroupBy(product.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProductQuery) IDs

func (pq *ProductQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of Product IDs.

func (*ProductQuery) IDsX

func (pq *ProductQuery) IDsX(ctx context.Context) []int64

IDsX is like IDs, but panics if an error occurs.

func (*ProductQuery) Limit

func (pq *ProductQuery) Limit(limit int) *ProductQuery

Limit the number of records to be returned by this query.

func (*ProductQuery) Offset

func (pq *ProductQuery) Offset(offset int) *ProductQuery

Offset to start from.

func (*ProductQuery) Only

func (pq *ProductQuery) Only(ctx context.Context) (*Product, error)

Only returns a single Product entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Product entity is found. Returns a *NotFoundError when no Product entities are found.

func (*ProductQuery) OnlyID

func (pq *ProductQuery) OnlyID(ctx context.Context) (id int64, err error)

OnlyID is like Only, but returns the only Product ID in the query. Returns a *NotSingularError when more than one Product ID is found. Returns a *NotFoundError when no entities are found.

func (*ProductQuery) OnlyIDX

func (pq *ProductQuery) OnlyIDX(ctx context.Context) int64

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*ProductQuery) OnlyX

func (pq *ProductQuery) OnlyX(ctx context.Context) *Product

OnlyX is like Only, but panics if an error occurs.

func (*ProductQuery) Order

func (pq *ProductQuery) Order(o ...product.OrderOption) *ProductQuery

Order specifies how the records should be ordered.

func (*ProductQuery) QueryCarts

func (pq *ProductQuery) QueryCarts() *CartQuery

QueryCarts chains the current query on the "carts" edge.

func (*ProductQuery) QueryCategories

func (pq *ProductQuery) QueryCategories() *CategoryQuery

QueryCategories chains the current query on the "categories" edge.

func (*ProductQuery) QueryOrderProducts

func (pq *ProductQuery) QueryOrderProducts() *OrderProductQuery

QueryOrderProducts chains the current query on the "order_products" edge.

func (*ProductQuery) QueryProductImages

func (pq *ProductQuery) QueryProductImages() *ProductImageQuery

QueryProductImages chains the current query on the "product_images" edge.

func (*ProductQuery) Select

func (pq *ProductQuery) Select(fields ...string) *ProductSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Product.Query().
	Select(product.FieldCreatedAt).
	Scan(ctx, &v)

func (*ProductQuery) Unique

func (pq *ProductQuery) Unique(unique bool) *ProductQuery

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 (*ProductQuery) Where

func (pq *ProductQuery) Where(ps ...predicate.Product) *ProductQuery

Where adds a new predicate for the ProductQuery builder.

func (*ProductQuery) WithCarts

func (pq *ProductQuery) WithCarts(opts ...func(*CartQuery)) *ProductQuery

WithCarts tells the query-builder to eager-load the nodes that are connected to the "carts" edge. The optional arguments are used to configure the query builder of the edge.

func (*ProductQuery) WithCategories

func (pq *ProductQuery) WithCategories(opts ...func(*CategoryQuery)) *ProductQuery

WithCategories tells the query-builder to eager-load the nodes that are connected to the "categories" edge. The optional arguments are used to configure the query builder of the edge.

func (*ProductQuery) WithOrderProducts

func (pq *ProductQuery) WithOrderProducts(opts ...func(*OrderProductQuery)) *ProductQuery

WithOrderProducts tells the query-builder to eager-load the nodes that are connected to the "order_products" edge. The optional arguments are used to configure the query builder of the edge.

func (*ProductQuery) WithProductImages

func (pq *ProductQuery) WithProductImages(opts ...func(*ProductImageQuery)) *ProductQuery

WithProductImages tells the query-builder to eager-load the nodes that are connected to the "product_images" edge. The optional arguments are used to configure the query builder of the edge.

type ProductSelect

type ProductSelect struct {
	*ProductQuery
	// contains filtered or unexported fields
}

ProductSelect is the builder for selecting fields of Product entities.

func (*ProductSelect) Aggregate

func (ps *ProductSelect) Aggregate(fns ...AggregateFunc) *ProductSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ProductSelect) Bool

func (s *ProductSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*ProductSelect) BoolX

func (s *ProductSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*ProductSelect) Bools

func (s *ProductSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*ProductSelect) BoolsX

func (s *ProductSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*ProductSelect) Float64

func (s *ProductSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*ProductSelect) Float64X

func (s *ProductSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*ProductSelect) Float64s

func (s *ProductSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*ProductSelect) Float64sX

func (s *ProductSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*ProductSelect) Int

func (s *ProductSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*ProductSelect) IntX

func (s *ProductSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*ProductSelect) Ints

func (s *ProductSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*ProductSelect) IntsX

func (s *ProductSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*ProductSelect) Scan

func (ps *ProductSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*ProductSelect) ScanX

func (s *ProductSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*ProductSelect) String

func (s *ProductSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*ProductSelect) StringX

func (s *ProductSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*ProductSelect) Strings

func (s *ProductSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*ProductSelect) StringsX

func (s *ProductSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type ProductUpdate

type ProductUpdate struct {
	// contains filtered or unexported fields
}

ProductUpdate is the builder for updating Product entities.

func (*ProductUpdate) AddAmount

func (pu *ProductUpdate) AddAmount(i int64) *ProductUpdate

AddAmount adds i to the "amount" field.

func (*ProductUpdate) AddCartIDs

func (pu *ProductUpdate) AddCartIDs(ids ...int64) *ProductUpdate

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*ProductUpdate) AddCarts

func (pu *ProductUpdate) AddCarts(c ...*Cart) *ProductUpdate

AddCarts adds the "carts" edges to the Cart entity.

func (*ProductUpdate) AddOrderProductIDs

func (pu *ProductUpdate) AddOrderProductIDs(ids ...int64) *ProductUpdate

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*ProductUpdate) AddOrderProducts

func (pu *ProductUpdate) AddOrderProducts(o ...*OrderProduct) *ProductUpdate

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*ProductUpdate) AddPrice

func (pu *ProductUpdate) AddPrice(i int64) *ProductUpdate

AddPrice adds i to the "price" field.

func (*ProductUpdate) AddProductImageIDs

func (pu *ProductUpdate) AddProductImageIDs(ids ...int64) *ProductUpdate

AddProductImageIDs adds the "product_images" edge to the ProductImage entity by IDs.

func (*ProductUpdate) AddProductImages

func (pu *ProductUpdate) AddProductImages(p ...*ProductImage) *ProductUpdate

AddProductImages adds the "product_images" edges to the ProductImage entity.

func (*ProductUpdate) ClearCarts

func (pu *ProductUpdate) ClearCarts() *ProductUpdate

ClearCarts clears all "carts" edges to the Cart entity.

func (*ProductUpdate) ClearCategories

func (pu *ProductUpdate) ClearCategories() *ProductUpdate

ClearCategories clears the "categories" edge to the Category entity.

func (*ProductUpdate) ClearDescription

func (pu *ProductUpdate) ClearDescription() *ProductUpdate

ClearDescription clears the value of the "description" field.

func (*ProductUpdate) ClearOrderProducts

func (pu *ProductUpdate) ClearOrderProducts() *ProductUpdate

ClearOrderProducts clears all "order_products" edges to the OrderProduct entity.

func (*ProductUpdate) ClearProductImages

func (pu *ProductUpdate) ClearProductImages() *ProductUpdate

ClearProductImages clears all "product_images" edges to the ProductImage entity.

func (*ProductUpdate) Exec

func (pu *ProductUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductUpdate) ExecX

func (pu *ProductUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpdate) Mutation

func (pu *ProductUpdate) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductUpdate) RemoveCartIDs

func (pu *ProductUpdate) RemoveCartIDs(ids ...int64) *ProductUpdate

RemoveCartIDs removes the "carts" edge to Cart entities by IDs.

func (*ProductUpdate) RemoveCarts

func (pu *ProductUpdate) RemoveCarts(c ...*Cart) *ProductUpdate

RemoveCarts removes "carts" edges to Cart entities.

func (*ProductUpdate) RemoveOrderProductIDs

func (pu *ProductUpdate) RemoveOrderProductIDs(ids ...int64) *ProductUpdate

RemoveOrderProductIDs removes the "order_products" edge to OrderProduct entities by IDs.

func (*ProductUpdate) RemoveOrderProducts

func (pu *ProductUpdate) RemoveOrderProducts(o ...*OrderProduct) *ProductUpdate

RemoveOrderProducts removes "order_products" edges to OrderProduct entities.

func (*ProductUpdate) RemoveProductImageIDs

func (pu *ProductUpdate) RemoveProductImageIDs(ids ...int64) *ProductUpdate

RemoveProductImageIDs removes the "product_images" edge to ProductImage entities by IDs.

func (*ProductUpdate) RemoveProductImages

func (pu *ProductUpdate) RemoveProductImages(p ...*ProductImage) *ProductUpdate

RemoveProductImages removes "product_images" edges to ProductImage entities.

func (*ProductUpdate) Save

func (pu *ProductUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*ProductUpdate) SaveX

func (pu *ProductUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*ProductUpdate) SetAmount

func (pu *ProductUpdate) SetAmount(i int64) *ProductUpdate

SetAmount sets the "amount" field.

func (*ProductUpdate) SetCategories

func (pu *ProductUpdate) SetCategories(c *Category) *ProductUpdate

SetCategories sets the "categories" edge to the Category entity.

func (*ProductUpdate) SetCategoriesID

func (pu *ProductUpdate) SetCategoriesID(id int64) *ProductUpdate

SetCategoriesID sets the "categories" edge to the Category entity by ID.

func (*ProductUpdate) SetCategoryID

func (pu *ProductUpdate) SetCategoryID(i int64) *ProductUpdate

SetCategoryID sets the "category_id" field.

func (*ProductUpdate) SetDescription

func (pu *ProductUpdate) SetDescription(s string) *ProductUpdate

SetDescription sets the "description" field.

func (*ProductUpdate) SetName

func (pu *ProductUpdate) SetName(s string) *ProductUpdate

SetName sets the "name" field.

func (*ProductUpdate) SetNillableAmount

func (pu *ProductUpdate) SetNillableAmount(i *int64) *ProductUpdate

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*ProductUpdate) SetNillableCategoryID

func (pu *ProductUpdate) SetNillableCategoryID(i *int64) *ProductUpdate

SetNillableCategoryID sets the "category_id" field if the given value is not nil.

func (*ProductUpdate) SetNillableDescription

func (pu *ProductUpdate) SetNillableDescription(s *string) *ProductUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProductUpdate) SetNillableName

func (pu *ProductUpdate) SetNillableName(s *string) *ProductUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductUpdate) SetNillablePrice

func (pu *ProductUpdate) SetNillablePrice(i *int64) *ProductUpdate

SetNillablePrice sets the "price" field if the given value is not nil.

func (*ProductUpdate) SetPrice

func (pu *ProductUpdate) SetPrice(i int64) *ProductUpdate

SetPrice sets the "price" field.

func (*ProductUpdate) SetUpdatedAt

func (pu *ProductUpdate) SetUpdatedAt(t time.Time) *ProductUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ProductUpdate) Where

func (pu *ProductUpdate) Where(ps ...predicate.Product) *ProductUpdate

Where appends a list predicates to the ProductUpdate builder.

type ProductUpdateOne

type ProductUpdateOne struct {
	// contains filtered or unexported fields
}

ProductUpdateOne is the builder for updating a single Product entity.

func (*ProductUpdateOne) AddAmount

func (puo *ProductUpdateOne) AddAmount(i int64) *ProductUpdateOne

AddAmount adds i to the "amount" field.

func (*ProductUpdateOne) AddCartIDs

func (puo *ProductUpdateOne) AddCartIDs(ids ...int64) *ProductUpdateOne

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*ProductUpdateOne) AddCarts

func (puo *ProductUpdateOne) AddCarts(c ...*Cart) *ProductUpdateOne

AddCarts adds the "carts" edges to the Cart entity.

func (*ProductUpdateOne) AddOrderProductIDs

func (puo *ProductUpdateOne) AddOrderProductIDs(ids ...int64) *ProductUpdateOne

AddOrderProductIDs adds the "order_products" edge to the OrderProduct entity by IDs.

func (*ProductUpdateOne) AddOrderProducts

func (puo *ProductUpdateOne) AddOrderProducts(o ...*OrderProduct) *ProductUpdateOne

AddOrderProducts adds the "order_products" edges to the OrderProduct entity.

func (*ProductUpdateOne) AddPrice

func (puo *ProductUpdateOne) AddPrice(i int64) *ProductUpdateOne

AddPrice adds i to the "price" field.

func (*ProductUpdateOne) AddProductImageIDs

func (puo *ProductUpdateOne) AddProductImageIDs(ids ...int64) *ProductUpdateOne

AddProductImageIDs adds the "product_images" edge to the ProductImage entity by IDs.

func (*ProductUpdateOne) AddProductImages

func (puo *ProductUpdateOne) AddProductImages(p ...*ProductImage) *ProductUpdateOne

AddProductImages adds the "product_images" edges to the ProductImage entity.

func (*ProductUpdateOne) ClearCarts

func (puo *ProductUpdateOne) ClearCarts() *ProductUpdateOne

ClearCarts clears all "carts" edges to the Cart entity.

func (*ProductUpdateOne) ClearCategories

func (puo *ProductUpdateOne) ClearCategories() *ProductUpdateOne

ClearCategories clears the "categories" edge to the Category entity.

func (*ProductUpdateOne) ClearDescription

func (puo *ProductUpdateOne) ClearDescription() *ProductUpdateOne

ClearDescription clears the value of the "description" field.

func (*ProductUpdateOne) ClearOrderProducts

func (puo *ProductUpdateOne) ClearOrderProducts() *ProductUpdateOne

ClearOrderProducts clears all "order_products" edges to the OrderProduct entity.

func (*ProductUpdateOne) ClearProductImages

func (puo *ProductUpdateOne) ClearProductImages() *ProductUpdateOne

ClearProductImages clears all "product_images" edges to the ProductImage entity.

func (*ProductUpdateOne) Exec

func (puo *ProductUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ProductUpdateOne) ExecX

func (puo *ProductUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpdateOne) Mutation

func (puo *ProductUpdateOne) Mutation() *ProductMutation

Mutation returns the ProductMutation object of the builder.

func (*ProductUpdateOne) RemoveCartIDs

func (puo *ProductUpdateOne) RemoveCartIDs(ids ...int64) *ProductUpdateOne

RemoveCartIDs removes the "carts" edge to Cart entities by IDs.

func (*ProductUpdateOne) RemoveCarts

func (puo *ProductUpdateOne) RemoveCarts(c ...*Cart) *ProductUpdateOne

RemoveCarts removes "carts" edges to Cart entities.

func (*ProductUpdateOne) RemoveOrderProductIDs

func (puo *ProductUpdateOne) RemoveOrderProductIDs(ids ...int64) *ProductUpdateOne

RemoveOrderProductIDs removes the "order_products" edge to OrderProduct entities by IDs.

func (*ProductUpdateOne) RemoveOrderProducts

func (puo *ProductUpdateOne) RemoveOrderProducts(o ...*OrderProduct) *ProductUpdateOne

RemoveOrderProducts removes "order_products" edges to OrderProduct entities.

func (*ProductUpdateOne) RemoveProductImageIDs

func (puo *ProductUpdateOne) RemoveProductImageIDs(ids ...int64) *ProductUpdateOne

RemoveProductImageIDs removes the "product_images" edge to ProductImage entities by IDs.

func (*ProductUpdateOne) RemoveProductImages

func (puo *ProductUpdateOne) RemoveProductImages(p ...*ProductImage) *ProductUpdateOne

RemoveProductImages removes "product_images" edges to ProductImage entities.

func (*ProductUpdateOne) Save

func (puo *ProductUpdateOne) Save(ctx context.Context) (*Product, error)

Save executes the query and returns the updated Product entity.

func (*ProductUpdateOne) SaveX

func (puo *ProductUpdateOne) SaveX(ctx context.Context) *Product

SaveX is like Save, but panics if an error occurs.

func (*ProductUpdateOne) Select

func (puo *ProductUpdateOne) Select(field string, fields ...string) *ProductUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*ProductUpdateOne) SetAmount

func (puo *ProductUpdateOne) SetAmount(i int64) *ProductUpdateOne

SetAmount sets the "amount" field.

func (*ProductUpdateOne) SetCategories

func (puo *ProductUpdateOne) SetCategories(c *Category) *ProductUpdateOne

SetCategories sets the "categories" edge to the Category entity.

func (*ProductUpdateOne) SetCategoriesID

func (puo *ProductUpdateOne) SetCategoriesID(id int64) *ProductUpdateOne

SetCategoriesID sets the "categories" edge to the Category entity by ID.

func (*ProductUpdateOne) SetCategoryID

func (puo *ProductUpdateOne) SetCategoryID(i int64) *ProductUpdateOne

SetCategoryID sets the "category_id" field.

func (*ProductUpdateOne) SetDescription

func (puo *ProductUpdateOne) SetDescription(s string) *ProductUpdateOne

SetDescription sets the "description" field.

func (*ProductUpdateOne) SetName

func (puo *ProductUpdateOne) SetName(s string) *ProductUpdateOne

SetName sets the "name" field.

func (*ProductUpdateOne) SetNillableAmount

func (puo *ProductUpdateOne) SetNillableAmount(i *int64) *ProductUpdateOne

SetNillableAmount sets the "amount" field if the given value is not nil.

func (*ProductUpdateOne) SetNillableCategoryID

func (puo *ProductUpdateOne) SetNillableCategoryID(i *int64) *ProductUpdateOne

SetNillableCategoryID sets the "category_id" field if the given value is not nil.

func (*ProductUpdateOne) SetNillableDescription

func (puo *ProductUpdateOne) SetNillableDescription(s *string) *ProductUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProductUpdateOne) SetNillableName

func (puo *ProductUpdateOne) SetNillableName(s *string) *ProductUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ProductUpdateOne) SetNillablePrice

func (puo *ProductUpdateOne) SetNillablePrice(i *int64) *ProductUpdateOne

SetNillablePrice sets the "price" field if the given value is not nil.

func (*ProductUpdateOne) SetPrice

func (puo *ProductUpdateOne) SetPrice(i int64) *ProductUpdateOne

SetPrice sets the "price" field.

func (*ProductUpdateOne) SetUpdatedAt

func (puo *ProductUpdateOne) SetUpdatedAt(t time.Time) *ProductUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ProductUpdateOne) Where

Where appends a list predicates to the ProductUpdate builder.

type ProductUpsert

type ProductUpsert struct {
	*sql.UpdateSet
}

ProductUpsert is the "OnConflict" setter.

func (*ProductUpsert) AddAmount

func (u *ProductUpsert) AddAmount(v int64) *ProductUpsert

AddAmount adds v to the "amount" field.

func (*ProductUpsert) AddPrice

func (u *ProductUpsert) AddPrice(v int64) *ProductUpsert

AddPrice adds v to the "price" field.

func (*ProductUpsert) ClearDescription

func (u *ProductUpsert) ClearDescription() *ProductUpsert

ClearDescription clears the value of the "description" field.

func (*ProductUpsert) SetAmount

func (u *ProductUpsert) SetAmount(v int64) *ProductUpsert

SetAmount sets the "amount" field.

func (*ProductUpsert) SetCategoryID

func (u *ProductUpsert) SetCategoryID(v int64) *ProductUpsert

SetCategoryID sets the "category_id" field.

func (*ProductUpsert) SetDescription

func (u *ProductUpsert) SetDescription(v string) *ProductUpsert

SetDescription sets the "description" field.

func (*ProductUpsert) SetName

func (u *ProductUpsert) SetName(v string) *ProductUpsert

SetName sets the "name" field.

func (*ProductUpsert) SetPrice

func (u *ProductUpsert) SetPrice(v int64) *ProductUpsert

SetPrice sets the "price" field.

func (*ProductUpsert) SetUpdatedAt

func (u *ProductUpsert) SetUpdatedAt(v time.Time) *ProductUpsert

SetUpdatedAt sets the "updated_at" field.

func (*ProductUpsert) UpdateAmount

func (u *ProductUpsert) UpdateAmount() *ProductUpsert

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*ProductUpsert) UpdateCategoryID

func (u *ProductUpsert) UpdateCategoryID() *ProductUpsert

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*ProductUpsert) UpdateDescription

func (u *ProductUpsert) UpdateDescription() *ProductUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ProductUpsert) UpdateName

func (u *ProductUpsert) UpdateName() *ProductUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductUpsert) UpdatePrice

func (u *ProductUpsert) UpdatePrice() *ProductUpsert

UpdatePrice sets the "price" field to the value that was provided on create.

func (*ProductUpsert) UpdateUpdatedAt

func (u *ProductUpsert) UpdateUpdatedAt() *ProductUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ProductUpsertBulk

type ProductUpsertBulk struct {
	// contains filtered or unexported fields
}

ProductUpsertBulk is the builder for "upsert"-ing a bulk of Product nodes.

func (*ProductUpsertBulk) AddAmount

func (u *ProductUpsertBulk) AddAmount(v int64) *ProductUpsertBulk

AddAmount adds v to the "amount" field.

func (*ProductUpsertBulk) AddPrice

func (u *ProductUpsertBulk) AddPrice(v int64) *ProductUpsertBulk

AddPrice adds v to the "price" field.

func (*ProductUpsertBulk) ClearDescription

func (u *ProductUpsertBulk) ClearDescription() *ProductUpsertBulk

ClearDescription clears the value of the "description" field.

func (*ProductUpsertBulk) DoNothing

func (u *ProductUpsertBulk) DoNothing() *ProductUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ProductUpsertBulk) Exec

func (u *ProductUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductUpsertBulk) ExecX

func (u *ProductUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpsertBulk) Ignore

func (u *ProductUpsertBulk) Ignore() *ProductUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Product.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*ProductUpsertBulk) SetAmount

func (u *ProductUpsertBulk) SetAmount(v int64) *ProductUpsertBulk

SetAmount sets the "amount" field.

func (*ProductUpsertBulk) SetCategoryID

func (u *ProductUpsertBulk) SetCategoryID(v int64) *ProductUpsertBulk

SetCategoryID sets the "category_id" field.

func (*ProductUpsertBulk) SetDescription

func (u *ProductUpsertBulk) SetDescription(v string) *ProductUpsertBulk

SetDescription sets the "description" field.

func (*ProductUpsertBulk) SetName

SetName sets the "name" field.

func (*ProductUpsertBulk) SetPrice

func (u *ProductUpsertBulk) SetPrice(v int64) *ProductUpsertBulk

SetPrice sets the "price" field.

func (*ProductUpsertBulk) SetUpdatedAt

func (u *ProductUpsertBulk) SetUpdatedAt(v time.Time) *ProductUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*ProductUpsertBulk) Update

func (u *ProductUpsertBulk) Update(set func(*ProductUpsert)) *ProductUpsertBulk

Update allows overriding fields `UPDATE` values. See the ProductCreateBulk.OnConflict documentation for more info.

func (*ProductUpsertBulk) UpdateAmount

func (u *ProductUpsertBulk) UpdateAmount() *ProductUpsertBulk

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*ProductUpsertBulk) UpdateCategoryID

func (u *ProductUpsertBulk) UpdateCategoryID() *ProductUpsertBulk

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*ProductUpsertBulk) UpdateDescription

func (u *ProductUpsertBulk) UpdateDescription() *ProductUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ProductUpsertBulk) UpdateName

func (u *ProductUpsertBulk) UpdateName() *ProductUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductUpsertBulk) UpdateNewValues

func (u *ProductUpsertBulk) UpdateNewValues() *ProductUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Product.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*ProductUpsertBulk) UpdatePrice

func (u *ProductUpsertBulk) UpdatePrice() *ProductUpsertBulk

UpdatePrice sets the "price" field to the value that was provided on create.

func (*ProductUpsertBulk) UpdateUpdatedAt

func (u *ProductUpsertBulk) UpdateUpdatedAt() *ProductUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type ProductUpsertOne

type ProductUpsertOne struct {
	// contains filtered or unexported fields
}

ProductUpsertOne is the builder for "upsert"-ing

one Product node.

func (*ProductUpsertOne) AddAmount

func (u *ProductUpsertOne) AddAmount(v int64) *ProductUpsertOne

AddAmount adds v to the "amount" field.

func (*ProductUpsertOne) AddPrice

func (u *ProductUpsertOne) AddPrice(v int64) *ProductUpsertOne

AddPrice adds v to the "price" field.

func (*ProductUpsertOne) ClearDescription

func (u *ProductUpsertOne) ClearDescription() *ProductUpsertOne

ClearDescription clears the value of the "description" field.

func (*ProductUpsertOne) DoNothing

func (u *ProductUpsertOne) DoNothing() *ProductUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*ProductUpsertOne) Exec

func (u *ProductUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*ProductUpsertOne) ExecX

func (u *ProductUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*ProductUpsertOne) ID

func (u *ProductUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*ProductUpsertOne) IDX

func (u *ProductUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*ProductUpsertOne) Ignore

func (u *ProductUpsertOne) Ignore() *ProductUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Product.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*ProductUpsertOne) SetAmount

func (u *ProductUpsertOne) SetAmount(v int64) *ProductUpsertOne

SetAmount sets the "amount" field.

func (*ProductUpsertOne) SetCategoryID

func (u *ProductUpsertOne) SetCategoryID(v int64) *ProductUpsertOne

SetCategoryID sets the "category_id" field.

func (*ProductUpsertOne) SetDescription

func (u *ProductUpsertOne) SetDescription(v string) *ProductUpsertOne

SetDescription sets the "description" field.

func (*ProductUpsertOne) SetName

func (u *ProductUpsertOne) SetName(v string) *ProductUpsertOne

SetName sets the "name" field.

func (*ProductUpsertOne) SetPrice

func (u *ProductUpsertOne) SetPrice(v int64) *ProductUpsertOne

SetPrice sets the "price" field.

func (*ProductUpsertOne) SetUpdatedAt

func (u *ProductUpsertOne) SetUpdatedAt(v time.Time) *ProductUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*ProductUpsertOne) Update

func (u *ProductUpsertOne) Update(set func(*ProductUpsert)) *ProductUpsertOne

Update allows overriding fields `UPDATE` values. See the ProductCreate.OnConflict documentation for more info.

func (*ProductUpsertOne) UpdateAmount

func (u *ProductUpsertOne) UpdateAmount() *ProductUpsertOne

UpdateAmount sets the "amount" field to the value that was provided on create.

func (*ProductUpsertOne) UpdateCategoryID

func (u *ProductUpsertOne) UpdateCategoryID() *ProductUpsertOne

UpdateCategoryID sets the "category_id" field to the value that was provided on create.

func (*ProductUpsertOne) UpdateDescription

func (u *ProductUpsertOne) UpdateDescription() *ProductUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ProductUpsertOne) UpdateName

func (u *ProductUpsertOne) UpdateName() *ProductUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*ProductUpsertOne) UpdateNewValues

func (u *ProductUpsertOne) UpdateNewValues() *ProductUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Product.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*ProductUpsertOne) UpdatePrice

func (u *ProductUpsertOne) UpdatePrice() *ProductUpsertOne

UpdatePrice sets the "price" field to the value that was provided on create.

func (*ProductUpsertOne) UpdateUpdatedAt

func (u *ProductUpsertOne) UpdateUpdatedAt() *ProductUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Products

type Products []*Product

Products is a parsable slice of Product.

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
	// Cart is the client for interacting with the Cart builders.
	Cart *CartClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// OrderProduct is the client for interacting with the OrderProduct builders.
	OrderProduct *OrderProductClient
	// Product is the client for interacting with the Product builders.
	Product *ProductClient
	// ProductImage is the client for interacting with the ProductImage builders.
	ProductImage *ProductImageClient
	// 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 int64 `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Phone holds the value of the "phone" field.
	Phone string `json:"phone,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Role holds the value of the "role" field.
	Role user.Role `json:"role,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"-"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAddresses

func (u *User) QueryAddresses() *AddressQuery

QueryAddresses queries the "addresses" edge of the User entity.

func (*User) QueryCarts

func (u *User) QueryCarts() *CartQuery

QueryCarts queries the "carts" edge of the User entity.

func (*User) QueryOrders

func (u *User) QueryOrders() *OrderQuery

QueryOrders queries the "orders" edge of the User entity.

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 int64) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int64) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int64) *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) QueryAddresses

func (c *UserClient) QueryAddresses(u *User) *AddressQuery

QueryAddresses queries the addresses edge of a User.

func (*UserClient) QueryCarts

func (c *UserClient) QueryCarts(u *User) *CartQuery

QueryCarts queries the carts edge of a User.

func (*UserClient) QueryOrders

func (c *UserClient) QueryOrders(u *User) *OrderQuery

QueryOrders queries the orders edge of a 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 int64) *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) AddAddressIDs

func (uc *UserCreate) AddAddressIDs(ids ...int64) *UserCreate

AddAddressIDs adds the "addresses" edge to the Address entity by IDs.

func (*UserCreate) AddAddresses

func (uc *UserCreate) AddAddresses(a ...*Address) *UserCreate

AddAddresses adds the "addresses" edges to the Address entity.

func (*UserCreate) AddCartIDs

func (uc *UserCreate) AddCartIDs(ids ...int64) *UserCreate

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*UserCreate) AddCarts

func (uc *UserCreate) AddCarts(c ...*Cart) *UserCreate

AddCarts adds the "carts" edges to the Cart entity.

func (*UserCreate) AddOrderIDs

func (uc *UserCreate) AddOrderIDs(ids ...int64) *UserCreate

AddOrderIDs adds the "orders" edge to the Order entity by IDs.

func (*UserCreate) AddOrders

func (uc *UserCreate) AddOrders(o ...*Order) *UserCreate

AddOrders adds the "orders" edges to the Order 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) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableRole

func (uc *UserCreate) SetNillableRole(u *user.Role) *UserCreate

SetNillableRole sets the "role" 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) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetPhone

func (uc *UserCreate) SetPhone(s string) *UserCreate

SetPhone sets the "phone" field.

func (*UserCreate) SetRole

func (uc *UserCreate) SetRole(u user.Role) *UserCreate

SetRole sets the "role" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" 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) OnConflict

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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 UserEdges

type UserEdges struct {
	// Addresses holds the value of the addresses edge.
	Addresses []*Address `json:"addresses,omitempty"`
	// Carts holds the value of the carts edge.
	Carts []*Cart `json:"carts,omitempty"`
	// Orders holds the value of the orders edge.
	Orders []*Order `json:"orders,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AddressesOrErr

func (e UserEdges) AddressesOrErr() ([]*Address, error)

AddressesOrErr returns the Addresses value or an error if the edge was not loaded in eager-loading.

func (UserEdges) CartsOrErr

func (e UserEdges) CartsOrErr() ([]*Cart, error)

CartsOrErr returns the Carts value or an error if the edge was not loaded in eager-loading.

func (UserEdges) OrdersOrErr

func (e UserEdges) OrdersOrErr() ([]*Order, error)

OrdersOrErr returns the Orders value or an error if the edge was not loaded in eager-loading.

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) AddAddressIDs

func (m *UserMutation) AddAddressIDs(ids ...int64)

AddAddressIDs adds the "addresses" edge to the Address entity by ids.

func (*UserMutation) AddCartIDs

func (m *UserMutation) AddCartIDs(ids ...int64)

AddCartIDs adds the "carts" edge to the Cart entity by ids.

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) AddOrderIDs

func (m *UserMutation) AddOrderIDs(ids ...int64)

AddOrderIDs adds the "orders" edge to the Order entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) AddressesCleared

func (m *UserMutation) AddressesCleared() bool

AddressesCleared reports if the "addresses" edge to the Address entity was cleared.

func (*UserMutation) AddressesIDs

func (m *UserMutation) AddressesIDs() (ids []int64)

AddressesIDs returns the "addresses" edge IDs in the mutation.

func (*UserMutation) CartsCleared

func (m *UserMutation) CartsCleared() bool

CartsCleared reports if the "carts" edge to the Cart entity was cleared.

func (*UserMutation) CartsIDs

func (m *UserMutation) CartsIDs() (ids []int64)

CartsIDs returns the "carts" edge IDs in the mutation.

func (*UserMutation) ClearAddresses

func (m *UserMutation) ClearAddresses()

ClearAddresses clears the "addresses" edge to the Address entity.

func (*UserMutation) ClearCarts

func (m *UserMutation) ClearCarts()

ClearCarts clears the "carts" edge to the Cart entity.

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) ClearOrders

func (m *UserMutation) ClearOrders()

ClearOrders clears the "orders" edge to the Order entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) 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) ID

func (m *UserMutation) ID() (id int64, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int64, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) 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) 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) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPhone

func (m *UserMutation) OldPhone(ctx context.Context) (v string, err error)

OldPhone returns the old "phone" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRole

func (m *UserMutation) OldRole(ctx context.Context) (v user.Role, err error)

OldRole returns the old "role" 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) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) OrdersCleared

func (m *UserMutation) OrdersCleared() bool

OrdersCleared reports if the "orders" edge to the Order entity was cleared.

func (*UserMutation) OrdersIDs

func (m *UserMutation) OrdersIDs() (ids []int64)

OrdersIDs returns the "orders" edge IDs in the mutation.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) Phone

func (m *UserMutation) Phone() (r string, exists bool)

Phone returns the value of the "phone" field in the mutation.

func (*UserMutation) RemoveAddressIDs

func (m *UserMutation) RemoveAddressIDs(ids ...int64)

RemoveAddressIDs removes the "addresses" edge to the Address entity by IDs.

func (*UserMutation) RemoveCartIDs

func (m *UserMutation) RemoveCartIDs(ids ...int64)

RemoveCartIDs removes the "carts" edge to the Cart entity by IDs.

func (*UserMutation) RemoveOrderIDs

func (m *UserMutation) RemoveOrderIDs(ids ...int64)

RemoveOrderIDs removes the "orders" edge to the Order entity by IDs.

func (*UserMutation) RemovedAddressesIDs

func (m *UserMutation) RemovedAddressesIDs() (ids []int64)

RemovedAddresses returns the removed IDs of the "addresses" edge to the Address entity.

func (*UserMutation) RemovedCartsIDs

func (m *UserMutation) RemovedCartsIDs() (ids []int64)

RemovedCarts returns the removed IDs of the "carts" edge to the Cart entity.

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) RemovedOrdersIDs

func (m *UserMutation) RemovedOrdersIDs() (ids []int64)

RemovedOrders returns the removed IDs of the "orders" edge to the Order entity.

func (*UserMutation) ResetAddresses

func (m *UserMutation) ResetAddresses()

ResetAddresses resets all changes to the "addresses" edge.

func (*UserMutation) ResetCarts

func (m *UserMutation) ResetCarts()

ResetCarts resets all changes to the "carts" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) 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) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetOrders

func (m *UserMutation) ResetOrders()

ResetOrders resets all changes to the "orders" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPhone

func (m *UserMutation) ResetPhone()

ResetPhone resets all changes to the "phone" field.

func (*UserMutation) ResetRole

func (m *UserMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) Role

func (m *UserMutation) Role() (r user.Role, exists bool)

Role returns the value of the "role" field in the mutation.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" 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) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetPhone

func (m *UserMutation) SetPhone(s string)

SetPhone sets the "phone" field.

func (*UserMutation) SetRole

func (m *UserMutation) SetRole(u user.Role)

SetRole sets the "role" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) 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 int64, 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) int64

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int64, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int64

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 int64, 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) int64

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) QueryAddresses

func (uq *UserQuery) QueryAddresses() *AddressQuery

QueryAddresses chains the current query on the "addresses" edge.

func (*UserQuery) QueryCarts

func (uq *UserQuery) QueryCarts() *CartQuery

QueryCarts chains the current query on the "carts" edge.

func (*UserQuery) QueryOrders

func (uq *UserQuery) QueryOrders() *OrderQuery

QueryOrders chains the current query on the "orders" edge.

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	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.

func (*UserQuery) WithAddresses

func (uq *UserQuery) WithAddresses(opts ...func(*AddressQuery)) *UserQuery

WithAddresses tells the query-builder to eager-load the nodes that are connected to the "addresses" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithCarts

func (uq *UserQuery) WithCarts(opts ...func(*CartQuery)) *UserQuery

WithCarts tells the query-builder to eager-load the nodes that are connected to the "carts" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithOrders

func (uq *UserQuery) WithOrders(opts ...func(*OrderQuery)) *UserQuery

WithOrders tells the query-builder to eager-load the nodes that are connected to the "orders" edge. The optional arguments are used to configure the query builder of the edge.

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) AddAddressIDs

func (uu *UserUpdate) AddAddressIDs(ids ...int64) *UserUpdate

AddAddressIDs adds the "addresses" edge to the Address entity by IDs.

func (*UserUpdate) AddAddresses

func (uu *UserUpdate) AddAddresses(a ...*Address) *UserUpdate

AddAddresses adds the "addresses" edges to the Address entity.

func (*UserUpdate) AddCartIDs

func (uu *UserUpdate) AddCartIDs(ids ...int64) *UserUpdate

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*UserUpdate) AddCarts

func (uu *UserUpdate) AddCarts(c ...*Cart) *UserUpdate

AddCarts adds the "carts" edges to the Cart entity.

func (*UserUpdate) AddOrderIDs

func (uu *UserUpdate) AddOrderIDs(ids ...int64) *UserUpdate

AddOrderIDs adds the "orders" edge to the Order entity by IDs.

func (*UserUpdate) AddOrders

func (uu *UserUpdate) AddOrders(o ...*Order) *UserUpdate

AddOrders adds the "orders" edges to the Order entity.

func (*UserUpdate) ClearAddresses

func (uu *UserUpdate) ClearAddresses() *UserUpdate

ClearAddresses clears all "addresses" edges to the Address entity.

func (*UserUpdate) ClearCarts

func (uu *UserUpdate) ClearCarts() *UserUpdate

ClearCarts clears all "carts" edges to the Cart entity.

func (*UserUpdate) ClearOrders

func (uu *UserUpdate) ClearOrders() *UserUpdate

ClearOrders clears all "orders" edges to the Order entity.

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) RemoveAddressIDs

func (uu *UserUpdate) RemoveAddressIDs(ids ...int64) *UserUpdate

RemoveAddressIDs removes the "addresses" edge to Address entities by IDs.

func (*UserUpdate) RemoveAddresses

func (uu *UserUpdate) RemoveAddresses(a ...*Address) *UserUpdate

RemoveAddresses removes "addresses" edges to Address entities.

func (*UserUpdate) RemoveCartIDs

func (uu *UserUpdate) RemoveCartIDs(ids ...int64) *UserUpdate

RemoveCartIDs removes the "carts" edge to Cart entities by IDs.

func (*UserUpdate) RemoveCarts

func (uu *UserUpdate) RemoveCarts(c ...*Cart) *UserUpdate

RemoveCarts removes "carts" edges to Cart entities.

func (*UserUpdate) RemoveOrderIDs

func (uu *UserUpdate) RemoveOrderIDs(ids ...int64) *UserUpdate

RemoveOrderIDs removes the "orders" edge to Order entities by IDs.

func (*UserUpdate) RemoveOrders

func (uu *UserUpdate) RemoveOrders(o ...*Order) *UserUpdate

RemoveOrders removes "orders" edges to Order entities.

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) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdate) SetNillablePassword

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillablePhone

func (uu *UserUpdate) SetNillablePhone(s *string) *UserUpdate

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdate) SetNillableRole

func (uu *UserUpdate) SetNillableRole(u *user.Role) *UserUpdate

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetPhone

func (uu *UserUpdate) SetPhone(s string) *UserUpdate

SetPhone sets the "phone" field.

func (*UserUpdate) SetRole

func (uu *UserUpdate) SetRole(u user.Role) *UserUpdate

SetRole sets the "role" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" 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) AddAddressIDs

func (uuo *UserUpdateOne) AddAddressIDs(ids ...int64) *UserUpdateOne

AddAddressIDs adds the "addresses" edge to the Address entity by IDs.

func (*UserUpdateOne) AddAddresses

func (uuo *UserUpdateOne) AddAddresses(a ...*Address) *UserUpdateOne

AddAddresses adds the "addresses" edges to the Address entity.

func (*UserUpdateOne) AddCartIDs

func (uuo *UserUpdateOne) AddCartIDs(ids ...int64) *UserUpdateOne

AddCartIDs adds the "carts" edge to the Cart entity by IDs.

func (*UserUpdateOne) AddCarts

func (uuo *UserUpdateOne) AddCarts(c ...*Cart) *UserUpdateOne

AddCarts adds the "carts" edges to the Cart entity.

func (*UserUpdateOne) AddOrderIDs

func (uuo *UserUpdateOne) AddOrderIDs(ids ...int64) *UserUpdateOne

AddOrderIDs adds the "orders" edge to the Order entity by IDs.

func (*UserUpdateOne) AddOrders

func (uuo *UserUpdateOne) AddOrders(o ...*Order) *UserUpdateOne

AddOrders adds the "orders" edges to the Order entity.

func (*UserUpdateOne) ClearAddresses

func (uuo *UserUpdateOne) ClearAddresses() *UserUpdateOne

ClearAddresses clears all "addresses" edges to the Address entity.

func (*UserUpdateOne) ClearCarts

func (uuo *UserUpdateOne) ClearCarts() *UserUpdateOne

ClearCarts clears all "carts" edges to the Cart entity.

func (*UserUpdateOne) ClearOrders

func (uuo *UserUpdateOne) ClearOrders() *UserUpdateOne

ClearOrders clears all "orders" edges to the Order entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAddressIDs

func (uuo *UserUpdateOne) RemoveAddressIDs(ids ...int64) *UserUpdateOne

RemoveAddressIDs removes the "addresses" edge to Address entities by IDs.

func (*UserUpdateOne) RemoveAddresses

func (uuo *UserUpdateOne) RemoveAddresses(a ...*Address) *UserUpdateOne

RemoveAddresses removes "addresses" edges to Address entities.

func (*UserUpdateOne) RemoveCartIDs

func (uuo *UserUpdateOne) RemoveCartIDs(ids ...int64) *UserUpdateOne

RemoveCartIDs removes the "carts" edge to Cart entities by IDs.

func (*UserUpdateOne) RemoveCarts

func (uuo *UserUpdateOne) RemoveCarts(c ...*Cart) *UserUpdateOne

RemoveCarts removes "carts" edges to Cart entities.

func (*UserUpdateOne) RemoveOrderIDs

func (uuo *UserUpdateOne) RemoveOrderIDs(ids ...int64) *UserUpdateOne

RemoveOrderIDs removes the "orders" edge to Order entities by IDs.

func (*UserUpdateOne) RemoveOrders

func (uuo *UserUpdateOne) RemoveOrders(o ...*Order) *UserUpdateOne

RemoveOrders removes "orders" edges to Order entities.

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) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePassword

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePhone

func (uuo *UserUpdateOne) SetNillablePhone(s *string) *UserUpdateOne

SetNillablePhone sets the "phone" field if the given value is not nil.

func (*UserUpdateOne) SetNillableRole

func (uuo *UserUpdateOne) SetNillableRole(u *user.Role) *UserUpdateOne

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetPhone

func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne

SetPhone sets the "phone" field.

func (*UserUpdateOne) SetRole

func (uuo *UserUpdateOne) SetRole(u user.Role) *UserUpdateOne

SetRole sets the "role" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) SetEmail

func (u *UserUpsert) SetEmail(v string) *UserUpsert

SetEmail sets the "email" field.

func (*UserUpsert) SetName

func (u *UserUpsert) SetName(v string) *UserUpsert

SetName sets the "name" field.

func (*UserUpsert) SetPassword

func (u *UserUpsert) SetPassword(v string) *UserUpsert

SetPassword sets the "password" field.

func (*UserUpsert) SetPhone

func (u *UserUpsert) SetPhone(v string) *UserUpsert

SetPhone sets the "phone" field.

func (*UserUpsert) SetRole

func (u *UserUpsert) SetRole(v user.Role) *UserUpsert

SetRole sets the "role" field.

func (*UserUpsert) SetUpdatedAt

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) UpdateEmail

func (u *UserUpsert) UpdateEmail() *UserUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsert) UpdateName

func (u *UserUpsert) UpdateName() *UserUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsert) UpdatePassword

func (u *UserUpsert) UpdatePassword() *UserUpsert

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsert) UpdatePhone

func (u *UserUpsert) UpdatePhone() *UserUpsert

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsert) UpdateRole

func (u *UserUpsert) UpdateRole() *UserUpsert

UpdateRole sets the "role" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedAt

func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type UserUpsertBulk

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX

func (u *UserUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetEmail

func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk

SetEmail sets the "email" field.

func (*UserUpsertBulk) SetName

func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk

SetName sets the "name" field.

func (*UserUpsertBulk) SetPassword

func (u *UserUpsertBulk) SetPassword(v string) *UserUpsertBulk

SetPassword sets the "password" field.

func (*UserUpsertBulk) SetPhone

func (u *UserUpsertBulk) SetPhone(v string) *UserUpsertBulk

SetPhone sets the "phone" field.

func (*UserUpsertBulk) SetRole

func (u *UserUpsertBulk) SetRole(v user.Role) *UserUpsertBulk

SetRole sets the "role" field.

func (*UserUpsertBulk) SetUpdatedAt

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertBulk) Update

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateEmail

func (u *UserUpsertBulk) UpdateEmail() *UserUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateName

func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdatePassword

func (u *UserUpsertBulk) UpdatePassword() *UserUpsertBulk

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertBulk) UpdatePhone

func (u *UserUpsertBulk) UpdatePhone() *UserUpsertBulk

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateRole

func (u *UserUpsertBulk) UpdateRole() *UserUpsertBulk

UpdateRole sets the "role" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedAt

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type UserUpsertOne

type UserUpsertOne struct {
	// contains filtered or unexported fields
}

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX

func (u *UserUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertOne) ID

func (u *UserUpsertOne) ID(ctx context.Context) (id int64, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) int64

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetEmail

func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne

SetEmail sets the "email" field.

func (*UserUpsertOne) SetName

func (u *UserUpsertOne) SetName(v string) *UserUpsertOne

SetName sets the "name" field.

func (*UserUpsertOne) SetPassword

func (u *UserUpsertOne) SetPassword(v string) *UserUpsertOne

SetPassword sets the "password" field.

func (*UserUpsertOne) SetPhone

func (u *UserUpsertOne) SetPhone(v string) *UserUpsertOne

SetPhone sets the "phone" field.

func (*UserUpsertOne) SetRole

func (u *UserUpsertOne) SetRole(v user.Role) *UserUpsertOne

SetRole sets the "role" field.

func (*UserUpsertOne) SetUpdatedAt

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertOne) Update

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateEmail

func (u *UserUpsertOne) UpdateEmail() *UserUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertOne) UpdateName

func (u *UserUpsertOne) UpdateName() *UserUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdatePassword

func (u *UserUpsertOne) UpdatePassword() *UserUpsertOne

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertOne) UpdatePhone

func (u *UserUpsertOne) UpdatePhone() *UserUpsertOne

UpdatePhone sets the "phone" field to the value that was provided on create.

func (*UserUpsertOne) UpdateRole

func (u *UserUpsertOne) UpdateRole() *UserUpsertOne

UpdateRole sets the "role" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedAt

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL