ent

package
v0.0.0-...-9819f5b Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConstraintFailure

func IsConstraintFailure(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks nor found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

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

func As(fn Aggregate, end string) Aggregate

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() Aggregate

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

func Max

func Max(field string) Aggregate

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

func Mean

func Mean(field string) Aggregate

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

func Min

func Min(field string) Aggregate

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

func Sum

func Sum(field string) Aggregate

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

func FromContext(ctx context.Context) *Client

FromContext returns the Client stored in a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a 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.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Direction.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional 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) FromRows

func (d *Direction) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Direction.

func (*Direction) String

func (d *Direction) String() string

String implements the fmt.Stringer.

func (*Direction) Unwrap

func (d *Direction) Unwrap() *Direction

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

func (c *DirectionClient) Get(ctx context.Context, id int) (*Direction, error)

Get returns a Direction entity by its 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

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.

func (*DirectionGroupBy) Strings

func (dgb *DirectionGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*DirectionGroupBy) StringsX

func (dgb *DirectionGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

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.

func (*DirectionSelect) Strings

func (ds *DirectionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DirectionSelect) StringsX

func (ds *DirectionSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

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 Directions

type Directions []*Direction

Directions is a parsable slice of Direction.

func (*Directions) FromRows

func (d *Directions) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Directions.

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

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

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

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.

func (*IngredientGroupBy) Strings

func (igb *IngredientGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*IngredientGroupBy) StringsX

func (igb *IngredientGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

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.

func (*IngredientSelect) Strings

func (is *IngredientSelect) Strings(ctx context.Context) ([]string, error)

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

func (*IngredientSelect) StringsX

func (is *IngredientSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, 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

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

SetName sets the name field.

func (*IngredientUpdateOne) SetUnitType

func (iuo *IngredientUpdateOne) SetUnitType(s string) *IngredientUpdateOne

SetUnitType sets the unitType field.

type Ingredients

type Ingredients []*Ingredient

Ingredients is a parsable slice of Ingredient.

func (*Ingredients) FromRows

func (i *Ingredients) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Ingredients.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type Order

type Order func(*sql.Selector)

Order applies an ordering on either graph traversal or sql selector.

func Asc

func Asc(fields ...string) Order

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) Order

Desc applies the given fields in DESC order.

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

func (r *Receipt) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Receipt.

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

func (r *Receipt) String() string

String implements the fmt.Stringer.

func (*Receipt) Unwrap

func (r *Receipt) Unwrap() *Receipt

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

func (c *ReceiptClient) Get(ctx context.Context, id int) (*Receipt, error)

Get returns a Receipt entity by its 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.

func (*ReceiptGroupBy) Strings

func (rgb *ReceiptGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*ReceiptGroupBy) StringsX

func (rgb *ReceiptGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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.

func (*ReceiptSelect) Strings

func (rs *ReceiptSelect) Strings(ctx context.Context) ([]string, error)

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

func (*ReceiptSelect) StringsX

func (rs *ReceiptSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, 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 Receipts

type Receipts []*Receipt

Receipts is a parsable slice of Receipt.

func (*Receipts) FromRows

func (r *Receipts) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Receipts.

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().

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

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

func (u *User) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into User.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its 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.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

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.

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when querying group-by with one field.

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, 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) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity in the query. Returns *ErrNotFound when no user was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User id in the query. Returns *ErrNotFound when no id was found.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) FirstXID

func (uq *UserQuery) FirstXID(ctx context.Context) int

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

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

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of User ids.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns the only User entity in the query, returns an error if not exactly one entity was returned.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID returns the only User id in the query, returns an error if not exactly one id was returned.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) OnlyXID

func (uq *UserQuery) OnlyXID(ctx context.Context) int

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...Order) *UserQuery

Order adds an order step to the query.

func (*UserQuery) Select

func (uq *UserQuery) Select(field string, fields ...string) *UserSelect

Select one or more fields from the given query.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the builder.

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.

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

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

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, 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.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

type Users

type Users []*User

Users is a parsable slice of User.

func (*Users) FromRows

func (u *Users) FromRows(rows *sql.Rows) error

FromRows scans the sql response data into Users.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL