ent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeCategory         = "Category"
	TypeIngredient       = "Ingredient"
	TypeRecipe           = "Recipe"
	TypeRecipeIngredient = "RecipeIngredient"
	TypeStep             = "Step"
	TypeUser             = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError 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 IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Categories

type Categories []*Category

Categories is a parsable slice of Category.

type Category

type Category struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CategoryQuery when eager-loading is set.
	Edges CategoryEdges `json:"edges"`
	// contains filtered or unexported fields
}

Category is the model entity for the Category schema.

func (*Category) QueryRecipe

func (c *Category) QueryRecipe() *RecipeQuery

QueryRecipe queries the "recipe" edge of the Category entity.

func (*Category) String

func (c *Category) String() string

String implements the fmt.Stringer.

func (*Category) Unwrap

func (c *Category) Unwrap() *Category

Unwrap unwraps the Category entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Category) Update

func (c *Category) Update() *CategoryUpdateOne

Update returns a builder for updating this Category. Note that you need to call Category.Unwrap() before calling this method if this Category was returned from a transaction, and the transaction was committed or rolled back.

type CategoryClient

type CategoryClient struct {
	// contains filtered or unexported fields
}

CategoryClient is a client for the Category schema.

func NewCategoryClient

func NewCategoryClient(c config) *CategoryClient

NewCategoryClient returns a client for the Category from the given config.

func (*CategoryClient) Create

func (c *CategoryClient) Create() *CategoryCreate

Create returns a create builder for Category.

func (*CategoryClient) CreateBulk

func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk

CreateBulk returns a builder for creating a bulk of Category entities.

func (*CategoryClient) Delete

func (c *CategoryClient) Delete() *CategoryDelete

Delete returns a delete builder for Category.

func (*CategoryClient) DeleteOne

func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CategoryClient) DeleteOneID

func (c *CategoryClient) DeleteOneID(id int) *CategoryDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CategoryClient) Get

func (c *CategoryClient) Get(ctx context.Context, id int) (*Category, error)

Get returns a Category entity by its id.

func (*CategoryClient) GetX

func (c *CategoryClient) GetX(ctx context.Context, id int) *Category

GetX is like Get, but panics if an error occurs.

func (*CategoryClient) Hooks

func (c *CategoryClient) Hooks() []Hook

Hooks returns the client hooks.

func (*CategoryClient) Query

func (c *CategoryClient) Query() *CategoryQuery

Query returns a query builder for Category.

func (*CategoryClient) QueryRecipe

func (c *CategoryClient) QueryRecipe(ca *Category) *RecipeQuery

QueryRecipe queries the recipe edge of a Category.

func (*CategoryClient) Update

func (c *CategoryClient) Update() *CategoryUpdate

Update returns an update builder for Category.

func (*CategoryClient) UpdateOne

func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CategoryClient) UpdateOneID

func (c *CategoryClient) UpdateOneID(id int) *CategoryUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CategoryClient) Use

func (c *CategoryClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `category.Hooks(f(g(h())))`.

type CategoryCreate

type CategoryCreate struct {
	// contains filtered or unexported fields
}

CategoryCreate is the builder for creating a Category entity.

func (*CategoryCreate) AddRecipe

func (cc *CategoryCreate) AddRecipe(r ...*Recipe) *CategoryCreate

AddRecipe adds the "recipe" edges to the Recipe entity.

func (*CategoryCreate) AddRecipeIDs

func (cc *CategoryCreate) AddRecipeIDs(ids ...int) *CategoryCreate

AddRecipeIDs adds the "recipe" edge to the Recipe entity by IDs.

func (*CategoryCreate) Exec

func (cc *CategoryCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryCreate) ExecX

func (cc *CategoryCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CategoryCreate) Mutation

func (cc *CategoryCreate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryCreate) Save

func (cc *CategoryCreate) Save(ctx context.Context) (*Category, error)

Save creates the Category in the database.

func (*CategoryCreate) SaveX

func (cc *CategoryCreate) SaveX(ctx context.Context) *Category

SaveX calls Save and panics if Save returns an error.

func (*CategoryCreate) SetName

func (cc *CategoryCreate) SetName(s string) *CategoryCreate

SetName sets the "name" field.

type CategoryCreateBulk

type CategoryCreateBulk struct {
	// contains filtered or unexported fields
}

CategoryCreateBulk is the builder for creating many Category entities in bulk.

func (*CategoryCreateBulk) Exec

func (ccb *CategoryCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryCreateBulk) ExecX

func (ccb *CategoryCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CategoryCreateBulk) Save

func (ccb *CategoryCreateBulk) Save(ctx context.Context) ([]*Category, error)

Save creates the Category entities in the database.

func (*CategoryCreateBulk) SaveX

func (ccb *CategoryCreateBulk) SaveX(ctx context.Context) []*Category

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

type CategoryDelete

type CategoryDelete struct {
	// contains filtered or unexported fields
}

CategoryDelete is the builder for deleting a Category entity.

func (*CategoryDelete) Exec

func (cd *CategoryDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*CategoryDelete) ExecX

func (cd *CategoryDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*CategoryDelete) Where

func (cd *CategoryDelete) Where(ps ...predicate.Category) *CategoryDelete

Where appends a list predicates to the CategoryDelete builder.

type CategoryDeleteOne

type CategoryDeleteOne struct {
	// contains filtered or unexported fields
}

CategoryDeleteOne is the builder for deleting a single Category entity.

func (*CategoryDeleteOne) Exec

func (cdo *CategoryDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*CategoryDeleteOne) ExecX

func (cdo *CategoryDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type CategoryEdges

type CategoryEdges struct {
	// Recipe holds the value of the recipe edge.
	Recipe []*Recipe `json:"recipe,omitempty"`
	// contains filtered or unexported fields
}

CategoryEdges holds the relations/edges for other nodes in the graph.

func (CategoryEdges) RecipeOrErr

func (e CategoryEdges) RecipeOrErr() ([]*Recipe, error)

RecipeOrErr returns the Recipe value or an error if the edge was not loaded in eager-loading.

type CategoryGroupBy

type CategoryGroupBy struct {
	// contains filtered or unexported fields
}

CategoryGroupBy is the group-by builder for Category entities.

func (*CategoryGroupBy) Aggregate

func (cgb *CategoryGroupBy) Aggregate(fns ...AggregateFunc) *CategoryGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*CategoryGroupBy) Bool

func (cgb *CategoryGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) BoolX

func (cgb *CategoryGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CategoryGroupBy) Bools

func (cgb *CategoryGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) BoolsX

func (cgb *CategoryGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CategoryGroupBy) Float64

func (cgb *CategoryGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) Float64X

func (cgb *CategoryGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CategoryGroupBy) Float64s

func (cgb *CategoryGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) Float64sX

func (cgb *CategoryGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CategoryGroupBy) Int

func (cgb *CategoryGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) IntX

func (cgb *CategoryGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CategoryGroupBy) Ints

func (cgb *CategoryGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) IntsX

func (cgb *CategoryGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CategoryGroupBy) Scan

func (cgb *CategoryGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*CategoryGroupBy) ScanX

func (cgb *CategoryGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CategoryGroupBy) String

func (cgb *CategoryGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CategoryGroupBy) StringX

func (cgb *CategoryGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CategoryGroupBy) Strings

func (cgb *CategoryGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CategoryGroupBy) StringsX

func (cgb *CategoryGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CategoryMutation

type CategoryMutation struct {
	// contains filtered or unexported fields
}

CategoryMutation represents an operation that mutates the Category nodes in the graph.

func (*CategoryMutation) AddField

func (m *CategoryMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*CategoryMutation) AddRecipeIDs

func (m *CategoryMutation) AddRecipeIDs(ids ...int)

AddRecipeIDs adds the "recipe" edge to the Recipe entity by ids.

func (*CategoryMutation) AddedEdges

func (m *CategoryMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*CategoryMutation) AddedField

func (m *CategoryMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*CategoryMutation) AddedFields

func (m *CategoryMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*CategoryMutation) AddedIDs

func (m *CategoryMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*CategoryMutation) ClearEdge

func (m *CategoryMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*CategoryMutation) ClearField

func (m *CategoryMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*CategoryMutation) ClearRecipe

func (m *CategoryMutation) ClearRecipe()

ClearRecipe clears the "recipe" edge to the Recipe entity.

func (*CategoryMutation) ClearedEdges

func (m *CategoryMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*CategoryMutation) ClearedFields

func (m *CategoryMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (CategoryMutation) Client

func (m CategoryMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*CategoryMutation) EdgeCleared

func (m *CategoryMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*CategoryMutation) Field

func (m *CategoryMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*CategoryMutation) FieldCleared

func (m *CategoryMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*CategoryMutation) Fields

func (m *CategoryMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*CategoryMutation) ID

func (m *CategoryMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*CategoryMutation) Name

func (m *CategoryMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*CategoryMutation) OldField

func (m *CategoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*CategoryMutation) OldName

func (m *CategoryMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Category entity. If the Category object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*CategoryMutation) Op

func (m *CategoryMutation) Op() Op

Op returns the operation name.

func (*CategoryMutation) RecipeCleared

func (m *CategoryMutation) RecipeCleared() bool

RecipeCleared reports if the "recipe" edge to the Recipe entity was cleared.

func (*CategoryMutation) RecipeIDs

func (m *CategoryMutation) RecipeIDs() (ids []int)

RecipeIDs returns the "recipe" edge IDs in the mutation.

func (*CategoryMutation) RemoveRecipeIDs

func (m *CategoryMutation) RemoveRecipeIDs(ids ...int)

RemoveRecipeIDs removes the "recipe" edge to the Recipe entity by IDs.

func (*CategoryMutation) RemovedEdges

func (m *CategoryMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*CategoryMutation) RemovedIDs

func (m *CategoryMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*CategoryMutation) RemovedRecipeIDs

func (m *CategoryMutation) RemovedRecipeIDs() (ids []int)

RemovedRecipe returns the removed IDs of the "recipe" edge to the Recipe entity.

func (*CategoryMutation) ResetEdge

func (m *CategoryMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*CategoryMutation) ResetField

func (m *CategoryMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*CategoryMutation) ResetName

func (m *CategoryMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CategoryMutation) ResetRecipe

func (m *CategoryMutation) ResetRecipe()

ResetRecipe resets all changes to the "recipe" edge.

func (*CategoryMutation) SetField

func (m *CategoryMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*CategoryMutation) SetName

func (m *CategoryMutation) SetName(s string)

SetName sets the "name" field.

func (CategoryMutation) Tx

func (m CategoryMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*CategoryMutation) Type

func (m *CategoryMutation) Type() string

Type returns the node type of this mutation (Category).

func (*CategoryMutation) Where

func (m *CategoryMutation) Where(ps ...predicate.Category)

Where appends a list predicates to the CategoryMutation builder.

type CategoryQuery

type CategoryQuery struct {
	// contains filtered or unexported fields
}

CategoryQuery is the builder for querying Category entities.

func (*CategoryQuery) All

func (cq *CategoryQuery) All(ctx context.Context) ([]*Category, error)

All executes the query and returns a list of Categories.

func (*CategoryQuery) AllX

func (cq *CategoryQuery) AllX(ctx context.Context) []*Category

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

func (*CategoryQuery) Clone

func (cq *CategoryQuery) Clone() *CategoryQuery

Clone returns a duplicate of the CategoryQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*CategoryQuery) Count

func (cq *CategoryQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*CategoryQuery) CountX

func (cq *CategoryQuery) CountX(ctx context.Context) int

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

func (*CategoryQuery) Exist

func (cq *CategoryQuery) Exist(ctx context.Context) (bool, error)

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

func (*CategoryQuery) ExistX

func (cq *CategoryQuery) ExistX(ctx context.Context) bool

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

func (*CategoryQuery) First

func (cq *CategoryQuery) First(ctx context.Context) (*Category, error)

First returns the first Category entity from the query. Returns a *NotFoundError when no Category was found.

func (*CategoryQuery) FirstID

func (cq *CategoryQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Category ID from the query. Returns a *NotFoundError when no Category ID was found.

func (*CategoryQuery) FirstIDX

func (cq *CategoryQuery) FirstIDX(ctx context.Context) int

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

func (*CategoryQuery) FirstX

func (cq *CategoryQuery) FirstX(ctx context.Context) *Category

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

func (*CategoryQuery) GroupBy

func (cq *CategoryQuery) GroupBy(field string, fields ...string) *CategoryGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Category.Query().
	GroupBy(category.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CategoryQuery) IDs

func (cq *CategoryQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Category IDs.

func (*CategoryQuery) IDsX

func (cq *CategoryQuery) IDsX(ctx context.Context) []int

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

func (*CategoryQuery) Limit

func (cq *CategoryQuery) Limit(limit int) *CategoryQuery

Limit adds a limit step to the query.

func (*CategoryQuery) Offset

func (cq *CategoryQuery) Offset(offset int) *CategoryQuery

Offset adds an offset step to the query.

func (*CategoryQuery) Only

func (cq *CategoryQuery) Only(ctx context.Context) (*Category, error)

Only returns a single Category entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Category entity is not found. Returns a *NotFoundError when no Category entities are found.

func (*CategoryQuery) OnlyID

func (cq *CategoryQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Category ID in the query. Returns a *NotSingularError when exactly one Category ID is not found. Returns a *NotFoundError when no entities are found.

func (*CategoryQuery) OnlyIDX

func (cq *CategoryQuery) OnlyIDX(ctx context.Context) int

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

func (*CategoryQuery) OnlyX

func (cq *CategoryQuery) OnlyX(ctx context.Context) *Category

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

func (*CategoryQuery) Order

func (cq *CategoryQuery) Order(o ...OrderFunc) *CategoryQuery

Order adds an order step to the query.

func (*CategoryQuery) QueryRecipe

func (cq *CategoryQuery) QueryRecipe() *RecipeQuery

QueryRecipe chains the current query on the "recipe" edge.

func (*CategoryQuery) Select

func (cq *CategoryQuery) Select(fields ...string) *CategorySelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Category.Query().
	Select(category.FieldName).
	Scan(ctx, &v)

func (*CategoryQuery) Unique

func (cq *CategoryQuery) Unique(unique bool) *CategoryQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*CategoryQuery) Where

func (cq *CategoryQuery) Where(ps ...predicate.Category) *CategoryQuery

Where adds a new predicate for the CategoryQuery builder.

func (*CategoryQuery) WithRecipe

func (cq *CategoryQuery) WithRecipe(opts ...func(*RecipeQuery)) *CategoryQuery

WithRecipe tells the query-builder to eager-load the nodes that are connected to the "recipe" edge. The optional arguments are used to configure the query builder of the edge.

type CategorySelect

type CategorySelect struct {
	*CategoryQuery
	// contains filtered or unexported fields
}

CategorySelect is the builder for selecting fields of Category entities.

func (*CategorySelect) Bool

func (cs *CategorySelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*CategorySelect) BoolX

func (cs *CategorySelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*CategorySelect) Bools

func (cs *CategorySelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*CategorySelect) BoolsX

func (cs *CategorySelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*CategorySelect) Float64

func (cs *CategorySelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*CategorySelect) Float64X

func (cs *CategorySelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*CategorySelect) Float64s

func (cs *CategorySelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*CategorySelect) Float64sX

func (cs *CategorySelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*CategorySelect) Int

func (cs *CategorySelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*CategorySelect) IntX

func (cs *CategorySelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*CategorySelect) Ints

func (cs *CategorySelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*CategorySelect) IntsX

func (cs *CategorySelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*CategorySelect) Scan

func (cs *CategorySelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*CategorySelect) ScanX

func (cs *CategorySelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*CategorySelect) String

func (cs *CategorySelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*CategorySelect) StringX

func (cs *CategorySelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*CategorySelect) Strings

func (cs *CategorySelect) Strings(ctx context.Context) ([]string, error)

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

func (*CategorySelect) StringsX

func (cs *CategorySelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type CategoryUpdate

type CategoryUpdate struct {
	// contains filtered or unexported fields
}

CategoryUpdate is the builder for updating Category entities.

func (*CategoryUpdate) AddRecipe

func (cu *CategoryUpdate) AddRecipe(r ...*Recipe) *CategoryUpdate

AddRecipe adds the "recipe" edges to the Recipe entity.

func (*CategoryUpdate) AddRecipeIDs

func (cu *CategoryUpdate) AddRecipeIDs(ids ...int) *CategoryUpdate

AddRecipeIDs adds the "recipe" edge to the Recipe entity by IDs.

func (*CategoryUpdate) ClearRecipe

func (cu *CategoryUpdate) ClearRecipe() *CategoryUpdate

ClearRecipe clears all "recipe" edges to the Recipe entity.

func (*CategoryUpdate) Exec

func (cu *CategoryUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*CategoryUpdate) ExecX

func (cu *CategoryUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CategoryUpdate) Mutation

func (cu *CategoryUpdate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdate) RemoveRecipe

func (cu *CategoryUpdate) RemoveRecipe(r ...*Recipe) *CategoryUpdate

RemoveRecipe removes "recipe" edges to Recipe entities.

func (*CategoryUpdate) RemoveRecipeIDs

func (cu *CategoryUpdate) RemoveRecipeIDs(ids ...int) *CategoryUpdate

RemoveRecipeIDs removes the "recipe" edge to Recipe entities by IDs.

func (*CategoryUpdate) Save

func (cu *CategoryUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*CategoryUpdate) SaveX

func (cu *CategoryUpdate) SaveX(ctx context.Context) int

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

func (*CategoryUpdate) SetName

func (cu *CategoryUpdate) SetName(s string) *CategoryUpdate

SetName sets the "name" field.

func (*CategoryUpdate) Where

func (cu *CategoryUpdate) Where(ps ...predicate.Category) *CategoryUpdate

Where appends a list predicates to the CategoryUpdate builder.

type CategoryUpdateOne

type CategoryUpdateOne struct {
	// contains filtered or unexported fields
}

CategoryUpdateOne is the builder for updating a single Category entity.

func (*CategoryUpdateOne) AddRecipe

func (cuo *CategoryUpdateOne) AddRecipe(r ...*Recipe) *CategoryUpdateOne

AddRecipe adds the "recipe" edges to the Recipe entity.

func (*CategoryUpdateOne) AddRecipeIDs

func (cuo *CategoryUpdateOne) AddRecipeIDs(ids ...int) *CategoryUpdateOne

AddRecipeIDs adds the "recipe" edge to the Recipe entity by IDs.

func (*CategoryUpdateOne) ClearRecipe

func (cuo *CategoryUpdateOne) ClearRecipe() *CategoryUpdateOne

ClearRecipe clears all "recipe" edges to the Recipe entity.

func (*CategoryUpdateOne) Exec

func (cuo *CategoryUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*CategoryUpdateOne) ExecX

func (cuo *CategoryUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*CategoryUpdateOne) Mutation

func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdateOne) RemoveRecipe

func (cuo *CategoryUpdateOne) RemoveRecipe(r ...*Recipe) *CategoryUpdateOne

RemoveRecipe removes "recipe" edges to Recipe entities.

func (*CategoryUpdateOne) RemoveRecipeIDs

func (cuo *CategoryUpdateOne) RemoveRecipeIDs(ids ...int) *CategoryUpdateOne

RemoveRecipeIDs removes the "recipe" edge to Recipe entities by IDs.

func (*CategoryUpdateOne) Save

func (cuo *CategoryUpdateOne) Save(ctx context.Context) (*Category, error)

Save executes the query and returns the updated Category entity.

func (*CategoryUpdateOne) SaveX

func (cuo *CategoryUpdateOne) SaveX(ctx context.Context) *Category

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

func (*CategoryUpdateOne) Select

func (cuo *CategoryUpdateOne) Select(field string, fields ...string) *CategoryUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*CategoryUpdateOne) SetName

func (cuo *CategoryUpdateOne) SetName(s string) *CategoryUpdateOne

SetName sets the "name" field.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Ingredient is the client for interacting with the Ingredient builders.
	Ingredient *IngredientClient
	// Recipe is the client for interacting with the Recipe builders.
	Recipe *RecipeClient
	// RecipeIngredient is the client for interacting with the RecipeIngredient builders.
	RecipeIngredient *RecipeIngredientClient
	// Step is the client for interacting with the Step builders.
	Step *StepClient
	// 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 a Client stored inside 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 database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

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().
	Category.
	Query().
	Count(ctx)

func (*Client) Tx

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

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Committer method.

type ConstraintError

type ConstraintError struct {
	// contains filtered or unexported fields
}

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

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"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the IngredientQuery when eager-loading is set.
	Edges IngredientEdges `json:"edges"`
	// contains filtered or unexported fields
}

Ingredient is the model entity for the Ingredient schema.

func (*Ingredient) QueryRecipeIngredients

func (i *Ingredient) QueryRecipeIngredients() *RecipeIngredientQuery

QueryRecipeIngredients queries the "recipe_ingredients" edge of the Ingredient entity.

func (*Ingredient) String

func (i *Ingredient) String() string

String implements the fmt.Stringer.

func (*Ingredient) Unwrap

func (i *Ingredient) Unwrap() *Ingredient

Unwrap unwraps the Ingredient entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*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) CreateBulk

func (c *IngredientClient) CreateBulk(builders ...*IngredientCreate) *IngredientCreateBulk

CreateBulk returns a builder for creating a bulk of Ingredient entities.

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

func (c *IngredientClient) Hooks() []Hook

Hooks returns the client hooks.

func (*IngredientClient) Query

func (c *IngredientClient) Query() *IngredientQuery

Query returns a query builder for Ingredient.

func (*IngredientClient) QueryRecipeIngredients

func (c *IngredientClient) QueryRecipeIngredients(i *Ingredient) *RecipeIngredientQuery

QueryRecipeIngredients queries the recipe_ingredients edge of a 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.

func (*IngredientClient) Use

func (c *IngredientClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `ingredient.Hooks(f(g(h())))`.

type IngredientCreate

type IngredientCreate struct {
	// contains filtered or unexported fields
}

IngredientCreate is the builder for creating a Ingredient entity.

func (*IngredientCreate) AddRecipeIngredientIDs

func (ic *IngredientCreate) AddRecipeIngredientIDs(ids ...int) *IngredientCreate

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*IngredientCreate) AddRecipeIngredients

func (ic *IngredientCreate) AddRecipeIngredients(r ...*RecipeIngredient) *IngredientCreate

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*IngredientCreate) Exec

