ent

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 23 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.
	TypeBadge     = "Badge"
	TypePet       = "Pet"
	TypePlayGroup = "PlayGroup"
	TypeToy       = "Toy"
)

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 Badge added in v0.3.2

type Badge struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Color holds the value of the "color" field.
	Color badge.Color `json:"color,omitempty"`
	// Material holds the value of the "material" field.
	Material badge.Material `json:"material,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BadgeQuery when eager-loading is set.
	Edges BadgeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Badge is the model entity for the Badge schema.

func (*Badge) QueryWearer added in v0.3.2

func (b *Badge) QueryWearer() *PetQuery

QueryWearer queries the "wearer" edge of the Badge entity.

func (*Badge) String added in v0.3.2

func (b *Badge) String() string

String implements the fmt.Stringer.

func (*Badge) Unwrap added in v0.3.2

func (b *Badge) Unwrap() *Badge

Unwrap unwraps the Badge 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 (*Badge) Update added in v0.3.2

func (b *Badge) Update() *BadgeUpdateOne

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

type BadgeClient added in v0.3.2

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

BadgeClient is a client for the Badge schema.

func NewBadgeClient added in v0.3.2

func NewBadgeClient(c config) *BadgeClient

NewBadgeClient returns a client for the Badge from the given config.

func (*BadgeClient) Create added in v0.3.2

func (c *BadgeClient) Create() *BadgeCreate

Create returns a create builder for Badge.

func (*BadgeClient) CreateBulk added in v0.3.2

func (c *BadgeClient) CreateBulk(builders ...*BadgeCreate) *BadgeCreateBulk

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

func (*BadgeClient) Delete added in v0.3.2

func (c *BadgeClient) Delete() *BadgeDelete

Delete returns a delete builder for Badge.

func (*BadgeClient) DeleteOne added in v0.3.2

func (c *BadgeClient) DeleteOne(b *Badge) *BadgeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*BadgeClient) DeleteOneID added in v0.3.2

func (c *BadgeClient) DeleteOneID(id int) *BadgeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*BadgeClient) Get added in v0.3.2

func (c *BadgeClient) Get(ctx context.Context, id int) (*Badge, error)

Get returns a Badge entity by its id.

func (*BadgeClient) GetX added in v0.3.2

func (c *BadgeClient) GetX(ctx context.Context, id int) *Badge

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

func (*BadgeClient) Hooks added in v0.3.2

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

Hooks returns the client hooks.

func (*BadgeClient) Query added in v0.3.2

func (c *BadgeClient) Query() *BadgeQuery

Query returns a query builder for Badge.

func (*BadgeClient) QueryWearer added in v0.3.2

func (c *BadgeClient) QueryWearer(b *Badge) *PetQuery

QueryWearer queries the wearer edge of a Badge.

func (*BadgeClient) Update added in v0.3.2

func (c *BadgeClient) Update() *BadgeUpdate

Update returns an update builder for Badge.

func (*BadgeClient) UpdateOne added in v0.3.2

func (c *BadgeClient) UpdateOne(b *Badge) *BadgeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BadgeClient) UpdateOneID added in v0.3.2

func (c *BadgeClient) UpdateOneID(id int) *BadgeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BadgeClient) Use added in v0.3.2

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

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

type BadgeCreate added in v0.3.2

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

BadgeCreate is the builder for creating a Badge entity.

func (*BadgeCreate) Exec added in v0.3.2

func (bc *BadgeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeCreate) ExecX added in v0.3.2

func (bc *BadgeCreate) ExecX(ctx context.Context)

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

func (*BadgeCreate) Mutation added in v0.3.2

func (bc *BadgeCreate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeCreate) Save added in v0.3.2

func (bc *BadgeCreate) Save(ctx context.Context) (*Badge, error)

Save creates the Badge in the database.

func (*BadgeCreate) SaveX added in v0.3.2

func (bc *BadgeCreate) SaveX(ctx context.Context) *Badge

SaveX calls Save and panics if Save returns an error.

func (*BadgeCreate) SetColor added in v0.3.2

func (bc *BadgeCreate) SetColor(b badge.Color) *BadgeCreate

SetColor sets the "color" field.

func (*BadgeCreate) SetMaterial added in v0.3.2

func (bc *BadgeCreate) SetMaterial(b badge.Material) *BadgeCreate

SetMaterial sets the "material" field.

func (*BadgeCreate) SetNillableWearerID added in v0.3.2

func (bc *BadgeCreate) SetNillableWearerID(id *int) *BadgeCreate

SetNillableWearerID sets the "wearer" edge to the Pet entity by ID if the given value is not nil.

func (*BadgeCreate) SetWearer added in v0.3.2

func (bc *BadgeCreate) SetWearer(p *Pet) *BadgeCreate

SetWearer sets the "wearer" edge to the Pet entity.

func (*BadgeCreate) SetWearerID added in v0.3.2

func (bc *BadgeCreate) SetWearerID(id int) *BadgeCreate

SetWearerID sets the "wearer" edge to the Pet entity by ID.

type BadgeCreateBulk added in v0.3.2

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

BadgeCreateBulk is the builder for creating many Badge entities in bulk.

func (*BadgeCreateBulk) Exec added in v0.3.2

func (bcb *BadgeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeCreateBulk) ExecX added in v0.3.2

func (bcb *BadgeCreateBulk) ExecX(ctx context.Context)

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

func (*BadgeCreateBulk) Save added in v0.3.2

func (bcb *BadgeCreateBulk) Save(ctx context.Context) ([]*Badge, error)

Save creates the Badge entities in the database.

func (*BadgeCreateBulk) SaveX added in v0.3.2

func (bcb *BadgeCreateBulk) SaveX(ctx context.Context) []*Badge

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

type BadgeDelete added in v0.3.2

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

BadgeDelete is the builder for deleting a Badge entity.

func (*BadgeDelete) Exec added in v0.3.2

func (bd *BadgeDelete) Exec(ctx context.Context) (int, error)

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

func (*BadgeDelete) ExecX added in v0.3.2

func (bd *BadgeDelete) ExecX(ctx context.Context) int

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

func (*BadgeDelete) Where added in v0.3.2

func (bd *BadgeDelete) Where(ps ...predicate.Badge) *BadgeDelete

Where appends a list predicates to the BadgeDelete builder.

type BadgeDeleteOne added in v0.3.2

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

BadgeDeleteOne is the builder for deleting a single Badge entity.

func (*BadgeDeleteOne) Exec added in v0.3.2

func (bdo *BadgeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BadgeDeleteOne) ExecX added in v0.3.2

func (bdo *BadgeDeleteOne) ExecX(ctx context.Context)

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

type BadgeEdges added in v0.3.2

type BadgeEdges struct {
	// Wearer holds the value of the wearer edge.
	Wearer *Pet `json:"wearer,omitempty"`
	// contains filtered or unexported fields
}

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

func (BadgeEdges) WearerOrErr added in v0.3.2

func (e BadgeEdges) WearerOrErr() (*Pet, error)

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

type BadgeGroupBy added in v0.3.2

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

BadgeGroupBy is the group-by builder for Badge entities.

func (*BadgeGroupBy) Aggregate added in v0.3.2

func (bgb *BadgeGroupBy) Aggregate(fns ...AggregateFunc) *BadgeGroupBy

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

func (*BadgeGroupBy) Bool added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) BoolX added in v0.3.2

func (bgb *BadgeGroupBy) BoolX(ctx context.Context) bool

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

func (*BadgeGroupBy) Bools added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) BoolsX added in v0.3.2

func (bgb *BadgeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*BadgeGroupBy) Float64 added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) Float64X added in v0.3.2

func (bgb *BadgeGroupBy) Float64X(ctx context.Context) float64

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

func (*BadgeGroupBy) Float64s added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) Float64sX added in v0.3.2

func (bgb *BadgeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*BadgeGroupBy) Int added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) IntX added in v0.3.2

func (bgb *BadgeGroupBy) IntX(ctx context.Context) int

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

func (*BadgeGroupBy) Ints added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) IntsX added in v0.3.2

func (bgb *BadgeGroupBy) IntsX(ctx context.Context) []int

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

func (*BadgeGroupBy) Scan added in v0.3.2

func (bgb *BadgeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*BadgeGroupBy) ScanX added in v0.3.2

func (bgb *BadgeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*BadgeGroupBy) String added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) StringX added in v0.3.2

func (bgb *BadgeGroupBy) StringX(ctx context.Context) string

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

func (*BadgeGroupBy) Strings added in v0.3.2

func (bgb *BadgeGroupBy) 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 (*BadgeGroupBy) StringsX added in v0.3.2

func (bgb *BadgeGroupBy) StringsX(ctx context.Context) []string

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

type BadgeMutation added in v0.3.2

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

BadgeMutation represents an operation that mutates the Badge nodes in the graph.

func (*BadgeMutation) AddField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) AddedEdges added in v0.3.2

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

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

func (*BadgeMutation) AddedField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) AddedFields added in v0.3.2

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

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

func (*BadgeMutation) AddedIDs added in v0.3.2

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

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

func (*BadgeMutation) ClearEdge added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ClearField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ClearWearer added in v0.3.2

func (m *BadgeMutation) ClearWearer()

ClearWearer clears the "wearer" edge to the Pet entity.

func (*BadgeMutation) ClearedEdges added in v0.3.2

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

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

func (*BadgeMutation) ClearedFields added in v0.3.2

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

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

func (BadgeMutation) Client added in v0.3.2

func (m BadgeMutation) 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 (*BadgeMutation) Color added in v0.3.2

func (m *BadgeMutation) Color() (r badge.Color, exists bool)

Color returns the value of the "color" field in the mutation.

func (*BadgeMutation) EdgeCleared added in v0.3.2

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

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

func (*BadgeMutation) Field added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) FieldCleared added in v0.3.2

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

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

func (*BadgeMutation) Fields added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ID added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) Material added in v0.3.2

func (m *BadgeMutation) Material() (r badge.Material, exists bool)

Material returns the value of the "material" field in the mutation.

func (*BadgeMutation) OldColor added in v0.3.2

func (m *BadgeMutation) OldColor(ctx context.Context) (v badge.Color, err error)

OldColor returns the old "color" field's value of the Badge entity. If the Badge 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 (*BadgeMutation) OldField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) OldMaterial added in v0.3.2

func (m *BadgeMutation) OldMaterial(ctx context.Context) (v badge.Material, err error)

OldMaterial returns the old "material" field's value of the Badge entity. If the Badge 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 (*BadgeMutation) Op added in v0.3.2

func (m *BadgeMutation) Op() Op

Op returns the operation name.

func (*BadgeMutation) RemovedEdges added in v0.3.2

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

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

func (*BadgeMutation) RemovedIDs added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ResetColor added in v0.3.2

func (m *BadgeMutation) ResetColor()

ResetColor resets all changes to the "color" field.

func (*BadgeMutation) ResetEdge added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ResetField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) ResetMaterial added in v0.3.2

func (m *BadgeMutation) ResetMaterial()

ResetMaterial resets all changes to the "material" field.

func (*BadgeMutation) ResetWearer added in v0.3.2

func (m *BadgeMutation) ResetWearer()

ResetWearer resets all changes to the "wearer" edge.

func (*BadgeMutation) SetColor added in v0.3.2

func (m *BadgeMutation) SetColor(b badge.Color)

SetColor sets the "color" field.

func (*BadgeMutation) SetField added in v0.3.2

func (m *BadgeMutation) 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 (*BadgeMutation) SetMaterial added in v0.3.2

func (m *BadgeMutation) SetMaterial(b badge.Material)

SetMaterial sets the "material" field.

func (*BadgeMutation) SetWearerID added in v0.3.2

func (m *BadgeMutation) SetWearerID(id int)

SetWearerID sets the "wearer" edge to the Pet entity by id.

func (BadgeMutation) Tx added in v0.3.2

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

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

func (*BadgeMutation) Type added in v0.3.2

func (m *BadgeMutation) Type() string

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

func (*BadgeMutation) WearerCleared added in v0.3.2

func (m *BadgeMutation) WearerCleared() bool

WearerCleared reports if the "wearer" edge to the Pet entity was cleared.

func (*BadgeMutation) WearerID added in v0.3.2

func (m *BadgeMutation) WearerID() (id int, exists bool)

WearerID returns the "wearer" edge ID in the mutation.

func (*BadgeMutation) WearerIDs added in v0.3.2

func (m *BadgeMutation) WearerIDs() (ids []int)

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

func (*BadgeMutation) Where added in v0.3.2

func (m *BadgeMutation) Where(ps ...predicate.Badge)

Where appends a list predicates to the BadgeMutation builder.

type BadgeQuery added in v0.3.2

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

BadgeQuery is the builder for querying Badge entities.

func (*BadgeQuery) All added in v0.3.2

func (bq *BadgeQuery) All(ctx context.Context) ([]*Badge, error)

All executes the query and returns a list of Badges.

func (*BadgeQuery) AllX added in v0.3.2

func (bq *BadgeQuery) AllX(ctx context.Context) []*Badge

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

func (*BadgeQuery) Clone added in v0.3.2

func (bq *BadgeQuery) Clone() *BadgeQuery

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

func (*BadgeQuery) Count added in v0.3.2

func (bq *BadgeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BadgeQuery) CountX added in v0.3.2

func (bq *BadgeQuery) CountX(ctx context.Context) int

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

func (*BadgeQuery) Exist added in v0.3.2

func (bq *BadgeQuery) Exist(ctx context.Context) (bool, error)

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

func (*BadgeQuery) ExistX added in v0.3.2

func (bq *BadgeQuery) ExistX(ctx context.Context) bool

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

func (*BadgeQuery) First added in v0.3.2

func (bq *BadgeQuery) First(ctx context.Context) (*Badge, error)

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

func (*BadgeQuery) FirstID added in v0.3.2

func (bq *BadgeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BadgeQuery) FirstIDX added in v0.3.2

func (bq *BadgeQuery) FirstIDX(ctx context.Context) int

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

func (*BadgeQuery) FirstX added in v0.3.2

func (bq *BadgeQuery) FirstX(ctx context.Context) *Badge

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

func (*BadgeQuery) GroupBy added in v0.3.2

func (bq *BadgeQuery) GroupBy(field string, fields ...string) *BadgeGroupBy

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 {
	Color badge.Color `json:"color,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Badge.Query().
	GroupBy(badge.FieldColor).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BadgeQuery) IDs added in v0.3.2

func (bq *BadgeQuery) IDs(ctx context.Context) ([]int, error)

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

func (*BadgeQuery) IDsX added in v0.3.2

func (bq *BadgeQuery) IDsX(ctx context.Context) []int

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

func (*BadgeQuery) Limit added in v0.3.2

func (bq *BadgeQuery) Limit(limit int) *BadgeQuery

Limit adds a limit step to the query.

func (*BadgeQuery) Offset added in v0.3.2

func (bq *BadgeQuery) Offset(offset int) *BadgeQuery

Offset adds an offset step to the query.

func (*BadgeQuery) Only added in v0.3.2

func (bq *BadgeQuery) Only(ctx context.Context) (*Badge, error)

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

func (*BadgeQuery) OnlyID added in v0.3.2

func (bq *BadgeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BadgeQuery) OnlyIDX added in v0.3.2

func (bq *BadgeQuery) OnlyIDX(ctx context.Context) int

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

func (*BadgeQuery) OnlyX added in v0.3.2

func (bq *BadgeQuery) OnlyX(ctx context.Context) *Badge

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

func (*BadgeQuery) Order added in v0.3.2

func (bq *BadgeQuery) Order(o ...OrderFunc) *BadgeQuery

Order adds an order step to the query.

func (*BadgeQuery) QueryWearer added in v0.3.2

func (bq *BadgeQuery) QueryWearer() *PetQuery

QueryWearer chains the current query on the "wearer" edge.

func (*BadgeQuery) Select added in v0.3.2

func (bq *BadgeQuery) Select(fields ...string) *BadgeSelect

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 {
	Color badge.Color `json:"color,omitempty"`
}

client.Badge.Query().
	Select(badge.FieldColor).
	Scan(ctx, &v)

func (*BadgeQuery) Unique added in v0.3.2

func (bq *BadgeQuery) Unique(unique bool) *BadgeQuery

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 (*BadgeQuery) Where added in v0.3.2

func (bq *BadgeQuery) Where(ps ...predicate.Badge) *BadgeQuery

Where adds a new predicate for the BadgeQuery builder.

func (*BadgeQuery) WithWearer added in v0.3.2

func (bq *BadgeQuery) WithWearer(opts ...func(*PetQuery)) *BadgeQuery

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

type BadgeSelect added in v0.3.2

type BadgeSelect struct {
	*BadgeQuery
	// contains filtered or unexported fields
}

BadgeSelect is the builder for selecting fields of Badge entities.

func (*BadgeSelect) Bool added in v0.3.2

func (bs *BadgeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*BadgeSelect) BoolX added in v0.3.2

func (bs *BadgeSelect) BoolX(ctx context.Context) bool

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

func (*BadgeSelect) Bools added in v0.3.2

func (bs *BadgeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*BadgeSelect) BoolsX added in v0.3.2

func (bs *BadgeSelect) BoolsX(ctx context.Context) []bool

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

func (*BadgeSelect) Float64 added in v0.3.2

func (bs *BadgeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*BadgeSelect) Float64X added in v0.3.2

