Documentation ¶
Index ¶
- func IsConstraintFailure(err error) bool
- func IsNotFound(err error) bool
- func IsNotSingular(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- type Aggregate
- type Client
- type Direction
- type DirectionClient
- func (c *DirectionClient) Create() *DirectionCreate
- func (c *DirectionClient) Delete() *DirectionDelete
- func (c *DirectionClient) DeleteOne(d *Direction) *DirectionDeleteOne
- func (c *DirectionClient) DeleteOneID(id int) *DirectionDeleteOne
- func (c *DirectionClient) Get(ctx context.Context, id int) (*Direction, error)
- func (c *DirectionClient) GetX(ctx context.Context, id int) *Direction
- func (c *DirectionClient) Query() *DirectionQuery
- func (c *DirectionClient) Update() *DirectionUpdate
- func (c *DirectionClient) UpdateOne(d *Direction) *DirectionUpdateOne
- func (c *DirectionClient) UpdateOneID(id int) *DirectionUpdateOne
- type DirectionCreate
- type DirectionDelete
- type DirectionDeleteOne
- type DirectionGroupBy
- func (dgb *DirectionGroupBy) Aggregate(fns ...Aggregate) *DirectionGroupBy
- func (dgb *DirectionGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (dgb *DirectionGroupBy) BoolsX(ctx context.Context) []bool
- func (dgb *DirectionGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (dgb *DirectionGroupBy) Float64sX(ctx context.Context) []float64
- func (dgb *DirectionGroupBy) Ints(ctx context.Context) ([]int, error)
- func (dgb *DirectionGroupBy) IntsX(ctx context.Context) []int
- func (dgb *DirectionGroupBy) Scan(ctx context.Context, v interface{}) error
- func (dgb *DirectionGroupBy) ScanX(ctx context.Context, v interface{})
- func (dgb *DirectionGroupBy) Strings(ctx context.Context) ([]string, error)
- func (dgb *DirectionGroupBy) StringsX(ctx context.Context) []string
- type DirectionQuery
- func (dq *DirectionQuery) All(ctx context.Context) ([]*Direction, error)
- func (dq *DirectionQuery) AllX(ctx context.Context) []*Direction
- func (dq *DirectionQuery) Clone() *DirectionQuery
- func (dq *DirectionQuery) Count(ctx context.Context) (int, error)
- func (dq *DirectionQuery) CountX(ctx context.Context) int
- func (dq *DirectionQuery) Exist(ctx context.Context) (bool, error)
- func (dq *DirectionQuery) ExistX(ctx context.Context) bool
- func (dq *DirectionQuery) First(ctx context.Context) (*Direction, error)
- func (dq *DirectionQuery) FirstID(ctx context.Context) (id int, err error)
- func (dq *DirectionQuery) FirstX(ctx context.Context) *Direction
- func (dq *DirectionQuery) FirstXID(ctx context.Context) int
- func (dq *DirectionQuery) GroupBy(field string, fields ...string) *DirectionGroupBy
- func (dq *DirectionQuery) IDs(ctx context.Context) ([]int, error)
- func (dq *DirectionQuery) IDsX(ctx context.Context) []int
- func (dq *DirectionQuery) Limit(limit int) *DirectionQuery
- func (dq *DirectionQuery) Offset(offset int) *DirectionQuery
- func (dq *DirectionQuery) Only(ctx context.Context) (*Direction, error)
- func (dq *DirectionQuery) OnlyID(ctx context.Context) (id int, err error)
- func (dq *DirectionQuery) OnlyX(ctx context.Context) *Direction
- func (dq *DirectionQuery) OnlyXID(ctx context.Context) int
- func (dq *DirectionQuery) Order(o ...Order) *DirectionQuery
- func (dq *DirectionQuery) Select(field string, fields ...string) *DirectionSelect
- func (dq *DirectionQuery) Where(ps ...predicate.Direction) *DirectionQuery
- type DirectionSelect
- func (ds *DirectionSelect) Bools(ctx context.Context) ([]bool, error)
- func (ds *DirectionSelect) BoolsX(ctx context.Context) []bool
- func (ds *DirectionSelect) Float64s(ctx context.Context) ([]float64, error)
- func (ds *DirectionSelect) Float64sX(ctx context.Context) []float64
- func (ds *DirectionSelect) Ints(ctx context.Context) ([]int, error)
- func (ds *DirectionSelect) IntsX(ctx context.Context) []int
- func (ds *DirectionSelect) Scan(ctx context.Context, v interface{}) error
- func (ds *DirectionSelect) ScanX(ctx context.Context, v interface{})
- func (ds *DirectionSelect) Strings(ctx context.Context) ([]string, error)
- func (ds *DirectionSelect) StringsX(ctx context.Context) []string
- type DirectionUpdate
- func (du *DirectionUpdate) Exec(ctx context.Context) error
- func (du *DirectionUpdate) ExecX(ctx context.Context)
- func (du *DirectionUpdate) Save(ctx context.Context) (int, error)
- func (du *DirectionUpdate) SaveX(ctx context.Context) int
- func (du *DirectionUpdate) SetDescription(s string) *DirectionUpdate
- func (du *DirectionUpdate) SetName(s string) *DirectionUpdate
- func (du *DirectionUpdate) Where(ps ...predicate.Direction) *DirectionUpdate
- type DirectionUpdateOne
- func (duo *DirectionUpdateOne) Exec(ctx context.Context) error
- func (duo *DirectionUpdateOne) ExecX(ctx context.Context)
- func (duo *DirectionUpdateOne) Save(ctx context.Context) (*Direction, error)
- func (duo *DirectionUpdateOne) SaveX(ctx context.Context) *Direction
- func (duo *DirectionUpdateOne) SetDescription(s string) *DirectionUpdateOne
- func (duo *DirectionUpdateOne) SetName(s string) *DirectionUpdateOne
- type Directions
- type ErrConstraintFailed
- type ErrNotFound
- type ErrNotSingular
- type Ingredient
- type IngredientClient
- func (c *IngredientClient) Create() *IngredientCreate
- func (c *IngredientClient) Delete() *IngredientDelete
- func (c *IngredientClient) DeleteOne(i *Ingredient) *IngredientDeleteOne
- func (c *IngredientClient) DeleteOneID(id int) *IngredientDeleteOne
- func (c *IngredientClient) Get(ctx context.Context, id int) (*Ingredient, error)
- func (c *IngredientClient) GetX(ctx context.Context, id int) *Ingredient
- func (c *IngredientClient) Query() *IngredientQuery
- func (c *IngredientClient) Update() *IngredientUpdate
- func (c *IngredientClient) UpdateOne(i *Ingredient) *IngredientUpdateOne
- func (c *IngredientClient) UpdateOneID(id int) *IngredientUpdateOne
- type IngredientCreate
- type IngredientDelete
- type IngredientDeleteOne
- type IngredientGroupBy
- func (igb *IngredientGroupBy) Aggregate(fns ...Aggregate) *IngredientGroupBy
- func (igb *IngredientGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (igb *IngredientGroupBy) BoolsX(ctx context.Context) []bool
- func (igb *IngredientGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (igb *IngredientGroupBy) Float64sX(ctx context.Context) []float64
- func (igb *IngredientGroupBy) Ints(ctx context.Context) ([]int, error)
- func (igb *IngredientGroupBy) IntsX(ctx context.Context) []int
- func (igb *IngredientGroupBy) Scan(ctx context.Context, v interface{}) error
- func (igb *IngredientGroupBy) ScanX(ctx context.Context, v interface{})
- func (igb *IngredientGroupBy) Strings(ctx context.Context) ([]string, error)
- func (igb *IngredientGroupBy) StringsX(ctx context.Context) []string
- type IngredientQuery
- func (iq *IngredientQuery) All(ctx context.Context) ([]*Ingredient, error)
- func (iq *IngredientQuery) AllX(ctx context.Context) []*Ingredient
- func (iq *IngredientQuery) Clone() *IngredientQuery
- func (iq *IngredientQuery) Count(ctx context.Context) (int, error)
- func (iq *IngredientQuery) CountX(ctx context.Context) int
- func (iq *IngredientQuery) Exist(ctx context.Context) (bool, error)
- func (iq *IngredientQuery) ExistX(ctx context.Context) bool
- func (iq *IngredientQuery) First(ctx context.Context) (*Ingredient, error)
- func (iq *IngredientQuery) FirstID(ctx context.Context) (id int, err error)
- func (iq *IngredientQuery) FirstX(ctx context.Context) *Ingredient
- func (iq *IngredientQuery) FirstXID(ctx context.Context) int
- func (iq *IngredientQuery) GroupBy(field string, fields ...string) *IngredientGroupBy
- func (iq *IngredientQuery) IDs(ctx context.Context) ([]int, error)
- func (iq *IngredientQuery) IDsX(ctx context.Context) []int
- func (iq *IngredientQuery) Limit(limit int) *IngredientQuery
- func (iq *IngredientQuery) Offset(offset int) *IngredientQuery
- func (iq *IngredientQuery) Only(ctx context.Context) (*Ingredient, error)
- func (iq *IngredientQuery) OnlyID(ctx context.Context) (id int, err error)
- func (iq *IngredientQuery) OnlyX(ctx context.Context) *Ingredient
- func (iq *IngredientQuery) OnlyXID(ctx context.Context) int
- func (iq *IngredientQuery) Order(o ...Order) *IngredientQuery
- func (iq *IngredientQuery) Select(field string, fields ...string) *IngredientSelect
- func (iq *IngredientQuery) Where(ps ...predicate.Ingredient) *IngredientQuery
- type IngredientSelect
- func (is *IngredientSelect) Bools(ctx context.Context) ([]bool, error)
- func (is *IngredientSelect) BoolsX(ctx context.Context) []bool
- func (is *IngredientSelect) Float64s(ctx context.Context) ([]float64, error)
- func (is *IngredientSelect) Float64sX(ctx context.Context) []float64
- func (is *IngredientSelect) Ints(ctx context.Context) ([]int, error)
- func (is *IngredientSelect) IntsX(ctx context.Context) []int
- func (is *IngredientSelect) Scan(ctx context.Context, v interface{}) error
- func (is *IngredientSelect) ScanX(ctx context.Context, v interface{})
- func (is *IngredientSelect) Strings(ctx context.Context) ([]string, error)
- func (is *IngredientSelect) StringsX(ctx context.Context) []string
- type IngredientUpdate
- func (iu *IngredientUpdate) Exec(ctx context.Context) error
- func (iu *IngredientUpdate) ExecX(ctx context.Context)
- func (iu *IngredientUpdate) Save(ctx context.Context) (int, error)
- func (iu *IngredientUpdate) SaveX(ctx context.Context) int
- func (iu *IngredientUpdate) SetName(s string) *IngredientUpdate
- func (iu *IngredientUpdate) SetUnitType(s string) *IngredientUpdate
- func (iu *IngredientUpdate) Where(ps ...predicate.Ingredient) *IngredientUpdate
- type IngredientUpdateOne
- func (iuo *IngredientUpdateOne) Exec(ctx context.Context) error
- func (iuo *IngredientUpdateOne) ExecX(ctx context.Context)
- func (iuo *IngredientUpdateOne) Save(ctx context.Context) (*Ingredient, error)
- func (iuo *IngredientUpdateOne) SaveX(ctx context.Context) *Ingredient
- func (iuo *IngredientUpdateOne) SetName(s string) *IngredientUpdateOne
- func (iuo *IngredientUpdateOne) SetUnitType(s string) *IngredientUpdateOne
- type Ingredients
- type Option
- type Order
- type Receipt
- type ReceiptClient
- func (c *ReceiptClient) Create() *ReceiptCreate
- func (c *ReceiptClient) Delete() *ReceiptDelete
- func (c *ReceiptClient) DeleteOne(r *Receipt) *ReceiptDeleteOne
- func (c *ReceiptClient) DeleteOneID(id int) *ReceiptDeleteOne
- func (c *ReceiptClient) Get(ctx context.Context, id int) (*Receipt, error)
- func (c *ReceiptClient) GetX(ctx context.Context, id int) *Receipt
- func (c *ReceiptClient) Query() *ReceiptQuery
- func (c *ReceiptClient) QueryDirections(r *Receipt) *DirectionQuery
- func (c *ReceiptClient) QueryIngredients(r *Receipt) *IngredientQuery
- func (c *ReceiptClient) Update() *ReceiptUpdate
- func (c *ReceiptClient) UpdateOne(r *Receipt) *ReceiptUpdateOne
- func (c *ReceiptClient) UpdateOneID(id int) *ReceiptUpdateOne
- type ReceiptCreate
- func (rc *ReceiptCreate) AddDirectionIDs(ids ...int) *ReceiptCreate
- func (rc *ReceiptCreate) AddDirections(d ...*Direction) *ReceiptCreate
- func (rc *ReceiptCreate) AddIngredientIDs(ids ...int) *ReceiptCreate
- func (rc *ReceiptCreate) AddIngredients(i ...*Ingredient) *ReceiptCreate
- func (rc *ReceiptCreate) Save(ctx context.Context) (*Receipt, error)
- func (rc *ReceiptCreate) SaveX(ctx context.Context) *Receipt
- func (rc *ReceiptCreate) SetName(s string) *ReceiptCreate
- func (rc *ReceiptCreate) SetPortions(i int) *ReceiptCreate
- type ReceiptDelete
- type ReceiptDeleteOne
- type ReceiptGroupBy
- func (rgb *ReceiptGroupBy) Aggregate(fns ...Aggregate) *ReceiptGroupBy
- func (rgb *ReceiptGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (rgb *ReceiptGroupBy) BoolsX(ctx context.Context) []bool
- func (rgb *ReceiptGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (rgb *ReceiptGroupBy) Float64sX(ctx context.Context) []float64
- func (rgb *ReceiptGroupBy) Ints(ctx context.Context) ([]int, error)
- func (rgb *ReceiptGroupBy) IntsX(ctx context.Context) []int
- func (rgb *ReceiptGroupBy) Scan(ctx context.Context, v interface{}) error
- func (rgb *ReceiptGroupBy) ScanX(ctx context.Context, v interface{})
- func (rgb *ReceiptGroupBy) Strings(ctx context.Context) ([]string, error)
- func (rgb *ReceiptGroupBy) StringsX(ctx context.Context) []string
- type ReceiptQuery
- func (rq *ReceiptQuery) All(ctx context.Context) ([]*Receipt, error)
- func (rq *ReceiptQuery) AllX(ctx context.Context) []*Receipt
- func (rq *ReceiptQuery) Clone() *ReceiptQuery
- func (rq *ReceiptQuery) Count(ctx context.Context) (int, error)
- func (rq *ReceiptQuery) CountX(ctx context.Context) int
- func (rq *ReceiptQuery) Exist(ctx context.Context) (bool, error)
- func (rq *ReceiptQuery) ExistX(ctx context.Context) bool
- func (rq *ReceiptQuery) First(ctx context.Context) (*Receipt, error)
- func (rq *ReceiptQuery) FirstID(ctx context.Context) (id int, err error)
- func (rq *ReceiptQuery) FirstX(ctx context.Context) *Receipt
- func (rq *ReceiptQuery) FirstXID(ctx context.Context) int
- func (rq *ReceiptQuery) GroupBy(field string, fields ...string) *ReceiptGroupBy
- func (rq *ReceiptQuery) IDs(ctx context.Context) ([]int, error)
- func (rq *ReceiptQuery) IDsX(ctx context.Context) []int
- func (rq *ReceiptQuery) Limit(limit int) *ReceiptQuery
- func (rq *ReceiptQuery) Offset(offset int) *ReceiptQuery
- func (rq *ReceiptQuery) Only(ctx context.Context) (*Receipt, error)
- func (rq *ReceiptQuery) OnlyID(ctx context.Context) (id int, err error)
- func (rq *ReceiptQuery) OnlyX(ctx context.Context) *Receipt
- func (rq *ReceiptQuery) OnlyXID(ctx context.Context) int
- func (rq *ReceiptQuery) Order(o ...Order) *ReceiptQuery
- func (rq *ReceiptQuery) QueryDirections() *DirectionQuery
- func (rq *ReceiptQuery) QueryIngredients() *IngredientQuery
- func (rq *ReceiptQuery) Select(field string, fields ...string) *ReceiptSelect
- func (rq *ReceiptQuery) Where(ps ...predicate.Receipt) *ReceiptQuery
- type ReceiptSelect
- func (rs *ReceiptSelect) Bools(ctx context.Context) ([]bool, error)
- func (rs *ReceiptSelect) BoolsX(ctx context.Context) []bool
- func (rs *ReceiptSelect) Float64s(ctx context.Context) ([]float64, error)
- func (rs *ReceiptSelect) Float64sX(ctx context.Context) []float64
- func (rs *ReceiptSelect) Ints(ctx context.Context) ([]int, error)
- func (rs *ReceiptSelect) IntsX(ctx context.Context) []int
- func (rs *ReceiptSelect) Scan(ctx context.Context, v interface{}) error
- func (rs *ReceiptSelect) ScanX(ctx context.Context, v interface{})
- func (rs *ReceiptSelect) Strings(ctx context.Context) ([]string, error)
- func (rs *ReceiptSelect) StringsX(ctx context.Context) []string
- type ReceiptUpdate
- func (ru *ReceiptUpdate) AddDirectionIDs(ids ...int) *ReceiptUpdate
- func (ru *ReceiptUpdate) AddDirections(d ...*Direction) *ReceiptUpdate
- func (ru *ReceiptUpdate) AddIngredientIDs(ids ...int) *ReceiptUpdate
- func (ru *ReceiptUpdate) AddIngredients(i ...*Ingredient) *ReceiptUpdate
- func (ru *ReceiptUpdate) AddPortions(i int) *ReceiptUpdate
- func (ru *ReceiptUpdate) Exec(ctx context.Context) error
- func (ru *ReceiptUpdate) ExecX(ctx context.Context)
- func (ru *ReceiptUpdate) RemoveDirectionIDs(ids ...int) *ReceiptUpdate
- func (ru *ReceiptUpdate) RemoveDirections(d ...*Direction) *ReceiptUpdate
- func (ru *ReceiptUpdate) RemoveIngredientIDs(ids ...int) *ReceiptUpdate
- func (ru *ReceiptUpdate) RemoveIngredients(i ...*Ingredient) *ReceiptUpdate
- func (ru *ReceiptUpdate) Save(ctx context.Context) (int, error)
- func (ru *ReceiptUpdate) SaveX(ctx context.Context) int
- func (ru *ReceiptUpdate) SetName(s string) *ReceiptUpdate
- func (ru *ReceiptUpdate) SetPortions(i int) *ReceiptUpdate
- func (ru *ReceiptUpdate) Where(ps ...predicate.Receipt) *ReceiptUpdate
- type ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) AddDirectionIDs(ids ...int) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) AddDirections(d ...*Direction) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) AddIngredientIDs(ids ...int) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) AddIngredients(i ...*Ingredient) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) AddPortions(i int) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) Exec(ctx context.Context) error
- func (ruo *ReceiptUpdateOne) ExecX(ctx context.Context)
- func (ruo *ReceiptUpdateOne) RemoveDirectionIDs(ids ...int) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) RemoveDirections(d ...*Direction) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) RemoveIngredientIDs(ids ...int) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) RemoveIngredients(i ...*Ingredient) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) Save(ctx context.Context) (*Receipt, error)
- func (ruo *ReceiptUpdateOne) SaveX(ctx context.Context) *Receipt
- func (ruo *ReceiptUpdateOne) SetName(s string) *ReceiptUpdateOne
- func (ruo *ReceiptUpdateOne) SetPortions(i int) *ReceiptUpdateOne
- type Receipts
- type Tx
- type User
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- type UserCreate
- type UserDelete
- type UserDeleteOne
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...Aggregate) *UserGroupBy
- func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
- func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
- func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (ugb *UserGroupBy) StringsX(ctx context.Context) []string
- type UserQuery
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) FirstXID(ctx context.Context) int
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) OnlyXID(ctx context.Context) int
- func (uq *UserQuery) Order(o ...Order) *UserQuery
- func (uq *UserQuery) Select(field string, fields ...string) *UserSelect
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- type UserSelect
- func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (us *UserSelect) BoolsX(ctx context.Context) []bool
- func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (us *UserSelect) Float64sX(ctx context.Context) []float64
- func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (us *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
- func (us *UserSelect) ScanX(ctx context.Context, v interface{})
- func (us *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (us *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- type UserUpdateOne
- type Users
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConstraintFailure ¶
IsConstraintFailure 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 IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
Types ¶
type Aggregate ¶
type Aggregate struct { // SQL the column wrapped with the aggregation function. SQL func(*sql.Selector) string }
Aggregate applies an aggregation step on the group-by traversal/selector.
func As ¶
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Direction is the client for interacting with the Direction builders. Direction *DirectionClient // Ingredient is the client for interacting with the Ingredient builders. Ingredient *IngredientClient // Receipt is the client for interacting with the Receipt builders. Receipt *ReceiptClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns the Client stored in a context, or nil if there isn't one.
func Open ¶
Open opens a connection to the database specified by the driver name and a driver-specific data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
type Direction ¶
type Direction struct { // ID of the ent. ID int `json:"id,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // contains filtered or unexported fields }
Direction is the model entity for the Direction schema.
Example ¶
if dsn == "" { return } ctx := context.Background() drv, err := sql.Open("mysql", dsn) if err != nil { log.Fatalf("failed creating database client: %v", err) } defer drv.Close() client := NewClient(Driver(drv)) // creating vertices for the direction's edges. // create direction vertex with its edges. d := client.Direction. Create(). SetDescription("string"). SetName("string"). SaveX(ctx) log.Println("direction created:", d) // query edges.
Output:
func (*Direction) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Direction) Update ¶
func (d *Direction) Update() *DirectionUpdateOne
Update returns a builder for updating this Direction. Note that, you need to call Direction.Unwrap() before calling this method, if this Direction was returned from a transaction, and the transaction was committed or rolled back.
type DirectionClient ¶
type DirectionClient struct {
// contains filtered or unexported fields
}
DirectionClient is a client for the Direction schema.
func NewDirectionClient ¶
func NewDirectionClient(c config) *DirectionClient
NewDirectionClient returns a client for the Direction from the given config.
func (*DirectionClient) Create ¶
func (c *DirectionClient) Create() *DirectionCreate
Create returns a create builder for Direction.
func (*DirectionClient) Delete ¶
func (c *DirectionClient) Delete() *DirectionDelete
Delete returns a delete builder for Direction.
func (*DirectionClient) DeleteOne ¶
func (c *DirectionClient) DeleteOne(d *Direction) *DirectionDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*DirectionClient) DeleteOneID ¶
func (c *DirectionClient) DeleteOneID(id int) *DirectionDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*DirectionClient) GetX ¶
func (c *DirectionClient) GetX(ctx context.Context, id int) *Direction
GetX is like Get, but panics if an error occurs.
func (*DirectionClient) Query ¶
func (c *DirectionClient) Query() *DirectionQuery
Create returns a query builder for Direction.
func (*DirectionClient) Update ¶
func (c *DirectionClient) Update() *DirectionUpdate
Update returns an update builder for Direction.
func (*DirectionClient) UpdateOne ¶
func (c *DirectionClient) UpdateOne(d *Direction) *DirectionUpdateOne
UpdateOne returns an update builder for the given entity.
func (*DirectionClient) UpdateOneID ¶
func (c *DirectionClient) UpdateOneID(id int) *DirectionUpdateOne
UpdateOneID returns an update builder for the given id.
type DirectionCreate ¶
type DirectionCreate struct {
// contains filtered or unexported fields
}
DirectionCreate is the builder for creating a Direction entity.
func (*DirectionCreate) Save ¶
func (dc *DirectionCreate) Save(ctx context.Context) (*Direction, error)
Save creates the Direction in the database.
func (*DirectionCreate) SaveX ¶
func (dc *DirectionCreate) SaveX(ctx context.Context) *Direction
SaveX calls Save and panics if Save returns an error.
func (*DirectionCreate) SetDescription ¶
func (dc *DirectionCreate) SetDescription(s string) *DirectionCreate
SetDescription sets the description field.
func (*DirectionCreate) SetName ¶
func (dc *DirectionCreate) SetName(s string) *DirectionCreate
SetName sets the name field.
type DirectionDelete ¶
type DirectionDelete struct {
// contains filtered or unexported fields
}
DirectionDelete is the builder for deleting a Direction entity.
func (*DirectionDelete) Exec ¶
func (dd *DirectionDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*DirectionDelete) ExecX ¶
func (dd *DirectionDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*DirectionDelete) Where ¶
func (dd *DirectionDelete) Where(ps ...predicate.Direction) *DirectionDelete
Where adds a new predicate to the delete builder.
type DirectionDeleteOne ¶
type DirectionDeleteOne struct {
// contains filtered or unexported fields
}
DirectionDeleteOne is the builder for deleting a single Direction entity.
func (*DirectionDeleteOne) Exec ¶
func (ddo *DirectionDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*DirectionDeleteOne) ExecX ¶
func (ddo *DirectionDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type DirectionGroupBy ¶
type DirectionGroupBy struct {
// contains filtered or unexported fields
}
DirectionGroupBy is the builder for group-by Direction entities.
func (*DirectionGroupBy) Aggregate ¶
func (dgb *DirectionGroupBy) Aggregate(fns ...Aggregate) *DirectionGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*DirectionGroupBy) Bools ¶
func (dgb *DirectionGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*DirectionGroupBy) BoolsX ¶
func (dgb *DirectionGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DirectionGroupBy) Float64s ¶
func (dgb *DirectionGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*DirectionGroupBy) Float64sX ¶
func (dgb *DirectionGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DirectionGroupBy) Ints ¶
func (dgb *DirectionGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*DirectionGroupBy) IntsX ¶
func (dgb *DirectionGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DirectionGroupBy) Scan ¶
func (dgb *DirectionGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*DirectionGroupBy) ScanX ¶
func (dgb *DirectionGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type DirectionQuery ¶
type DirectionQuery struct {
// contains filtered or unexported fields
}
DirectionQuery is the builder for querying Direction entities.
func (*DirectionQuery) All ¶
func (dq *DirectionQuery) All(ctx context.Context) ([]*Direction, error)
All executes the query and returns a list of Directions.
func (*DirectionQuery) AllX ¶
func (dq *DirectionQuery) AllX(ctx context.Context) []*Direction
AllX is like All, but panics if an error occurs.
func (*DirectionQuery) Clone ¶
func (dq *DirectionQuery) Clone() *DirectionQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*DirectionQuery) Count ¶
func (dq *DirectionQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*DirectionQuery) CountX ¶
func (dq *DirectionQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*DirectionQuery) Exist ¶
func (dq *DirectionQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*DirectionQuery) ExistX ¶
func (dq *DirectionQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*DirectionQuery) First ¶
func (dq *DirectionQuery) First(ctx context.Context) (*Direction, error)
First returns the first Direction entity in the query. Returns *ErrNotFound when no direction was found.
func (*DirectionQuery) FirstID ¶
func (dq *DirectionQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Direction id in the query. Returns *ErrNotFound when no id was found.
func (*DirectionQuery) FirstX ¶
func (dq *DirectionQuery) FirstX(ctx context.Context) *Direction
FirstX is like First, but panics if an error occurs.
func (*DirectionQuery) FirstXID ¶
func (dq *DirectionQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*DirectionQuery) GroupBy ¶
func (dq *DirectionQuery) GroupBy(field string, fields ...string) *DirectionGroupBy
GroupBy 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 { Description string `json:"description,omitempty"` Count int `json:"count,omitempty"` } client.Direction.Query(). GroupBy(direction.FieldDescription). Aggregate(ent.Count()). Scan(ctx, &v)
func (*DirectionQuery) IDs ¶
func (dq *DirectionQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Direction ids.
func (*DirectionQuery) IDsX ¶
func (dq *DirectionQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*DirectionQuery) Limit ¶
func (dq *DirectionQuery) Limit(limit int) *DirectionQuery
Limit adds a limit step to the query.
func (*DirectionQuery) Offset ¶
func (dq *DirectionQuery) Offset(offset int) *DirectionQuery
Offset adds an offset step to the query.
func (*DirectionQuery) Only ¶
func (dq *DirectionQuery) Only(ctx context.Context) (*Direction, error)
Only returns the only Direction entity in the query, returns an error if not exactly one entity was returned.
func (*DirectionQuery) OnlyID ¶
func (dq *DirectionQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Direction id in the query, returns an error if not exactly one id was returned.
func (*DirectionQuery) OnlyX ¶
func (dq *DirectionQuery) OnlyX(ctx context.Context) *Direction
OnlyX is like Only, but panics if an error occurs.
func (*DirectionQuery) OnlyXID ¶
func (dq *DirectionQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*DirectionQuery) Order ¶
func (dq *DirectionQuery) Order(o ...Order) *DirectionQuery
Order adds an order step to the query.
func (*DirectionQuery) Select ¶
func (dq *DirectionQuery) Select(field string, fields ...string) *DirectionSelect
Select one or more fields from the given query.
Example:
var v []struct { Description string `json:"description,omitempty"` } client.Direction.Query(). Select(direction.FieldDescription). Scan(ctx, &v)
func (*DirectionQuery) Where ¶
func (dq *DirectionQuery) Where(ps ...predicate.Direction) *DirectionQuery
Where adds a new predicate for the builder.
type DirectionSelect ¶
type DirectionSelect struct {
// contains filtered or unexported fields
}
DirectionSelect is the builder for select fields of Direction entities.
func (*DirectionSelect) Bools ¶
func (ds *DirectionSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*DirectionSelect) BoolsX ¶
func (ds *DirectionSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*DirectionSelect) Float64s ¶
func (ds *DirectionSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*DirectionSelect) Float64sX ¶
func (ds *DirectionSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*DirectionSelect) Ints ¶
func (ds *DirectionSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*DirectionSelect) IntsX ¶
func (ds *DirectionSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*DirectionSelect) Scan ¶
func (ds *DirectionSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*DirectionSelect) ScanX ¶
func (ds *DirectionSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type DirectionUpdate ¶
type DirectionUpdate struct {
// contains filtered or unexported fields
}
DirectionUpdate is the builder for updating Direction entities.
func (*DirectionUpdate) Exec ¶
func (du *DirectionUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*DirectionUpdate) ExecX ¶
func (du *DirectionUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DirectionUpdate) Save ¶
func (du *DirectionUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*DirectionUpdate) SaveX ¶
func (du *DirectionUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*DirectionUpdate) SetDescription ¶
func (du *DirectionUpdate) SetDescription(s string) *DirectionUpdate
SetDescription sets the description field.
func (*DirectionUpdate) SetName ¶
func (du *DirectionUpdate) SetName(s string) *DirectionUpdate
SetName sets the name field.
func (*DirectionUpdate) Where ¶
func (du *DirectionUpdate) Where(ps ...predicate.Direction) *DirectionUpdate
Where adds a new predicate for the builder.
type DirectionUpdateOne ¶
type DirectionUpdateOne struct {
// contains filtered or unexported fields
}
DirectionUpdateOne is the builder for updating a single Direction entity.
func (*DirectionUpdateOne) Exec ¶
func (duo *DirectionUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*DirectionUpdateOne) ExecX ¶
func (duo *DirectionUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*DirectionUpdateOne) Save ¶
func (duo *DirectionUpdateOne) Save(ctx context.Context) (*Direction, error)
Save executes the query and returns the updated entity.
func (*DirectionUpdateOne) SaveX ¶
func (duo *DirectionUpdateOne) SaveX(ctx context.Context) *Direction
SaveX is like Save, but panics if an error occurs.
func (*DirectionUpdateOne) SetDescription ¶
func (duo *DirectionUpdateOne) SetDescription(s string) *DirectionUpdateOne
SetDescription sets the description field.
func (*DirectionUpdateOne) SetName ¶
func (duo *DirectionUpdateOne) SetName(s string) *DirectionUpdateOne
SetName sets the name field.
type ErrConstraintFailed ¶
type ErrConstraintFailed struct {
// contains filtered or unexported fields
}
ErrConstraintFailed 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 (ErrConstraintFailed) Error ¶
func (e ErrConstraintFailed) Error() string
Error implements the error interface.
func (*ErrConstraintFailed) Unwrap ¶
func (e *ErrConstraintFailed) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type ErrNotFound ¶
type ErrNotFound struct {
// contains filtered or unexported fields
}
ErrNotFound returns when trying to fetch a specific entity and it was not found in the database.
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string
Error implements the error interface.
type ErrNotSingular ¶
type ErrNotSingular struct {
// contains filtered or unexported fields
}
ErrNotSingular returns when trying to fetch a singular entity and more then one was found in the database.
func (*ErrNotSingular) Error ¶
func (e *ErrNotSingular) Error() string
Error implements the error interface.
type Ingredient ¶
type Ingredient struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // UnitType holds the value of the "unitType" field. UnitType string `json:"unitType,omitempty"` // contains filtered or unexported fields }
Ingredient is the model entity for the Ingredient schema.
Example ¶
if dsn == "" { return } ctx := context.Background() drv, err := sql.Open("mysql", dsn) if err != nil { log.Fatalf("failed creating database client: %v", err) } defer drv.Close() client := NewClient(Driver(drv)) // creating vertices for the ingredient's edges. // create ingredient vertex with its edges. i := client.Ingredient. Create(). SetName("string"). SetUnitType("string"). SaveX(ctx) log.Println("ingredient created:", i) // query edges.
Output:
func (*Ingredient) FromRows ¶
func (i *Ingredient) FromRows(rows *sql.Rows) error
FromRows scans the sql response data into Ingredient.
func (*Ingredient) String ¶
func (i *Ingredient) String() string
String implements the fmt.Stringer.
func (*Ingredient) Unwrap ¶
func (i *Ingredient) Unwrap() *Ingredient
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Ingredient) Update ¶
func (i *Ingredient) Update() *IngredientUpdateOne
Update returns a builder for updating this Ingredient. Note that, you need to call Ingredient.Unwrap() before calling this method, if this Ingredient was returned from a transaction, and the transaction was committed or rolled back.
type IngredientClient ¶
type IngredientClient struct {
// contains filtered or unexported fields
}
IngredientClient is a client for the Ingredient schema.
func NewIngredientClient ¶
func NewIngredientClient(c config) *IngredientClient
NewIngredientClient returns a client for the Ingredient from the given config.
func (*IngredientClient) Create ¶
func (c *IngredientClient) Create() *IngredientCreate
Create returns a create builder for Ingredient.
func (*IngredientClient) Delete ¶
func (c *IngredientClient) Delete() *IngredientDelete
Delete returns a delete builder for Ingredient.
func (*IngredientClient) DeleteOne ¶
func (c *IngredientClient) DeleteOne(i *Ingredient) *IngredientDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*IngredientClient) DeleteOneID ¶
func (c *IngredientClient) DeleteOneID(id int) *IngredientDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*IngredientClient) Get ¶
func (c *IngredientClient) Get(ctx context.Context, id int) (*Ingredient, error)
Get returns a Ingredient entity by its id.
func (*IngredientClient) GetX ¶
func (c *IngredientClient) GetX(ctx context.Context, id int) *Ingredient
GetX is like Get, but panics if an error occurs.
func (*IngredientClient) Query ¶
func (c *IngredientClient) Query() *IngredientQuery
Create returns a query builder for Ingredient.
func (*IngredientClient) Update ¶
func (c *IngredientClient) Update() *IngredientUpdate
Update returns an update builder for Ingredient.
func (*IngredientClient) UpdateOne ¶
func (c *IngredientClient) UpdateOne(i *Ingredient) *IngredientUpdateOne
UpdateOne returns an update builder for the given entity.
func (*IngredientClient) UpdateOneID ¶
func (c *IngredientClient) UpdateOneID(id int) *IngredientUpdateOne
UpdateOneID returns an update builder for the given id.
type IngredientCreate ¶
type IngredientCreate struct {
// contains filtered or unexported fields
}
IngredientCreate is the builder for creating a Ingredient entity.
func (*IngredientCreate) Save ¶
func (ic *IngredientCreate) Save(ctx context.Context) (*Ingredient, error)
Save creates the Ingredient in the database.
func (*IngredientCreate) SaveX ¶
func (ic *IngredientCreate) SaveX(ctx context.Context) *Ingredient
SaveX calls Save and panics if Save returns an error.
func (*IngredientCreate) SetName ¶
func (ic *IngredientCreate) SetName(s string) *IngredientCreate
SetName sets the name field.
func (*IngredientCreate) SetUnitType ¶
func (ic *IngredientCreate) SetUnitType(s string) *IngredientCreate
SetUnitType sets the unitType field.
type IngredientDelete ¶
type IngredientDelete struct {
// contains filtered or unexported fields
}
IngredientDelete is the builder for deleting a Ingredient entity.
func (*IngredientDelete) Exec ¶
func (id *IngredientDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*IngredientDelete) ExecX ¶
func (id *IngredientDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*IngredientDelete) Where ¶
func (id *IngredientDelete) Where(ps ...predicate.Ingredient) *IngredientDelete
Where adds a new predicate to the delete builder.
type IngredientDeleteOne ¶
type IngredientDeleteOne struct {
// contains filtered or unexported fields
}
IngredientDeleteOne is the builder for deleting a single Ingredient entity.
func (*IngredientDeleteOne) Exec ¶
func (ido *IngredientDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*IngredientDeleteOne) ExecX ¶
func (ido *IngredientDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type IngredientGroupBy ¶
type IngredientGroupBy struct {
// contains filtered or unexported fields
}
IngredientGroupBy is the builder for group-by Ingredient entities.
func (*IngredientGroupBy) Aggregate ¶
func (igb *IngredientGroupBy) Aggregate(fns ...Aggregate) *IngredientGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*IngredientGroupBy) Bools ¶
func (igb *IngredientGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*IngredientGroupBy) BoolsX ¶
func (igb *IngredientGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*IngredientGroupBy) Float64s ¶
func (igb *IngredientGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*IngredientGroupBy) Float64sX ¶
func (igb *IngredientGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*IngredientGroupBy) Ints ¶
func (igb *IngredientGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*IngredientGroupBy) IntsX ¶
func (igb *IngredientGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*IngredientGroupBy) Scan ¶
func (igb *IngredientGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*IngredientGroupBy) ScanX ¶
func (igb *IngredientGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type IngredientQuery ¶
type IngredientQuery struct {
// contains filtered or unexported fields
}
IngredientQuery is the builder for querying Ingredient entities.
func (*IngredientQuery) All ¶
func (iq *IngredientQuery) All(ctx context.Context) ([]*Ingredient, error)
All executes the query and returns a list of Ingredients.
func (*IngredientQuery) AllX ¶
func (iq *IngredientQuery) AllX(ctx context.Context) []*Ingredient
AllX is like All, but panics if an error occurs.
func (*IngredientQuery) Clone ¶
func (iq *IngredientQuery) Clone() *IngredientQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*IngredientQuery) Count ¶
func (iq *IngredientQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*IngredientQuery) CountX ¶
func (iq *IngredientQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*IngredientQuery) Exist ¶
func (iq *IngredientQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*IngredientQuery) ExistX ¶
func (iq *IngredientQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*IngredientQuery) First ¶
func (iq *IngredientQuery) First(ctx context.Context) (*Ingredient, error)
First returns the first Ingredient entity in the query. Returns *ErrNotFound when no ingredient was found.
func (*IngredientQuery) FirstID ¶
func (iq *IngredientQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Ingredient id in the query. Returns *ErrNotFound when no id was found.
func (*IngredientQuery) FirstX ¶
func (iq *IngredientQuery) FirstX(ctx context.Context) *Ingredient
FirstX is like First, but panics if an error occurs.
func (*IngredientQuery) FirstXID ¶
func (iq *IngredientQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*IngredientQuery) GroupBy ¶
func (iq *IngredientQuery) GroupBy(field string, fields ...string) *IngredientGroupBy
GroupBy 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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Ingredient.Query(). GroupBy(ingredient.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*IngredientQuery) IDs ¶
func (iq *IngredientQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Ingredient ids.
func (*IngredientQuery) IDsX ¶
func (iq *IngredientQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*IngredientQuery) Limit ¶
func (iq *IngredientQuery) Limit(limit int) *IngredientQuery
Limit adds a limit step to the query.
func (*IngredientQuery) Offset ¶
func (iq *IngredientQuery) Offset(offset int) *IngredientQuery
Offset adds an offset step to the query.
func (*IngredientQuery) Only ¶
func (iq *IngredientQuery) Only(ctx context.Context) (*Ingredient, error)
Only returns the only Ingredient entity in the query, returns an error if not exactly one entity was returned.
func (*IngredientQuery) OnlyID ¶
func (iq *IngredientQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Ingredient id in the query, returns an error if not exactly one id was returned.
func (*IngredientQuery) OnlyX ¶
func (iq *IngredientQuery) OnlyX(ctx context.Context) *Ingredient
OnlyX is like Only, but panics if an error occurs.
func (*IngredientQuery) OnlyXID ¶
func (iq *IngredientQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*IngredientQuery) Order ¶
func (iq *IngredientQuery) Order(o ...Order) *IngredientQuery
Order adds an order step to the query.
func (*IngredientQuery) Select ¶
func (iq *IngredientQuery) Select(field string, fields ...string) *IngredientSelect
Select one or more fields from the given query.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Ingredient.Query(). Select(ingredient.FieldName). Scan(ctx, &v)
func (*IngredientQuery) Where ¶
func (iq *IngredientQuery) Where(ps ...predicate.Ingredient) *IngredientQuery
Where adds a new predicate for the builder.
type IngredientSelect ¶
type IngredientSelect struct {
// contains filtered or unexported fields
}
IngredientSelect is the builder for select fields of Ingredient entities.
func (*IngredientSelect) Bools ¶
func (is *IngredientSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*IngredientSelect) BoolsX ¶
func (is *IngredientSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*IngredientSelect) Float64s ¶
func (is *IngredientSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*IngredientSelect) Float64sX ¶
func (is *IngredientSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*IngredientSelect) Ints ¶
func (is *IngredientSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*IngredientSelect) IntsX ¶
func (is *IngredientSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*IngredientSelect) Scan ¶
func (is *IngredientSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*IngredientSelect) ScanX ¶
func (is *IngredientSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type IngredientUpdate ¶
type IngredientUpdate struct {
// contains filtered or unexported fields
}
IngredientUpdate is the builder for updating Ingredient entities.
func (*IngredientUpdate) Exec ¶
func (iu *IngredientUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*IngredientUpdate) ExecX ¶
func (iu *IngredientUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*IngredientUpdate) Save ¶
func (iu *IngredientUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*IngredientUpdate) SaveX ¶
func (iu *IngredientUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*IngredientUpdate) SetName ¶
func (iu *IngredientUpdate) SetName(s string) *IngredientUpdate
SetName sets the name field.
func (*IngredientUpdate) SetUnitType ¶
func (iu *IngredientUpdate) SetUnitType(s string) *IngredientUpdate
SetUnitType sets the unitType field.
func (*IngredientUpdate) Where ¶
func (iu *IngredientUpdate) Where(ps ...predicate.Ingredient) *IngredientUpdate
Where adds a new predicate for the builder.
type IngredientUpdateOne ¶
type IngredientUpdateOne struct {
// contains filtered or unexported fields
}
IngredientUpdateOne is the builder for updating a single Ingredient entity.
func (*IngredientUpdateOne) Exec ¶
func (iuo *IngredientUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*IngredientUpdateOne) ExecX ¶
func (iuo *IngredientUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*IngredientUpdateOne) Save ¶
func (iuo *IngredientUpdateOne) Save(ctx context.Context) (*Ingredient, error)
Save executes the query and returns the updated entity.
func (*IngredientUpdateOne) SaveX ¶
func (iuo *IngredientUpdateOne) SaveX(ctx context.Context) *Ingredient
SaveX is like Save, but panics if an error occurs.
func (*IngredientUpdateOne) SetName ¶
func (iuo *IngredientUpdateOne) SetName(s string) *IngredientUpdateOne
SetName sets the name field.
func (*IngredientUpdateOne) SetUnitType ¶
func (iuo *IngredientUpdateOne) SetUnitType(s string) *IngredientUpdateOne
SetUnitType sets the unitType field.
type Receipt ¶
type Receipt struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Portions holds the value of the "portions" field. Portions int `json:"portions,omitempty"` // contains filtered or unexported fields }
Receipt is the model entity for the Receipt schema.
Example ¶
if dsn == "" { return } ctx := context.Background() drv, err := sql.Open("mysql", dsn) if err != nil { log.Fatalf("failed creating database client: %v", err) } defer drv.Close() client := NewClient(Driver(drv)) // creating vertices for the receipt's edges. i0 := client.Ingredient. Create(). SetName("string"). SetUnitType("string"). SaveX(ctx) log.Println("ingredient created:", i0) d1 := client.Direction. Create(). SetDescription("string"). SetName("string"). SaveX(ctx) log.Println("direction created:", d1) // create receipt vertex with its edges. r := client.Receipt. Create(). SetName("string"). SetPortions(1). AddIngredients(i0). AddDirections(d1). SaveX(ctx) log.Println("receipt created:", r) // query edges. i0, err = r.QueryIngredients().First(ctx) if err != nil { log.Fatalf("failed querying ingredients: %v", err) } log.Println("ingredients found:", i0) d1, err = r.QueryDirections().First(ctx) if err != nil { log.Fatalf("failed querying directions: %v", err) } log.Println("directions found:", d1)
Output:
func (*Receipt) QueryDirections ¶
func (r *Receipt) QueryDirections() *DirectionQuery
QueryDirections queries the directions edge of the Receipt.
func (*Receipt) QueryIngredients ¶
func (r *Receipt) QueryIngredients() *IngredientQuery
QueryIngredients queries the ingredients edge of the Receipt.
func (*Receipt) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*Receipt) Update ¶
func (r *Receipt) Update() *ReceiptUpdateOne
Update returns a builder for updating this Receipt. Note that, you need to call Receipt.Unwrap() before calling this method, if this Receipt was returned from a transaction, and the transaction was committed or rolled back.
type ReceiptClient ¶
type ReceiptClient struct {
// contains filtered or unexported fields
}
ReceiptClient is a client for the Receipt schema.
func NewReceiptClient ¶
func NewReceiptClient(c config) *ReceiptClient
NewReceiptClient returns a client for the Receipt from the given config.
func (*ReceiptClient) Create ¶
func (c *ReceiptClient) Create() *ReceiptCreate
Create returns a create builder for Receipt.
func (*ReceiptClient) Delete ¶
func (c *ReceiptClient) Delete() *ReceiptDelete
Delete returns a delete builder for Receipt.
func (*ReceiptClient) DeleteOne ¶
func (c *ReceiptClient) DeleteOne(r *Receipt) *ReceiptDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*ReceiptClient) DeleteOneID ¶
func (c *ReceiptClient) DeleteOneID(id int) *ReceiptDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*ReceiptClient) GetX ¶
func (c *ReceiptClient) GetX(ctx context.Context, id int) *Receipt
GetX is like Get, but panics if an error occurs.
func (*ReceiptClient) Query ¶
func (c *ReceiptClient) Query() *ReceiptQuery
Create returns a query builder for Receipt.
func (*ReceiptClient) QueryDirections ¶
func (c *ReceiptClient) QueryDirections(r *Receipt) *DirectionQuery
QueryDirections queries the directions edge of a Receipt.
func (*ReceiptClient) QueryIngredients ¶
func (c *ReceiptClient) QueryIngredients(r *Receipt) *IngredientQuery
QueryIngredients queries the ingredients edge of a Receipt.
func (*ReceiptClient) Update ¶
func (c *ReceiptClient) Update() *ReceiptUpdate
Update returns an update builder for Receipt.
func (*ReceiptClient) UpdateOne ¶
func (c *ReceiptClient) UpdateOne(r *Receipt) *ReceiptUpdateOne
UpdateOne returns an update builder for the given entity.
func (*ReceiptClient) UpdateOneID ¶
func (c *ReceiptClient) UpdateOneID(id int) *ReceiptUpdateOne
UpdateOneID returns an update builder for the given id.
type ReceiptCreate ¶
type ReceiptCreate struct {
// contains filtered or unexported fields
}
ReceiptCreate is the builder for creating a Receipt entity.
func (*ReceiptCreate) AddDirectionIDs ¶
func (rc *ReceiptCreate) AddDirectionIDs(ids ...int) *ReceiptCreate
AddDirectionIDs adds the directions edge to Direction by ids.
func (*ReceiptCreate) AddDirections ¶
func (rc *ReceiptCreate) AddDirections(d ...*Direction) *ReceiptCreate
AddDirections adds the directions edges to Direction.
func (*ReceiptCreate) AddIngredientIDs ¶
func (rc *ReceiptCreate) AddIngredientIDs(ids ...int) *ReceiptCreate
AddIngredientIDs adds the ingredients edge to Ingredient by ids.
func (*ReceiptCreate) AddIngredients ¶
func (rc *ReceiptCreate) AddIngredients(i ...*Ingredient) *ReceiptCreate
AddIngredients adds the ingredients edges to Ingredient.
func (*ReceiptCreate) Save ¶
func (rc *ReceiptCreate) Save(ctx context.Context) (*Receipt, error)
Save creates the Receipt in the database.
func (*ReceiptCreate) SaveX ¶
func (rc *ReceiptCreate) SaveX(ctx context.Context) *Receipt
SaveX calls Save and panics if Save returns an error.
func (*ReceiptCreate) SetName ¶
func (rc *ReceiptCreate) SetName(s string) *ReceiptCreate
SetName sets the name field.
func (*ReceiptCreate) SetPortions ¶
func (rc *ReceiptCreate) SetPortions(i int) *ReceiptCreate
SetPortions sets the portions field.
type ReceiptDelete ¶
type ReceiptDelete struct {
// contains filtered or unexported fields
}
ReceiptDelete is the builder for deleting a Receipt entity.
func (*ReceiptDelete) Exec ¶
func (rd *ReceiptDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*ReceiptDelete) ExecX ¶
func (rd *ReceiptDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*ReceiptDelete) Where ¶
func (rd *ReceiptDelete) Where(ps ...predicate.Receipt) *ReceiptDelete
Where adds a new predicate to the delete builder.
type ReceiptDeleteOne ¶
type ReceiptDeleteOne struct {
// contains filtered or unexported fields
}
ReceiptDeleteOne is the builder for deleting a single Receipt entity.
func (*ReceiptDeleteOne) Exec ¶
func (rdo *ReceiptDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*ReceiptDeleteOne) ExecX ¶
func (rdo *ReceiptDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type ReceiptGroupBy ¶
type ReceiptGroupBy struct {
// contains filtered or unexported fields
}
ReceiptGroupBy is the builder for group-by Receipt entities.
func (*ReceiptGroupBy) Aggregate ¶
func (rgb *ReceiptGroupBy) Aggregate(fns ...Aggregate) *ReceiptGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*ReceiptGroupBy) Bools ¶
func (rgb *ReceiptGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*ReceiptGroupBy) BoolsX ¶
func (rgb *ReceiptGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ReceiptGroupBy) Float64s ¶
func (rgb *ReceiptGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*ReceiptGroupBy) Float64sX ¶
func (rgb *ReceiptGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ReceiptGroupBy) Ints ¶
func (rgb *ReceiptGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*ReceiptGroupBy) IntsX ¶
func (rgb *ReceiptGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ReceiptGroupBy) Scan ¶
func (rgb *ReceiptGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*ReceiptGroupBy) ScanX ¶
func (rgb *ReceiptGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ReceiptQuery ¶
type ReceiptQuery struct {
// contains filtered or unexported fields
}
ReceiptQuery is the builder for querying Receipt entities.
func (*ReceiptQuery) All ¶
func (rq *ReceiptQuery) All(ctx context.Context) ([]*Receipt, error)
All executes the query and returns a list of Receipts.
func (*ReceiptQuery) AllX ¶
func (rq *ReceiptQuery) AllX(ctx context.Context) []*Receipt
AllX is like All, but panics if an error occurs.
func (*ReceiptQuery) Clone ¶
func (rq *ReceiptQuery) Clone() *ReceiptQuery
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*ReceiptQuery) Count ¶
func (rq *ReceiptQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*ReceiptQuery) CountX ¶
func (rq *ReceiptQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*ReceiptQuery) Exist ¶
func (rq *ReceiptQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*ReceiptQuery) ExistX ¶
func (rq *ReceiptQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*ReceiptQuery) First ¶
func (rq *ReceiptQuery) First(ctx context.Context) (*Receipt, error)
First returns the first Receipt entity in the query. Returns *ErrNotFound when no receipt was found.
func (*ReceiptQuery) FirstID ¶
func (rq *ReceiptQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Receipt id in the query. Returns *ErrNotFound when no id was found.
func (*ReceiptQuery) FirstX ¶
func (rq *ReceiptQuery) FirstX(ctx context.Context) *Receipt
FirstX is like First, but panics if an error occurs.
func (*ReceiptQuery) FirstXID ¶
func (rq *ReceiptQuery) FirstXID(ctx context.Context) int
FirstXID is like FirstID, but panics if an error occurs.
func (*ReceiptQuery) GroupBy ¶
func (rq *ReceiptQuery) GroupBy(field string, fields ...string) *ReceiptGroupBy
GroupBy 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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Receipt.Query(). GroupBy(receipt.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*ReceiptQuery) IDs ¶
func (rq *ReceiptQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Receipt ids.
func (*ReceiptQuery) IDsX ¶
func (rq *ReceiptQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*ReceiptQuery) Limit ¶
func (rq *ReceiptQuery) Limit(limit int) *ReceiptQuery
Limit adds a limit step to the query.
func (*ReceiptQuery) Offset ¶
func (rq *ReceiptQuery) Offset(offset int) *ReceiptQuery
Offset adds an offset step to the query.
func (*ReceiptQuery) Only ¶
func (rq *ReceiptQuery) Only(ctx context.Context) (*Receipt, error)
Only returns the only Receipt entity in the query, returns an error if not exactly one entity was returned.
func (*ReceiptQuery) OnlyID ¶
func (rq *ReceiptQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID returns the only Receipt id in the query, returns an error if not exactly one id was returned.
func (*ReceiptQuery) OnlyX ¶
func (rq *ReceiptQuery) OnlyX(ctx context.Context) *Receipt
OnlyX is like Only, but panics if an error occurs.
func (*ReceiptQuery) OnlyXID ¶
func (rq *ReceiptQuery) OnlyXID(ctx context.Context) int
OnlyXID is like OnlyID, but panics if an error occurs.
func (*ReceiptQuery) Order ¶
func (rq *ReceiptQuery) Order(o ...Order) *ReceiptQuery
Order adds an order step to the query.
func (*ReceiptQuery) QueryDirections ¶
func (rq *ReceiptQuery) QueryDirections() *DirectionQuery
QueryDirections chains the current query on the directions edge.
func (*ReceiptQuery) QueryIngredients ¶
func (rq *ReceiptQuery) QueryIngredients() *IngredientQuery
QueryIngredients chains the current query on the ingredients edge.
func (*ReceiptQuery) Select ¶
func (rq *ReceiptQuery) Select(field string, fields ...string) *ReceiptSelect
Select one or more fields from the given query.
Example:
var v []struct { Name string `json:"name,omitempty"` } client.Receipt.Query(). Select(receipt.FieldName). Scan(ctx, &v)
func (*ReceiptQuery) Where ¶
func (rq *ReceiptQuery) Where(ps ...predicate.Receipt) *ReceiptQuery
Where adds a new predicate for the builder.
type ReceiptSelect ¶
type ReceiptSelect struct {
// contains filtered or unexported fields
}
ReceiptSelect is the builder for select fields of Receipt entities.
func (*ReceiptSelect) Bools ¶
func (rs *ReceiptSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*ReceiptSelect) BoolsX ¶
func (rs *ReceiptSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*ReceiptSelect) Float64s ¶
func (rs *ReceiptSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*ReceiptSelect) Float64sX ¶
func (rs *ReceiptSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*ReceiptSelect) Ints ¶
func (rs *ReceiptSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*ReceiptSelect) IntsX ¶
func (rs *ReceiptSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*ReceiptSelect) Scan ¶
func (rs *ReceiptSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*ReceiptSelect) ScanX ¶
func (rs *ReceiptSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type ReceiptUpdate ¶
type ReceiptUpdate struct {
// contains filtered or unexported fields
}
ReceiptUpdate is the builder for updating Receipt entities.
func (*ReceiptUpdate) AddDirectionIDs ¶
func (ru *ReceiptUpdate) AddDirectionIDs(ids ...int) *ReceiptUpdate
AddDirectionIDs adds the directions edge to Direction by ids.
func (*ReceiptUpdate) AddDirections ¶
func (ru *ReceiptUpdate) AddDirections(d ...*Direction) *ReceiptUpdate
AddDirections adds the directions edges to Direction.
func (*ReceiptUpdate) AddIngredientIDs ¶
func (ru *ReceiptUpdate) AddIngredientIDs(ids ...int) *ReceiptUpdate
AddIngredientIDs adds the ingredients edge to Ingredient by ids.
func (*ReceiptUpdate) AddIngredients ¶
func (ru *ReceiptUpdate) AddIngredients(i ...*Ingredient) *ReceiptUpdate
AddIngredients adds the ingredients edges to Ingredient.
func (*ReceiptUpdate) AddPortions ¶
func (ru *ReceiptUpdate) AddPortions(i int) *ReceiptUpdate
AddPortions adds i to portions.
func (*ReceiptUpdate) Exec ¶
func (ru *ReceiptUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*ReceiptUpdate) ExecX ¶
func (ru *ReceiptUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ReceiptUpdate) RemoveDirectionIDs ¶
func (ru *ReceiptUpdate) RemoveDirectionIDs(ids ...int) *ReceiptUpdate
RemoveDirectionIDs removes the directions edge to Direction by ids.
func (*ReceiptUpdate) RemoveDirections ¶
func (ru *ReceiptUpdate) RemoveDirections(d ...*Direction) *ReceiptUpdate
RemoveDirections removes directions edges to Direction.
func (*ReceiptUpdate) RemoveIngredientIDs ¶
func (ru *ReceiptUpdate) RemoveIngredientIDs(ids ...int) *ReceiptUpdate
RemoveIngredientIDs removes the ingredients edge to Ingredient by ids.
func (*ReceiptUpdate) RemoveIngredients ¶
func (ru *ReceiptUpdate) RemoveIngredients(i ...*Ingredient) *ReceiptUpdate
RemoveIngredients removes ingredients edges to Ingredient.
func (*ReceiptUpdate) Save ¶
func (ru *ReceiptUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*ReceiptUpdate) SaveX ¶
func (ru *ReceiptUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*ReceiptUpdate) SetName ¶
func (ru *ReceiptUpdate) SetName(s string) *ReceiptUpdate
SetName sets the name field.
func (*ReceiptUpdate) SetPortions ¶
func (ru *ReceiptUpdate) SetPortions(i int) *ReceiptUpdate
SetPortions sets the portions field.
func (*ReceiptUpdate) Where ¶
func (ru *ReceiptUpdate) Where(ps ...predicate.Receipt) *ReceiptUpdate
Where adds a new predicate for the builder.
type ReceiptUpdateOne ¶
type ReceiptUpdateOne struct {
// contains filtered or unexported fields
}
ReceiptUpdateOne is the builder for updating a single Receipt entity.
func (*ReceiptUpdateOne) AddDirectionIDs ¶
func (ruo *ReceiptUpdateOne) AddDirectionIDs(ids ...int) *ReceiptUpdateOne
AddDirectionIDs adds the directions edge to Direction by ids.
func (*ReceiptUpdateOne) AddDirections ¶
func (ruo *ReceiptUpdateOne) AddDirections(d ...*Direction) *ReceiptUpdateOne
AddDirections adds the directions edges to Direction.
func (*ReceiptUpdateOne) AddIngredientIDs ¶
func (ruo *ReceiptUpdateOne) AddIngredientIDs(ids ...int) *ReceiptUpdateOne
AddIngredientIDs adds the ingredients edge to Ingredient by ids.
func (*ReceiptUpdateOne) AddIngredients ¶
func (ruo *ReceiptUpdateOne) AddIngredients(i ...*Ingredient) *ReceiptUpdateOne
AddIngredients adds the ingredients edges to Ingredient.
func (*ReceiptUpdateOne) AddPortions ¶
func (ruo *ReceiptUpdateOne) AddPortions(i int) *ReceiptUpdateOne
AddPortions adds i to portions.
func (*ReceiptUpdateOne) Exec ¶
func (ruo *ReceiptUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*ReceiptUpdateOne) ExecX ¶
func (ruo *ReceiptUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*ReceiptUpdateOne) RemoveDirectionIDs ¶
func (ruo *ReceiptUpdateOne) RemoveDirectionIDs(ids ...int) *ReceiptUpdateOne
RemoveDirectionIDs removes the directions edge to Direction by ids.
func (*ReceiptUpdateOne) RemoveDirections ¶
func (ruo *ReceiptUpdateOne) RemoveDirections(d ...*Direction) *ReceiptUpdateOne
RemoveDirections removes directions edges to Direction.
func (*ReceiptUpdateOne) RemoveIngredientIDs ¶
func (ruo *ReceiptUpdateOne) RemoveIngredientIDs(ids ...int) *ReceiptUpdateOne
RemoveIngredientIDs removes the ingredients edge to Ingredient by ids.
func (*ReceiptUpdateOne) RemoveIngredients ¶
func (ruo *ReceiptUpdateOne) RemoveIngredients(i ...*Ingredient) *ReceiptUpdateOne
RemoveIngredients removes ingredients edges to Ingredient.
func (*ReceiptUpdateOne) Save ¶
func (ruo *ReceiptUpdateOne) Save(ctx context.Context) (*Receipt, error)
Save executes the query and returns the updated entity.
func (*ReceiptUpdateOne) SaveX ¶
func (ruo *ReceiptUpdateOne) SaveX(ctx context.Context) *Receipt
SaveX is like Save, but panics if an error occurs.
func (*ReceiptUpdateOne) SetName ¶
func (ruo *ReceiptUpdateOne) SetName(s string) *ReceiptUpdateOne
SetName sets the name field.
func (*ReceiptUpdateOne) SetPortions ¶
func (ruo *ReceiptUpdateOne) SetPortions(i int) *ReceiptUpdateOne
SetPortions sets the portions field.
type Tx ¶
type Tx struct { // Direction is the client for interacting with the Direction builders. Direction *DirectionClient // Ingredient is the client for interacting with the Ingredient builders. Ingredient *IngredientClient // Receipt is the client for interacting with the Receipt builders. Receipt *ReceiptClient // User is the client for interacting with the User builders. User *UserClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
type User ¶
type User struct { // ID of the ent. ID int `json:"id,omitempty"` // contains filtered or unexported fields }
User is the model entity for the User schema.
Example ¶
if dsn == "" { return } ctx := context.Background() drv, err := sql.Open("mysql", dsn) if err != nil { log.Fatalf("failed creating database client: %v", err) } defer drv.Close() client := NewClient(Driver(drv)) // creating vertices for the user's edges. // create user vertex with its edges. u := client.User. Create(). SaveX(ctx) log.Println("user created:", u) // query edges.
Output:
func (*User) Unwrap ¶
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that, you need to call User.Unwrap() before calling this method, if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a create builder for User.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a delete builder for the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*UserClient) GetX ¶
func (c *UserClient) GetX(ctx context.Context, id int) *User
GetX is like Get, but panics if an error occurs.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Create returns a query builder for User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
type UserDelete ¶
type UserDelete struct {
// contains filtered or unexported fields
}
UserDelete is the builder for deleting a User entity.
func (*UserDelete) Exec ¶
func (ud *UserDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*UserDelete) ExecX ¶
func (ud *UserDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*UserDelete) Where ¶
func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete
Where adds a new predicate to the delete builder.
type UserDeleteOne ¶
type UserDeleteOne struct {
// contains filtered or unexported fields
}
UserDeleteOne is the builder for deleting a single User entity.
func (*UserDeleteOne) Exec ¶
func (udo *UserDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*UserDeleteOne) ExecX ¶
func (udo *UserDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the builder for group-by User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...Aggregate) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bools ¶
func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) BoolsX ¶
func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserGroupBy) Float64s ¶
func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) Float64sX ¶
func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserGroupBy) Ints ¶
func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from group-by. It is only allowed when querying group-by with one field.
func (*UserGroupBy) IntsX ¶
func (ugb *UserGroupBy) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserGroupBy) Scan ¶
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error
Scan applies the group-by query and scan the result into the given value.
func (*UserGroupBy) ScanX ¶
func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is the builder for querying User entities.
func (*UserQuery) Clone ¶
Clone returns a duplicate of the query builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*UserQuery) First ¶
First returns the first User entity in the query. Returns *ErrNotFound when no user was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User id in the query. Returns *ErrNotFound when no id was found.
func (*UserQuery) GroupBy ¶
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
GroupBy used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.
func (*UserQuery) Only ¶
Only returns the only User entity in the query, returns an error if not exactly one entity was returned.
func (*UserQuery) OnlyID ¶
OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.
type UserSelect ¶
type UserSelect struct {
// contains filtered or unexported fields
}
UserSelect is the builder for select fields of User entities.
func (*UserSelect) Bools ¶
func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)
Bools returns list of bools from selector. It is only allowed when selecting one field.
func (*UserSelect) BoolsX ¶
func (us *UserSelect) BoolsX(ctx context.Context) []bool
BoolsX is like Bools, but panics if an error occurs.
func (*UserSelect) Float64s ¶
func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)
Float64s returns list of float64s from selector. It is only allowed when selecting one field.
func (*UserSelect) Float64sX ¶
func (us *UserSelect) Float64sX(ctx context.Context) []float64
Float64sX is like Float64s, but panics if an error occurs.
func (*UserSelect) Ints ¶
func (us *UserSelect) Ints(ctx context.Context) ([]int, error)
Ints returns list of ints from selector. It is only allowed when selecting one field.
func (*UserSelect) IntsX ¶
func (us *UserSelect) IntsX(ctx context.Context) []int
IntsX is like Ints, but panics if an error occurs.
func (*UserSelect) Scan ¶
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error
Scan applies the selector query and scan the result into the given value.
func (*UserSelect) ScanX ¶
func (us *UserSelect) ScanX(ctx context.Context, v interface{})
ScanX is like Scan, but panics if an error occurs.
type UserUpdate ¶
type UserUpdate struct {
// contains filtered or unexported fields
}
UserUpdate is the builder for updating User entities.
func (*UserUpdate) Exec ¶
func (uu *UserUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*UserUpdate) ExecX ¶
func (uu *UserUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*UserUpdate) Save ¶
func (uu *UserUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of rows/vertices matched by this operation.
func (*UserUpdate) SaveX ¶
func (uu *UserUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where adds a new predicate for the builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) Exec ¶
func (uuo *UserUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*UserUpdateOne) ExecX ¶
func (uuo *UserUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
Source Files ¶
- client.go
- config.go
- context.go
- direction.go
- direction_create.go
- direction_delete.go
- direction_query.go
- direction_update.go
- ent.go
- ingredient.go
- ingredient_create.go
- ingredient_delete.go
- ingredient_query.go
- ingredient_update.go
- receipt.go
- receipt_create.go
- receipt_delete.go
- receipt_query.go
- receipt_update.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go