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 int64) *OrderDeleteOne
- func (c *OrderClient) Get(ctx context.Context, id int64) (*Order, error)
- func (c *OrderClient) GetX(ctx context.Context, id int64) *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 int64) *OrderUpdateOne
- func (c *OrderClient) Use(hooks ...Hook)
- type 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) SetExchangeID(i int64) *OrderCreate
- func (oc *OrderCreate) SetGroupID(i int64) *OrderCreate
- func (oc *OrderCreate) SetID(i int64) *OrderCreate
- func (oc *OrderCreate) SetNillableGroupID(i *int64) *OrderCreate
- func (oc *OrderCreate) SetNillableStop(f *float64) *OrderCreate
- func (oc *OrderCreate) SetPrice(f float64) *OrderCreate
- func (oc *OrderCreate) SetQuantity(f float64) *OrderCreate
- func (oc *OrderCreate) SetSide(s string) *OrderCreate
- func (oc *OrderCreate) SetStatus(s string) *OrderCreate
- func (oc *OrderCreate) SetStop(f float64) *OrderCreate
- func (oc *OrderCreate) SetSymbol(s string) *OrderCreate
- func (oc *OrderCreate) SetType(s string) *OrderCreate
- func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate
- type OrderCreateBulk
- type OrderDelete
- type OrderDeleteOne
- 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) AddExchangeID(i int64)
- func (m *OrderMutation) AddField(name string, value ent.Value) error
- func (m *OrderMutation) AddGroupID(i int64)
- func (m *OrderMutation) AddPrice(f float64)
- func (m *OrderMutation) AddQuantity(f float64)
- func (m *OrderMutation) AddStop(f float64)
- func (m *OrderMutation) AddedEdges() []string
- func (m *OrderMutation) AddedExchangeID() (r int64, exists bool)
- func (m *OrderMutation) AddedField(name string) (ent.Value, bool)
- func (m *OrderMutation) AddedFields() []string
- func (m *OrderMutation) AddedGroupID() (r int64, exists bool)
- func (m *OrderMutation) AddedIDs(name string) []ent.Value
- func (m *OrderMutation) AddedPrice() (r float64, exists bool)
- func (m *OrderMutation) AddedQuantity() (r float64, exists bool)
- func (m *OrderMutation) AddedStop() (r float64, exists bool)
- func (m *OrderMutation) ClearEdge(name string) error
- func (m *OrderMutation) ClearField(name string) error
- func (m *OrderMutation) ClearGroupID()
- func (m *OrderMutation) ClearStop()
- 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) ExchangeID() (r int64, 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) GetType() (r string, exists bool)
- func (m *OrderMutation) GroupID() (r int64, exists bool)
- func (m *OrderMutation) GroupIDCleared() bool
- func (m *OrderMutation) ID() (id int64, exists bool)
- func (m *OrderMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *OrderMutation) OldExchangeID(ctx context.Context) (v int64, err error)
- func (m *OrderMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *OrderMutation) OldGroupID(ctx context.Context) (v int64, err error)
- func (m *OrderMutation) OldPrice(ctx context.Context) (v float64, err error)
- func (m *OrderMutation) OldQuantity(ctx context.Context) (v float64, err error)
- func (m *OrderMutation) OldSide(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldStatus(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldStop(ctx context.Context) (v float64, err error)
- func (m *OrderMutation) OldSymbol(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldType(ctx context.Context) (v string, err error)
- func (m *OrderMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *OrderMutation) Op() Op
- func (m *OrderMutation) Price() (r float64, exists bool)
- func (m *OrderMutation) Quantity() (r float64, exists bool)
- func (m *OrderMutation) RemovedEdges() []string
- func (m *OrderMutation) RemovedIDs(name string) []ent.Value
- func (m *OrderMutation) ResetCreatedAt()
- func (m *OrderMutation) ResetEdge(name string) error
- func (m *OrderMutation) ResetExchangeID()
- func (m *OrderMutation) ResetField(name string) error
- func (m *OrderMutation) ResetGroupID()
- func (m *OrderMutation) ResetPrice()
- func (m *OrderMutation) ResetQuantity()
- func (m *OrderMutation) ResetSide()
- func (m *OrderMutation) ResetStatus()
- func (m *OrderMutation) ResetStop()
- func (m *OrderMutation) ResetSymbol()
- func (m *OrderMutation) ResetType()
- func (m *OrderMutation) ResetUpdatedAt()
- func (m *OrderMutation) SetCreatedAt(t time.Time)
- func (m *OrderMutation) SetExchangeID(i int64)
- func (m *OrderMutation) SetField(name string, value ent.Value) error
- func (m *OrderMutation) SetGroupID(i int64)
- func (m *OrderMutation) SetID(id int64)
- func (m *OrderMutation) SetPrice(f float64)
- func (m *OrderMutation) SetQuantity(f float64)
- func (m *OrderMutation) SetSide(s string)
- func (m *OrderMutation) SetStatus(s string)
- func (m *OrderMutation) SetStop(f float64)
- func (m *OrderMutation) SetSymbol(s string)
- func (m *OrderMutation) SetType(s string)
- func (m *OrderMutation) SetUpdatedAt(t time.Time)
- func (m *OrderMutation) Side() (r string, exists bool)
- func (m *OrderMutation) Status() (r string, exists bool)
- func (m *OrderMutation) Stop() (r float64, exists bool)
- func (m *OrderMutation) StopCleared() bool
- func (m *OrderMutation) Symbol() (r string, exists bool)
- func (m OrderMutation) Tx() (*Tx, error)
- func (m *OrderMutation) Type() string
- func (m *OrderMutation) UpdatedAt() (r time.Time, 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 int64, err error)
- func (oq *OrderQuery) FirstIDX(ctx context.Context) int64
- func (oq *OrderQuery) FirstX(ctx context.Context) *Order
- func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy
- func (oq *OrderQuery) IDs(ctx context.Context) ([]int64, error)
- func (oq *OrderQuery) IDsX(ctx context.Context) []int64
- 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 int64, err error)
- func (oq *OrderQuery) OnlyIDX(ctx context.Context) int64
- func (oq *OrderQuery) OnlyX(ctx context.Context) *Order
- func (oq *OrderQuery) Order(o ...OrderFunc) *OrderQuery
- func (oq *OrderQuery) Select(field string, fields ...string) *OrderSelect
- func (oq *OrderQuery) Unique(unique bool) *OrderQuery
- func (oq *OrderQuery) Where(ps ...predicate.Order) *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) AddExchangeID(i int64) *OrderUpdate
- func (ou *OrderUpdate) AddGroupID(i int64) *OrderUpdate
- func (ou *OrderUpdate) AddPrice(f float64) *OrderUpdate
- func (ou *OrderUpdate) AddQuantity(f float64) *OrderUpdate
- func (ou *OrderUpdate) AddStop(f float64) *OrderUpdate
- func (ou *OrderUpdate) ClearGroupID() *OrderUpdate
- func (ou *OrderUpdate) ClearStop() *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) SetCreatedAt(t time.Time) *OrderUpdate
- func (ou *OrderUpdate) SetExchangeID(i int64) *OrderUpdate
- func (ou *OrderUpdate) SetGroupID(i int64) *OrderUpdate
- func (ou *OrderUpdate) SetNillableGroupID(i *int64) *OrderUpdate
- func (ou *OrderUpdate) SetNillableStop(f *float64) *OrderUpdate
- func (ou *OrderUpdate) SetPrice(f float64) *OrderUpdate
- func (ou *OrderUpdate) SetQuantity(f float64) *OrderUpdate
- func (ou *OrderUpdate) SetSide(s string) *OrderUpdate
- func (ou *OrderUpdate) SetStatus(s string) *OrderUpdate
- func (ou *OrderUpdate) SetStop(f float64) *OrderUpdate
- func (ou *OrderUpdate) SetSymbol(s string) *OrderUpdate
- func (ou *OrderUpdate) SetType(s string) *OrderUpdate
- func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate
- func (ou *OrderUpdate) Where(ps ...predicate.Order) *OrderUpdate
- type OrderUpdateOne
- func (ouo *OrderUpdateOne) AddExchangeID(i int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddGroupID(i int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddPrice(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddQuantity(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) AddStop(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) ClearGroupID() *OrderUpdateOne
- func (ouo *OrderUpdateOne) ClearStop() *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) SetCreatedAt(t time.Time) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetExchangeID(i int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetGroupID(i int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetNillableGroupID(i *int64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetNillableStop(f *float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetPrice(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetQuantity(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetSide(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetStatus(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetStop(f float64) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetSymbol(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetType(s string) *OrderUpdateOne
- func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *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 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 // 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(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 int64 `json:"id,omitempty"` // ExchangeID holds the value of the "exchange_id" field. ExchangeID int64 `json:"exchange_id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // Symbol holds the value of the "symbol" field. Symbol string `json:"symbol,omitempty"` // Side holds the value of the "side" field. Side string `json:"side,omitempty"` // Type holds the value of the "type" field. Type string `json:"type,omitempty"` // Status holds the value of the "status" field. Status string `json:"status,omitempty"` // Price holds the value of the "price" field. Price float64 `json:"price,omitempty"` // Quantity holds the value of the "quantity" field. Quantity float64 `json:"quantity,omitempty"` // GroupID holds the value of the "group_id" field. GroupID int64 `json:"group_id,omitempty"` // Stop holds the value of the "stop" field. Stop float64 `json:"stop,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 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 int64) *OrderDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*OrderClient) GetX ¶
func (c *OrderClient) GetX(ctx context.Context, id int64) *Order
GetX is like Get, but panics if an error occurs.
func (*OrderClient) 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 int64) *OrderUpdateOne
UpdateOneID returns an update builder for the given id.
func (*OrderClient) Use ¶
func (c *OrderClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `order.Hooks(f(g(h())))`.
type OrderCreate ¶
type OrderCreate struct {
// contains filtered or unexported fields
}
OrderCreate is the builder for creating a Order entity.
func (*OrderCreate) 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) SetExchangeID ¶
func (oc *OrderCreate) SetExchangeID(i int64) *OrderCreate
SetExchangeID sets the "exchange_id" field.
func (*OrderCreate) SetGroupID ¶
func (oc *OrderCreate) SetGroupID(i int64) *OrderCreate
SetGroupID sets the "group_id" field.
func (*OrderCreate) SetID ¶
func (oc *OrderCreate) SetID(i int64) *OrderCreate
SetID sets the "id" field.
func (*OrderCreate) SetNillableGroupID ¶
func (oc *OrderCreate) SetNillableGroupID(i *int64) *OrderCreate
SetNillableGroupID sets the "group_id" field if the given value is not nil.
func (*OrderCreate) SetNillableStop ¶
func (oc *OrderCreate) SetNillableStop(f *float64) *OrderCreate
SetNillableStop sets the "stop" field if the given value is not nil.
func (*OrderCreate) SetPrice ¶
func (oc *OrderCreate) SetPrice(f float64) *OrderCreate
SetPrice sets the "price" field.
func (*OrderCreate) SetQuantity ¶
func (oc *OrderCreate) SetQuantity(f float64) *OrderCreate
SetQuantity sets the "quantity" field.
func (*OrderCreate) SetSide ¶
func (oc *OrderCreate) SetSide(s string) *OrderCreate
SetSide sets the "side" field.
func (*OrderCreate) SetStatus ¶
func (oc *OrderCreate) SetStatus(s string) *OrderCreate
SetStatus sets the "status" field.
func (*OrderCreate) SetStop ¶
func (oc *OrderCreate) SetStop(f float64) *OrderCreate
SetStop sets the "stop" field.
func (*OrderCreate) SetSymbol ¶
func (oc *OrderCreate) SetSymbol(s string) *OrderCreate
SetSymbol sets the "symbol" field.
func (*OrderCreate) SetType ¶
func (oc *OrderCreate) SetType(s string) *OrderCreate
SetType sets the "type" field.
func (*OrderCreate) SetUpdatedAt ¶
func (oc *OrderCreate) SetUpdatedAt(t time.Time) *OrderCreate
SetUpdatedAt sets the "updated_at" 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 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) AddExchangeID ¶
func (m *OrderMutation) AddExchangeID(i int64)
AddExchangeID adds i to the "exchange_id" field.
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) AddGroupID ¶
func (m *OrderMutation) AddGroupID(i int64)
AddGroupID adds i to the "group_id" field.
func (*OrderMutation) AddPrice ¶
func (m *OrderMutation) AddPrice(f float64)
AddPrice adds f to the "price" field.
func (*OrderMutation) AddQuantity ¶
func (m *OrderMutation) AddQuantity(f float64)
AddQuantity adds f to the "quantity" field.
func (*OrderMutation) AddStop ¶
func (m *OrderMutation) AddStop(f float64)
AddStop adds f to the "stop" field.
func (*OrderMutation) AddedEdges ¶
func (m *OrderMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*OrderMutation) AddedExchangeID ¶
func (m *OrderMutation) AddedExchangeID() (r int64, exists bool)
AddedExchangeID returns the value that was added to the "exchange_id" field 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) AddedGroupID ¶
func (m *OrderMutation) AddedGroupID() (r int64, exists bool)
AddedGroupID returns the value that was added to the "group_id" field in 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) AddedPrice ¶
func (m *OrderMutation) AddedPrice() (r float64, exists bool)
AddedPrice returns the value that was added to the "price" field in this mutation.
func (*OrderMutation) AddedQuantity ¶
func (m *OrderMutation) AddedQuantity() (r float64, exists bool)
AddedQuantity returns the value that was added to the "quantity" field in this mutation.
func (*OrderMutation) AddedStop ¶
func (m *OrderMutation) AddedStop() (r float64, exists bool)
AddedStop returns the value that was added to the "stop" field 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) ClearGroupID ¶
func (m *OrderMutation) ClearGroupID()
ClearGroupID clears the value of the "group_id" field.
func (*OrderMutation) ClearStop ¶
func (m *OrderMutation) ClearStop()
ClearStop clears the value of the "stop" field.
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) ExchangeID ¶
func (m *OrderMutation) ExchangeID() (r int64, exists bool)
ExchangeID returns the value of the "exchange_id" 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) GetType ¶
func (m *OrderMutation) GetType() (r string, exists bool)
GetType returns the value of the "type" field in the mutation.
func (*OrderMutation) GroupID ¶
func (m *OrderMutation) GroupID() (r int64, exists bool)
GroupID returns the value of the "group_id" field in the mutation.
func (*OrderMutation) GroupIDCleared ¶
func (m *OrderMutation) GroupIDCleared() bool
GroupIDCleared returns if the "group_id" field was cleared in this mutation.
func (*OrderMutation) ID ¶
func (m *OrderMutation) ID() (id int64, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.
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) OldExchangeID ¶
func (m *OrderMutation) OldExchangeID(ctx context.Context) (v int64, err error)
OldExchangeID returns the old "exchange_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) 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) OldGroupID ¶
func (m *OrderMutation) OldGroupID(ctx context.Context) (v int64, err error)
OldGroupID returns the old "group_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) OldPrice ¶
func (m *OrderMutation) OldPrice(ctx context.Context) (v float64, err error)
OldPrice returns the old "price" 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) OldQuantity ¶
func (m *OrderMutation) OldQuantity(ctx context.Context) (v float64, err error)
OldQuantity returns the old "quantity" 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) OldSide ¶
func (m *OrderMutation) OldSide(ctx context.Context) (v string, err error)
OldSide returns the old "side" 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) 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) OldStop ¶
func (m *OrderMutation) OldStop(ctx context.Context) (v float64, err error)
OldStop returns the old "stop" 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) OldSymbol ¶
func (m *OrderMutation) OldSymbol(ctx context.Context) (v string, err error)
OldSymbol returns the old "symbol" 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) OldType ¶
func (m *OrderMutation) OldType(ctx context.Context) (v string, err error)
OldType returns the old "type" 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) Price ¶
func (m *OrderMutation) Price() (r float64, exists bool)
Price returns the value of the "price" field in the mutation.
func (*OrderMutation) Quantity ¶
func (m *OrderMutation) Quantity() (r float64, exists bool)
Quantity returns the value of the "quantity" 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) 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) ResetExchangeID ¶
func (m *OrderMutation) ResetExchangeID()
ResetExchangeID resets all changes to the "exchange_id" 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) ResetGroupID ¶
func (m *OrderMutation) ResetGroupID()
ResetGroupID resets all changes to the "group_id" field.
func (*OrderMutation) ResetPrice ¶
func (m *OrderMutation) ResetPrice()
ResetPrice resets all changes to the "price" field.
func (*OrderMutation) ResetQuantity ¶
func (m *OrderMutation) ResetQuantity()
ResetQuantity resets all changes to the "quantity" field.
func (*OrderMutation) ResetSide ¶
func (m *OrderMutation) ResetSide()
ResetSide resets all changes to the "side" field.
func (*OrderMutation) ResetStatus ¶
func (m *OrderMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*OrderMutation) ResetStop ¶
func (m *OrderMutation) ResetStop()
ResetStop resets all changes to the "stop" field.
func (*OrderMutation) ResetSymbol ¶
func (m *OrderMutation) ResetSymbol()
ResetSymbol resets all changes to the "symbol" field.
func (*OrderMutation) ResetType ¶
func (m *OrderMutation) ResetType()
ResetType resets all changes to the "type" field.
func (*OrderMutation) ResetUpdatedAt ¶
func (m *OrderMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*OrderMutation) SetCreatedAt ¶
func (m *OrderMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*OrderMutation) SetExchangeID ¶
func (m *OrderMutation) SetExchangeID(i int64)
SetExchangeID sets the "exchange_id" 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) SetGroupID ¶
func (m *OrderMutation) SetGroupID(i int64)
SetGroupID sets the "group_id" field.
func (*OrderMutation) SetID ¶
func (m *OrderMutation) SetID(id int64)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Order entities.
func (*OrderMutation) SetPrice ¶
func (m *OrderMutation) SetPrice(f float64)
SetPrice sets the "price" field.
func (*OrderMutation) SetQuantity ¶
func (m *OrderMutation) SetQuantity(f float64)
SetQuantity sets the "quantity" field.
func (*OrderMutation) SetSide ¶
func (m *OrderMutation) SetSide(s string)
SetSide sets the "side" field.
func (*OrderMutation) SetStatus ¶
func (m *OrderMutation) SetStatus(s string)
SetStatus sets the "status" field.
func (*OrderMutation) SetStop ¶
func (m *OrderMutation) SetStop(f float64)
SetStop sets the "stop" field.
func (*OrderMutation) SetSymbol ¶
func (m *OrderMutation) SetSymbol(s string)
SetSymbol sets the "symbol" field.
func (*OrderMutation) SetType ¶
func (m *OrderMutation) SetType(s string)
SetType sets the "type" field.
func (*OrderMutation) SetUpdatedAt ¶
func (m *OrderMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*OrderMutation) Side ¶
func (m *OrderMutation) Side() (r string, exists bool)
Side returns the value of the "side" field in the mutation.
func (*OrderMutation) Status ¶
func (m *OrderMutation) Status() (r string, exists bool)
Status returns the value of the "status" field in the mutation.
func (*OrderMutation) Stop ¶
func (m *OrderMutation) Stop() (r float64, exists bool)
Stop returns the value of the "stop" field in the mutation.
func (*OrderMutation) StopCleared ¶
func (m *OrderMutation) StopCleared() bool
StopCleared returns if the "stop" field was cleared in this mutation.
func (*OrderMutation) Symbol ¶
func (m *OrderMutation) Symbol() (r string, exists bool)
Symbol returns the value of the "symbol" 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).
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 int64, err error)
FirstID returns the first Order ID from the query. Returns a *NotFoundError when no Order ID was found.
func (*OrderQuery) FirstIDX ¶
func (oq *OrderQuery) FirstIDX(ctx context.Context) int64
FirstIDX is like FirstID, but panics if an error occurs.
func (*OrderQuery) FirstX ¶
func (oq *OrderQuery) FirstX(ctx context.Context) *Order
FirstX is like First, but panics if an error occurs.
func (*OrderQuery) GroupBy ¶
func (oq *OrderQuery) GroupBy(field string, fields ...string) *OrderGroupBy
GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
Example:
var v []struct { ExchangeID int64 `json:"exchange_id,omitempty"` Count int `json:"count,omitempty"` } client.Order.Query(). GroupBy(order.FieldExchangeID). Aggregate(ent.Count()). Scan(ctx, &v)
func (*OrderQuery) IDs ¶
func (oq *OrderQuery) IDs(ctx context.Context) ([]int64, error)
IDs executes the query and returns a list of Order IDs.
func (*OrderQuery) IDsX ¶
func (oq *OrderQuery) IDsX(ctx context.Context) []int64
IDsX is like IDs, but panics if an error occurs.
func (*OrderQuery) Limit ¶
func (oq *OrderQuery) Limit(limit int) *OrderQuery
Limit 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 int64, 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) int64
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*OrderQuery) OnlyX ¶
func (oq *OrderQuery) OnlyX(ctx context.Context) *Order
OnlyX is like Only, but panics if an error occurs.
func (*OrderQuery) Order ¶
func (oq *OrderQuery) Order(o ...OrderFunc) *OrderQuery
Order adds an order step to the query.
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 { ExchangeID int64 `json:"exchange_id,omitempty"` } client.Order.Query(). Select(order.FieldExchangeID). 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) 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) AddExchangeID ¶
func (ou *OrderUpdate) AddExchangeID(i int64) *OrderUpdate
AddExchangeID adds i to the "exchange_id" field.
func (*OrderUpdate) AddGroupID ¶
func (ou *OrderUpdate) AddGroupID(i int64) *OrderUpdate
AddGroupID adds i to the "group_id" field.
func (*OrderUpdate) AddPrice ¶
func (ou *OrderUpdate) AddPrice(f float64) *OrderUpdate
AddPrice adds f to the "price" field.
func (*OrderUpdate) AddQuantity ¶
func (ou *OrderUpdate) AddQuantity(f float64) *OrderUpdate
AddQuantity adds f to the "quantity" field.
func (*OrderUpdate) AddStop ¶
func (ou *OrderUpdate) AddStop(f float64) *OrderUpdate
AddStop adds f to the "stop" field.
func (*OrderUpdate) ClearGroupID ¶
func (ou *OrderUpdate) ClearGroupID() *OrderUpdate
ClearGroupID clears the value of the "group_id" field.
func (*OrderUpdate) ClearStop ¶
func (ou *OrderUpdate) ClearStop() *OrderUpdate
ClearStop clears the value of the "stop" 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) SetCreatedAt ¶
func (ou *OrderUpdate) SetCreatedAt(t time.Time) *OrderUpdate
SetCreatedAt sets the "created_at" field.
func (*OrderUpdate) SetExchangeID ¶
func (ou *OrderUpdate) SetExchangeID(i int64) *OrderUpdate
SetExchangeID sets the "exchange_id" field.
func (*OrderUpdate) SetGroupID ¶
func (ou *OrderUpdate) SetGroupID(i int64) *OrderUpdate
SetGroupID sets the "group_id" field.
func (*OrderUpdate) SetNillableGroupID ¶
func (ou *OrderUpdate) SetNillableGroupID(i *int64) *OrderUpdate
SetNillableGroupID sets the "group_id" field if the given value is not nil.
func (*OrderUpdate) SetNillableStop ¶
func (ou *OrderUpdate) SetNillableStop(f *float64) *OrderUpdate
SetNillableStop sets the "stop" field if the given value is not nil.
func (*OrderUpdate) SetPrice ¶
func (ou *OrderUpdate) SetPrice(f float64) *OrderUpdate
SetPrice sets the "price" field.
func (*OrderUpdate) SetQuantity ¶
func (ou *OrderUpdate) SetQuantity(f float64) *OrderUpdate
SetQuantity sets the "quantity" field.
func (*OrderUpdate) SetSide ¶
func (ou *OrderUpdate) SetSide(s string) *OrderUpdate
SetSide sets the "side" field.
func (*OrderUpdate) SetStatus ¶
func (ou *OrderUpdate) SetStatus(s string) *OrderUpdate
SetStatus sets the "status" field.
func (*OrderUpdate) SetStop ¶
func (ou *OrderUpdate) SetStop(f float64) *OrderUpdate
SetStop sets the "stop" field.
func (*OrderUpdate) SetSymbol ¶
func (ou *OrderUpdate) SetSymbol(s string) *OrderUpdate
SetSymbol sets the "symbol" field.
func (*OrderUpdate) SetType ¶
func (ou *OrderUpdate) SetType(s string) *OrderUpdate
SetType sets the "type" field.
func (*OrderUpdate) SetUpdatedAt ¶
func (ou *OrderUpdate) SetUpdatedAt(t time.Time) *OrderUpdate
SetUpdatedAt sets the "updated_at" 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) AddExchangeID ¶
func (ouo *OrderUpdateOne) AddExchangeID(i int64) *OrderUpdateOne
AddExchangeID adds i to the "exchange_id" field.
func (*OrderUpdateOne) AddGroupID ¶
func (ouo *OrderUpdateOne) AddGroupID(i int64) *OrderUpdateOne
AddGroupID adds i to the "group_id" field.
func (*OrderUpdateOne) AddPrice ¶
func (ouo *OrderUpdateOne) AddPrice(f float64) *OrderUpdateOne
AddPrice adds f to the "price" field.
func (*OrderUpdateOne) AddQuantity ¶
func (ouo *OrderUpdateOne) AddQuantity(f float64) *OrderUpdateOne
AddQuantity adds f to the "quantity" field.
func (*OrderUpdateOne) AddStop ¶
func (ouo *OrderUpdateOne) AddStop(f float64) *OrderUpdateOne
AddStop adds f to the "stop" field.
func (*OrderUpdateOne) ClearGroupID ¶
func (ouo *OrderUpdateOne) ClearGroupID() *OrderUpdateOne
ClearGroupID clears the value of the "group_id" field.
func (*OrderUpdateOne) ClearStop ¶
func (ouo *OrderUpdateOne) ClearStop() *OrderUpdateOne
ClearStop clears the value of the "stop" 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) SetCreatedAt ¶
func (ouo *OrderUpdateOne) SetCreatedAt(t time.Time) *OrderUpdateOne
SetCreatedAt sets the "created_at" field.
func (*OrderUpdateOne) SetExchangeID ¶
func (ouo *OrderUpdateOne) SetExchangeID(i int64) *OrderUpdateOne
SetExchangeID sets the "exchange_id" field.
func (*OrderUpdateOne) SetGroupID ¶
func (ouo *OrderUpdateOne) SetGroupID(i int64) *OrderUpdateOne
SetGroupID sets the "group_id" field.
func (*OrderUpdateOne) SetNillableGroupID ¶
func (ouo *OrderUpdateOne) SetNillableGroupID(i *int64) *OrderUpdateOne
SetNillableGroupID sets the "group_id" field if the given value is not nil.
func (*OrderUpdateOne) SetNillableStop ¶
func (ouo *OrderUpdateOne) SetNillableStop(f *float64) *OrderUpdateOne
SetNillableStop sets the "stop" field if the given value is not nil.
func (*OrderUpdateOne) SetPrice ¶
func (ouo *OrderUpdateOne) SetPrice(f float64) *OrderUpdateOne
SetPrice sets the "price" field.
func (*OrderUpdateOne) SetQuantity ¶
func (ouo *OrderUpdateOne) SetQuantity(f float64) *OrderUpdateOne
SetQuantity sets the "quantity" field.
func (*OrderUpdateOne) SetSide ¶
func (ouo *OrderUpdateOne) SetSide(s string) *OrderUpdateOne
SetSide sets the "side" field.
func (*OrderUpdateOne) SetStatus ¶
func (ouo *OrderUpdateOne) SetStatus(s string) *OrderUpdateOne
SetStatus sets the "status" field.
func (*OrderUpdateOne) SetStop ¶
func (ouo *OrderUpdateOne) SetStop(f float64) *OrderUpdateOne
SetStop sets the "stop" field.
func (*OrderUpdateOne) SetSymbol ¶
func (ouo *OrderUpdateOne) SetSymbol(s string) *OrderUpdateOne
SetSymbol sets the "symbol" field.
func (*OrderUpdateOne) SetType ¶
func (ouo *OrderUpdateOne) SetType(s string) *OrderUpdateOne
SetType sets the "type" field.
func (*OrderUpdateOne) SetUpdatedAt ¶
func (ouo *OrderUpdateOne) SetUpdatedAt(t time.Time) *OrderUpdateOne
SetUpdatedAt sets the "updated_at" 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 { // 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.