func (bs *BadgeSelect) Float64X(ctx context.Context) float64

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

func (*BadgeSelect) Float64s added in v0.3.2

func (bs *BadgeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*BadgeSelect) Float64sX added in v0.3.2

func (bs *BadgeSelect) Float64sX(ctx context.Context) []float64

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

func (*BadgeSelect) Int added in v0.3.2

func (bs *BadgeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*BadgeSelect) IntX added in v0.3.2

func (bs *BadgeSelect) IntX(ctx context.Context) int

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

func (*BadgeSelect) Ints added in v0.3.2

func (bs *BadgeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*BadgeSelect) IntsX added in v0.3.2

func (bs *BadgeSelect) IntsX(ctx context.Context) []int

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

func (*BadgeSelect) Scan added in v0.3.2

func (bs *BadgeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*BadgeSelect) ScanX added in v0.3.2

func (bs *BadgeSelect) ScanX(ctx context.Context, v interface{})

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

func (*BadgeSelect) String added in v0.3.2

func (bs *BadgeSelect) String(ctx context.Context) (_ string, err error)

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

func (*BadgeSelect) StringX added in v0.3.2

func (bs *BadgeSelect) StringX(ctx context.Context) string

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

func (*BadgeSelect) Strings added in v0.3.2

func (bs *BadgeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*BadgeSelect) StringsX added in v0.3.2

func (bs *BadgeSelect) StringsX(ctx context.Context) []string

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

type BadgeUpdate added in v0.3.2

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

BadgeUpdate is the builder for updating Badge entities.

func (*BadgeUpdate) ClearWearer added in v0.3.2

func (bu *BadgeUpdate) ClearWearer() *BadgeUpdate

ClearWearer clears the "wearer" edge to the Pet entity.

func (*BadgeUpdate) Exec added in v0.3.2

func (bu *BadgeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BadgeUpdate) ExecX added in v0.3.2

func (bu *BadgeUpdate) ExecX(ctx context.Context)

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

func (*BadgeUpdate) Mutation added in v0.3.2

func (bu *BadgeUpdate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdate) Save added in v0.3.2

func (bu *BadgeUpdate) Save(ctx context.Context) (int, error)

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

func (*BadgeUpdate) SaveX added in v0.3.2

func (bu *BadgeUpdate) SaveX(ctx context.Context) int

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

func (*BadgeUpdate) SetColor added in v0.3.2

func (bu *BadgeUpdate) SetColor(b badge.Color) *BadgeUpdate

SetColor sets the "color" field.

func (*BadgeUpdate) SetMaterial added in v0.3.2

func (bu *BadgeUpdate) SetMaterial(b badge.Material) *BadgeUpdate

SetMaterial sets the "material" field.

func (*BadgeUpdate) SetNillableWearerID added in v0.3.2

func (bu *BadgeUpdate) SetNillableWearerID(id *int) *BadgeUpdate

SetNillableWearerID sets the "wearer" edge to the Pet entity by ID if the given value is not nil.

func (*BadgeUpdate) SetWearer added in v0.3.2

func (bu *BadgeUpdate) SetWearer(p *Pet) *BadgeUpdate

SetWearer sets the "wearer" edge to the Pet entity.

func (*BadgeUpdate) SetWearerID added in v0.3.2

func (bu *BadgeUpdate) SetWearerID(id int) *BadgeUpdate

SetWearerID sets the "wearer" edge to the Pet entity by ID.

func (*BadgeUpdate) Where added in v0.3.2

func (bu *BadgeUpdate) Where(ps ...predicate.Badge) *BadgeUpdate

Where appends a list predicates to the BadgeUpdate builder.

type BadgeUpdateOne added in v0.3.2

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

BadgeUpdateOne is the builder for updating a single Badge entity.

func (*BadgeUpdateOne) ClearWearer added in v0.3.2

func (buo *BadgeUpdateOne) ClearWearer() *BadgeUpdateOne

ClearWearer clears the "wearer" edge to the Pet entity.

func (*BadgeUpdateOne) Exec added in v0.3.2

func (buo *BadgeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BadgeUpdateOne) ExecX added in v0.3.2

func (buo *BadgeUpdateOne) ExecX(ctx context.Context)

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

func (*BadgeUpdateOne) Mutation added in v0.3.2

func (buo *BadgeUpdateOne) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdateOne) Save added in v0.3.2

func (buo *BadgeUpdateOne) Save(ctx context.Context) (*Badge, error)

Save executes the query and returns the updated Badge entity.

func (*BadgeUpdateOne) SaveX added in v0.3.2

func (buo *BadgeUpdateOne) SaveX(ctx context.Context) *Badge

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

func (*BadgeUpdateOne) Select added in v0.3.2

func (buo *BadgeUpdateOne) Select(field string, fields ...string) *BadgeUpdateOne

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

func (*BadgeUpdateOne) SetColor added in v0.3.2

func (buo *BadgeUpdateOne) SetColor(b badge.Color) *BadgeUpdateOne

SetColor sets the "color" field.

func (*BadgeUpdateOne) SetMaterial added in v0.3.2

func (buo *BadgeUpdateOne) SetMaterial(b badge.Material) *BadgeUpdateOne

SetMaterial sets the "material" field.

func (*BadgeUpdateOne) SetNillableWearerID added in v0.3.2

func (buo *BadgeUpdateOne) SetNillableWearerID(id *int) *BadgeUpdateOne

SetNillableWearerID sets the "wearer" edge to the Pet entity by ID if the given value is not nil.

func (*BadgeUpdateOne) SetWearer added in v0.3.2

func (buo *BadgeUpdateOne) SetWearer(p *Pet) *BadgeUpdateOne

SetWearer sets the "wearer" edge to the Pet entity.

func (*BadgeUpdateOne) SetWearerID added in v0.3.2

func (buo *BadgeUpdateOne) SetWearerID(id int) *BadgeUpdateOne

SetWearerID sets the "wearer" edge to the Pet entity by ID.

type Badges added in v0.3.2

type Badges []*Badge

Badges is a parsable slice of Badge.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Badge is the client for interacting with the Badge builders.
	Badge *BadgeClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// PlayGroup is the client for interacting with the PlayGroup builders.
	PlayGroup *PlayGroupClient
	// Toy is the client for interacting with the Toy builders.
	Toy *ToyClient
	// 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().
	Badge.
	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 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 Pet

type Pet struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Height holds the value of the "height" field.
	Height int `json:"height,omitempty"`
	// Weight holds the value of the "weight" field.
	Weight float64 `json:"weight,omitempty"`
	// Castrated holds the value of the "castrated" field.
	Castrated bool `json:"castrated,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Birthday holds the value of the "birthday" field.
	Birthday time.Time `json:"birthday,omitempty"`
	// Nicknames holds the value of the "nicknames" field.
	Nicknames []string `json:"nicknames,omitempty"`
	// Sex holds the value of the "sex" field.
	Sex pet.Sex `json:"sex,omitempty"`
	// Chip holds the value of the "chip" field.
	Chip uuid.UUID `json:"chip,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PetQuery when eager-loading is set.
	Edges PetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Pet is the model entity for the Pet schema.

func (*Pet) QueryBadge added in v0.3.2

func (pe *Pet) QueryBadge() *BadgeQuery

QueryBadge queries the "badge" edge of the Pet entity.

func (*Pet) QueryChildren added in v0.3.2

func (pe *Pet) QueryChildren() *PetQuery

QueryChildren queries the "children" edge of the Pet entity.

func (*Pet) QueryFriends

func (pe *Pet) QueryFriends() *PetQuery

QueryFriends queries the "friends" edge of the Pet entity.

func (*Pet) QueryMentor added in v0.3.2

func (pe *Pet) QueryMentor() *PetQuery

QueryMentor queries the "mentor" edge of the Pet entity.

func (*Pet) QueryParent added in v0.3.2

func (pe *Pet) QueryParent() *PetQuery

QueryParent queries the "parent" edge of the Pet entity.

func (*Pet) QueryPlayGroups added in v0.3.2

func (pe *Pet) QueryPlayGroups() *PlayGroupQuery

QueryPlayGroups queries the "play_groups" edge of the Pet entity.

func (*Pet) QueryProtege added in v0.3.2

func (pe *Pet) QueryProtege() *PetQuery

QueryProtege queries the "protege" edge of the Pet entity.

func (*Pet) QuerySpouse added in v0.3.2

func (pe *Pet) QuerySpouse() *PetQuery

QuerySpouse queries the "spouse" edge of the Pet entity.

func (*Pet) QueryToys added in v0.3.2

func (pe *Pet) QueryToys() *ToyQuery

QueryToys queries the "toys" edge of the Pet entity.

func (*Pet) String

func (pe *Pet) String() string

String implements the fmt.Stringer.

func (*Pet) Unwrap

func (pe *Pet) Unwrap() *Pet

Unwrap unwraps the Pet 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 (*Pet) Update

func (pe *Pet) Update() *PetUpdateOne

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

type PetClient

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

PetClient is a client for the Pet schema.

func NewPetClient

func NewPetClient(c config) *PetClient

NewPetClient returns a client for the Pet from the given config.

func (*PetClient) Create

func (c *PetClient) Create() *PetCreate

Create returns a create builder for Pet.

func (*PetClient) CreateBulk

func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk

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

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

func (c *PetClient) DeleteOne(pe *Pet) *PetDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PetClient) DeleteOneID

func (c *PetClient) DeleteOneID(id int) *PetDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PetClient) Get

func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error)

Get returns a Pet entity by its id.

func (*PetClient) GetX

func (c *PetClient) GetX(ctx context.Context, id int) *Pet

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

func (*PetClient) Hooks

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

Hooks returns the client hooks.

func (*PetClient) Query

func (c *PetClient) Query() *PetQuery

Query returns a query builder for Pet.

func (*PetClient) QueryBadge added in v0.3.2

func (c *PetClient) QueryBadge(pe *Pet) *BadgeQuery

QueryBadge queries the badge edge of a Pet.

func (*PetClient) QueryChildren added in v0.3.2

func (c *PetClient) QueryChildren(pe *Pet) *PetQuery

QueryChildren queries the children edge of a Pet.

func (*PetClient) QueryFriends

func (c *PetClient) QueryFriends(pe *Pet) *PetQuery

QueryFriends queries the friends edge of a Pet.

func (*PetClient) QueryMentor added in v0.3.2

func (c *PetClient) QueryMentor(pe *Pet) *PetQuery

QueryMentor queries the mentor edge of a Pet.

func (*PetClient) QueryParent added in v0.3.2

func (c *PetClient) QueryParent(pe *Pet) *PetQuery

QueryParent queries the parent edge of a Pet.

func (*PetClient) QueryPlayGroups added in v0.3.2

func (c *PetClient) QueryPlayGroups(pe *Pet) *PlayGroupQuery

QueryPlayGroups queries the play_groups edge of a Pet.

func (*PetClient) QueryProtege added in v0.3.2

func (c *PetClient) QueryProtege(pe *Pet) *PetQuery

QueryProtege queries the protege edge of a Pet.

func (*PetClient) QuerySpouse added in v0.3.2

func (c *PetClient) QuerySpouse(pe *Pet) *PetQuery

QuerySpouse queries the spouse edge of a Pet.

func (*PetClient) QueryToys added in v0.3.2

func (c *PetClient) QueryToys(pe *Pet) *ToyQuery

QueryToys queries the toys edge of a Pet.

func (*PetClient) Update

func (c *PetClient) Update() *PetUpdate

Update returns an update builder for Pet.

func (*PetClient) UpdateOne

func (c *PetClient) UpdateOne(pe *Pet) *PetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PetClient) UpdateOneID

func (c *PetClient) UpdateOneID(id int) *PetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PetClient) Use

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

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

type PetCreate

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

PetCreate is the builder for creating a Pet entity.

func (*PetCreate) AddChildIDs added in v0.3.2

func (pc *PetCreate) AddChildIDs(ids ...int) *PetCreate

AddChildIDs adds the "children" edge to the Pet entity by IDs.

func (*PetCreate) AddChildren added in v0.3.2

func (pc *PetCreate) AddChildren(p ...*Pet) *PetCreate

AddChildren adds the "children" edges to the Pet entity.

func (*PetCreate) AddFriendIDs

func (pc *PetCreate) AddFriendIDs(ids ...int) *PetCreate

AddFriendIDs adds the "friends" edge to the Pet entity by IDs.

func (*PetCreate) AddFriends

func (pc *PetCreate) AddFriends(p ...*Pet) *PetCreate

AddFriends adds the "friends" edges to the Pet entity.

func (*PetCreate) AddPlayGroupIDs added in v0.3.2

func (pc *PetCreate) AddPlayGroupIDs(ids ...int) *PetCreate

AddPlayGroupIDs adds the "play_groups" edge to the PlayGroup entity by IDs.

func (*PetCreate) AddPlayGroups added in v0.3.2

func (pc *PetCreate) AddPlayGroups(p ...*PlayGroup) *PetCreate

AddPlayGroups adds the "play_groups" edges to the PlayGroup entity.

func (*PetCreate) AddToyIDs added in v0.3.2

func (pc *PetCreate) AddToyIDs(ids ...int) *PetCreate

AddToyIDs adds the "toys" edge to the Toy entity by IDs.

func (*PetCreate) AddToys added in v0.3.2

func (pc *PetCreate) AddToys(t ...*Toy) *PetCreate

AddToys adds the "toys" edges to the Toy entity.

func (*PetCreate) Exec added in v0.3.2

func (pc *PetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PetCreate) ExecX added in v0.3.2

func (pc *PetCreate) ExecX(ctx context.Context)

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

func (*PetCreate) Mutation

func (pc *PetCreate) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetCreate) Save

func (pc *PetCreate) Save(ctx context.Context) (*Pet, error)

Save creates the Pet in the database.

func (*PetCreate) SaveX

func (pc *PetCreate) SaveX(ctx context.Context) *Pet

SaveX calls Save and panics if Save returns an error.

func (*PetCreate) SetBadge added in v0.3.2

func (pc *PetCreate) SetBadge(b *Badge) *PetCreate

SetBadge sets the "badge" edge to the Badge entity.

func (*PetCreate) SetBadgeID added in v0.3.2

func (pc *PetCreate) SetBadgeID(id int) *PetCreate

SetBadgeID sets the "badge" edge to the Badge entity by ID.

func (*PetCreate) SetBirthday added in v0.3.2

func (pc *PetCreate) SetBirthday(t time.Time) *PetCreate

SetBirthday sets the "birthday" field.

func (*PetCreate) SetCastrated added in v0.3.2

func (pc *PetCreate) SetCastrated(b bool) *PetCreate

SetCastrated sets the "castrated" field.

func (*PetCreate) SetChip added in v0.3.2

func (pc *PetCreate) SetChip(u uuid.UUID) *PetCreate

SetChip sets the "chip" field.

func (*PetCreate) SetHeight added in v0.3.2

func (pc *PetCreate) SetHeight(i int) *PetCreate

SetHeight sets the "height" field.

func (*PetCreate) SetMentor added in v0.3.2

func (pc *PetCreate) SetMentor(p *Pet) *PetCreate

SetMentor sets the "mentor" edge to the Pet entity.

func (*PetCreate) SetMentorID added in v0.3.2

func (pc *PetCreate) SetMentorID(id int) *PetCreate

SetMentorID sets the "mentor" edge to the Pet entity by ID.

func (*PetCreate) SetName

func (pc *PetCreate) SetName(s string) *PetCreate

SetName sets the "name" field.

func (*PetCreate) SetNicknames added in v0.3.2

func (pc *PetCreate) SetNicknames(s []string) *PetCreate

SetNicknames sets the "nicknames" field.

func (*PetCreate) SetNillableBirthday added in v0.3.2

func (pc *PetCreate) SetNillableBirthday(t *time.Time) *PetCreate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*PetCreate) SetNillableMentorID added in v0.3.2

func (pc *PetCreate) SetNillableMentorID(id *int) *PetCreate

SetNillableMentorID sets the "mentor" edge to the Pet entity by ID if the given value is not nil.

func (*PetCreate) SetNillableParentID added in v0.3.2

func (pc *PetCreate) SetNillableParentID(id *int) *PetCreate

SetNillableParentID sets the "parent" edge to the Pet entity by ID if the given value is not nil.

func (*PetCreate) SetNillableProtegeID added in v0.3.2

func (pc *PetCreate) SetNillableProtegeID(id *int) *PetCreate

SetNillableProtegeID sets the "protege" edge to the Pet entity by ID if the given value is not nil.

func (*PetCreate) SetNillableSpouseID added in v0.3.2

func (pc *PetCreate) SetNillableSpouseID(id *int) *PetCreate

SetNillableSpouseID sets the "spouse" edge to the Pet entity by ID if the given value is not nil.

func (*PetCreate) SetNillableWeight added in v0.3.2

func (pc *PetCreate) SetNillableWeight(f *float64) *PetCreate

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PetCreate) SetParent added in v0.3.2

func (pc *PetCreate) SetParent(p *Pet) *PetCreate

SetParent sets the "parent" edge to the Pet entity.

func (*PetCreate) SetParentID added in v0.3.2

func (pc *PetCreate) SetParentID(id int) *PetCreate

SetParentID sets the "parent" edge to the Pet entity by ID.