func (ic *IngredientCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*IngredientCreate) ExecX

func (ic *IngredientCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*IngredientCreate) Mutation

func (ic *IngredientCreate) Mutation() *IngredientMutation

Mutation returns the IngredientMutation object of the builder.

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.

type IngredientCreateBulk

type IngredientCreateBulk struct {
	// contains filtered or unexported fields
}

IngredientCreateBulk is the builder for creating many Ingredient entities in bulk.

func (*IngredientCreateBulk) Exec

func (icb *IngredientCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*IngredientCreateBulk) ExecX

func (icb *IngredientCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*IngredientCreateBulk) Save

func (icb *IngredientCreateBulk) Save(ctx context.Context) ([]*Ingredient, error)

Save creates the Ingredient entities in the database.

func (*IngredientCreateBulk) SaveX

func (icb *IngredientCreateBulk) SaveX(ctx context.Context) []*Ingredient

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

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 appends a list predicates to the IngredientDelete 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 IngredientEdges

type IngredientEdges struct {
	// RecipeIngredients holds the value of the recipe_ingredients edge.
	RecipeIngredients []*RecipeIngredient `json:"recipe_ingredients,omitempty"`
	// contains filtered or unexported fields
}

IngredientEdges holds the relations/edges for other nodes in the graph.

func (IngredientEdges) RecipeIngredientsOrErr

func (e IngredientEdges) RecipeIngredientsOrErr() ([]*RecipeIngredient, error)

RecipeIngredientsOrErr returns the RecipeIngredients value or an error if the edge was not loaded in eager-loading.

type IngredientGroupBy

type IngredientGroupBy struct {
	// contains filtered or unexported fields
}

IngredientGroupBy is the group-by builder for Ingredient entities.

func (*IngredientGroupBy) Aggregate

func (igb *IngredientGroupBy) Aggregate(fns ...AggregateFunc) *IngredientGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*IngredientGroupBy) Bool

func (igb *IngredientGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*IngredientGroupBy) BoolX

func (igb *IngredientGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

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 executing a group-by query 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) Float64

func (igb *IngredientGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*IngredientGroupBy) Float64X

func (igb *IngredientGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, 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 executing a group-by query 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) Int

func (igb *IngredientGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*IngredientGroupBy) IntX

func (igb *IngredientGroupBy) IntX(ctx context.Context) int

IntX is like Int, 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 executing a group-by query 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 scans 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) String

func (igb *IngredientGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*IngredientGroupBy) StringX

func (igb *IngredientGroupBy) StringX(ctx context.Context) string

StringX is like String, 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 executing a group-by query 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 IngredientMutation

type IngredientMutation struct {
	// contains filtered or unexported fields
}

IngredientMutation represents an operation that mutates the Ingredient nodes in the graph.

func (*IngredientMutation) AddField

func (m *IngredientMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*IngredientMutation) AddRecipeIngredientIDs

func (m *IngredientMutation) AddRecipeIngredientIDs(ids ...int)

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by ids.

func (*IngredientMutation) AddedEdges

func (m *IngredientMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*IngredientMutation) AddedField

func (m *IngredientMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*IngredientMutation) AddedFields

func (m *IngredientMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*IngredientMutation) AddedIDs

func (m *IngredientMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*IngredientMutation) ClearEdge

func (m *IngredientMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*IngredientMutation) ClearField

func (m *IngredientMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*IngredientMutation) ClearRecipeIngredients

func (m *IngredientMutation) ClearRecipeIngredients()

ClearRecipeIngredients clears the "recipe_ingredients" edge to the RecipeIngredient entity.

func (*IngredientMutation) ClearedEdges

func (m *IngredientMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*IngredientMutation) ClearedFields

func (m *IngredientMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (IngredientMutation) Client

func (m IngredientMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*IngredientMutation) EdgeCleared

func (m *IngredientMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*IngredientMutation) Field

func (m *IngredientMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*IngredientMutation) FieldCleared

func (m *IngredientMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*IngredientMutation) Fields

func (m *IngredientMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*IngredientMutation) ID

func (m *IngredientMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*IngredientMutation) Name

func (m *IngredientMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*IngredientMutation) OldField

func (m *IngredientMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*IngredientMutation) OldName

func (m *IngredientMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Ingredient entity. If the Ingredient object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*IngredientMutation) Op

func (m *IngredientMutation) Op() Op

Op returns the operation name.

func (*IngredientMutation) RecipeIngredientsCleared

func (m *IngredientMutation) RecipeIngredientsCleared() bool

RecipeIngredientsCleared reports if the "recipe_ingredients" edge to the RecipeIngredient entity was cleared.

func (*IngredientMutation) RecipeIngredientsIDs

func (m *IngredientMutation) RecipeIngredientsIDs() (ids []int)

RecipeIngredientsIDs returns the "recipe_ingredients" edge IDs in the mutation.

func (*IngredientMutation) RemoveRecipeIngredientIDs

func (m *IngredientMutation) RemoveRecipeIngredientIDs(ids ...int)

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*IngredientMutation) RemovedEdges

func (m *IngredientMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*IngredientMutation) RemovedIDs

func (m *IngredientMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*IngredientMutation) RemovedRecipeIngredientsIDs

func (m *IngredientMutation) RemovedRecipeIngredientsIDs() (ids []int)

RemovedRecipeIngredients returns the removed IDs of the "recipe_ingredients" edge to the RecipeIngredient entity.

func (*IngredientMutation) ResetEdge

func (m *IngredientMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*IngredientMutation) ResetField

func (m *IngredientMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*IngredientMutation) ResetName

func (m *IngredientMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*IngredientMutation) ResetRecipeIngredients

func (m *IngredientMutation) ResetRecipeIngredients()

ResetRecipeIngredients resets all changes to the "recipe_ingredients" edge.

func (*IngredientMutation) SetField

func (m *IngredientMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*IngredientMutation) SetName

func (m *IngredientMutation) SetName(s string)

SetName sets the "name" field.

func (IngredientMutation) Tx

func (m IngredientMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*IngredientMutation) Type

func (m *IngredientMutation) Type() string

Type returns the node type of this mutation (Ingredient).

func (*IngredientMutation) Where

func (m *IngredientMutation) Where(ps ...predicate.Ingredient)

Where appends a list predicates to the IngredientMutation builder.

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 IngredientQuery 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 from the query. Returns a *NotFoundError 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 from the query. Returns a *NotFoundError when no Ingredient ID was found.

func (*IngredientQuery) FirstIDX

func (iq *IngredientQuery) FirstIDX(ctx context.Context) int

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

func (*IngredientQuery) FirstX

func (iq *IngredientQuery) FirstX(ctx context.Context) *Ingredient

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

func (*IngredientQuery) GroupBy

func (iq *IngredientQuery) GroupBy(field string, fields ...string) *IngredientGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	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 a single Ingredient entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Ingredient entity is not found. Returns a *NotFoundError when no Ingredient entities are found.

