ent

package
v0.0.0-...-4241208 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	// Node types.
	TypeOrder       = "Order"
	TypeTransaction = "Transaction"
	TypeTxItem      = "TxItem"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// Transaction is the client for interacting with the Transaction builders.
	Transaction *TransactionClient
	// TxItem is the client for interacting with the TxItem builders.
	TxItem *TxItemClient
	// 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().
	Order.
	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,主键
	ID int64 `json:"id,omitempty"`
	// 订单编号
	OrderNo string `json:"order_no,omitempty"`
	// 交易ID
	TxID int64 `json:"tx_id,omitempty"`
	// 订单状态
	OrderStatus order.OrderStatus `json:"order_status,omitempty"`
	// 配送地址
	DeliveredAddress string `json:"delivered_address,omitempty"`
	// 运费
	ShippingCost float64 `json:"shipping_cost,omitempty"`
	// 总金额
	TotalAmount float64 `json:"total_amount,omitempty"`
	// 下单用户ID
	PlacedUserID int64 `json:"placed_user_id,omitempty"`
	// 下单时间
	PlacedAt time.Time `json:"placed_at,omitempty"`
	// 发货地址
	ShippedAddress string `json:"shipped_address,omitempty"`
	// 发货时间
	ShippedAt time.Time `json:"shipped_at,omitempty"`
	// 支付ID
	PaymentID int64 `json:"payment_id,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) QueryTransaction

func (o *Order) QueryTransaction() *TransactionQuery

QueryTransaction queries the "transaction" edge of the Order entity.

func (*Order) QueryTxItems

func (o *Order) QueryTxItems() *TxItemQuery

QueryTxItems queries the "txItems" 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) QueryTransaction

func (c *OrderClient) QueryTransaction(o *Order) *TransactionQuery

QueryTransaction queries the transaction edge of a Order.

func (*OrderClient) QueryTxItems

func (c *OrderClient) QueryTxItems(o *Order) *TxItemQuery

QueryTxItems queries the txItems 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) AddTransaction

func (oc *OrderCreate) AddTransaction(t ...*Transaction) *OrderCreate

AddTransaction adds the "transaction" edges to the Transaction entity.

func (*OrderCreate) AddTransactionIDs

func (oc *OrderCreate) AddTransactionIDs(ids ...int64) *OrderCreate

AddTransactionIDs adds the "transaction" edge to the Transaction entity by IDs.

func (*OrderCreate) AddTxItemIDs

func (oc *OrderCreate) AddTxItemIDs(ids ...int64) *OrderCreate

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*OrderCreate) AddTxItems

func (oc *OrderCreate) AddTxItems(t ...*TxItem) *OrderCreate

AddTxItems adds the "txItems" edges to the TxItem 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) 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) SetDeliveredAddress

func (oc *OrderCreate) SetDeliveredAddress(s string) *OrderCreate

SetDeliveredAddress sets the "delivered_address" field.

func (*OrderCreate) SetID

func (oc *OrderCreate) SetID(i int64) *OrderCreate

SetID sets the "id" field.

func (*OrderCreate) SetNillableDeliveredAddress

func (oc *OrderCreate) SetNillableDeliveredAddress(s *string) *OrderCreate

SetNillableDeliveredAddress sets the "delivered_address" field if the given value is not nil.

func (*OrderCreate) SetNillableOrderNo

func (oc *OrderCreate) SetNillableOrderNo(s *string) *OrderCreate

SetNillableOrderNo sets the "order_no" field if the given value is not nil.

func (*OrderCreate) SetNillablePaymentID

func (oc *OrderCreate) SetNillablePaymentID(i *int64) *OrderCreate

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*OrderCreate) SetNillablePlacedAt

func (oc *OrderCreate) SetNillablePlacedAt(t *time.Time) *OrderCreate

SetNillablePlacedAt sets the "placed_at" field if the given value is not nil.

func (*OrderCreate) SetNillableShippedAddress

func (oc *OrderCreate) SetNillableShippedAddress(s *string) *OrderCreate

SetNillableShippedAddress sets the "shipped_address" field if the given value is not nil.

func (*OrderCreate) SetNillableShippedAt

func (oc *OrderCreate) SetNillableShippedAt(t *time.Time) *OrderCreate

SetNillableShippedAt sets the "shipped_at" field if the given value is not nil.

func (*OrderCreate) SetNillableShippingCost

func (oc *OrderCreate) SetNillableShippingCost(f *float64) *OrderCreate

SetNillableShippingCost sets the "shipping_cost" field if the given value is not nil.

func (*OrderCreate) SetNillableTotalAmount

func (oc *OrderCreate) SetNillableTotalAmount(f *float64) *OrderCreate

SetNillableTotalAmount sets the "total_amount" field if the given value is not nil.

func (*OrderCreate) SetOrderNo

func (oc *OrderCreate) SetOrderNo(s string) *OrderCreate

SetOrderNo sets the "order_no" field.

func (*OrderCreate) SetOrderStatus

func (oc *OrderCreate) SetOrderStatus(os order.OrderStatus) *OrderCreate

SetOrderStatus sets the "order_status" field.

func (*OrderCreate) SetPaymentID

func (oc *OrderCreate) SetPaymentID(i int64) *OrderCreate

SetPaymentID sets the "payment_id" field.

func (*OrderCreate) SetPlacedAt

func (oc *OrderCreate) SetPlacedAt(t time.Time) *OrderCreate

SetPlacedAt sets the "placed_at" field.

func (*OrderCreate) SetPlacedUserID

func (oc *OrderCreate) SetPlacedUserID(i int64) *OrderCreate

SetPlacedUserID sets the "placed_user_id" field.

func (*OrderCreate) SetShippedAddress

func (oc *OrderCreate) SetShippedAddress(s string) *OrderCreate

SetShippedAddress sets the "shipped_address" field.

func (*OrderCreate) SetShippedAt

func (oc *OrderCreate) SetShippedAt(t time.Time) *OrderCreate

SetShippedAt sets the "shipped_at" field.

func (*OrderCreate) SetShippingCost

func (oc *OrderCreate) SetShippingCost(f float64) *OrderCreate

SetShippingCost sets the "shipping_cost" field.

func (*OrderCreate) SetTotalAmount

func (oc *OrderCreate) SetTotalAmount(f float64) *OrderCreate

SetTotalAmount sets the "total_amount" field.

func (*OrderCreate) SetTxID

func (oc *OrderCreate) SetTxID(i int64) *OrderCreate

SetTxID sets the "tx_id" field.

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) 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 {
	// Transaction holds the value of the transaction edge.
	Transaction []*Transaction `json:"transaction,omitempty"`
	// TxItems holds the value of the txItems edge.
	TxItems []*TxItem `json:"txItems,omitempty"`
	// contains filtered or unexported fields
}

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

func (OrderEdges) TransactionOrErr

func (e OrderEdges) TransactionOrErr() ([]*Transaction, error)

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

func (OrderEdges) TxItemsOrErr

func (e OrderEdges) TxItemsOrErr() ([]*TxItem, error)

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

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

func (m *OrderMutation) AddPaymentID(i int64)

AddPaymentID adds i to the "payment_id" field.

func (*OrderMutation) AddPlacedUserID

func (m *OrderMutation) AddPlacedUserID(i int64)

AddPlacedUserID adds i to the "placed_user_id" field.

func (*OrderMutation) AddShippingCost

func (m *OrderMutation) AddShippingCost(f float64)

AddShippingCost adds f to the "shipping_cost" field.

func (*OrderMutation) AddTotalAmount

func (m *OrderMutation) AddTotalAmount(f float64)

AddTotalAmount adds f to the "total_amount" field.

func (*OrderMutation) AddTransactionIDs

func (m *OrderMutation) AddTransactionIDs(ids ...int64)

AddTransactionIDs adds the "transaction" edge to the Transaction entity by ids.

func (*OrderMutation) AddTxID

func (m *OrderMutation) AddTxID(i int64)

AddTxID adds i to the "tx_id" field.

func (*OrderMutation) AddTxItemIDs

func (m *OrderMutation) AddTxItemIDs(ids ...int64)

AddTxItemIDs adds the "txItems" edge to the TxItem 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) AddedPaymentID

func (m *OrderMutation) AddedPaymentID() (r int64, exists bool)

AddedPaymentID returns the value that was added to the "payment_id" field in this mutation.

func (*OrderMutation) AddedPlacedUserID

func (m *OrderMutation) AddedPlacedUserID() (r int64, exists bool)

AddedPlacedUserID returns the value that was added to the "placed_user_id" field in this mutation.

func (*OrderMutation) AddedShippingCost

func (m *OrderMutation) AddedShippingCost() (r float64, exists bool)

AddedShippingCost returns the value that was added to the "shipping_cost" field in this mutation.

func (*OrderMutation) AddedTotalAmount

func (m *OrderMutation) AddedTotalAmount() (r float64, exists bool)

AddedTotalAmount returns the value that was added to the "total_amount" field in this mutation.

func (*OrderMutation) AddedTxID

func (m *OrderMutation) AddedTxID() (r int64, exists bool)

AddedTxID returns the value that was added to the "tx_id" field in this mutation.

func (*OrderMutation) ClearDeliveredAddress

func (m *OrderMutation) ClearDeliveredAddress()

ClearDeliveredAddress clears the value of the "delivered_address" field.

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

func (m *OrderMutation) ClearOrderNo()

ClearOrderNo clears the value of the "order_no" field.

func (*OrderMutation) ClearPaymentID

func (m *OrderMutation) ClearPaymentID()

ClearPaymentID clears the value of the "payment_id" field.

func (*OrderMutation) ClearPlacedAt

func (m *OrderMutation) ClearPlacedAt()

ClearPlacedAt clears the value of the "placed_at" field.

func (*OrderMutation) ClearShippedAddress

func (m *OrderMutation) ClearShippedAddress()

ClearShippedAddress clears the value of the "shipped_address" field.

func (*OrderMutation) ClearShippedAt

func (m *OrderMutation) ClearShippedAt()

ClearShippedAt clears the value of the "shipped_at" field.

func (*OrderMutation) ClearShippingCost

func (m *OrderMutation) ClearShippingCost()

ClearShippingCost clears the value of the "shipping_cost" field.

func (*OrderMutation) ClearTotalAmount

func (m *OrderMutation) ClearTotalAmount()

ClearTotalAmount clears the value of the "total_amount" field.

func (*OrderMutation) ClearTransaction

func (m *OrderMutation) ClearTransaction()

ClearTransaction clears the "transaction" edge to the Transaction entity.

func (*OrderMutation) ClearTxItems

func (m *OrderMutation) ClearTxItems()

ClearTxItems clears the "txItems" edge to the TxItem 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) DeliveredAddress

func (m *OrderMutation) DeliveredAddress() (r string, exists bool)

DeliveredAddress returns the value of the "delivered_address" field in the mutation.

func (*OrderMutation) DeliveredAddressCleared

func (m *OrderMutation) DeliveredAddressCleared() bool

DeliveredAddressCleared returns if the "delivered_address" field was cleared in this 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) OldDeliveredAddress

func (m *OrderMutation) OldDeliveredAddress(ctx context.Context) (v string, err error)

OldDeliveredAddress returns the old "delivered_address" 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) OldOrderNo

func (m *OrderMutation) OldOrderNo(ctx context.Context) (v string, err error)

OldOrderNo returns the old "order_no" 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) OldOrderStatus

func (m *OrderMutation) OldOrderStatus(ctx context.Context) (v order.OrderStatus, err error)

OldOrderStatus returns the old "order_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) OldPaymentID

func (m *OrderMutation) OldPaymentID(ctx context.Context) (v int64, err error)

OldPaymentID returns the old "payment_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) OldPlacedAt

func (m *OrderMutation) OldPlacedAt(ctx context.Context) (v time.Time, err error)

OldPlacedAt returns the old "placed_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) OldPlacedUserID

func (m *OrderMutation) OldPlacedUserID(ctx context.Context) (v int64, err error)

OldPlacedUserID returns the old "placed_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) OldShippedAddress

func (m *OrderMutation) OldShippedAddress(ctx context.Context) (v string, err error)

OldShippedAddress returns the old "shipped_address" 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) OldShippedAt

func (m *OrderMutation) OldShippedAt(ctx context.Context) (v time.Time, err error)

OldShippedAt returns the old "shipped_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) OldShippingCost

func (m *OrderMutation) OldShippingCost(ctx context.Context) (v float64, err error)

OldShippingCost returns the old "shipping_cost" 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) OldTotalAmount

func (m *OrderMutation) OldTotalAmount(ctx context.Context) (v float64, err error)

OldTotalAmount returns the old "total_amount" 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) OldTxID

func (m *OrderMutation) OldTxID(ctx context.Context) (v int64, err error)

OldTxID returns the old "tx_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) OrderNo

func (m *OrderMutation) OrderNo() (r string, exists bool)

OrderNo returns the value of the "order_no" field in the mutation.

func (*OrderMutation) OrderNoCleared

func (m *OrderMutation) OrderNoCleared() bool

OrderNoCleared returns if the "order_no" field was cleared in this mutation.

func (*OrderMutation) OrderStatus

func (m *OrderMutation) OrderStatus() (r order.OrderStatus, exists bool)

OrderStatus returns the value of the "order_status" field in the mutation.

func (*OrderMutation) PaymentID

func (m *OrderMutation) PaymentID() (r int64, exists bool)

PaymentID returns the value of the "payment_id" field in the mutation.

func (*OrderMutation) PaymentIDCleared

func (m *OrderMutation) PaymentIDCleared() bool

PaymentIDCleared returns if the "payment_id" field was cleared in this mutation.

func (*OrderMutation) PlacedAt

func (m *OrderMutation) PlacedAt() (r time.Time, exists bool)

PlacedAt returns the value of the "placed_at" field in the mutation.

func (*OrderMutation) PlacedAtCleared

func (m *OrderMutation) PlacedAtCleared() bool

PlacedAtCleared returns if the "placed_at" field was cleared in this mutation.

func (*OrderMutation) PlacedUserID

func (m *OrderMutation) PlacedUserID() (r int64, exists bool)

PlacedUserID returns the value of the "placed_user_id" field in the mutation.

func (*OrderMutation) RemoveTransactionIDs

func (m *OrderMutation) RemoveTransactionIDs(ids ...int64)

RemoveTransactionIDs removes the "transaction" edge to the Transaction entity by IDs.

func (*OrderMutation) RemoveTxItemIDs

func (m *OrderMutation) RemoveTxItemIDs(ids ...int64)

RemoveTxItemIDs removes the "txItems" edge to the TxItem 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) RemovedTransactionIDs

func (m *OrderMutation) RemovedTransactionIDs() (ids []int64)

RemovedTransaction returns the removed IDs of the "transaction" edge to the Transaction entity.

func (*OrderMutation) RemovedTxItemsIDs

func (m *OrderMutation) RemovedTxItemsIDs() (ids []int64)

RemovedTxItems returns the removed IDs of the "txItems" edge to the TxItem entity.

func (*OrderMutation) ResetDeliveredAddress

func (m *OrderMutation) ResetDeliveredAddress()

ResetDeliveredAddress resets all changes to the "delivered_address" 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) ResetOrderNo

func (m *OrderMutation) ResetOrderNo()

ResetOrderNo resets all changes to the "order_no" field.

func (*OrderMutation) ResetOrderStatus

func (m *OrderMutation) ResetOrderStatus()

ResetOrderStatus resets all changes to the "order_status" field.

func (*OrderMutation) ResetPaymentID

func (m *OrderMutation) ResetPaymentID()

ResetPaymentID resets all changes to the "payment_id" field.

func (*OrderMutation) ResetPlacedAt

func (m *OrderMutation) ResetPlacedAt()

ResetPlacedAt resets all changes to the "placed_at" field.

func (*OrderMutation) ResetPlacedUserID

func (m *OrderMutation) ResetPlacedUserID()

ResetPlacedUserID resets all changes to the "placed_user_id" field.

func (*OrderMutation) ResetShippedAddress

func (m *OrderMutation) ResetShippedAddress()

ResetShippedAddress resets all changes to the "shipped_address" field.

func (*OrderMutation) ResetShippedAt

func (m *OrderMutation) ResetShippedAt()

ResetShippedAt resets all changes to the "shipped_at" field.

func (*OrderMutation) ResetShippingCost

func (m *OrderMutation) ResetShippingCost()

ResetShippingCost resets all changes to the "shipping_cost" field.

func (*OrderMutation) ResetTotalAmount

func (m *OrderMutation) ResetTotalAmount()

ResetTotalAmount resets all changes to the "total_amount" field.

func (*OrderMutation) ResetTransaction

func (m *OrderMutation) ResetTransaction()

ResetTransaction resets all changes to the "transaction" edge.

func (*OrderMutation) ResetTxID

func (m *OrderMutation) ResetTxID()

ResetTxID resets all changes to the "tx_id" field.

func (*OrderMutation) ResetTxItems

func (m *OrderMutation) ResetTxItems()

ResetTxItems resets all changes to the "txItems" edge.

func (*OrderMutation) SetDeliveredAddress

func (m *OrderMutation) SetDeliveredAddress(s string)

SetDeliveredAddress sets the "delivered_address" 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) SetID

func (m *OrderMutation) SetID(id int64)

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

func (*OrderMutation) SetOp

func (m *OrderMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*OrderMutation) SetOrderNo

func (m *OrderMutation) SetOrderNo(s string)

SetOrderNo sets the "order_no" field.

func (*OrderMutation) SetOrderStatus

func (m *OrderMutation) SetOrderStatus(os order.OrderStatus)

SetOrderStatus sets the "order_status" field.

func (*OrderMutation) SetPaymentID

func (m *OrderMutation) SetPaymentID(i int64)

SetPaymentID sets the "payment_id" field.

func (*OrderMutation) SetPlacedAt

func (m *OrderMutation) SetPlacedAt(t time.Time)

SetPlacedAt sets the "placed_at" field.

func (*OrderMutation) SetPlacedUserID

func (m *OrderMutation) SetPlacedUserID(i int64)

SetPlacedUserID sets the "placed_user_id" field.

func (*OrderMutation) SetShippedAddress

func (m *OrderMutation) SetShippedAddress(s string)

SetShippedAddress sets the "shipped_address" field.

func (*OrderMutation) SetShippedAt

func (m *OrderMutation) SetShippedAt(t time.Time)

SetShippedAt sets the "shipped_at" field.

func (*OrderMutation) SetShippingCost

func (m *OrderMutation) SetShippingCost(f float64)

SetShippingCost sets the "shipping_cost" field.

func (*OrderMutation) SetTotalAmount

func (m *OrderMutation) SetTotalAmount(f float64)

SetTotalAmount sets the "total_amount" field.

func (*OrderMutation) SetTxID

func (m *OrderMutation) SetTxID(i int64)

SetTxID sets the "tx_id" field.

func (*OrderMutation) ShippedAddress

func (m *OrderMutation) ShippedAddress() (r string, exists bool)

ShippedAddress returns the value of the "shipped_address" field in the mutation.

func (*OrderMutation) ShippedAddressCleared

func (m *OrderMutation) ShippedAddressCleared() bool

ShippedAddressCleared returns if the "shipped_address" field was cleared in this mutation.

func (*OrderMutation) ShippedAt

func (m *OrderMutation) ShippedAt() (r time.Time, exists bool)

ShippedAt returns the value of the "shipped_at" field in the mutation.

func (*OrderMutation) ShippedAtCleared

func (m *OrderMutation) ShippedAtCleared() bool

ShippedAtCleared returns if the "shipped_at" field was cleared in this mutation.

func (*OrderMutation) ShippingCost

func (m *OrderMutation) ShippingCost() (r float64, exists bool)

ShippingCost returns the value of the "shipping_cost" field in the mutation.

func (*OrderMutation) ShippingCostCleared

func (m *OrderMutation) ShippingCostCleared() bool

ShippingCostCleared returns if the "shipping_cost" field was cleared in this mutation.

func (*OrderMutation) TotalAmount

func (m *OrderMutation) TotalAmount() (r float64, exists bool)

TotalAmount returns the value of the "total_amount" field in the mutation.

func (*OrderMutation) TotalAmountCleared

func (m *OrderMutation) TotalAmountCleared() bool

TotalAmountCleared returns if the "total_amount" field was cleared in this mutation.

func (*OrderMutation) TransactionCleared

func (m *OrderMutation) TransactionCleared() bool

TransactionCleared reports if the "transaction" edge to the Transaction entity was cleared.

func (*OrderMutation) TransactionIDs

func (m *OrderMutation) TransactionIDs() (ids []int64)

TransactionIDs returns the "transaction" edge IDs 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) TxID

func (m *OrderMutation) TxID() (r int64, exists bool)

TxID returns the value of the "tx_id" field in the mutation.

func (*OrderMutation) TxItemsCleared

func (m *OrderMutation) TxItemsCleared() bool

TxItemsCleared reports if the "txItems" edge to the TxItem entity was cleared.

func (*OrderMutation) TxItemsIDs

func (m *OrderMutation) TxItemsIDs() (ids []int64)

TxItemsIDs returns the "txItems" edge IDs in the mutation.

func (*OrderMutation) Type

func (m *OrderMutation) Type() string

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

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

client.Order.Query().
	GroupBy(order.FieldOrderNo).
	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) QueryTransaction

func (oq *OrderQuery) QueryTransaction() *TransactionQuery

QueryTransaction chains the current query on the "transaction" edge.

func (*OrderQuery) QueryTxItems

func (oq *OrderQuery) QueryTxItems() *TxItemQuery

QueryTxItems chains the current query on the "txItems" 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 {
	OrderNo string `json:"order_no,omitempty"`
}

client.Order.Query().
	Select(order.FieldOrderNo).
	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) WithTransaction

func (oq *OrderQuery) WithTransaction(opts ...func(*TransactionQuery)) *OrderQuery

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

func (*OrderQuery) WithTxItems

func (oq *OrderQuery) WithTxItems(opts ...func(*TxItemQuery)) *OrderQuery

WithTxItems tells the query-builder to eager-load the nodes that are connected to the "txItems" 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) AddPaymentID

func (ou *OrderUpdate) AddPaymentID(i int64) *OrderUpdate

AddPaymentID adds i to the "payment_id" field.

func (*OrderUpdate) AddPlacedUserID

func (ou *OrderUpdate) AddPlacedUserID(i int64) *OrderUpdate

AddPlacedUserID adds i to the "placed_user_id" field.

func (*OrderUpdate) AddShippingCost

func (ou *OrderUpdate) AddShippingCost(f float64) *OrderUpdate

AddShippingCost adds f to the "shipping_cost" field.

func (*OrderUpdate) AddTotalAmount

func (ou *OrderUpdate) AddTotalAmount(f float64) *OrderUpdate

AddTotalAmount adds f to the "total_amount" field.

func (*OrderUpdate) AddTransaction

func (ou *OrderUpdate) AddTransaction(t ...*Transaction) *OrderUpdate

AddTransaction adds the "transaction" edges to the Transaction entity.

func (*OrderUpdate) AddTransactionIDs

func (ou *OrderUpdate) AddTransactionIDs(ids ...int64) *OrderUpdate

AddTransactionIDs adds the "transaction" edge to the Transaction entity by IDs.

func (*OrderUpdate) AddTxID

func (ou *OrderUpdate) AddTxID(i int64) *OrderUpdate

AddTxID adds i to the "tx_id" field.

func (*OrderUpdate) AddTxItemIDs

func (ou *OrderUpdate) AddTxItemIDs(ids ...int64) *OrderUpdate

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*OrderUpdate) AddTxItems

func (ou *OrderUpdate) AddTxItems(t ...*TxItem) *OrderUpdate

AddTxItems adds the "txItems" edges to the TxItem entity.

func (*OrderUpdate) ClearDeliveredAddress

func (ou *OrderUpdate) ClearDeliveredAddress() *OrderUpdate

ClearDeliveredAddress clears the value of the "delivered_address" field.

func (*OrderUpdate) ClearOrderNo

func (ou *OrderUpdate) ClearOrderNo() *OrderUpdate

ClearOrderNo clears the value of the "order_no" field.

func (*OrderUpdate) ClearPaymentID

func (ou *OrderUpdate) ClearPaymentID() *OrderUpdate

ClearPaymentID clears the value of the "payment_id" field.

func (*OrderUpdate) ClearPlacedAt

func (ou *OrderUpdate) ClearPlacedAt() *OrderUpdate

ClearPlacedAt clears the value of the "placed_at" field.

func (*OrderUpdate) ClearShippedAddress

func (ou *OrderUpdate) ClearShippedAddress() *OrderUpdate

ClearShippedAddress clears the value of the "shipped_address" field.

func (*OrderUpdate) ClearShippedAt

func (ou *OrderUpdate) ClearShippedAt() *OrderUpdate

ClearShippedAt clears the value of the "shipped_at" field.

func (*OrderUpdate) ClearShippingCost

func (ou *OrderUpdate) ClearShippingCost() *OrderUpdate

ClearShippingCost clears the value of the "shipping_cost" field.

func (*OrderUpdate) ClearTotalAmount

func (ou *OrderUpdate) ClearTotalAmount() *OrderUpdate

ClearTotalAmount clears the value of the "total_amount" field.

func (*OrderUpdate) ClearTransaction

func (ou *OrderUpdate) ClearTransaction() *OrderUpdate

ClearTransaction clears all "transaction" edges to the Transaction entity.

func (*OrderUpdate) ClearTxItems

func (ou *OrderUpdate) ClearTxItems() *OrderUpdate

ClearTxItems clears all "txItems" edges to the TxItem 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) RemoveTransaction

func (ou *OrderUpdate) RemoveTransaction(t ...*Transaction) *OrderUpdate

RemoveTransaction removes "transaction" edges to Transaction entities.

func (*OrderUpdate) RemoveTransactionIDs

func (ou *OrderUpdate) RemoveTransactionIDs(ids ...int64) *OrderUpdate

RemoveTransactionIDs removes the "transaction" edge to Transaction entities by IDs.

func (*OrderUpdate) RemoveTxItemIDs

func (ou *OrderUpdate) RemoveTxItemIDs(ids ...int64) *OrderUpdate

RemoveTxItemIDs removes the "txItems" edge to TxItem entities by IDs.

func (*OrderUpdate) RemoveTxItems

func (ou *OrderUpdate) RemoveTxItems(t ...*TxItem) *OrderUpdate

RemoveTxItems removes "txItems" edges to TxItem 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) SetDeliveredAddress

func (ou *OrderUpdate) SetDeliveredAddress(s string) *OrderUpdate

SetDeliveredAddress sets the "delivered_address" field.

func (*OrderUpdate) SetNillableDeliveredAddress

func (ou *OrderUpdate) SetNillableDeliveredAddress(s *string) *OrderUpdate

SetNillableDeliveredAddress sets the "delivered_address" field if the given value is not nil.

func (*OrderUpdate) SetNillableOrderNo

func (ou *OrderUpdate) SetNillableOrderNo(s *string) *OrderUpdate

SetNillableOrderNo sets the "order_no" field if the given value is not nil.

func (*OrderUpdate) SetNillableOrderStatus

func (ou *OrderUpdate) SetNillableOrderStatus(os *order.OrderStatus) *OrderUpdate

SetNillableOrderStatus sets the "order_status" field if the given value is not nil.

func (*OrderUpdate) SetNillablePaymentID

func (ou *OrderUpdate) SetNillablePaymentID(i *int64) *OrderUpdate

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*OrderUpdate) SetNillablePlacedAt

func (ou *OrderUpdate) SetNillablePlacedAt(t *time.Time) *OrderUpdate

SetNillablePlacedAt sets the "placed_at" field if the given value is not nil.

func (*OrderUpdate) SetNillablePlacedUserID

func (ou *OrderUpdate) SetNillablePlacedUserID(i *int64) *OrderUpdate

SetNillablePlacedUserID sets the "placed_user_id" field if the given value is not nil.

func (*OrderUpdate) SetNillableShippedAddress

func (ou *OrderUpdate) SetNillableShippedAddress(s *string) *OrderUpdate

SetNillableShippedAddress sets the "shipped_address" field if the given value is not nil.

func (*OrderUpdate) SetNillableShippedAt

func (ou *OrderUpdate) SetNillableShippedAt(t *time.Time) *OrderUpdate

SetNillableShippedAt sets the "shipped_at" field if the given value is not nil.

func (*OrderUpdate) SetNillableShippingCost

func (ou *OrderUpdate) SetNillableShippingCost(f *float64) *OrderUpdate

SetNillableShippingCost sets the "shipping_cost" field if the given value is not nil.

func (*OrderUpdate) SetNillableTotalAmount

func (ou *OrderUpdate) SetNillableTotalAmount(f *float64) *OrderUpdate

SetNillableTotalAmount sets the "total_amount" field if the given value is not nil.

func (*OrderUpdate) SetNillableTxID

func (ou *OrderUpdate) SetNillableTxID(i *int64) *OrderUpdate

SetNillableTxID sets the "tx_id" field if the given value is not nil.

func (*OrderUpdate) SetOrderNo

func (ou *OrderUpdate) SetOrderNo(s string) *OrderUpdate

SetOrderNo sets the "order_no" field.

func (*OrderUpdate) SetOrderStatus

func (ou *OrderUpdate) SetOrderStatus(os order.OrderStatus) *OrderUpdate

SetOrderStatus sets the "order_status" field.

func (*OrderUpdate) SetPaymentID

func (ou *OrderUpdate) SetPaymentID(i int64) *OrderUpdate

SetPaymentID sets the "payment_id" field.

func (*OrderUpdate) SetPlacedAt

func (ou *OrderUpdate) SetPlacedAt(t time.Time) *OrderUpdate

SetPlacedAt sets the "placed_at" field.

func (*OrderUpdate) SetPlacedUserID

func (ou *OrderUpdate) SetPlacedUserID(i int64) *OrderUpdate

SetPlacedUserID sets the "placed_user_id" field.

func (*OrderUpdate) SetShippedAddress

func (ou *OrderUpdate) SetShippedAddress(s string) *OrderUpdate

SetShippedAddress sets the "shipped_address" field.

func (*OrderUpdate) SetShippedAt

func (ou *OrderUpdate) SetShippedAt(t time.Time) *OrderUpdate

SetShippedAt sets the "shipped_at" field.

func (*OrderUpdate) SetShippingCost

func (ou *OrderUpdate) SetShippingCost(f float64) *OrderUpdate

SetShippingCost sets the "shipping_cost" field.

func (*OrderUpdate) SetTotalAmount

func (ou *OrderUpdate) SetTotalAmount(f float64) *OrderUpdate

SetTotalAmount sets the "total_amount" field.

func (*OrderUpdate) SetTxID

func (ou *OrderUpdate) SetTxID(i int64) *OrderUpdate

SetTxID sets the "tx_id" field.

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

func (ouo *OrderUpdateOne) AddPaymentID(i int64) *OrderUpdateOne

AddPaymentID adds i to the "payment_id" field.

func (*OrderUpdateOne) AddPlacedUserID

func (ouo *OrderUpdateOne) AddPlacedUserID(i int64) *OrderUpdateOne

AddPlacedUserID adds i to the "placed_user_id" field.

func (*OrderUpdateOne) AddShippingCost

func (ouo *OrderUpdateOne) AddShippingCost(f float64) *OrderUpdateOne

AddShippingCost adds f to the "shipping_cost" field.

func (*OrderUpdateOne) AddTotalAmount

func (ouo *OrderUpdateOne) AddTotalAmount(f float64) *OrderUpdateOne

AddTotalAmount adds f to the "total_amount" field.

func (*OrderUpdateOne) AddTransaction

func (ouo *OrderUpdateOne) AddTransaction(t ...*Transaction) *OrderUpdateOne

AddTransaction adds the "transaction" edges to the Transaction entity.

func (*OrderUpdateOne) AddTransactionIDs

func (ouo *OrderUpdateOne) AddTransactionIDs(ids ...int64) *OrderUpdateOne

AddTransactionIDs adds the "transaction" edge to the Transaction entity by IDs.

func (*OrderUpdateOne) AddTxID

func (ouo *OrderUpdateOne) AddTxID(i int64) *OrderUpdateOne

AddTxID adds i to the "tx_id" field.

func (*OrderUpdateOne) AddTxItemIDs

func (ouo *OrderUpdateOne) AddTxItemIDs(ids ...int64) *OrderUpdateOne

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*OrderUpdateOne) AddTxItems

func (ouo *OrderUpdateOne) AddTxItems(t ...*TxItem) *OrderUpdateOne

AddTxItems adds the "txItems" edges to the TxItem entity.

func (*OrderUpdateOne) ClearDeliveredAddress

func (ouo *OrderUpdateOne) ClearDeliveredAddress() *OrderUpdateOne

ClearDeliveredAddress clears the value of the "delivered_address" field.

func (*OrderUpdateOne) ClearOrderNo

func (ouo *OrderUpdateOne) ClearOrderNo() *OrderUpdateOne

ClearOrderNo clears the value of the "order_no" field.

func (*OrderUpdateOne) ClearPaymentID

func (ouo *OrderUpdateOne) ClearPaymentID() *OrderUpdateOne

ClearPaymentID clears the value of the "payment_id" field.

func (*OrderUpdateOne) ClearPlacedAt

func (ouo *OrderUpdateOne) ClearPlacedAt() *OrderUpdateOne

ClearPlacedAt clears the value of the "placed_at" field.

func (*OrderUpdateOne) ClearShippedAddress

func (ouo *OrderUpdateOne) ClearShippedAddress() *OrderUpdateOne

ClearShippedAddress clears the value of the "shipped_address" field.

func (*OrderUpdateOne) ClearShippedAt

func (ouo *OrderUpdateOne) ClearShippedAt() *OrderUpdateOne

ClearShippedAt clears the value of the "shipped_at" field.

func (*OrderUpdateOne) ClearShippingCost

func (ouo *OrderUpdateOne) ClearShippingCost() *OrderUpdateOne

ClearShippingCost clears the value of the "shipping_cost" field.

func (*OrderUpdateOne) ClearTotalAmount

func (ouo *OrderUpdateOne) ClearTotalAmount() *OrderUpdateOne

ClearTotalAmount clears the value of the "total_amount" field.

func (*OrderUpdateOne) ClearTransaction

func (ouo *OrderUpdateOne) ClearTransaction() *OrderUpdateOne

ClearTransaction clears all "transaction" edges to the Transaction entity.

func (*OrderUpdateOne) ClearTxItems

func (ouo *OrderUpdateOne) ClearTxItems() *OrderUpdateOne

ClearTxItems clears all "txItems" edges to the TxItem 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) RemoveTransaction

func (ouo *OrderUpdateOne) RemoveTransaction(t ...*Transaction) *OrderUpdateOne

RemoveTransaction removes "transaction" edges to Transaction entities.

func (*OrderUpdateOne) RemoveTransactionIDs

func (ouo *OrderUpdateOne) RemoveTransactionIDs(ids ...int64) *OrderUpdateOne

RemoveTransactionIDs removes the "transaction" edge to Transaction entities by IDs.

func (*OrderUpdateOne) RemoveTxItemIDs

func (ouo *OrderUpdateOne) RemoveTxItemIDs(ids ...int64) *OrderUpdateOne

RemoveTxItemIDs removes the "txItems" edge to TxItem entities by IDs.

func (*OrderUpdateOne) RemoveTxItems

func (ouo *OrderUpdateOne) RemoveTxItems(t ...*TxItem) *OrderUpdateOne

RemoveTxItems removes "txItems" edges to TxItem 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) SetDeliveredAddress

func (ouo *OrderUpdateOne) SetDeliveredAddress(s string) *OrderUpdateOne

SetDeliveredAddress sets the "delivered_address" field.

func (*OrderUpdateOne) SetNillableDeliveredAddress

func (ouo *OrderUpdateOne) SetNillableDeliveredAddress(s *string) *OrderUpdateOne

SetNillableDeliveredAddress sets the "delivered_address" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableOrderNo

func (ouo *OrderUpdateOne) SetNillableOrderNo(s *string) *OrderUpdateOne

SetNillableOrderNo sets the "order_no" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableOrderStatus

func (ouo *OrderUpdateOne) SetNillableOrderStatus(os *order.OrderStatus) *OrderUpdateOne

SetNillableOrderStatus sets the "order_status" field if the given value is not nil.

func (*OrderUpdateOne) SetNillablePaymentID

func (ouo *OrderUpdateOne) SetNillablePaymentID(i *int64) *OrderUpdateOne

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*OrderUpdateOne) SetNillablePlacedAt

func (ouo *OrderUpdateOne) SetNillablePlacedAt(t *time.Time) *OrderUpdateOne

SetNillablePlacedAt sets the "placed_at" field if the given value is not nil.

func (*OrderUpdateOne) SetNillablePlacedUserID

func (ouo *OrderUpdateOne) SetNillablePlacedUserID(i *int64) *OrderUpdateOne

SetNillablePlacedUserID sets the "placed_user_id" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableShippedAddress

func (ouo *OrderUpdateOne) SetNillableShippedAddress(s *string) *OrderUpdateOne

SetNillableShippedAddress sets the "shipped_address" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableShippedAt

func (ouo *OrderUpdateOne) SetNillableShippedAt(t *time.Time) *OrderUpdateOne

SetNillableShippedAt sets the "shipped_at" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableShippingCost

func (ouo *OrderUpdateOne) SetNillableShippingCost(f *float64) *OrderUpdateOne

SetNillableShippingCost sets the "shipping_cost" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableTotalAmount

func (ouo *OrderUpdateOne) SetNillableTotalAmount(f *float64) *OrderUpdateOne

SetNillableTotalAmount sets the "total_amount" field if the given value is not nil.

func (*OrderUpdateOne) SetNillableTxID

func (ouo *OrderUpdateOne) SetNillableTxID(i *int64) *OrderUpdateOne

SetNillableTxID sets the "tx_id" field if the given value is not nil.

func (*OrderUpdateOne) SetOrderNo

func (ouo *OrderUpdateOne) SetOrderNo(s string) *OrderUpdateOne

SetOrderNo sets the "order_no" field.

func (*OrderUpdateOne) SetOrderStatus

func (ouo *OrderUpdateOne) SetOrderStatus(os order.OrderStatus) *OrderUpdateOne

SetOrderStatus sets the "order_status" field.

func (*OrderUpdateOne) SetPaymentID

func (ouo *OrderUpdateOne) SetPaymentID(i int64) *OrderUpdateOne

SetPaymentID sets the "payment_id" field.

func (*OrderUpdateOne) SetPlacedAt

func (ouo *OrderUpdateOne) SetPlacedAt(t time.Time) *OrderUpdateOne

SetPlacedAt sets the "placed_at" field.

func (*OrderUpdateOne) SetPlacedUserID

func (ouo *OrderUpdateOne) SetPlacedUserID(i int64) *OrderUpdateOne

SetPlacedUserID sets the "placed_user_id" field.

func (*OrderUpdateOne) SetShippedAddress

func (ouo *OrderUpdateOne) SetShippedAddress(s string) *OrderUpdateOne

SetShippedAddress sets the "shipped_address" field.

func (*OrderUpdateOne) SetShippedAt

func (ouo *OrderUpdateOne) SetShippedAt(t time.Time) *OrderUpdateOne

SetShippedAt sets the "shipped_at" field.

func (*OrderUpdateOne) SetShippingCost

func (ouo *OrderUpdateOne) SetShippingCost(f float64) *OrderUpdateOne

SetShippingCost sets the "shipping_cost" field.

func (*OrderUpdateOne) SetTotalAmount

func (ouo *OrderUpdateOne) SetTotalAmount(f float64) *OrderUpdateOne

SetTotalAmount sets the "total_amount" field.

func (*OrderUpdateOne) SetTxID

func (ouo *OrderUpdateOne) SetTxID(i int64) *OrderUpdateOne

SetTxID sets the "tx_id" field.

func (*OrderUpdateOne) Where

func (ouo *OrderUpdateOne) Where(ps ...predicate.Order) *OrderUpdateOne

Where appends a list predicates to the OrderUpdate builder.

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 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 Transaction

type Transaction struct {

	// ID of the ent.
	// 交易ID,主键
	ID int64 `json:"id,omitempty"`
	// 交易编号
	TxNo string `json:"tx_no,omitempty"`
	// 交易类型(买或卖)
	TxType transaction.TxType `json:"tx_type,omitempty"`
	// 用户ID
	UserID int64 `json:"user_id,omitempty"`
	// 交易数量
	Quantity int `json:"quantity,omitempty"`
	// 交易状态
	TxStatus transaction.TxStatus `json:"tx_status,omitempty"`
	// 交易日期
	TxDate time.Time `json:"tx_date,omitempty"`
	// 交易金额
	TxAmount float64 `json:"tx_amount,omitempty"`
	// 支付ID
	PaymentID int64 `json:"payment_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TransactionQuery when eager-loading is set.
	Edges TransactionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Transaction is the model entity for the Transaction schema.

