Documentation
¶
Index ¶
- Constants
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- type AggregateFunc
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type Recipe
- type RecipeClient
- func (c *RecipeClient) Create() *RecipeCreate
- func (c *RecipeClient) CreateBulk(builders ...*RecipeCreate) *RecipeCreateBulk
- func (c *RecipeClient) Delete() *RecipeDelete
- func (c *RecipeClient) DeleteOne(r *Recipe) *RecipeDeleteOne
- func (c *RecipeClient) DeleteOneID(id uuid.UUID) *RecipeDeleteOne
- func (c *RecipeClient) Get(ctx context.Context, id uuid.UUID) (*Recipe, error)
- func (c *RecipeClient) GetX(ctx context.Context, id uuid.UUID) *Recipe
- func (c *RecipeClient) Hooks() []Hook
- func (c *RecipeClient) Query() *RecipeQuery
- func (c *RecipeClient) Update() *RecipeUpdate
- func (c *RecipeClient) UpdateOne(r *Recipe) *RecipeUpdateOne
- func (c *RecipeClient) UpdateOneID(id uuid.UUID) *RecipeUpdateOne
- func (c *RecipeClient) Use(hooks ...Hook)
- type RecipeCreate
- func (rc *RecipeCreate) Exec(ctx context.Context) error
- func (rc *RecipeCreate) ExecX(ctx context.Context)
- func (rc *RecipeCreate) Mutation() *RecipeMutation
- func (rc *RecipeCreate) Save(ctx context.Context) (*Recipe, error)
- func (rc *RecipeCreate) SaveX(ctx context.Context) *Recipe
- func (rc *RecipeCreate) SetID(u uuid.UUID) *RecipeCreate
- func (rc *RecipeCreate) SetNillablePlanned(b *bool) *RecipeCreate
- func (rc *RecipeCreate) SetPlanned(b bool) *RecipeCreate
- func (rc *RecipeCreate) SetTitle(s string) *RecipeCreate
- type RecipeCreateBulk
- type RecipeDelete
- type RecipeDeleteOne
- type RecipeGroupBy
- func (rgb *RecipeGroupBy) Aggregate(fns ...AggregateFunc) *RecipeGroupBy
- func (rgb *RecipeGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (rgb *RecipeGroupBy) BoolX(ctx context.Context) bool
- func (rgb *RecipeGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (rgb *RecipeGroupBy) BoolsX(ctx context.Context) []bool
- func (rgb *RecipeGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (rgb *RecipeGroupBy) Float64X(ctx context.Context) float64
- func (rgb *RecipeGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (rgb *RecipeGroupBy) Float64sX(ctx context.Context) []float64
- func (rgb *RecipeGroupBy) Int(ctx context.Context) (_ int, err error)
- func (rgb *RecipeGroupBy) IntX(ctx context.Context) int
- func (rgb *RecipeGroupBy) Ints(ctx context.Context) ([]int, error)
- func (rgb *RecipeGroupBy) IntsX(ctx context.Context) []int
- func (rgb *RecipeGroupBy) Scan(ctx context.Context, v interface{}) error
- func (rgb *RecipeGroupBy) ScanX(ctx context.Context, v interface{})
- func (rgb *RecipeGroupBy) String(ctx context.Context) (_ string, err error)
- func (rgb *RecipeGroupBy) StringX(ctx context.Context) string
- func (rgb *RecipeGroupBy) Strings(ctx context.Context) ([]string, error)
- func (rgb *RecipeGroupBy) StringsX(ctx context.Context) []string
- type RecipeMutation
- func (m *RecipeMutation) AddField(name string, value ent.Value) error
- func (m *RecipeMutation) AddedEdges() []string
- func (m *RecipeMutation) AddedField(name string) (ent.Value, bool)
- func (m *RecipeMutation) AddedFields() []string
- func (m *RecipeMutation) AddedIDs(name string) []ent.Value
- func (m *RecipeMutation) ClearEdge(name string) error
- func (m *RecipeMutation) ClearField(name string) error
- func (m *RecipeMutation) ClearedEdges() []string
- func (m *RecipeMutation) ClearedFields() []string
- func (m RecipeMutation) Client() *Client
- func (m *RecipeMutation) EdgeCleared(name string) bool
- func (m *RecipeMutation) Field(name string) (ent.Value, bool)
- func (m *RecipeMutation) FieldCleared(name string) bool
- func (m *RecipeMutation) Fields() []string
- func (m *RecipeMutation) ID() (id uuid.UUID, exists bool)
- func (m *RecipeMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *RecipeMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *RecipeMutation) OldPlanned(ctx context.Context) (v bool, err error)
- func (m *RecipeMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *RecipeMutation) Op() Op
- func (m *RecipeMutation) Planned() (r bool, exists bool)
- func (m *RecipeMutation) RemovedEdges() []string
- func (m *RecipeMutation) RemovedIDs(name string) []ent.Value
- func (m *RecipeMutation) ResetEdge(name string) error
- func (m *RecipeMutation) ResetField(name string) error
- func (m *RecipeMutation) ResetPlanned()
- func (m *RecipeMutation) ResetTitle()
- func (m *RecipeMutation) SetField(name string, value ent.Value) error
- func (m *RecipeMutation) SetID(id uuid.UUID)
- func (m *RecipeMutation) SetPlanned(b bool)
- func (m *RecipeMutation) SetTitle(s string)
- func (m *RecipeMutation) Title() (r string, exists bool)
- func (m RecipeMutation) Tx() (*Tx, error)
- func (m *RecipeMutation) Type() string
- func (m *RecipeMutation) Where(ps ...predicate.Recipe)
- type RecipeQuery
- func (rq *RecipeQuery) All(ctx context.Context) ([]*Recipe, error)
- func (rq *RecipeQuery) AllX(ctx context.Context) []*Recipe
- func (rq *RecipeQuery) Clone() *RecipeQuery
- func (rq *RecipeQuery) Count(ctx context.Context) (int, error)
- func (rq *RecipeQuery) CountX(ctx context.Context) int
- func (rq *RecipeQuery) Exist(ctx context.Context) (bool, error)
- func (rq *RecipeQuery) ExistX(ctx context.Context) bool
- func (rq *RecipeQuery) First(ctx context.Context) (*Recipe, error)
- func (rq *RecipeQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (rq *RecipeQuery) FirstIDX(ctx context.Context) uuid.UUID
- func (rq *RecipeQuery) FirstX(ctx context.Context) *Recipe
- func (rq *RecipeQuery) GroupBy(field string, fields ...string) *RecipeGroupBy
- func (rq *RecipeQuery) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (rq *RecipeQuery) IDsX(ctx context.Context) []uuid.UUID
- func (rq *RecipeQuery) Limit(limit int) *RecipeQuery
- func (rq *RecipeQuery) Offset(offset int) *RecipeQuery
- func (rq *RecipeQuery) Only(ctx context.Context) (*Recipe, error)
- func (rq *RecipeQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (rq *RecipeQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (rq *RecipeQuery) OnlyX(ctx context.Context) *Recipe
- func (rq *RecipeQuery) Order(o ...OrderFunc) *RecipeQuery
- func (rq *RecipeQuery) Select(fields ...string) *RecipeSelect
- func (rq *RecipeQuery) Unique(unique bool) *RecipeQuery
- func (rq *RecipeQuery) Where(ps ...predicate.Recipe) *RecipeQuery
- type RecipeSelect
- func (rs *RecipeSelect) Bool(ctx context.Context) (_ bool, err error)
- func (rs *RecipeSelect) BoolX(ctx context.Context) bool
- func (rs *RecipeSelect) Bools(ctx context.Context) ([]bool, error)
- func (rs *RecipeSelect) BoolsX(ctx context.Context) []bool
- func (rs *RecipeSelect) Float64(ctx context.Context) (_ float64, err error)
- func (rs *RecipeSelect) Float64X(ctx context.Context) float64
- func (rs *RecipeSelect) Float64s(ctx context.Context) ([]float64, error)
- func (rs *RecipeSelect) Float64sX(ctx context.Context) []float64
- func (rs *RecipeSelect) Int(ctx context.Context) (_ int, err error)
- func (rs *RecipeSelect) IntX(ctx context.Context) int
- func (rs *RecipeSelect) Ints(ctx context.Context) ([]int, error)
- func (rs *RecipeSelect) IntsX(ctx context.Context) []int
- func (rs *RecipeSelect) Scan(ctx context.Context, v interface{}) error
- func (rs *RecipeSelect) ScanX(ctx context.Context, v interface{})
- func (rs *RecipeSelect) String(ctx context.Context) (_ string, err error)
- func (rs *RecipeSelect) StringX(ctx context.Context) string
- func (rs *RecipeSelect) Strings(ctx context.Context) ([]string, error)
- func (rs *RecipeSelect) StringsX(ctx context.Context) []string
- type RecipeUpdate
- func (ru *RecipeUpdate) Exec(ctx context.Context) error
- func (ru *RecipeUpdate) ExecX(ctx context.Context)
- func (ru *RecipeUpdate) Mutation() *RecipeMutation
- func (ru *RecipeUpdate) Save(ctx context.Context) (int, error)
- func (ru *RecipeUpdate) SaveX(ctx context.Context) int
- func (ru *RecipeUpdate) SetNillablePlanned(b *bool) *RecipeUpdate
- func (ru *RecipeUpdate) SetPlanned(b bool) *RecipeUpdate
- func (ru *RecipeUpdate) SetTitle(s string) *RecipeUpdate
- func (ru *RecipeUpdate) Where(ps ...predicate.Recipe) *RecipeUpdate
- type RecipeUpdateOne
- func (ruo *RecipeUpdateOne) Exec(ctx context.Context) error
- func (ruo *RecipeUpdateOne) ExecX(ctx context.Context)
- func (ruo *RecipeUpdateOne) Mutation() *RecipeMutation
- func (ruo *RecipeUpdateOne) Save(ctx context.Context) (*Recipe, error)
- func (ruo *RecipeUpdateOne) SaveX(ctx context.Context) *Recipe
- func (ruo *RecipeUpdateOne) Select(field string, fields ...string) *RecipeUpdateOne
- func (ruo *RecipeUpdateOne) SetNillablePlanned(b *bool) *RecipeUpdateOne
- func (ruo *RecipeUpdateOne) SetPlanned(b bool) *RecipeUpdateOne
- func (ruo *RecipeUpdateOne) SetTitle(s string) *RecipeUpdateOne
- type Recipes
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- type ValidationError
- type Value
Constants ¶
const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeRecipe = "Recipe" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Recipe is the client for interacting with the Recipe builders. Recipe *RecipeClient // contains filtered or unexported fields }
Client is the client that holds all ent builders.
func FromContext ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func (*Client) Debug ¶
Debug returns a new debug-client. It's used to get verbose logging on specific operations.
client.Debug(). Recipe. Query(). Count(ctx)
type CommitFunc ¶
The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.
type CommitHook ¶
CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:
hook := func(next ent.Committer) ent.Committer { return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Commit(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type ConstraintError ¶
type ConstraintError struct {
// contains filtered or unexported fields
}
ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.
func (ConstraintError) Error ¶
func (e ConstraintError) Error() string
Error implements the error interface.
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Error implements the error interface.
type NotLoadedError ¶
type NotLoadedError struct {
// contains filtered or unexported fields
}
NotLoadedError returns when trying to get a node that was not loaded by the query.
func (*NotLoadedError) Error ¶
func (e *NotLoadedError) Error() string
Error implements the error interface.
type NotSingularError ¶
type NotSingularError struct {
// contains filtered or unexported fields
}
NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
func (*NotSingularError) Error ¶
func (e *NotSingularError) Error() string
Error implements the error interface.
type Recipe ¶
type Recipe struct { // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // Planned holds the value of the "planned" field. Planned bool `json:"planned,omitempty"` // contains filtered or unexported fields }
Recipe is the model entity for the Recipe schema.
func (*Recipe) Unwrap ¶
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 uuid.UUID) *RecipeDeleteOne
DeleteOneID returns a delete builder for the given id.
func (*RecipeClient) Query ¶
func (c *RecipeClient) Query() *RecipeQuery
Query returns a query builder for 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 uuid.UUID) *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) 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) SetID ¶
func (rc *RecipeCreate) SetID(u uuid.UUID) *RecipeCreate
SetID sets the "id" field.
func (*RecipeCreate) SetNillablePlanned ¶
func (rc *RecipeCreate) SetNillablePlanned(b *bool) *RecipeCreate
SetNillablePlanned sets the "planned" field if the given value is not nil.
func (*RecipeCreate) SetPlanned ¶
func (rc *RecipeCreate) SetPlanned(b bool) *RecipeCreate
SetPlanned sets the "planned" field.
func (*RecipeCreate) SetTitle ¶
func (rc *RecipeCreate) SetTitle(s string) *RecipeCreate
SetTitle sets the "title" 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.
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 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.
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) 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) 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) 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 uuid.UUID, 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) IDs ¶
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*RecipeMutation) OldField ¶
OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.
func (*RecipeMutation) OldPlanned ¶
func (m *RecipeMutation) OldPlanned(ctx context.Context) (v bool, err error)
OldPlanned returns the old "planned" 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) OldTitle ¶
func (m *RecipeMutation) OldTitle(ctx context.Context) (v string, err error)
OldTitle returns the old "title" 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) Planned ¶
func (m *RecipeMutation) Planned() (r bool, exists bool)
Planned returns the value of the "planned" field in the mutation.
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) 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) ResetPlanned ¶
func (m *RecipeMutation) ResetPlanned()
ResetPlanned resets all changes to the "planned" field.
func (*RecipeMutation) ResetTitle ¶
func (m *RecipeMutation) ResetTitle()
ResetTitle resets all changes to the "title" field.
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) SetID ¶
func (m *RecipeMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Recipe entities.
func (*RecipeMutation) SetPlanned ¶
func (m *RecipeMutation) SetPlanned(b bool)
SetPlanned sets the "planned" field.
func (*RecipeMutation) SetTitle ¶
func (m *RecipeMutation) SetTitle(s string)
SetTitle sets the "title" field.
func (*RecipeMutation) Title ¶
func (m *RecipeMutation) Title() (r string, exists bool)
Title returns the value of the "title" field 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 ¶
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) uuid.UUID
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 { Title string `json:"title,omitempty"` Count int `json:"count,omitempty"` } client.Recipe.Query(). GroupBy(recipe.FieldTitle). Aggregate(ent.Count()). Scan(ctx, &v)
func (*RecipeQuery) IDsX ¶
func (rq *RecipeQuery) IDsX(ctx context.Context) []uuid.UUID
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 more than one Recipe entity is found. Returns a *NotFoundError when no Recipe entities are found.
func (*RecipeQuery) OnlyID ¶
OnlyID is like Only, but returns the only Recipe ID in the query. Returns a *NotSingularError when more than one Recipe ID is found. Returns a *NotFoundError when no entities are found.
func (*RecipeQuery) OnlyIDX ¶
func (rq *RecipeQuery) OnlyIDX(ctx context.Context) uuid.UUID
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) 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 { Title string `json:"title,omitempty"` } client.Recipe.Query(). Select(recipe.FieldTitle). 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.
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.
type RecipeUpdate ¶
type RecipeUpdate struct {
// contains filtered or unexported fields
}
RecipeUpdate is the builder for updating Recipe entities.
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) 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) SetNillablePlanned ¶
func (ru *RecipeUpdate) SetNillablePlanned(b *bool) *RecipeUpdate
SetNillablePlanned sets the "planned" field if the given value is not nil.
func (*RecipeUpdate) SetPlanned ¶
func (ru *RecipeUpdate) SetPlanned(b bool) *RecipeUpdate
SetPlanned sets the "planned" field.
func (*RecipeUpdate) SetTitle ¶
func (ru *RecipeUpdate) SetTitle(s string) *RecipeUpdate
SetTitle sets the "title" 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) 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) 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) SetNillablePlanned ¶
func (ruo *RecipeUpdateOne) SetNillablePlanned(b *bool) *RecipeUpdateOne
SetNillablePlanned sets the "planned" field if the given value is not nil.
func (*RecipeUpdateOne) SetPlanned ¶
func (ruo *RecipeUpdateOne) SetPlanned(b bool) *RecipeUpdateOne
SetPlanned sets the "planned" field.
func (*RecipeUpdateOne) SetTitle ¶
func (ruo *RecipeUpdateOne) SetTitle(s string) *RecipeUpdateOne
SetTitle sets the "title" field.
type RollbackFunc ¶
The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.
type RollbackHook ¶
type RollbackHook func(Rollbacker) Rollbacker
RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:
hook := func(next ent.Rollbacker) ent.Rollbacker { return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error { // Do some stuff before. if err := next.Rollback(ctx, tx); err != nil { return err } // Do some stuff after. return nil }) }
type Rollbacker ¶
Rollbacker is the interface that wraps the Rollback method.
type Tx ¶
type Tx struct { // Recipe is the client for interacting with the Recipe builders. Recipe *RecipeClient // contains filtered or unexported fields }
Tx is a transactional client that is created by calling Client.Tx().
func TxFromContext ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
type ValidationError ¶
type ValidationError struct { Name string // Field or edge name. // contains filtered or unexported fields }
ValidationError returns when validating a field or edge 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.