func (*IngredientQuery) OnlyID

func (iq *IngredientQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Ingredient ID in the query. Returns a *NotSingularError when exactly one Ingredient ID is not found. Returns a *NotFoundError when no entities are found.

func (*IngredientQuery) OnlyIDX

func (iq *IngredientQuery) OnlyIDX(ctx context.Context) int

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

func (*IngredientQuery) OnlyX

func (iq *IngredientQuery) OnlyX(ctx context.Context) *Ingredient

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

func (*IngredientQuery) Order

func (iq *IngredientQuery) Order(o ...OrderFunc) *IngredientQuery

Order adds an order step to the query.

func (*IngredientQuery) QueryRecipeIngredients

func (iq *IngredientQuery) QueryRecipeIngredients() *RecipeIngredientQuery

QueryRecipeIngredients chains the current query on the "recipe_ingredients" edge.

func (*IngredientQuery) Select

func (iq *IngredientQuery) Select(fields ...string) *IngredientSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Ingredient.Query().
	Select(ingredient.FieldName).
	Scan(ctx, &v)

func (*IngredientQuery) Unique

func (iq *IngredientQuery) Unique(unique bool) *IngredientQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*IngredientQuery) Where

Where adds a new predicate for the IngredientQuery builder.

func (*IngredientQuery) WithRecipeIngredients

func (iq *IngredientQuery) WithRecipeIngredients(opts ...func(*RecipeIngredientQuery)) *IngredientQuery

WithRecipeIngredients tells the query-builder to eager-load the nodes that are connected to the "recipe_ingredients" edge. The optional arguments are used to configure the query builder of the edge.

type IngredientSelect

type IngredientSelect struct {
	*IngredientQuery
	// contains filtered or unexported fields
}

IngredientSelect is the builder for selecting fields of Ingredient entities.

func (*IngredientSelect) Bool

func (is *IngredientSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*IngredientSelect) BoolX

func (is *IngredientSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*IngredientSelect) Bools

func (is *IngredientSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a 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) Float64

func (is *IngredientSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*IngredientSelect) Float64X

func (is *IngredientSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*IngredientSelect) Float64s

func (is *IngredientSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a 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) Int

func (is *IngredientSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*IngredientSelect) IntX

func (is *IngredientSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*IngredientSelect) Ints

func (is *IngredientSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a 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 scans 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) String

func (is *IngredientSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*IngredientSelect) StringX

func (is *IngredientSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*IngredientSelect) Strings

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

Strings returns list of strings from a 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) AddRecipeIngredientIDs

func (iu *IngredientUpdate) AddRecipeIngredientIDs(ids ...int) *IngredientUpdate

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*IngredientUpdate) AddRecipeIngredients

func (iu *IngredientUpdate) AddRecipeIngredients(r ...*RecipeIngredient) *IngredientUpdate

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*IngredientUpdate) ClearRecipeIngredients

func (iu *IngredientUpdate) ClearRecipeIngredients() *IngredientUpdate

ClearRecipeIngredients clears all "recipe_ingredients" edges to the RecipeIngredient entity.

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

func (iu *IngredientUpdate) Mutation() *IngredientMutation

Mutation returns the IngredientMutation object of the builder.

func (*IngredientUpdate) RemoveRecipeIngredientIDs

func (iu *IngredientUpdate) RemoveRecipeIngredientIDs(ids ...int) *IngredientUpdate

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to RecipeIngredient entities by IDs.

func (*IngredientUpdate) RemoveRecipeIngredients

func (iu *IngredientUpdate) RemoveRecipeIngredients(r ...*RecipeIngredient) *IngredientUpdate

RemoveRecipeIngredients removes "recipe_ingredients" edges to RecipeIngredient entities.

func (*IngredientUpdate) Save

func (iu *IngredientUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update 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) Where

Where appends a list predicates to the IngredientUpdate builder.

type IngredientUpdateOne

type IngredientUpdateOne struct {
	// contains filtered or unexported fields
}

IngredientUpdateOne is the builder for updating a single Ingredient entity.

func (*IngredientUpdateOne) AddRecipeIngredientIDs

func (iuo *IngredientUpdateOne) AddRecipeIngredientIDs(ids ...int) *IngredientUpdateOne

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*IngredientUpdateOne) AddRecipeIngredients

func (iuo *IngredientUpdateOne) AddRecipeIngredients(r ...*RecipeIngredient) *IngredientUpdateOne

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*IngredientUpdateOne) ClearRecipeIngredients

func (iuo *IngredientUpdateOne) ClearRecipeIngredients() *IngredientUpdateOne

ClearRecipeIngredients clears all "recipe_ingredients" edges to the RecipeIngredient 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) Mutation

func (iuo *IngredientUpdateOne) Mutation() *IngredientMutation

Mutation returns the IngredientMutation object of the builder.

func (*IngredientUpdateOne) RemoveRecipeIngredientIDs

func (iuo *IngredientUpdateOne) RemoveRecipeIngredientIDs(ids ...int) *IngredientUpdateOne

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to RecipeIngredient entities by IDs.

func (*IngredientUpdateOne) RemoveRecipeIngredients

func (iuo *IngredientUpdateOne) RemoveRecipeIngredients(r ...*RecipeIngredient) *IngredientUpdateOne

RemoveRecipeIngredients removes "recipe_ingredients" edges to RecipeIngredient entities.

func (*IngredientUpdateOne) Save

func (iuo *IngredientUpdateOne) Save(ctx context.Context) (*Ingredient, error)

Save executes the query and returns the updated Ingredient entity.

func (*IngredientUpdateOne) SaveX

func (iuo *IngredientUpdateOne) SaveX(ctx context.Context) *Ingredient

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

func (*IngredientUpdateOne) Select

func (iuo *IngredientUpdateOne) Select(field string, fields ...string) *IngredientUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*IngredientUpdateOne) SetName

SetName sets the "name" field.

type Ingredients

type Ingredients []*Ingredient

Ingredients is a parsable slice of Ingredient.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

type NotLoadedError struct {
	// contains filtered or unexported fields
}

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

type NotSingularError struct {
	// contains filtered or unexported fields
}

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

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 OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type Recipe

type Recipe struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Servings holds the value of the "servings" field.
	Servings int `json:"servings,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RecipeQuery when eager-loading is set.
	Edges RecipeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Recipe is the model entity for the Recipe schema.

func (*Recipe) QueryAuthor

func (r *Recipe) QueryAuthor() *UserQuery

QueryAuthor queries the "author" edge of the Recipe entity.

func (*Recipe) QueryRecipeIngredients

func (r *Recipe) QueryRecipeIngredients() *RecipeIngredientQuery

QueryRecipeIngredients queries the "recipe_ingredients" edge of the Recipe entity.

func (*Recipe) QuerySteps

func (r *Recipe) QuerySteps() *StepQuery

QuerySteps queries the "steps" edge of the Recipe entity.

func (*Recipe) QueryTags

func (r *Recipe) QueryTags() *CategoryQuery

QueryTags queries the "tags" edge of the Recipe entity.

func (*Recipe) String

func (r *Recipe) String() string

String implements the fmt.Stringer.

func (*Recipe) Unwrap

func (r *Recipe) Unwrap() *Recipe

Unwrap unwraps the Recipe entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Recipe) Update

func (r *Recipe) Update() *RecipeUpdateOne

Update returns a builder for updating this Recipe. Note that you need to call Recipe.Unwrap() before calling this method if this Recipe was returned from a transaction, and the transaction was committed or rolled back.

type RecipeClient

type RecipeClient struct {
	// contains filtered or unexported fields
}

RecipeClient is a client for the Recipe schema.

func NewRecipeClient

func NewRecipeClient(c config) *RecipeClient

NewRecipeClient returns a client for the Recipe from the given config.

func (*RecipeClient) Create

func (c *RecipeClient) Create() *RecipeCreate

Create returns a create builder for Recipe.

func (*RecipeClient) CreateBulk

func (c *RecipeClient) CreateBulk(builders ...*RecipeCreate) *RecipeCreateBulk

CreateBulk returns a builder for creating a bulk of Recipe entities.

func (*RecipeClient) Delete

func (c *RecipeClient) Delete() *RecipeDelete

Delete returns a delete builder for Recipe.

func (*RecipeClient) DeleteOne

func (c *RecipeClient) DeleteOne(r *Recipe) *RecipeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*RecipeClient) DeleteOneID

func (c *RecipeClient) DeleteOneID(id int) *RecipeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RecipeClient) Get

func (c *RecipeClient) Get(ctx context.Context, id int) (*Recipe, error)

Get returns a Recipe entity by its id.

func (*RecipeClient) GetX

func (c *RecipeClient) GetX(ctx context.Context, id int) *Recipe

GetX is like Get, but panics if an error occurs.

func (*RecipeClient) Hooks

func (c *RecipeClient) Hooks() []Hook

Hooks returns the client hooks.

func (*RecipeClient) Query

func (c *RecipeClient) Query() *RecipeQuery

Query returns a query builder for Recipe.

func (*RecipeClient) QueryAuthor

func (c *RecipeClient) QueryAuthor(r *Recipe) *UserQuery

QueryAuthor queries the author edge of a Recipe.

func (*RecipeClient) QueryRecipeIngredients

func (c *RecipeClient) QueryRecipeIngredients(r *Recipe) *RecipeIngredientQuery

QueryRecipeIngredients queries the recipe_ingredients edge of a Recipe.

func (*RecipeClient) QuerySteps

func (c *RecipeClient) QuerySteps(r *Recipe) *StepQuery

QuerySteps queries the steps edge of a Recipe.

func (*RecipeClient) QueryTags

func (c *RecipeClient) QueryTags(r *Recipe) *CategoryQuery

QueryTags queries the tags edge of a Recipe.

func (*RecipeClient) Update

func (c *RecipeClient) Update() *RecipeUpdate

Update returns an update builder for Recipe.

func (*RecipeClient) UpdateOne

func (c *RecipeClient) UpdateOne(r *Recipe) *RecipeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RecipeClient) UpdateOneID

func (c *RecipeClient) UpdateOneID(id int) *RecipeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RecipeClient) Use

func (c *RecipeClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `recipe.Hooks(f(g(h())))`.

type RecipeCreate

type RecipeCreate struct {
	// contains filtered or unexported fields
}

RecipeCreate is the builder for creating a Recipe entity.

func (*RecipeCreate) AddRecipeIngredientIDs

func (rc *RecipeCreate) AddRecipeIngredientIDs(ids ...int) *RecipeCreate

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*RecipeCreate) AddRecipeIngredients

func (rc *RecipeCreate) AddRecipeIngredients(r ...*RecipeIngredient) *RecipeCreate

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*RecipeCreate) AddStepIDs

func (rc *RecipeCreate) AddStepIDs(ids ...int) *RecipeCreate

AddStepIDs adds the "steps" edge to the Step entity by IDs.

func (*RecipeCreate) AddSteps

func (rc *RecipeCreate) AddSteps(s ...*Step) *RecipeCreate

AddSteps adds the "steps" edges to the Step entity.

func (*RecipeCreate) AddTagIDs

func (rc *RecipeCreate) AddTagIDs(ids ...int) *RecipeCreate

AddTagIDs adds the "tags" edge to the Category entity by IDs.

func (*RecipeCreate) AddTags

func (rc *RecipeCreate) AddTags(c ...*Category) *RecipeCreate

AddTags adds the "tags" edges to the Category entity.

func (*RecipeCreate) Exec

func (rc *RecipeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipeCreate) ExecX

func (rc *RecipeCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeCreate) Mutation

func (rc *RecipeCreate) Mutation() *RecipeMutation

Mutation returns the RecipeMutation object of the builder.

func (*RecipeCreate) Save

func (rc *RecipeCreate) Save(ctx context.Context) (*Recipe, error)

Save creates the Recipe in the database.

func (*RecipeCreate) SaveX

func (rc *RecipeCreate) SaveX(ctx context.Context) *Recipe

SaveX calls Save and panics if Save returns an error.

func (*RecipeCreate) SetAuthor

func (rc *RecipeCreate) SetAuthor(u *User) *RecipeCreate

SetAuthor sets the "author" edge to the User entity.

func (*RecipeCreate) SetAuthorID

func (rc *RecipeCreate) SetAuthorID(id int) *RecipeCreate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*RecipeCreate) SetName

func (rc *RecipeCreate) SetName(s string) *RecipeCreate

SetName sets the "name" field.

func (*RecipeCreate) SetNillableAuthorID

func (rc *RecipeCreate) SetNillableAuthorID(id *int) *RecipeCreate

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

func (*RecipeCreate) SetServings

func (rc *RecipeCreate) SetServings(i int) *RecipeCreate

SetServings sets the "servings" field.

type RecipeCreateBulk

type RecipeCreateBulk struct {
	// contains filtered or unexported fields
}

RecipeCreateBulk is the builder for creating many Recipe entities in bulk.

func (*RecipeCreateBulk) Exec

func (rcb *RecipeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipeCreateBulk) ExecX

func (rcb *RecipeCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeCreateBulk) Save

func (rcb *RecipeCreateBulk) Save(ctx context.Context) ([]*Recipe, error)

Save creates the Recipe entities in the database.

func (*RecipeCreateBulk) SaveX

func (rcb *RecipeCreateBulk) SaveX(ctx context.Context) []*Recipe

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

type RecipeDelete

type RecipeDelete struct {
	// contains filtered or unexported fields
}

RecipeDelete is the builder for deleting a Recipe entity.

func (*RecipeDelete) Exec

func (rd *RecipeDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*RecipeDelete) ExecX

func (rd *RecipeDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*RecipeDelete) Where

func (rd *RecipeDelete) Where(ps ...predicate.Recipe) *RecipeDelete

Where appends a list predicates to the RecipeDelete builder.

type RecipeDeleteOne

type RecipeDeleteOne struct {
	// contains filtered or unexported fields
}

RecipeDeleteOne is the builder for deleting a single Recipe entity.

func (*RecipeDeleteOne) Exec

func (rdo *RecipeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RecipeDeleteOne) ExecX

func (rdo *RecipeDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type RecipeEdges

type RecipeEdges struct {
	// Author holds the value of the author edge.
	Author *User `json:"author,omitempty"`
	// Tags holds the value of the tags edge.
	Tags []*Category `json:"tags,omitempty"`
	// Steps holds the value of the steps edge.
	Steps []*Step `json:"steps,omitempty"`
	// RecipeIngredients holds the value of the recipe_ingredients edge.
	RecipeIngredients []*RecipeIngredient `json:"recipe_ingredients,omitempty"`
	// contains filtered or unexported fields
}

RecipeEdges holds the relations/edges for other nodes in the graph.

func (RecipeEdges) AuthorOrErr

func (e RecipeEdges) AuthorOrErr() (*User, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (RecipeEdges) RecipeIngredientsOrErr

func (e RecipeEdges) RecipeIngredientsOrErr() ([]*RecipeIngredient, error)

RecipeIngredientsOrErr returns the RecipeIngredients value or an error if the edge was not loaded in eager-loading.

func (RecipeEdges) StepsOrErr

func (e RecipeEdges) StepsOrErr() ([]*Step, error)

StepsOrErr returns the Steps value or an error if the edge was not loaded in eager-loading.

func (RecipeEdges) TagsOrErr

func (e RecipeEdges) TagsOrErr() ([]*Category, error)

TagsOrErr returns the Tags value or an error if the edge was not loaded in eager-loading.

type RecipeGroupBy

type RecipeGroupBy struct {
	// contains filtered or unexported fields
}

RecipeGroupBy is the group-by builder for Recipe entities.

func (*RecipeGroupBy) Aggregate

func (rgb *RecipeGroupBy) Aggregate(fns ...AggregateFunc) *RecipeGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*RecipeGroupBy) Bool

func (rgb *RecipeGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) BoolX

func (rgb *RecipeGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RecipeGroupBy) Bools

func (rgb *RecipeGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) BoolsX

func (rgb *RecipeGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RecipeGroupBy) Float64

func (rgb *RecipeGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) Float64X

func (rgb *RecipeGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RecipeGroupBy) Float64s

func (rgb *RecipeGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) Float64sX

func (rgb *RecipeGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RecipeGroupBy) Int

func (rgb *RecipeGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) IntX

func (rgb *RecipeGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RecipeGroupBy) Ints

func (rgb *RecipeGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) IntsX

func (rgb *RecipeGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RecipeGroupBy) Scan

func (rgb *RecipeGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*RecipeGroupBy) ScanX

func (rgb *RecipeGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RecipeGroupBy) String

func (rgb *RecipeGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeGroupBy) StringX

func (rgb *RecipeGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RecipeGroupBy) Strings

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

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

func (*RecipeGroupBy) StringsX

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

StringsX is like Strings, but panics if an error occurs.

type RecipeIngredient

type RecipeIngredient struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Quantity holds the value of the "quantity" field.
	Quantity float32 `json:"quantity,omitempty"`
	// Unit holds the value of the "unit" field.
	Unit string `json:"unit,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RecipeIngredientQuery when eager-loading is set.
	Edges RecipeIngredientEdges `json:"edges"`
	// contains filtered or unexported fields
}