func (*Transaction) QueryTxItems

func (t *Transaction) QueryTxItems() *TxItemQuery

QueryTxItems queries the "txItems" edge of the Transaction entity.

func (*Transaction) QueryTxOrder

func (t *Transaction) QueryTxOrder() *OrderQuery

QueryTxOrder queries the "txOrder" edge of the Transaction entity.

func (*Transaction) String

func (t *Transaction) String() string

String implements the fmt.Stringer.

func (*Transaction) Unwrap

func (t *Transaction) Unwrap() *Transaction

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

func (t *Transaction) Update() *TransactionUpdateOne

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

func (*Transaction) Value

func (t *Transaction) Value(name string) (ent.Value, error)

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

type TransactionClient

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

TransactionClient is a client for the Transaction schema.

func NewTransactionClient

func NewTransactionClient(c config) *TransactionClient

NewTransactionClient returns a client for the Transaction from the given config.

func (*TransactionClient) Create

func (c *TransactionClient) Create() *TransactionCreate

Create returns a builder for creating a Transaction entity.

func (*TransactionClient) CreateBulk

func (c *TransactionClient) CreateBulk(builders ...*TransactionCreate) *TransactionCreateBulk

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

func (*TransactionClient) Delete

func (c *TransactionClient) Delete() *TransactionDelete

