ent

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 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

type Badge struct {

	// ID of the ent.
	ID uint32 `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

func (b *Badge) QueryWearer() *PetQuery

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

func (*Badge) String

func (b *Badge) String() string

String implements the fmt.Stringer.

func (*Badge) Unwrap

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

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

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

BadgeClient is a client for the Badge schema.

func NewBadgeClient

func NewBadgeClient(c config) *BadgeClient

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

func (*BadgeClient) Create

func (c *BadgeClient) Create() *BadgeCreate

Create returns a create builder for Badge.

func (*BadgeClient) CreateBulk

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

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

func (*BadgeClient) Delete

func (c *BadgeClient) Delete() *BadgeDelete

Delete returns a delete builder for Badge.

func (*BadgeClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*BadgeClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*BadgeClient) Get

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

Get returns a Badge entity by its id.

func (*BadgeClient) GetX

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

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

func (*BadgeClient) Hooks

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

Hooks returns the client hooks.

func (*BadgeClient) Query

func (c *BadgeClient) Query() *BadgeQuery

Query returns a query builder for Badge.

func (*BadgeClient) QueryWearer

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

QueryWearer queries the wearer edge of a Badge.

func (*BadgeClient) Update

func (c *BadgeClient) Update() *BadgeUpdate

Update returns an update builder for Badge.

func (*BadgeClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*BadgeClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*BadgeClient) Use

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

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

BadgeCreate is the builder for creating a Badge entity.

func (*BadgeCreate) Exec

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

Exec executes the query.

func (*BadgeCreate) ExecX

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

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

func (*BadgeCreate) Mutation

func (bc *BadgeCreate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeCreate) Save

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

Save creates the Badge in the database.

func (*BadgeCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*BadgeCreate) SetColor

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

SetColor sets the "color" field.

func (*BadgeCreate) SetID added in v0.4.1

func (bc *BadgeCreate) SetID(u uint32) *BadgeCreate

SetID sets the "id" field.

func (*BadgeCreate) SetMaterial

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

SetMaterial sets the "material" field.

func (*BadgeCreate) SetNillableWearerID

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

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

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

func (*BadgeCreate) SetWearerID

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

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

type BadgeCreateBulk

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

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

func (*BadgeCreateBulk) Exec

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

Exec executes the query.

func (*BadgeCreateBulk) ExecX

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

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

func (*BadgeCreateBulk) Save

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

Save creates the Badge entities in the database.

func (*BadgeCreateBulk) SaveX

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

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

type BadgeDelete

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

BadgeDelete is the builder for deleting a Badge entity.

func (*BadgeDelete) Exec

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

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

func (*BadgeDelete) ExecX

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

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

func (*BadgeDelete) Where

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

Where appends a list predicates to the BadgeDelete builder.

type BadgeDeleteOne

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

BadgeDeleteOne is the builder for deleting a single Badge entity.

func (*BadgeDeleteOne) Exec

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

Exec executes the deletion query.

func (*BadgeDeleteOne) ExecX

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

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

type BadgeEdges

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

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

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

BadgeGroupBy is the group-by builder for Badge entities.

func (*BadgeGroupBy) Aggregate

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

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

func (*BadgeGroupBy) Bool

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

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

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

func (*BadgeGroupBy) Bools

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

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

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

func (*BadgeGroupBy) Float64

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

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

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

func (*BadgeGroupBy) Float64s

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

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

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

func (*BadgeGroupBy) Int

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

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

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

func (*BadgeGroupBy) Ints

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

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

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

func (*BadgeGroupBy) Scan

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

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

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

func (*BadgeGroupBy) String

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

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

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

func (*BadgeGroupBy) Strings

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

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

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

type BadgeMutation

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

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

func (*BadgeMutation) AddField

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

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

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

func (*BadgeMutation) AddedField

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

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

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

func (*BadgeMutation) AddedIDs

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

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

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

func (m *BadgeMutation) ClearWearer()

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

func (*BadgeMutation) ClearedEdges

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

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

func (*BadgeMutation) ClearedFields

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

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

func (BadgeMutation) Client

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

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

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

func (*BadgeMutation) EdgeCleared

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

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

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

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

func (m *BadgeMutation) ID() (id uint32, 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

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

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

func (*BadgeMutation) OldColor

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

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

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

func (m *BadgeMutation) Op() Op

Op returns the operation name.

func (*BadgeMutation) RemovedEdges

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

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

func (*BadgeMutation) RemovedIDs

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

func (m *BadgeMutation) ResetColor()

ResetColor resets all changes to the "color" field.

func (*BadgeMutation) ResetEdge

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

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

func (m *BadgeMutation) ResetMaterial()

ResetMaterial resets all changes to the "material" field.

func (*BadgeMutation) ResetWearer

func (m *BadgeMutation) ResetWearer()

ResetWearer resets all changes to the "wearer" edge.

func (*BadgeMutation) SetColor

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

SetColor sets the "color" field.

func (*BadgeMutation) SetField

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) SetID added in v0.4.1

func (m *BadgeMutation) SetID(id uint32)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Badge entities.

func (*BadgeMutation) SetMaterial

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

SetMaterial sets the "material" field.

func (*BadgeMutation) SetWearerID

func (m *BadgeMutation) SetWearerID(id int)

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

func (BadgeMutation) Tx

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

func (m *BadgeMutation) Type() string

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

func (*BadgeMutation) WearerCleared

func (m *BadgeMutation) WearerCleared() bool

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

func (*BadgeMutation) WearerID

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

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

func (*BadgeMutation) WearerIDs

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

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

Where appends a list predicates to the BadgeMutation builder.

type BadgeQuery

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

BadgeQuery is the builder for querying Badge entities.

func (*BadgeQuery) All

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

All executes the query and returns a list of Badges.

func (*BadgeQuery) AllX

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

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

func (*BadgeQuery) Clone

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

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

Count returns the count of the given query.

func (*BadgeQuery) CountX

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

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

func (*BadgeQuery) Exist

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

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

func (*BadgeQuery) ExistX

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

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

func (*BadgeQuery) First

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

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

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

func (*BadgeQuery) FirstIDX

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

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

func (*BadgeQuery) FirstX

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

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

func (*BadgeQuery) GroupBy

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

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

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

func (*BadgeQuery) IDsX

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

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

func (*BadgeQuery) Limit

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

Limit adds a limit step to the query.

func (*BadgeQuery) Offset

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

Offset adds an offset step to the query.

func (*BadgeQuery) Only

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

func (bq *BadgeQuery) OnlyID(ctx context.Context) (id uint32, 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

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

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

func (*BadgeQuery) OnlyX

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

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

func (*BadgeQuery) Order

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

Order adds an order step to the query.

func (*BadgeQuery) QueryWearer

func (bq *BadgeQuery) QueryWearer() *PetQuery

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

func (*BadgeQuery) Select

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

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

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

Where adds a new predicate for the BadgeQuery builder.

func (*BadgeQuery) WithWearer

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

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

BadgeSelect is the builder for selecting fields of Badge entities.

func (*BadgeSelect) Bool

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

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

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

func (*BadgeSelect) Bools

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

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

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

func (*BadgeSelect) Float64

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

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

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

func (*BadgeSelect) Float64s

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

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

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

func (*BadgeSelect) Int

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

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

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

func (*BadgeSelect) Ints

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

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

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

func (*BadgeSelect) Scan

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

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

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

func (*BadgeSelect) String

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

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

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

func (*BadgeSelect) Strings

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

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

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

type BadgeUpdate

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

BadgeUpdate is the builder for updating Badge entities.

func (*BadgeUpdate) ClearWearer

func (bu *BadgeUpdate) ClearWearer() *BadgeUpdate

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

func (*BadgeUpdate) Exec

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

Exec executes the query.

func (*BadgeUpdate) ExecX

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

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

func (*BadgeUpdate) Mutation

func (bu *BadgeUpdate) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdate) Save

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

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

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

func (*BadgeUpdate) SetColor

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

SetColor sets the "color" field.

func (*BadgeUpdate) SetMaterial

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

SetMaterial sets the "material" field.

func (*BadgeUpdate) SetNillableWearerID

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

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

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

func (*BadgeUpdate) SetWearerID

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

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

func (*BadgeUpdate) Where

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

Where appends a list predicates to the BadgeUpdate builder.

type BadgeUpdateOne

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

BadgeUpdateOne is the builder for updating a single Badge entity.

func (*BadgeUpdateOne) ClearWearer

func (buo *BadgeUpdateOne) ClearWearer() *BadgeUpdateOne

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

func (*BadgeUpdateOne) Exec

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

Exec executes the query on the entity.

func (*BadgeUpdateOne) ExecX

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

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

func (*BadgeUpdateOne) Mutation

func (buo *BadgeUpdateOne) Mutation() *BadgeMutation

Mutation returns the BadgeMutation object of the builder.

func (*BadgeUpdateOne) Save

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

Save executes the query and returns the updated Badge entity.

func (*BadgeUpdateOne) SaveX

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

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

func (*BadgeUpdateOne) Select

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

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

SetColor sets the "color" field.

func (*BadgeUpdateOne) SetMaterial

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

SetMaterial sets the "material" field.

func (*BadgeUpdateOne) SetNillableWearerID

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

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

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

func (*BadgeUpdateOne) SetWearerID

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

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

type Badges

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

func (pe *Pet) QueryBadge() *BadgeQuery

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

func (*Pet) QueryChildren

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

func (pe *Pet) QueryMentor() *PetQuery

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

func (*Pet) QueryParent

func (pe *Pet) QueryParent() *PetQuery

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

func (*Pet) QueryPlayGroups

func (pe *Pet) QueryPlayGroups() *PlayGroupQuery

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

func (*Pet) QueryProtege

func (pe *Pet) QueryProtege() *PetQuery

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

func (*Pet) QuerySpouse

func (pe *Pet) QuerySpouse() *PetQuery

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

func (*Pet) QueryToys

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

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

QueryBadge queries the badge edge of a Pet.

func (*PetClient) QueryChildren

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

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

QueryMentor queries the mentor edge of a Pet.

func (*PetClient) QueryParent

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

QueryParent queries the parent edge of a Pet.

func (*PetClient) QueryPlayGroups

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

QueryPlayGroups queries the play_groups edge of a Pet.

func (*PetClient) QueryProtege

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

QueryProtege queries the protege edge of a Pet.

func (*PetClient) QuerySpouse

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

QuerySpouse queries the spouse edge of a Pet.

func (*PetClient) QueryToys

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

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

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

func (*PetCreate) AddChildren

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

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

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

func (*PetCreate) AddPlayGroups

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

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

func (*PetCreate) AddToyIDs

func (pc *PetCreate) AddToyIDs(ids ...uuid.UUID) *PetCreate

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

func (*PetCreate) AddToys

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

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

func (*PetCreate) Exec

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

Exec executes the query.

func (*PetCreate) ExecX

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

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

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

func (*PetCreate) SetBadgeID

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

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

func (*PetCreate) SetBirthday

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

SetBirthday sets the "birthday" field.

func (*PetCreate) SetCastrated

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

SetCastrated sets the "castrated" field.

func (*PetCreate) SetChip

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

SetChip sets the "chip" field.

func (*PetCreate) SetHeight

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

SetHeight sets the "height" field.

func (*PetCreate) SetMentor

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

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

func (*PetCreate) SetMentorID

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

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

SetNicknames sets the "nicknames" field.

func (*PetCreate) SetNillableBirthday

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

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

func (*PetCreate) SetNillableMentorID

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

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

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

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

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

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

func (*PetCreate) SetParent

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

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

func (*PetCreate) SetParentID

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

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

func (*PetCreate) SetProtege

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

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

func (*PetCreate) SetProtegeID

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

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

func (*PetCreate) SetSex

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

SetSex sets the "sex" field.

func (*PetCreate) SetSpouse

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

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

func (*PetCreate) SetSpouseID

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

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

func (*PetCreate) SetWeight

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

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

Exec executes the query.

func (*PetCreateBulk) ExecX

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

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

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

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

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

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

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

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

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

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

func (m *PetMutation) AddHeight(i int)

AddHeight adds i to the "height" field.

func (*PetMutation) AddPlayGroupIDs

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

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

func (*PetMutation) AddToyIDs

func (m *PetMutation) AddToyIDs(ids ...uuid.UUID)

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

func (*PetMutation) AddWeight

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

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

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

func (m *PetMutation) BadgeCleared() bool

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

func (*PetMutation) BadgeID

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

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

func (*PetMutation) BadgeIDs

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

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

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

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

func (*PetMutation) BirthdayCleared

func (m *PetMutation) BirthdayCleared() bool

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

func (*PetMutation) Castrated

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

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

func (*PetMutation) ChildrenCleared

func (m *PetMutation) ChildrenCleared() bool

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

func (*PetMutation) ChildrenIDs

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

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

func (*PetMutation) Chip

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

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

func (*PetMutation) ClearBadge

func (m *PetMutation) ClearBadge()

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

func (*PetMutation) ClearBirthday

func (m *PetMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*PetMutation) ClearChildren

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

func (m *PetMutation) ClearMentor()

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

func (*PetMutation) ClearNicknames

func (m *PetMutation) ClearNicknames()

ClearNicknames clears the value of the "nicknames" field.

func (*PetMutation) ClearParent

func (m *PetMutation) ClearParent()

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

func (*PetMutation) ClearPlayGroups

func (m *PetMutation) ClearPlayGroups()

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

func (*PetMutation) ClearProtege

func (m *PetMutation) ClearProtege()

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

func (*PetMutation) ClearSpouse

func (m *PetMutation) ClearSpouse()

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

func (*PetMutation) ClearToys

func (m *PetMutation) ClearToys()

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

func (*PetMutation) ClearWeight

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

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

func (m *PetMutation) MentorCleared() bool

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

func (*PetMutation) MentorID

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

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

func (*PetMutation) MentorIDs

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

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

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

func (*PetMutation) NicknamesCleared

func (m *PetMutation) NicknamesCleared() bool

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

func (*PetMutation) OldBirthday

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

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

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

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

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

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

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

func (m *PetMutation) ParentCleared() bool

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

func (*PetMutation) ParentID

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

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

func (*PetMutation) ParentIDs

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

func (m *PetMutation) PlayGroupsCleared() bool

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

func (*PetMutation) PlayGroupsIDs

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

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

func (*PetMutation) ProtegeCleared

func (m *PetMutation) ProtegeCleared() bool

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

func (*PetMutation) ProtegeID

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

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

func (*PetMutation) ProtegeIDs

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

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

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

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

func (*PetMutation) RemoveToyIDs

func (m *PetMutation) RemoveToyIDs(ids ...uuid.UUID)

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

func (*PetMutation) RemovedChildrenIDs

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

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

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

func (*PetMutation) RemovedToysIDs

func (m *PetMutation) RemovedToysIDs() (ids []uuid.UUID)

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

func (*PetMutation) ResetBadge

func (m *PetMutation) ResetBadge()

ResetBadge resets all changes to the "badge" edge.

func (*PetMutation) ResetBirthday

func (m *PetMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*PetMutation) ResetCastrated

func (m *PetMutation) ResetCastrated()

ResetCastrated resets all changes to the "castrated" field.

func (*PetMutation) ResetChildren

func (m *PetMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*PetMutation) ResetChip

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

func (m *PetMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*PetMutation) ResetMentor

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

func (m *PetMutation) ResetNicknames()

ResetNicknames resets all changes to the "nicknames" field.

func (*PetMutation) ResetParent

func (m *PetMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*PetMutation) ResetPlayGroups

func (m *PetMutation) ResetPlayGroups()

ResetPlayGroups resets all changes to the "play_groups" edge.

func (*PetMutation) ResetProtege

func (m *PetMutation) ResetProtege()

ResetProtege resets all changes to the "protege" edge.

func (*PetMutation) ResetSex

func (m *PetMutation) ResetSex()

ResetSex resets all changes to the "sex" field.

func (*PetMutation) ResetSpouse

func (m *PetMutation) ResetSpouse()

ResetSpouse resets all changes to the "spouse" edge.

func (*PetMutation) ResetToys

func (m *PetMutation) ResetToys()

ResetToys resets all changes to the "toys" edge.

func (*PetMutation) ResetWeight

func (m *PetMutation) ResetWeight()

ResetWeight resets all changes to the "weight" field.

func (*PetMutation) SetBadgeID

func (m *PetMutation) SetBadgeID(id uint32)

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

func (*PetMutation) SetBirthday

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

SetBirthday sets the "birthday" field.

func (*PetMutation) SetCastrated

func (m *PetMutation) SetCastrated(b bool)

SetCastrated sets the "castrated" field.

func (*PetMutation) SetChip

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

func (m *PetMutation) SetHeight(i int)

SetHeight sets the "height" field.

func (*PetMutation) SetMentorID

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

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

SetNicknames sets the "nicknames" field.

func (*PetMutation) SetParentID

func (m *PetMutation) SetParentID(id int)

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

func (*PetMutation) SetProtegeID

func (m *PetMutation) SetProtegeID(id int)

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

func (*PetMutation) SetSex

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

SetSex sets the "sex" field.

func (*PetMutation) SetSpouseID

func (m *PetMutation) SetSpouseID(id int)

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

func (*PetMutation) SetWeight

func (m *PetMutation) SetWeight(f float64)

SetWeight sets the "weight" field.

func (*PetMutation) Sex

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

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

func (*PetMutation) SpouseCleared

func (m *PetMutation) SpouseCleared() bool

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

func (*PetMutation) SpouseID

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

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

func (*PetMutation) SpouseIDs

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

func (m *PetMutation) ToysCleared() bool

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

func (*PetMutation) ToysIDs

func (m *PetMutation) ToysIDs() (ids []uuid.UUID)

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

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

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

func (*PetMutation) WeightCleared

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

func (pq *PetQuery) QueryBadge() *BadgeQuery

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

func (*PetQuery) QueryChildren

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

func (pq *PetQuery) QueryMentor() *PetQuery

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

func (*PetQuery) QueryParent

func (pq *PetQuery) QueryParent() *PetQuery

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

func (*PetQuery) QueryPlayGroups

func (pq *PetQuery) QueryPlayGroups() *PlayGroupQuery

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

func (*PetQuery) QueryProtege

func (pq *PetQuery) QueryProtege() *PetQuery

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

func (*PetQuery) QuerySpouse

func (pq *PetQuery) QuerySpouse() *PetQuery

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

func (*PetQuery) QueryToys

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

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

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

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

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

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

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

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

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

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

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

func (*PetUpdate) AddChildren

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

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

AddHeight adds i to the "height" field.

func (*PetUpdate) AddPlayGroupIDs

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

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

func (*PetUpdate) AddPlayGroups

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

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

func (*PetUpdate) AddToyIDs

func (pu *PetUpdate) AddToyIDs(ids ...uuid.UUID) *PetUpdate

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

func (*PetUpdate) AddToys

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

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

func (*PetUpdate) AddWeight

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

AddWeight adds f to the "weight" field.

func (*PetUpdate) ClearBadge

func (pu *PetUpdate) ClearBadge() *PetUpdate

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

func (*PetUpdate) ClearBirthday

func (pu *PetUpdate) ClearBirthday() *PetUpdate

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdate) ClearChildren

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

func (pu *PetUpdate) ClearMentor() *PetUpdate

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

func (*PetUpdate) ClearNicknames

func (pu *PetUpdate) ClearNicknames() *PetUpdate

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdate) ClearParent

func (pu *PetUpdate) ClearParent() *PetUpdate

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

func (*PetUpdate) ClearPlayGroups

func (pu *PetUpdate) ClearPlayGroups() *PetUpdate

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

func (*PetUpdate) ClearProtege

func (pu *PetUpdate) ClearProtege() *PetUpdate

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

func (*PetUpdate) ClearSpouse

func (pu *PetUpdate) ClearSpouse() *PetUpdate

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

func (*PetUpdate) ClearToys

func (pu *PetUpdate) ClearToys() *PetUpdate

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

func (*PetUpdate) ClearWeight

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

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

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

func (*PetUpdate) RemoveChildren

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

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

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

func (*PetUpdate) RemovePlayGroups

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

RemovePlayGroups removes "play_groups" edges to PlayGroup entities.

func (*PetUpdate) RemoveToyIDs

func (pu *PetUpdate) RemoveToyIDs(ids ...uuid.UUID) *PetUpdate

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

func (*PetUpdate) RemoveToys

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

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

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

func (*PetUpdate) SetBadgeID

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

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

func (*PetUpdate) SetBirthday

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

SetBirthday sets the "birthday" field.

func (*PetUpdate) SetCastrated

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

SetCastrated sets the "castrated" field.

func (*PetUpdate) SetChip

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

SetChip sets the "chip" field.

func (*PetUpdate) SetHeight

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

SetHeight sets the "height" field.

func (*PetUpdate) SetMentor

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

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

func (*PetUpdate) SetMentorID

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

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

SetNicknames sets the "nicknames" field.

func (*PetUpdate) SetNillableBirthday

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

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

func (*PetUpdate) SetNillableMentorID

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

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

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

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

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

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

func (*PetUpdate) SetParent

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

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

func (*PetUpdate) SetParentID

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

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

func (*PetUpdate) SetProtege

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

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

func (*PetUpdate) SetProtegeID

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

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

func (*PetUpdate) SetSpouse

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

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

func (*PetUpdate) SetSpouseID

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

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

func (*PetUpdate) SetWeight

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

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

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

func (*PetUpdateOne) AddChildren

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

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

AddHeight adds i to the "height" field.

func (*PetUpdateOne) AddPlayGroupIDs

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

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

func (*PetUpdateOne) AddPlayGroups

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

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

func (*PetUpdateOne) AddToyIDs

func (puo *PetUpdateOne) AddToyIDs(ids ...uuid.UUID) *PetUpdateOne

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

func (*PetUpdateOne) AddToys

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

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

func (*PetUpdateOne) AddWeight

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

AddWeight adds f to the "weight" field.

func (*PetUpdateOne) ClearBadge

func (puo *PetUpdateOne) ClearBadge() *PetUpdateOne

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

func (*PetUpdateOne) ClearBirthday

func (puo *PetUpdateOne) ClearBirthday() *PetUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdateOne) ClearChildren

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

func (puo *PetUpdateOne) ClearMentor() *PetUpdateOne

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

func (*PetUpdateOne) ClearNicknames

func (puo *PetUpdateOne) ClearNicknames() *PetUpdateOne

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdateOne) ClearParent

func (puo *PetUpdateOne) ClearParent() *PetUpdateOne

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

func (*PetUpdateOne) ClearPlayGroups

func (puo *PetUpdateOne) ClearPlayGroups() *PetUpdateOne

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

func (*PetUpdateOne) ClearProtege

func (puo *PetUpdateOne) ClearProtege() *PetUpdateOne

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

func (*PetUpdateOne) ClearSpouse

func (puo *PetUpdateOne) ClearSpouse() *PetUpdateOne

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

func (*PetUpdateOne) ClearToys

func (puo *PetUpdateOne) ClearToys() *PetUpdateOne

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

func (*PetUpdateOne) ClearWeight

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

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

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

func (*PetUpdateOne) RemoveChildren

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

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

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

func (*PetUpdateOne) RemovePlayGroups

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

RemovePlayGroups removes "play_groups" edges to PlayGroup entities.

func (*PetUpdateOne) RemoveToyIDs

func (puo *PetUpdateOne) RemoveToyIDs(ids ...uuid.UUID) *PetUpdateOne

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

func (*PetUpdateOne) RemoveToys

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

func (puo *PetUpdateOne) SetBadge(b *Badge) *PetUpdateOne

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

func (*PetUpdateOne) SetBadgeID

func (puo *PetUpdateOne) SetBadgeID(id uint32) *PetUpdateOne

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

func (*PetUpdateOne) SetBirthday

func (puo *PetUpdateOne) SetBirthday(t time.Time) *PetUpdateOne

SetBirthday sets the "birthday" field.

func (*PetUpdateOne) SetCastrated

func (puo *PetUpdateOne) SetCastrated(b bool) *PetUpdateOne

SetCastrated sets the "castrated" field.

func (*PetUpdateOne) SetChip

func (puo *PetUpdateOne) SetChip(u uuid.UUID) *PetUpdateOne

SetChip sets the "chip" field.

func (*PetUpdateOne) SetHeight

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

SetHeight sets the "height" field.

func (*PetUpdateOne) SetMentor

func (puo *PetUpdateOne) SetMentor(p *Pet) *PetUpdateOne

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

func (*PetUpdateOne) SetMentorID

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

func (puo *PetUpdateOne) SetNicknames(s []string) *PetUpdateOne

SetNicknames sets the "nicknames" field.

func (*PetUpdateOne) SetNillableBirthday

func (puo *PetUpdateOne) SetNillableBirthday(t *time.Time) *PetUpdateOne

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

func (*PetUpdateOne) SetNillableMentorID

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

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

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

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

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

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

func (*PetUpdateOne) SetParent

func (puo *PetUpdateOne) SetParent(p *Pet) *PetUpdateOne

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

func (*PetUpdateOne) SetParentID

func (puo *PetUpdateOne) SetParentID(id int) *PetUpdateOne

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

func (*PetUpdateOne) SetProtege

func (puo *PetUpdateOne) SetProtege(p *Pet) *PetUpdateOne

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

func (*PetUpdateOne) SetProtegeID

func (puo *PetUpdateOne) SetProtegeID(id int) *PetUpdateOne

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

func (*PetUpdateOne) SetSpouse

func (puo *PetUpdateOne) SetSpouse(p *Pet) *PetUpdateOne

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

func (*PetUpdateOne) SetSpouseID

func (puo *PetUpdateOne) SetSpouseID(id int) *PetUpdateOne

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

func (*PetUpdateOne) SetWeight

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

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

func (pg *PlayGroup) QueryParticipants() *PetQuery

QueryParticipants queries the "participants" edge of the PlayGroup entity.

func (*PlayGroup) String

func (pg *PlayGroup) String() string

String implements the fmt.Stringer.

func (*PlayGroup) Unwrap

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

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

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

PlayGroupClient is a client for the PlayGroup schema.

func NewPlayGroupClient

func NewPlayGroupClient(c config) *PlayGroupClient

NewPlayGroupClient returns a client for the PlayGroup from the given config.

func (*PlayGroupClient) Create

func (c *PlayGroupClient) Create() *PlayGroupCreate

Create returns a create builder for PlayGroup.

func (*PlayGroupClient) CreateBulk

func (c *PlayGroupClient) CreateBulk(builders ...*PlayGroupCreate) *PlayGroupCreateBulk

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

func (*PlayGroupClient) Delete

func (c *PlayGroupClient) Delete() *PlayGroupDelete

Delete returns a delete builder for PlayGroup.

func (*PlayGroupClient) DeleteOne

func (c *PlayGroupClient) DeleteOne(pg *PlayGroup) *PlayGroupDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PlayGroupClient) DeleteOneID

func (c *PlayGroupClient) DeleteOneID(id int) *PlayGroupDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PlayGroupClient) Get

func (c *PlayGroupClient) Get(ctx context.Context, id int) (*PlayGroup, error)

Get returns a PlayGroup entity by its id.

func (*PlayGroupClient) GetX

func (c *PlayGroupClient) GetX(ctx context.Context, id int) *PlayGroup

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

func (*PlayGroupClient) Hooks

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

Hooks returns the client hooks.

func (*PlayGroupClient) Query

func (c *PlayGroupClient) Query() *PlayGroupQuery

Query returns a query builder for PlayGroup.

func (*PlayGroupClient) QueryParticipants

func (c *PlayGroupClient) QueryParticipants(pg *PlayGroup) *PetQuery

QueryParticipants queries the participants edge of a PlayGroup.

func (*PlayGroupClient) Update

func (c *PlayGroupClient) Update() *PlayGroupUpdate

Update returns an update builder for PlayGroup.

func (*PlayGroupClient) UpdateOne

func (c *PlayGroupClient) UpdateOne(pg *PlayGroup) *PlayGroupUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PlayGroupClient) UpdateOneID

func (c *PlayGroupClient) UpdateOneID(id int) *PlayGroupUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PlayGroupClient) Use

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

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

PlayGroupCreate is the builder for creating a PlayGroup entity.

func (*PlayGroupCreate) AddParticipantIDs

func (pgc *PlayGroupCreate) AddParticipantIDs(ids ...int) *PlayGroupCreate

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupCreate) AddParticipants

func (pgc *PlayGroupCreate) AddParticipants(p ...*Pet) *PlayGroupCreate

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupCreate) Exec

func (pgc *PlayGroupCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupCreate) ExecX

func (pgc *PlayGroupCreate) ExecX(ctx context.Context)

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

func (*PlayGroupCreate) Mutation

func (pgc *PlayGroupCreate) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupCreate) Save

func (pgc *PlayGroupCreate) Save(ctx context.Context) (*PlayGroup, error)

Save creates the PlayGroup in the database.

func (*PlayGroupCreate) SaveX

func (pgc *PlayGroupCreate) SaveX(ctx context.Context) *PlayGroup

SaveX calls Save and panics if Save returns an error.

func (*PlayGroupCreate) SetDescription

func (pgc *PlayGroupCreate) SetDescription(s string) *PlayGroupCreate

SetDescription sets the "description" field.

func (*PlayGroupCreate) SetNillableDescription

func (pgc *PlayGroupCreate) SetNillableDescription(s *string) *PlayGroupCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupCreate) SetTitle

func (pgc *PlayGroupCreate) SetTitle(s string) *PlayGroupCreate

SetTitle sets the "title" field.

func (*PlayGroupCreate) SetWeekday

func (pgc *PlayGroupCreate) SetWeekday(pl playgroup.Weekday) *PlayGroupCreate

SetWeekday sets the "weekday" field.

type PlayGroupCreateBulk

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

PlayGroupCreateBulk is the builder for creating many PlayGroup entities in bulk.

func (*PlayGroupCreateBulk) Exec

func (pgcb *PlayGroupCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupCreateBulk) ExecX

func (pgcb *PlayGroupCreateBulk) ExecX(ctx context.Context)

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

func (*PlayGroupCreateBulk) Save

func (pgcb *PlayGroupCreateBulk) Save(ctx context.Context) ([]*PlayGroup, error)

Save creates the PlayGroup entities in the database.

func (*PlayGroupCreateBulk) SaveX

func (pgcb *PlayGroupCreateBulk) SaveX(ctx context.Context) []*PlayGroup

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

type PlayGroupDelete

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

PlayGroupDelete is the builder for deleting a PlayGroup entity.

func (*PlayGroupDelete) Exec

func (pgd *PlayGroupDelete) Exec(ctx context.Context) (int, error)

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

func (*PlayGroupDelete) ExecX

func (pgd *PlayGroupDelete) ExecX(ctx context.Context) int

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

func (*PlayGroupDelete) Where

Where appends a list predicates to the PlayGroupDelete builder.

type PlayGroupDeleteOne

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

PlayGroupDeleteOne is the builder for deleting a single PlayGroup entity.

func (*PlayGroupDeleteOne) Exec

func (pgdo *PlayGroupDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PlayGroupDeleteOne) ExecX

func (pgdo *PlayGroupDeleteOne) ExecX(ctx context.Context)

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

type PlayGroupEdges

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

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

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

PlayGroupGroupBy is the group-by builder for PlayGroup entities.

func (*PlayGroupGroupBy) Aggregate

func (pggb *PlayGroupGroupBy) Aggregate(fns ...AggregateFunc) *PlayGroupGroupBy

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

func (*PlayGroupGroupBy) Bool

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

func (pggb *PlayGroupGroupBy) BoolX(ctx context.Context) bool

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

func (*PlayGroupGroupBy) Bools

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

func (pggb *PlayGroupGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PlayGroupGroupBy) Float64

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

func (pggb *PlayGroupGroupBy) Float64X(ctx context.Context) float64

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

func (*PlayGroupGroupBy) Float64s

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

func (pggb *PlayGroupGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PlayGroupGroupBy) Int

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

func (pggb *PlayGroupGroupBy) IntX(ctx context.Context) int

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

func (*PlayGroupGroupBy) Ints

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

func (pggb *PlayGroupGroupBy) IntsX(ctx context.Context) []int

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

func (*PlayGroupGroupBy) Scan

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

func (pggb *PlayGroupGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PlayGroupGroupBy) String

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

func (pggb *PlayGroupGroupBy) StringX(ctx context.Context) string

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

func (*PlayGroupGroupBy) Strings

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

func (pggb *PlayGroupGroupBy) StringsX(ctx context.Context) []string

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

type PlayGroupMutation

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

PlayGroupMutation represents an operation that mutates the PlayGroup nodes in the graph.

func (*PlayGroupMutation) AddField

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

func (m *PlayGroupMutation) AddParticipantIDs(ids ...int)

AddParticipantIDs adds the "participants" edge to the Pet entity by ids.

func (*PlayGroupMutation) AddedEdges

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

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

func (*PlayGroupMutation) AddedField

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

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

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

func (*PlayGroupMutation) AddedIDs

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

func (m *PlayGroupMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PlayGroupMutation) ClearEdge

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

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

func (m *PlayGroupMutation) ClearParticipants()

ClearParticipants clears the "participants" edge to the Pet entity.

func (*PlayGroupMutation) ClearedEdges

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

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

func (*PlayGroupMutation) ClearedFields

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

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

func (PlayGroupMutation) Client

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

func (m *PlayGroupMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*PlayGroupMutation) DescriptionCleared

func (m *PlayGroupMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PlayGroupMutation) EdgeCleared

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

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

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

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

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

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

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

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

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

func (m *PlayGroupMutation) Op() Op

Op returns the operation name.

func (*PlayGroupMutation) ParticipantsCleared

func (m *PlayGroupMutation) ParticipantsCleared() bool

ParticipantsCleared reports if the "participants" edge to the Pet entity was cleared.

func (*PlayGroupMutation) ParticipantsIDs

func (m *PlayGroupMutation) ParticipantsIDs() (ids []int)

ParticipantsIDs returns the "participants" edge IDs in the mutation.

func (*PlayGroupMutation) RemoveParticipantIDs

func (m *PlayGroupMutation) RemoveParticipantIDs(ids ...int)

RemoveParticipantIDs removes the "participants" edge to the Pet entity by IDs.

func (*PlayGroupMutation) RemovedEdges

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

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

func (*PlayGroupMutation) RemovedIDs

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

func (m *PlayGroupMutation) RemovedParticipantsIDs() (ids []int)

RemovedParticipants returns the removed IDs of the "participants" edge to the Pet entity.

func (*PlayGroupMutation) ResetDescription

func (m *PlayGroupMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PlayGroupMutation) ResetEdge

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

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

func (m *PlayGroupMutation) ResetParticipants()

ResetParticipants resets all changes to the "participants" edge.

func (*PlayGroupMutation) ResetTitle

func (m *PlayGroupMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*PlayGroupMutation) ResetWeekday

func (m *PlayGroupMutation) ResetWeekday()

ResetWeekday resets all changes to the "weekday" field.

func (*PlayGroupMutation) SetDescription

func (m *PlayGroupMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PlayGroupMutation) SetField

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

func (m *PlayGroupMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*PlayGroupMutation) SetWeekday

func (m *PlayGroupMutation) SetWeekday(pl playgroup.Weekday)

SetWeekday sets the "weekday" field.

func (*PlayGroupMutation) Title

func (m *PlayGroupMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (PlayGroupMutation) Tx

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

func (m *PlayGroupMutation) Type() string

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

func (*PlayGroupMutation) Weekday

func (m *PlayGroupMutation) Weekday() (r playgroup.Weekday, exists bool)

Weekday returns the value of the "weekday" field in the mutation.

func (*PlayGroupMutation) Where

func (m *PlayGroupMutation) Where(ps ...predicate.PlayGroup)

Where appends a list predicates to the PlayGroupMutation builder.

type PlayGroupQuery

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

PlayGroupQuery is the builder for querying PlayGroup entities.

func (*PlayGroupQuery) All

func (pgq *PlayGroupQuery) All(ctx context.Context) ([]*PlayGroup, error)

All executes the query and returns a list of PlayGroups.

func (*PlayGroupQuery) AllX

func (pgq *PlayGroupQuery) AllX(ctx context.Context) []*PlayGroup

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

func (*PlayGroupQuery) Clone

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

func (pgq *PlayGroupQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PlayGroupQuery) CountX

func (pgq *PlayGroupQuery) CountX(ctx context.Context) int

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

func (*PlayGroupQuery) Exist

func (pgq *PlayGroupQuery) Exist(ctx context.Context) (bool, error)

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

func (*PlayGroupQuery) ExistX

func (pgq *PlayGroupQuery) ExistX(ctx context.Context) bool

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

func (*PlayGroupQuery) First

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

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

func (pgq *PlayGroupQuery) FirstIDX(ctx context.Context) int

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

func (*PlayGroupQuery) FirstX

func (pgq *PlayGroupQuery) FirstX(ctx context.Context) *PlayGroup

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

func (*PlayGroupQuery) GroupBy

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

func (pgq *PlayGroupQuery) IDs(ctx context.Context) ([]int, error)

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

func (*PlayGroupQuery) IDsX

func (pgq *PlayGroupQuery) IDsX(ctx context.Context) []int

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

func (*PlayGroupQuery) Limit

func (pgq *PlayGroupQuery) Limit(limit int) *PlayGroupQuery

Limit adds a limit step to the query.

func (*PlayGroupQuery) Offset

func (pgq *PlayGroupQuery) Offset(offset int) *PlayGroupQuery

Offset adds an offset step to the query.

func (*PlayGroupQuery) Only

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

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

func (pgq *PlayGroupQuery) OnlyIDX(ctx context.Context) int

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

func (*PlayGroupQuery) OnlyX

func (pgq *PlayGroupQuery) OnlyX(ctx context.Context) *PlayGroup

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

func (*PlayGroupQuery) Order

func (pgq *PlayGroupQuery) Order(o ...OrderFunc) *PlayGroupQuery

Order adds an order step to the query.

func (*PlayGroupQuery) QueryParticipants

func (pgq *PlayGroupQuery) QueryParticipants() *PetQuery

QueryParticipants chains the current query on the "participants" edge.

func (*PlayGroupQuery) Select

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

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

func (pgq *PlayGroupQuery) Where(ps ...predicate.PlayGroup) *PlayGroupQuery

Where adds a new predicate for the PlayGroupQuery builder.

func (*PlayGroupQuery) WithParticipants

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

type PlayGroupSelect struct {
	*PlayGroupQuery
	// contains filtered or unexported fields
}

PlayGroupSelect is the builder for selecting fields of PlayGroup entities.

func (*PlayGroupSelect) Bool

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

func (pgs *PlayGroupSelect) BoolX(ctx context.Context) bool

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

func (*PlayGroupSelect) Bools

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

func (pgs *PlayGroupSelect) BoolsX(ctx context.Context) []bool

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

func (*PlayGroupSelect) Float64

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

func (pgs *PlayGroupSelect) Float64X(ctx context.Context) float64

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

func (*PlayGroupSelect) Float64s

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

func (pgs *PlayGroupSelect) Float64sX(ctx context.Context) []float64

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

func (*PlayGroupSelect) Int

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

func (pgs *PlayGroupSelect) IntX(ctx context.Context) int

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

func (*PlayGroupSelect) Ints

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

func (pgs *PlayGroupSelect) IntsX(ctx context.Context) []int

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

func (*PlayGroupSelect) Scan

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

func (pgs *PlayGroupSelect) ScanX(ctx context.Context, v interface{})

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

func (*PlayGroupSelect) String

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

func (pgs *PlayGroupSelect) StringX(ctx context.Context) string

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

func (*PlayGroupSelect) Strings

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

func (pgs *PlayGroupSelect) StringsX(ctx context.Context) []string

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

type PlayGroupUpdate

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

PlayGroupUpdate is the builder for updating PlayGroup entities.

func (*PlayGroupUpdate) AddParticipantIDs

func (pgu *PlayGroupUpdate) AddParticipantIDs(ids ...int) *PlayGroupUpdate

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupUpdate) AddParticipants

func (pgu *PlayGroupUpdate) AddParticipants(p ...*Pet) *PlayGroupUpdate

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupUpdate) ClearDescription

func (pgu *PlayGroupUpdate) ClearDescription() *PlayGroupUpdate

ClearDescription clears the value of the "description" field.

func (*PlayGroupUpdate) ClearParticipants

func (pgu *PlayGroupUpdate) ClearParticipants() *PlayGroupUpdate

ClearParticipants clears all "participants" edges to the Pet entity.

func (*PlayGroupUpdate) Exec

func (pgu *PlayGroupUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PlayGroupUpdate) ExecX

func (pgu *PlayGroupUpdate) ExecX(ctx context.Context)

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

func (*PlayGroupUpdate) Mutation

func (pgu *PlayGroupUpdate) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupUpdate) RemoveParticipantIDs

func (pgu *PlayGroupUpdate) RemoveParticipantIDs(ids ...int) *PlayGroupUpdate

RemoveParticipantIDs removes the "participants" edge to Pet entities by IDs.

func (*PlayGroupUpdate) RemoveParticipants

func (pgu *PlayGroupUpdate) RemoveParticipants(p ...*Pet) *PlayGroupUpdate

RemoveParticipants removes "participants" edges to Pet entities.

func (*PlayGroupUpdate) Save

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

func (pgu *PlayGroupUpdate) SaveX(ctx context.Context) int

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

func (*PlayGroupUpdate) SetDescription

func (pgu *PlayGroupUpdate) SetDescription(s string) *PlayGroupUpdate

SetDescription sets the "description" field.

func (*PlayGroupUpdate) SetNillableDescription

func (pgu *PlayGroupUpdate) SetNillableDescription(s *string) *PlayGroupUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupUpdate) SetTitle

func (pgu *PlayGroupUpdate) SetTitle(s string) *PlayGroupUpdate

SetTitle sets the "title" field.

func (*PlayGroupUpdate) SetWeekday

func (pgu *PlayGroupUpdate) SetWeekday(pl playgroup.Weekday) *PlayGroupUpdate

SetWeekday sets the "weekday" field.

func (*PlayGroupUpdate) Where

Where appends a list predicates to the PlayGroupUpdate builder.

type PlayGroupUpdateOne

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

PlayGroupUpdateOne is the builder for updating a single PlayGroup entity.

func (*PlayGroupUpdateOne) AddParticipantIDs

func (pguo *PlayGroupUpdateOne) AddParticipantIDs(ids ...int) *PlayGroupUpdateOne

AddParticipantIDs adds the "participants" edge to the Pet entity by IDs.

func (*PlayGroupUpdateOne) AddParticipants

func (pguo *PlayGroupUpdateOne) AddParticipants(p ...*Pet) *PlayGroupUpdateOne

AddParticipants adds the "participants" edges to the Pet entity.

func (*PlayGroupUpdateOne) ClearDescription

func (pguo *PlayGroupUpdateOne) ClearDescription() *PlayGroupUpdateOne

ClearDescription clears the value of the "description" field.

func (*PlayGroupUpdateOne) ClearParticipants

func (pguo *PlayGroupUpdateOne) ClearParticipants() *PlayGroupUpdateOne

ClearParticipants clears all "participants" edges to the Pet entity.

func (*PlayGroupUpdateOne) Exec

func (pguo *PlayGroupUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PlayGroupUpdateOne) ExecX

func (pguo *PlayGroupUpdateOne) ExecX(ctx context.Context)

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

func (*PlayGroupUpdateOne) Mutation

func (pguo *PlayGroupUpdateOne) Mutation() *PlayGroupMutation

Mutation returns the PlayGroupMutation object of the builder.

func (*PlayGroupUpdateOne) RemoveParticipantIDs

func (pguo *PlayGroupUpdateOne) RemoveParticipantIDs(ids ...int) *PlayGroupUpdateOne

RemoveParticipantIDs removes the "participants" edge to Pet entities by IDs.

func (*PlayGroupUpdateOne) RemoveParticipants

func (pguo *PlayGroupUpdateOne) RemoveParticipants(p ...*Pet) *PlayGroupUpdateOne

RemoveParticipants removes "participants" edges to Pet entities.

func (*PlayGroupUpdateOne) Save

func (pguo *PlayGroupUpdateOne) Save(ctx context.Context) (*PlayGroup, error)

Save executes the query and returns the updated PlayGroup entity.

func (*PlayGroupUpdateOne) SaveX

func (pguo *PlayGroupUpdateOne) SaveX(ctx context.Context) *PlayGroup

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

func (*PlayGroupUpdateOne) Select

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

func (pguo *PlayGroupUpdateOne) SetDescription(s string) *PlayGroupUpdateOne

SetDescription sets the "description" field.

func (*PlayGroupUpdateOne) SetNillableDescription

func (pguo *PlayGroupUpdateOne) SetNillableDescription(s *string) *PlayGroupUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PlayGroupUpdateOne) SetTitle

func (pguo *PlayGroupUpdateOne) SetTitle(s string) *PlayGroupUpdateOne

SetTitle sets the "title" field.

func (*PlayGroupUpdateOne) SetWeekday

SetWeekday sets the "weekday" field.

type PlayGroups

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

type Toy struct {

	// ID of the ent.
	ID uuid.UUID `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

func (t *Toy) QueryOwner() *PetQuery

QueryOwner queries the "owner" edge of the Toy entity.

func (*Toy) String

func (t *Toy) String() string

String implements the fmt.Stringer.

func (*Toy) Unwrap

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

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

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

ToyClient is a client for the Toy schema.

func NewToyClient

func NewToyClient(c config) *ToyClient

NewToyClient returns a client for the Toy from the given config.

func (*ToyClient) Create

func (c *ToyClient) Create() *ToyCreate

Create returns a create builder for Toy.

func (*ToyClient) CreateBulk

func (c *ToyClient) CreateBulk(builders ...*ToyCreate) *ToyCreateBulk

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

func (*ToyClient) Delete

func (c *ToyClient) Delete() *ToyDelete

Delete returns a delete builder for Toy.

func (*ToyClient) DeleteOne

func (c *ToyClient) DeleteOne(t *Toy) *ToyDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*ToyClient) DeleteOneID

func (c *ToyClient) DeleteOneID(id uuid.UUID) *ToyDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*ToyClient) Get

func (c *ToyClient) Get(ctx context.Context, id uuid.UUID) (*Toy, error)

Get returns a Toy entity by its id.

func (*ToyClient) GetX

func (c *ToyClient) GetX(ctx context.Context, id uuid.UUID) *Toy

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

func (*ToyClient) Hooks

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

Hooks returns the client hooks.

func (*ToyClient) Query

func (c *ToyClient) Query() *ToyQuery

Query returns a query builder for Toy.

func (*ToyClient) QueryOwner

func (c *ToyClient) QueryOwner(t *Toy) *PetQuery

QueryOwner queries the owner edge of a Toy.

func (*ToyClient) Update

func (c *ToyClient) Update() *ToyUpdate

Update returns an update builder for Toy.

func (*ToyClient) UpdateOne

func (c *ToyClient) UpdateOne(t *Toy) *ToyUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ToyClient) UpdateOneID

func (c *ToyClient) UpdateOneID(id uuid.UUID) *ToyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ToyClient) Use

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

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

ToyCreate is the builder for creating a Toy entity.

func (*ToyCreate) Exec

func (tc *ToyCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyCreate) ExecX

func (tc *ToyCreate) ExecX(ctx context.Context)

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

func (*ToyCreate) Mutation

func (tc *ToyCreate) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyCreate) Save

func (tc *ToyCreate) Save(ctx context.Context) (*Toy, error)

Save creates the Toy in the database.

func (*ToyCreate) SaveX

func (tc *ToyCreate) SaveX(ctx context.Context) *Toy

SaveX calls Save and panics if Save returns an error.

func (*ToyCreate) SetColor

func (tc *ToyCreate) SetColor(t toy.Color) *ToyCreate

SetColor sets the "color" field.

func (*ToyCreate) SetID added in v0.4.1

func (tc *ToyCreate) SetID(u uuid.UUID) *ToyCreate

SetID sets the "id" field.

func (*ToyCreate) SetMaterial

func (tc *ToyCreate) SetMaterial(t toy.Material) *ToyCreate

SetMaterial sets the "material" field.

func (*ToyCreate) SetNillableOwnerID

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

func (tc *ToyCreate) SetOwner(p *Pet) *ToyCreate

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyCreate) SetOwnerID

func (tc *ToyCreate) SetOwnerID(id int) *ToyCreate

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyCreate) SetTitle

func (tc *ToyCreate) SetTitle(s string) *ToyCreate

SetTitle sets the "title" field.

type ToyCreateBulk

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

ToyCreateBulk is the builder for creating many Toy entities in bulk.

func (*ToyCreateBulk) Exec

func (tcb *ToyCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyCreateBulk) ExecX

func (tcb *ToyCreateBulk) ExecX(ctx context.Context)

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

func (*ToyCreateBulk) Save

func (tcb *ToyCreateBulk) Save(ctx context.Context) ([]*Toy, error)

Save creates the Toy entities in the database.

func (*ToyCreateBulk) SaveX

func (tcb *ToyCreateBulk) SaveX(ctx context.Context) []*Toy

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

type ToyDelete

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

ToyDelete is the builder for deleting a Toy entity.

func (*ToyDelete) Exec

func (td *ToyDelete) Exec(ctx context.Context) (int, error)

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

func (*ToyDelete) ExecX

func (td *ToyDelete) ExecX(ctx context.Context) int

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

func (*ToyDelete) Where

func (td *ToyDelete) Where(ps ...predicate.Toy) *ToyDelete

Where appends a list predicates to the ToyDelete builder.

type ToyDeleteOne

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

ToyDeleteOne is the builder for deleting a single Toy entity.

func (*ToyDeleteOne) Exec

func (tdo *ToyDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ToyDeleteOne) ExecX

func (tdo *ToyDeleteOne) ExecX(ctx context.Context)

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

type ToyEdges

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

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

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

ToyGroupBy is the group-by builder for Toy entities.

func (*ToyGroupBy) Aggregate

func (tgb *ToyGroupBy) Aggregate(fns ...AggregateFunc) *ToyGroupBy

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

func (*ToyGroupBy) Bool

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

func (tgb *ToyGroupBy) BoolX(ctx context.Context) bool

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

func (*ToyGroupBy) Bools

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

func (tgb *ToyGroupBy) BoolsX(ctx context.Context) []bool

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

func (*ToyGroupBy) Float64

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

func (tgb *ToyGroupBy) Float64X(ctx context.Context) float64

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

func (*ToyGroupBy) Float64s

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

func (tgb *ToyGroupBy) Float64sX(ctx context.Context) []float64

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

func (*ToyGroupBy) Int

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

func (tgb *ToyGroupBy) IntX(ctx context.Context) int

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

func (*ToyGroupBy) Ints

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

func (tgb *ToyGroupBy) IntsX(ctx context.Context) []int

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

func (*ToyGroupBy) Scan

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

func (tgb *ToyGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ToyGroupBy) String

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

func (tgb *ToyGroupBy) StringX(ctx context.Context) string

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

func (*ToyGroupBy) Strings

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

func (tgb *ToyGroupBy) StringsX(ctx context.Context) []string

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

type ToyMutation

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

ToyMutation represents an operation that mutates the Toy nodes in the graph.

func (*ToyMutation) AddField

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

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

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

func (*ToyMutation) AddedField

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

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

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

func (*ToyMutation) AddedIDs

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

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

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

func (m *ToyMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyMutation) ClearedEdges

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

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

func (*ToyMutation) ClearedFields

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

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

func (ToyMutation) Client

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

func (m *ToyMutation) Color() (r toy.Color, exists bool)

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

func (*ToyMutation) EdgeCleared

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

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

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

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

func (m *ToyMutation) ID() (id uuid.UUID, exists bool)

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

func (*ToyMutation) Material

func (m *ToyMutation) Material() (r toy.Material, exists bool)

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

func (*ToyMutation) OldColor

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

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

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

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

func (m *ToyMutation) Op() Op

Op returns the operation name.

func (*ToyMutation) OwnerCleared

func (m *ToyMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the Pet entity was cleared.

func (*ToyMutation) OwnerID

func (m *ToyMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*ToyMutation) OwnerIDs

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

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

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

func (*ToyMutation) RemovedIDs

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

func (m *ToyMutation) ResetColor()

ResetColor resets all changes to the "color" field.

func (*ToyMutation) ResetEdge

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

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

func (m *ToyMutation) ResetMaterial()

ResetMaterial resets all changes to the "material" field.

func (*ToyMutation) ResetOwner

func (m *ToyMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*ToyMutation) ResetTitle

func (m *ToyMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ToyMutation) SetColor

func (m *ToyMutation) SetColor(t toy.Color)

SetColor sets the "color" field.

func (*ToyMutation) SetField

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) SetID added in v0.4.1

func (m *ToyMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Toy entities.

func (*ToyMutation) SetMaterial

func (m *ToyMutation) SetMaterial(t toy.Material)

SetMaterial sets the "material" field.

func (*ToyMutation) SetOwnerID

func (m *ToyMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the Pet entity by id.

func (*ToyMutation) SetTitle

func (m *ToyMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ToyMutation) Title

func (m *ToyMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (ToyMutation) Tx

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

func (m *ToyMutation) Type() string

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

func (*ToyMutation) Where

func (m *ToyMutation) Where(ps ...predicate.Toy)

Where appends a list predicates to the ToyMutation builder.

type ToyQuery

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

ToyQuery is the builder for querying Toy entities.

func (*ToyQuery) All

func (tq *ToyQuery) All(ctx context.Context) ([]*Toy, error)

All executes the query and returns a list of Toys.

func (*ToyQuery) AllX

func (tq *ToyQuery) AllX(ctx context.Context) []*Toy

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

func (*ToyQuery) Clone

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

func (tq *ToyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ToyQuery) CountX

func (tq *ToyQuery) CountX(ctx context.Context) int

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

func (*ToyQuery) Exist

func (tq *ToyQuery) Exist(ctx context.Context) (bool, error)

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

func (*ToyQuery) ExistX

func (tq *ToyQuery) ExistX(ctx context.Context) bool

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

func (*ToyQuery) First

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

func (tq *ToyQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ToyQuery) FirstIDX

func (tq *ToyQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ToyQuery) FirstX

func (tq *ToyQuery) FirstX(ctx context.Context) *Toy

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

func (*ToyQuery) GroupBy

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

func (tq *ToyQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*ToyQuery) IDsX

func (tq *ToyQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ToyQuery) Limit

func (tq *ToyQuery) Limit(limit int) *ToyQuery

Limit adds a limit step to the query.

func (*ToyQuery) Offset

func (tq *ToyQuery) Offset(offset int) *ToyQuery

Offset adds an offset step to the query.

func (*ToyQuery) Only

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

func (tq *ToyQuery) OnlyID(ctx context.Context) (id uuid.UUID, 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

func (tq *ToyQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ToyQuery) OnlyX

func (tq *ToyQuery) OnlyX(ctx context.Context) *Toy

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

func (*ToyQuery) Order

func (tq *ToyQuery) Order(o ...OrderFunc) *ToyQuery

Order adds an order step to the query.

func (*ToyQuery) QueryOwner

func (tq *ToyQuery) QueryOwner() *PetQuery

QueryOwner chains the current query on the "owner" edge.

func (*ToyQuery) Select

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

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

func (tq *ToyQuery) Where(ps ...predicate.Toy) *ToyQuery

Where adds a new predicate for the ToyQuery builder.

func (*ToyQuery) WithOwner

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

type ToySelect struct {
	*ToyQuery
	// contains filtered or unexported fields
}

ToySelect is the builder for selecting fields of Toy entities.

func (*ToySelect) Bool

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

func (ts *ToySelect) BoolX(ctx context.Context) bool

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

func (*ToySelect) Bools

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

func (ts *ToySelect) BoolsX(ctx context.Context) []bool

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

func (*ToySelect) Float64

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

func (ts *ToySelect) Float64X(ctx context.Context) float64

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

func (*ToySelect) Float64s

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

func (ts *ToySelect) Float64sX(ctx context.Context) []float64

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

func (*ToySelect) Int

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

func (ts *ToySelect) IntX(ctx context.Context) int

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

func (*ToySelect) Ints

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

func (ts *ToySelect) IntsX(ctx context.Context) []int

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

func (*ToySelect) Scan

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

func (ts *ToySelect) ScanX(ctx context.Context, v interface{})

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

func (*ToySelect) String

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

func (ts *ToySelect) StringX(ctx context.Context) string

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

func (*ToySelect) Strings

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

func (ts *ToySelect) StringsX(ctx context.Context) []string

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

type ToyUpdate

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

ToyUpdate is the builder for updating Toy entities.

func (*ToyUpdate) ClearOwner

func (tu *ToyUpdate) ClearOwner() *ToyUpdate

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyUpdate) Exec

func (tu *ToyUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ToyUpdate) ExecX

func (tu *ToyUpdate) ExecX(ctx context.Context)

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

func (*ToyUpdate) Mutation

func (tu *ToyUpdate) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyUpdate) Save

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

func (tu *ToyUpdate) SaveX(ctx context.Context) int

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

func (*ToyUpdate) SetColor

func (tu *ToyUpdate) SetColor(t toy.Color) *ToyUpdate

SetColor sets the "color" field.

func (*ToyUpdate) SetMaterial

func (tu *ToyUpdate) SetMaterial(t toy.Material) *ToyUpdate

SetMaterial sets the "material" field.

func (*ToyUpdate) SetNillableOwnerID

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

func (tu *ToyUpdate) SetOwner(p *Pet) *ToyUpdate

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyUpdate) SetOwnerID

func (tu *ToyUpdate) SetOwnerID(id int) *ToyUpdate

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyUpdate) SetTitle

func (tu *ToyUpdate) SetTitle(s string) *ToyUpdate

SetTitle sets the "title" field.

func (*ToyUpdate) Where

func (tu *ToyUpdate) Where(ps ...predicate.Toy) *ToyUpdate

Where appends a list predicates to the ToyUpdate builder.

type ToyUpdateOne

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

ToyUpdateOne is the builder for updating a single Toy entity.

func (*ToyUpdateOne) ClearOwner

func (tuo *ToyUpdateOne) ClearOwner() *ToyUpdateOne

ClearOwner clears the "owner" edge to the Pet entity.

func (*ToyUpdateOne) Exec

func (tuo *ToyUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ToyUpdateOne) ExecX

func (tuo *ToyUpdateOne) ExecX(ctx context.Context)

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

func (*ToyUpdateOne) Mutation

func (tuo *ToyUpdateOne) Mutation() *ToyMutation

Mutation returns the ToyMutation object of the builder.

func (*ToyUpdateOne) Save

func (tuo *ToyUpdateOne) Save(ctx context.Context) (*Toy, error)

Save executes the query and returns the updated Toy entity.

func (*ToyUpdateOne) SaveX

func (tuo *ToyUpdateOne) SaveX(ctx context.Context) *Toy

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

func (*ToyUpdateOne) Select

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

func (tuo *ToyUpdateOne) SetColor(t toy.Color) *ToyUpdateOne

SetColor sets the "color" field.

func (*ToyUpdateOne) SetMaterial

func (tuo *ToyUpdateOne) SetMaterial(t toy.Material) *ToyUpdateOne

SetMaterial sets the "material" field.

func (*ToyUpdateOne) SetNillableOwnerID

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

func (tuo *ToyUpdateOne) SetOwner(p *Pet) *ToyUpdateOne

SetOwner sets the "owner" edge to the Pet entity.

func (*ToyUpdateOne) SetOwnerID

func (tuo *ToyUpdateOne) SetOwnerID(id int) *ToyUpdateOne

SetOwnerID sets the "owner" edge to the Pet entity by ID.

func (*ToyUpdateOne) SetTitle

func (tuo *ToyUpdateOne) SetTitle(s string) *ToyUpdateOne

SetTitle sets the "title" field.

type Toys

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