RecipeIngredient is the model entity for the RecipeIngredient schema.

func (*RecipeIngredient) QueryIngredient

func (ri *RecipeIngredient) QueryIngredient() *IngredientQuery

QueryIngredient queries the "ingredient" edge of the RecipeIngredient entity.

func (*RecipeIngredient) String

func (ri *RecipeIngredient) String() string

String implements the fmt.Stringer.

func (*RecipeIngredient) Unwrap

func (ri *RecipeIngredient) Unwrap() *RecipeIngredient

Unwrap unwraps the RecipeIngredient entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*RecipeIngredient) Update

Update returns a builder for updating this RecipeIngredient. Note that you need to call RecipeIngredient.Unwrap() before calling this method if this RecipeIngredient was returned from a transaction, and the transaction was committed or rolled back.

type RecipeIngredientClient

type RecipeIngredientClient struct {
	// contains filtered or unexported fields
}

RecipeIngredientClient is a client for the RecipeIngredient schema.

func NewRecipeIngredientClient

func NewRecipeIngredientClient(c config) *RecipeIngredientClient

NewRecipeIngredientClient returns a client for the RecipeIngredient from the given config.

func (*RecipeIngredientClient) Create

Create returns a create builder for RecipeIngredient.

func (*RecipeIngredientClient) CreateBulk

CreateBulk returns a builder for creating a bulk of RecipeIngredient entities.

func (*RecipeIngredientClient) Delete

Delete returns a delete builder for RecipeIngredient.

func (*RecipeIngredientClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*RecipeIngredientClient) DeleteOneID

DeleteOneID returns a delete builder for the given id.

func (*RecipeIngredientClient) Get

Get returns a RecipeIngredient entity by its id.

func (*RecipeIngredientClient) GetX

GetX is like Get, but panics if an error occurs.

func (*RecipeIngredientClient) Hooks

func (c *RecipeIngredientClient) Hooks() []Hook

Hooks returns the client hooks.

func (*RecipeIngredientClient) Query

Query returns a query builder for RecipeIngredient.

func (*RecipeIngredientClient) QueryIngredient

func (c *RecipeIngredientClient) QueryIngredient(ri *RecipeIngredient) *IngredientQuery

QueryIngredient queries the ingredient edge of a RecipeIngredient.

func (*RecipeIngredientClient) Update

Update returns an update builder for RecipeIngredient.

func (*RecipeIngredientClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*RecipeIngredientClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*RecipeIngredientClient) Use

func (c *RecipeIngredientClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `recipeingredient.Hooks(f(g(h())))`.

type RecipeIngredientCreate

type RecipeIngredientCreate struct {
	// contains filtered or unexported fields
}

RecipeIngredientCreate is the builder for creating a RecipeIngredient entity.

func (*RecipeIngredientCreate) Exec

Exec executes the query.

func (*RecipeIngredientCreate) ExecX

func (ric *RecipeIngredientCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeIngredientCreate) Mutation

Mutation returns the RecipeIngredientMutation object of the builder.

func (*RecipeIngredientCreate) Save

Save creates the RecipeIngredient in the database.

func (*RecipeIngredientCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*RecipeIngredientCreate) SetIngredient

SetIngredient sets the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientCreate) SetIngredientID

func (ric *RecipeIngredientCreate) SetIngredientID(id int) *RecipeIngredientCreate

SetIngredientID sets the "ingredient" edge to the Ingredient entity by ID.

func (*RecipeIngredientCreate) SetNillableIngredientID

func (ric *RecipeIngredientCreate) SetNillableIngredientID(id *int) *RecipeIngredientCreate

SetNillableIngredientID sets the "ingredient" edge to the Ingredient entity by ID if the given value is not nil.

func (*RecipeIngredientCreate) SetQuantity

SetQuantity sets the "quantity" field.

func (*RecipeIngredientCreate) SetUnit

SetUnit sets the "unit" field.

type RecipeIngredientCreateBulk

type RecipeIngredientCreateBulk struct {
	// contains filtered or unexported fields
}

RecipeIngredientCreateBulk is the builder for creating many RecipeIngredient entities in bulk.

func (*RecipeIngredientCreateBulk) Exec

Exec executes the query.

func (*RecipeIngredientCreateBulk) ExecX

func (ricb *RecipeIngredientCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeIngredientCreateBulk) Save

Save creates the RecipeIngredient entities in the database.

func (*RecipeIngredientCreateBulk) SaveX

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

type RecipeIngredientDelete

type RecipeIngredientDelete struct {
	// contains filtered or unexported fields
}

RecipeIngredientDelete is the builder for deleting a RecipeIngredient entity.

func (*RecipeIngredientDelete) Exec

func (rid *RecipeIngredientDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*RecipeIngredientDelete) ExecX

func (rid *RecipeIngredientDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*RecipeIngredientDelete) Where

Where appends a list predicates to the RecipeIngredientDelete builder.

type RecipeIngredientDeleteOne

type RecipeIngredientDeleteOne struct {
	// contains filtered or unexported fields
}

RecipeIngredientDeleteOne is the builder for deleting a single RecipeIngredient entity.

func (*RecipeIngredientDeleteOne) Exec

Exec executes the deletion query.

func (*RecipeIngredientDeleteOne) ExecX