func (*PetCreate) SetProtege added in v0.3.2

func (pc *PetCreate) SetProtege(p *Pet) *PetCreate

SetProtege sets the "protege" edge to the Pet entity.

func (*PetCreate) SetProtegeID added in v0.3.2

func (pc *PetCreate) SetProtegeID(id int) *PetCreate

SetProtegeID sets the "protege" edge to the Pet entity by ID.

func (*PetCreate) SetSex added in v0.3.2

func (pc *PetCreate) SetSex(pe pet.Sex) *PetCreate

SetSex sets the "sex" field.

func (*PetCreate) SetSpouse added in v0.3.2

func (pc *PetCreate) SetSpouse(p *Pet) *PetCreate

SetSpouse sets the "spouse" edge to the Pet entity.

func (*PetCreate) SetSpouseID added in v0.3.2

func (pc *PetCreate) SetSpouseID(id int) *PetCreate

SetSpouseID sets the "spouse" edge to the Pet entity by ID.

func (*PetCreate) SetWeight added in v0.3.2

func (pc *PetCreate) SetWeight(f float64) *PetCreate

SetWeight sets the "weight" field.

type PetCreateBulk

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

PetCreateBulk is the builder for creating many Pet entities in bulk.

func (*PetCreateBulk) Exec added in v0.3.2

func (pcb *PetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PetCreateBulk) ExecX added in v0.3.2

func (pcb *PetCreateBulk) ExecX(ctx context.Context)

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

func (*PetCreateBulk) Save

func (pcb *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error)

Save creates the Pet entities in the database.

func (*PetCreateBulk) SaveX

func (pcb *PetCreateBulk) SaveX(ctx context.Context) []*Pet

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

type PetDelete

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

PetDelete is the builder for deleting a Pet entity.

func (*PetDelete) Exec

func (pd *PetDelete) Exec(ctx context.Context) (int, error)

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

func (*PetDelete) ExecX

func (pd *PetDelete) ExecX(ctx context.Context) int

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

func (*PetDelete) Where

func (pd *PetDelete) Where(ps ...predicate.Pet) *PetDelete

Where appends a list predicates to the PetDelete builder.

type PetDeleteOne

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

PetDeleteOne is the builder for deleting a single Pet entity.

func (*PetDeleteOne) Exec

func (pdo *PetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PetDeleteOne) ExecX

func (pdo *PetDeleteOne) ExecX(ctx context.Context)

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

type PetEdges

type PetEdges struct {
	// Badge holds the value of the badge edge.
	Badge *Badge `json:"badge,omitempty"`
	// Protege holds the value of the protege edge.
	Protege *Pet `json:"protege,omitempty"`
	// Mentor holds the value of the mentor edge.
	Mentor *Pet `json:"mentor,omitempty"`
	// Spouse holds the value of the spouse edge.
	Spouse *Pet `json:"spouse,omitempty"`
	// Toys holds the value of the toys edge.
	Toys []*Toy `json:"toys,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Pet `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*Pet `json:"children,omitempty"`
	// PlayGroups holds the value of the play_groups edge.
	PlayGroups []*PlayGroup `json:"play_groups,omitempty"`
	// Friends holds the value of the friends edge.
	Friends []*Pet `json:"friends,omitempty"`
	// contains filtered or unexported fields
}

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

func (PetEdges) BadgeOrErr added in v0.3.2

func (e PetEdges) BadgeOrErr() (*Badge, error)

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

func (PetEdges) ChildrenOrErr added in v0.3.2

func (e PetEdges) ChildrenOrErr() ([]*Pet, error)

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

func (PetEdges) FriendsOrErr

func (e PetEdges) FriendsOrErr() ([]*Pet, error)

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

func (PetEdges) MentorOrErr added in v0.3.2

func (e PetEdges) MentorOrErr() (*Pet, error)

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

func (PetEdges) ParentOrErr added in v0.3.2

func (e PetEdges) ParentOrErr() (*Pet, error)

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

func (PetEdges) PlayGroupsOrErr added in v0.3.2

func (e PetEdges) PlayGroupsOrErr() ([]*PlayGroup, error)

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

func (PetEdges) ProtegeOrErr added in v0.3.2

func (e PetEdges) ProtegeOrErr() (*Pet, error)

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

func (PetEdges) SpouseOrErr added in v0.3.2

func (e PetEdges) SpouseOrErr() (*Pet, error)

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

func (PetEdges) ToysOrErr added in v0.3.2

func (e PetEdges) ToysOrErr() ([]*Toy, error)

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

type PetGroupBy

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

PetGroupBy is the group-by builder for Pet entities.

func (*PetGroupBy) Aggregate

func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy

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

func (*PetGroupBy) Bool

func (pgb *PetGroupBy) 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 (*PetGroupBy) BoolX

func (pgb *PetGroupBy) BoolX(ctx context.Context) bool

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

func (*PetGroupBy) Bools

func (pgb *PetGroupBy) 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 (*PetGroupBy) BoolsX

func (pgb *PetGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PetGroupBy) Float64

func (pgb *PetGroupBy) 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 (*PetGroupBy) Float64X

func (pgb *PetGroupBy) Float64X(ctx context.Context) float64

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

func (*PetGroupBy) Float64s

func (pgb *PetGroupBy) 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 (*PetGroupBy) Float64sX

func (pgb *PetGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PetGroupBy) Int

func (pgb *PetGroupBy) 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 (*PetGroupBy) IntX

func (pgb *PetGroupBy) IntX(ctx context.Context) int

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

func (*PetGroupBy) Ints

func (pgb *PetGroupBy) 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 (*PetGroupBy) IntsX

func (pgb *PetGroupBy) IntsX(ctx context.Context) []int

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

func (*PetGroupBy) Scan

func (pgb *PetGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*PetGroupBy) ScanX

func (pgb *PetGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PetGroupBy) String

func (pgb *PetGroupBy) 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 (*PetGroupBy) StringX

func (pgb *PetGroupBy) StringX(ctx context.Context) string

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

func (*PetGroupBy) Strings

func (pgb *PetGroupBy) 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 (*PetGroupBy) StringsX

func (pgb *PetGroupBy) StringsX(ctx context.Context) []string

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

type PetMutation

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

PetMutation represents an operation that mutates the Pet nodes in the graph.

func (*PetMutation) AddChildIDs added in v0.3.2

