Documentation ¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type Order
- type OrderClient
- func (c *OrderClient) Create() *OrderCreate
- func (c *OrderClient) CreateBulk(builders ...*OrderCreate) *OrderCreateBulk
- func (c *OrderClient) Delete() *OrderDelete
- func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne
- func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne
- func (c *OrderClient) Get(ctx context.Context, id int) (*Order, error)
- func (c *OrderClient) GetX(ctx context.Context, id int) *Order
- func (c *OrderClient) Hooks() []Hook
- func (c *OrderClient) Query() *OrderQuery
- func (c *OrderClient) Update() *OrderUpdate
- func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne
- func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne
- func (c *OrderClient) Use(hooks ...Hook)
- type OrderCreate
- func (oc *OrderCreate) Exec(ctx context.Context) error
- func (oc *OrderCreate) ExecX(ctx context.Context)
- func (oc *OrderCreate) Mutation() *OrderMutation
- func (oc *OrderCreate) Save(ctx context.Context) (*Order, error)
- func (oc *OrderCreate) SaveX(ctx context.Context) *Order
- func (oc *OrderCreate) SetAttach(s string) *OrderCreate
- func (oc *OrderCreate) SetAuthCode(s string) *OrderCreate
- func (oc *OrderCreate) SetBody(s string) *OrderCreate
- func (oc *OrderCreate) SetChannel(s string) *OrderCreate
- func (oc *OrderCreate) SetClientIP(s string) *OrderCreate
- func (oc *OrderCreate) SetExtendParams(s string) *OrderCreate
- func (oc *OrderCreate) SetJumpURL(s string) *OrderCreate
- func (oc *OrderCreate) SetMerchantID(s string) *OrderCreate
- func (oc *OrderCreate) SetNotifyURL(s string) *OrderCreate
- func (oc *OrderCreate) SetOrderExpiration(s string) *OrderCreate
- func (oc *OrderCreate) SetOrderStatus(i int8) *OrderCreate
- func (oc *OrderCreate) SetOutOrderNo(s string) *OrderCreate
- func (oc *OrderCreate) SetPayWay(s string) *OrderCreate
- func (oc *OrderCreate) SetSubOpenid(s string) *OrderCreate
- func (oc *OrderCreate) SetTotalAmount(u uint64) *OrderCreate
- func (oc *OrderCreate) SetWxAppid(s string) *OrderCreate
- type OrderCreateBulk
- type OrderDelete
- type OrderDeleteOne
- type OrderFunc
- type OrderGroupBy
- func (ogb *OrderGroupBy) Aggregate(fns ...AggregateFunc) *OrderGroupBy
- func (s *OrderGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *OrderGroupBy) BoolX(ctx context.Context) bool
- func (s *OrderGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *OrderGroupBy) BoolsX(ctx context.Context) []bool
- func (s *OrderGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *OrderGroupBy) Float64X(ctx context.Context) float64
- func (s *OrderGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *OrderGroupBy) Float64sX(ctx context.Context) []float64
- func (s *OrderGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *OrderGroupBy) IntX(ctx context.Context) int
- func (s *OrderGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *OrderGroupBy) IntsX(ctx context.Context) []int
- func (ogb *OrderGroupBy) Scan(ctx context.Context, v any) error
- func (s *OrderGroupBy) ScanX(ctx context.Context, v any)
- func (s *OrderGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *OrderGroupBy) StringX(ctx context.Context) string
- func (s *OrderGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *OrderGroupBy) StringsX(ctx context.Context) []string
- type OrderMutation
- func (m *OrderMutation) AddField(name string, value ent.Value) error
- func (m *OrderMutation) AddOrderStatus(i int8)
- func (m *OrderMutation) AddTotalAmount(u int64)
- func (m *OrderMutation) AddedEdges() []string
- func (m *OrderMutation) AddedField(name string) (ent.Value, bool)
- func (m *OrderMutation) AddedFields() []string
- func (m *OrderMutation) AddedIDs(name string) []ent.Value
- func (m *OrderMutation) AddedOrderStatus() (r int8, exists bool)
- func (m *OrderMutation) AddedTotalAmount() (r int64, exists bool)
- func (m *OrderMutation) Attach() (r string, exists bool)
- func (m *OrderMutation) AuthCode() (r string, exists bool)
- func (m *OrderMutation) Body() (r string, exists bool)
- func (m *OrderMutation) Channel() (r string, exists bool)
- func (m *OrderMutation) ClearEdge(name string) error
- func (m *OrderMutation) ClearField(name string) error
- func (m *OrderMutation) ClearedEdges() []string
- func (m *OrderMutation) ClearedFields() []string
- func (m OrderMutation) Client() *Client
- func (m *OrderMutation) ClientIP() (r string, exists bool)
- func (m *OrderMutation) EdgeCleared(name string) bool
- func (m *OrderMutation) ExtendParams() (r string, exists bool)
- func (m *OrderMutation) Field(name string) (ent.Value, bool)
- func (m *OrderMutation) FieldCleared(name string) bool
- func (m *OrderMutation) Fields() []string
- func (m *OrderMutation) ID() (id int, exists bool)
- func (m *OrderMutation) IDs(ctx context.Context) ([]int, error)
- func (m *OrderMutation) JumpURL() (r string, exists bool)
- func (m *OrderMutation) MerchantID() (r string, exists bool)
- func (m *OrderMutation) NotifyURL() (r string, exists bool)
- func (m *OrderMutation) OldAttach(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldAuthCode(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldBody(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldChannel(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldClientIP(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldExtendParams(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *OrderMutation) OldJumpURL(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldMerchantID(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldNotifyURL(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldOrderExpiration(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldOrderStatus(ctx context.Context) (v int8, err error)
- func (m *OrderMutation) OldOutOrderNo(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldPayWay(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldSubOpenid(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldTotalAmount(ctx context.Context) (v uint64, err error)
- func (m *OrderMutation) OldWxAppid(ctx context.Context) (v string, err error)
- func (m *OrderMutation) Op() Op
- func (m *OrderMutation) OrderExpiration() (r string, exists bool)
- func (m *OrderMutation) OrderStatus() (r int8, exists bool)
- func (m *OrderMutation) OutOrderNo() (r string, exists bool)
- func (m *OrderMutation) PayWay() (r string, exists bool)
- func (m *OrderMutation) RemovedEdges() []string
- func (m *OrderMutation) RemovedIDs(name string) []ent.Value
- func (m *OrderMutation) ResetAttach()
- func (m *OrderMutation) ResetAuthCode()
- func (m *OrderMutation) ResetBody()
- func (m *OrderMutation) ResetChannel()
- func (m *OrderMutation) ResetClientIP()
- func (m *OrderMutation) ResetEdge(name string) error
- func (m *OrderMutation) ResetExtendParams()
- func (m *OrderMutation) ResetField(name string) error
- func (m *OrderMutation) ResetJumpURL()
- func (m *OrderMutation) ResetMerchantID()
- func (m *OrderMutation) ResetNotifyURL()
- func (m *OrderMutation) ResetOrderExpiration()
- func (m *OrderMutation) ResetOrderStatus()
- func (m *OrderMutation) ResetOutOrderNo()
- func (m *OrderMutation) ResetPayWay()
- func (m *OrderMutation) ResetSubOpenid()
- func (m *OrderMutation) ResetTotalAmount()
- func (m *OrderMutation) ResetWxAppid()
- func (m *OrderMutation) SetAttach(s string)
- func (m *OrderMutation) SetAuthCode(s string)
- func (m *OrderMutation) SetBody(s string)
- func (m *OrderMutation) SetChannel(s string)
- func (m *OrderMutation) SetClientIP(s string)
- func (m *OrderMutation) SetExtendParams(s string)
- func (m *OrderMutation) SetField(name string, value ent.Value) error
- func (m *OrderMutation) SetJumpURL(s string)
- func (m *OrderMutation) SetMerchantID(s string)
- func (m *OrderMutation) SetNotifyURL(s string)
- func (m *OrderMutation) SetOrderExpiration(s string)
- func (m *OrderMutation) SetOrderStatus(i int8)
- func (m *OrderMutation) SetOutOrderNo(s string)
- func (m *OrderMutation) SetPayWay(s string)
- func (m *OrderMutation) SetSubOpenid(s string)
- func (m *OrderMutation) SetTotalAmount(u uint64)
- func (m *OrderMutation) SetWxAppid(s string)
- func (m *OrderMutation) SubOpenid() (r string, exists bool)
- func (m *OrderMutation) TotalAmount() (r uint64, exists bool)
- func (m OrderMutation) Tx() (*Tx, error)
- func (m *OrderMutation) Type() string
- func (m *OrderMutation) Where(ps ...predicate.Order)
- func (m *OrderMutation) WxAppid() (r string, exists bool)
- type OrderQuery
- func (oq *OrderQuery) Aggregate(fns ...AggregateFunc) *OrderSelect
- func (oq *OrderQuery) All(ctx context.Context) ([]*Order, error)
- func (oq *OrderQuery) AllX(ctx context.Context) []*Order
- func (oq *OrderQuery) Clone() *OrderQuery
- func (oq *OrderQuery) Count(ctx context.Context) (int, error)
- func (oq *OrderQuery) CountX(ctx context.Context) int
- func (oq *OrderQuery) Exist(ctx context.Context) (bool, error)
- func (oq *OrderQuery) ExistX(ctx context.Context) bool
- func (oq *OrderQuery) First(ctx context.Context) (*Order, error)
- func (oq *OrderQuery) FirstID(ctx context.Context) (id int, err error)
- func (oq *OrderQuery) FirstIDX(ctx context.Context) int
- func (oq *OrderQuery) FirstX(ctx context.Context) *Order
- func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy
- func (oq *OrderQuery) IDs(ctx context.Context) ([]int, error)
- func (oq *OrderQuery) IDsX(ctx context.Context) []int
- func (oq *OrderQuery) Limit(limit int) *OrderQuery
- func (oq *OrderQuery) Offset(offset int) *OrderQuery
- func (oq *OrderQuery) Only(ctx context.Context) (*Order, error)
- func (oq *OrderQuery) OnlyID(ctx context.Context) (id int, err error)
- func (oq *OrderQuery) OnlyIDX(ctx context.Context) int
- func (oq *OrderQuery) OnlyX(ctx context.Context) *Order
- func (oq *OrderQuery) Order(o ...OrderFunc) *OrderQuery
- func (oq *OrderQuery) Select(fields ...string) *OrderSelect
- func (oq *OrderQuery) Unique(unique bool) *OrderQuery
- func (oq *OrderQuery) Where(ps ...predicate.Order) *OrderQuery
- type OrderSelect
- func (os *OrderSelect) Aggregate(fns ...AggregateFunc) *OrderSelect
- func (s *OrderSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *OrderSelect) BoolX(ctx context.Context) bool
- func (s *OrderSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *OrderSelect) BoolsX(ctx context.Context) []bool
- func (s *OrderSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *OrderSelect) Float64X(ctx context.Context) float64
- func (s *OrderSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *OrderSelect) Float64sX(ctx context.Context) []float64
- func (s *OrderSelect) Int(ctx context.Context) (_ int, err error)
- func (s *OrderSelect) IntX(ctx context.Context) int
- func (s *OrderSelect) Ints(ctx context.Context) ([]int, error)
- func (s *OrderSelect) IntsX(ctx context.Context) []int
- func (os *OrderSelect) Scan(ctx context.Context, v any) error
- func (s *OrderSelect) ScanX(ctx context.Context, v any)
- func (s *OrderSelect) String(ctx context.Context) (_ string, err error)
- func (s *OrderSelect) StringX(ctx context.Context) string
- func (s *OrderSelect) Strings(ctx context.Context) ([]string, error)
- func (s *OrderSelect) StringsX(ctx context.Context) []string
- type OrderUpdate
- func (ou *OrderUpdate) AddOrderStatus(i int8) *OrderUpdate
- func (ou *OrderUpdate) AddTotalAmount(u int64) *OrderUpdate
- func (ou *OrderUpdate) Exec(ctx context.Context) error
- func (ou *OrderUpdate) ExecX(ctx context.Context)
- func (ou *OrderUpdate) Mutation() *OrderMutation
- func (ou *OrderUpdate) Save(ctx context.Context) (int, error)
- func (ou *OrderUpdate) SaveX(ctx context.Context) int
- func (ou *OrderUpdate) SetAttach(s string) *OrderUpdate
- func (ou *OrderUpdate) SetAuthCode(s string) *OrderUpdate
- func (ou *OrderUpdate) SetBody(s string) *OrderUpdate
- func (ou *OrderUpdate) SetChannel(s string) *OrderUpdate
- func (ou *OrderUpdate) SetClientIP(s string) *OrderUpdate
- func (ou *OrderUpdate) SetExtendParams(s string) *OrderUpdate
- func (ou *OrderUpdate) SetJumpURL(s string) *OrderUpdate
- func (ou *OrderUpdate) SetMerchantID(s string) *OrderUpdate
- func (ou *OrderUpdate) SetNotifyURL(s string) *OrderUpdate
- func (ou *OrderUpdate) SetOrderExpiration(s string) *OrderUpdate
- func (ou *OrderUpdate) SetOrderStatus(i int8) *OrderUpdate
- func (ou *OrderUpdate) SetOutOrderNo(s string) *OrderUpdate
- func (ou *OrderUpdate) SetPayWay(s string) *OrderUpdate
- func (ou *OrderUpdate) SetSubOpenid(s string) *OrderUpdate
- func (ou *OrderUpdate) SetTotalAmount(u uint64) *OrderUpdate
- func (ou *OrderUpdate) SetWxAppid(s string) *OrderUpdate
- func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate
- type OrderUpdateOne
- func (ouo *OrderUpdateOne) AddOrderStatus(i int8) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddTotalAmount(u int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) Exec(ctx context.Context) error
- func (ouo *OrderUpdateOne) ExecX(ctx context.Context)
- func (ouo *OrderUpdateOne) Mutation() *OrderMutation
- func (ouo *OrderUpdateOne) Save(ctx context.Context) (*Order, error)
- func (ouo *OrderUpdateOne) SaveX(ctx context.Context) *Order
- func (ouo *OrderUpdateOne) Select(field string, fields ...string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetAttach(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetAuthCode(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetBody(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetChannel(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetClientIP(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetExtendParams(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetJumpURL(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetMerchantID(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetNotifyURL(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetOrderExpiration(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetOrderStatus(i int8) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetOutOrderNo(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetPayWay(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetSubOpenid(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetTotalAmount(u uint64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetWxAppid(s string) *OrderUpdateOne
- type Orders
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeOrder = "Order" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
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 // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
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) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Order. Query(). Count(ctx)
type CommitFunc ¶
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.
type CommitHook ¶
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 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 MutateFunc ¶
type MutateFunc = ent.MutateFunc
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 Order ¶
type Order struct { // ID of the ent. ID int `json:"id,omitempty"` // MerchantID holds the value of the "merchant_id" field. MerchantID string `json:"merchant_id,omitempty"` // Channel holds the value of the "channel" field. Channel string `json:"channel,omitempty"` // PayWay holds the value of the "pay_way" field. PayWay string `json:"pay_way,omitempty"` // OutOrderNo holds the value of the "out_order_no" field. OutOrderNo string `json:"out_order_no,omitempty"` // TotalAmount holds the value of the "total_amount" field. TotalAmount uint64 `json:"total_amount,omitempty"` // Body holds the value of the "body" field. Body string `json:"body,omitempty"` // OrderStatus holds the value of the "order_status" field. OrderStatus int8 `json:"order_status,omitempty"` // AuthCode holds the value of the "auth_code" field. AuthCode string `json:"auth_code,omitempty"` // WxAppid holds the value of the "wx_appid" field. WxAppid string `json:"wx_appid,omitempty"` // SubOpenid holds the value of the "sub_openid" field. SubOpenid string `json:"sub_openid,omitempty"` // JumpURL holds the value of the "jump_url" field. JumpURL string `json:"jump_url,omitempty"` // NotifyURL holds the value of the "notify_url" field. NotifyURL string `json:"notify_url,omitempty"` // ClientIP holds the value of the "client_ip" field. ClientIP string `json:"client_ip,omitempty"` // Attach holds the value of the "attach" field. Attach string `json:"attach,omitempty"` // OrderExpiration holds the value of the "order_expiration" field. OrderExpiration string `json:"order_expiration,omitempty"` // ExtendParams holds the value of the "extend_params" field. ExtendParams string `json:"extend_params,omitempty"` // contains filtered or unexported fields }
Order is the model entity for the Order schema.
func (*Order) Unwrap ¶
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.
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 int) *OrderDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*OrderClient) GetX ¶
func (c *OrderClient) GetX(ctx context.Context, id int) *Order
GetX is like Get, but panics if an error occurs.
func (*OrderClient) Query ¶
func (c *OrderClient) Query() *OrderQuery
Query returns a query builder for 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 int) *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) 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) SetAttach ¶
func (oc *OrderCreate) SetAttach(s string) *OrderCreate
SetAttach sets the "attach" field.
func (*OrderCreate) SetAuthCode ¶
func (oc *OrderCreate) SetAuthCode(s string) *OrderCreate
SetAuthCode sets the "auth_code" field.
func (*OrderCreate) SetBody ¶
func (oc *OrderCreate) SetBody(s string) *OrderCreate
SetBody sets the "body" field.
func (*OrderCreate) SetChannel ¶
func (oc *OrderCreate) SetChannel(s string) *OrderCreate
SetChannel sets the "channel" field.
func (*OrderCreate) SetClientIP ¶
func (oc *OrderCreate) SetClientIP(s string) *OrderCreate
SetClientIP sets the "client_ip" field.
func (*OrderCreate) SetExtendParams ¶
func (oc *OrderCreate) SetExtendParams(s string) *OrderCreate
SetExtendParams sets the "extend_params" field.
func (*OrderCreate) SetJumpURL ¶
func (oc *OrderCreate) SetJumpURL(s string) *OrderCreate
SetJumpURL sets the "jump_url" field.
func (*OrderCreate) SetMerchantID ¶
func (oc *OrderCreate) SetMerchantID(s string) *OrderCreate
SetMerchantID sets the "merchant_id" field.
func (*OrderCreate) SetNotifyURL ¶
func (oc *OrderCreate) SetNotifyURL(s string) *OrderCreate
SetNotifyURL sets the "notify_url" field.
func (*OrderCreate) SetOrderExpiration ¶
func (oc *OrderCreate) SetOrderExpiration(s string) *OrderCreate
SetOrderExpiration sets the "order_expiration" field.
func (*OrderCreate) SetOrderStatus ¶
func (oc *OrderCreate) SetOrderStatus(i int8) *OrderCreate
SetOrderStatus sets the "order_status" field.
func (*OrderCreate) SetOutOrderNo ¶
func (oc *OrderCreate) SetOutOrderNo(s string) *OrderCreate
SetOutOrderNo sets the "out_order_no" field.
func (*OrderCreate) SetPayWay ¶
func (oc *OrderCreate) SetPayWay(s string) *OrderCreate
SetPayWay sets the "pay_way" field.
func (*OrderCreate) SetSubOpenid ¶
func (oc *OrderCreate) SetSubOpenid(s string) *OrderCreate
SetSubOpenid sets the "sub_openid" field.
func (*OrderCreate) SetTotalAmount ¶
func (oc *OrderCreate) SetTotalAmount(u uint64) *OrderCreate
SetTotalAmount sets the "total_amount" field.
func (*OrderCreate) SetWxAppid ¶
func (oc *OrderCreate) SetWxAppid(s string) *OrderCreate
SetWxAppid sets the "wx_appid" 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.
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.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*OrderGroupBy) Scan ¶
func (ogb *OrderGroupBy) Scan(ctx context.Context, v any) error
Scan applies the group-by query and scans the result into the given value.
func (*OrderGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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) AddOrderStatus ¶
func (m *OrderMutation) AddOrderStatus(i int8)
AddOrderStatus adds i to the "order_status" field.
func (*OrderMutation) AddTotalAmount ¶
func (m *OrderMutation) AddTotalAmount(u int64)
AddTotalAmount adds u to the "total_amount" field.
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) AddedOrderStatus ¶
func (m *OrderMutation) AddedOrderStatus() (r int8, exists bool)
AddedOrderStatus returns the value that was added to the "order_status" field in this mutation.
func (*OrderMutation) AddedTotalAmount ¶
func (m *OrderMutation) AddedTotalAmount() (r int64, exists bool)
AddedTotalAmount returns the value that was added to the "total_amount" field in this mutation.
func (*OrderMutation) Attach ¶
func (m *OrderMutation) Attach() (r string, exists bool)
Attach returns the value of the "attach" field in the mutation.
func (*OrderMutation) AuthCode ¶
func (m *OrderMutation) AuthCode() (r string, exists bool)
AuthCode returns the value of the "auth_code" field in the mutation.
func (*OrderMutation) Body ¶
func (m *OrderMutation) Body() (r string, exists bool)
Body returns the value of the "body" field in the mutation.
func (*OrderMutation) Channel ¶
func (m *OrderMutation) Channel() (r string, exists bool)
Channel returns the value of the "channel" field in the mutation.
func (*OrderMutation) ClearEdge ¶
func (m *OrderMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*OrderMutation) ClearField ¶
func (m *OrderMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*OrderMutation) 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) ClientIP ¶
func (m *OrderMutation) ClientIP() (r string, exists bool)
ClientIP returns the value of the "client_ip" field in the mutation.
func (*OrderMutation) EdgeCleared ¶
func (m *OrderMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*OrderMutation) ExtendParams ¶
func (m *OrderMutation) ExtendParams() (r string, exists bool)
ExtendParams returns the value of the "extend_params" field in the 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 int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*OrderMutation) IDs ¶
func (m *OrderMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*OrderMutation) JumpURL ¶
func (m *OrderMutation) JumpURL() (r string, exists bool)
JumpURL returns the value of the "jump_url" field in the mutation.
func (*OrderMutation) MerchantID ¶
func (m *OrderMutation) MerchantID() (r string, exists bool)
MerchantID returns the value of the "merchant_id" field in the mutation.
func (*OrderMutation) NotifyURL ¶
func (m *OrderMutation) NotifyURL() (r string, exists bool)
NotifyURL returns the value of the "notify_url" field in the mutation.
func (*OrderMutation) OldAttach ¶
func (m *OrderMutation) OldAttach(ctx context.Context) (v string, err error)
OldAttach returns the old "attach" 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) OldAuthCode ¶
func (m *OrderMutation) OldAuthCode(ctx context.Context) (v string, err error)
OldAuthCode returns the old "auth_code" 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) OldBody ¶
func (m *OrderMutation) OldBody(ctx context.Context) (v string, err error)
OldBody returns the old "body" 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) OldChannel ¶
func (m *OrderMutation) OldChannel(ctx context.Context) (v string, err error)
OldChannel returns the old "channel" 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) OldClientIP ¶
func (m *OrderMutation) OldClientIP(ctx context.Context) (v string, err error)
OldClientIP returns the old "client_ip" 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) OldExtendParams ¶
func (m *OrderMutation) OldExtendParams(ctx context.Context) (v string, err error)
OldExtendParams returns the old "extend_params" 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 ¶
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) OldJumpURL ¶
func (m *OrderMutation) OldJumpURL(ctx context.Context) (v string, err error)
OldJumpURL returns the old "jump_url" 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) OldMerchantID ¶
func (m *OrderMutation) OldMerchantID(ctx context.Context) (v string, err error)
OldMerchantID returns the old "merchant_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) OldNotifyURL ¶
func (m *OrderMutation) OldNotifyURL(ctx context.Context) (v string, err error)
OldNotifyURL returns the old "notify_url" 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) OldOrderExpiration ¶
func (m *OrderMutation) OldOrderExpiration(ctx context.Context) (v string, err error)
OldOrderExpiration returns the old "order_expiration" 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 int8, 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) OldOutOrderNo ¶
func (m *OrderMutation) OldOutOrderNo(ctx context.Context) (v string, err error)
OldOutOrderNo returns the old "out_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) OldPayWay ¶
func (m *OrderMutation) OldPayWay(ctx context.Context) (v string, err error)
OldPayWay returns the old "pay_way" 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) OldSubOpenid ¶
func (m *OrderMutation) OldSubOpenid(ctx context.Context) (v string, err error)
OldSubOpenid returns the old "sub_openid" 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 uint64, 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) OldWxAppid ¶
func (m *OrderMutation) OldWxAppid(ctx context.Context) (v string, err error)
OldWxAppid returns the old "wx_appid" 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) OrderExpiration ¶
func (m *OrderMutation) OrderExpiration() (r string, exists bool)
OrderExpiration returns the value of the "order_expiration" field in the mutation.
func (*OrderMutation) OrderStatus ¶
func (m *OrderMutation) OrderStatus() (r int8, exists bool)
OrderStatus returns the value of the "order_status" field in the mutation.
func (*OrderMutation) OutOrderNo ¶
func (m *OrderMutation) OutOrderNo() (r string, exists bool)
OutOrderNo returns the value of the "out_order_no" field in the mutation.
func (*OrderMutation) PayWay ¶
func (m *OrderMutation) PayWay() (r string, exists bool)
PayWay returns the value of the "pay_way" field in the mutation.
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) ResetAttach ¶
func (m *OrderMutation) ResetAttach()
ResetAttach resets all changes to the "attach" field.
func (*OrderMutation) ResetAuthCode ¶
func (m *OrderMutation) ResetAuthCode()
ResetAuthCode resets all changes to the "auth_code" field.
func (*OrderMutation) ResetBody ¶
func (m *OrderMutation) ResetBody()
ResetBody resets all changes to the "body" field.
func (*OrderMutation) ResetChannel ¶
func (m *OrderMutation) ResetChannel()
ResetChannel resets all changes to the "channel" field.
func (*OrderMutation) ResetClientIP ¶
func (m *OrderMutation) ResetClientIP()
ResetClientIP resets all changes to the "client_ip" 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) ResetExtendParams ¶
func (m *OrderMutation) ResetExtendParams()
ResetExtendParams resets all changes to the "extend_params" field.
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) ResetJumpURL ¶
func (m *OrderMutation) ResetJumpURL()
ResetJumpURL resets all changes to the "jump_url" field.
func (*OrderMutation) ResetMerchantID ¶
func (m *OrderMutation) ResetMerchantID()
ResetMerchantID resets all changes to the "merchant_id" field.
func (*OrderMutation) ResetNotifyURL ¶
func (m *OrderMutation) ResetNotifyURL()
ResetNotifyURL resets all changes to the "notify_url" field.
func (*OrderMutation) ResetOrderExpiration ¶
func (m *OrderMutation) ResetOrderExpiration()
ResetOrderExpiration resets all changes to the "order_expiration" field.
func (*OrderMutation) ResetOrderStatus ¶
func (m *OrderMutation) ResetOrderStatus()
ResetOrderStatus resets all changes to the "order_status" field.
func (*OrderMutation) ResetOutOrderNo ¶
func (m *OrderMutation) ResetOutOrderNo()
ResetOutOrderNo resets all changes to the "out_order_no" field.
func (*OrderMutation) ResetPayWay ¶
func (m *OrderMutation) ResetPayWay()
ResetPayWay resets all changes to the "pay_way" field.
func (*OrderMutation) ResetSubOpenid ¶
func (m *OrderMutation) ResetSubOpenid()
ResetSubOpenid resets all changes to the "sub_openid" field.
func (*OrderMutation) ResetTotalAmount ¶
func (m *OrderMutation) ResetTotalAmount()
ResetTotalAmount resets all changes to the "total_amount" field.
func (*OrderMutation) ResetWxAppid ¶
func (m *OrderMutation) ResetWxAppid()
ResetWxAppid resets all changes to the "wx_appid" field.
func (*OrderMutation) SetAttach ¶
func (m *OrderMutation) SetAttach(s string)
SetAttach sets the "attach" field.
func (*OrderMutation) SetAuthCode ¶
func (m *OrderMutation) SetAuthCode(s string)
SetAuthCode sets the "auth_code" field.
func (*OrderMutation) SetBody ¶
func (m *OrderMutation) SetBody(s string)
SetBody sets the "body" field.
func (*OrderMutation) SetChannel ¶
func (m *OrderMutation) SetChannel(s string)
SetChannel sets the "channel" field.
func (*OrderMutation) SetClientIP ¶
func (m *OrderMutation) SetClientIP(s string)
SetClientIP sets the "client_ip" field.
func (*OrderMutation) SetExtendParams ¶
func (m *OrderMutation) SetExtendParams(s string)
SetExtendParams sets the "extend_params" 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) SetJumpURL ¶
func (m *OrderMutation) SetJumpURL(s string)
SetJumpURL sets the "jump_url" field.
func (*OrderMutation) SetMerchantID ¶
func (m *OrderMutation) SetMerchantID(s string)
SetMerchantID sets the "merchant_id" field.
func (*OrderMutation) SetNotifyURL ¶
func (m *OrderMutation) SetNotifyURL(s string)
SetNotifyURL sets the "notify_url" field.
func (*OrderMutation) SetOrderExpiration ¶
func (m *OrderMutation) SetOrderExpiration(s string)
SetOrderExpiration sets the "order_expiration" field.
func (*OrderMutation) SetOrderStatus ¶
func (m *OrderMutation) SetOrderStatus(i int8)
SetOrderStatus sets the "order_status" field.
func (*OrderMutation) SetOutOrderNo ¶
func (m *OrderMutation) SetOutOrderNo(s string)
SetOutOrderNo sets the "out_order_no" field.
func (*OrderMutation) SetPayWay ¶
func (m *OrderMutation) SetPayWay(s string)
SetPayWay sets the "pay_way" field.
func (*OrderMutation) SetSubOpenid ¶
func (m *OrderMutation) SetSubOpenid(s string)
SetSubOpenid sets the "sub_openid" field.
func (*OrderMutation) SetTotalAmount ¶
func (m *OrderMutation) SetTotalAmount(u uint64)
SetTotalAmount sets the "total_amount" field.
func (*OrderMutation) SetWxAppid ¶
func (m *OrderMutation) SetWxAppid(s string)
SetWxAppid sets the "wx_appid" field.
func (*OrderMutation) SubOpenid ¶
func (m *OrderMutation) SubOpenid() (r string, exists bool)
SubOpenid returns the value of the "sub_openid" field in the mutation.
func (*OrderMutation) TotalAmount ¶
func (m *OrderMutation) TotalAmount() (r uint64, exists bool)
TotalAmount returns the value of the "total_amount" field in the mutation.
func (OrderMutation) Tx ¶
func (m OrderMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*OrderMutation) Type ¶
func (m *OrderMutation) Type() string
Type returns the node type of this mutation (Order).
func (*OrderMutation) Where ¶
func (m *OrderMutation) Where(ps ...predicate.Order)
Where appends a list predicates to the OrderMutation builder.
func (*OrderMutation) WxAppid ¶
func (m *OrderMutation) WxAppid() (r string, exists bool)
WxAppid returns the value of the "wx_appid" field in the mutation.
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 int, 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) int
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 { MerchantID string `json:"merchant_id,omitempty"` Count int `json:"count,omitempty"` } client.Order.Query(). GroupBy(order.FieldMerchantID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*OrderQuery) IDs ¶
func (oq *OrderQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Order IDs.
func (*OrderQuery) IDsX ¶
func (oq *OrderQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*OrderQuery) Limit ¶
func (oq *OrderQuery) Limit(limit int) *OrderQuery
Limit adds a limit step to the query.
func (*OrderQuery) Offset ¶
func (oq *OrderQuery) Offset(offset int) *OrderQuery
Offset adds an offset step to the query.
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 int, 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) int
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 ...OrderFunc) *OrderQuery
Order adds an order step to the query.
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 { MerchantID string `json:"merchant_id,omitempty"` } client.Order.Query(). Select(order.FieldMerchantID). 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.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*OrderSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*OrderSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*OrderSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*OrderSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*OrderSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type OrderUpdate ¶
type OrderUpdate struct {
// contains filtered or unexported fields
}
OrderUpdate is the builder for updating Order entities.
func (*OrderUpdate) AddOrderStatus ¶
func (ou *OrderUpdate) AddOrderStatus(i int8) *OrderUpdate
AddOrderStatus adds i to the "order_status" field.
func (*OrderUpdate) AddTotalAmount ¶
func (ou *OrderUpdate) AddTotalAmount(u int64) *OrderUpdate
AddTotalAmount adds u to the "total_amount" field.
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) 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) SetAttach ¶
func (ou *OrderUpdate) SetAttach(s string) *OrderUpdate
SetAttach sets the "attach" field.
func (*OrderUpdate) SetAuthCode ¶
func (ou *OrderUpdate) SetAuthCode(s string) *OrderUpdate
SetAuthCode sets the "auth_code" field.
func (*OrderUpdate) SetBody ¶
func (ou *OrderUpdate) SetBody(s string) *OrderUpdate
SetBody sets the "body" field.
func (*OrderUpdate) SetChannel ¶
func (ou *OrderUpdate) SetChannel(s string) *OrderUpdate
SetChannel sets the "channel" field.
func (*OrderUpdate) SetClientIP ¶
func (ou *OrderUpdate) SetClientIP(s string) *OrderUpdate
SetClientIP sets the "client_ip" field.
func (*OrderUpdate) SetExtendParams ¶
func (ou *OrderUpdate) SetExtendParams(s string) *OrderUpdate
SetExtendParams sets the "extend_params" field.
func (*OrderUpdate) SetJumpURL ¶
func (ou *OrderUpdate) SetJumpURL(s string) *OrderUpdate
SetJumpURL sets the "jump_url" field.
func (*OrderUpdate) SetMerchantID ¶
func (ou *OrderUpdate) SetMerchantID(s string) *OrderUpdate
SetMerchantID sets the "merchant_id" field.
func (*OrderUpdate) SetNotifyURL ¶
func (ou *OrderUpdate) SetNotifyURL(s string) *OrderUpdate
SetNotifyURL sets the "notify_url" field.
func (*OrderUpdate) SetOrderExpiration ¶
func (ou *OrderUpdate) SetOrderExpiration(s string) *OrderUpdate
SetOrderExpiration sets the "order_expiration" field.
func (*OrderUpdate) SetOrderStatus ¶
func (ou *OrderUpdate) SetOrderStatus(i int8) *OrderUpdate
SetOrderStatus sets the "order_status" field.
func (*OrderUpdate) SetOutOrderNo ¶
func (ou *OrderUpdate) SetOutOrderNo(s string) *OrderUpdate
SetOutOrderNo sets the "out_order_no" field.
func (*OrderUpdate) SetPayWay ¶
func (ou *OrderUpdate) SetPayWay(s string) *OrderUpdate
SetPayWay sets the "pay_way" field.
func (*OrderUpdate) SetSubOpenid ¶
func (ou *OrderUpdate) SetSubOpenid(s string) *OrderUpdate
SetSubOpenid sets the "sub_openid" field.
func (*OrderUpdate) SetTotalAmount ¶
func (ou *OrderUpdate) SetTotalAmount(u uint64) *OrderUpdate
SetTotalAmount sets the "total_amount" field.
func (*OrderUpdate) SetWxAppid ¶
func (ou *OrderUpdate) SetWxAppid(s string) *OrderUpdate
SetWxAppid sets the "wx_appid" 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) AddOrderStatus ¶
func (ouo *OrderUpdateOne) AddOrderStatus(i int8) *OrderUpdateOne
AddOrderStatus adds i to the "order_status" field.
func (*OrderUpdateOne) AddTotalAmount ¶
func (ouo *OrderUpdateOne) AddTotalAmount(u int64) *OrderUpdateOne
AddTotalAmount adds u to the "total_amount" field.
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) 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) SetAttach ¶
func (ouo *OrderUpdateOne) SetAttach(s string) *OrderUpdateOne
SetAttach sets the "attach" field.
func (*OrderUpdateOne) SetAuthCode ¶
func (ouo *OrderUpdateOne) SetAuthCode(s string) *OrderUpdateOne
SetAuthCode sets the "auth_code" field.
func (*OrderUpdateOne) SetBody ¶
func (ouo *OrderUpdateOne) SetBody(s string) *OrderUpdateOne
SetBody sets the "body" field.
func (*OrderUpdateOne) SetChannel ¶
func (ouo *OrderUpdateOne) SetChannel(s string) *OrderUpdateOne
SetChannel sets the "channel" field.
func (*OrderUpdateOne) SetClientIP ¶
func (ouo *OrderUpdateOne) SetClientIP(s string) *OrderUpdateOne
SetClientIP sets the "client_ip" field.
func (*OrderUpdateOne) SetExtendParams ¶
func (ouo *OrderUpdateOne) SetExtendParams(s string) *OrderUpdateOne
SetExtendParams sets the "extend_params" field.
func (*OrderUpdateOne) SetJumpURL ¶
func (ouo *OrderUpdateOne) SetJumpURL(s string) *OrderUpdateOne
SetJumpURL sets the "jump_url" field.
func (*OrderUpdateOne) SetMerchantID ¶
func (ouo *OrderUpdateOne) SetMerchantID(s string) *OrderUpdateOne
SetMerchantID sets the "merchant_id" field.
func (*OrderUpdateOne) SetNotifyURL ¶
func (ouo *OrderUpdateOne) SetNotifyURL(s string) *OrderUpdateOne
SetNotifyURL sets the "notify_url" field.
func (*OrderUpdateOne) SetOrderExpiration ¶
func (ouo *OrderUpdateOne) SetOrderExpiration(s string) *OrderUpdateOne
SetOrderExpiration sets the "order_expiration" field.
func (*OrderUpdateOne) SetOrderStatus ¶
func (ouo *OrderUpdateOne) SetOrderStatus(i int8) *OrderUpdateOne
SetOrderStatus sets the "order_status" field.
func (*OrderUpdateOne) SetOutOrderNo ¶
func (ouo *OrderUpdateOne) SetOutOrderNo(s string) *OrderUpdateOne
SetOutOrderNo sets the "out_order_no" field.
func (*OrderUpdateOne) SetPayWay ¶
func (ouo *OrderUpdateOne) SetPayWay(s string) *OrderUpdateOne
SetPayWay sets the "pay_way" field.
func (*OrderUpdateOne) SetSubOpenid ¶
func (ouo *OrderUpdateOne) SetSubOpenid(s string) *OrderUpdateOne
SetSubOpenid sets the "sub_openid" field.
func (*OrderUpdateOne) SetTotalAmount ¶
func (ouo *OrderUpdateOne) SetTotalAmount(u uint64) *OrderUpdateOne
SetTotalAmount sets the "total_amount" field.
func (*OrderUpdateOne) SetWxAppid ¶
func (ouo *OrderUpdateOne) SetWxAppid(s string) *OrderUpdateOne
SetWxAppid sets the "wx_appid" field.
type RollbackFunc ¶
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.
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 ¶
Rollbacker is the interface that wraps the Rollback method.
type Tx ¶
type Tx struct { // Order is the client for interacting with the Order builders. Order *OrderClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
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.