Delete returns a delete builder for Transaction.

func (*TransactionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TransactionClient) DeleteOneID

func (c *TransactionClient) DeleteOneID(id int64) *TransactionDeleteOne

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

func (*TransactionClient) Get

Get returns a Transaction entity by its id.

func (*TransactionClient) GetX

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

func (*TransactionClient) Hooks

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

Hooks returns the client hooks.

func (*TransactionClient) Intercept

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

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

func (*TransactionClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TransactionClient) MapCreateBulk

func (c *TransactionClient) MapCreateBulk(slice any, setFunc func(*TransactionCreate, int)) *TransactionCreateBulk

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

func (c *TransactionClient) Query() *TransactionQuery

Query returns a query builder for Transaction.

func (*TransactionClient) QueryTxItems

func (c *TransactionClient) QueryTxItems(t *Transaction) *TxItemQuery

QueryTxItems queries the txItems edge of a Transaction.

func (*TransactionClient) QueryTxOrder

func (c *TransactionClient) QueryTxOrder(t *Transaction) *OrderQuery

QueryTxOrder queries the txOrder edge of a Transaction.

func (*TransactionClient) Update

func (c *TransactionClient) Update() *TransactionUpdate

Update returns an update builder for Transaction.

func (*TransactionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*TransactionClient) UpdateOneID

func (c *TransactionClient) UpdateOneID(id int64) *TransactionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TransactionClient) Use

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

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

type TransactionCreate

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

TransactionCreate is the builder for creating a Transaction entity.

func (*TransactionCreate) AddTxItemIDs

func (tc *TransactionCreate) AddTxItemIDs(ids ...int64) *TransactionCreate

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*TransactionCreate) AddTxItems

func (tc *TransactionCreate) AddTxItems(t ...*TxItem) *TransactionCreate

AddTxItems adds the "txItems" edges to the TxItem entity.

func (*TransactionCreate) AddTxOrder

func (tc *TransactionCreate) AddTxOrder(o ...*Order) *TransactionCreate

AddTxOrder adds the "txOrder" edges to the Order entity.

func (*TransactionCreate) AddTxOrderIDs

func (tc *TransactionCreate) AddTxOrderIDs(ids ...int64) *TransactionCreate

AddTxOrderIDs adds the "txOrder" edge to the Order entity by IDs.

func (*TransactionCreate) Exec

func (tc *TransactionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TransactionCreate) ExecX

func (tc *TransactionCreate) ExecX(ctx context.Context)

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

func (*TransactionCreate) Mutation

func (tc *TransactionCreate) Mutation() *TransactionMutation

Mutation returns the TransactionMutation object of the builder.

func (*TransactionCreate) Save

Save creates the Transaction in the database.

func (*TransactionCreate) SaveX

func (tc *TransactionCreate) SaveX(ctx context.Context) *Transaction

SaveX calls Save and panics if Save returns an error.

func (*TransactionCreate) SetID

SetID sets the "id" field.

func (*TransactionCreate) SetNillablePaymentID

func (tc *TransactionCreate) SetNillablePaymentID(i *int64) *TransactionCreate

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*TransactionCreate) SetNillableTxAmount

func (tc *TransactionCreate) SetNillableTxAmount(f *float64) *TransactionCreate

SetNillableTxAmount sets the "tx_amount" field if the given value is not nil.

func (*TransactionCreate) SetNillableTxDate

func (tc *TransactionCreate) SetNillableTxDate(t *time.Time) *TransactionCreate

SetNillableTxDate sets the "tx_date" field if the given value is not nil.

func (*TransactionCreate) SetPaymentID

func (tc *TransactionCreate) SetPaymentID(i int64) *TransactionCreate

SetPaymentID sets the "payment_id" field.

func (*TransactionCreate) SetQuantity

func (tc *TransactionCreate) SetQuantity(i int) *TransactionCreate

SetQuantity sets the "quantity" field.

func (*TransactionCreate) SetTxAmount

func (tc *TransactionCreate) SetTxAmount(f float64) *TransactionCreate

SetTxAmount sets the "tx_amount" field.

func (*TransactionCreate) SetTxDate

func (tc *TransactionCreate) SetTxDate(t time.Time) *TransactionCreate

SetTxDate sets the "tx_date" field.

func (*TransactionCreate) SetTxNo

func (tc *TransactionCreate) SetTxNo(s string) *TransactionCreate

SetTxNo sets the "tx_no" field.

func (*TransactionCreate) SetTxStatus

SetTxStatus sets the "tx_status" field.

func (*TransactionCreate) SetTxType

SetTxType sets the "tx_type" field.

func (*TransactionCreate) SetUserID

func (tc *TransactionCreate) SetUserID(i int64) *TransactionCreate

SetUserID sets the "user_id" field.

type TransactionCreateBulk

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

TransactionCreateBulk is the builder for creating many Transaction entities in bulk.

func (*TransactionCreateBulk) Exec

func (tcb *TransactionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TransactionCreateBulk) ExecX

func (tcb *TransactionCreateBulk) ExecX(ctx context.Context)

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

func (*TransactionCreateBulk) Save

func (tcb *TransactionCreateBulk) Save(ctx context.Context) ([]*Transaction, error)

Save creates the Transaction entities in the database.

func (*TransactionCreateBulk) SaveX

func (tcb *TransactionCreateBulk) SaveX(ctx context.Context) []*Transaction

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

type TransactionDelete

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

TransactionDelete is the builder for deleting a Transaction entity.

func (*TransactionDelete) Exec

func (td *TransactionDelete) Exec(ctx context.Context) (int, error)

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

func (*TransactionDelete) ExecX

func (td *TransactionDelete) ExecX(ctx context.Context) int

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

func (*TransactionDelete) Where

Where appends a list predicates to the TransactionDelete builder.

type TransactionDeleteOne

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

TransactionDeleteOne is the builder for deleting a single Transaction entity.

func (*TransactionDeleteOne) Exec

func (tdo *TransactionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TransactionDeleteOne) ExecX

func (tdo *TransactionDeleteOne) ExecX(ctx context.Context)

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

func (*TransactionDeleteOne) Where

Where appends a list predicates to the TransactionDelete builder.

type TransactionEdges

type TransactionEdges struct {
	// TxItems holds the value of the txItems edge.
	TxItems []*TxItem `json:"txItems,omitempty"`
	// TxOrder holds the value of the txOrder edge.
	TxOrder []*Order `json:"txOrder,omitempty"`
	// contains filtered or unexported fields
}

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

func (TransactionEdges) TxItemsOrErr

func (e TransactionEdges) TxItemsOrErr() ([]*TxItem, error)

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

func (TransactionEdges) TxOrderOrErr

func (e TransactionEdges) TxOrderOrErr() ([]*Order, error)

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

type TransactionGroupBy

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

TransactionGroupBy is the group-by builder for Transaction entities.

func (*TransactionGroupBy) Aggregate

func (tgb *TransactionGroupBy) Aggregate(fns ...AggregateFunc) *TransactionGroupBy

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

func (*TransactionGroupBy) Bool

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

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

func (*TransactionGroupBy) BoolX

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

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

func (*TransactionGroupBy) Bools

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

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

func (*TransactionGroupBy) BoolsX

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

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

func (*TransactionGroupBy) Float64

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

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

func (*TransactionGroupBy) Float64X

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

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

func (*TransactionGroupBy) Float64s

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

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

func (*TransactionGroupBy) Float64sX

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

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

func (*TransactionGroupBy) Int

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

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

func (*TransactionGroupBy) IntX

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

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

func (*TransactionGroupBy) Ints

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

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

func (*TransactionGroupBy) IntsX

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

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

func (*TransactionGroupBy) Scan

func (tgb *TransactionGroupBy) Scan(ctx context.Context, v any) error

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

func (*TransactionGroupBy) ScanX

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

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

func (*TransactionGroupBy) String

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

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

func (*TransactionGroupBy) StringX

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

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

func (*TransactionGroupBy) Strings

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

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

func (*TransactionGroupBy) StringsX

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

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

type TransactionMutation

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

TransactionMutation represents an operation that mutates the Transaction nodes in the graph.

func (*TransactionMutation) AddField

func (m *TransactionMutation) 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 (*TransactionMutation) AddPaymentID

func (m *TransactionMutation) AddPaymentID(i int64)

AddPaymentID adds i to the "payment_id" field.

func (*TransactionMutation) AddQuantity

func (m *TransactionMutation) AddQuantity(i int)

AddQuantity adds i to the "quantity" field.

func (*TransactionMutation) AddTxAmount

func (m *TransactionMutation) AddTxAmount(f float64)

AddTxAmount adds f to the "tx_amount" field.

func (*TransactionMutation) AddTxItemIDs

func (m *TransactionMutation) AddTxItemIDs(ids ...int64)

AddTxItemIDs adds the "txItems" edge to the TxItem entity by ids.

func (*TransactionMutation) AddTxOrderIDs

func (m *TransactionMutation) AddTxOrderIDs(ids ...int64)

AddTxOrderIDs adds the "txOrder" edge to the Order entity by ids.

func (*TransactionMutation) AddUserID

func (m *TransactionMutation) AddUserID(i int64)

AddUserID adds i to the "user_id" field.

func (*TransactionMutation) AddedEdges

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

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

func (*TransactionMutation) AddedField

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

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

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

func (*TransactionMutation) AddedIDs

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

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

func (*TransactionMutation) AddedPaymentID

func (m *TransactionMutation) AddedPaymentID() (r int64, exists bool)

AddedPaymentID returns the value that was added to the "payment_id" field in this mutation.

func (*TransactionMutation) AddedQuantity

func (m *TransactionMutation) AddedQuantity() (r int, exists bool)

AddedQuantity returns the value that was added to the "quantity" field in this mutation.

func (*TransactionMutation) AddedTxAmount

func (m *TransactionMutation) AddedTxAmount() (r float64, exists bool)

AddedTxAmount returns the value that was added to the "tx_amount" field in this mutation.

func (*TransactionMutation) AddedUserID

func (m *TransactionMutation) AddedUserID() (r int64, exists bool)

AddedUserID returns the value that was added to the "user_id" field in this mutation.

func (*TransactionMutation) ClearEdge

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

func (m *TransactionMutation) 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 (*TransactionMutation) ClearPaymentID

func (m *TransactionMutation) ClearPaymentID()

ClearPaymentID clears the value of the "payment_id" field.

func (*TransactionMutation) ClearTxAmount

func (m *TransactionMutation) ClearTxAmount()

ClearTxAmount clears the value of the "tx_amount" field.

func (*TransactionMutation) ClearTxDate

func (m *TransactionMutation) ClearTxDate()

ClearTxDate clears the value of the "tx_date" field.

func (*TransactionMutation) ClearTxItems

func (m *TransactionMutation) ClearTxItems()

ClearTxItems clears the "txItems" edge to the TxItem entity.

func (*TransactionMutation) ClearTxOrder

func (m *TransactionMutation) ClearTxOrder()

ClearTxOrder clears the "txOrder" edge to the Order entity.

func (*TransactionMutation) ClearedEdges

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

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

func (*TransactionMutation) ClearedFields

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

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

func (TransactionMutation) Client

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

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

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

func (*TransactionMutation) Field

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

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

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

func (*TransactionMutation) Fields

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

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

func (m *TransactionMutation) 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 (*TransactionMutation) OldField

func (m *TransactionMutation) 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 (*TransactionMutation) OldPaymentID

func (m *TransactionMutation) OldPaymentID(ctx context.Context) (v int64, err error)

OldPaymentID returns the old "payment_id" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldQuantity

func (m *TransactionMutation) OldQuantity(ctx context.Context) (v int, err error)

OldQuantity returns the old "quantity" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldTxAmount

func (m *TransactionMutation) OldTxAmount(ctx context.Context) (v float64, err error)

OldTxAmount returns the old "tx_amount" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldTxDate

func (m *TransactionMutation) OldTxDate(ctx context.Context) (v time.Time, err error)

OldTxDate returns the old "tx_date" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldTxNo

func (m *TransactionMutation) OldTxNo(ctx context.Context) (v string, err error)

OldTxNo returns the old "tx_no" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldTxStatus

func (m *TransactionMutation) OldTxStatus(ctx context.Context) (v transaction.TxStatus, err error)

OldTxStatus returns the old "tx_status" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldTxType

func (m *TransactionMutation) OldTxType(ctx context.Context) (v transaction.TxType, err error)

OldTxType returns the old "tx_type" field's value of the Transaction entity. If the Transaction 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 (*TransactionMutation) OldUserID

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

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

func (m *TransactionMutation) Op() Op

Op returns the operation name.

func (*TransactionMutation) PaymentID

func (m *TransactionMutation) PaymentID() (r int64, exists bool)

PaymentID returns the value of the "payment_id" field in the mutation.

func (*TransactionMutation) PaymentIDCleared

func (m *TransactionMutation) PaymentIDCleared() bool

PaymentIDCleared returns if the "payment_id" field was cleared in this mutation.

func (*TransactionMutation) Quantity

func (m *TransactionMutation) Quantity() (r int, exists bool)

Quantity returns the value of the "quantity" field in the mutation.

func (*TransactionMutation) RemoveTxItemIDs

func (m *TransactionMutation) RemoveTxItemIDs(ids ...int64)

RemoveTxItemIDs removes the "txItems" edge to the TxItem entity by IDs.

func (*TransactionMutation) RemoveTxOrderIDs

func (m *TransactionMutation) RemoveTxOrderIDs(ids ...int64)

RemoveTxOrderIDs removes the "txOrder" edge to the Order entity by IDs.

func (*TransactionMutation) RemovedEdges

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

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

func (*TransactionMutation) RemovedIDs

func (m *TransactionMutation) 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 (*TransactionMutation) RemovedTxItemsIDs

func (m *TransactionMutation) RemovedTxItemsIDs() (ids []int64)

RemovedTxItems returns the removed IDs of the "txItems" edge to the TxItem entity.

func (*TransactionMutation) RemovedTxOrderIDs

func (m *TransactionMutation) RemovedTxOrderIDs() (ids []int64)

RemovedTxOrder returns the removed IDs of the "txOrder" edge to the Order entity.

func (*TransactionMutation) ResetEdge

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

func (m *TransactionMutation) 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 (*TransactionMutation) ResetPaymentID

func (m *TransactionMutation) ResetPaymentID()

ResetPaymentID resets all changes to the "payment_id" field.

func (*TransactionMutation) ResetQuantity

func (m *TransactionMutation) ResetQuantity()

ResetQuantity resets all changes to the "quantity" field.

func (*TransactionMutation) ResetTxAmount

func (m *TransactionMutation) ResetTxAmount()

ResetTxAmount resets all changes to the "tx_amount" field.

func (*TransactionMutation) ResetTxDate

func (m *TransactionMutation) ResetTxDate()

ResetTxDate resets all changes to the "tx_date" field.

func (*TransactionMutation) ResetTxItems

func (m *TransactionMutation) ResetTxItems()

ResetTxItems resets all changes to the "txItems" edge.

func (*TransactionMutation) ResetTxNo

func (m *TransactionMutation) ResetTxNo()

ResetTxNo resets all changes to the "tx_no" field.

func (*TransactionMutation) ResetTxOrder

func (m *TransactionMutation) ResetTxOrder()

ResetTxOrder resets all changes to the "txOrder" edge.

func (*TransactionMutation) ResetTxStatus

func (m *TransactionMutation) ResetTxStatus()

ResetTxStatus resets all changes to the "tx_status" field.

func (*TransactionMutation) ResetTxType

func (m *TransactionMutation) ResetTxType()

ResetTxType resets all changes to the "tx_type" field.

func (*TransactionMutation) ResetUserID

func (m *TransactionMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*TransactionMutation) SetField

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

func (m *TransactionMutation) SetID(id int64)

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

func (*TransactionMutation) SetOp

func (m *TransactionMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TransactionMutation) SetPaymentID

func (m *TransactionMutation) SetPaymentID(i int64)

SetPaymentID sets the "payment_id" field.

func (*TransactionMutation) SetQuantity

func (m *TransactionMutation) SetQuantity(i int)

SetQuantity sets the "quantity" field.

func (*TransactionMutation) SetTxAmount

func (m *TransactionMutation) SetTxAmount(f float64)

SetTxAmount sets the "tx_amount" field.

func (*TransactionMutation) SetTxDate

func (m *TransactionMutation) SetTxDate(t time.Time)

SetTxDate sets the "tx_date" field.

func (*TransactionMutation) SetTxNo

func (m *TransactionMutation) SetTxNo(s string)

SetTxNo sets the "tx_no" field.

func (*TransactionMutation) SetTxStatus

func (m *TransactionMutation) SetTxStatus(ts transaction.TxStatus)

SetTxStatus sets the "tx_status" field.

func (*TransactionMutation) SetTxType

func (m *TransactionMutation) SetTxType(tt transaction.TxType)

SetTxType sets the "tx_type" field.

func (*TransactionMutation) SetUserID

func (m *TransactionMutation) SetUserID(i int64)

SetUserID sets the "user_id" field.

func (TransactionMutation) Tx

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

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

func (*TransactionMutation) TxAmount

func (m *TransactionMutation) TxAmount() (r float64, exists bool)

TxAmount returns the value of the "tx_amount" field in the mutation.

func (*TransactionMutation) TxAmountCleared

func (m *TransactionMutation) TxAmountCleared() bool

TxAmountCleared returns if the "tx_amount" field was cleared in this mutation.

func (*TransactionMutation) TxDate

func (m *TransactionMutation) TxDate() (r time.Time, exists bool)

TxDate returns the value of the "tx_date" field in the mutation.

func (*TransactionMutation) TxDateCleared

func (m *TransactionMutation) TxDateCleared() bool

TxDateCleared returns if the "tx_date" field was cleared in this mutation.

func (*TransactionMutation) TxItemsCleared

func (m *TransactionMutation) TxItemsCleared() bool

TxItemsCleared reports if the "txItems" edge to the TxItem entity was cleared.

func (*TransactionMutation) TxItemsIDs

func (m *TransactionMutation) TxItemsIDs() (ids []int64)

TxItemsIDs returns the "txItems" edge IDs in the mutation.

func (*TransactionMutation) TxNo

func (m *TransactionMutation) TxNo() (r string, exists bool)

TxNo returns the value of the "tx_no" field in the mutation.

func (*TransactionMutation) TxOrderCleared

func (m *TransactionMutation) TxOrderCleared() bool

TxOrderCleared reports if the "txOrder" edge to the Order entity was cleared.

func (*TransactionMutation) TxOrderIDs

func (m *TransactionMutation) TxOrderIDs() (ids []int64)

TxOrderIDs returns the "txOrder" edge IDs in the mutation.

func (*TransactionMutation) TxStatus

func (m *TransactionMutation) TxStatus() (r transaction.TxStatus, exists bool)

TxStatus returns the value of the "tx_status" field in the mutation.

func (*TransactionMutation) TxType

func (m *TransactionMutation) TxType() (r transaction.TxType, exists bool)

TxType returns the value of the "tx_type" field in the mutation.

func (*TransactionMutation) Type

func (m *TransactionMutation) Type() string

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

func (*TransactionMutation) UserID

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

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

func (*TransactionMutation) Where

func (m *TransactionMutation) Where(ps ...predicate.Transaction)

Where appends a list predicates to the TransactionMutation builder.

func (*TransactionMutation) WhereP

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

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

type TransactionQuery

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

TransactionQuery is the builder for querying Transaction entities.

func (*TransactionQuery) Aggregate

func (tq *TransactionQuery) Aggregate(fns ...AggregateFunc) *TransactionSelect

Aggregate returns a TransactionSelect configured with the given aggregations.

func (*TransactionQuery) All

func (tq *TransactionQuery) All(ctx context.Context) ([]*Transaction, error)

All executes the query and returns a list of Transactions.

func (*TransactionQuery) AllX

func (tq *TransactionQuery) AllX(ctx context.Context) []*Transaction

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

func (*TransactionQuery) Clone

func (tq *TransactionQuery) Clone() *TransactionQuery

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

func (*TransactionQuery) Count

func (tq *TransactionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TransactionQuery) CountX

func (tq *TransactionQuery) CountX(ctx context.Context) int

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

func (*TransactionQuery) Exist

func (tq *TransactionQuery) Exist(ctx context.Context) (bool, error)

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

func (*TransactionQuery) ExistX

func (tq *TransactionQuery) ExistX(ctx context.Context) bool

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

func (*TransactionQuery) First

func (tq *TransactionQuery) First(ctx context.Context) (*Transaction, error)

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

func (*TransactionQuery) FirstID

func (tq *TransactionQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*TransactionQuery) FirstIDX

func (tq *TransactionQuery) FirstIDX(ctx context.Context) int64

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

func (*TransactionQuery) FirstX

func (tq *TransactionQuery) FirstX(ctx context.Context) *Transaction

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

func (*TransactionQuery) GroupBy

func (tq *TransactionQuery) GroupBy(field string, fields ...string) *TransactionGroupBy

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

client.Transaction.Query().
	GroupBy(transaction.FieldTxNo).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TransactionQuery) IDs

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

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

func (*TransactionQuery) IDsX

func (tq *TransactionQuery) IDsX(ctx context.Context) []int64

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

func (*TransactionQuery) Limit

func (tq *TransactionQuery) Limit(limit int) *TransactionQuery

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

func (*TransactionQuery) Offset

func (tq *TransactionQuery) Offset(offset int) *TransactionQuery

Offset to start from.

func (*TransactionQuery) Only

func (tq *TransactionQuery) Only(ctx context.Context) (*Transaction, error)

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

func (*TransactionQuery) OnlyID

func (tq *TransactionQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*TransactionQuery) OnlyIDX

func (tq *TransactionQuery) OnlyIDX(ctx context.Context) int64

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

func (*TransactionQuery) OnlyX

func (tq *TransactionQuery) OnlyX(ctx context.Context) *Transaction

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

func (*TransactionQuery) Order

Order specifies how the records should be ordered.

func (*TransactionQuery) QueryTxItems

func (tq *TransactionQuery) QueryTxItems() *TxItemQuery

QueryTxItems chains the current query on the "txItems" edge.

func (*TransactionQuery) QueryTxOrder

func (tq *TransactionQuery) QueryTxOrder() *OrderQuery

QueryTxOrder chains the current query on the "txOrder" edge.

func (*TransactionQuery) Select

func (tq *TransactionQuery) Select(fields ...string) *TransactionSelect

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

client.Transaction.Query().
	Select(transaction.FieldTxNo).
	Scan(ctx, &v)

func (*TransactionQuery) Unique

func (tq *TransactionQuery) Unique(unique bool) *TransactionQuery

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

Where adds a new predicate for the TransactionQuery builder.

func (*TransactionQuery) WithTxItems

func (tq *TransactionQuery) WithTxItems(opts ...func(*TxItemQuery)) *TransactionQuery

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

func (*TransactionQuery) WithTxOrder

func (tq *TransactionQuery) WithTxOrder(opts ...func(*OrderQuery)) *TransactionQuery

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

type TransactionSelect

type TransactionSelect struct {
	*TransactionQuery
	// contains filtered or unexported fields
}

TransactionSelect is the builder for selecting fields of Transaction entities.

func (*TransactionSelect) Aggregate

func (ts *TransactionSelect) Aggregate(fns ...AggregateFunc) *TransactionSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TransactionSelect) Bool

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

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

func (*TransactionSelect) BoolX

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

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

func (*TransactionSelect) Bools

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

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

func (*TransactionSelect) BoolsX

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

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

func (*TransactionSelect) Float64

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

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

func (*TransactionSelect) Float64X

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

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

func (*TransactionSelect) Float64s

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

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

func (*TransactionSelect) Float64sX

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

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

func (*TransactionSelect) Int

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

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

func (*TransactionSelect) IntX

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

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

func (*TransactionSelect) Ints

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

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

func (*TransactionSelect) IntsX

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

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

func (*TransactionSelect) Scan

func (ts *TransactionSelect) Scan(ctx context.Context, v any) error

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

func (*TransactionSelect) ScanX

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

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

func (*TransactionSelect) String

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

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

func (*TransactionSelect) StringX

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

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

func (*TransactionSelect) Strings

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

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

func (*TransactionSelect) StringsX

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

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

type TransactionUpdate

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

TransactionUpdate is the builder for updating Transaction entities.

func (*TransactionUpdate) AddPaymentID

func (tu *TransactionUpdate) AddPaymentID(i int64) *TransactionUpdate

AddPaymentID adds i to the "payment_id" field.

func (*TransactionUpdate) AddQuantity

func (tu *TransactionUpdate) AddQuantity(i int) *TransactionUpdate

AddQuantity adds i to the "quantity" field.

func (*TransactionUpdate) AddTxAmount

func (tu *TransactionUpdate) AddTxAmount(f float64) *TransactionUpdate

AddTxAmount adds f to the "tx_amount" field.

func (*TransactionUpdate) AddTxItemIDs

func (tu *TransactionUpdate) AddTxItemIDs(ids ...int64) *TransactionUpdate

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*TransactionUpdate) AddTxItems

func (tu *TransactionUpdate) AddTxItems(t ...*TxItem) *TransactionUpdate

AddTxItems adds the "txItems" edges to the TxItem entity.

func (*TransactionUpdate) AddTxOrder

func (tu *TransactionUpdate) AddTxOrder(o ...*Order) *TransactionUpdate

AddTxOrder adds the "txOrder" edges to the Order entity.

func (*TransactionUpdate) AddTxOrderIDs

func (tu *TransactionUpdate) AddTxOrderIDs(ids ...int64) *TransactionUpdate

AddTxOrderIDs adds the "txOrder" edge to the Order entity by IDs.

func (*TransactionUpdate) AddUserID

func (tu *TransactionUpdate) AddUserID(i int64) *TransactionUpdate

AddUserID adds i to the "user_id" field.

func (*TransactionUpdate) ClearPaymentID

func (tu *TransactionUpdate) ClearPaymentID() *TransactionUpdate

ClearPaymentID clears the value of the "payment_id" field.

func (*TransactionUpdate) ClearTxAmount

func (tu *TransactionUpdate) ClearTxAmount() *TransactionUpdate

ClearTxAmount clears the value of the "tx_amount" field.

func (*TransactionUpdate) ClearTxDate

func (tu *TransactionUpdate) ClearTxDate() *TransactionUpdate

ClearTxDate clears the value of the "tx_date" field.

func (*TransactionUpdate) ClearTxItems

func (tu *TransactionUpdate) ClearTxItems() *TransactionUpdate

ClearTxItems clears all "txItems" edges to the TxItem entity.

func (*TransactionUpdate) ClearTxOrder

func (tu *TransactionUpdate) ClearTxOrder() *TransactionUpdate

ClearTxOrder clears all "txOrder" edges to the Order entity.

func (*TransactionUpdate) Exec

func (tu *TransactionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TransactionUpdate) ExecX

func (tu *TransactionUpdate) ExecX(ctx context.Context)

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

func (*TransactionUpdate) Mutation

func (tu *TransactionUpdate) Mutation() *TransactionMutation

Mutation returns the TransactionMutation object of the builder.

func (*TransactionUpdate) RemoveTxItemIDs

func (tu *TransactionUpdate) RemoveTxItemIDs(ids ...int64) *TransactionUpdate

RemoveTxItemIDs removes the "txItems" edge to TxItem entities by IDs.

func (*TransactionUpdate) RemoveTxItems

func (tu *TransactionUpdate) RemoveTxItems(t ...*TxItem) *TransactionUpdate

RemoveTxItems removes "txItems" edges to TxItem entities.

func (*TransactionUpdate) RemoveTxOrder

func (tu *TransactionUpdate) RemoveTxOrder(o ...*Order) *TransactionUpdate

RemoveTxOrder removes "txOrder" edges to Order entities.

func (*TransactionUpdate) RemoveTxOrderIDs

func (tu *TransactionUpdate) RemoveTxOrderIDs(ids ...int64) *TransactionUpdate

RemoveTxOrderIDs removes the "txOrder" edge to Order entities by IDs.

func (*TransactionUpdate) Save

func (tu *TransactionUpdate) Save(ctx context.Context) (int, error)

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

func (*TransactionUpdate) SaveX

func (tu *TransactionUpdate) SaveX(ctx context.Context) int

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

func (*TransactionUpdate) SetNillablePaymentID

func (tu *TransactionUpdate) SetNillablePaymentID(i *int64) *TransactionUpdate

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*TransactionUpdate) SetNillableQuantity

func (tu *TransactionUpdate) SetNillableQuantity(i *int) *TransactionUpdate

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*TransactionUpdate) SetNillableTxAmount

func (tu *TransactionUpdate) SetNillableTxAmount(f *float64) *TransactionUpdate

SetNillableTxAmount sets the "tx_amount" field if the given value is not nil.

func (*TransactionUpdate) SetNillableTxDate

func (tu *TransactionUpdate) SetNillableTxDate(t *time.Time) *TransactionUpdate

SetNillableTxDate sets the "tx_date" field if the given value is not nil.

func (*TransactionUpdate) SetNillableTxNo

func (tu *TransactionUpdate) SetNillableTxNo(s *string) *TransactionUpdate

SetNillableTxNo sets the "tx_no" field if the given value is not nil.

func (*TransactionUpdate) SetNillableTxStatus

func (tu *TransactionUpdate) SetNillableTxStatus(ts *transaction.TxStatus) *TransactionUpdate

SetNillableTxStatus sets the "tx_status" field if the given value is not nil.

func (*TransactionUpdate) SetNillableTxType

func (tu *TransactionUpdate) SetNillableTxType(tt *transaction.TxType) *TransactionUpdate

SetNillableTxType sets the "tx_type" field if the given value is not nil.

func (*TransactionUpdate) SetNillableUserID

func (tu *TransactionUpdate) SetNillableUserID(i *int64) *TransactionUpdate

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

func (*TransactionUpdate) SetPaymentID

func (tu *TransactionUpdate) SetPaymentID(i int64) *TransactionUpdate

SetPaymentID sets the "payment_id" field.

func (*TransactionUpdate) SetQuantity

func (tu *TransactionUpdate) SetQuantity(i int) *TransactionUpdate

SetQuantity sets the "quantity" field.

func (*TransactionUpdate) SetTxAmount

func (tu *TransactionUpdate) SetTxAmount(f float64) *TransactionUpdate

SetTxAmount sets the "tx_amount" field.

func (*TransactionUpdate) SetTxDate

func (tu *TransactionUpdate) SetTxDate(t time.Time) *TransactionUpdate