func (rido *RecipeIngredientDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type RecipeIngredientEdges

type RecipeIngredientEdges struct {
	// Ingredient holds the value of the ingredient edge.
	Ingredient *Ingredient `json:"ingredient,omitempty"`
	// contains filtered or unexported fields
}

RecipeIngredientEdges holds the relations/edges for other nodes in the graph.

func (RecipeIngredientEdges) IngredientOrErr

func (e RecipeIngredientEdges) IngredientOrErr() (*Ingredient, error)

IngredientOrErr returns the Ingredient value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type RecipeIngredientGroupBy

type RecipeIngredientGroupBy struct {
	// contains filtered or unexported fields
}

RecipeIngredientGroupBy is the group-by builder for RecipeIngredient entities.

func (*RecipeIngredientGroupBy) Aggregate

Aggregate adds the given aggregation functions to the group-by query.

func (*RecipeIngredientGroupBy) Bool

func (rigb *RecipeIngredientGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) BoolX

func (rigb *RecipeIngredientGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Bools

func (rigb *RecipeIngredientGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) BoolsX

func (rigb *RecipeIngredientGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Float64

func (rigb *RecipeIngredientGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) Float64X

func (rigb *RecipeIngredientGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Float64s

func (rigb *RecipeIngredientGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) Float64sX

func (rigb *RecipeIngredientGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Int

func (rigb *RecipeIngredientGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) IntX

func (rigb *RecipeIngredientGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Ints

func (rigb *RecipeIngredientGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) IntsX

func (rigb *RecipeIngredientGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Scan

func (rigb *RecipeIngredientGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*RecipeIngredientGroupBy) ScanX

func (rigb *RecipeIngredientGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RecipeIngredientGroupBy) String

func (rigb *RecipeIngredientGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RecipeIngredientGroupBy) StringX

func (rigb *RecipeIngredientGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RecipeIngredientGroupBy) Strings

func (rigb *RecipeIngredientGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*RecipeIngredientGroupBy) StringsX

func (rigb *RecipeIngredientGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RecipeIngredientMutation

type RecipeIngredientMutation struct {
	// contains filtered or unexported fields
}

RecipeIngredientMutation represents an operation that mutates the RecipeIngredient nodes in the graph.

func (*RecipeIngredientMutation) AddField

func (m *RecipeIngredientMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RecipeIngredientMutation) AddQuantity

func (m *RecipeIngredientMutation) AddQuantity(f float32)

AddQuantity adds f to the "quantity" field.

func (*RecipeIngredientMutation) AddedEdges

func (m *RecipeIngredientMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*RecipeIngredientMutation) AddedField

func (m *RecipeIngredientMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RecipeIngredientMutation) AddedFields

func (m *RecipeIngredientMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*RecipeIngredientMutation) AddedIDs

func (m *RecipeIngredientMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*RecipeIngredientMutation) AddedQuantity

func (m *RecipeIngredientMutation) AddedQuantity() (r float32, exists bool)

AddedQuantity returns the value that was added to the "quantity" field in this mutation.

func (*RecipeIngredientMutation) ClearEdge

func (m *RecipeIngredientMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*RecipeIngredientMutation) ClearField

func (m *RecipeIngredientMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*RecipeIngredientMutation) ClearIngredient

func (m *RecipeIngredientMutation) ClearIngredient()

ClearIngredient clears the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientMutation) ClearedEdges

func (m *RecipeIngredientMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*RecipeIngredientMutation) ClearedFields

func (m *RecipeIngredientMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (RecipeIngredientMutation) Client

func (m RecipeIngredientMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*RecipeIngredientMutation) EdgeCleared

func (m *RecipeIngredientMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*RecipeIngredientMutation) Field

func (m *RecipeIngredientMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RecipeIngredientMutation) FieldCleared

func (m *RecipeIngredientMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*RecipeIngredientMutation) Fields

func (m *RecipeIngredientMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*RecipeIngredientMutation) ID

func (m *RecipeIngredientMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*RecipeIngredientMutation) IngredientCleared

func (m *RecipeIngredientMutation) IngredientCleared() bool

IngredientCleared reports if the "ingredient" edge to the Ingredient entity was cleared.

func (*RecipeIngredientMutation) IngredientID

func (m *RecipeIngredientMutation) IngredientID() (id int, exists bool)

IngredientID returns the "ingredient" edge ID in the mutation.

func (*RecipeIngredientMutation) IngredientIDs

func (m *RecipeIngredientMutation) IngredientIDs() (ids []int)

IngredientIDs returns the "ingredient" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use IngredientID instead. It exists only for internal usage by the builders.

func (*RecipeIngredientMutation) OldField

func (m *RecipeIngredientMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*RecipeIngredientMutation) OldQuantity

func (m *RecipeIngredientMutation) OldQuantity(ctx context.Context) (v float32, err error)

OldQuantity returns the old "quantity" field's value of the RecipeIngredient entity. If the RecipeIngredient object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RecipeIngredientMutation) OldUnit

func (m *RecipeIngredientMutation) OldUnit(ctx context.Context) (v string, err error)

OldUnit returns the old "unit" field's value of the RecipeIngredient entity. If the RecipeIngredient object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RecipeIngredientMutation) Op

func (m *RecipeIngredientMutation) Op() Op

Op returns the operation name.

func (*RecipeIngredientMutation) Quantity

func (m *RecipeIngredientMutation) Quantity() (r float32, exists bool)

Quantity returns the value of the "quantity" field in the mutation.

func (*RecipeIngredientMutation) RemovedEdges

func (m *RecipeIngredientMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*RecipeIngredientMutation) RemovedIDs

func (m *RecipeIngredientMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*RecipeIngredientMutation) ResetEdge

func (m *RecipeIngredientMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*RecipeIngredientMutation) ResetField

func (m *RecipeIngredientMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*RecipeIngredientMutation) ResetIngredient

func (m *RecipeIngredientMutation) ResetIngredient()

ResetIngredient resets all changes to the "ingredient" edge.

func (*RecipeIngredientMutation) ResetQuantity

func (m *RecipeIngredientMutation) ResetQuantity()

ResetQuantity resets all changes to the "quantity" field.

func (*RecipeIngredientMutation) ResetUnit

func (m *RecipeIngredientMutation) ResetUnit()

ResetUnit resets all changes to the "unit" field.

func (*RecipeIngredientMutation) SetField

func (m *RecipeIngredientMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RecipeIngredientMutation) SetIngredientID

func (m *RecipeIngredientMutation) SetIngredientID(id int)

SetIngredientID sets the "ingredient" edge to the Ingredient entity by id.

func (*RecipeIngredientMutation) SetQuantity

func (m *RecipeIngredientMutation) SetQuantity(f float32)

SetQuantity sets the "quantity" field.

func (*RecipeIngredientMutation) SetUnit

func (m *RecipeIngredientMutation) SetUnit(s string)

SetUnit sets the "unit" field.

func (RecipeIngredientMutation) Tx

func (m RecipeIngredientMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*RecipeIngredientMutation) Type

func (m *RecipeIngredientMutation) Type() string

Type returns the node type of this mutation (RecipeIngredient).

func (*RecipeIngredientMutation) Unit

func (m *RecipeIngredientMutation) Unit() (r string, exists bool)

Unit returns the value of the "unit" field in the mutation.

func (*RecipeIngredientMutation) Where

Where appends a list predicates to the RecipeIngredientMutation builder.

type RecipeIngredientQuery

type RecipeIngredientQuery struct {
	// contains filtered or unexported fields
}

RecipeIngredientQuery is the builder for querying RecipeIngredient entities.

func (*RecipeIngredientQuery) All

All executes the query and returns a list of RecipeIngredients.

func (*RecipeIngredientQuery) AllX

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

func (*RecipeIngredientQuery) Clone

Clone returns a duplicate of the RecipeIngredientQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*RecipeIngredientQuery) Count

func (riq *RecipeIngredientQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RecipeIngredientQuery) CountX

func (riq *RecipeIngredientQuery) CountX(ctx context.Context) int

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

func (*RecipeIngredientQuery) Exist

func (riq *RecipeIngredientQuery) Exist(ctx context.Context) (bool, error)

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

func (*RecipeIngredientQuery) ExistX

func (riq *RecipeIngredientQuery) ExistX(ctx context.Context) bool

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

func (*RecipeIngredientQuery) First

First returns the first RecipeIngredient entity from the query. Returns a *NotFoundError when no RecipeIngredient was found.

func (*RecipeIngredientQuery) FirstID

func (riq *RecipeIngredientQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first RecipeIngredient ID from the query. Returns a *NotFoundError when no RecipeIngredient ID was found.

func (*RecipeIngredientQuery) FirstIDX

func (riq *RecipeIngredientQuery) FirstIDX(ctx context.Context) int

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

func (*RecipeIngredientQuery) FirstX

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

func (*RecipeIngredientQuery) GroupBy

func (riq *RecipeIngredientQuery) GroupBy(field string, fields ...string) *RecipeIngredientGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Quantity float32 `json:"quantity,omitempty"`
	Count int `json:"count,omitempty"`
}

client.RecipeIngredient.Query().
	GroupBy(recipeingredient.FieldQuantity).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RecipeIngredientQuery) IDs

func (riq *RecipeIngredientQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of RecipeIngredient IDs.

func (*RecipeIngredientQuery) IDsX

func (riq *RecipeIngredientQuery) IDsX(ctx context.Context) []int

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

func (*RecipeIngredientQuery) Limit

func (riq *RecipeIngredientQuery) Limit(limit int) *RecipeIngredientQuery

Limit adds a limit step to the query.

func (*RecipeIngredientQuery) Offset

func (riq *RecipeIngredientQuery) Offset(offset int) *RecipeIngredientQuery

Offset adds an offset step to the query.

func (*RecipeIngredientQuery) Only

Only returns a single RecipeIngredient entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one RecipeIngredient entity is not found. Returns a *NotFoundError when no RecipeIngredient entities are found.

func (*RecipeIngredientQuery) OnlyID

func (riq *RecipeIngredientQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only RecipeIngredient ID in the query. Returns a *NotSingularError when exactly one RecipeIngredient ID is not found. Returns a *NotFoundError when no entities are found.

func (*RecipeIngredientQuery) OnlyIDX

func (riq *RecipeIngredientQuery) OnlyIDX(ctx context.Context) int

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

func (*RecipeIngredientQuery) OnlyX

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

func (*RecipeIngredientQuery) Order

Order adds an order step to the query.

func (*RecipeIngredientQuery) QueryIngredient

func (riq *RecipeIngredientQuery) QueryIngredient() *IngredientQuery

QueryIngredient chains the current query on the "ingredient" edge.

func (*RecipeIngredientQuery) Select

func (riq *RecipeIngredientQuery) Select(fields ...string) *RecipeIngredientSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Quantity float32 `json:"quantity,omitempty"`
}

client.RecipeIngredient.Query().
	Select(recipeingredient.FieldQuantity).
	Scan(ctx, &v)

func (*RecipeIngredientQuery) Unique

func (riq *RecipeIngredientQuery) Unique(unique bool) *RecipeIngredientQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*RecipeIngredientQuery) Where

Where adds a new predicate for the RecipeIngredientQuery builder.

func (*RecipeIngredientQuery) WithIngredient

func (riq *RecipeIngredientQuery) WithIngredient(opts ...func(*IngredientQuery)) *RecipeIngredientQuery

WithIngredient tells the query-builder to eager-load the nodes that are connected to the "ingredient" edge. The optional arguments are used to configure the query builder of the edge.

type RecipeIngredientSelect

type RecipeIngredientSelect struct {
	*RecipeIngredientQuery
	// contains filtered or unexported fields
}

RecipeIngredientSelect is the builder for selecting fields of RecipeIngredient entities.

func (*RecipeIngredientSelect) Bool

func (ris *RecipeIngredientSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) BoolX

func (ris *RecipeIngredientSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RecipeIngredientSelect) Bools

func (ris *RecipeIngredientSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) BoolsX

func (ris *RecipeIngredientSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RecipeIngredientSelect) Float64

func (ris *RecipeIngredientSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) Float64X

func (ris *RecipeIngredientSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RecipeIngredientSelect) Float64s

func (ris *RecipeIngredientSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) Float64sX

func (ris *RecipeIngredientSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RecipeIngredientSelect) Int

func (ris *RecipeIngredientSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) IntX

func (ris *RecipeIngredientSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RecipeIngredientSelect) Ints

func (ris *RecipeIngredientSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) IntsX

func (ris *RecipeIngredientSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RecipeIngredientSelect) Scan

func (ris *RecipeIngredientSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*RecipeIngredientSelect) ScanX

func (ris *RecipeIngredientSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RecipeIngredientSelect) String

func (ris *RecipeIngredientSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RecipeIngredientSelect) StringX

func (ris *RecipeIngredientSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RecipeIngredientSelect) Strings

func (ris *RecipeIngredientSelect) Strings(ctx context.Context) ([]string, error)

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

func (*RecipeIngredientSelect) StringsX

func (ris *RecipeIngredientSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RecipeIngredientUpdate

type RecipeIngredientUpdate struct {
	// contains filtered or unexported fields
}

RecipeIngredientUpdate is the builder for updating RecipeIngredient entities.

func (*RecipeIngredientUpdate) AddQuantity

AddQuantity adds f to the "quantity" field.

func (*RecipeIngredientUpdate) ClearIngredient

func (riu *RecipeIngredientUpdate) ClearIngredient() *RecipeIngredientUpdate

ClearIngredient clears the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientUpdate) Exec

Exec executes the query.

func (*RecipeIngredientUpdate) ExecX

func (riu *RecipeIngredientUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeIngredientUpdate) Mutation

Mutation returns the RecipeIngredientMutation object of the builder.

func (*RecipeIngredientUpdate) Save

func (riu *RecipeIngredientUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*RecipeIngredientUpdate) SaveX

func (riu *RecipeIngredientUpdate) SaveX(ctx context.Context) int

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

func (*RecipeIngredientUpdate) SetIngredient

SetIngredient sets the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientUpdate) SetIngredientID

func (riu *RecipeIngredientUpdate) SetIngredientID(id int) *RecipeIngredientUpdate

SetIngredientID sets the "ingredient" edge to the Ingredient entity by ID.

func (*RecipeIngredientUpdate) SetNillableIngredientID

func (riu *RecipeIngredientUpdate) SetNillableIngredientID(id *int) *RecipeIngredientUpdate

SetNillableIngredientID sets the "ingredient" edge to the Ingredient entity by ID if the given value is not nil.

func (*RecipeIngredientUpdate) SetQuantity

SetQuantity sets the "quantity" field.

func (*RecipeIngredientUpdate) SetUnit

SetUnit sets the "unit" field.

func (*RecipeIngredientUpdate) Where

Where appends a list predicates to the RecipeIngredientUpdate builder.

type RecipeIngredientUpdateOne

type RecipeIngredientUpdateOne struct {
	// contains filtered or unexported fields
}

RecipeIngredientUpdateOne is the builder for updating a single RecipeIngredient entity.

func (*RecipeIngredientUpdateOne) AddQuantity

AddQuantity adds f to the "quantity" field.

func (*RecipeIngredientUpdateOne) ClearIngredient

func (riuo *RecipeIngredientUpdateOne) ClearIngredient() *RecipeIngredientUpdateOne

ClearIngredient clears the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientUpdateOne) Exec

Exec executes the query on the entity.

func (*RecipeIngredientUpdateOne) ExecX

func (riuo *RecipeIngredientUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeIngredientUpdateOne) Mutation

Mutation returns the RecipeIngredientMutation object of the builder.

func (*RecipeIngredientUpdateOne) Save

Save executes the query and returns the updated RecipeIngredient entity.

func (*RecipeIngredientUpdateOne) SaveX

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

func (*RecipeIngredientUpdateOne) Select

func (riuo *RecipeIngredientUpdateOne) Select(field string, fields ...string) *RecipeIngredientUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*RecipeIngredientUpdateOne) SetIngredient

SetIngredient sets the "ingredient" edge to the Ingredient entity.

func (*RecipeIngredientUpdateOne) SetIngredientID

func (riuo *RecipeIngredientUpdateOne) SetIngredientID(id int) *RecipeIngredientUpdateOne

SetIngredientID sets the "ingredient" edge to the Ingredient entity by ID.

func (*RecipeIngredientUpdateOne) SetNillableIngredientID

func (riuo *RecipeIngredientUpdateOne) SetNillableIngredientID(id *int) *RecipeIngredientUpdateOne

SetNillableIngredientID sets the "ingredient" edge to the Ingredient entity by ID if the given value is not nil.

func (*RecipeIngredientUpdateOne) SetQuantity

SetQuantity sets the "quantity" field.

func (*RecipeIngredientUpdateOne) SetUnit

SetUnit sets the "unit" field.

type RecipeIngredients

type RecipeIngredients []*RecipeIngredient

RecipeIngredients is a parsable slice of RecipeIngredient.

type RecipeMutation

type RecipeMutation struct {
	// contains filtered or unexported fields
}

RecipeMutation represents an operation that mutates the Recipe nodes in the graph.

func (*RecipeMutation) AddField

func (m *RecipeMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RecipeMutation) AddRecipeIngredientIDs

func (m *RecipeMutation) AddRecipeIngredientIDs(ids ...int)

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by ids.

func (*RecipeMutation) AddServings

func (m *RecipeMutation) AddServings(i int)

AddServings adds i to the "servings" field.

func (*RecipeMutation) AddStepIDs

func (m *RecipeMutation) AddStepIDs(ids ...int)

AddStepIDs adds the "steps" edge to the Step entity by ids.

func (*RecipeMutation) AddTagIDs

func (m *RecipeMutation) AddTagIDs(ids ...int)

AddTagIDs adds the "tags" edge to the Category entity by ids.

func (*RecipeMutation) AddedEdges

func (m *RecipeMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*RecipeMutation) AddedField

func (m *RecipeMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RecipeMutation) AddedFields

func (m *RecipeMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*RecipeMutation) AddedIDs

func (m *RecipeMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*RecipeMutation) AddedServings

func (m *RecipeMutation) AddedServings() (r int, exists bool)

AddedServings returns the value that was added to the "servings" field in this mutation.

func (*RecipeMutation) AuthorCleared

func (m *RecipeMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the User entity was cleared.

func (*RecipeMutation) AuthorID

func (m *RecipeMutation) AuthorID() (id int, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*RecipeMutation) AuthorIDs

func (m *RecipeMutation) AuthorIDs() (ids []int)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*RecipeMutation) ClearAuthor

func (m *RecipeMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the User entity.

func (*RecipeMutation) ClearEdge

func (m *RecipeMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*RecipeMutation) ClearField

func (m *RecipeMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*RecipeMutation) ClearRecipeIngredients

func (m *RecipeMutation) ClearRecipeIngredients()

ClearRecipeIngredients clears the "recipe_ingredients" edge to the RecipeIngredient entity.

func (*RecipeMutation) ClearSteps

func (m *RecipeMutation) ClearSteps()

ClearSteps clears the "steps" edge to the Step entity.

func (*RecipeMutation) ClearTags

func (m *RecipeMutation) ClearTags()

ClearTags clears the "tags" edge to the Category entity.

func (*RecipeMutation) ClearedEdges

func (m *RecipeMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*RecipeMutation) ClearedFields

func (m *RecipeMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (RecipeMutation) Client

func (m RecipeMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*RecipeMutation) EdgeCleared

func (m *RecipeMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*RecipeMutation) Field

func (m *RecipeMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*RecipeMutation) FieldCleared

func (m *RecipeMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*RecipeMutation) Fields

func (m *RecipeMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*RecipeMutation) ID

func (m *RecipeMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*RecipeMutation) Name

func (m *RecipeMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*RecipeMutation) OldField

func (m *RecipeMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*RecipeMutation) OldName

func (m *RecipeMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Recipe entity. If the Recipe object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RecipeMutation) OldServings

func (m *RecipeMutation) OldServings(ctx context.Context) (v int, err error)

OldServings returns the old "servings" field's value of the Recipe entity. If the Recipe object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*RecipeMutation) Op

func (m *RecipeMutation) Op() Op

Op returns the operation name.

func (*RecipeMutation) RecipeIngredientsCleared

func (m *RecipeMutation) RecipeIngredientsCleared() bool

RecipeIngredientsCleared reports if the "recipe_ingredients" edge to the RecipeIngredient entity was cleared.

func (*RecipeMutation) RecipeIngredientsIDs

func (m *RecipeMutation) RecipeIngredientsIDs() (ids []int)

RecipeIngredientsIDs returns the "recipe_ingredients" edge IDs in the mutation.

func (*RecipeMutation) RemoveRecipeIngredientIDs

func (m *RecipeMutation) RemoveRecipeIngredientIDs(ids ...int)

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*RecipeMutation) RemoveStepIDs

func (m *RecipeMutation) RemoveStepIDs(ids ...int)

RemoveStepIDs removes the "steps" edge to the Step entity by IDs.

func (*RecipeMutation) RemoveTagIDs

func (m *RecipeMutation) RemoveTagIDs(ids ...int)

RemoveTagIDs removes the "tags" edge to the Category entity by IDs.

func (*RecipeMutation) RemovedEdges

func (m *RecipeMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*RecipeMutation) RemovedIDs

func (m *RecipeMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*RecipeMutation) RemovedRecipeIngredientsIDs

func (m *RecipeMutation) RemovedRecipeIngredientsIDs() (ids []int)

RemovedRecipeIngredients returns the removed IDs of the "recipe_ingredients" edge to the RecipeIngredient entity.

func (*RecipeMutation) RemovedStepsIDs

func (m *RecipeMutation) RemovedStepsIDs() (ids []int)

RemovedSteps returns the removed IDs of the "steps" edge to the Step entity.

func (*RecipeMutation) RemovedTagsIDs

func (m *RecipeMutation) RemovedTagsIDs() (ids []int)

RemovedTags returns the removed IDs of the "tags" edge to the Category entity.

func (*RecipeMutation) ResetAuthor

func (m *RecipeMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*RecipeMutation) ResetEdge

func (m *RecipeMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*RecipeMutation) ResetField

func (m *RecipeMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*RecipeMutation) ResetName

func (m *RecipeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RecipeMutation) ResetRecipeIngredients

func (m *RecipeMutation) ResetRecipeIngredients()

ResetRecipeIngredients resets all changes to the "recipe_ingredients" edge.

func (*RecipeMutation) ResetServings

func (m *RecipeMutation) ResetServings()

ResetServings resets all changes to the "servings" field.

func (*RecipeMutation) ResetSteps

func (m *RecipeMutation) ResetSteps()

ResetSteps resets all changes to the "steps" edge.

func (*RecipeMutation) ResetTags

func (m *RecipeMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*RecipeMutation) Servings

func (m *RecipeMutation) Servings() (r int, exists bool)

Servings returns the value of the "servings" field in the mutation.

func (*RecipeMutation) SetAuthorID

func (m *RecipeMutation) SetAuthorID(id int)

SetAuthorID sets the "author" edge to the User entity by id.

func (*RecipeMutation) SetField

func (m *RecipeMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*RecipeMutation) SetName

func (m *RecipeMutation) SetName(s string)

SetName sets the "name" field.

func (*RecipeMutation) SetServings

func (m *RecipeMutation) SetServings(i int)

SetServings sets the "servings" field.

func (*RecipeMutation) StepsCleared

func (m *RecipeMutation) StepsCleared() bool

StepsCleared reports if the "steps" edge to the Step entity was cleared.

func (*RecipeMutation) StepsIDs

func (m *RecipeMutation) StepsIDs() (ids []int)

StepsIDs returns the "steps" edge IDs in the mutation.

func (*RecipeMutation) TagsCleared

func (m *RecipeMutation) TagsCleared() bool

TagsCleared reports if the "tags" edge to the Category entity was cleared.

func (*RecipeMutation) TagsIDs

func (m *RecipeMutation) TagsIDs() (ids []int)

TagsIDs returns the "tags" edge IDs in the mutation.

func (RecipeMutation) Tx

func (m RecipeMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*RecipeMutation) Type

func (m *RecipeMutation) Type() string

Type returns the node type of this mutation (Recipe).

func (*RecipeMutation) Where

func (m *RecipeMutation) Where(ps ...predicate.Recipe)

Where appends a list predicates to the RecipeMutation builder.

type RecipeQuery

type RecipeQuery struct {
	// contains filtered or unexported fields
}

RecipeQuery is the builder for querying Recipe entities.

func (*RecipeQuery) All

func (rq *RecipeQuery) All(ctx context.Context) ([]*Recipe, error)

All executes the query and returns a list of Recipes.

func (*RecipeQuery) AllX

func (rq *RecipeQuery) AllX(ctx context.Context) []*Recipe

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

func (*RecipeQuery) Clone

func (rq *RecipeQuery) Clone() *RecipeQuery

Clone returns a duplicate of the RecipeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*RecipeQuery) Count

func (rq *RecipeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RecipeQuery) CountX

func (rq *RecipeQuery) CountX(ctx context.Context) int

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

func (*RecipeQuery) Exist

func (rq *RecipeQuery) Exist(ctx context.Context) (bool, error)

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

func (*RecipeQuery) ExistX

func (rq *RecipeQuery) ExistX(ctx context.Context) bool

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

func (*RecipeQuery) First

func (rq *RecipeQuery) First(ctx context.Context) (*Recipe, error)

First returns the first Recipe entity from the query. Returns a *NotFoundError when no Recipe was found.

func (*RecipeQuery) FirstID

func (rq *RecipeQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Recipe ID from the query. Returns a *NotFoundError when no Recipe ID was found.

func (*RecipeQuery) FirstIDX

func (rq *RecipeQuery) FirstIDX(ctx context.Context) int

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

func (*RecipeQuery) FirstX

func (rq *RecipeQuery) FirstX(ctx context.Context) *Recipe

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

func (*RecipeQuery) GroupBy

func (rq *RecipeQuery) GroupBy(field string, fields ...string) *RecipeGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Recipe.Query().
	GroupBy(recipe.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RecipeQuery) IDs

func (rq *RecipeQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Recipe IDs.

func (*RecipeQuery) IDsX

func (rq *RecipeQuery) IDsX(ctx context.Context) []int

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

func (*RecipeQuery) Limit

func (rq *RecipeQuery) Limit(limit int) *RecipeQuery

Limit adds a limit step to the query.

func (*RecipeQuery) Offset

func (rq *RecipeQuery) Offset(offset int) *RecipeQuery

Offset adds an offset step to the query.

func (*RecipeQuery) Only

func (rq *RecipeQuery) Only(ctx context.Context) (*Recipe, error)

Only returns a single Recipe entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Recipe entity is not found. Returns a *NotFoundError when no Recipe entities are found.

func (*RecipeQuery) OnlyID

func (rq *RecipeQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Recipe ID in the query. Returns a *NotSingularError when exactly one Recipe ID is not found. Returns a *NotFoundError when no entities are found.

func (*RecipeQuery) OnlyIDX

func (rq *RecipeQuery) OnlyIDX(ctx context.Context) int

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

func (*RecipeQuery) OnlyX

func (rq *RecipeQuery) OnlyX(ctx context.Context) *Recipe

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

func (*RecipeQuery) Order

func (rq *RecipeQuery) Order(o ...OrderFunc) *RecipeQuery

Order adds an order step to the query.

func (*RecipeQuery) QueryAuthor

func (rq *RecipeQuery) QueryAuthor() *UserQuery

QueryAuthor chains the current query on the "author" edge.

func (*RecipeQuery) QueryRecipeIngredients

func (rq *RecipeQuery) QueryRecipeIngredients() *RecipeIngredientQuery

QueryRecipeIngredients chains the current query on the "recipe_ingredients" edge.

func (*RecipeQuery) QuerySteps

func (rq *RecipeQuery) QuerySteps() *StepQuery

QuerySteps chains the current query on the "steps" edge.

func (*RecipeQuery) QueryTags

func (rq *RecipeQuery) QueryTags() *CategoryQuery

QueryTags chains the current query on the "tags" edge.

func (*RecipeQuery) Select

func (rq *RecipeQuery) Select(fields ...string) *RecipeSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Recipe.Query().
	Select(recipe.FieldName).
	Scan(ctx, &v)

func (*RecipeQuery) Unique

func (rq *RecipeQuery) Unique(unique bool) *RecipeQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*RecipeQuery) Where

func (rq *RecipeQuery) Where(ps ...predicate.Recipe) *RecipeQuery

Where adds a new predicate for the RecipeQuery builder.

func (*RecipeQuery) WithAuthor

func (rq *RecipeQuery) WithAuthor(opts ...func(*UserQuery)) *RecipeQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

func (*RecipeQuery) WithRecipeIngredients

func (rq *RecipeQuery) WithRecipeIngredients(opts ...func(*RecipeIngredientQuery)) *RecipeQuery

WithRecipeIngredients tells the query-builder to eager-load the nodes that are connected to the "recipe_ingredients" edge. The optional arguments are used to configure the query builder of the edge.

func (*RecipeQuery) WithSteps

func (rq *RecipeQuery) WithSteps(opts ...func(*StepQuery)) *RecipeQuery

WithSteps tells the query-builder to eager-load the nodes that are connected to the "steps" edge. The optional arguments are used to configure the query builder of the edge.

func (*RecipeQuery) WithTags

func (rq *RecipeQuery) WithTags(opts ...func(*CategoryQuery)) *RecipeQuery

WithTags tells the query-builder to eager-load the nodes that are connected to the "tags" edge. The optional arguments are used to configure the query builder of the edge.

type RecipeSelect

type RecipeSelect struct {
	*RecipeQuery
	// contains filtered or unexported fields
}

RecipeSelect is the builder for selecting fields of Recipe entities.

func (*RecipeSelect) Bool

func (rs *RecipeSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) BoolX

func (rs *RecipeSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RecipeSelect) Bools

func (rs *RecipeSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) BoolsX

func (rs *RecipeSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RecipeSelect) Float64

func (rs *RecipeSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) Float64X

func (rs *RecipeSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RecipeSelect) Float64s

func (rs *RecipeSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) Float64sX

func (rs *RecipeSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RecipeSelect) Int

func (rs *RecipeSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) IntX

func (rs *RecipeSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RecipeSelect) Ints

func (rs *RecipeSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) IntsX

func (rs *RecipeSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RecipeSelect) Scan

func (rs *RecipeSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*RecipeSelect) ScanX

func (rs *RecipeSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RecipeSelect) String

func (rs *RecipeSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RecipeSelect) StringX

func (rs *RecipeSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RecipeSelect) Strings

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

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

func (*RecipeSelect) StringsX

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

StringsX is like Strings, but panics if an error occurs.

type RecipeUpdate

type RecipeUpdate struct {
	// contains filtered or unexported fields
}

RecipeUpdate is the builder for updating Recipe entities.

func (*RecipeUpdate) AddRecipeIngredientIDs

func (ru *RecipeUpdate) AddRecipeIngredientIDs(ids ...int) *RecipeUpdate

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*RecipeUpdate) AddRecipeIngredients

func (ru *RecipeUpdate) AddRecipeIngredients(r ...*RecipeIngredient) *RecipeUpdate

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*RecipeUpdate) AddServings

func (ru *RecipeUpdate) AddServings(i int) *RecipeUpdate

AddServings adds i to the "servings" field.

func (*RecipeUpdate) AddStepIDs

func (ru *RecipeUpdate) AddStepIDs(ids ...int) *RecipeUpdate

AddStepIDs adds the "steps" edge to the Step entity by IDs.

func (*RecipeUpdate) AddSteps

func (ru *RecipeUpdate) AddSteps(s ...*Step) *RecipeUpdate

AddSteps adds the "steps" edges to the Step entity.

func (*RecipeUpdate) AddTagIDs

func (ru *RecipeUpdate) AddTagIDs(ids ...int) *RecipeUpdate

AddTagIDs adds the "tags" edge to the Category entity by IDs.

func (*RecipeUpdate) AddTags

func (ru *RecipeUpdate) AddTags(c ...*Category) *RecipeUpdate

AddTags adds the "tags" edges to the Category entity.

func (*RecipeUpdate) ClearAuthor

func (ru *RecipeUpdate) ClearAuthor() *RecipeUpdate

ClearAuthor clears the "author" edge to the User entity.

func (*RecipeUpdate) ClearRecipeIngredients

func (ru *RecipeUpdate) ClearRecipeIngredients() *RecipeUpdate

ClearRecipeIngredients clears all "recipe_ingredients" edges to the RecipeIngredient entity.

func (*RecipeUpdate) ClearSteps

func (ru *RecipeUpdate) ClearSteps() *RecipeUpdate

ClearSteps clears all "steps" edges to the Step entity.

func (*RecipeUpdate) ClearTags

func (ru *RecipeUpdate) ClearTags() *RecipeUpdate

ClearTags clears all "tags" edges to the Category entity.

func (*RecipeUpdate) Exec

func (ru *RecipeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipeUpdate) ExecX

func (ru *RecipeUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeUpdate) Mutation

func (ru *RecipeUpdate) Mutation() *RecipeMutation

Mutation returns the RecipeMutation object of the builder.

func (*RecipeUpdate) RemoveRecipeIngredientIDs

func (ru *RecipeUpdate) RemoveRecipeIngredientIDs(ids ...int) *RecipeUpdate

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to RecipeIngredient entities by IDs.

func (*RecipeUpdate) RemoveRecipeIngredients

func (ru *RecipeUpdate) RemoveRecipeIngredients(r ...*RecipeIngredient) *RecipeUpdate

RemoveRecipeIngredients removes "recipe_ingredients" edges to RecipeIngredient entities.

func (*RecipeUpdate) RemoveStepIDs

func (ru *RecipeUpdate) RemoveStepIDs(ids ...int) *RecipeUpdate

RemoveStepIDs removes the "steps" edge to Step entities by IDs.

func (*RecipeUpdate) RemoveSteps

func (ru *RecipeUpdate) RemoveSteps(s ...*Step) *RecipeUpdate

RemoveSteps removes "steps" edges to Step entities.

func (*RecipeUpdate) RemoveTagIDs

func (ru *RecipeUpdate) RemoveTagIDs(ids ...int) *RecipeUpdate

RemoveTagIDs removes the "tags" edge to Category entities by IDs.

func (*RecipeUpdate) RemoveTags

func (ru *RecipeUpdate) RemoveTags(c ...*Category) *RecipeUpdate

RemoveTags removes "tags" edges to Category entities.

func (*RecipeUpdate) Save

func (ru *RecipeUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*RecipeUpdate) SaveX

func (ru *RecipeUpdate) SaveX(ctx context.Context) int

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

func (*RecipeUpdate) SetAuthor

func (ru *RecipeUpdate) SetAuthor(u *User) *RecipeUpdate

SetAuthor sets the "author" edge to the User entity.

func (*RecipeUpdate) SetAuthorID

func (ru *RecipeUpdate) SetAuthorID(id int) *RecipeUpdate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*RecipeUpdate) SetName

func (ru *RecipeUpdate) SetName(s string) *RecipeUpdate

SetName sets the "name" field.

func (*RecipeUpdate) SetNillableAuthorID

func (ru *RecipeUpdate) SetNillableAuthorID(id *int) *RecipeUpdate

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

func (*RecipeUpdate) SetServings

func (ru *RecipeUpdate) SetServings(i int) *RecipeUpdate

SetServings sets the "servings" field.

func (*RecipeUpdate) Where

func (ru *RecipeUpdate) Where(ps ...predicate.Recipe) *RecipeUpdate

Where appends a list predicates to the RecipeUpdate builder.

type RecipeUpdateOne

type RecipeUpdateOne struct {
	// contains filtered or unexported fields
}

RecipeUpdateOne is the builder for updating a single Recipe entity.

func (*RecipeUpdateOne) AddRecipeIngredientIDs

func (ruo *RecipeUpdateOne) AddRecipeIngredientIDs(ids ...int) *RecipeUpdateOne

AddRecipeIngredientIDs adds the "recipe_ingredients" edge to the RecipeIngredient entity by IDs.

func (*RecipeUpdateOne) AddRecipeIngredients

func (ruo *RecipeUpdateOne) AddRecipeIngredients(r ...*RecipeIngredient) *RecipeUpdateOne

AddRecipeIngredients adds the "recipe_ingredients" edges to the RecipeIngredient entity.

func (*RecipeUpdateOne) AddServings

func (ruo *RecipeUpdateOne) AddServings(i int) *RecipeUpdateOne

AddServings adds i to the "servings" field.

func (*RecipeUpdateOne) AddStepIDs

func (ruo *RecipeUpdateOne) AddStepIDs(ids ...int) *RecipeUpdateOne

AddStepIDs adds the "steps" edge to the Step entity by IDs.

func (*RecipeUpdateOne) AddSteps

func (ruo *RecipeUpdateOne) AddSteps(s ...*Step) *RecipeUpdateOne

AddSteps adds the "steps" edges to the Step entity.

func (*RecipeUpdateOne) AddTagIDs

func (ruo *RecipeUpdateOne) AddTagIDs(ids ...int) *RecipeUpdateOne

AddTagIDs adds the "tags" edge to the Category entity by IDs.

func (*RecipeUpdateOne) AddTags

func (ruo *RecipeUpdateOne) AddTags(c ...*Category) *RecipeUpdateOne

AddTags adds the "tags" edges to the Category entity.

func (*RecipeUpdateOne) ClearAuthor

func (ruo *RecipeUpdateOne) ClearAuthor() *RecipeUpdateOne

ClearAuthor clears the "author" edge to the User entity.

func (*RecipeUpdateOne) ClearRecipeIngredients

func (ruo *RecipeUpdateOne) ClearRecipeIngredients() *RecipeUpdateOne

ClearRecipeIngredients clears all "recipe_ingredients" edges to the RecipeIngredient entity.

func (*RecipeUpdateOne) ClearSteps

func (ruo *RecipeUpdateOne) ClearSteps() *RecipeUpdateOne

ClearSteps clears all "steps" edges to the Step entity.

func (*RecipeUpdateOne) ClearTags

func (ruo *RecipeUpdateOne) ClearTags() *RecipeUpdateOne

ClearTags clears all "tags" edges to the Category entity.

func (*RecipeUpdateOne) Exec

func (ruo *RecipeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RecipeUpdateOne) ExecX

func (ruo *RecipeUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RecipeUpdateOne) Mutation

func (ruo *RecipeUpdateOne) Mutation() *RecipeMutation

Mutation returns the RecipeMutation object of the builder.

func (*RecipeUpdateOne) RemoveRecipeIngredientIDs

func (ruo *RecipeUpdateOne) RemoveRecipeIngredientIDs(ids ...int) *RecipeUpdateOne

RemoveRecipeIngredientIDs removes the "recipe_ingredients" edge to RecipeIngredient entities by IDs.

func (*RecipeUpdateOne) RemoveRecipeIngredients

func (ruo *RecipeUpdateOne) RemoveRecipeIngredients(r ...*RecipeIngredient) *RecipeUpdateOne

RemoveRecipeIngredients removes "recipe_ingredients" edges to RecipeIngredient entities.

func (*RecipeUpdateOne) RemoveStepIDs

func (ruo *RecipeUpdateOne) RemoveStepIDs(ids ...int) *RecipeUpdateOne

RemoveStepIDs removes the "steps" edge to Step entities by IDs.

func (*RecipeUpdateOne) RemoveSteps

func (ruo *RecipeUpdateOne) RemoveSteps(s ...*Step) *RecipeUpdateOne

RemoveSteps removes "steps" edges to Step entities.

func (*RecipeUpdateOne) RemoveTagIDs

func (ruo *RecipeUpdateOne) RemoveTagIDs(ids ...int) *RecipeUpdateOne

RemoveTagIDs removes the "tags" edge to Category entities by IDs.

func (*RecipeUpdateOne) RemoveTags

func (ruo *RecipeUpdateOne) RemoveTags(c ...*Category) *RecipeUpdateOne

RemoveTags removes "tags" edges to Category entities.

func (*RecipeUpdateOne) Save

func (ruo *RecipeUpdateOne) Save(ctx context.Context) (*Recipe, error)

Save executes the query and returns the updated Recipe entity.

func (*RecipeUpdateOne) SaveX

func (ruo *RecipeUpdateOne) SaveX(ctx context.Context) *Recipe

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

func (*RecipeUpdateOne) Select

func (ruo *RecipeUpdateOne) Select(field string, fields ...string) *RecipeUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*RecipeUpdateOne) SetAuthor

func (ruo *RecipeUpdateOne) SetAuthor(u *User) *RecipeUpdateOne

SetAuthor sets the "author" edge to the User entity.

func (*RecipeUpdateOne) SetAuthorID

func (ruo *RecipeUpdateOne) SetAuthorID(id int) *RecipeUpdateOne

SetAuthorID sets the "author" edge to the User entity by ID.

func (*RecipeUpdateOne) SetName

func (ruo *RecipeUpdateOne) SetName(s string) *RecipeUpdateOne

SetName sets the "name" field.

func (*RecipeUpdateOne) SetNillableAuthorID

func (ruo *RecipeUpdateOne) SetNillableAuthorID(id *int) *RecipeUpdateOne

SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil.

func (*RecipeUpdateOne) SetServings

func (ruo *RecipeUpdateOne) SetServings(i int) *RecipeUpdateOne

SetServings sets the "servings" field.

type Recipes

type Recipes []*Recipe

Recipes is a parsable slice of Recipe.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollbacker method.

type Step

type Step struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the StepQuery when eager-loading is set.
	Edges StepEdges `json:"edges"`
	// contains filtered or unexported fields
}

Step is the model entity for the Step schema.

func (*Step) QueryRecipe

func (s *Step) QueryRecipe() *RecipeQuery

QueryRecipe queries the "recipe" edge of the Step entity.

func (*Step) String

func (s *Step) String() string

String implements the fmt.Stringer.

func (*Step) Unwrap

func (s *Step) Unwrap() *Step

Unwrap unwraps the Step entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Step) Update

func (s *Step) Update() *StepUpdateOne

Update returns a builder for updating this Step. Note that you need to call Step.Unwrap() before calling this method if this Step was returned from a transaction, and the transaction was committed or rolled back.

type StepClient

type StepClient struct {
	// contains filtered or unexported fields
}

StepClient is a client for the Step schema.

func NewStepClient

func NewStepClient(c config) *StepClient

NewStepClient returns a client for the Step from the given config.

func (*StepClient) Create

func (c *StepClient) Create() *StepCreate

Create returns a create builder for Step.

func (*StepClient) CreateBulk

func (c *StepClient) CreateBulk(builders ...*StepCreate) *StepCreateBulk

CreateBulk returns a builder for creating a bulk of Step entities.

func (*StepClient) Delete

func (c *StepClient) Delete() *StepDelete

Delete returns a delete builder for Step.

func (*StepClient) DeleteOne

func (c *StepClient) DeleteOne(s *Step) *StepDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*StepClient) DeleteOneID

func (c *StepClient) DeleteOneID(id int) *StepDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*StepClient) Get

func (c *StepClient) Get(ctx context.Context, id int) (*Step, error)

Get returns a Step entity by its id.

func (*StepClient) GetX

func (c *StepClient) GetX(ctx context.Context, id int) *Step

GetX is like Get, but panics if an error occurs.

func (*StepClient) Hooks

func (c *StepClient) Hooks() []Hook

Hooks returns the client hooks.

func (*StepClient) Query

func (c *StepClient) Query() *StepQuery

Query returns a query builder for Step.

func (*StepClient) QueryRecipe

func (c *StepClient) QueryRecipe(s *Step) *RecipeQuery

QueryRecipe queries the recipe edge of a Step.

func (*StepClient) Update

func (c *StepClient) Update() *StepUpdate

Update returns an update builder for Step.

func (*StepClient) UpdateOne

func (c *StepClient) UpdateOne(s *Step) *StepUpdateOne

UpdateOne returns an update builder for the given entity.

func (*StepClient) UpdateOneID

func (c *StepClient) UpdateOneID(id int) *StepUpdateOne

UpdateOneID returns an update builder for the given id.

func (*StepClient) Use

func (c *StepClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `step.Hooks(f(g(h())))`.

type StepCreate

type StepCreate struct {
	// contains filtered or unexported fields
}

StepCreate is the builder for creating a Step entity.

func (*StepCreate) Exec

func (sc *StepCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*StepCreate) ExecX

func (sc *StepCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StepCreate) Mutation

func (sc *StepCreate) Mutation() *StepMutation

Mutation returns the StepMutation object of the builder.

func (*StepCreate) Save

func (sc *StepCreate) Save(ctx context.Context) (*Step, error)

Save creates the Step in the database.

func (*StepCreate) SaveX

func (sc *StepCreate) SaveX(ctx context.Context) *Step

SaveX calls Save and panics if Save returns an error.

func (*StepCreate) SetNillableRecipeID

func (sc *StepCreate) SetNillableRecipeID(id *int) *StepCreate

SetNillableRecipeID sets the "recipe" edge to the Recipe entity by ID if the given value is not nil.

func (*StepCreate) SetRecipe

func (sc *StepCreate) SetRecipe(r *Recipe) *StepCreate

SetRecipe sets the "recipe" edge to the Recipe entity.

func (*StepCreate) SetRecipeID

func (sc *StepCreate) SetRecipeID(id int) *StepCreate

SetRecipeID sets the "recipe" edge to the Recipe entity by ID.

func (*StepCreate) SetText

func (sc *StepCreate) SetText(s string) *StepCreate

SetText sets the "text" field.

type StepCreateBulk

type StepCreateBulk struct {
	// contains filtered or unexported fields
}

StepCreateBulk is the builder for creating many Step entities in bulk.

func (*StepCreateBulk) Exec

func (scb *StepCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*StepCreateBulk) ExecX

func (scb *StepCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StepCreateBulk) Save

func (scb *StepCreateBulk) Save(ctx context.Context) ([]*Step, error)

Save creates the Step entities in the database.

func (*StepCreateBulk) SaveX

func (scb *StepCreateBulk) SaveX(ctx context.Context) []*Step

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

type StepDelete

type StepDelete struct {
	// contains filtered or unexported fields
}

StepDelete is the builder for deleting a Step entity.

func (*StepDelete) Exec

func (sd *StepDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*StepDelete) ExecX

func (sd *StepDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*StepDelete) Where

func (sd *StepDelete) Where(ps ...predicate.Step) *StepDelete

Where appends a list predicates to the StepDelete builder.

type StepDeleteOne

type StepDeleteOne struct {
	// contains filtered or unexported fields
}

StepDeleteOne is the builder for deleting a single Step entity.

func (*StepDeleteOne) Exec

func (sdo *StepDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*StepDeleteOne) ExecX

func (sdo *StepDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type StepEdges

type StepEdges struct {
	// Recipe holds the value of the recipe edge.
	Recipe *Recipe `json:"recipe,omitempty"`
	// contains filtered or unexported fields
}

StepEdges holds the relations/edges for other nodes in the graph.

func (StepEdges) RecipeOrErr

func (e StepEdges) RecipeOrErr() (*Recipe, error)

RecipeOrErr returns the Recipe value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type StepGroupBy

type StepGroupBy struct {
	// contains filtered or unexported fields
}

StepGroupBy is the group-by builder for Step entities.

func (*StepGroupBy) Aggregate

func (sgb *StepGroupBy) Aggregate(fns ...AggregateFunc) *StepGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*StepGroupBy) Bool

func (sgb *StepGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) BoolX

func (sgb *StepGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*StepGroupBy) Bools

func (sgb *StepGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) BoolsX

func (sgb *StepGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*StepGroupBy) Float64

func (sgb *StepGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) Float64X

func (sgb *StepGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*StepGroupBy) Float64s

func (sgb *StepGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) Float64sX

func (sgb *StepGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*StepGroupBy) Int

func (sgb *StepGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) IntX

func (sgb *StepGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*StepGroupBy) Ints

func (sgb *StepGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) IntsX

func (sgb *StepGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*StepGroupBy) Scan

func (sgb *StepGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*StepGroupBy) ScanX

func (sgb *StepGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*StepGroupBy) String

func (sgb *StepGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*StepGroupBy) StringX

func (sgb *StepGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*StepGroupBy) Strings

func (sgb *StepGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*StepGroupBy) StringsX

func (sgb *StepGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type StepMutation

type StepMutation struct {
	// contains filtered or unexported fields
}

StepMutation represents an operation that mutates the Step nodes in the graph.

func (*StepMutation) AddField

func (m *StepMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*StepMutation) AddedEdges

func (m *StepMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*StepMutation) AddedField

func (m *StepMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*StepMutation) AddedFields

func (m *StepMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*StepMutation) AddedIDs

func (m *StepMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*StepMutation) ClearEdge

func (m *StepMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*StepMutation) ClearField

func (m *StepMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*StepMutation) ClearRecipe

func (m *StepMutation) ClearRecipe()

ClearRecipe clears the "recipe" edge to the Recipe entity.

func (*StepMutation) ClearedEdges

func (m *StepMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*StepMutation) ClearedFields

func (m *StepMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (StepMutation) Client

func (m StepMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*StepMutation) EdgeCleared

func (m *StepMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*StepMutation) Field

func (m *StepMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*StepMutation) FieldCleared

func (m *StepMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*StepMutation) Fields

func (m *StepMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*StepMutation) ID

func (m *StepMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*StepMutation) OldField

func (m *StepMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*StepMutation) OldText

func (m *StepMutation) OldText(ctx context.Context) (v string, err error)

OldText returns the old "text" field's value of the Step entity. If the Step object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*StepMutation) Op

func (m *StepMutation) Op() Op

Op returns the operation name.

func (*StepMutation) RecipeCleared

func (m *StepMutation) RecipeCleared() bool

RecipeCleared reports if the "recipe" edge to the Recipe entity was cleared.

func (*StepMutation) RecipeID

func (m *StepMutation) RecipeID() (id int, exists bool)

RecipeID returns the "recipe" edge ID in the mutation.

func (*StepMutation) RecipeIDs

func (m *StepMutation) RecipeIDs() (ids []int)

RecipeIDs returns the "recipe" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use RecipeID instead. It exists only for internal usage by the builders.

func (*StepMutation) RemovedEdges

func (m *StepMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*StepMutation) RemovedIDs

func (m *StepMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*StepMutation) ResetEdge

func (m *StepMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*StepMutation) ResetField

func (m *StepMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*StepMutation) ResetRecipe

func (m *StepMutation) ResetRecipe()

ResetRecipe resets all changes to the "recipe" edge.

func (*StepMutation) ResetText

func (m *StepMutation) ResetText()

ResetText resets all changes to the "text" field.

func (*StepMutation) SetField

func (m *StepMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*StepMutation) SetRecipeID

func (m *StepMutation) SetRecipeID(id int)

SetRecipeID sets the "recipe" edge to the Recipe entity by id.

func (*StepMutation) SetText

func (m *StepMutation) SetText(s string)

SetText sets the "text" field.

func (*StepMutation) Text

func (m *StepMutation) Text() (r string, exists bool)

Text returns the value of the "text" field in the mutation.

func (StepMutation) Tx

func (m StepMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*StepMutation) Type

func (m *StepMutation) Type() string

Type returns the node type of this mutation (Step).

func (*StepMutation) Where

func (m *StepMutation) Where(ps ...predicate.Step)

Where appends a list predicates to the StepMutation builder.

type StepQuery

type StepQuery struct {
	// contains filtered or unexported fields
}

StepQuery is the builder for querying Step entities.

func (*StepQuery) All

func (sq *StepQuery) All(ctx context.Context) ([]*Step, error)

All executes the query and returns a list of Steps.

func (*StepQuery) AllX

func (sq *StepQuery) AllX(ctx context.Context) []*Step

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

func (*StepQuery) Clone

func (sq *StepQuery) Clone() *StepQuery

Clone returns a duplicate of the StepQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*StepQuery) Count

func (sq *StepQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*StepQuery) CountX

func (sq *StepQuery) CountX(ctx context.Context) int

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

func (*StepQuery) Exist

func (sq *StepQuery) Exist(ctx context.Context) (bool, error)

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

func (*StepQuery) ExistX

func (sq *StepQuery) ExistX(ctx context.Context) bool

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

func (*StepQuery) First

func (sq *StepQuery) First(ctx context.Context) (*Step, error)

First returns the first Step entity from the query. Returns a *NotFoundError when no Step was found.

func (*StepQuery) FirstID

func (sq *StepQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Step ID from the query. Returns a *NotFoundError when no Step ID was found.

func (*StepQuery) FirstIDX

func (sq *StepQuery) FirstIDX(ctx context.Context) int

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

func (*StepQuery) FirstX

func (sq *StepQuery) FirstX(ctx context.Context) *Step

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

func (*StepQuery) GroupBy

func (sq *StepQuery) GroupBy(field string, fields ...string) *StepGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Text string `json:"text,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Step.Query().
	GroupBy(step.FieldText).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*StepQuery) IDs

func (sq *StepQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Step IDs.

func (*StepQuery) IDsX

func (sq *StepQuery) IDsX(ctx context.Context) []int

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

func (*StepQuery) Limit

func (sq *StepQuery) Limit(limit int) *StepQuery

Limit adds a limit step to the query.

func (*StepQuery) Offset

func (sq *StepQuery) Offset(offset int) *StepQuery

Offset adds an offset step to the query.

func (*StepQuery) Only

func (sq *StepQuery) Only(ctx context.Context) (*Step, error)

Only returns a single Step entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Step entity is not found. Returns a *NotFoundError when no Step entities are found.

func (*StepQuery) OnlyID

func (sq *StepQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Step ID in the query. Returns a *NotSingularError when exactly one Step ID is not found. Returns a *NotFoundError when no entities are found.

func (*StepQuery) OnlyIDX

func (sq *StepQuery) OnlyIDX(ctx context.Context) int

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

func (*StepQuery) OnlyX

func (sq *StepQuery) OnlyX(ctx context.Context) *Step

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

func (*StepQuery) Order

func (sq *StepQuery) Order(o ...OrderFunc) *StepQuery

Order adds an order step to the query.

func (*StepQuery) QueryRecipe

func (sq *StepQuery) QueryRecipe() *RecipeQuery

QueryRecipe chains the current query on the "recipe" edge.

func (*StepQuery) Select

func (sq *StepQuery) Select(fields ...string) *StepSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Text string `json:"text,omitempty"`
}

client.Step.Query().
	Select(step.FieldText).
	Scan(ctx, &v)

func (*StepQuery) Unique

func (sq *StepQuery) Unique(unique bool) *StepQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*StepQuery) Where

func (sq *StepQuery) Where(ps ...predicate.Step) *StepQuery

Where adds a new predicate for the StepQuery builder.

func (*StepQuery) WithRecipe

func (sq *StepQuery) WithRecipe(opts ...func(*RecipeQuery)) *StepQuery

WithRecipe tells the query-builder to eager-load the nodes that are connected to the "recipe" edge. The optional arguments are used to configure the query builder of the edge.

type StepSelect

type StepSelect struct {
	*StepQuery
	// contains filtered or unexported fields
}

StepSelect is the builder for selecting fields of Step entities.

func (*StepSelect) Bool

func (ss *StepSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*StepSelect) BoolX

func (ss *StepSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*StepSelect) Bools

func (ss *StepSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*StepSelect) BoolsX

func (ss *StepSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*StepSelect) Float64

func (ss *StepSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*StepSelect) Float64X

func (ss *StepSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*StepSelect) Float64s

func (ss *StepSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*StepSelect) Float64sX

func (ss *StepSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*StepSelect) Int

func (ss *StepSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*StepSelect) IntX

func (ss *StepSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*StepSelect) Ints

func (ss *StepSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*StepSelect) IntsX

func (ss *StepSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*StepSelect) Scan

func (ss *StepSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*StepSelect) ScanX

func (ss *StepSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*StepSelect) String

func (ss *StepSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*StepSelect) StringX

func (ss *StepSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*StepSelect) Strings

func (ss *StepSelect) Strings(ctx context.Context) ([]string, error)

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

func (*StepSelect) StringsX

func (ss *StepSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type StepUpdate

type StepUpdate struct {
	// contains filtered or unexported fields
}

StepUpdate is the builder for updating Step entities.

func (*StepUpdate) ClearRecipe

func (su *StepUpdate) ClearRecipe() *StepUpdate

ClearRecipe clears the "recipe" edge to the Recipe entity.

func (*StepUpdate) Exec

func (su *StepUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*StepUpdate) ExecX

func (su *StepUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StepUpdate) Mutation

func (su *StepUpdate) Mutation() *StepMutation

Mutation returns the StepMutation object of the builder.

func (*StepUpdate) Save

func (su *StepUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*StepUpdate) SaveX

func (su *StepUpdate) SaveX(ctx context.Context) int

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

func (*StepUpdate) SetNillableRecipeID

func (su *StepUpdate) SetNillableRecipeID(id *int) *StepUpdate

SetNillableRecipeID sets the "recipe" edge to the Recipe entity by ID if the given value is not nil.

func (*StepUpdate) SetRecipe

func (su *StepUpdate) SetRecipe(r *Recipe) *StepUpdate

SetRecipe sets the "recipe" edge to the Recipe entity.

func (*StepUpdate) SetRecipeID

func (su *StepUpdate) SetRecipeID(id int) *StepUpdate

SetRecipeID sets the "recipe" edge to the Recipe entity by ID.

func (*StepUpdate) SetText

func (su *StepUpdate) SetText(s string) *StepUpdate

SetText sets the "text" field.

func (*StepUpdate) Where

func (su *StepUpdate) Where(ps ...predicate.Step) *StepUpdate

Where appends a list predicates to the StepUpdate builder.

type StepUpdateOne

type StepUpdateOne struct {
	// contains filtered or unexported fields
}

StepUpdateOne is the builder for updating a single Step entity.

func (*StepUpdateOne) ClearRecipe

func (suo *StepUpdateOne) ClearRecipe() *StepUpdateOne

ClearRecipe clears the "recipe" edge to the Recipe entity.

func (*StepUpdateOne) Exec

func (suo *StepUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*StepUpdateOne) ExecX

func (suo *StepUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*StepUpdateOne) Mutation

func (suo *StepUpdateOne) Mutation() *StepMutation

Mutation returns the StepMutation object of the builder.

func (*StepUpdateOne) Save

func (suo *StepUpdateOne) Save(ctx context.Context) (*Step, error)

Save executes the query and returns the updated Step entity.

func (*StepUpdateOne) SaveX

func (suo *StepUpdateOne) SaveX(ctx context.Context) *Step

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

func (*StepUpdateOne) Select

func (suo *StepUpdateOne) Select(field string, fields ...string) *StepUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*StepUpdateOne) SetNillableRecipeID

func (suo *StepUpdateOne) SetNillableRecipeID(id *int) *StepUpdateOne

SetNillableRecipeID sets the "recipe" edge to the Recipe entity by ID if the given value is not nil.

func (*StepUpdateOne) SetRecipe

func (suo *StepUpdateOne) SetRecipe(r *Recipe) *StepUpdateOne

SetRecipe sets the "recipe" edge to the Recipe entity.

func (*StepUpdateOne) SetRecipeID

func (suo *StepUpdateOne) SetRecipeID(id int) *StepUpdateOne

SetRecipeID sets the "recipe" edge to the Recipe entity by ID.

func (*StepUpdateOne) SetText

func (suo *StepUpdateOne) SetText(s string) *StepUpdateOne

SetText sets the "text" field.

type Steps

type Steps []*Step

Steps is a parsable slice of Step.

type Tx

type Tx struct {

	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Ingredient is the client for interacting with the Ingredient builders.
	Ingredient *IngredientClient
	// Recipe is the client for interacting with the Recipe builders.
	Recipe *RecipeClient
	// RecipeIngredient is the client for interacting with the RecipeIngredient builders.
	RecipeIngredient *RecipeIngredientClient
	// Step is the client for interacting with the Step builders.
	Step *StepClient
	// 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 TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

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

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

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"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryRecipes

func (u *User) QueryRecipes() *RecipeQuery

QueryRecipes queries the "recipes" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*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) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

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

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryRecipes

func (c *UserClient) QueryRecipes(u *User) *RecipeQuery

QueryRecipes queries the recipes edge of a 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.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddRecipeIDs

func (uc *UserCreate) AddRecipeIDs(ids ...int) *UserCreate

AddRecipeIDs adds the "recipes" edge to the Recipe entity by IDs.

func (*UserCreate) AddRecipes

func (uc *UserCreate) AddRecipes(r ...*Recipe) *UserCreate

AddRecipes adds the "recipes" edges to the Recipe entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

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.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

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 appends a list predicates to the UserDelete 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 UserEdges

type UserEdges struct {
	// Recipes holds the value of the recipes edge.
	Recipes []*Recipe `json:"recipes,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) RecipesOrErr

func (e UserEdges) RecipesOrErr() ([]*Recipe, error)

RecipesOrErr returns the Recipes value or an error if the edge was not loaded in eager-loading.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

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 executing a group-by query 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) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, 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 executing a group-by query 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) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, 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 executing a group-by query 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 scans 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) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, 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 executing a group-by query 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 UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddRecipeIDs

func (m *UserMutation) AddRecipeIDs(ids ...int)

AddRecipeIDs adds the "recipes" edge to the Recipe entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearRecipes

func (m *UserMutation) ClearRecipes()

ClearRecipes clears the "recipes" edge to the Recipe entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RecipesCleared

func (m *UserMutation) RecipesCleared() bool

RecipesCleared reports if the "recipes" edge to the Recipe entity was cleared.

func (*UserMutation) RecipesIDs

func (m *UserMutation) RecipesIDs() (ids []int)

RecipesIDs returns the "recipes" edge IDs in the mutation.

func (*UserMutation) RemoveRecipeIDs

func (m *UserMutation) RemoveRecipeIDs(ids ...int)

RemoveRecipeIDs removes the "recipes" edge to the Recipe entity by IDs.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedRecipesIDs

func (m *UserMutation) RemovedRecipesIDs() (ids []int)

RemovedRecipes returns the removed IDs of the "recipes" edge to the Recipe entity.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetRecipes

func (m *UserMutation) ResetRecipes()

ResetRecipes resets all changes to the "recipes" edge.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

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 UserQuery 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 from the query. Returns a *NotFoundError 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 from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

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

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

func (*UserQuery) FirstX

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

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

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 a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one User entity is not found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

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

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when exactly one User ID is not found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

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

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

func (*UserQuery) OnlyX

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

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

func (*UserQuery) Order

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

Order adds an order step to the query.

func (*UserQuery) QueryRecipes

func (uq *UserQuery) QueryRecipes() *RecipeQuery

QueryRecipes chains the current query on the "recipes" edge.

func (*UserQuery) Select

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

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

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

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithRecipes

func (uq *UserQuery) WithRecipes(opts ...func(*RecipeQuery)) *UserQuery

WithRecipes tells the query-builder to eager-load the nodes that are connected to the "recipes" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a 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) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a 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) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a 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 scans 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) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

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

Strings returns list of strings from a 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) AddRecipeIDs

func (uu *UserUpdate) AddRecipeIDs(ids ...int) *UserUpdate

AddRecipeIDs adds the "recipes" edge to the Recipe entity by IDs.

func (*UserUpdate) AddRecipes

func (uu *UserUpdate) AddRecipes(r ...*Recipe) *UserUpdate

AddRecipes adds the "recipes" edges to the Recipe entity.

func (*UserUpdate) ClearRecipes

func (uu *UserUpdate) ClearRecipes() *UserUpdate

ClearRecipes clears all "recipes" edges to the Recipe entity.

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

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveRecipeIDs

func (uu *UserUpdate) RemoveRecipeIDs(ids ...int) *UserUpdate

RemoveRecipeIDs removes the "recipes" edge to Recipe entities by IDs.

func (*UserUpdate) RemoveRecipes

func (uu *UserUpdate) RemoveRecipes(r ...*Recipe) *UserUpdate

RemoveRecipes removes "recipes" edges to Recipe entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddRecipeIDs

func (uuo *UserUpdateOne) AddRecipeIDs(ids ...int) *UserUpdateOne

AddRecipeIDs adds the "recipes" edge to the Recipe entity by IDs.

func (*UserUpdateOne) AddRecipes

func (uuo *UserUpdateOne) AddRecipes(r ...*Recipe) *UserUpdateOne

AddRecipes adds the "recipes" edges to the Recipe entity.

func (*UserUpdateOne) ClearRecipes

func (uuo *UserUpdateOne) ClearRecipes() *UserUpdateOne

ClearRecipes clears all "recipes" edges to the Recipe 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) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveRecipeIDs

func (uuo *UserUpdateOne) RemoveRecipeIDs(ids ...int) *UserUpdateOne

RemoveRecipeIDs removes the "recipes" edge to Recipe entities by IDs.

func (*UserUpdateOne) RemoveRecipes

func (uuo *UserUpdateOne) RemoveRecipes(r ...*Recipe) *UserUpdateOne

RemoveRecipes removes "recipes" edges to Recipe entities.

func (*UserUpdateOne) Save

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

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

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

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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