func (m *PetMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the Pet entity by ids.

func (*PetMutation) AddField

func (m *PetMutation) 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 (*PetMutation) AddFriendIDs

func (m *PetMutation) AddFriendIDs(ids ...int)

AddFriendIDs adds the "friends" edge to the Pet entity by ids.

func (*PetMutation) AddHeight added in v0.3.2

func (m *PetMutation) AddHeight(i int)

AddHeight adds i to the "height" field.

func (*PetMutation) AddPlayGroupIDs added in v0.3.2

func (m *PetMutation) AddPlayGroupIDs(ids ...int)

AddPlayGroupIDs adds the "play_groups" edge to the PlayGroup entity by ids.

func (*PetMutation) AddToyIDs added in v0.3.2

func (m *PetMutation) AddToyIDs(ids ...int)

AddToyIDs adds the "toys" edge to the Toy entity by ids.

func (*PetMutation) AddWeight added in v0.3.2

func (m *PetMutation) AddWeight(f float64)

AddWeight adds f to the "weight" field.

func (*PetMutation) AddedEdges

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

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

func (*PetMutation) AddedField

func (m *PetMutation) 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 (*PetMutation) AddedFields

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

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

func (*PetMutation) AddedHeight added in v0.3.2

func (m *PetMutation) AddedHeight() (r int, exists bool)

AddedHeight returns the value that was added to the "height" field in this mutation.

func (*PetMutation) AddedIDs

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

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

func (*PetMutation) AddedWeight added in v0.3.2

func (m *PetMutation) AddedWeight() (r float64, exists bool)

AddedWeight returns the value that was added to the "weight" field in this mutation.

func (*PetMutation) BadgeCleared added in v0.3.2

func (m *PetMutation) BadgeCleared() bool

BadgeCleared reports if the "badge" edge to the Badge entity was cleared.

func (*PetMutation) BadgeID added in v0.3.2

func (m *PetMutation) BadgeID() (id int, exists bool)

BadgeID returns the "badge" edge ID in the mutation.

func (*PetMutation) BadgeIDs added in v0.3.2

func (m *PetMutation) BadgeIDs() (ids []int)

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

func (*PetMutation) Birthday added in v0.3.2

func (m *PetMutation) Birthday() (r time.Time, exists bool)

Birthday returns the value of the "birthday" field in the mutation.

func (*PetMutation) BirthdayCleared added in v0.3.2

func (m *PetMutation) BirthdayCleared() bool

BirthdayCleared returns if the "birthday" field was cleared in this mutation.

func (*PetMutation) Castrated added in v0.3.2

func (m *PetMutation) Castrated() (r bool, exists bool)

Castrated returns the value of the "castrated" field in the mutation.

func (*PetMutation) ChildrenCleared added in v0.3.2

func (m *PetMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Pet entity was cleared.

func (*PetMutation) ChildrenIDs added in v0.3.2

func (m *PetMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*PetMutation) Chip added in v0.3.2

func (m *PetMutation) Chip() (r uuid.UUID, exists bool)

Chip returns the value of the "chip" field in the mutation.

func (*PetMutation) ClearBadge added in v0.3.2

func (m *PetMutation) ClearBadge()

ClearBadge clears the "badge" edge to the Badge entity.

func (*PetMutation) ClearBirthday added in v0.3.2

func (m *PetMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*PetMutation) ClearChildren added in v0.3.2

func (m *PetMutation) ClearChildren()

ClearChildren clears the "children" edge to the Pet entity.

func (*PetMutation) ClearEdge

func (m *PetMutation) 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 (*PetMutation) ClearField

func (m *PetMutation) 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 (*PetMutation) ClearFriends

func (m *PetMutation) ClearFriends()

ClearFriends clears the "friends" edge to the Pet entity.

func (*PetMutation) ClearMentor added in v0.3.2

func (m *PetMutation) ClearMentor()

ClearMentor clears the "mentor" edge to the Pet entity.

func (*PetMutation) ClearNicknames added in v0.3.2

func (m *PetMutation) ClearNicknames()

ClearNicknames clears the value of the "nicknames" field.

func (*PetMutation) ClearParent added in v0.3.2

func (m *PetMutation) ClearParent()

ClearParent clears the "parent" edge to the Pet entity.

func (*PetMutation) ClearPlayGroups added in v0.3.2

func (m *PetMutation) ClearPlayGroups()

ClearPlayGroups clears the "play_groups" edge to the PlayGroup entity.

func (*PetMutation) ClearProtege added in v0.3.2

func (m *PetMutation) ClearProtege()

ClearProtege clears the "protege" edge to the Pet entity.

func (*PetMutation) ClearSpouse added in v0.3.2

func (m *PetMutation) ClearSpouse()

ClearSpouse clears the "spouse" edge to the Pet entity.

func (*PetMutation) ClearToys added in v0.3.2

func (m *PetMutation) ClearToys()

ClearToys clears the "toys" edge to the Toy entity.

func (*PetMutation) ClearWeight added in v0.3.2

func (m *PetMutation) ClearWeight()

ClearWeight clears the value of the "weight" field.

func (*PetMutation) ClearedEdges

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

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

func (*PetMutation) ClearedFields

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

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

func (PetMutation) Client

func (m PetMutation) 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 (*PetMutation) EdgeCleared

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

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

func (*PetMutation) Field

func (m *PetMutation) 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 (*PetMutation) FieldCleared

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

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

func (*PetMutation) Fields

func (m *PetMutation) 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 (*PetMutation) FriendsCleared

func (m *PetMutation) FriendsCleared() bool

FriendsCleared reports if the "friends" edge to the Pet entity was cleared.

func (*PetMutation) FriendsIDs

func (m *PetMutation) FriendsIDs() (ids []int)

FriendsIDs returns the "friends" edge IDs in the mutation.

func (*PetMutation) Height added in v0.3.2

func (m *PetMutation) Height() (r int, exists bool)

Height returns the value of the "height" field in the mutation.

func (*PetMutation) ID

func (m *PetMutation) 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 (*PetMutation) MentorCleared added in v0.3.2

func (m *PetMutation) MentorCleared() bool

MentorCleared reports if the "mentor" edge to the Pet entity was cleared.

func (*PetMutation) MentorID added in v0.3.2

func (m *PetMutation) MentorID() (id int, exists bool)

MentorID returns the "mentor" edge ID in the mutation.

func (*PetMutation) MentorIDs added in v0.3.2

func (m *PetMutation) MentorIDs() (ids []int)

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

func (*PetMutation) Name

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

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

func (*PetMutation) Nicknames added in v0.3.2

func (m *PetMutation) Nicknames() (r []string, exists bool)

Nicknames returns the value of the "nicknames" field in the mutation.

func (*PetMutation) NicknamesCleared added in v0.3.2

func (m *PetMutation) NicknamesCleared() bool

NicknamesCleared returns if the "nicknames" field was cleared in this mutation.

func (*PetMutation) OldBirthday added in v0.3.2

func (m *PetMutation) OldBirthday(ctx context.Context) (v time.Time, err error)

OldBirthday returns the old "birthday" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldCastrated added in v0.3.2

func (m *PetMutation) OldCastrated(ctx context.Context) (v bool, err error)

OldCastrated returns the old "castrated" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldChip added in v0.3.2

func (m *PetMutation) OldChip(ctx context.Context) (v uuid.UUID, err error)

OldChip returns the old "chip" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldField

func (m *PetMutation) 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 (*PetMutation) OldHeight added in v0.3.2

func (m *PetMutation) OldHeight(ctx context.Context) (v int, err error)

OldHeight returns the old "height" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldName

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

OldName returns the old "name" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldNicknames added in v0.3.2

func (m *PetMutation) OldNicknames(ctx context.Context) (v []string, err error)

OldNicknames returns the old "nicknames" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldSex added in v0.3.2

func (m *PetMutation) OldSex(ctx context.Context) (v pet.Sex, err error)

OldSex returns the old "sex" field's value of the Pet entity. If the Pet 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 (*PetMutation) OldWeight added in v0.3.2

func (m *PetMutation) OldWeight(ctx context.Context) (v float64, err error)

OldWeight returns the old "weight" field's value of the Pet entity. If the Pet 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 (*PetMutation) Op

func (m *PetMutation) Op() Op

Op returns the operation name.

func (*PetMutation) ParentCleared added in v0.3.2

func (m *PetMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Pet entity was cleared.

func (*PetMutation) ParentID added in v0.3.2

func (m *PetMutation) ParentID() (id int, exists bool)

ParentID returns the "parent" edge ID in the mutation.

func (*PetMutation) ParentIDs added in v0.3.2

func (m *PetMutation) ParentIDs() (ids []int)

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

func (*PetMutation) PlayGroupsCleared added in v0.3.2

func (m *PetMutation) PlayGroupsCleared() bool

PlayGroupsCleared reports if the "play_groups" edge to the PlayGroup entity was cleared.

func (*PetMutation) PlayGroupsIDs added in v0.3.2

func (m *PetMutation) PlayGroupsIDs() (ids []int)

PlayGroupsIDs returns the "play_groups" edge IDs in the mutation.

func (*PetMutation) ProtegeCleared added in v0.3.2

func (m *PetMutation) ProtegeCleared() bool

ProtegeCleared reports if the "protege" edge to the Pet entity was cleared.

func (*PetMutation) ProtegeID added in v0.3.2

func (m *PetMutation) ProtegeID() (id int, exists bool)

ProtegeID returns the "protege" edge ID in the mutation.

func (*PetMutation) ProtegeIDs added in v0.3.2

func (m *PetMutation) ProtegeIDs() (ids []int)

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

func (*PetMutation) RemoveChildIDs added in v0.3.2

func (m *PetMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Pet entity by IDs.

func (*PetMutation) RemoveFriendIDs

func (m *PetMutation) RemoveFriendIDs(ids ...int)

RemoveFriendIDs removes the "friends" edge to the Pet entity by IDs.

func (*PetMutation) RemovePlayGroupIDs added in v0.3.2

func (m *PetMutation) RemovePlayGroupIDs(ids ...int)

RemovePlayGroupIDs removes the "play_groups" edge to the PlayGroup entity by IDs.

func (*PetMutation) RemoveToyIDs added in v0.3.2

func (m *PetMutation) RemoveToyIDs(ids ...int)

RemoveToyIDs removes the "toys" edge to the Toy entity by IDs.

func (*PetMutation) RemovedChildrenIDs added in v0.3.2

func (m *PetMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the Pet entity.

func (*PetMutation) RemovedEdges

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

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

func (*PetMutation) RemovedFriendsIDs

func (m *PetMutation) RemovedFriendsIDs() (ids []int)

RemovedFriends returns the removed IDs of the "friends" edge to the Pet entity.

func (*PetMutation) RemovedIDs

func (m *PetMutation) 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 (*PetMutation) RemovedPlayGroupsIDs added in v0.3.2

func (m *PetMutation) RemovedPlayGroupsIDs() (ids []int)

RemovedPlayGroups returns the removed IDs of the "play_groups" edge to the PlayGroup entity.

func (*PetMutation) RemovedToysIDs added in v0.3.2

func (m *PetMutation) RemovedToysIDs() (ids []int)

RemovedToys returns the removed IDs of the "toys" edge to the Toy entity.

func (*PetMutation) ResetBadge added in v0.3.2

func (m *PetMutation) ResetBadge()

ResetBadge resets all changes to the "badge" edge.

func (*PetMutation) ResetBirthday added in v0.3.2

func (m *PetMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*PetMutation) ResetCastrated added in v0.3.2

func (m *PetMutation) ResetCastrated()

ResetCastrated resets all changes to the "castrated" field.

func (*PetMutation) ResetChildren added in v0.3.2

func (m *PetMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*PetMutation) ResetChip added in v0.3.2

func (m *PetMutation) ResetChip()

ResetChip resets all changes to the "chip" field.

func (*PetMutation) ResetEdge

func (m *PetMutation) 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 (*PetMutation) ResetField

func (m *PetMutation) 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 (*PetMutation) ResetFriends

func (m *PetMutation) ResetFriends()

ResetFriends resets all changes to the "friends" edge.

func (*PetMutation) ResetHeight added in v0.3.2

func (m *PetMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*PetMutation) ResetMentor added in v0.3.2

func (m *PetMutation) ResetMentor()

ResetMentor resets all changes to the "mentor" edge.

func (*PetMutation) ResetName

func (m *PetMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PetMutation) ResetNicknames added in v0.3.2

func (m *PetMutation) ResetNicknames()

ResetNicknames resets all changes to the "nicknames" field.

func (*PetMutation) ResetParent added in v0.3.2

func (m *PetMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*PetMutation) ResetPlayGroups added in v0.3.2

func (m *PetMutation) ResetPlayGroups()

ResetPlayGroups resets all changes to the "play_groups" edge.

func (*PetMutation) ResetProtege added in v0.3.2

func (m *PetMutation) ResetProtege()

ResetProtege resets all changes to the "protege" edge.

func (*PetMutation) ResetSex added in v0.3.2

func (m *PetMutation) ResetSex()

ResetSex resets all changes to the "sex" field.

func (*PetMutation) ResetSpouse added in v0.3.2

func (m *PetMutation) ResetSpouse()

ResetSpouse resets all changes to the "spouse" edge.

func (*PetMutation) ResetToys added in v0.3.2

func (m *PetMutation) ResetToys()

ResetToys resets all changes to the "toys" edge.

func (*PetMutation) ResetWeight added in v0.3.2

func (m *PetMutation) ResetWeight()

ResetWeight resets all changes to the "weight" field.

func (*PetMutation) SetBadgeID added in v0.3.2

func (m *PetMutation) SetBadgeID(id int)

SetBadgeID sets the "badge" edge to the Badge entity by id.

func (*PetMutation) SetBirthday added in v0.3.2

func (m *PetMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*PetMutation) SetCastrated added in v0.3.2

func (m *PetMutation) SetCastrated(b bool)

SetCastrated sets the "castrated" field.

func (*PetMutation) SetChip added in v0.3.2

func (m *PetMutation) SetChip(u uuid.UUID)

SetChip sets the "chip" field.

func (*PetMutation) SetField

func (m *PetMutation) 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 (*PetMutation) SetHeight added in v0.3.2

func (m *PetMutation) SetHeight(i int)

SetHeight sets the "height" field.

func (*PetMutation) SetMentorID added in v0.3.2

func (m *PetMutation) SetMentorID(id int)

SetMentorID sets the "mentor" edge to the Pet entity by id.

func (*PetMutation) SetName

func (m *PetMutation) SetName(s string)

SetName sets the "name" field.

func (*PetMutation) SetNicknames added in v0.3.2

func (m *PetMutation) SetNicknames(s []string)

SetNicknames sets the "nicknames" field.

func (*PetMutation) SetParentID added in v0.3.2

func (m *PetMutation) SetParentID(id int)

SetParentID sets the "parent" edge to the Pet entity by id.

func (*PetMutation) SetProtegeID added in v0.3.2

func (m *PetMutation) SetProtegeID(id int)

SetProtegeID sets the "protege" edge to the Pet entity by id.

func (*PetMutation) SetSex added in v0.3.2

func (m *PetMutation) SetSex(pe pet.Sex)

SetSex sets the "sex" field.

func (*PetMutation) SetSpouseID added in v0.3.2

func (m *PetMutation) SetSpouseID(id int)

SetSpouseID sets the "spouse" edge to the Pet entity by id.

func (*PetMutation) SetWeight added in v0.3.2

func (m *PetMutation) SetWeight(f float64)

SetWeight sets the "weight" field.

func (*PetMutation) Sex added in v0.3.2

func (m *PetMutation) Sex() (r pet.Sex, exists bool)

Sex returns the value of the "sex" field in the mutation.

func (*PetMutation) SpouseCleared added in v0.3.2

func (m *PetMutation) SpouseCleared() bool

SpouseCleared reports if the "spouse" edge to the Pet entity was cleared.

func (*PetMutation) SpouseID added in v0.3.2

func (m *PetMutation) SpouseID() (id int, exists bool)

SpouseID returns the "spouse" edge ID in the mutation.

func (*PetMutation) SpouseIDs added in v0.3.2

func (m *PetMutation) SpouseIDs() (ids []int)

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

func (*PetMutation) ToysCleared added in v0.3.2

func (m *PetMutation) ToysCleared() bool

ToysCleared reports if the "toys" edge to the Toy entity was cleared.

func (*PetMutation) ToysIDs added in v0.3.2

func (m *PetMutation) ToysIDs() (ids []int)

ToysIDs returns the "toys" edge IDs in the mutation.

func (PetMutation) Tx

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

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

func (*PetMutation) Type

func (m *PetMutation) Type() string

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

func (*PetMutation) Weight added in v0.3.2

func (m *PetMutation) Weight() (r float64, exists bool)

Weight returns the value of the "weight" field in the mutation.

func (*PetMutation) WeightCleared added in v0.3.2

func (m *PetMutation) WeightCleared() bool

WeightCleared returns if the "weight" field was cleared in this mutation.

func (*PetMutation) Where

func (m *PetMutation) Where(ps ...predicate.Pet)

Where appends a list predicates to the PetMutation builder.

type PetQuery

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

PetQuery is the builder for querying Pet entities.

func (*PetQuery) All

func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error)

All executes the query and returns a list of Pets.

func (*PetQuery) AllX

func (pq *PetQuery) AllX(ctx context.Context) []*Pet

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

func (*PetQuery) Clone

func (pq *PetQuery) Clone() *PetQuery

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

func (*PetQuery) Count

func (pq *PetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PetQuery) CountX

func (pq *PetQuery) CountX(ctx context.Context) int

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

func (*PetQuery) Exist

func (pq *PetQuery) Exist(ctx context.Context) (bool, error)

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

func (*PetQuery) ExistX

func (pq *PetQuery) ExistX(ctx context.Context) bool

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

func (*PetQuery) First

func (pq *PetQuery) First(ctx context.Context) (*Pet, error)

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

func (*PetQuery) FirstID

func (pq *PetQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PetQuery) FirstIDX

func (pq *PetQuery) FirstIDX(ctx context.Context) int

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

func (*PetQuery) FirstX

func (pq *PetQuery) FirstX(ctx context.Context) *Pet

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

func (*PetQuery) GroupBy

func (pq *PetQuery) GroupBy(field string, fields ...string) *PetGroupBy

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 {
	Height int `json:"height,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Pet.Query().
	GroupBy(pet.FieldHeight).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PetQuery) IDs

func (pq *PetQuery) IDs(ctx context.Context) ([]int, error)

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

func (*PetQuery) IDsX

func (pq *PetQuery) IDsX(ctx context.Context) []int

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

func (*PetQuery) Limit

func (pq *PetQuery) Limit(limit int) *PetQuery

Limit adds a limit step to the query.

func (*PetQuery) Offset

func (pq *PetQuery) Offset(offset int) *PetQuery

Offset adds an offset step to the query.

func (*PetQuery) Only

func (pq *PetQuery) Only(ctx context.Context) (*Pet, error)

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

func (*PetQuery) OnlyID

func (pq *PetQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PetQuery) OnlyIDX

func (pq *PetQuery) OnlyIDX(ctx context.Context) int

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

func (*PetQuery) OnlyX

func (pq *PetQuery) OnlyX(ctx context.Context) *Pet

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

func (*PetQuery) Order

func (pq *PetQuery) Order(o ...OrderFunc) *PetQuery

Order adds an order step to the query.

func (*PetQuery) QueryBadge added in v0.3.2

func (pq *PetQuery) QueryBadge() *BadgeQuery

QueryBadge chains the current query on the "badge" edge.

func (*PetQuery) QueryChildren added in v0.3.2

func (pq *PetQuery) QueryChildren() *PetQuery

QueryChildren chains the current query on the "children" edge.

func (*PetQuery) QueryFriends

func (pq *PetQuery) QueryFriends() *PetQuery

QueryFriends chains the current query on the "friends" edge.

func (*PetQuery) QueryMentor added in v0.3.2

func (pq *PetQuery) QueryMentor() *PetQuery

QueryMentor chains the current query on the "mentor" edge.

func (*PetQuery) QueryParent added in v0.3.2

func (pq *PetQuery) QueryParent() *PetQuery

QueryParent chains the current query on the "parent" edge.

func (*PetQuery) QueryPlayGroups added in v0.3.2

func (pq *PetQuery) QueryPlayGroups() *PlayGroupQuery

QueryPlayGroups chains the current query on the "play_groups" edge.

func (*PetQuery) QueryProtege added in v0.3.2

func (pq *PetQuery) QueryProtege() *PetQuery

QueryProtege chains the current query on the "protege" edge.

func (*PetQuery) QuerySpouse added in v0.3.2

func (pq *PetQuery) QuerySpouse() *PetQuery

QuerySpouse chains the current query on the "spouse" edge.

func (*PetQuery) QueryToys added in v0.3.2

func (pq *PetQuery) QueryToys() *ToyQuery

QueryToys chains the current query on the "toys" edge.

func (*PetQuery) Select

func (pq *PetQuery) Select(fields ...string) *PetSelect

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 {
	Height int `json:"height,omitempty"`
}

client.Pet.Query().
	Select(pet.FieldHeight).
	Scan(ctx, &v)

func (*PetQuery) Unique

func (pq *PetQuery) Unique(unique bool) *PetQuery

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 (*PetQuery) Where

func (pq *PetQuery) Where(ps ...predicate.Pet) *PetQuery

Where adds a new predicate for the PetQuery builder.

func (*PetQuery) WithBadge added in v0.3.2

func (pq *PetQuery) WithBadge(opts ...func(*BadgeQuery)) *PetQuery

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

func (*PetQuery) WithChildren added in v0.3.2

func (pq *PetQuery) WithChildren(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithFriends

func (pq *PetQuery) WithFriends(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithMentor added in v0.3.2

func (pq *PetQuery) WithMentor(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithParent added in v0.3.2

func (pq *PetQuery) WithParent(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithPlayGroups added in v0.3.2

func (pq *PetQuery) WithPlayGroups(opts ...func(*PlayGroupQuery)) *PetQuery

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

func (*PetQuery) WithProtege added in v0.3.2

func (pq *PetQuery) WithProtege(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithSpouse added in v0.3.2

func (pq *PetQuery) WithSpouse(opts ...func(*PetQuery)) *PetQuery

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

func (*PetQuery) WithToys added in v0.3.2

func (pq *PetQuery) WithToys(opts ...func(*ToyQuery)) *PetQuery

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

type PetSelect

type PetSelect struct {
	*PetQuery
	// contains filtered or unexported fields
}

PetSelect is the builder for selecting fields of Pet entities.

func (*PetSelect) Bool

func (ps *PetSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*PetSelect) BoolX

func (ps *PetSelect) BoolX(ctx context.Context) bool

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

func (*PetSelect) Bools

func (ps *PetSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*PetSelect) BoolsX

func (ps *PetSelect) BoolsX(ctx context.Context) []bool

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

func (*PetSelect) Float64

func (ps *PetSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*PetSelect) Float64X

func (ps *PetSelect) Float64X(ctx context.Context) float64

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

func (*PetSelect) Float64s

func (ps *PetSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*PetSelect) Float64sX

func (ps *PetSelect) Float64sX(ctx context.Context) []float64

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

func (*PetSelect) Int

func (ps *PetSelect) Int(ctx context.Context) (_ int, err error)

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

func (*PetSelect) IntX

func (ps *PetSelect) IntX(ctx context.Context) int

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

func (*PetSelect) Ints

func (ps *PetSelect) Ints(ctx context.Context) ([]int, error)

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

func (*PetSelect) IntsX

func (ps *PetSelect) IntsX(ctx context.Context) []int

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

func (*PetSelect) Scan

func (ps *PetSelect) Scan(ctx context.Context, v interface{}) error

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

func (*PetSelect) ScanX

func (ps *PetSelect) ScanX(ctx context.Context, v interface{})

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

func (*PetSelect) String

func (ps *PetSelect) String(ctx context.Context) (_ string, err error)

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

func (*PetSelect) StringX

func (ps *PetSelect) StringX(ctx context.Context) string

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

func (*PetSelect) Strings

func (ps *PetSelect) Strings(ctx context.Context) ([]string, error)

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

func (*PetSelect) StringsX

func (ps *PetSelect) StringsX(ctx context.Context) []string

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

type PetUpdate

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

PetUpdate is the builder for updating Pet entities.

func (*PetUpdate) AddChildIDs added in v0.3.2

func (pu *PetUpdate) AddChildIDs(ids ...int) *PetUpdate

AddChildIDs adds the "children" edge to the Pet entity by IDs.

func (*PetUpdate) AddChildren added in v0.3.2

func (pu *PetUpdate) AddChildren(p ...*Pet) *PetUpdate

AddChildren adds the "children" edges to the Pet entity.

func (*PetUpdate) AddFriendIDs

func (pu *PetUpdate) AddFriendIDs(ids ...int) *PetUpdate

AddFriendIDs adds the "friends" edge to the Pet entity by IDs.

func (*PetUpdate) AddFriends

func (pu *PetUpdate) AddFriends(p ...*Pet) *PetUpdate

AddFriends adds the "friends" edges to the Pet entity.

func (*PetUpdate) AddHeight added in v0.3.2

func (pu *PetUpdate) AddHeight(i int) *PetUpdate

AddHeight adds i to the "height" field.

func (*PetUpdate) AddPlayGroupIDs added in v0.3.2

func (pu *PetUpdate) AddPlayGroupIDs(ids ...int) *PetUpdate

AddPlayGroupIDs adds the "play_groups" edge to the PlayGroup entity by IDs.

func (*PetUpdate) AddPlayGroups added in v0.3.2

func (pu *PetUpdate) AddPlayGroups(p ...*PlayGroup) *PetUpdate

AddPlayGroups adds the "play_groups" edges to the PlayGroup entity.

func (*PetUpdate) AddToyIDs added in v0.3.2

func (pu *PetUpdate) AddToyIDs(ids ...int) *PetUpdate

AddToyIDs adds the "toys" edge to the Toy entity by IDs.

func (*PetUpdate) AddToys added in v0.3.2

func (pu *PetUpdate) AddToys(t ...*Toy) *PetUpdate

AddToys adds the "toys" edges to the Toy entity.

func (*PetUpdate) AddWeight added in v0.3.2

func (pu *PetUpdate) AddWeight(f float64) *PetUpdate

AddWeight adds f to the "weight" field.

func (*PetUpdate) ClearBadge added in v0.3.2

func (pu *PetUpdate) ClearBadge() *PetUpdate

ClearBadge clears the "badge" edge to the Badge entity.

func (*PetUpdate) ClearBirthday added in v0.3.2

func (pu *PetUpdate) ClearBirthday() *PetUpdate

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdate) ClearChildren added in v0.3.2

func (pu *PetUpdate) ClearChildren() *PetUpdate

ClearChildren clears all "children" edges to the Pet entity.

func (*PetUpdate) ClearFriends

func (pu *PetUpdate) ClearFriends() *PetUpdate

ClearFriends clears all "friends" edges to the Pet entity.

func (*PetUpdate) ClearMentor added in v0.3.2

func (pu *PetUpdate) ClearMentor() *PetUpdate

ClearMentor clears the "mentor" edge to the Pet entity.

func (*PetUpdate) ClearNicknames added in v0.3.2

func (pu *PetUpdate) ClearNicknames() *PetUpdate

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdate) ClearParent added in v0.3.2

func (pu *PetUpdate) ClearParent() *PetUpdate

ClearParent clears the "parent" edge to the Pet entity.

func (*PetUpdate) ClearPlayGroups added in v0.3.2

func (pu *PetUpdate) ClearPlayGroups() *PetUpdate

ClearPlayGroups clears all "play_groups" edges to the PlayGroup entity.

func (*PetUpdate) ClearProtege added in v0.3.2

func (pu *PetUpdate) ClearProtege() *PetUpdate

ClearProtege clears the "protege" edge to the Pet entity.

func (*PetUpdate) ClearSpouse added in v0.3.2

func (pu *PetUpdate) ClearSpouse() *PetUpdate

ClearSpouse clears the "spouse" edge to the Pet entity.

func (*PetUpdate) ClearToys added in v0.3.2

func (pu *PetUpdate) ClearToys() *PetUpdate

ClearToys clears all "toys" edges to the Toy entity.

func (*PetUpdate) ClearWeight added in v0.3.2

func (pu *PetUpdate) ClearWeight() *PetUpdate

ClearWeight clears the value of the "weight" field.

func (*PetUpdate) Exec

func (pu *PetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PetUpdate) ExecX

func (pu *PetUpdate) ExecX(ctx context.Context)

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

func (*PetUpdate) Mutation

func (pu *PetUpdate) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdate) RemoveChildIDs added in v0.3.2

func (pu *PetUpdate) RemoveChildIDs(ids ...int) *PetUpdate

RemoveChildIDs removes the "children" edge to Pet entities by IDs.

func (*PetUpdate) RemoveChildren added in v0.3.2

func (pu *PetUpdate) RemoveChildren(p ...*Pet) *PetUpdate

RemoveChildren removes "children" edges to Pet entities.

func (*PetUpdate) RemoveFriendIDs

func (pu *PetUpdate) RemoveFriendIDs(ids ...int) *PetUpdate

RemoveFriendIDs removes the "friends" edge to Pet entities by IDs.

func (*PetUpdate) RemoveFriends

func (pu *PetUpdate) RemoveFriends(p ...*Pet) *PetUpdate

RemoveFriends removes "friends" edges to Pet entities.

func (*PetUpdate) RemovePlayGroupIDs added in v0.3.2

func (pu *PetUpdate) RemovePlayGroupIDs(ids ...int) *PetUpdate

RemovePlayGroupIDs removes the "play_groups" edge to PlayGroup entities by IDs.

func (*PetUpdate) RemovePlayGroups added in v0.3.2

func (pu *PetUpdate) RemovePlayGroups(p ...*PlayGroup) *PetUpdate

RemovePlayGroups removes "play_groups" edges to PlayGroup entities.

func (*PetUpdate) RemoveToyIDs added in v0.3.2

func (pu *PetUpdate) RemoveToyIDs(ids ...int) *PetUpdate

RemoveToyIDs removes the "toys" edge to Toy entities by IDs.

func (*PetUpdate) RemoveToys added in v0.3.2

func (pu *PetUpdate) RemoveToys(t ...*Toy) *PetUpdate

RemoveToys removes "toys" edges to Toy entities.

func (*PetUpdate) Save

func (pu *PetUpdate) Save(ctx context.Context) (int, error)

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

func (*PetUpdate) SaveX

func (pu *PetUpdate) SaveX(ctx context.Context) int

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

func (*PetUpdate) SetBadge added in v0.3.2

func (pu *PetUpdate) SetBadge(b *Badge) *PetUpdate

SetBadge sets the "badge" edge to the Badge entity.

func (*PetUpdate) SetBadgeID added in v0.3.2

func (pu *PetUpdate) SetBadgeID(id int) *PetUpdate

SetBadgeID sets the "badge" edge to the Badge entity by ID.

func (*PetUpdate) SetBirthday added in v0.3.2

func (pu *PetUpdate) SetBirthday(t time.Time) *PetUpdate

SetBirthday sets the "birthday" field.

func (*PetUpdate) SetCastrated added in v0.3.2

func (pu *PetUpdate) SetCastrated(b bool) *PetUpdate

SetCastrated sets the "castrated" field.

func (*PetUpdate) SetChip added in v0.3.2

func (pu *PetUpdate) SetChip(u uuid.UUID) *PetUpdate

SetChip sets the "chip" field.

func (*PetUpdate) SetHeight added in v0.3.2

func (pu *PetUpdate) SetHeight(i int) *PetUpdate

SetHeight sets the "height" field.

func (*PetUpdate) SetMentor added in v0.3.2

func (pu *PetUpdate) SetMentor(p *Pet) *PetUpdate

SetMentor sets the "mentor" edge to the Pet entity.

func (*PetUpdate) SetMentorID added in v0.3.2

func (pu *PetUpdate) SetMentorID(id int) *PetUpdate

SetMentorID sets the "mentor" edge to the Pet entity by ID.

func (*PetUpdate) SetName

func (pu *PetUpdate) SetName(s string) *PetUpdate

SetName sets the "name" field.

func (*PetUpdate) SetNicknames added in v0.3.2

func (pu *PetUpdate) SetNicknames(s []string) *PetUpdate

SetNicknames sets the "nicknames" field.

func (*PetUpdate) SetNillableBirthday added in v0.3.2

func (pu *PetUpdate) SetNillableBirthday(t *time.Time) *PetUpdate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*PetUpdate) SetNillableMentorID added in v0.3.2

func (pu *PetUpdate) SetNillableMentorID(id *int) *PetUpdate

SetNillableMentorID sets the "mentor" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdate) SetNillableParentID added in v0.3.2

func (pu *PetUpdate) SetNillableParentID(id *int) *PetUpdate

SetNillableParentID sets the "parent" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdate) SetNillableProtegeID added in v0.3.2

func (pu *PetUpdate) SetNillableProtegeID(id *int) *PetUpdate

SetNillableProtegeID sets the "protege" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdate) SetNillableSpouseID added in v0.3.2

func (pu *PetUpdate) SetNillableSpouseID(id *int) *PetUpdate

SetNillableSpouseID sets the "spouse" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdate) SetNillableWeight added in v0.3.2

func (pu *PetUpdate) SetNillableWeight(f *float64) *PetUpdate

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PetUpdate) SetParent added in v0.3.2

func (pu *PetUpdate) SetParent(p *Pet) *PetUpdate

SetParent sets the "parent" edge to the Pet entity.

func (*PetUpdate) SetParentID added in v0.3.2

func (pu *PetUpdate) SetParentID(id int) *PetUpdate

SetParentID sets the "parent" edge to the Pet entity by ID.

func (*PetUpdate) SetProtege added in v0.3.2

func (pu *PetUpdate) SetProtege(p *Pet) *PetUpdate

SetProtege sets the "protege" edge to the Pet entity.

func (*PetUpdate) SetProtegeID added in v0.3.2

func (pu *PetUpdate) SetProtegeID(id int) *PetUpdate

SetProtegeID sets the "protege" edge to the Pet entity by ID.

func (*PetUpdate) SetSex added in v0.3.2

func (pu *PetUpdate) SetSex(pe pet.Sex) *PetUpdate

SetSex sets the "sex" field.

func (*PetUpdate) SetSpouse added in v0.3.2

func (pu *PetUpdate) SetSpouse(p *Pet) *PetUpdate

SetSpouse sets the "spouse" edge to the Pet entity.

func (*PetUpdate) SetSpouseID added in v0.3.2

func (pu *PetUpdate) SetSpouseID(id int) *PetUpdate

SetSpouseID sets the "spouse" edge to the Pet entity by ID.

func (*PetUpdate) SetWeight added in v0.3.2

func (pu *PetUpdate) SetWeight(f float64) *PetUpdate

SetWeight sets the "weight" field.

func (*PetUpdate) Where

func (pu *PetUpdate) Where(ps ...predicate.Pet) *PetUpdate

Where appends a list predicates to the PetUpdate builder.

type PetUpdateOne

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

PetUpdateOne is the builder for updating a single Pet entity.

func (*PetUpdateOne) AddChildIDs added in v0.3.2

func (puo *PetUpdateOne) AddChildIDs(ids ...int) *PetUpdateOne

AddChildIDs adds the "children" edge to the Pet entity by IDs.

func (*PetUpdateOne) AddChildren added in v0.3.2

func (puo *PetUpdateOne) AddChildren(p ...*Pet) *PetUpdateOne

AddChildren adds the "children" edges to the Pet entity.

func (*PetUpdateOne) AddFriendIDs

func (puo *PetUpdateOne) AddFriendIDs(ids ...int) *PetUpdateOne

AddFriendIDs adds the "friends" edge to the Pet entity by IDs.

func (*PetUpdateOne) AddFriends

func (puo *PetUpdateOne) AddFriends(p ...*Pet) *PetUpdateOne

AddFriends adds the "friends" edges to the Pet entity.

func (*PetUpdateOne) AddHeight added in v0.3.2

func (puo *PetUpdateOne) AddHeight(i int) *PetUpdateOne

AddHeight adds i to the "height" field.

func (*PetUpdateOne) AddPlayGroupIDs added in v0.3.2

func (puo *PetUpdateOne) AddPlayGroupIDs(ids ...int) *PetUpdateOne

AddPlayGroupIDs adds the "play_groups" edge to the PlayGroup entity by IDs.

func (*PetUpdateOne) AddPlayGroups added in v0.3.2

func (puo *PetUpdateOne) AddPlayGroups(p ...*PlayGroup) *PetUpdateOne

AddPlayGroups adds the "play_groups" edges to the PlayGroup entity.

func (*PetUpdateOne) AddToyIDs added in v0.3.2

func (puo *PetUpdateOne) AddToyIDs(ids ...int) *PetUpdateOne

AddToyIDs adds the "toys" edge to the Toy entity by IDs.

func (*PetUpdateOne) AddToys added in v0.3.2

func (puo *PetUpdateOne) AddToys(t ...*Toy) *PetUpdateOne

AddToys adds the "toys" edges to the Toy entity.

func (*PetUpdateOne) AddWeight added in v0.3.2

func (puo *PetUpdateOne) AddWeight(f float64) *PetUpdateOne

AddWeight adds f to the "weight" field.

func (*PetUpdateOne) ClearBadge added in v0.3.2

func (puo *PetUpdateOne) ClearBadge() *PetUpdateOne

ClearBadge clears the "badge" edge to the Badge entity.

func (*PetUpdateOne) ClearBirthday added in v0.3.2

func (puo *PetUpdateOne) ClearBirthday() *PetUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdateOne) ClearChildren added in v0.3.2

func (puo *PetUpdateOne) ClearChildren() *PetUpdateOne

ClearChildren clears all "children" edges to the Pet entity.

func (*PetUpdateOne) ClearFriends

func (puo *PetUpdateOne) ClearFriends() *PetUpdateOne

ClearFriends clears all "friends" edges to the Pet entity.

func (*PetUpdateOne) ClearMentor added in v0.3.2

func (puo *PetUpdateOne) ClearMentor() *PetUpdateOne

ClearMentor clears the "mentor" edge to the Pet entity.

func (*PetUpdateOne) ClearNicknames added in v0.3.2

func (puo *PetUpdateOne) ClearNicknames() *PetUpdateOne

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdateOne) ClearParent added in v0.3.2

func (puo *PetUpdateOne) ClearParent() *PetUpdateOne

ClearParent clears the "parent" edge to the Pet entity.

func (*PetUpdateOne) ClearPlayGroups added in v0.3.2

func (puo *PetUpdateOne) ClearPlayGroups() *PetUpdateOne

ClearPlayGroups clears all "play_groups" edges to the PlayGroup entity.

func (*PetUpdateOne) ClearProtege added in v0.3.2

func (puo *PetUpdateOne) ClearProtege() *PetUpdateOne

ClearProtege clears the "protege" edge to the Pet entity.

func (*PetUpdateOne) ClearSpouse added in v0.3.2

func (puo *PetUpdateOne) ClearSpouse() *PetUpdateOne

ClearSpouse clears the "spouse" edge to the Pet entity.

func (*PetUpdateOne) ClearToys added in v0.3.2

func (puo *PetUpdateOne) ClearToys() *PetUpdateOne

ClearToys clears all "toys" edges to the Toy entity.

func (*PetUpdateOne) ClearWeight added in v0.3.2

func (puo *PetUpdateOne) ClearWeight() *PetUpdateOne

ClearWeight clears the value of the "weight" field.

func (*PetUpdateOne) Exec

func (puo *PetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PetUpdateOne) ExecX

func (puo *PetUpdateOne) ExecX(ctx context.Context)

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

func (*PetUpdateOne) Mutation

func (puo *PetUpdateOne) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdateOne) RemoveChildIDs added in v0.3.2

func (puo *PetUpdateOne) RemoveChildIDs(ids ...int) *PetUpdateOne

RemoveChildIDs removes the "children" edge to Pet entities by IDs.

func (*PetUpdateOne) RemoveChildren added in v0.3.2

func (puo *PetUpdateOne) RemoveChildren(p ...*Pet) *PetUpdateOne

RemoveChildren removes "children" edges to Pet entities.

func (*PetUpdateOne) RemoveFriendIDs

func (puo *PetUpdateOne) RemoveFriendIDs(ids ...int) *PetUpdateOne

RemoveFriendIDs removes the "friends" edge to Pet entities by IDs.

func (*PetUpdateOne) RemoveFriends

func (puo *PetUpdateOne) RemoveFriends(p ...*Pet) *PetUpdateOne

RemoveFriends removes "friends" edges to Pet entities.

func (*PetUpdateOne) RemovePlayGroupIDs added in v0.3.2

func (puo *PetUpdateOne) RemovePlayGroupIDs(ids ...int) *PetUpdateOne

RemovePlayGroupIDs removes the "play_groups" edge to PlayGroup entities by IDs.

func (*PetUpdateOne) RemovePlayGroups added in v0.3.2

func (puo *PetUpdateOne) RemovePlayGroups(p ...*PlayGroup) *PetUpdateOne

RemovePlayGroups removes "play_groups" edges to PlayGroup entities.

func (*PetUpdateOne) RemoveToyIDs added in v0.3.2

func (puo *PetUpdateOne) RemoveToyIDs(ids ...int) *PetUpdateOne

RemoveToyIDs removes the "toys" edge to Toy entities by IDs.

func (*PetUpdateOne) RemoveToys added in v0.3.2

func (puo *PetUpdateOne) RemoveToys(t ...*Toy) *PetUpdateOne

RemoveToys removes "toys" edges to Toy entities.

func (*PetUpdateOne) Save

func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error)

Save executes the query and returns the updated Pet entity.

func (*PetUpdateOne) SaveX

func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet

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

func (*PetUpdateOne) Select

func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne

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

func (*PetUpdateOne) SetBadge added in v0.3.2

func (puo *PetUpdateOne) SetBadge(b *Badge) *PetUpdateOne

SetBadge sets the "badge" edge to the Badge entity.

func (*PetUpdateOne) SetBadgeID added in v0.3.2

func (puo *PetUpdateOne) SetBadgeID(id int) *PetUpdateOne

SetBadgeID sets the "badge" edge to the Badge entity by ID.

func (*PetUpdateOne) SetBirthday added in v0.3.2

func (puo *PetUpdateOne) SetBirthday(t time.Time) *PetUpdateOne

SetBirthday sets the "birthday" field.

func (*PetUpdateOne) SetCastrated added in v0.3.2

func (puo *PetUpdateOne) SetCastrated(b bool) *PetUpdateOne

SetCastrated sets the "castrated" field.

func (*PetUpdateOne) SetChip added in v0.3.2

func (puo *PetUpdateOne) SetChip(u uuid.UUID) *PetUpdateOne

SetChip sets the "chip" field.

func (*PetUpdateOne) SetHeight added in v0.3.2

func (puo *PetUpdateOne) SetHeight(i int) *PetUpdateOne

SetHeight sets the "height" field.

func (*PetUpdateOne) SetMentor added in v0.3.2

func (puo *PetUpdateOne) SetMentor(p *Pet) *PetUpdateOne

SetMentor sets the "mentor" edge to the Pet entity.

func (*PetUpdateOne) SetMentorID added in v0.3.2

func (puo *PetUpdateOne) SetMentorID(id int) *PetUpdateOne

SetMentorID sets the "mentor" edge to the Pet entity by ID.

func (*PetUpdateOne) SetName

func (puo *PetUpdateOne) SetName(s string) *PetUpdateOne

SetName sets the "name" field.

func (*PetUpdateOne) SetNicknames added in v0.3.2

func (puo *PetUpdateOne) SetNicknames(s []string) *PetUpdateOne

SetNicknames sets the "nicknames" field.

func (*PetUpdateOne) SetNillableBirthday added in v0.3.2

func (puo *PetUpdateOne) SetNillableBirthday(t *time.Time) *PetUpdateOne

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*PetUpdateOne) SetNillableMentorID added in v0.3.2

func (puo *PetUpdateOne) SetNillableMentorID(id *int) *PetUpdateOne

SetNillableMentorID sets the "mentor" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdateOne) SetNillableParentID added in v0.3.2

func (puo *PetUpdateOne) SetNillableParentID(id *int) *PetUpdateOne

SetNillableParentID sets the "parent" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdateOne) SetNillableProtegeID added in v0.3.2

func (puo *PetUpdateOne) SetNillableProtegeID(id *int) *PetUpdateOne

SetNillableProtegeID sets the "protege" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdateOne) SetNillableSpouseID added in v0.3.2

func (puo *PetUpdateOne) SetNillableSpouseID(id *int) *PetUpdateOne

SetNillableSpouseID sets the "spouse" edge to the Pet entity by ID if the given value is not nil.

func (*PetUpdateOne) SetNillableWeight added in v0.3.2

func (puo *PetUpdateOne) SetNillableWeight(f *float64) *PetUpdateOne

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PetUpdateOne) SetParent added in v0.3.2

func (puo *PetUpdateOne) SetParent(p *Pet) *PetUpdateOne

SetParent sets the "parent" edge to the Pet entity.

func (*PetUpdateOne) SetParentID added in v0.3.2

func (puo *PetUpdateOne) SetParentID(id int) *PetUpdateOne

SetParentID sets the "parent" edge to the Pet entity by ID.

func (*PetUpdateOne) SetProtege added in v0.3.2

func (puo *PetUpdateOne) SetProtege(p *Pet) *PetUpdateOne

SetProtege sets the "protege" edge to the Pet entity.

func (*PetUpdateOne) SetProtegeID added in v0.3.2

func (puo *PetUpdateOne) SetProtegeID(id int) *PetUpdateOne

SetProtegeID sets the "protege" edge to the Pet entity by ID.

func (*PetUpdateOne) SetSex added in v0.3.2

func (puo *PetUpdateOne) SetSex(pe pet.Sex) *PetUpdateOne

SetSex sets the "sex" field.

func (*PetUpdateOne) SetSpouse added in v0.3.2

func (puo *PetUpdateOne) SetSpouse(p *Pet) *PetUpdateOne

SetSpouse sets the "spouse" edge to the Pet entity.

func (*PetUpdateOne) SetSpouseID added in v0.3.2

func (puo *PetUpdateOne) SetSpouseID(id int) *PetUpdateOne

SetSpouseID sets the "spouse" edge to the Pet entity by ID.

func (*PetUpdateOne) SetWeight added in v0.3.2

func (puo *PetUpdateOne) SetWeight(f float64) *PetUpdateOne

SetWeight sets the "weight" field.

type Pets

type Pets []*Pet

Pets is a parsable slice of Pet.

type PlayGroup added in v0.3.2

type PlayGroup struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Weekday holds the value of the "weekday" field.
	Weekday playgroup.Weekday `json:"weekday,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PlayGroupQuery when eager-loading is set.
	Edges PlayGroupEdges `json:"edges"`
	// contains filtered or unexported fields
}

PlayGroup is the model entity for the PlayGroup schema.

func (*PlayGroup) QueryParticipants added in v0.3.2

func (pg *PlayGroup) QueryParticipants() *PetQuery

QueryParticipants queries the "participants" edge of the PlayGroup entity.

func (*PlayGroup) String added in v0.3.2

func (pg *PlayGroup) String() string

String implements the fmt.Stringer.

func (*PlayGroup) Unwrap added in v0.3.2

func (pg *PlayGroup) Unwrap() *PlayGroup

Unwrap unwraps the PlayGroup 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 (*PlayGroup) Update added in v0.3.2

func (pg *PlayGroup) Update() *PlayGroupUpdateOne

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

type PlayGroupClient added in v0.3.2

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

PlayGroupClient is a client for the PlayGroup schema.

func NewPlayGroupClient added in v0.3.2

func NewPlayGroupClient(c config) *PlayGroupClient

NewPlayGroupClient returns a client for the PlayGroup from the given config.

func (*PlayGroupClient) Create added in v0.3.2

func (c *PlayGroupClient) Create() *PlayGroupCreate

Create returns a create builder for PlayGroup.

func (*PlayGroupClient) CreateBulk added in v0.3.2

func (c *PlayGroupClient) CreateBulk(builders ...*PlayGroupCreate) *PlayGroupCreateBulk

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

func (*PlayGroupClient) Delete added in v0.3.2

func (c *PlayGroupClient) Delete() *PlayGroupDelete

Delete returns a delete builder for PlayGroup.

func (*PlayGroupClient) DeleteOne added in v0.3.2

func (c *PlayGroupClient) DeleteOne(pg *PlayGroup) *PlayGroupDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PlayGroupClient) DeleteOneID added in v0.3.2

func (c *PlayGroupClient) DeleteOneID(id int) *PlayGroupDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PlayGroupClient) Get added in v0.3.2

func (c *PlayGroupClient) Get(ctx context.Context, id int) (*PlayGroup, error)

Get returns a PlayGroup entity by its id.

func (*PlayGroupClient) GetX added in v0.3.2

func (c *PlayGroupClient) GetX(ctx context.Context, id int) *PlayGroup

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

func (*PlayGroupClient) Hooks added in v0.3.2

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

Hooks returns the client hooks.

func (*PlayGroupClient) Query added in v0.3.2

func (c *PlayGroupClient) Query() *PlayGroupQuery

Query returns a query builder for PlayGroup.

func (*PlayGroupClient) QueryParticipants added in v0.3.2

func (c *PlayGroupClient) QueryParticipants(pg *PlayGroup) *PetQuery

QueryParticipants queries the participants edge of a PlayGroup.

func (*PlayGroupClient) Update added in v0.3.2

func (c *PlayGroupClient) Update() *PlayGroupUpdate

Update returns an update builder for PlayGroup.

func (*PlayGroupClient) UpdateOne added in v0.3.2

func (c *PlayGroupClient) UpdateOne(pg *PlayGroup) *PlayGroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PlayGroupClient) UpdateOneID added in v0.3.2

func (c *PlayGroupClient) UpdateOneID(id int) *PlayGroupUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PlayGroupClient) Use added in v0.3.2

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

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

type PlayGroupCreate added in v0.3.2

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

PlayGroupCreate is the builder for creating a PlayGroup entity.

func (*PlayGroupCreate) AddParticipantIDs added in v0.3.2

func (pgc *PlayGroupCreate) AddParticipantIDs(ids ...int) *PlayGroupCreate

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupCreate) AddParticipants added in v0.3.2

func (pgc *PlayGroupCreate) AddParticipants(p ...*Pet) *PlayGroupCreate

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupCreate) Exec added in v0.3.2

func (pgc *PlayGroupCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupCreate) ExecX added in v0.3.2

func (pgc *PlayGroupCreate) ExecX(ctx context.Context)

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

func (*PlayGroupCreate) Mutation added in v0.3.2

func (pgc *PlayGroupCreate) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupCreate) Save added in v0.3.2

func (pgc *PlayGroupCreate) Save(ctx context.Context) (*PlayGroup, error)

Save creates the PlayGroup in the database.

func (*PlayGroupCreate) SaveX added in v0.3.2

func (pgc *PlayGroupCreate) SaveX(ctx context.Context) *PlayGroup

SaveX calls Save and panics if Save returns an error.

func (*PlayGroupCreate) SetDescription added in v0.3.2

func (pgc *PlayGroupCreate) SetDescription(s string) *PlayGroupCreate

SetDescription sets the "description" field.

func (*PlayGroupCreate) SetNillableDescription added in v0.3.2

func (pgc *PlayGroupCreate) SetNillableDescription(s *string) *PlayGroupCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupCreate) SetTitle added in v0.3.2

func (pgc *PlayGroupCreate) SetTitle(s string) *PlayGroupCreate

SetTitle sets the "title" field.

func (*PlayGroupCreate) SetWeekday added in v0.3.2

func (pgc *PlayGroupCreate) SetWeekday(pl playgroup.Weekday) *PlayGroupCreate

SetWeekday sets the "weekday" field.

type PlayGroupCreateBulk added in v0.3.2

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

PlayGroupCreateBulk is the builder for creating many PlayGroup entities in bulk.

func (*PlayGroupCreateBulk) Exec added in v0.3.2

func (pgcb *PlayGroupCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupCreateBulk) ExecX added in v0.3.2

func (pgcb *PlayGroupCreateBulk) ExecX(ctx context.Context)

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

func (*PlayGroupCreateBulk) Save added in v0.3.2

func (pgcb *PlayGroupCreateBulk) Save(ctx context.Context) ([]*PlayGroup, error)

Save creates the PlayGroup entities in the database.

func (*PlayGroupCreateBulk) SaveX added in v0.3.2

func (pgcb *PlayGroupCreateBulk) SaveX(ctx context.Context) []*PlayGroup

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

type PlayGroupDelete added in v0.3.2

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

PlayGroupDelete is the builder for deleting a PlayGroup entity.

func (*PlayGroupDelete) Exec added in v0.3.2

func (pgd *PlayGroupDelete) Exec(ctx context.Context) (int, error)

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

func (*PlayGroupDelete) ExecX added in v0.3.2

func (pgd *PlayGroupDelete) ExecX(ctx context.Context) int

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

func (*PlayGroupDelete) Where added in v0.3.2

Where appends a list predicates to the PlayGroupDelete builder.

type PlayGroupDeleteOne added in v0.3.2

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

PlayGroupDeleteOne is the builder for deleting a single PlayGroup entity.

func (*PlayGroupDeleteOne) Exec added in v0.3.2

func (pgdo *PlayGroupDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PlayGroupDeleteOne) ExecX added in v0.3.2

func (pgdo *PlayGroupDeleteOne) ExecX(ctx context.Context)

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

type PlayGroupEdges added in v0.3.2

type PlayGroupEdges struct {
	// Participants holds the value of the participants edge.
	Participants []*Pet `json:"participants,omitempty"`
	// contains filtered or unexported fields
}

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

func (PlayGroupEdges) ParticipantsOrErr added in v0.3.2

func (e PlayGroupEdges) ParticipantsOrErr() ([]*Pet, error)

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

type PlayGroupGroupBy added in v0.3.2

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

PlayGroupGroupBy is the group-by builder for PlayGroup entities.

func (*PlayGroupGroupBy) Aggregate added in v0.3.2

func (pggb *PlayGroupGroupBy) Aggregate(fns ...AggregateFunc) *PlayGroupGroupBy

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

func (*PlayGroupGroupBy) Bool added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) BoolX added in v0.3.2

func (pggb *PlayGroupGroupBy) BoolX(ctx context.Context) bool

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

func (*PlayGroupGroupBy) Bools added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) BoolsX added in v0.3.2

func (pggb *PlayGroupGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PlayGroupGroupBy) Float64 added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) Float64X added in v0.3.2

func (pggb *PlayGroupGroupBy) Float64X(ctx context.Context) float64

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

func (*PlayGroupGroupBy) Float64s added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) Float64sX added in v0.3.2

func (pggb *PlayGroupGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PlayGroupGroupBy) Int added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) IntX added in v0.3.2

func (pggb *PlayGroupGroupBy) IntX(ctx context.Context) int

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

func (*PlayGroupGroupBy) Ints added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) IntsX added in v0.3.2

func (pggb *PlayGroupGroupBy) IntsX(ctx context.Context) []int

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

func (*PlayGroupGroupBy) Scan added in v0.3.2

func (pggb *PlayGroupGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*PlayGroupGroupBy) ScanX added in v0.3.2

func (pggb *PlayGroupGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PlayGroupGroupBy) String added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) StringX added in v0.3.2

func (pggb *PlayGroupGroupBy) StringX(ctx context.Context) string

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

func (*PlayGroupGroupBy) Strings added in v0.3.2

func (pggb *PlayGroupGroupBy) 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 (*PlayGroupGroupBy) StringsX added in v0.3.2

func (pggb *PlayGroupGroupBy) StringsX(ctx context.Context) []string

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

type PlayGroupMutation added in v0.3.2

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

PlayGroupMutation represents an operation that mutates the PlayGroup nodes in the graph.

func (*PlayGroupMutation) AddField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) AddParticipantIDs added in v0.3.2

func (m *PlayGroupMutation) AddParticipantIDs(ids ...int)

AddParticipantIDs adds the "participants" edge to the Pet entity by ids.

func (*PlayGroupMutation) AddedEdges added in v0.3.2

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

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

func (*PlayGroupMutation) AddedField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) AddedFields added in v0.3.2

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

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

func (*PlayGroupMutation) AddedIDs added in v0.3.2

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

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

func (*PlayGroupMutation) ClearDescription added in v0.3.2

func (m *PlayGroupMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PlayGroupMutation) ClearEdge added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) ClearField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) ClearParticipants added in v0.3.2

func (m *PlayGroupMutation) ClearParticipants()

ClearParticipants clears the "participants" edge to the Pet entity.

func (*PlayGroupMutation) ClearedEdges added in v0.3.2

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

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

func (*PlayGroupMutation) ClearedFields added in v0.3.2

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

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

func (PlayGroupMutation) Client added in v0.3.2

func (m PlayGroupMutation) 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 (*PlayGroupMutation) Description added in v0.3.2

func (m *PlayGroupMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*PlayGroupMutation) DescriptionCleared added in v0.3.2

func (m *PlayGroupMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PlayGroupMutation) EdgeCleared added in v0.3.2

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

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

func (*PlayGroupMutation) Field added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) FieldCleared added in v0.3.2

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

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

func (*PlayGroupMutation) Fields added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) ID added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) OldDescription added in v0.3.2

func (m *PlayGroupMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the PlayGroup entity. If the PlayGroup 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 (*PlayGroupMutation) OldField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) OldTitle added in v0.3.2

func (m *PlayGroupMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the PlayGroup entity. If the PlayGroup 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 (*PlayGroupMutation) OldWeekday added in v0.3.2

func (m *PlayGroupMutation) OldWeekday(ctx context.Context) (v playgroup.Weekday, err error)

OldWeekday returns the old "weekday" field's value of the PlayGroup entity. If the PlayGroup 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 (*PlayGroupMutation) Op added in v0.3.2

func (m *PlayGroupMutation) Op() Op

Op returns the operation name.

func (*PlayGroupMutation) ParticipantsCleared added in v0.3.2

func (m *PlayGroupMutation) ParticipantsCleared() bool

ParticipantsCleared reports if the "participants" edge to the Pet entity was cleared.

func (*PlayGroupMutation) ParticipantsIDs added in v0.3.2

func (m *PlayGroupMutation) ParticipantsIDs() (ids []int)

ParticipantsIDs returns the "participants" edge IDs in the mutation.

func (*PlayGroupMutation) RemoveParticipantIDs added in v0.3.2

func (m *PlayGroupMutation) RemoveParticipantIDs(ids ...int)

RemoveParticipantIDs removes the "participants" edge to the Pet entity by IDs.

func (*PlayGroupMutation) RemovedEdges added in v0.3.2

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

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

func (*PlayGroupMutation) RemovedIDs added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) RemovedParticipantsIDs added in v0.3.2

func (m *PlayGroupMutation) RemovedParticipantsIDs() (ids []int)

RemovedParticipants returns the removed IDs of the "participants" edge to the Pet entity.

func (*PlayGroupMutation) ResetDescription added in v0.3.2

func (m *PlayGroupMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PlayGroupMutation) ResetEdge added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) ResetField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) ResetParticipants added in v0.3.2

func (m *PlayGroupMutation) ResetParticipants()

ResetParticipants resets all changes to the "participants" edge.

func (*PlayGroupMutation) ResetTitle added in v0.3.2

func (m *PlayGroupMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*PlayGroupMutation) ResetWeekday added in v0.3.2

func (m *PlayGroupMutation) ResetWeekday()

ResetWeekday resets all changes to the "weekday" field.

func (*PlayGroupMutation) SetDescription added in v0.3.2

func (m *PlayGroupMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PlayGroupMutation) SetField added in v0.3.2

func (m *PlayGroupMutation) 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 (*PlayGroupMutation) SetTitle added in v0.3.2

func (m *PlayGroupMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*PlayGroupMutation) SetWeekday added in v0.3.2

func (m *PlayGroupMutation) SetWeekday(pl playgroup.Weekday)

SetWeekday sets the "weekday" field.

func (*PlayGroupMutation) Title added in v0.3.2

func (m *PlayGroupMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (PlayGroupMutation) Tx added in v0.3.2

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

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

func (*PlayGroupMutation) Type added in v0.3.2

func (m *PlayGroupMutation) Type() string

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

func (*PlayGroupMutation) Weekday added in v0.3.2

func (m *PlayGroupMutation) Weekday() (r playgroup.Weekday, exists bool)

Weekday returns the value of the "weekday" field in the mutation.

func (*PlayGroupMutation) Where added in v0.3.2

func (m *PlayGroupMutation) Where(ps ...predicate.PlayGroup)

Where appends a list predicates to the PlayGroupMutation builder.

type PlayGroupQuery added in v0.3.2

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

PlayGroupQuery is the builder for querying PlayGroup entities.

func (*PlayGroupQuery) All added in v0.3.2

func (pgq *PlayGroupQuery) All(ctx context.Context) ([]*PlayGroup, error)

All executes the query and returns a list of PlayGroups.

func (*PlayGroupQuery) AllX added in v0.3.2

func (pgq *PlayGroupQuery) AllX(ctx context.Context) []*PlayGroup

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

func (*PlayGroupQuery) Clone added in v0.3.2

func (pgq *PlayGroupQuery) Clone() *PlayGroupQuery

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

func (*PlayGroupQuery) Count added in v0.3.2

func (pgq *PlayGroupQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PlayGroupQuery) CountX added in v0.3.2

func (pgq *PlayGroupQuery) CountX(ctx context.Context) int

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

func (*PlayGroupQuery) Exist added in v0.3.2

func (pgq *PlayGroupQuery) Exist(ctx context.Context) (bool, error)

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

func (*PlayGroupQuery) ExistX added in v0.3.2

func (pgq *PlayGroupQuery) ExistX(ctx context.Context) bool

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

func (*PlayGroupQuery) First added in v0.3.2

func (pgq *PlayGroupQuery) First(ctx context.Context) (*PlayGroup, error)

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

func (*PlayGroupQuery) FirstID added in v0.3.2

func (pgq *PlayGroupQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PlayGroupQuery) FirstIDX added in v0.3.2

func (pgq *PlayGroupQuery) FirstIDX(ctx context.Context) int

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

func (*PlayGroupQuery) FirstX added in v0.3.2

func (pgq *PlayGroupQuery) FirstX(ctx context.Context) *PlayGroup

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

func (*PlayGroupQuery) GroupBy added in v0.3.2

func (pgq *PlayGroupQuery) GroupBy(field string, fields ...string) *PlayGroupGroupBy

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.PlayGroup.Query().
	GroupBy(playgroup.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PlayGroupQuery) IDs added in v0.3.2

func (pgq *PlayGroupQuery) IDs(ctx context.Context) ([]int, error)

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

func (*PlayGroupQuery) IDsX added in v0.3.2

func (pgq *PlayGroupQuery) IDsX(ctx context.Context) []int

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

func (*PlayGroupQuery) Limit added in v0.3.2

func (pgq *PlayGroupQuery) Limit(limit int) *PlayGroupQuery

Limit adds a limit step to the query.

func (*PlayGroupQuery) Offset added in v0.3.2

func (pgq *PlayGroupQuery) Offset(offset int) *PlayGroupQuery

Offset adds an offset step to the query.

func (*PlayGroupQuery) Only added in v0.3.2

func (pgq *PlayGroupQuery) Only(ctx context.Context) (*PlayGroup, error)

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

func (*PlayGroupQuery) OnlyID added in v0.3.2

func (pgq *PlayGroupQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PlayGroupQuery) OnlyIDX added in v0.3.2

func (pgq *PlayGroupQuery) OnlyIDX(ctx context.Context) int

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

func (*PlayGroupQuery) OnlyX added in v0.3.2

func (pgq *PlayGroupQuery) OnlyX(ctx context.Context) *PlayGroup

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

func (*PlayGroupQuery) Order added in v0.3.2

func (pgq *PlayGroupQuery) Order(o ...OrderFunc) *PlayGroupQuery

Order adds an order step to the query.

func (*PlayGroupQuery) QueryParticipants added in v0.3.2

func (pgq *PlayGroupQuery) QueryParticipants() *PetQuery

QueryParticipants chains the current query on the "participants" edge.

func (*PlayGroupQuery) Select added in v0.3.2

func (pgq *PlayGroupQuery) Select(fields ...string) *PlayGroupSelect

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.PlayGroup.Query().
	Select(playgroup.FieldTitle).
	Scan(ctx, &v)

func (*PlayGroupQuery) Unique added in v0.3.2

func (pgq *PlayGroupQuery) Unique(unique bool) *PlayGroupQuery

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 (*PlayGroupQuery) Where added in v0.3.2

func (pgq *PlayGroupQuery) Where(ps ...predicate.PlayGroup) *PlayGroupQuery

Where adds a new predicate for the PlayGroupQuery builder.

func (*PlayGroupQuery) WithParticipants added in v0.3.2

func (pgq *PlayGroupQuery) WithParticipants(opts ...func(*PetQuery)) *PlayGroupQuery

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

type PlayGroupSelect added in v0.3.2

type PlayGroupSelect struct {
	*PlayGroupQuery
	// contains filtered or unexported fields
}

PlayGroupSelect is the builder for selecting fields of PlayGroup entities.

func (*PlayGroupSelect) Bool added in v0.3.2

func (pgs *PlayGroupSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*PlayGroupSelect) BoolX added in v0.3.2

func (pgs *PlayGroupSelect) BoolX(ctx context.Context) bool

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

func (*PlayGroupSelect) Bools added in v0.3.2

func (pgs *PlayGroupSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*PlayGroupSelect) BoolsX added in v0.3.2

func (pgs *PlayGroupSelect) BoolsX(ctx context.Context) []bool

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

func (*PlayGroupSelect) Float64 added in v0.3.2

func (pgs *PlayGroupSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*PlayGroupSelect) Float64X added in v0.3.2

func (pgs *PlayGroupSelect) Float64X(ctx context.Context) float64

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

func (*PlayGroupSelect) Float64s added in v0.3.2

func (pgs *PlayGroupSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*PlayGroupSelect) Float64sX added in v0.3.2

func (pgs *PlayGroupSelect) Float64sX(ctx context.Context) []float64

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

func (*PlayGroupSelect) Int added in v0.3.2

func (pgs *PlayGroupSelect) Int(ctx context.Context) (_ int, err error)

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

func (*PlayGroupSelect) IntX added in v0.3.2

func (pgs *PlayGroupSelect) IntX(ctx context.Context) int

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

func (*PlayGroupSelect) Ints added in v0.3.2

func (pgs *PlayGroupSelect) Ints(ctx context.Context) ([]int, error)

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

func (*PlayGroupSelect) IntsX added in v0.3.2

func (pgs *PlayGroupSelect) IntsX(ctx context.Context) []int

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

func (*PlayGroupSelect) Scan added in v0.3.2

func (pgs *PlayGroupSelect) Scan(ctx context.Context, v interface{}) error

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

func (*PlayGroupSelect) ScanX added in v0.3.2

func (pgs *PlayGroupSelect) ScanX(ctx context.Context, v interface{})

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

func (*PlayGroupSelect) String added in v0.3.2

func (pgs *PlayGroupSelect) String(ctx context.Context) (_ string, err error)

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

func (*PlayGroupSelect) StringX added in v0.3.2

func (pgs *PlayGroupSelect) StringX(ctx context.Context) string

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

func (*PlayGroupSelect) Strings added in v0.3.2

func (pgs *PlayGroupSelect) Strings(ctx context.Context) ([]string, error)

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

func (*PlayGroupSelect) StringsX added in v0.3.2

func (pgs *PlayGroupSelect) StringsX(ctx context.Context) []string

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

type PlayGroupUpdate added in v0.3.2

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

PlayGroupUpdate is the builder for updating PlayGroup entities.

func (*PlayGroupUpdate) AddParticipantIDs added in v0.3.2

func (pgu *PlayGroupUpdate) AddParticipantIDs(ids ...int) *PlayGroupUpdate

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupUpdate) AddParticipants added in v0.3.2

func (pgu *PlayGroupUpdate) AddParticipants(p ...*Pet) *PlayGroupUpdate

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupUpdate) ClearDescription added in v0.3.2

func (pgu *PlayGroupUpdate) ClearDescription() *PlayGroupUpdate

ClearDescription clears the value of the "description" field.

func (*PlayGroupUpdate) ClearParticipants added in v0.3.2

func (pgu *PlayGroupUpdate) ClearParticipants() *PlayGroupUpdate

ClearParticipants clears all "participants" edges to the Pet entity.

func (*PlayGroupUpdate) Exec added in v0.3.2

func (pgu *PlayGroupUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupUpdate) ExecX added in v0.3.2

func (pgu *PlayGroupUpdate) ExecX(ctx context.Context)

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

func (*PlayGroupUpdate) Mutation added in v0.3.2

func (pgu *PlayGroupUpdate) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupUpdate) RemoveParticipantIDs added in v0.3.2

func (pgu *PlayGroupUpdate) RemoveParticipantIDs(ids ...int) *PlayGroupUpdate

RemoveParticipantIDs removes the "participants" edge to Pet entities by IDs.

func (*PlayGroupUpdate) RemoveParticipants added in v0.3.2

func (pgu *PlayGroupUpdate) RemoveParticipants(p ...*Pet) *PlayGroupUpdate

RemoveParticipants removes "participants" edges to Pet entities.

func (*PlayGroupUpdate) Save added in v0.3.2

func (pgu *PlayGroupUpdate) Save(ctx context.Context) (int, error)

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

func (*PlayGroupUpdate) SaveX added in v0.3.2

func (pgu *PlayGroupUpdate) SaveX(ctx context.Context) int

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

func (*PlayGroupUpdate) SetDescription added in v0.3.2

func (pgu *PlayGroupUpdate) SetDescription(s string) *PlayGroupUpdate

SetDescription sets the "description" field.

func (*PlayGroupUpdate) SetNillableDescription added in v0.3.2

func (pgu *PlayGroupUpdate) SetNillableDescription(s *string) *PlayGroupUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupUpdate) SetTitle added in v0.3.2

func (pgu *PlayGroupUpdate) SetTitle(s string) *PlayGroupUpdate

SetTitle sets the "title" field.

func (*PlayGroupUpdate) SetWeekday added in v0.3.2

func (pgu *PlayGroupUpdate) SetWeekday(pl playgroup.Weekday) *PlayGroupUpdate

SetWeekday sets the "weekday" field.

func (*PlayGroupUpdate) Where added in v0.3.2

Where appends a list predicates to the PlayGroupUpdate builder.

type PlayGroupUpdateOne added in v0.3.2

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

PlayGroupUpdateOne is the builder for updating a single PlayGroup entity.

func (*PlayGroupUpdateOne) AddParticipantIDs added in v0.3.2

func (pguo *PlayGroupUpdateOne) AddParticipantIDs(ids ...int) *PlayGroupUpdateOne

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupUpdateOne) AddParticipants added in v0.3.2

func (pguo *PlayGroupUpdateOne) AddParticipants(p ...*Pet) *PlayGroupUpdateOne

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupUpdateOne) ClearDescription added in v0.3.2

func (pguo *PlayGroupUpdateOne) ClearDescription() *PlayGroupUpdateOne

ClearDescription clears the value of the "description" field.

func (*PlayGroupUpdateOne) ClearParticipants added in v0.3.2

func (pguo *PlayGroupUpdateOne) ClearParticipants() *PlayGroupUpdateOne

ClearParticipants clears all "participants" edges to the Pet entity.

func (*PlayGroupUpdateOne) Exec added in v0.3.2

func (pguo *PlayGroupUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PlayGroupUpdateOne) ExecX added in v0.3.2

func (pguo *PlayGroupUpdateOne) ExecX(ctx context.Context)

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

func (*PlayGroupUpdateOne) Mutation added in v0.3.2

func (pguo *PlayGroupUpdateOne) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupUpdateOne) RemoveParticipantIDs added in v0.3.2

func (pguo *PlayGroupUpdateOne) RemoveParticipantIDs(ids ...int) *PlayGroupUpdateOne

RemoveParticipantIDs removes the "participants" edge to Pet entities by IDs.

func (*PlayGroupUpdateOne) RemoveParticipants added in v0.3.2

func (pguo *PlayGroupUpdateOne) RemoveParticipants(p ...*Pet) *PlayGroupUpdateOne

RemoveParticipants removes "participants" edges to Pet entities.

func (*PlayGroupUpdateOne) Save added in v0.3.2

func (pguo *PlayGroupUpdateOne) Save(ctx context.Context) (*PlayGroup, error)

Save executes the query and returns the updated PlayGroup entity.

func (*PlayGroupUpdateOne) SaveX added in v0.3.2

func (pguo *PlayGroupUpdateOne) SaveX(ctx context.Context) *PlayGroup

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

func (*PlayGroupUpdateOne) Select added in v0.3.2

func (pguo *PlayGroupUpdateOne) Select(field string, fields ...string) *PlayGroupUpdateOne

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

func (*PlayGroupUpdateOne) SetDescription added in v0.3.2

func (pguo *PlayGroupUpdateOne) SetDescription(s string) *PlayGroupUpdateOne

SetDescription sets the "description" field.

func (*PlayGroupUpdateOne) SetNillableDescription added in v0.3.2

func (pguo *PlayGroupUpdateOne) SetNillableDescription(s *string) *PlayGroupUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupUpdateOne) SetTitle added in v0.3.2

func (pguo *PlayGroupUpdateOne) SetTitle(s string) *PlayGroupUpdateOne

SetTitle sets the "title" field.

func (*PlayGroupUpdateOne) SetWeekday added in v0.3.2

SetWeekday sets the "weekday" field.

type PlayGroups added in v0.3.2

type PlayGroups []*PlayGroup

PlayGroups is a parsable slice of PlayGroup.

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 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 Toy added in v0.3.2

type Toy struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Color holds the value of the "color" field.
	Color toy.Color `json:"color,omitempty"`
	// Material holds the value of the "material" field.
	Material toy.Material `json:"material,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ToyQuery when eager-loading is set.
	Edges ToyEdges `json:"edges"`
	// contains filtered or unexported fields
}

Toy is the model entity for the Toy schema.

func (*Toy) QueryOwner added in v0.3.2

func (t *Toy) QueryOwner() *PetQuery

QueryOwner queries the "owner" edge of the Toy entity.

func (*Toy) String added in v0.3.2

func (t *Toy) String() string

String implements the fmt.Stringer.

func (*Toy) Unwrap added in v0.3.2

func (t *Toy) Unwrap() *Toy

Unwrap unwraps the Toy 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 (*Toy) Update added in v0.3.2

func (t *Toy) Update() *ToyUpdateOne

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

type ToyClient added in v0.3.2

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

ToyClient is a client for the Toy schema.

func NewToyClient added in v0.3.2

func NewToyClient(c config) *ToyClient

NewToyClient returns a client for the Toy from the given config.

func (*ToyClient) Create added in v0.3.2

func (c *ToyClient) Create() *ToyCreate

Create returns a create builder for Toy.

func (*ToyClient) CreateBulk added in v0.3.2

func (c *ToyClient) CreateBulk(builders ...*ToyCreate) *ToyCreateBulk

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

func (*ToyClient) Delete added in v0.3.2

func (c *ToyClient) Delete() *ToyDelete

Delete returns a delete builder for Toy.

func (*ToyClient) DeleteOne added in v0.3.2

func (c *ToyClient) DeleteOne(t *Toy) *ToyDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ToyClient) DeleteOneID added in v0.3.2

func (c *ToyClient) DeleteOneID(id int) *ToyDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ToyClient) Get added in v0.3.2

func (c *ToyClient) Get(ctx context.Context, id int) (*Toy, error)

Get returns a Toy entity by its id.

func (*ToyClient) GetX added in v0.3.2

func (c *ToyClient) GetX(ctx context.Context, id int) *Toy

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

func (*ToyClient) Hooks added in v0.3.2

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

Hooks returns the client hooks.

func (*ToyClient) Query added in v0.3.2

func (c *ToyClient) Query() *ToyQuery

Query returns a query builder for Toy.

func (*ToyClient) QueryOwner added in v0.3.2

func (c *ToyClient) QueryOwner(t *Toy) *PetQuery

QueryOwner queries the owner edge of a Toy.

func (*ToyClient) Update added in v0.3.2

func (c *ToyClient) Update() *ToyUpdate

Update returns an update builder for Toy.

func (*ToyClient) UpdateOne added in v0.3.2

func (c *ToyClient) UpdateOne(t *Toy) *ToyUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ToyClient) UpdateOneID added in v0.3.2

func (c *ToyClient) UpdateOneID(id int) *ToyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ToyClient) Use added in v0.3.2

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

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

type ToyCreate added in v0.3.2

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

ToyCreate is the builder for creating a Toy entity.

func (*ToyCreate) Exec added in v0.3.2

func (tc *ToyCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyCreate) ExecX added in v0.3.2

func (tc *ToyCreate) ExecX(ctx context.Context)

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

func (*ToyCreate) Mutation added in v0.3.2

func (tc *ToyCreate) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyCreate) Save added in v0.3.2

func (tc *ToyCreate) Save(ctx context.Context) (*Toy, error)

Save creates the Toy in the database.

func (*ToyCreate) SaveX added in v0.3.2

func (tc *ToyCreate) SaveX(ctx context.Context) *Toy

SaveX calls Save and panics if Save returns an error.

func (*ToyCreate) SetColor added in v0.3.2

func (tc *ToyCreate) SetColor(t toy.Color) *ToyCreate

SetColor sets the "color" field.

func (*ToyCreate) SetMaterial added in v0.3.2

func (tc *ToyCreate) SetMaterial(t toy.Material) *ToyCreate

SetMaterial sets the "material" field.

func (*ToyCreate) SetNillableOwnerID added in v0.3.2

func (tc *ToyCreate) SetNillableOwnerID(id *int) *ToyCreate

SetNillableOwnerID sets the "owner" edge to the Pet entity by ID if the given value is not nil.

func (*ToyCreate) SetOwner added in v0.3.2

func (tc *ToyCreate) SetOwner(p *Pet) *ToyCreate

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyCreate) SetOwnerID added in v0.3.2

func (tc *ToyCreate) SetOwnerID(id int) *ToyCreate

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyCreate) SetTitle added in v0.3.2

func (tc *ToyCreate) SetTitle(s string) *ToyCreate

SetTitle sets the "title" field.

type ToyCreateBulk added in v0.3.2

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

ToyCreateBulk is the builder for creating many Toy entities in bulk.

func (*ToyCreateBulk) Exec added in v0.3.2

func (tcb *ToyCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyCreateBulk) ExecX added in v0.3.2

func (tcb *ToyCreateBulk) ExecX(ctx context.Context)

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

func (*ToyCreateBulk) Save added in v0.3.2

func (tcb *ToyCreateBulk) Save(ctx context.Context) ([]*Toy, error)

Save creates the Toy entities in the database.

func (*ToyCreateBulk) SaveX added in v0.3.2

func (tcb *ToyCreateBulk) SaveX(ctx context.Context) []*Toy

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

type ToyDelete added in v0.3.2

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

ToyDelete is the builder for deleting a Toy entity.

func (*ToyDelete) Exec added in v0.3.2

func (td *ToyDelete) Exec(ctx context.Context) (int, error)

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

func (*ToyDelete) ExecX added in v0.3.2

func (td *ToyDelete) ExecX(ctx context.Context) int

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

func (*ToyDelete) Where added in v0.3.2

func (td *ToyDelete) Where(ps ...predicate.Toy) *ToyDelete

Where appends a list predicates to the ToyDelete builder.

type ToyDeleteOne added in v0.3.2

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

ToyDeleteOne is the builder for deleting a single Toy entity.

func (*ToyDeleteOne) Exec added in v0.3.2

func (tdo *ToyDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ToyDeleteOne) ExecX added in v0.3.2

func (tdo *ToyDeleteOne) ExecX(ctx context.Context)

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

type ToyEdges added in v0.3.2

type ToyEdges struct {
	// Owner holds the value of the owner edge.
	Owner *Pet `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

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

func (ToyEdges) OwnerOrErr added in v0.3.2

func (e ToyEdges) OwnerOrErr() (*Pet, error)

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

type ToyGroupBy added in v0.3.2

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

ToyGroupBy is the group-by builder for Toy entities.

func (*ToyGroupBy) Aggregate added in v0.3.2

func (tgb *ToyGroupBy) Aggregate(fns ...AggregateFunc) *ToyGroupBy

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

func (*ToyGroupBy) Bool added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) BoolX added in v0.3.2

func (tgb *ToyGroupBy) BoolX(ctx context.Context) bool

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

func (*ToyGroupBy) Bools added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) BoolsX added in v0.3.2

func (tgb *ToyGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ToyGroupBy) Float64 added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) Float64X added in v0.3.2

func (tgb *ToyGroupBy) Float64X(ctx context.Context) float64

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

func (*ToyGroupBy) Float64s added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) Float64sX added in v0.3.2

func (tgb *ToyGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ToyGroupBy) Int added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) IntX added in v0.3.2

func (tgb *ToyGroupBy) IntX(ctx context.Context) int

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

func (*ToyGroupBy) Ints added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) IntsX added in v0.3.2

func (tgb *ToyGroupBy) IntsX(ctx context.Context) []int

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

func (*ToyGroupBy) Scan added in v0.3.2

func (tgb *ToyGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ToyGroupBy) ScanX added in v0.3.2

func (tgb *ToyGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ToyGroupBy) String added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) StringX added in v0.3.2

func (tgb *ToyGroupBy) StringX(ctx context.Context) string

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

func (*ToyGroupBy) Strings added in v0.3.2

func (tgb *ToyGroupBy) 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 (*ToyGroupBy) StringsX added in v0.3.2

func (tgb *ToyGroupBy) StringsX(ctx context.Context) []string

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

type ToyMutation added in v0.3.2

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

ToyMutation represents an operation that mutates the Toy nodes in the graph.

func (*ToyMutation) AddField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) AddedEdges added in v0.3.2

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

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

func (*ToyMutation) AddedField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) AddedFields added in v0.3.2

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

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

func (*ToyMutation) AddedIDs added in v0.3.2

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

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

func (*ToyMutation) ClearEdge added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ClearField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ClearOwner added in v0.3.2

func (m *ToyMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyMutation) ClearedEdges added in v0.3.2

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

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

func (*ToyMutation) ClearedFields added in v0.3.2

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

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

func (ToyMutation) Client added in v0.3.2

func (m ToyMutation) 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 (*ToyMutation) Color added in v0.3.2

func (m *ToyMutation) Color() (r toy.Color, exists bool)

Color returns the value of the "color" field in the mutation.

func (*ToyMutation) EdgeCleared added in v0.3.2

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

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

func (*ToyMutation) Field added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) FieldCleared added in v0.3.2

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

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

func (*ToyMutation) Fields added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ID added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) Material added in v0.3.2

func (m *ToyMutation) Material() (r toy.Material, exists bool)

Material returns the value of the "material" field in the mutation.

func (*ToyMutation) OldColor added in v0.3.2

func (m *ToyMutation) OldColor(ctx context.Context) (v toy.Color, err error)

OldColor returns the old "color" field's value of the Toy entity. If the Toy 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 (*ToyMutation) OldField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) OldMaterial added in v0.3.2

func (m *ToyMutation) OldMaterial(ctx context.Context) (v toy.Material, err error)

OldMaterial returns the old "material" field's value of the Toy entity. If the Toy 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 (*ToyMutation) OldTitle added in v0.3.2

func (m *ToyMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Toy entity. If the Toy 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 (*ToyMutation) Op added in v0.3.2

func (m *ToyMutation) Op() Op

Op returns the operation name.

func (*ToyMutation) OwnerCleared added in v0.3.2

func (m *ToyMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the Pet entity was cleared.

func (*ToyMutation) OwnerID added in v0.3.2

func (m *ToyMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*ToyMutation) OwnerIDs added in v0.3.2

func (m *ToyMutation) OwnerIDs() (ids []int)

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

func (*ToyMutation) RemovedEdges added in v0.3.2

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

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

func (*ToyMutation) RemovedIDs added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ResetColor added in v0.3.2

func (m *ToyMutation) ResetColor()

ResetColor resets all changes to the "color" field.

func (*ToyMutation) ResetEdge added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ResetField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) ResetMaterial added in v0.3.2

func (m *ToyMutation) ResetMaterial()

ResetMaterial resets all changes to the "material" field.

func (*ToyMutation) ResetOwner added in v0.3.2

func (m *ToyMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*ToyMutation) ResetTitle added in v0.3.2

func (m *ToyMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ToyMutation) SetColor added in v0.3.2

func (m *ToyMutation) SetColor(t toy.Color)

SetColor sets the "color" field.

func (*ToyMutation) SetField added in v0.3.2

func (m *ToyMutation) 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 (*ToyMutation) SetMaterial added in v0.3.2

func (m *ToyMutation) SetMaterial(t toy.Material)

SetMaterial sets the "material" field.

func (*ToyMutation) SetOwnerID added in v0.3.2

func (m *ToyMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the Pet entity by id.

func (*ToyMutation) SetTitle added in v0.3.2

func (m *ToyMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ToyMutation) Title added in v0.3.2

func (m *ToyMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (ToyMutation) Tx added in v0.3.2

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

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

func (*ToyMutation) Type added in v0.3.2

func (m *ToyMutation) Type() string

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

func (*ToyMutation) Where added in v0.3.2

func (m *ToyMutation) Where(ps ...predicate.Toy)

Where appends a list predicates to the ToyMutation builder.

type ToyQuery added in v0.3.2

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

ToyQuery is the builder for querying Toy entities.

func (*ToyQuery) All added in v0.3.2

func (tq *ToyQuery) All(ctx context.Context) ([]*Toy, error)

All executes the query and returns a list of Toys.

func (*ToyQuery) AllX added in v0.3.2

func (tq *ToyQuery) AllX(ctx context.Context) []*Toy

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

func (*ToyQuery) Clone added in v0.3.2

func (tq *ToyQuery) Clone() *ToyQuery

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

func (*ToyQuery) Count added in v0.3.2

func (tq *ToyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ToyQuery) CountX added in v0.3.2

func (tq *ToyQuery) CountX(ctx context.Context) int

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

func (*ToyQuery) Exist added in v0.3.2

func (tq *ToyQuery) Exist(ctx context.Context) (bool, error)

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

func (*ToyQuery) ExistX added in v0.3.2

func (tq *ToyQuery) ExistX(ctx context.Context) bool

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

func (*ToyQuery) First added in v0.3.2

func (tq *ToyQuery) First(ctx context.Context) (*Toy, error)

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

func (*ToyQuery) FirstID added in v0.3.2

func (tq *ToyQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ToyQuery) FirstIDX added in v0.3.2

func (tq *ToyQuery) FirstIDX(ctx context.Context) int

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

func (*ToyQuery) FirstX added in v0.3.2

func (tq *ToyQuery) FirstX(ctx context.Context) *Toy

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

func (*ToyQuery) GroupBy added in v0.3.2

func (tq *ToyQuery) GroupBy(field string, fields ...string) *ToyGroupBy

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 {
	Color toy.Color `json:"color,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Toy.Query().
	GroupBy(toy.FieldColor).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ToyQuery) IDs added in v0.3.2

func (tq *ToyQuery) IDs(ctx context.Context) ([]int, error)

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

func (*ToyQuery) IDsX added in v0.3.2

func (tq *ToyQuery) IDsX(ctx context.Context) []int

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

func (*ToyQuery) Limit added in v0.3.2

func (tq *ToyQuery) Limit(limit int) *ToyQuery

Limit adds a limit step to the query.

func (*ToyQuery) Offset added in v0.3.2

func (tq *ToyQuery) Offset(offset int) *ToyQuery

Offset adds an offset step to the query.

func (*ToyQuery) Only added in v0.3.2

func (tq *ToyQuery) Only(ctx context.Context) (*Toy, error)

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

func (*ToyQuery) OnlyID added in v0.3.2

func (tq *ToyQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ToyQuery) OnlyIDX added in v0.3.2

func (tq *ToyQuery) OnlyIDX(ctx context.Context) int

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

func (*ToyQuery) OnlyX added in v0.3.2

func (tq *ToyQuery) OnlyX(ctx context.Context) *Toy

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

func (*ToyQuery) Order added in v0.3.2

func (tq *ToyQuery) Order(o ...OrderFunc) *ToyQuery

Order adds an order step to the query.

func (*ToyQuery) QueryOwner added in v0.3.2

func (tq *ToyQuery) QueryOwner() *PetQuery

QueryOwner chains the current query on the "owner" edge.

func (*ToyQuery) Select added in v0.3.2

func (tq *ToyQuery) Select(fields ...string) *ToySelect

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 {
	Color toy.Color `json:"color,omitempty"`
}

client.Toy.Query().
	Select(toy.FieldColor).
	Scan(ctx, &v)

func (*ToyQuery) Unique added in v0.3.2

func (tq *ToyQuery) Unique(unique bool) *ToyQuery

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 (*ToyQuery) Where added in v0.3.2

func (tq *ToyQuery) Where(ps ...predicate.Toy) *ToyQuery

Where adds a new predicate for the ToyQuery builder.

func (*ToyQuery) WithOwner added in v0.3.2

func (tq *ToyQuery) WithOwner(opts ...func(*PetQuery)) *ToyQuery

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

type ToySelect added in v0.3.2

type ToySelect struct {
	*ToyQuery
	// contains filtered or unexported fields
}

ToySelect is the builder for selecting fields of Toy entities.

func (*ToySelect) Bool added in v0.3.2

func (ts *ToySelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*ToySelect) BoolX added in v0.3.2

func (ts *ToySelect) BoolX(ctx context.Context) bool

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

func (*ToySelect) Bools added in v0.3.2

func (ts *ToySelect) Bools(ctx context.Context) ([]bool, error)

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

func (*ToySelect) BoolsX added in v0.3.2

func (ts *ToySelect) BoolsX(ctx context.Context) []bool

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

func (*ToySelect) Float64 added in v0.3.2

func (ts *ToySelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*ToySelect) Float64X added in v0.3.2

func (ts *ToySelect) Float64X(ctx context.Context) float64

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

func (*ToySelect) Float64s added in v0.3.2

func (ts *ToySelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*ToySelect) Float64sX added in v0.3.2

func (ts *ToySelect) Float64sX(ctx context.Context) []float64

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

func (*ToySelect) Int added in v0.3.2

func (ts *ToySelect) Int(ctx context.Context) (_ int, err error)

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

func (*ToySelect) IntX added in v0.3.2

func (ts *ToySelect) IntX(ctx context.Context) int

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

func (*ToySelect) Ints added in v0.3.2

func (ts *ToySelect) Ints(ctx context.Context) ([]int, error)

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

func (*ToySelect) IntsX added in v0.3.2

func (ts *ToySelect) IntsX(ctx context.Context) []int

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

func (*ToySelect) Scan added in v0.3.2

func (ts *ToySelect) Scan(ctx context.Context, v interface{}) error

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

func (*ToySelect) ScanX added in v0.3.2

func (ts *ToySelect) ScanX(ctx context.Context, v interface{})

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

func (*ToySelect) String added in v0.3.2

func (ts *ToySelect) String(ctx context.Context) (_ string, err error)

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

func (*ToySelect) StringX added in v0.3.2

func (ts *ToySelect) StringX(ctx context.Context) string

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

func (*ToySelect) Strings added in v0.3.2

func (ts *ToySelect) Strings(ctx context.Context) ([]string, error)

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

func (*ToySelect) StringsX added in v0.3.2

func (ts *ToySelect) StringsX(ctx context.Context) []string

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

type ToyUpdate added in v0.3.2

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

ToyUpdate is the builder for updating Toy entities.

func (*ToyUpdate) ClearOwner added in v0.3.2

func (tu *ToyUpdate) ClearOwner() *ToyUpdate

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyUpdate) Exec added in v0.3.2

func (tu *ToyUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyUpdate) ExecX added in v0.3.2

func (tu *ToyUpdate) ExecX(ctx context.Context)

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

func (*ToyUpdate) Mutation added in v0.3.2

func (tu *ToyUpdate) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyUpdate) Save added in v0.3.2

func (tu *ToyUpdate) Save(ctx context.Context) (int, error)

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

func (*ToyUpdate) SaveX added in v0.3.2

func (tu *ToyUpdate) SaveX(ctx context.Context) int

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

func (*ToyUpdate) SetColor added in v0.3.2

func (tu *ToyUpdate) SetColor(t toy.Color) *ToyUpdate

SetColor sets the "color" field.

func (*ToyUpdate) SetMaterial added in v0.3.2

func (tu *ToyUpdate) SetMaterial(t toy.Material) *ToyUpdate

SetMaterial sets the "material" field.

func (*ToyUpdate) SetNillableOwnerID added in v0.3.2

func (tu *ToyUpdate) SetNillableOwnerID(id *int) *ToyUpdate

SetNillableOwnerID sets the "owner" edge to the Pet entity by ID if the given value is not nil.

func (*ToyUpdate) SetOwner added in v0.3.2

func (tu *ToyUpdate) SetOwner(p *Pet) *ToyUpdate

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyUpdate) SetOwnerID added in v0.3.2

func (tu *ToyUpdate) SetOwnerID(id int) *ToyUpdate

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyUpdate) SetTitle added in v0.3.2

func (tu *ToyUpdate) SetTitle(s string) *ToyUpdate

SetTitle sets the "title" field.

func (*ToyUpdate) Where added in v0.3.2

func (tu *ToyUpdate) Where(ps ...predicate.Toy) *ToyUpdate

Where appends a list predicates to the ToyUpdate builder.

type ToyUpdateOne added in v0.3.2

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

ToyUpdateOne is the builder for updating a single Toy entity.

func (*ToyUpdateOne) ClearOwner added in v0.3.2

func (tuo *ToyUpdateOne) ClearOwner() *ToyUpdateOne

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyUpdateOne) Exec added in v0.3.2

func (tuo *ToyUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ToyUpdateOne) ExecX added in v0.3.2

func (tuo *ToyUpdateOne) ExecX(ctx context.Context)

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

func (*ToyUpdateOne) Mutation added in v0.3.2

func (tuo *ToyUpdateOne) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyUpdateOne) Save added in v0.3.2

func (tuo *ToyUpdateOne) Save(ctx context.Context) (*Toy, error)

Save executes the query and returns the updated Toy entity.

func (*ToyUpdateOne) SaveX added in v0.3.2

func (tuo *ToyUpdateOne) SaveX(ctx context.Context) *Toy

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

func (*ToyUpdateOne) Select added in v0.3.2

func (tuo *ToyUpdateOne) Select(field string, fields ...string) *ToyUpdateOne

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

func (*ToyUpdateOne) SetColor added in v0.3.2

func (tuo *ToyUpdateOne) SetColor(t toy.Color) *ToyUpdateOne

SetColor sets the "color" field.

func (*ToyUpdateOne) SetMaterial added in v0.3.2

func (tuo *ToyUpdateOne) SetMaterial(t toy.Material) *ToyUpdateOne

SetMaterial sets the "material" field.

func (*ToyUpdateOne) SetNillableOwnerID added in v0.3.2

func (tuo *ToyUpdateOne) SetNillableOwnerID(id *int) *ToyUpdateOne

SetNillableOwnerID sets the "owner" edge to the Pet entity by ID if the given value is not nil.

func (*ToyUpdateOne) SetOwner added in v0.3.2

func (tuo *ToyUpdateOne) SetOwner(p *Pet) *ToyUpdateOne

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyUpdateOne) SetOwnerID added in v0.3.2

func (tuo *ToyUpdateOne) SetOwnerID(id int) *ToyUpdateOne

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyUpdateOne) SetTitle added in v0.3.2

func (tuo *ToyUpdateOne) SetTitle(s string) *ToyUpdateOne

SetTitle sets the "title" field.

type Toys added in v0.3.2

type Toys []*Toy

Toys is a parsable slice of Toy.

type Tx

type Tx struct {

	// Badge is the client for interacting with the Badge builders.
	Badge *BadgeClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// PlayGroup is the client for interacting with the PlayGroup builders.
	PlayGroup *PlayGroupClient
	// Toy is the client for interacting with the Toy builders.
	Toy *ToyClient
	// 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 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