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 Item
- type ItemClient
- func (c *ItemClient) Create() *ItemCreate
- func (c *ItemClient) CreateBulk(builders ...*ItemCreate) *ItemCreateBulk
- func (c *ItemClient) Delete() *ItemDelete
- func (c *ItemClient) DeleteOne(i *Item) *ItemDeleteOne
- func (c *ItemClient) DeleteOneID(id int) *ItemDeleteOne
- func (c *ItemClient) Get(ctx context.Context, id int) (*Item, error)
- func (c *ItemClient) GetX(ctx context.Context, id int) *Item
- func (c *ItemClient) Hooks() []Hook
- func (c *ItemClient) Query() *ItemQuery
- func (c *ItemClient) QueryOrderID(i *Item) *OrderQuery
- func (c *ItemClient) Update() *ItemUpdate
- func (c *ItemClient) UpdateOne(i *Item) *ItemUpdateOne
- func (c *ItemClient) UpdateOneID(id int) *ItemUpdateOne
- func (c *ItemClient) Use(hooks ...Hook)
- type ItemCreate
- func (ic *ItemCreate) AddOrderID(o ...*Order) *ItemCreate
- func (ic *ItemCreate) AddOrderIDIDs(ids ...string) *ItemCreate
- func (ic *ItemCreate) Mutation() *ItemMutation
- func (ic *ItemCreate) Save(ctx context.Context) (*Item, error)
- func (ic *ItemCreate) SaveX(ctx context.Context) *Item
- func (ic *ItemCreate) SetCreatedAt(t time.Time) *ItemCreate
- func (ic *ItemCreate) SetNillableCreatedAt(t *time.Time) *ItemCreate
- func (ic *ItemCreate) SetNillableQty(i *int) *ItemCreate
- func (ic *ItemCreate) SetNillableUpdatedAt(t *time.Time) *ItemCreate
- func (ic *ItemCreate) SetProductID(i int) *ItemCreate
- func (ic *ItemCreate) SetQty(i int) *ItemCreate
- func (ic *ItemCreate) SetUpdatedAt(t time.Time) *ItemCreate
- type ItemCreateBulk
- type ItemDelete
- type ItemDeleteOne
- type ItemEdges
- type ItemGroupBy
- func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy
- func (igb *ItemGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (igb *ItemGroupBy) BoolX(ctx context.Context) bool
- func (igb *ItemGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (igb *ItemGroupBy) BoolsX(ctx context.Context) []bool
- func (igb *ItemGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (igb *ItemGroupBy) Float64X(ctx context.Context) float64
- func (igb *ItemGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (igb *ItemGroupBy) Float64sX(ctx context.Context) []float64
- func (igb *ItemGroupBy) Int(ctx context.Context) (_ int, err error)
- func (igb *ItemGroupBy) IntX(ctx context.Context) int
- func (igb *ItemGroupBy) Ints(ctx context.Context) ([]int, error)
- func (igb *ItemGroupBy) IntsX(ctx context.Context) []int
- func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error
- func (igb *ItemGroupBy) ScanX(ctx context.Context, v interface{})
- func (igb *ItemGroupBy) String(ctx context.Context) (_ string, err error)
- func (igb *ItemGroupBy) StringX(ctx context.Context) string
- func (igb *ItemGroupBy) Strings(ctx context.Context) ([]string, error)
- func (igb *ItemGroupBy) StringsX(ctx context.Context) []string
- type ItemMutation
- func (m *ItemMutation) AddField(name string, value ent.Value) error
- func (m *ItemMutation) AddOrderIDIDs(ids ...string)
- func (m *ItemMutation) AddProductID(i int)
- func (m *ItemMutation) AddQty(i int)
- func (m *ItemMutation) AddedEdges() []string
- func (m *ItemMutation) AddedField(name string) (ent.Value, bool)
- func (m *ItemMutation) AddedFields() []string
- func (m *ItemMutation) AddedIDs(name string) []ent.Value
- func (m *ItemMutation) AddedProductID() (r int, exists bool)
- func (m *ItemMutation) AddedQty() (r int, exists bool)
- func (m *ItemMutation) ClearEdge(name string) error
- func (m *ItemMutation) ClearField(name string) error
- func (m *ItemMutation) ClearOrderID()
- func (m *ItemMutation) ClearedEdges() []string
- func (m *ItemMutation) ClearedFields() []string
- func (m ItemMutation) Client() *Client
- func (m *ItemMutation) CreatedAt() (r time.Time, exists bool)
- func (m *ItemMutation) EdgeCleared(name string) bool
- func (m *ItemMutation) Field(name string) (ent.Value, bool)
- func (m *ItemMutation) FieldCleared(name string) bool
- func (m *ItemMutation) Fields() []string
- func (m *ItemMutation) ID() (id int, exists bool)
- func (m *ItemMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ItemMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ItemMutation) OldProductID(ctx context.Context) (v int, err error)
- func (m *ItemMutation) OldQty(ctx context.Context) (v int, err error)
- func (m *ItemMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *ItemMutation) Op() Op
- func (m *ItemMutation) OrderIDCleared() bool
- func (m *ItemMutation) OrderIDIDs() (ids []string)
- func (m *ItemMutation) ProductID() (r int, exists bool)
- func (m *ItemMutation) Qty() (r int, exists bool)
- func (m *ItemMutation) RemoveOrderIDIDs(ids ...string)
- func (m *ItemMutation) RemovedEdges() []string
- func (m *ItemMutation) RemovedIDs(name string) []ent.Value
- func (m *ItemMutation) RemovedOrderIDIDs() (ids []string)
- func (m *ItemMutation) ResetCreatedAt()
- func (m *ItemMutation) ResetEdge(name string) error
- func (m *ItemMutation) ResetField(name string) error
- func (m *ItemMutation) ResetOrderID()
- func (m *ItemMutation) ResetProductID()
- func (m *ItemMutation) ResetQty()
- func (m *ItemMutation) ResetUpdatedAt()
- func (m *ItemMutation) SetCreatedAt(t time.Time)
- func (m *ItemMutation) SetField(name string, value ent.Value) error
- func (m *ItemMutation) SetProductID(i int)
- func (m *ItemMutation) SetQty(i int)
- func (m *ItemMutation) SetUpdatedAt(t time.Time)
- func (m ItemMutation) Tx() (*Tx, error)
- func (m *ItemMutation) Type() string
- func (m *ItemMutation) UpdatedAt() (r time.Time, exists bool)
- type ItemQuery
- func (iq *ItemQuery) All(ctx context.Context) ([]*Item, error)
- func (iq *ItemQuery) AllX(ctx context.Context) []*Item
- func (iq *ItemQuery) Clone() *ItemQuery
- func (iq *ItemQuery) Count(ctx context.Context) (int, error)
- func (iq *ItemQuery) CountX(ctx context.Context) int
- func (iq *ItemQuery) Exist(ctx context.Context) (bool, error)
- func (iq *ItemQuery) ExistX(ctx context.Context) bool
- func (iq *ItemQuery) First(ctx context.Context) (*Item, error)
- func (iq *ItemQuery) FirstID(ctx context.Context) (id int, err error)
- func (iq *ItemQuery) FirstIDX(ctx context.Context) int
- func (iq *ItemQuery) FirstX(ctx context.Context) *Item
- func (iq *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy
- func (iq *ItemQuery) IDs(ctx context.Context) ([]int, error)
- func (iq *ItemQuery) IDsX(ctx context.Context) []int
- func (iq *ItemQuery) Limit(limit int) *ItemQuery
- func (iq *ItemQuery) Offset(offset int) *ItemQuery
- func (iq *ItemQuery) Only(ctx context.Context) (*Item, error)
- func (iq *ItemQuery) OnlyID(ctx context.Context) (id int, err error)
- func (iq *ItemQuery) OnlyIDX(ctx context.Context) int
- func (iq *ItemQuery) OnlyX(ctx context.Context) *Item
- func (iq *ItemQuery) Order(o ...OrderFunc) *ItemQuery
- func (iq *ItemQuery) QueryOrderID() *OrderQuery
- func (iq *ItemQuery) Select(field string, fields ...string) *ItemSelect
- func (iq *ItemQuery) Where(ps ...predicate.Item) *ItemQuery
- func (iq *ItemQuery) WithOrderID(opts ...func(*OrderQuery)) *ItemQuery
- type ItemSelect
- func (is *ItemSelect) Bool(ctx context.Context) (_ bool, err error)
- func (is *ItemSelect) BoolX(ctx context.Context) bool
- func (is *ItemSelect) Bools(ctx context.Context) ([]bool, error)
- func (is *ItemSelect) BoolsX(ctx context.Context) []bool
- func (is *ItemSelect) Float64(ctx context.Context) (_ float64, err error)
- func (is *ItemSelect) Float64X(ctx context.Context) float64
- func (is *ItemSelect) Float64s(ctx context.Context) ([]float64, error)
- func (is *ItemSelect) Float64sX(ctx context.Context) []float64
- func (is *ItemSelect) Int(ctx context.Context) (_ int, err error)
- func (is *ItemSelect) IntX(ctx context.Context) int
- func (is *ItemSelect) Ints(ctx context.Context) ([]int, error)
- func (is *ItemSelect) IntsX(ctx context.Context) []int
- func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error
- func (is *ItemSelect) ScanX(ctx context.Context, v interface{})
- func (is *ItemSelect) String(ctx context.Context) (_ string, err error)
- func (is *ItemSelect) StringX(ctx context.Context) string
- func (is *ItemSelect) Strings(ctx context.Context) ([]string, error)
- func (is *ItemSelect) StringsX(ctx context.Context) []string
- type ItemUpdate
- func (iu *ItemUpdate) AddOrderID(o ...*Order) *ItemUpdate
- func (iu *ItemUpdate) AddOrderIDIDs(ids ...string) *ItemUpdate
- func (iu *ItemUpdate) AddProductID(i int) *ItemUpdate
- func (iu *ItemUpdate) AddQty(i int) *ItemUpdate
- func (iu *ItemUpdate) ClearOrderID() *ItemUpdate
- func (iu *ItemUpdate) Exec(ctx context.Context) error
- func (iu *ItemUpdate) ExecX(ctx context.Context)
- func (iu *ItemUpdate) Mutation() *ItemMutation
- func (iu *ItemUpdate) RemoveOrderID(o ...*Order) *ItemUpdate
- func (iu *ItemUpdate) RemoveOrderIDIDs(ids ...string) *ItemUpdate
- func (iu *ItemUpdate) Save(ctx context.Context) (int, error)
- func (iu *ItemUpdate) SaveX(ctx context.Context) int
- func (iu *ItemUpdate) SetCreatedAt(t time.Time) *ItemUpdate
- func (iu *ItemUpdate) SetNillableCreatedAt(t *time.Time) *ItemUpdate
- func (iu *ItemUpdate) SetNillableQty(i *int) *ItemUpdate
- func (iu *ItemUpdate) SetProductID(i int) *ItemUpdate
- func (iu *ItemUpdate) SetQty(i int) *ItemUpdate
- func (iu *ItemUpdate) SetUpdatedAt(t time.Time) *ItemUpdate
- func (iu *ItemUpdate) Where(ps ...predicate.Item) *ItemUpdate
- type ItemUpdateOne
- func (iuo *ItemUpdateOne) AddOrderID(o ...*Order) *ItemUpdateOne
- func (iuo *ItemUpdateOne) AddOrderIDIDs(ids ...string) *ItemUpdateOne
- func (iuo *ItemUpdateOne) AddProductID(i int) *ItemUpdateOne
- func (iuo *ItemUpdateOne) AddQty(i int) *ItemUpdateOne
- func (iuo *ItemUpdateOne) ClearOrderID() *ItemUpdateOne
- func (iuo *ItemUpdateOne) Exec(ctx context.Context) error
- func (iuo *ItemUpdateOne) ExecX(ctx context.Context)
- func (iuo *ItemUpdateOne) Mutation() *ItemMutation
- func (iuo *ItemUpdateOne) RemoveOrderID(o ...*Order) *ItemUpdateOne
- func (iuo *ItemUpdateOne) RemoveOrderIDIDs(ids ...string) *ItemUpdateOne
- func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error)
- func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item
- func (iuo *ItemUpdateOne) SetCreatedAt(t time.Time) *ItemUpdateOne
- func (iuo *ItemUpdateOne) SetNillableCreatedAt(t *time.Time) *ItemUpdateOne
- func (iuo *ItemUpdateOne) SetNillableQty(i *int) *ItemUpdateOne
- func (iuo *ItemUpdateOne) SetProductID(i int) *ItemUpdateOne
- func (iuo *ItemUpdateOne) SetQty(i int) *ItemUpdateOne
- func (iuo *ItemUpdateOne) SetUpdatedAt(t time.Time) *ItemUpdateOne
- type Items
- 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 string) *OrderDeleteOne
- func (c *OrderClient) Get(ctx context.Context, id string) (*Order, error)
- func (c *OrderClient) GetX(ctx context.Context, id string) *Order
- func (c *OrderClient) Hooks() []Hook
- func (c *OrderClient) Query() *OrderQuery
- func (c *OrderClient) QueryItems(o *Order) *ItemQuery
- func (c *OrderClient) Update() *OrderUpdate
- func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne
- func (c *OrderClient) UpdateOneID(id string) *OrderUpdateOne
- func (c *OrderClient) Use(hooks ...Hook)
- type OrderCreate
- func (oc *OrderCreate) AddItemIDs(ids ...int) *OrderCreate
- func (oc *OrderCreate) AddItems(i ...*Item) *OrderCreate
- 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) SetCreatedAt(t time.Time) *OrderCreate
- func (oc *OrderCreate) SetID(s string) *OrderCreate
- func (oc *OrderCreate) SetNillableCreatedAt(t *time.Time) *OrderCreate
- func (oc *OrderCreate) SetNillableStatus(s *string) *OrderCreate
- func (oc *OrderCreate) SetNillableUpdatedAt(t *time.Time) *OrderCreate
- func (oc *OrderCreate) SetStatus(s string) *OrderCreate
- func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate
- func (oc *OrderCreate) SetUserID(s string) *OrderCreate
- type OrderCreateBulk
- type OrderDelete
- type OrderDeleteOne
- type OrderEdges
- type OrderFunc
- type OrderGroupBy
- func (ogb *OrderGroupBy) Aggregate(fns ...AggregateFunc) *OrderGroupBy
- func (ogb *OrderGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (ogb *OrderGroupBy) BoolX(ctx context.Context) bool
- func (ogb *OrderGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ogb *OrderGroupBy) BoolsX(ctx context.Context) []bool
- func (ogb *OrderGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (ogb *OrderGroupBy) Float64X(ctx context.Context) float64
- func (ogb *OrderGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ogb *OrderGroupBy) Float64sX(ctx context.Context) []float64
- func (ogb *OrderGroupBy) Int(ctx context.Context) (_ int, err error)
- func (ogb *OrderGroupBy) IntX(ctx context.Context) int
- func (ogb *OrderGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ogb *OrderGroupBy) IntsX(ctx context.Context) []int
- func (ogb *OrderGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ogb *OrderGroupBy) ScanX(ctx context.Context, v interface{})
- func (ogb *OrderGroupBy) String(ctx context.Context) (_ string, err error)
- func (ogb *OrderGroupBy) StringX(ctx context.Context) string
- func (ogb *OrderGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ogb *OrderGroupBy) StringsX(ctx context.Context) []string
- type OrderMutation
- func (m *OrderMutation) AddField(name string, value ent.Value) error
- func (m *OrderMutation) AddItemIDs(ids ...int)
- 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) ClearEdge(name string) error
- func (m *OrderMutation) ClearField(name string) error
- func (m *OrderMutation) ClearItems()
- func (m *OrderMutation) ClearedEdges() []string
- func (m *OrderMutation) ClearedFields() []string
- func (m OrderMutation) Client() *Client
- func (m *OrderMutation) CreatedAt() (r time.Time, exists bool)
- func (m *OrderMutation) EdgeCleared(name string) 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 string, exists bool)
- func (m *OrderMutation) ItemsCleared() bool
- func (m *OrderMutation) ItemsIDs() (ids []int)
- func (m *OrderMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *OrderMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *OrderMutation) OldStatus(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *OrderMutation) OldUserID(ctx context.Context) (v string, err error)
- func (m *OrderMutation) Op() Op
- func (m *OrderMutation) RemoveItemIDs(ids ...int)
- func (m *OrderMutation) RemovedEdges() []string
- func (m *OrderMutation) RemovedIDs(name string) []ent.Value
- func (m *OrderMutation) RemovedItemsIDs() (ids []int)
- func (m *OrderMutation) ResetCreatedAt()
- func (m *OrderMutation) ResetEdge(name string) error
- func (m *OrderMutation) ResetField(name string) error
- func (m *OrderMutation) ResetItems()
- func (m *OrderMutation) ResetStatus()
- func (m *OrderMutation) ResetUpdatedAt()
- func (m *OrderMutation) ResetUserID()
- func (m *OrderMutation) SetCreatedAt(t time.Time)
- func (m *OrderMutation) SetField(name string, value ent.Value) error
- func (m *OrderMutation) SetID(id string)
- func (m *OrderMutation) SetStatus(s string)
- func (m *OrderMutation) SetUpdatedAt(t time.Time)
- func (m *OrderMutation) SetUserID(s string)
- func (m *OrderMutation) Status() (r string, exists bool)
- func (m OrderMutation) Tx() (*Tx, error)
- func (m *OrderMutation) Type() string
- func (m *OrderMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *OrderMutation) UserID() (r string, exists bool)
- type OrderQuery
- 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 string, err error)
- func (oq *OrderQuery) FirstIDX(ctx context.Context) string
- func (oq *OrderQuery) FirstX(ctx context.Context) *Order
- func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy
- func (oq *OrderQuery) IDs(ctx context.Context) ([]string, error)
- func (oq *OrderQuery) IDsX(ctx context.Context) []string
- 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 string, err error)
- func (oq *OrderQuery) OnlyIDX(ctx context.Context) string
- func (oq *OrderQuery) OnlyX(ctx context.Context) *Order
- func (oq *OrderQuery) Order(o ...OrderFunc) *OrderQuery
- func (oq *OrderQuery) QueryItems() *ItemQuery
- func (oq *OrderQuery) Select(field string, fields ...string) *OrderSelect
- func (oq *OrderQuery) Where(ps ...predicate.Order) *OrderQuery
- func (oq *OrderQuery) WithItems(opts ...func(*ItemQuery)) *OrderQuery
- type OrderSelect
- func (os *OrderSelect) Bool(ctx context.Context) (_ bool, err error)
- func (os *OrderSelect) BoolX(ctx context.Context) bool
- func (os *OrderSelect) Bools(ctx context.Context) ([]bool, error)
- func (os *OrderSelect) BoolsX(ctx context.Context) []bool
- func (os *OrderSelect) Float64(ctx context.Context) (_ float64, err error)
- func (os *OrderSelect) Float64X(ctx context.Context) float64
- func (os *OrderSelect) Float64s(ctx context.Context) ([]float64, error)
- func (os *OrderSelect) Float64sX(ctx context.Context) []float64
- func (os *OrderSelect) Int(ctx context.Context) (_ int, err error)
- func (os *OrderSelect) IntX(ctx context.Context) int
- func (os *OrderSelect) Ints(ctx context.Context) ([]int, error)
- func (os *OrderSelect) IntsX(ctx context.Context) []int
- func (os *OrderSelect) Scan(ctx context.Context, v interface{}) error
- func (os *OrderSelect) ScanX(ctx context.Context, v interface{})
- func (os *OrderSelect) String(ctx context.Context) (_ string, err error)
- func (os *OrderSelect) StringX(ctx context.Context) string
- func (os *OrderSelect) Strings(ctx context.Context) ([]string, error)
- func (os *OrderSelect) StringsX(ctx context.Context) []string
- type OrderUpdate
- func (ou *OrderUpdate) AddItemIDs(ids ...int) *OrderUpdate
- func (ou *OrderUpdate) AddItems(i ...*Item) *OrderUpdate
- func (ou *OrderUpdate) ClearItems() *OrderUpdate
- func (ou *OrderUpdate) Exec(ctx context.Context) error
- func (ou *OrderUpdate) ExecX(ctx context.Context)
- func (ou *OrderUpdate) Mutation() *OrderMutation
- func (ou *OrderUpdate) RemoveItemIDs(ids ...int) *OrderUpdate
- func (ou *OrderUpdate) RemoveItems(i ...*Item) *OrderUpdate
- func (ou *OrderUpdate) Save(ctx context.Context) (int, error)
- func (ou *OrderUpdate) SaveX(ctx context.Context) int
- func (ou *OrderUpdate) SetCreatedAt(t time.Time) *OrderUpdate
- func (ou *OrderUpdate) SetNillableCreatedAt(t *time.Time) *OrderUpdate
- func (ou *OrderUpdate) SetNillableStatus(s *string) *OrderUpdate
- func (ou *OrderUpdate) SetStatus(s string) *OrderUpdate
- func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate
- func (ou *OrderUpdate) SetUserID(s string) *OrderUpdate
- func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate
- type OrderUpdateOne
- func (ouo *OrderUpdateOne) AddItemIDs(ids ...int) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddItems(i ...*Item) *OrderUpdateOne
- func (ouo *OrderUpdateOne) ClearItems() *OrderUpdateOne
- func (ouo *OrderUpdateOne) Exec(ctx context.Context) error
- func (ouo *OrderUpdateOne) ExecX(ctx context.Context)
- func (ouo *OrderUpdateOne) Mutation() *OrderMutation
- func (ouo *OrderUpdateOne) RemoveItemIDs(ids ...int) *OrderUpdateOne
- func (ouo *OrderUpdateOne) RemoveItems(i ...*Item) *OrderUpdateOne
- func (ouo *OrderUpdateOne) Save(ctx context.Context) (*Order, error)
- func (ouo *OrderUpdateOne) SaveX(ctx context.Context) *Order
- func (ouo *OrderUpdateOne) SetCreatedAt(t time.Time) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetNillableCreatedAt(t *time.Time) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetNillableStatus(s *string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetStatus(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetUserID(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. TypeItem = "Item" 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 validaton 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 // Item is the client for interacting with the Item builders. Item *ItemClient // 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(). Item. 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(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 Item ¶
type Item struct { // ID of the ent. ID int `json:"id,omitempty"` // ProductID holds the value of the "product_id" field. ProductID int `json:"product_id,omitempty"` // Qty holds the value of the "qty" field. Qty int `json:"qty,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ItemQuery when eager-loading is set. Edges ItemEdges `json:"edges"` // contains filtered or unexported fields }
Item is the model entity for the Item schema.
func (*Item) QueryOrderID ¶
func (i *Item) QueryOrderID() *OrderQuery
QueryOrderID queries the "order_id" edge of the Item entity.
func (*Item) Unwrap ¶
Unwrap unwraps the Item 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 (*Item) Update ¶
func (i *Item) Update() *ItemUpdateOne
Update returns a builder for updating this Item. Note that you need to call Item.Unwrap() before calling this method if this Item was returned from a transaction, and the transaction was committed or rolled back.
type ItemClient ¶
type ItemClient struct {
// contains filtered or unexported fields
}
ItemClient is a client for the Item schema.
func NewItemClient ¶
func NewItemClient(c config) *ItemClient
NewItemClient returns a client for the Item from the given config.
func (*ItemClient) Create ¶
func (c *ItemClient) Create() *ItemCreate
Create returns a create builder for Item.
func (*ItemClient) CreateBulk ¶
func (c *ItemClient) CreateBulk(builders ...*ItemCreate) *ItemCreateBulk
CreateBulk returns a builder for creating a bulk of Item entities.
func (*ItemClient) Delete ¶
func (c *ItemClient) Delete() *ItemDelete
Delete returns a delete builder for Item.
func (*ItemClient) DeleteOne ¶
func (c *ItemClient) DeleteOne(i *Item) *ItemDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ItemClient) DeleteOneID ¶
func (c *ItemClient) DeleteOneID(id int) *ItemDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ItemClient) GetX ¶
func (c *ItemClient) GetX(ctx context.Context, id int) *Item
GetX is like Get, but panics if an error occurs.
func (*ItemClient) Query ¶
func (c *ItemClient) Query() *ItemQuery
Query returns a query builder for Item.
func (*ItemClient) QueryOrderID ¶
func (c *ItemClient) QueryOrderID(i *Item) *OrderQuery
QueryOrderID queries the order_id edge of a Item.
func (*ItemClient) Update ¶
func (c *ItemClient) Update() *ItemUpdate
Update returns an update builder for Item.
func (*ItemClient) UpdateOne ¶
func (c *ItemClient) UpdateOne(i *Item) *ItemUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ItemClient) UpdateOneID ¶
func (c *ItemClient) UpdateOneID(id int) *ItemUpdateOne
UpdateOneID returns an update builder for the given id.
func (*ItemClient) Use ¶
func (c *ItemClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `item.Hooks(f(g(h())))`.
type ItemCreate ¶
type ItemCreate struct {
// contains filtered or unexported fields
}
ItemCreate is the builder for creating a Item entity.
func (*ItemCreate) AddOrderID ¶
func (ic *ItemCreate) AddOrderID(o ...*Order) *ItemCreate
AddOrderID adds the "order_id" edges to the Order entity.
func (*ItemCreate) AddOrderIDIDs ¶
func (ic *ItemCreate) AddOrderIDIDs(ids ...string) *ItemCreate
AddOrderIDIDs adds the "order_id" edge to the Order entity by IDs.
func (*ItemCreate) Mutation ¶
func (ic *ItemCreate) Mutation() *ItemMutation
Mutation returns the ItemMutation object of the builder.
func (*ItemCreate) Save ¶
func (ic *ItemCreate) Save(ctx context.Context) (*Item, error)
Save creates the Item in the database.
func (*ItemCreate) SaveX ¶
func (ic *ItemCreate) SaveX(ctx context.Context) *Item
SaveX calls Save and panics if Save returns an error.
func (*ItemCreate) SetCreatedAt ¶
func (ic *ItemCreate) SetCreatedAt(t time.Time) *ItemCreate
SetCreatedAt sets the "created_at" field.
func (*ItemCreate) SetNillableCreatedAt ¶
func (ic *ItemCreate) SetNillableCreatedAt(t *time.Time) *ItemCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ItemCreate) SetNillableQty ¶
func (ic *ItemCreate) SetNillableQty(i *int) *ItemCreate
SetNillableQty sets the "qty" field if the given value is not nil.
func (*ItemCreate) SetNillableUpdatedAt ¶
func (ic *ItemCreate) SetNillableUpdatedAt(t *time.Time) *ItemCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*ItemCreate) SetProductID ¶
func (ic *ItemCreate) SetProductID(i int) *ItemCreate
SetProductID sets the "product_id" field.
func (*ItemCreate) SetQty ¶
func (ic *ItemCreate) SetQty(i int) *ItemCreate
SetQty sets the "qty" field.
func (*ItemCreate) SetUpdatedAt ¶
func (ic *ItemCreate) SetUpdatedAt(t time.Time) *ItemCreate
SetUpdatedAt sets the "updated_at" field.
type ItemCreateBulk ¶
type ItemCreateBulk struct {
// contains filtered or unexported fields
}
ItemCreateBulk is the builder for creating many Item entities in bulk.
type ItemDelete ¶
type ItemDelete struct {
// contains filtered or unexported fields
}
ItemDelete is the builder for deleting a Item entity.
func (*ItemDelete) Exec ¶
func (id *ItemDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ItemDelete) ExecX ¶
func (id *ItemDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ItemDelete) Where ¶
func (id *ItemDelete) Where(ps ...predicate.Item) *ItemDelete
Where adds a new predicate to the ItemDelete builder.
type ItemDeleteOne ¶
type ItemDeleteOne struct {
// contains filtered or unexported fields
}
ItemDeleteOne is the builder for deleting a single Item entity.
func (*ItemDeleteOne) Exec ¶
func (ido *ItemDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ItemDeleteOne) ExecX ¶
func (ido *ItemDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ItemEdges ¶
type ItemEdges struct { // OrderID holds the value of the order_id edge. OrderID []*Order `json:"order_id,omitempty"` // contains filtered or unexported fields }
ItemEdges holds the relations/edges for other nodes in the graph.
func (ItemEdges) OrderIDOrErr ¶
OrderIDOrErr returns the OrderID value or an error if the edge was not loaded in eager-loading.
type ItemGroupBy ¶
type ItemGroupBy struct {
// contains filtered or unexported fields
}
ItemGroupBy is the group-by builder for Item entities.
func (*ItemGroupBy) Aggregate ¶
func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ItemGroupBy) Bool ¶
func (igb *ItemGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) BoolX ¶
func (igb *ItemGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ItemGroupBy) Bools ¶
func (igb *ItemGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) BoolsX ¶
func (igb *ItemGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ItemGroupBy) Float64 ¶
func (igb *ItemGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) Float64X ¶
func (igb *ItemGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ItemGroupBy) Float64s ¶
func (igb *ItemGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) Float64sX ¶
func (igb *ItemGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ItemGroupBy) Int ¶
func (igb *ItemGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) IntX ¶
func (igb *ItemGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ItemGroupBy) Ints ¶
func (igb *ItemGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) IntsX ¶
func (igb *ItemGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ItemGroupBy) Scan ¶
func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*ItemGroupBy) ScanX ¶
func (igb *ItemGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ItemGroupBy) String ¶
func (igb *ItemGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*ItemGroupBy) StringX ¶
func (igb *ItemGroupBy) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ItemMutation ¶
type ItemMutation struct {
// contains filtered or unexported fields
}
ItemMutation represents an operation that mutates the Item nodes in the graph.
func (*ItemMutation) AddField ¶
func (m *ItemMutation) 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 (*ItemMutation) AddOrderIDIDs ¶
func (m *ItemMutation) AddOrderIDIDs(ids ...string)
AddOrderIDIDs adds the "order_id" edge to the Order entity by ids.
func (*ItemMutation) AddProductID ¶
func (m *ItemMutation) AddProductID(i int)
AddProductID adds i to the "product_id" field.
func (*ItemMutation) AddQty ¶
func (m *ItemMutation) AddQty(i int)
AddQty adds i to the "qty" field.
func (*ItemMutation) AddedEdges ¶
func (m *ItemMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*ItemMutation) AddedField ¶
func (m *ItemMutation) 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 (*ItemMutation) AddedFields ¶
func (m *ItemMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*ItemMutation) AddedIDs ¶
func (m *ItemMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*ItemMutation) AddedProductID ¶
func (m *ItemMutation) AddedProductID() (r int, exists bool)
AddedProductID returns the value that was added to the "product_id" field in this mutation.
func (*ItemMutation) AddedQty ¶
func (m *ItemMutation) AddedQty() (r int, exists bool)
AddedQty returns the value that was added to the "qty" field in this mutation.
func (*ItemMutation) ClearEdge ¶
func (m *ItemMutation) 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 (*ItemMutation) ClearField ¶
func (m *ItemMutation) 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 (*ItemMutation) ClearOrderID ¶
func (m *ItemMutation) ClearOrderID()
ClearOrderID clears the "order_id" edge to the Order entity.
func (*ItemMutation) ClearedEdges ¶
func (m *ItemMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*ItemMutation) ClearedFields ¶
func (m *ItemMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (ItemMutation) Client ¶
func (m ItemMutation) 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 (*ItemMutation) CreatedAt ¶
func (m *ItemMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*ItemMutation) EdgeCleared ¶
func (m *ItemMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*ItemMutation) Field ¶
func (m *ItemMutation) 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 (*ItemMutation) FieldCleared ¶
func (m *ItemMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*ItemMutation) Fields ¶
func (m *ItemMutation) 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 (*ItemMutation) ID ¶
func (m *ItemMutation) 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.
func (*ItemMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Item entity. If the Item 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 (*ItemMutation) 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 (*ItemMutation) OldProductID ¶
func (m *ItemMutation) OldProductID(ctx context.Context) (v int, err error)
OldProductID returns the old "product_id" field's value of the Item entity. If the Item 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 (*ItemMutation) OldQty ¶
func (m *ItemMutation) OldQty(ctx context.Context) (v int, err error)
OldQty returns the old "qty" field's value of the Item entity. If the Item 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 (*ItemMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Item entity. If the Item 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 (*ItemMutation) OrderIDCleared ¶
func (m *ItemMutation) OrderIDCleared() bool
OrderIDCleared returns if the "order_id" edge to the Order entity was cleared.
func (*ItemMutation) OrderIDIDs ¶
func (m *ItemMutation) OrderIDIDs() (ids []string)
OrderIDIDs returns the "order_id" edge IDs in the mutation.
func (*ItemMutation) ProductID ¶
func (m *ItemMutation) ProductID() (r int, exists bool)
ProductID returns the value of the "product_id" field in the mutation.
func (*ItemMutation) Qty ¶
func (m *ItemMutation) Qty() (r int, exists bool)
Qty returns the value of the "qty" field in the mutation.
func (*ItemMutation) RemoveOrderIDIDs ¶
func (m *ItemMutation) RemoveOrderIDIDs(ids ...string)
RemoveOrderIDIDs removes the "order_id" edge to the Order entity by IDs.
func (*ItemMutation) RemovedEdges ¶
func (m *ItemMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*ItemMutation) RemovedIDs ¶
func (m *ItemMutation) 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 (*ItemMutation) RemovedOrderIDIDs ¶
func (m *ItemMutation) RemovedOrderIDIDs() (ids []string)
RemovedOrderID returns the removed IDs of the "order_id" edge to the Order entity.
func (*ItemMutation) ResetCreatedAt ¶
func (m *ItemMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*ItemMutation) ResetEdge ¶
func (m *ItemMutation) 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 (*ItemMutation) ResetField ¶
func (m *ItemMutation) 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 (*ItemMutation) ResetOrderID ¶
func (m *ItemMutation) ResetOrderID()
ResetOrderID resets all changes to the "order_id" edge.
func (*ItemMutation) ResetProductID ¶
func (m *ItemMutation) ResetProductID()
ResetProductID resets all changes to the "product_id" field.
func (*ItemMutation) ResetQty ¶
func (m *ItemMutation) ResetQty()
ResetQty resets all changes to the "qty" field.
func (*ItemMutation) ResetUpdatedAt ¶
func (m *ItemMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*ItemMutation) SetCreatedAt ¶
func (m *ItemMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*ItemMutation) SetField ¶
func (m *ItemMutation) 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 (*ItemMutation) SetProductID ¶
func (m *ItemMutation) SetProductID(i int)
SetProductID sets the "product_id" field.
func (*ItemMutation) SetUpdatedAt ¶
func (m *ItemMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (ItemMutation) Tx ¶
func (m ItemMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*ItemMutation) Type ¶
func (m *ItemMutation) Type() string
Type returns the node type of this mutation (Item).
type ItemQuery ¶
type ItemQuery struct {
// contains filtered or unexported fields
}
ItemQuery is the builder for querying Item entities.
func (*ItemQuery) Clone ¶
Clone returns a duplicate of the ItemQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ItemQuery) First ¶
First returns the first Item entity from the query. Returns a *NotFoundError when no Item was found.
func (*ItemQuery) FirstID ¶
FirstID returns the first Item ID from the query. Returns a *NotFoundError when no Item ID was found.
func (*ItemQuery) GroupBy ¶
func (iq *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy
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 { ProductID int `json:"product_id,omitempty"` Count int `json:"count,omitempty"` } client.Item.Query(). GroupBy(item.FieldProductID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ItemQuery) Only ¶
Only returns a single Item entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Item entity is not found. Returns a *NotFoundError when no Item entities are found.
func (*ItemQuery) OnlyID ¶
OnlyID is like Only, but returns the only Item ID in the query. Returns a *NotSingularError when exactly one Item ID is not found. Returns a *NotFoundError when no entities are found.
func (*ItemQuery) QueryOrderID ¶
func (iq *ItemQuery) QueryOrderID() *OrderQuery
QueryOrderID chains the current query on the "order_id" edge.
func (*ItemQuery) Select ¶
func (iq *ItemQuery) Select(field string, fields ...string) *ItemSelect
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 { ProductID int `json:"product_id,omitempty"` } client.Item.Query(). Select(item.FieldProductID). Scan(ctx, &v)
func (*ItemQuery) WithOrderID ¶
func (iq *ItemQuery) WithOrderID(opts ...func(*OrderQuery)) *ItemQuery
WithOrderID tells the query-builder to eager-load the nodes that are connected to the "order_id" edge. The optional arguments are used to configure the query builder of the edge.
type ItemSelect ¶
type ItemSelect struct { *ItemQuery // contains filtered or unexported fields }
ItemSelect is the builder for selecting fields of Item entities.
func (*ItemSelect) Bool ¶
func (is *ItemSelect) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ItemSelect) BoolX ¶
func (is *ItemSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*ItemSelect) Bools ¶
func (is *ItemSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ItemSelect) BoolsX ¶
func (is *ItemSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ItemSelect) Float64 ¶
func (is *ItemSelect) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ItemSelect) Float64X ¶
func (is *ItemSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*ItemSelect) Float64s ¶
func (is *ItemSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ItemSelect) Float64sX ¶
func (is *ItemSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ItemSelect) Int ¶
func (is *ItemSelect) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ItemSelect) IntX ¶
func (is *ItemSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*ItemSelect) Ints ¶
func (is *ItemSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*ItemSelect) IntsX ¶
func (is *ItemSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ItemSelect) Scan ¶
func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*ItemSelect) ScanX ¶
func (is *ItemSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*ItemSelect) String ¶
func (is *ItemSelect) String(ctx context.Context) (_ string, err error)
String returns a single string from a selector. It is only allowed when selecting one field.
func (*ItemSelect) StringX ¶
func (is *ItemSelect) StringX(ctx context.Context) string
StringX is like String, but panics if an error occurs.
type ItemUpdate ¶
type ItemUpdate struct {
// contains filtered or unexported fields
}
ItemUpdate is the builder for updating Item entities.
func (*ItemUpdate) AddOrderID ¶
func (iu *ItemUpdate) AddOrderID(o ...*Order) *ItemUpdate
AddOrderID adds the "order_id" edges to the Order entity.
func (*ItemUpdate) AddOrderIDIDs ¶
func (iu *ItemUpdate) AddOrderIDIDs(ids ...string) *ItemUpdate
AddOrderIDIDs adds the "order_id" edge to the Order entity by IDs.
func (*ItemUpdate) AddProductID ¶
func (iu *ItemUpdate) AddProductID(i int) *ItemUpdate
AddProductID adds i to the "product_id" field.
func (*ItemUpdate) AddQty ¶
func (iu *ItemUpdate) AddQty(i int) *ItemUpdate
AddQty adds i to the "qty" field.
func (*ItemUpdate) ClearOrderID ¶
func (iu *ItemUpdate) ClearOrderID() *ItemUpdate
ClearOrderID clears all "order_id" edges to the Order entity.
func (*ItemUpdate) Exec ¶
func (iu *ItemUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ItemUpdate) ExecX ¶
func (iu *ItemUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ItemUpdate) Mutation ¶
func (iu *ItemUpdate) Mutation() *ItemMutation
Mutation returns the ItemMutation object of the builder.
func (*ItemUpdate) RemoveOrderID ¶
func (iu *ItemUpdate) RemoveOrderID(o ...*Order) *ItemUpdate
RemoveOrderID removes "order_id" edges to Order entities.
func (*ItemUpdate) RemoveOrderIDIDs ¶
func (iu *ItemUpdate) RemoveOrderIDIDs(ids ...string) *ItemUpdate
RemoveOrderIDIDs removes the "order_id" edge to Order entities by IDs.
func (*ItemUpdate) Save ¶
func (iu *ItemUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*ItemUpdate) SaveX ¶
func (iu *ItemUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ItemUpdate) SetCreatedAt ¶
func (iu *ItemUpdate) SetCreatedAt(t time.Time) *ItemUpdate
SetCreatedAt sets the "created_at" field.
func (*ItemUpdate) SetNillableCreatedAt ¶
func (iu *ItemUpdate) SetNillableCreatedAt(t *time.Time) *ItemUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ItemUpdate) SetNillableQty ¶
func (iu *ItemUpdate) SetNillableQty(i *int) *ItemUpdate
SetNillableQty sets the "qty" field if the given value is not nil.
func (*ItemUpdate) SetProductID ¶
func (iu *ItemUpdate) SetProductID(i int) *ItemUpdate
SetProductID sets the "product_id" field.
func (*ItemUpdate) SetQty ¶
func (iu *ItemUpdate) SetQty(i int) *ItemUpdate
SetQty sets the "qty" field.
func (*ItemUpdate) SetUpdatedAt ¶
func (iu *ItemUpdate) SetUpdatedAt(t time.Time) *ItemUpdate
SetUpdatedAt sets the "updated_at" field.
func (*ItemUpdate) Where ¶
func (iu *ItemUpdate) Where(ps ...predicate.Item) *ItemUpdate
Where adds a new predicate for the ItemUpdate builder.
type ItemUpdateOne ¶
type ItemUpdateOne struct {
// contains filtered or unexported fields
}
ItemUpdateOne is the builder for updating a single Item entity.
func (*ItemUpdateOne) AddOrderID ¶
func (iuo *ItemUpdateOne) AddOrderID(o ...*Order) *ItemUpdateOne
AddOrderID adds the "order_id" edges to the Order entity.
func (*ItemUpdateOne) AddOrderIDIDs ¶
func (iuo *ItemUpdateOne) AddOrderIDIDs(ids ...string) *ItemUpdateOne
AddOrderIDIDs adds the "order_id" edge to the Order entity by IDs.
func (*ItemUpdateOne) AddProductID ¶
func (iuo *ItemUpdateOne) AddProductID(i int) *ItemUpdateOne
AddProductID adds i to the "product_id" field.
func (*ItemUpdateOne) AddQty ¶
func (iuo *ItemUpdateOne) AddQty(i int) *ItemUpdateOne
AddQty adds i to the "qty" field.
func (*ItemUpdateOne) ClearOrderID ¶
func (iuo *ItemUpdateOne) ClearOrderID() *ItemUpdateOne
ClearOrderID clears all "order_id" edges to the Order entity.
func (*ItemUpdateOne) Exec ¶
func (iuo *ItemUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ItemUpdateOne) ExecX ¶
func (iuo *ItemUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ItemUpdateOne) Mutation ¶
func (iuo *ItemUpdateOne) Mutation() *ItemMutation
Mutation returns the ItemMutation object of the builder.
func (*ItemUpdateOne) RemoveOrderID ¶
func (iuo *ItemUpdateOne) RemoveOrderID(o ...*Order) *ItemUpdateOne
RemoveOrderID removes "order_id" edges to Order entities.
func (*ItemUpdateOne) RemoveOrderIDIDs ¶
func (iuo *ItemUpdateOne) RemoveOrderIDIDs(ids ...string) *ItemUpdateOne
RemoveOrderIDIDs removes the "order_id" edge to Order entities by IDs.
func (*ItemUpdateOne) Save ¶
func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error)
Save executes the query and returns the updated Item entity.
func (*ItemUpdateOne) SaveX ¶
func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item
SaveX is like Save, but panics if an error occurs.
func (*ItemUpdateOne) SetCreatedAt ¶
func (iuo *ItemUpdateOne) SetCreatedAt(t time.Time) *ItemUpdateOne
SetCreatedAt sets the "created_at" field.
func (*ItemUpdateOne) SetNillableCreatedAt ¶
func (iuo *ItemUpdateOne) SetNillableCreatedAt(t *time.Time) *ItemUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*ItemUpdateOne) SetNillableQty ¶
func (iuo *ItemUpdateOne) SetNillableQty(i *int) *ItemUpdateOne
SetNillableQty sets the "qty" field if the given value is not nil.
func (*ItemUpdateOne) SetProductID ¶
func (iuo *ItemUpdateOne) SetProductID(i int) *ItemUpdateOne
SetProductID sets the "product_id" field.
func (*ItemUpdateOne) SetQty ¶
func (iuo *ItemUpdateOne) SetQty(i int) *ItemUpdateOne
SetQty sets the "qty" field.
func (*ItemUpdateOne) SetUpdatedAt ¶
func (iuo *ItemUpdateOne) SetUpdatedAt(t time.Time) *ItemUpdateOne
SetUpdatedAt sets the "updated_at" field.
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 string `json:"id,omitempty"` // UserID holds the value of the "user_id" field. UserID string `json:"user_id,omitempty"` // Status holds the value of the "status" field. Status string `json:"status,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // 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) QueryItems ¶
QueryItems queries the "items" edge of the Order entity.
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 create builder for Order.
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 delete builder for the given entity.
func (*OrderClient) DeleteOneID ¶
func (c *OrderClient) DeleteOneID(id string) *OrderDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*OrderClient) GetX ¶
func (c *OrderClient) GetX(ctx context.Context, id string) *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) QueryItems ¶
func (c *OrderClient) QueryItems(o *Order) *ItemQuery
QueryItems queries the items 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 string) *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) AddItemIDs ¶
func (oc *OrderCreate) AddItemIDs(ids ...int) *OrderCreate
AddItemIDs adds the "items" edge to the Item entity by IDs.
func (*OrderCreate) AddItems ¶
func (oc *OrderCreate) AddItems(i ...*Item) *OrderCreate
AddItems adds the "items" edges to the Item entity.
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) SetCreatedAt ¶
func (oc *OrderCreate) SetCreatedAt(t time.Time) *OrderCreate
SetCreatedAt sets the "created_at" field.
func (*OrderCreate) SetID ¶
func (oc *OrderCreate) SetID(s string) *OrderCreate
SetID sets the "id" field.
func (*OrderCreate) SetNillableCreatedAt ¶
func (oc *OrderCreate) SetNillableCreatedAt(t *time.Time) *OrderCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*OrderCreate) SetNillableStatus ¶
func (oc *OrderCreate) SetNillableStatus(s *string) *OrderCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*OrderCreate) SetNillableUpdatedAt ¶
func (oc *OrderCreate) SetNillableUpdatedAt(t *time.Time) *OrderCreate
SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (*OrderCreate) SetStatus ¶
func (oc *OrderCreate) SetStatus(s string) *OrderCreate
SetStatus sets the "status" field.
func (*OrderCreate) SetUpdatedAt ¶
func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate
SetUpdatedAt sets the "updated_at" field.
func (*OrderCreate) SetUserID ¶
func (oc *OrderCreate) SetUserID(s string) *OrderCreate
SetUserID sets the "user_id" field.
type OrderCreateBulk ¶
type OrderCreateBulk struct {
// contains filtered or unexported fields
}
OrderCreateBulk is the builder for creating many Order entities in bulk.
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 adds a new predicate 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 OrderEdges ¶
type OrderEdges struct { // Items holds the value of the items edge. Items []*Item `json:"items,omitempty"` // contains filtered or unexported fields }
OrderEdges holds the relations/edges for other nodes in the graph.
func (OrderEdges) ItemsOrErr ¶
func (e OrderEdges) ItemsOrErr() ([]*Item, error)
ItemsOrErr returns the Items value or an error if the edge was not loaded in eager-loading.
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 (ogb *OrderGroupBy) Bool(ctx context.Context) (_ bool, err error)
Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) BoolX ¶
func (ogb *OrderGroupBy) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*OrderGroupBy) Bools ¶
func (ogb *OrderGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) BoolsX ¶
func (ogb *OrderGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*OrderGroupBy) Float64 ¶
func (ogb *OrderGroupBy) Float64(ctx context.Context) (_ float64, err error)
Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) Float64X ¶
func (ogb *OrderGroupBy) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*OrderGroupBy) Float64s ¶
func (ogb *OrderGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) Float64sX ¶
func (ogb *OrderGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*OrderGroupBy) Int ¶
func (ogb *OrderGroupBy) Int(ctx context.Context) (_ int, err error)
Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) IntX ¶
func (ogb *OrderGroupBy) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*OrderGroupBy) Ints ¶
func (ogb *OrderGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) IntsX ¶
func (ogb *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 interface{}) error
Scan applies the group-by query and scans the result into the given value.
func (*OrderGroupBy) ScanX ¶
func (ogb *OrderGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*OrderGroupBy) String ¶
func (ogb *OrderGroupBy) String(ctx context.Context) (_ string, err error)
String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.
func (*OrderGroupBy) StringX ¶
func (ogb *OrderGroupBy) StringX(ctx context.Context) string
StringX is like String, 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) AddItemIDs ¶
func (m *OrderMutation) AddItemIDs(ids ...int)
AddItemIDs adds the "items" edge to the Item entity by ids.
func (*OrderMutation) AddedEdges ¶
func (m *OrderMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*OrderMutation) AddedField ¶
func (m *OrderMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*OrderMutation) AddedFields ¶
func (m *OrderMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*OrderMutation) AddedIDs ¶
func (m *OrderMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*OrderMutation) ClearEdge ¶
func (m *OrderMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*OrderMutation) ClearField ¶
func (m *OrderMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*OrderMutation) ClearItems ¶
func (m *OrderMutation) ClearItems()
ClearItems clears the "items" edge to the Item entity.
func (*OrderMutation) ClearedEdges ¶
func (m *OrderMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*OrderMutation) ClearedFields ¶
func (m *OrderMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (OrderMutation) Client ¶
func (m OrderMutation) Client() *Client
Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.
func (*OrderMutation) CreatedAt ¶
func (m *OrderMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*OrderMutation) EdgeCleared ¶
func (m *OrderMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*OrderMutation) Field ¶
func (m *OrderMutation) Field(name string) (ent.Value, bool)
Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*OrderMutation) FieldCleared ¶
func (m *OrderMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*OrderMutation) Fields ¶
func (m *OrderMutation) Fields() []string
Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().
func (*OrderMutation) ID ¶
func (m *OrderMutation) ID() (id string, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
func (*OrderMutation) ItemsCleared ¶
func (m *OrderMutation) ItemsCleared() bool
ItemsCleared returns if the "items" edge to the Item entity was cleared.
func (*OrderMutation) ItemsIDs ¶
func (m *OrderMutation) ItemsIDs() (ids []int)
ItemsIDs returns the "items" edge IDs in the mutation.
func (*OrderMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Order entity. If the Order object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*OrderMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*OrderMutation) OldStatus ¶
func (m *OrderMutation) OldStatus(ctx context.Context) (v string, err error)
OldStatus returns the old "status" field's value of the Order entity. If the Order object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*OrderMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Order entity. If the Order object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*OrderMutation) OldUserID ¶
func (m *OrderMutation) OldUserID(ctx context.Context) (v string, err error)
OldUserID returns the old "user_id" field's value of the Order entity. If the Order object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (*OrderMutation) RemoveItemIDs ¶
func (m *OrderMutation) RemoveItemIDs(ids ...int)
RemoveItemIDs removes the "items" edge to the Item 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) RemovedItemsIDs ¶
func (m *OrderMutation) RemovedItemsIDs() (ids []int)
RemovedItems returns the removed IDs of the "items" edge to the Item entity.
func (*OrderMutation) ResetCreatedAt ¶
func (m *OrderMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*OrderMutation) ResetEdge ¶
func (m *OrderMutation) ResetEdge(name string) error
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (*OrderMutation) ResetField ¶
func (m *OrderMutation) ResetField(name string) error
ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.
func (*OrderMutation) ResetItems ¶
func (m *OrderMutation) ResetItems()
ResetItems resets all changes to the "items" edge.
func (*OrderMutation) ResetStatus ¶
func (m *OrderMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*OrderMutation) ResetUpdatedAt ¶
func (m *OrderMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*OrderMutation) ResetUserID ¶
func (m *OrderMutation) ResetUserID()
ResetUserID resets all changes to the "user_id" field.
func (*OrderMutation) SetCreatedAt ¶
func (m *OrderMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*OrderMutation) SetField ¶
func (m *OrderMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*OrderMutation) SetID ¶
func (m *OrderMutation) SetID(id string)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Order entities.
func (*OrderMutation) SetStatus ¶
func (m *OrderMutation) SetStatus(s string)
SetStatus sets the "status" field.
func (*OrderMutation) SetUpdatedAt ¶
func (m *OrderMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*OrderMutation) SetUserID ¶
func (m *OrderMutation) SetUserID(s string)
SetUserID sets the "user_id" field.
func (*OrderMutation) Status ¶
func (m *OrderMutation) Status() (r string, exists bool)
Status returns the value of the "status" field in the mutation.
func (OrderMutation) Tx ¶
func (m OrderMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*OrderMutation) Type ¶
func (m *OrderMutation) Type() string
Type returns the node type of this mutation (Order).
func (*OrderMutation) UpdatedAt ¶
func (m *OrderMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*OrderMutation) UserID ¶
func (m *OrderMutation) UserID() (r string, exists bool)
UserID returns the value of the "user_id" field in the mutation.
type OrderQuery ¶
type OrderQuery struct {
// contains filtered or unexported fields
}
OrderQuery is the builder for querying Order entities.
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 string, 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) string
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 { UserID string `json:"user_id,omitempty"` Count int `json:"count,omitempty"` } client.Order.Query(). GroupBy(order.FieldUserID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*OrderQuery) IDs ¶
func (oq *OrderQuery) IDs(ctx context.Context) ([]string, error)
IDs executes the query and returns a list of Order IDs.
func (*OrderQuery) IDsX ¶
func (oq *OrderQuery) IDsX(ctx context.Context) []string
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 exactly one Order entity is not found. Returns a *NotFoundError when no Order entities are found.
func (*OrderQuery) OnlyID ¶
func (oq *OrderQuery) OnlyID(ctx context.Context) (id string, err error)
OnlyID is like Only, but returns the only Order ID in the query. Returns a *NotSingularError when exactly one Order ID is not found. Returns a *NotFoundError when no entities are found.
func (*OrderQuery) OnlyIDX ¶
func (oq *OrderQuery) OnlyIDX(ctx context.Context) string
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) QueryItems ¶
func (oq *OrderQuery) QueryItems() *ItemQuery
QueryItems chains the current query on the "items" edge.
func (*OrderQuery) Select ¶
func (oq *OrderQuery) Select(field string, 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 { UserID string `json:"user_id,omitempty"` } client.Order.Query(). Select(order.FieldUserID). Scan(ctx, &v)
func (*OrderQuery) Where ¶
func (oq *OrderQuery) Where(ps ...predicate.Order) *OrderQuery
Where adds a new predicate for the OrderQuery builder.
func (*OrderQuery) WithItems ¶
func (oq *OrderQuery) WithItems(opts ...func(*ItemQuery)) *OrderQuery
WithItems tells the query-builder to eager-load the nodes that are connected to the "items" 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) Bool ¶
func (os *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 (os *OrderSelect) BoolX(ctx context.Context) bool
BoolX is like Bool, but panics if an error occurs.
func (*OrderSelect) Bools ¶
func (os *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 (os *OrderSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*OrderSelect) Float64 ¶
func (os *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 (os *OrderSelect) Float64X(ctx context.Context) float64
Float64X is like Float64, but panics if an error occurs.
func (*OrderSelect) Float64s ¶
func (os *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 (os *OrderSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*OrderSelect) Int ¶
func (os *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 (os *OrderSelect) IntX(ctx context.Context) int
IntX is like Int, but panics if an error occurs.
func (*OrderSelect) Ints ¶
func (os *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 (os *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 interface{}) error
Scan applies the selector query and scans the result into the given value.
func (*OrderSelect) ScanX ¶
func (os *OrderSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
func (*OrderSelect) String ¶
func (os *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 (os *OrderSelect) StringX(ctx context.Context) string
StringX is like String, 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) AddItemIDs ¶
func (ou *OrderUpdate) AddItemIDs(ids ...int) *OrderUpdate
AddItemIDs adds the "items" edge to the Item entity by IDs.
func (*OrderUpdate) AddItems ¶
func (ou *OrderUpdate) AddItems(i ...*Item) *OrderUpdate
AddItems adds the "items" edges to the Item entity.
func (*OrderUpdate) ClearItems ¶
func (ou *OrderUpdate) ClearItems() *OrderUpdate
ClearItems clears all "items" edges to the Item 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) RemoveItemIDs ¶
func (ou *OrderUpdate) RemoveItemIDs(ids ...int) *OrderUpdate
RemoveItemIDs removes the "items" edge to Item entities by IDs.
func (*OrderUpdate) RemoveItems ¶
func (ou *OrderUpdate) RemoveItems(i ...*Item) *OrderUpdate
RemoveItems removes "items" edges to Item 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) SetCreatedAt ¶
func (ou *OrderUpdate) SetCreatedAt(t time.Time) *OrderUpdate
SetCreatedAt sets the "created_at" field.
func (*OrderUpdate) SetNillableCreatedAt ¶
func (ou *OrderUpdate) SetNillableCreatedAt(t *time.Time) *OrderUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*OrderUpdate) SetNillableStatus ¶
func (ou *OrderUpdate) SetNillableStatus(s *string) *OrderUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*OrderUpdate) SetStatus ¶
func (ou *OrderUpdate) SetStatus(s string) *OrderUpdate
SetStatus sets the "status" field.
func (*OrderUpdate) SetUpdatedAt ¶
func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate
SetUpdatedAt sets the "updated_at" field.
func (*OrderUpdate) SetUserID ¶
func (ou *OrderUpdate) SetUserID(s string) *OrderUpdate
SetUserID sets the "user_id" field.
func (*OrderUpdate) Where ¶
func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate
Where adds a new predicate for 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) AddItemIDs ¶
func (ouo *OrderUpdateOne) AddItemIDs(ids ...int) *OrderUpdateOne
AddItemIDs adds the "items" edge to the Item entity by IDs.
func (*OrderUpdateOne) AddItems ¶
func (ouo *OrderUpdateOne) AddItems(i ...*Item) *OrderUpdateOne
AddItems adds the "items" edges to the Item entity.
func (*OrderUpdateOne) ClearItems ¶
func (ouo *OrderUpdateOne) ClearItems() *OrderUpdateOne
ClearItems clears all "items" edges to the Item 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) RemoveItemIDs ¶
func (ouo *OrderUpdateOne) RemoveItemIDs(ids ...int) *OrderUpdateOne
RemoveItemIDs removes the "items" edge to Item entities by IDs.
func (*OrderUpdateOne) RemoveItems ¶
func (ouo *OrderUpdateOne) RemoveItems(i ...*Item) *OrderUpdateOne
RemoveItems removes "items" edges to Item 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) SetCreatedAt ¶
func (ouo *OrderUpdateOne) SetCreatedAt(t time.Time) *OrderUpdateOne
SetCreatedAt sets the "created_at" field.
func (*OrderUpdateOne) SetNillableCreatedAt ¶
func (ouo *OrderUpdateOne) SetNillableCreatedAt(t *time.Time) *OrderUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*OrderUpdateOne) SetNillableStatus ¶
func (ouo *OrderUpdateOne) SetNillableStatus(s *string) *OrderUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*OrderUpdateOne) SetStatus ¶
func (ouo *OrderUpdateOne) SetStatus(s string) *OrderUpdateOne
SetStatus sets the "status" field.
func (*OrderUpdateOne) SetUpdatedAt ¶
func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *OrderUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*OrderUpdateOne) SetUserID ¶
func (ouo *OrderUpdateOne) SetUserID(s string) *OrderUpdateOne
SetUserID sets the "user_id" 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(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 Rollbacker method.
type Tx ¶
type Tx struct { // Item is the client for interacting with the Item builders. Item *ItemClient // 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 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.