SetTxDate sets the "tx_date" field.

func (*TransactionUpdate) SetTxNo

func (tu *TransactionUpdate) SetTxNo(s string) *TransactionUpdate

SetTxNo sets the "tx_no" field.

func (*TransactionUpdate) SetTxStatus

SetTxStatus sets the "tx_status" field.

func (*TransactionUpdate) SetTxType

SetTxType sets the "tx_type" field.

func (*TransactionUpdate) SetUserID

func (tu *TransactionUpdate) SetUserID(i int64) *TransactionUpdate

SetUserID sets the "user_id" field.

func (*TransactionUpdate) Where

Where appends a list predicates to the TransactionUpdate builder.

type TransactionUpdateOne

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

TransactionUpdateOne is the builder for updating a single Transaction entity.

func (*TransactionUpdateOne) AddPaymentID

func (tuo *TransactionUpdateOne) AddPaymentID(i int64) *TransactionUpdateOne

AddPaymentID adds i to the "payment_id" field.

func (*TransactionUpdateOne) AddQuantity

func (tuo *TransactionUpdateOne) AddQuantity(i int) *TransactionUpdateOne

AddQuantity adds i to the "quantity" field.

func (*TransactionUpdateOne) AddTxAmount

func (tuo *TransactionUpdateOne) AddTxAmount(f float64) *TransactionUpdateOne

AddTxAmount adds f to the "tx_amount" field.

func (*TransactionUpdateOne) AddTxItemIDs

func (tuo *TransactionUpdateOne) AddTxItemIDs(ids ...int64) *TransactionUpdateOne

AddTxItemIDs adds the "txItems" edge to the TxItem entity by IDs.

func (*TransactionUpdateOne) AddTxItems

func (tuo *TransactionUpdateOne) AddTxItems(t ...*TxItem) *TransactionUpdateOne

AddTxItems adds the "txItems" edges to the TxItem entity.

func (*TransactionUpdateOne) AddTxOrder

func (tuo *TransactionUpdateOne) AddTxOrder(o ...*Order) *TransactionUpdateOne

AddTxOrder adds the "txOrder" edges to the Order entity.

func (*TransactionUpdateOne) AddTxOrderIDs

func (tuo *TransactionUpdateOne) AddTxOrderIDs(ids ...int64) *TransactionUpdateOne

AddTxOrderIDs adds the "txOrder" edge to the Order entity by IDs.

func (*TransactionUpdateOne) AddUserID

func (tuo *TransactionUpdateOne) AddUserID(i int64) *TransactionUpdateOne

AddUserID adds i to the "user_id" field.

func (*TransactionUpdateOne) ClearPaymentID

func (tuo *TransactionUpdateOne) ClearPaymentID() *TransactionUpdateOne

ClearPaymentID clears the value of the "payment_id" field.

func (*TransactionUpdateOne) ClearTxAmount

func (tuo *TransactionUpdateOne) ClearTxAmount() *TransactionUpdateOne

ClearTxAmount clears the value of the "tx_amount" field.

func (*TransactionUpdateOne) ClearTxDate

func (tuo *TransactionUpdateOne) ClearTxDate() *TransactionUpdateOne

ClearTxDate clears the value of the "tx_date" field.

func (*TransactionUpdateOne) ClearTxItems

func (tuo *TransactionUpdateOne) ClearTxItems() *TransactionUpdateOne

ClearTxItems clears all "txItems" edges to the TxItem entity.

func (*TransactionUpdateOne) ClearTxOrder

func (tuo *TransactionUpdateOne) ClearTxOrder() *TransactionUpdateOne

ClearTxOrder clears all "txOrder" edges to the Order entity.

func (*TransactionUpdateOne) Exec

func (tuo *TransactionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TransactionUpdateOne) ExecX

func (tuo *TransactionUpdateOne) ExecX(ctx context.Context)

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

func (*TransactionUpdateOne) Mutation

func (tuo *TransactionUpdateOne) Mutation() *TransactionMutation

Mutation returns the TransactionMutation object of the builder.

func (*TransactionUpdateOne) RemoveTxItemIDs

func (tuo *TransactionUpdateOne) RemoveTxItemIDs(ids ...int64) *TransactionUpdateOne

RemoveTxItemIDs removes the "txItems" edge to TxItem entities by IDs.

func (*TransactionUpdateOne) RemoveTxItems

func (tuo *TransactionUpdateOne) RemoveTxItems(t ...*TxItem) *TransactionUpdateOne

RemoveTxItems removes "txItems" edges to TxItem entities.

func (*TransactionUpdateOne) RemoveTxOrder

func (tuo *TransactionUpdateOne) RemoveTxOrder(o ...*Order) *TransactionUpdateOne

RemoveTxOrder removes "txOrder" edges to Order entities.

func (*TransactionUpdateOne) RemoveTxOrderIDs

func (tuo *TransactionUpdateOne) RemoveTxOrderIDs(ids ...int64) *TransactionUpdateOne

RemoveTxOrderIDs removes the "txOrder" edge to Order entities by IDs.

func (*TransactionUpdateOne) Save

Save executes the query and returns the updated Transaction entity.

func (*TransactionUpdateOne) SaveX

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

func (*TransactionUpdateOne) Select

func (tuo *TransactionUpdateOne) Select(field string, fields ...string) *TransactionUpdateOne

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

func (*TransactionUpdateOne) SetNillablePaymentID

func (tuo *TransactionUpdateOne) SetNillablePaymentID(i *int64) *TransactionUpdateOne

SetNillablePaymentID sets the "payment_id" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableQuantity

func (tuo *TransactionUpdateOne) SetNillableQuantity(i *int) *TransactionUpdateOne

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableTxAmount

func (tuo *TransactionUpdateOne) SetNillableTxAmount(f *float64) *TransactionUpdateOne

SetNillableTxAmount sets the "tx_amount" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableTxDate

func (tuo *TransactionUpdateOne) SetNillableTxDate(t *time.Time) *TransactionUpdateOne

SetNillableTxDate sets the "tx_date" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableTxNo

func (tuo *TransactionUpdateOne) SetNillableTxNo(s *string) *TransactionUpdateOne

SetNillableTxNo sets the "tx_no" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableTxStatus

func (tuo *TransactionUpdateOne) SetNillableTxStatus(ts *transaction.TxStatus) *TransactionUpdateOne

SetNillableTxStatus sets the "tx_status" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableTxType

func (tuo *TransactionUpdateOne) SetNillableTxType(tt *transaction.TxType) *TransactionUpdateOne

SetNillableTxType sets the "tx_type" field if the given value is not nil.

func (*TransactionUpdateOne) SetNillableUserID

func (tuo *TransactionUpdateOne) SetNillableUserID(i *int64) *TransactionUpdateOne

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

func (*TransactionUpdateOne) SetPaymentID

func (tuo *TransactionUpdateOne) SetPaymentID(i int64) *TransactionUpdateOne

SetPaymentID sets the "payment_id" field.

func (*TransactionUpdateOne) SetQuantity

func (tuo *TransactionUpdateOne) SetQuantity(i int) *TransactionUpdateOne

SetQuantity sets the "quantity" field.

func (*TransactionUpdateOne) SetTxAmount

func (tuo *TransactionUpdateOne) SetTxAmount(f float64) *TransactionUpdateOne

SetTxAmount sets the "tx_amount" field.

func (*TransactionUpdateOne) SetTxDate

SetTxDate sets the "tx_date" field.

func (*TransactionUpdateOne) SetTxNo

SetTxNo sets the "tx_no" field.

func (*TransactionUpdateOne) SetTxStatus

SetTxStatus sets the "tx_status" field.

func (*TransactionUpdateOne) SetTxType

SetTxType sets the "tx_type" field.

func (*TransactionUpdateOne) SetUserID

func (tuo *TransactionUpdateOne) SetUserID(i int64) *TransactionUpdateOne

SetUserID sets the "user_id" field.

func (*TransactionUpdateOne) Where

Where appends a list predicates to the TransactionUpdate builder.

type Transactions

type Transactions []*Transaction

Transactions is a parsable slice of Transaction.

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 {

	// Order is the client for interacting with the Order builders.
	Order *OrderClient
	// Transaction is the client for interacting with the Transaction builders.
	Transaction *TransactionClient
	// TxItem is the client for interacting with the TxItem builders.
	TxItem *TxItemClient
	// 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 TxItem

type TxItem struct {

	// ID of the ent.
	// 交易明细ID,主键
	ID int64 `json:"id,omitempty"`
	// 交易类型(买或卖)
	TxType txitem.TxType `json:"tx_type,omitempty"`
	// 交易ID
	TxID int64 `json:"tx_id,omitempty"`
	// 书籍ID
	BookID int64 `json:"book_id,omitempty"`
	// 交易数量
	Quantity int `json:"quantity,omitempty"`
	// 交易价格
	Price float64 `json:"price,omitempty"`
	// ISBN
	Isbn string `json:"isbn,omitempty"`
	// 书名
	Title string `json:"title,omitempty"`
	// 主编
	Author string `json:"author,omitempty"`
	// 出版社ID
	PublisherID int64 `json:"publisher_id,omitempty"`
	// 图片URL
	ImageURL string `json:"image_url,omitempty"`
	// contains filtered or unexported fields
}

TxItem is the model entity for the TxItem schema.

func (*TxItem) String

func (ti *TxItem) String() string

String implements the fmt.Stringer.

func (*TxItem) Unwrap

func (ti *TxItem) Unwrap() *TxItem

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

func (ti *TxItem) Update() *TxItemUpdateOne

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

func (*TxItem) Value

func (ti *TxItem) Value(name string) (ent.Value, error)

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

type TxItemClient

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

TxItemClient is a client for the TxItem schema.

func NewTxItemClient

func NewTxItemClient(c config) *TxItemClient

NewTxItemClient returns a client for the TxItem from the given config.

func (*TxItemClient) Create

func (c *TxItemClient) Create() *TxItemCreate

Create returns a builder for creating a TxItem entity.

func (*TxItemClient) CreateBulk

func (c *TxItemClient) CreateBulk(builders ...*TxItemCreate) *TxItemCreateBulk

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

func (*TxItemClient) Delete

func (c *TxItemClient) Delete() *TxItemDelete

Delete returns a delete builder for TxItem.

func (*TxItemClient) DeleteOne

func (c *TxItemClient) DeleteOne(ti *TxItem) *TxItemDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TxItemClient) DeleteOneID

func (c *TxItemClient) DeleteOneID(id int64) *TxItemDeleteOne

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

func (*TxItemClient) Get

func (c *TxItemClient) Get(ctx context.Context, id int64) (*TxItem, error)

Get returns a TxItem entity by its id.

func (*TxItemClient) GetX

func (c *TxItemClient) GetX(ctx context.Context, id int64) *TxItem

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

func (*TxItemClient) Hooks

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

Hooks returns the client hooks.

func (*TxItemClient) Intercept

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

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

func (*TxItemClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TxItemClient) MapCreateBulk

func (c *TxItemClient) MapCreateBulk(slice any, setFunc func(*TxItemCreate, int)) *TxItemCreateBulk

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

func (c *TxItemClient) Query() *TxItemQuery

Query returns a query builder for TxItem.

func (*TxItemClient) Update

func (c *TxItemClient) Update() *TxItemUpdate

Update returns an update builder for TxItem.

func (*TxItemClient) UpdateOne

func (c *TxItemClient) UpdateOne(ti *TxItem) *TxItemUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TxItemClient) UpdateOneID

func (c *TxItemClient) UpdateOneID(id int64) *TxItemUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TxItemClient) Use

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

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

type TxItemCreate

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

TxItemCreate is the builder for creating a TxItem entity.

func (*TxItemCreate) Exec

func (tic *TxItemCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TxItemCreate) ExecX

func (tic *TxItemCreate) ExecX(ctx context.Context)

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

func (*TxItemCreate) Mutation

func (tic *TxItemCreate) Mutation() *TxItemMutation

Mutation returns the TxItemMutation object of the builder.

func (*TxItemCreate) Save

func (tic *TxItemCreate) Save(ctx context.Context) (*TxItem, error)

Save creates the TxItem in the database.

func (*TxItemCreate) SaveX

func (tic *TxItemCreate) SaveX(ctx context.Context) *TxItem

SaveX calls Save and panics if Save returns an error.

func (*TxItemCreate) SetAuthor

func (tic *TxItemCreate) SetAuthor(s string) *TxItemCreate

SetAuthor sets the "author" field.

func (*TxItemCreate) SetBookID

func (tic *TxItemCreate) SetBookID(i int64) *TxItemCreate

SetBookID sets the "book_id" field.

func (*TxItemCreate) SetID

func (tic *TxItemCreate) SetID(i int64) *TxItemCreate

SetID sets the "id" field.

func (*TxItemCreate) SetImageURL

func (tic *TxItemCreate) SetImageURL(s string) *TxItemCreate

SetImageURL sets the "image_url" field.

func (*TxItemCreate) SetIsbn

func (tic *TxItemCreate) SetIsbn(s string) *TxItemCreate

SetIsbn sets the "isbn" field.

func (*TxItemCreate) SetNillableImageURL

func (tic *TxItemCreate) SetNillableImageURL(s *string) *TxItemCreate

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*TxItemCreate) SetNillablePublisherID

func (tic *TxItemCreate) SetNillablePublisherID(i *int64) *TxItemCreate

SetNillablePublisherID sets the "publisher_id" field if the given value is not nil.

func (*TxItemCreate) SetPrice

func (tic *TxItemCreate) SetPrice(f float64) *TxItemCreate

SetPrice sets the "price" field.

func (*TxItemCreate) SetPublisherID

func (tic *TxItemCreate) SetPublisherID(i int64) *TxItemCreate

SetPublisherID sets the "publisher_id" field.

func (*TxItemCreate) SetQuantity

func (tic *TxItemCreate) SetQuantity(i int) *TxItemCreate

SetQuantity sets the "quantity" field.

func (*TxItemCreate) SetTitle

func (tic *TxItemCreate) SetTitle(s string) *TxItemCreate

SetTitle sets the "title" field.

func (*TxItemCreate) SetTxID

func (tic *TxItemCreate) SetTxID(i int64) *TxItemCreate

SetTxID sets the "tx_id" field.

func (*TxItemCreate) SetTxType

func (tic *TxItemCreate) SetTxType(tt txitem.TxType) *TxItemCreate

SetTxType sets the "tx_type" field.

type TxItemCreateBulk

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

TxItemCreateBulk is the builder for creating many TxItem entities in bulk.

func (*TxItemCreateBulk) Exec

func (ticb *TxItemCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TxItemCreateBulk) ExecX

func (ticb *TxItemCreateBulk) ExecX(ctx context.Context)

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

func (*TxItemCreateBulk) Save

func (ticb *TxItemCreateBulk) Save(ctx context.Context) ([]*TxItem, error)

Save creates the TxItem entities in the database.

func (*TxItemCreateBulk) SaveX

func (ticb *TxItemCreateBulk) SaveX(ctx context.Context) []*TxItem

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

type TxItemDelete

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

TxItemDelete is the builder for deleting a TxItem entity.

func (*TxItemDelete) Exec

func (tid *TxItemDelete) Exec(ctx context.Context) (int, error)

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

func (*TxItemDelete) ExecX

func (tid *TxItemDelete) ExecX(ctx context.Context) int

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

func (*TxItemDelete) Where

func (tid *TxItemDelete) Where(ps ...predicate.TxItem) *TxItemDelete

Where appends a list predicates to the TxItemDelete builder.

type TxItemDeleteOne

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

TxItemDeleteOne is the builder for deleting a single TxItem entity.

func (*TxItemDeleteOne) Exec

func (tido *TxItemDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TxItemDeleteOne) ExecX

func (tido *TxItemDeleteOne) ExecX(ctx context.Context)

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

func (*TxItemDeleteOne) Where

func (tido *TxItemDeleteOne) Where(ps ...predicate.TxItem) *TxItemDeleteOne

Where appends a list predicates to the TxItemDelete builder.

type TxItemGroupBy

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

TxItemGroupBy is the group-by builder for TxItem entities.

func (*TxItemGroupBy) Aggregate

func (tigb *TxItemGroupBy) Aggregate(fns ...AggregateFunc) *TxItemGroupBy

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

func (*TxItemGroupBy) Bool

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

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

func (*TxItemGroupBy) BoolX

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

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

func (*TxItemGroupBy) Bools

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

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

func (*TxItemGroupBy) BoolsX

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

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

func (*TxItemGroupBy) Float64

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

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

func (*TxItemGroupBy) Float64X

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

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

func (*TxItemGroupBy) Float64s

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

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

func (*TxItemGroupBy) Float64sX

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

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

func (*TxItemGroupBy) Int

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

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

func (*TxItemGroupBy) IntX

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

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

func (*TxItemGroupBy) Ints

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

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

func (*TxItemGroupBy) IntsX

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

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

func (*TxItemGroupBy) Scan

func (tigb *TxItemGroupBy) Scan(ctx context.Context, v any) error

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

func (*TxItemGroupBy) ScanX

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

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

func (*TxItemGroupBy) String

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

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

func (*TxItemGroupBy) StringX

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

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

func (*TxItemGroupBy) Strings

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

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

func (*TxItemGroupBy) StringsX

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

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

type TxItemMutation

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

TxItemMutation represents an operation that mutates the TxItem nodes in the graph.

func (*TxItemMutation) AddBookID

func (m *TxItemMutation) AddBookID(i int64)

AddBookID adds i to the "book_id" field.

func (*TxItemMutation) AddField

func (m *TxItemMutation) 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 (*TxItemMutation) AddPrice

func (m *TxItemMutation) AddPrice(f float64)

AddPrice adds f to the "price" field.

func (*TxItemMutation) AddPublisherID

func (m *TxItemMutation) AddPublisherID(i int64)

AddPublisherID adds i to the "publisher_id" field.

func (*TxItemMutation) AddQuantity

func (m *TxItemMutation) AddQuantity(i int)

AddQuantity adds i to the "quantity" field.

func (*TxItemMutation) AddTxID

func (m *TxItemMutation) AddTxID(i int64)

AddTxID adds i to the "tx_id" field.

func (*TxItemMutation) AddedBookID

func (m *TxItemMutation) AddedBookID() (r int64, exists bool)

AddedBookID returns the value that was added to the "book_id" field in this mutation.

func (*TxItemMutation) AddedEdges

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

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

func (*TxItemMutation) AddedField

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

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

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

func (*TxItemMutation) AddedIDs

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

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

func (*TxItemMutation) AddedPrice

func (m *TxItemMutation) AddedPrice() (r float64, exists bool)

AddedPrice returns the value that was added to the "price" field in this mutation.

func (*TxItemMutation) AddedPublisherID

func (m *TxItemMutation) AddedPublisherID() (r int64, exists bool)

AddedPublisherID returns the value that was added to the "publisher_id" field in this mutation.

func (*TxItemMutation) AddedQuantity

func (m *TxItemMutation) AddedQuantity() (r int, exists bool)

AddedQuantity returns the value that was added to the "quantity" field in this mutation.

func (*TxItemMutation) AddedTxID

func (m *TxItemMutation) AddedTxID() (r int64, exists bool)

AddedTxID returns the value that was added to the "tx_id" field in this mutation.

func (*TxItemMutation) Author

func (m *TxItemMutation) Author() (r string, exists bool)

Author returns the value of the "author" field in the mutation.

func (*TxItemMutation) BookID

func (m *TxItemMutation) BookID() (r int64, exists bool)

BookID returns the value of the "book_id" field in the mutation.

func (*TxItemMutation) ClearEdge

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

func (m *TxItemMutation) 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 (*TxItemMutation) ClearImageURL

func (m *TxItemMutation) ClearImageURL()

ClearImageURL clears the value of the "image_url" field.

func (*TxItemMutation) ClearPublisherID

func (m *TxItemMutation) ClearPublisherID()

ClearPublisherID clears the value of the "publisher_id" field.

func (*TxItemMutation) ClearedEdges

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

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

func (*TxItemMutation) ClearedFields

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

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

func (TxItemMutation) Client

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

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

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

func (*TxItemMutation) Field

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

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

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

func (*TxItemMutation) Fields

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

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

func (m *TxItemMutation) 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 (*TxItemMutation) ImageURL

func (m *TxItemMutation) ImageURL() (r string, exists bool)

ImageURL returns the value of the "image_url" field in the mutation.

func (*TxItemMutation) ImageURLCleared

func (m *TxItemMutation) ImageURLCleared() bool

ImageURLCleared returns if the "image_url" field was cleared in this mutation.

func (*TxItemMutation) Isbn

func (m *TxItemMutation) Isbn() (r string, exists bool)

Isbn returns the value of the "isbn" field in the mutation.

func (*TxItemMutation) OldAuthor

func (m *TxItemMutation) OldAuthor(ctx context.Context) (v string, err error)

OldAuthor returns the old "author" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldBookID

func (m *TxItemMutation) OldBookID(ctx context.Context) (v int64, err error)

OldBookID returns the old "book_id" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldField

func (m *TxItemMutation) 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 (*TxItemMutation) OldImageURL

func (m *TxItemMutation) OldImageURL(ctx context.Context) (v string, err error)

OldImageURL returns the old "image_url" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldIsbn

func (m *TxItemMutation) OldIsbn(ctx context.Context) (v string, err error)

OldIsbn returns the old "isbn" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldPrice

func (m *TxItemMutation) OldPrice(ctx context.Context) (v float64, err error)

OldPrice returns the old "price" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldPublisherID

func (m *TxItemMutation) OldPublisherID(ctx context.Context) (v int64, err error)

OldPublisherID returns the old "publisher_id" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldQuantity

func (m *TxItemMutation) OldQuantity(ctx context.Context) (v int, err error)

OldQuantity returns the old "quantity" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldTitle

func (m *TxItemMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldTxID

func (m *TxItemMutation) OldTxID(ctx context.Context) (v int64, err error)

OldTxID returns the old "tx_id" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) OldTxType

func (m *TxItemMutation) OldTxType(ctx context.Context) (v txitem.TxType, err error)

OldTxType returns the old "tx_type" field's value of the TxItem entity. If the TxItem 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 (*TxItemMutation) Op

func (m *TxItemMutation) Op() Op

Op returns the operation name.

func (*TxItemMutation) Price

func (m *TxItemMutation) Price() (r float64, exists bool)

Price returns the value of the "price" field in the mutation.

func (*TxItemMutation) PublisherID

func (m *TxItemMutation) PublisherID() (r int64, exists bool)

PublisherID returns the value of the "publisher_id" field in the mutation.

func (*TxItemMutation) PublisherIDCleared

func (m *TxItemMutation) PublisherIDCleared() bool

PublisherIDCleared returns if the "publisher_id" field was cleared in this mutation.

func (*TxItemMutation) Quantity

func (m *TxItemMutation) Quantity() (r int, exists bool)

Quantity returns the value of the "quantity" field in the mutation.

func (*TxItemMutation) RemovedEdges

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

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

func (*TxItemMutation) RemovedIDs

func (m *TxItemMutation) 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 (*TxItemMutation) ResetAuthor

func (m *TxItemMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" field.

func (*TxItemMutation) ResetBookID

func (m *TxItemMutation) ResetBookID()

ResetBookID resets all changes to the "book_id" field.

func (*TxItemMutation) ResetEdge

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

func (m *TxItemMutation) 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 (*TxItemMutation) ResetImageURL

func (m *TxItemMutation) ResetImageURL()

ResetImageURL resets all changes to the "image_url" field.

func (*TxItemMutation) ResetIsbn

func (m *TxItemMutation) ResetIsbn()

ResetIsbn resets all changes to the "isbn" field.

func (*TxItemMutation) ResetPrice

func (m *TxItemMutation) ResetPrice()

ResetPrice resets all changes to the "price" field.

func (*TxItemMutation) ResetPublisherID

func (m *TxItemMutation) ResetPublisherID()

ResetPublisherID resets all changes to the "publisher_id" field.

func (*TxItemMutation) ResetQuantity

func (m *TxItemMutation) ResetQuantity()

ResetQuantity resets all changes to the "quantity" field.

func (*TxItemMutation) ResetTitle

func (m *TxItemMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*TxItemMutation) ResetTxID

func (m *TxItemMutation) ResetTxID()

ResetTxID resets all changes to the "tx_id" field.

func (*TxItemMutation) ResetTxType

func (m *TxItemMutation) ResetTxType()

ResetTxType resets all changes to the "tx_type" field.

func (*TxItemMutation) SetAuthor

func (m *TxItemMutation) SetAuthor(s string)

SetAuthor sets the "author" field.

func (*TxItemMutation) SetBookID

func (m *TxItemMutation) SetBookID(i int64)

SetBookID sets the "book_id" field.

func (*TxItemMutation) SetField

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

func (m *TxItemMutation) SetID(id int64)

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

func (*TxItemMutation) SetImageURL

func (m *TxItemMutation) SetImageURL(s string)

SetImageURL sets the "image_url" field.

func (*TxItemMutation) SetIsbn

func (m *TxItemMutation) SetIsbn(s string)

SetIsbn sets the "isbn" field.

func (*TxItemMutation) SetOp

func (m *TxItemMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TxItemMutation) SetPrice

func (m *TxItemMutation) SetPrice(f float64)

SetPrice sets the "price" field.

func (*TxItemMutation) SetPublisherID

func (m *TxItemMutation) SetPublisherID(i int64)

SetPublisherID sets the "publisher_id" field.

func (*TxItemMutation) SetQuantity

func (m *TxItemMutation) SetQuantity(i int)

SetQuantity sets the "quantity" field.

func (*TxItemMutation) SetTitle

func (m *TxItemMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*TxItemMutation) SetTxID

func (m *TxItemMutation) SetTxID(i int64)

SetTxID sets the "tx_id" field.

func (*TxItemMutation) SetTxType

func (m *TxItemMutation) SetTxType(tt txitem.TxType)

SetTxType sets the "tx_type" field.

func (*TxItemMutation) Title

func (m *TxItemMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (TxItemMutation) Tx

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

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

func (*TxItemMutation) TxID

func (m *TxItemMutation) TxID() (r int64, exists bool)

TxID returns the value of the "tx_id" field in the mutation.

func (*TxItemMutation) TxType

func (m *TxItemMutation) TxType() (r txitem.TxType, exists bool)

TxType returns the value of the "tx_type" field in the mutation.

func (*TxItemMutation) Type

func (m *TxItemMutation) Type() string

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

func (*TxItemMutation) Where

func (m *TxItemMutation) Where(ps ...predicate.TxItem)

Where appends a list predicates to the TxItemMutation builder.

func (*TxItemMutation) WhereP

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

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

type TxItemQuery

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

TxItemQuery is the builder for querying TxItem entities.

func (*TxItemQuery) Aggregate

func (tiq *TxItemQuery) Aggregate(fns ...AggregateFunc) *TxItemSelect

Aggregate returns a TxItemSelect configured with the given aggregations.

func (*TxItemQuery) All

func (tiq *TxItemQuery) All(ctx context.Context) ([]*TxItem, error)

All executes the query and returns a list of TxItems.

func (*TxItemQuery) AllX

func (tiq *TxItemQuery) AllX(ctx context.Context) []*TxItem

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

func (*TxItemQuery) Clone

func (tiq *TxItemQuery) Clone() *TxItemQuery

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

func (*TxItemQuery) Count

func (tiq *TxItemQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TxItemQuery) CountX

func (tiq *TxItemQuery) CountX(ctx context.Context) int

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

func (*TxItemQuery) Exist

func (tiq *TxItemQuery) Exist(ctx context.Context) (bool, error)

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

func (*TxItemQuery) ExistX

func (tiq *TxItemQuery) ExistX(ctx context.Context) bool

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

func (*TxItemQuery) First

func (tiq *TxItemQuery) First(ctx context.Context) (*TxItem, error)

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

func (*TxItemQuery) FirstID

func (tiq *TxItemQuery) FirstID(ctx context.Context) (id int64, err error)

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

func (*TxItemQuery) FirstIDX

func (tiq *TxItemQuery) FirstIDX(ctx context.Context) int64

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

func (*TxItemQuery) FirstX

func (tiq *TxItemQuery) FirstX(ctx context.Context) *TxItem

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

func (*TxItemQuery) GroupBy

func (tiq *TxItemQuery) GroupBy(field string, fields ...string) *TxItemGroupBy

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 {
	TxType txitem.TxType `json:"tx_type,omitempty"`
	Count int `json:"count,omitempty"`
}

client.TxItem.Query().
	GroupBy(txitem.FieldTxType).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TxItemQuery) IDs

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

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

func (*TxItemQuery) IDsX

func (tiq *TxItemQuery) IDsX(ctx context.Context) []int64

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

func (*TxItemQuery) Limit

func (tiq *TxItemQuery) Limit(limit int) *TxItemQuery

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

func (*TxItemQuery) Offset

func (tiq *TxItemQuery) Offset(offset int) *TxItemQuery

Offset to start from.

func (*TxItemQuery) Only

func (tiq *TxItemQuery) Only(ctx context.Context) (*TxItem, error)

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

func (*TxItemQuery) OnlyID

func (tiq *TxItemQuery) OnlyID(ctx context.Context) (id int64, err error)

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

func (*TxItemQuery) OnlyIDX

func (tiq *TxItemQuery) OnlyIDX(ctx context.Context) int64

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

func (*TxItemQuery) OnlyX

func (tiq *TxItemQuery) OnlyX(ctx context.Context) *TxItem

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

func (*TxItemQuery) Order

func (tiq *TxItemQuery) Order(o ...txitem.OrderOption) *TxItemQuery

Order specifies how the records should be ordered.

func (*TxItemQuery) Select

func (tiq *TxItemQuery) Select(fields ...string) *TxItemSelect

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 {
	TxType txitem.TxType `json:"tx_type,omitempty"`
}

client.TxItem.Query().
	Select(txitem.FieldTxType).
	Scan(ctx, &v)

func (*TxItemQuery) Unique

func (tiq *TxItemQuery) Unique(unique bool) *TxItemQuery

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

func (tiq *TxItemQuery) Where(ps ...predicate.TxItem) *TxItemQuery

Where adds a new predicate for the TxItemQuery builder.

type TxItemSelect

type TxItemSelect struct {
	*TxItemQuery
	// contains filtered or unexported fields
}

TxItemSelect is the builder for selecting fields of TxItem entities.

func (*TxItemSelect) Aggregate

func (tis *TxItemSelect) Aggregate(fns ...AggregateFunc) *TxItemSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TxItemSelect) Bool

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

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

func (*TxItemSelect) BoolX

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

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

func (*TxItemSelect) Bools

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

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

func (*TxItemSelect) BoolsX

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

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

func (*TxItemSelect) Float64

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

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

func (*TxItemSelect) Float64X

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

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

func (*TxItemSelect) Float64s

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

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

func (*TxItemSelect) Float64sX

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

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

func (*TxItemSelect) Int

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

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

func (*TxItemSelect) IntX

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

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

func (*TxItemSelect) Ints

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

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

func (*TxItemSelect) IntsX

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

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

func (*TxItemSelect) Scan

func (tis *TxItemSelect) Scan(ctx context.Context, v any) error

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

func (*TxItemSelect) ScanX

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

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

func (*TxItemSelect) String

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

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

func (*TxItemSelect) StringX

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

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

func (*TxItemSelect) Strings

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

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

func (*TxItemSelect) StringsX

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

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

type TxItemUpdate

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

TxItemUpdate is the builder for updating TxItem entities.

func (*TxItemUpdate) AddBookID

func (tiu *TxItemUpdate) AddBookID(i int64) *TxItemUpdate

AddBookID adds i to the "book_id" field.

func (*TxItemUpdate) AddPrice

func (tiu *TxItemUpdate) AddPrice(f float64) *TxItemUpdate

AddPrice adds f to the "price" field.

func (*TxItemUpdate) AddPublisherID

func (tiu *TxItemUpdate) AddPublisherID(i int64) *TxItemUpdate

AddPublisherID adds i to the "publisher_id" field.

func (*TxItemUpdate) AddQuantity

func (tiu *TxItemUpdate) AddQuantity(i int) *TxItemUpdate

AddQuantity adds i to the "quantity" field.

func (*TxItemUpdate) AddTxID

func (tiu *TxItemUpdate) AddTxID(i int64) *TxItemUpdate

AddTxID adds i to the "tx_id" field.

func (*TxItemUpdate) ClearImageURL

func (tiu *TxItemUpdate) ClearImageURL() *TxItemUpdate

ClearImageURL clears the value of the "image_url" field.

func (*TxItemUpdate) ClearPublisherID

func (tiu *TxItemUpdate) ClearPublisherID() *TxItemUpdate

ClearPublisherID clears the value of the "publisher_id" field.

func (*TxItemUpdate) Exec

func (tiu *TxItemUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TxItemUpdate) ExecX

func (tiu *TxItemUpdate) ExecX(ctx context.Context)

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

func (*TxItemUpdate) Mutation

func (tiu *TxItemUpdate) Mutation() *TxItemMutation

Mutation returns the TxItemMutation object of the builder.

func (*TxItemUpdate) Save

func (tiu *TxItemUpdate) Save(ctx context.Context) (int, error)

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

func (*TxItemUpdate) SaveX

func (tiu *TxItemUpdate) SaveX(ctx context.Context) int

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

func (*TxItemUpdate) SetAuthor

func (tiu *TxItemUpdate) SetAuthor(s string) *TxItemUpdate

SetAuthor sets the "author" field.

func (*TxItemUpdate) SetBookID

func (tiu *TxItemUpdate) SetBookID(i int64) *TxItemUpdate

SetBookID sets the "book_id" field.

func (*TxItemUpdate) SetImageURL

func (tiu *TxItemUpdate) SetImageURL(s string) *TxItemUpdate

SetImageURL sets the "image_url" field.

func (*TxItemUpdate) SetIsbn

func (tiu *TxItemUpdate) SetIsbn(s string) *TxItemUpdate

SetIsbn sets the "isbn" field.

func (*TxItemUpdate) SetNillableAuthor

func (tiu *TxItemUpdate) SetNillableAuthor(s *string) *TxItemUpdate

SetNillableAuthor sets the "author" field if the given value is not nil.

func (*TxItemUpdate) SetNillableBookID

func (tiu *TxItemUpdate) SetNillableBookID(i *int64) *TxItemUpdate

SetNillableBookID sets the "book_id" field if the given value is not nil.

func (*TxItemUpdate) SetNillableImageURL

func (tiu *TxItemUpdate) SetNillableImageURL(s *string) *TxItemUpdate

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*TxItemUpdate) SetNillableIsbn

func (tiu *TxItemUpdate) SetNillableIsbn(s *string) *TxItemUpdate

SetNillableIsbn sets the "isbn" field if the given value is not nil.

func (*TxItemUpdate) SetNillablePrice

func (tiu *TxItemUpdate) SetNillablePrice(f *float64) *TxItemUpdate

SetNillablePrice sets the "price" field if the given value is not nil.

func (*TxItemUpdate) SetNillablePublisherID

func (tiu *TxItemUpdate) SetNillablePublisherID(i *int64) *TxItemUpdate

SetNillablePublisherID sets the "publisher_id" field if the given value is not nil.

func (*TxItemUpdate) SetNillableQuantity

func (tiu *TxItemUpdate) SetNillableQuantity(i *int) *TxItemUpdate

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*TxItemUpdate) SetNillableTitle

func (tiu *TxItemUpdate) SetNillableTitle(s *string) *TxItemUpdate

SetNillableTitle sets the "title" field if the given value is not nil.

func (*TxItemUpdate) SetNillableTxID

func (tiu *TxItemUpdate) SetNillableTxID(i *int64) *TxItemUpdate

SetNillableTxID sets the "tx_id" field if the given value is not nil.

func (*TxItemUpdate) SetNillableTxType

func (tiu *TxItemUpdate) SetNillableTxType(tt *txitem.TxType) *TxItemUpdate

SetNillableTxType sets the "tx_type" field if the given value is not nil.

func (*TxItemUpdate) SetPrice

func (tiu *TxItemUpdate) SetPrice(f float64) *TxItemUpdate

SetPrice sets the "price" field.

func (*TxItemUpdate) SetPublisherID

func (tiu *TxItemUpdate) SetPublisherID(i int64) *TxItemUpdate

SetPublisherID sets the "publisher_id" field.

func (*TxItemUpdate) SetQuantity

func (tiu *TxItemUpdate) SetQuantity(i int) *TxItemUpdate

SetQuantity sets the "quantity" field.

func (*TxItemUpdate) SetTitle

func (tiu *TxItemUpdate) SetTitle(s string) *TxItemUpdate

SetTitle sets the "title" field.

func (*TxItemUpdate) SetTxID

func (tiu *TxItemUpdate) SetTxID(i int64) *TxItemUpdate

SetTxID sets the "tx_id" field.

func (*TxItemUpdate) SetTxType

func (tiu *TxItemUpdate) SetTxType(tt txitem.TxType) *TxItemUpdate

SetTxType sets the "tx_type" field.

func (*TxItemUpdate) Where

func (tiu *TxItemUpdate) Where(ps ...predicate.TxItem) *TxItemUpdate

Where appends a list predicates to the TxItemUpdate builder.

type TxItemUpdateOne

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

TxItemUpdateOne is the builder for updating a single TxItem entity.

func (*TxItemUpdateOne) AddBookID

func (tiuo *TxItemUpdateOne) AddBookID(i int64) *TxItemUpdateOne

AddBookID adds i to the "book_id" field.

func (*TxItemUpdateOne) AddPrice

func (tiuo *TxItemUpdateOne) AddPrice(f float64) *TxItemUpdateOne

AddPrice adds f to the "price" field.

func (*TxItemUpdateOne) AddPublisherID

func (tiuo *TxItemUpdateOne) AddPublisherID(i int64) *TxItemUpdateOne

AddPublisherID adds i to the "publisher_id" field.

func (*TxItemUpdateOne) AddQuantity

func (tiuo *TxItemUpdateOne) AddQuantity(i int) *TxItemUpdateOne

AddQuantity adds i to the "quantity" field.

func (*TxItemUpdateOne) AddTxID

func (tiuo *TxItemUpdateOne) AddTxID(i int64) *TxItemUpdateOne

AddTxID adds i to the "tx_id" field.

func (*TxItemUpdateOne) ClearImageURL

func (tiuo *TxItemUpdateOne) ClearImageURL() *TxItemUpdateOne

ClearImageURL clears the value of the "image_url" field.

func (*TxItemUpdateOne) ClearPublisherID

func (tiuo *TxItemUpdateOne) ClearPublisherID() *TxItemUpdateOne

ClearPublisherID clears the value of the "publisher_id" field.

func (*TxItemUpdateOne) Exec

func (tiuo *TxItemUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TxItemUpdateOne) ExecX

func (tiuo *TxItemUpdateOne) ExecX(ctx context.Context)

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

func (*TxItemUpdateOne) Mutation

func (tiuo *TxItemUpdateOne) Mutation() *TxItemMutation

Mutation returns the TxItemMutation object of the builder.

func (*TxItemUpdateOne) Save

func (tiuo *TxItemUpdateOne) Save(ctx context.Context) (*TxItem, error)

Save executes the query and returns the updated TxItem entity.

func (*TxItemUpdateOne) SaveX

func (tiuo *TxItemUpdateOne) SaveX(ctx context.Context) *TxItem

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

func (*TxItemUpdateOne) Select

func (tiuo *TxItemUpdateOne) Select(field string, fields ...string) *TxItemUpdateOne

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

func (*TxItemUpdateOne) SetAuthor

func (tiuo *TxItemUpdateOne) SetAuthor(s string) *TxItemUpdateOne

SetAuthor sets the "author" field.

func (*TxItemUpdateOne) SetBookID

func (tiuo *TxItemUpdateOne) SetBookID(i int64) *TxItemUpdateOne

SetBookID sets the "book_id" field.

func (*TxItemUpdateOne) SetImageURL

func (tiuo *TxItemUpdateOne) SetImageURL(s string) *TxItemUpdateOne

SetImageURL sets the "image_url" field.

func (*TxItemUpdateOne) SetIsbn

func (tiuo *TxItemUpdateOne) SetIsbn(s string) *TxItemUpdateOne

SetIsbn sets the "isbn" field.

func (*TxItemUpdateOne) SetNillableAuthor

func (tiuo *TxItemUpdateOne) SetNillableAuthor(s *string) *TxItemUpdateOne

SetNillableAuthor sets the "author" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableBookID

func (tiuo *TxItemUpdateOne) SetNillableBookID(i *int64) *TxItemUpdateOne

SetNillableBookID sets the "book_id" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableImageURL

func (tiuo *TxItemUpdateOne) SetNillableImageURL(s *string) *TxItemUpdateOne

SetNillableImageURL sets the "image_url" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableIsbn

func (tiuo *TxItemUpdateOne) SetNillableIsbn(s *string) *TxItemUpdateOne

SetNillableIsbn sets the "isbn" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillablePrice

func (tiuo *TxItemUpdateOne) SetNillablePrice(f *float64) *TxItemUpdateOne

SetNillablePrice sets the "price" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillablePublisherID

func (tiuo *TxItemUpdateOne) SetNillablePublisherID(i *int64) *TxItemUpdateOne

SetNillablePublisherID sets the "publisher_id" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableQuantity

func (tiuo *TxItemUpdateOne) SetNillableQuantity(i *int) *TxItemUpdateOne

SetNillableQuantity sets the "quantity" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableTitle

func (tiuo *TxItemUpdateOne) SetNillableTitle(s *string) *TxItemUpdateOne

SetNillableTitle sets the "title" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableTxID

func (tiuo *TxItemUpdateOne) SetNillableTxID(i *int64) *TxItemUpdateOne

SetNillableTxID sets the "tx_id" field if the given value is not nil.

func (*TxItemUpdateOne) SetNillableTxType

func (tiuo *TxItemUpdateOne) SetNillableTxType(tt *txitem.TxType) *TxItemUpdateOne

SetNillableTxType sets the "tx_type" field if the given value is not nil.

func (*TxItemUpdateOne) SetPrice

func (tiuo *TxItemUpdateOne) SetPrice(f float64) *TxItemUpdateOne

SetPrice sets the "price" field.

func (*TxItemUpdateOne) SetPublisherID

func (tiuo *TxItemUpdateOne) SetPublisherID(i int64) *TxItemUpdateOne

SetPublisherID sets the "publisher_id" field.

func (*TxItemUpdateOne) SetQuantity

func (tiuo *TxItemUpdateOne) SetQuantity(i int) *TxItemUpdateOne

SetQuantity sets the "quantity" field.

func (*TxItemUpdateOne) SetTitle

func (tiuo *TxItemUpdateOne) SetTitle(s string) *TxItemUpdateOne

SetTitle sets the "title" field.

func (*TxItemUpdateOne) SetTxID

func (tiuo *TxItemUpdateOne) SetTxID(i int64) *TxItemUpdateOne

SetTxID sets the "tx_id" field.

func (*TxItemUpdateOne) SetTxType

func (tiuo *TxItemUpdateOne) SetTxType(tt txitem.TxType) *TxItemUpdateOne

SetTxType sets the "tx_type" field.

func (*TxItemUpdateOne) Where

func (tiuo *TxItemUpdateOne) Where(ps ...predicate.TxItem) *TxItemUpdateOne

Where appends a list predicates to the TxItemUpdate builder.

type TxItems

type TxItems []*TxItem

TxItems is a parsable slice of TxItem.

type ValidationError

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

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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