gen

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 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.
	TypeBreed     = "Breed"
	TypeCat       = "Cat"
	TypeFatherCat = "FatherCat"
	TypeKitten    = "Kitten"
)

Variables

View Source
var ErrTxStarted = errors.New("gen: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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(gen.As(gen.Sum(field1), "sum_field1"), (gen.As(gen.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 Breed

type Breed struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// DeletedTime holds the value of the "deleted_time" field.
	DeletedTime *time.Time `json:"deleted_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BreedQuery when eager-loading is set.
	Edges BreedEdges `json:"edges"`
	// contains filtered or unexported fields
}

Breed is the model entity for the Breed schema.

func (*Breed) QueryCats

func (b *Breed) QueryCats() *CatQuery

QueryCats queries the "cats" edge of the Breed entity.

func (*Breed) String

func (b *Breed) String() string

String implements the fmt.Stringer.

func (*Breed) Unwrap

func (b *Breed) Unwrap() *Breed

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

func (b *Breed) Update() *BreedUpdateOne

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

func (*Breed) Value

func (b *Breed) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Breed. This includes values selected through modifiers, order, etc.

type BreedClient

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

BreedClient is a client for the Breed schema.

func NewBreedClient

func NewBreedClient(c config) *BreedClient

NewBreedClient returns a client for the Breed from the given config.

func (*BreedClient) Create

func (c *BreedClient) Create() *BreedCreate

Create returns a builder for creating a Breed entity.

func (*BreedClient) CreateBulk

func (c *BreedClient) CreateBulk(builders ...*BreedCreate) *BreedCreateBulk

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

func (*BreedClient) Delete

func (c *BreedClient) Delete() *BreedDelete

Delete returns a delete builder for Breed.

func (*BreedClient) DeleteOne

func (c *BreedClient) DeleteOne(b *Breed) *BreedDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BreedClient) DeleteOneID

func (c *BreedClient) DeleteOneID(id uuid.UUID) *BreedDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*BreedClient) Get

func (c *BreedClient) Get(ctx context.Context, id uuid.UUID) (*Breed, error)

Get returns a Breed entity by its id.

func (*BreedClient) GetX

func (c *BreedClient) GetX(ctx context.Context, id uuid.UUID) *Breed

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

func (*BreedClient) Hooks

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

Hooks returns the client hooks.

func (*BreedClient) Intercept

func (c *BreedClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `breed.Intercept(f(g(h())))`.

func (*BreedClient) Interceptors

func (c *BreedClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*BreedClient) MapCreateBulk

func (c *BreedClient) MapCreateBulk(slice any, setFunc func(*BreedCreate, int)) *BreedCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*BreedClient) Query

func (c *BreedClient) Query() *BreedQuery

Query returns a query builder for Breed.

func (*BreedClient) QueryCats

func (c *BreedClient) QueryCats(b *Breed) *CatQuery

QueryCats queries the cats edge of a Breed.

func (*BreedClient) Update

func (c *BreedClient) Update() *BreedUpdate

Update returns an update builder for Breed.

func (*BreedClient) UpdateOne

func (c *BreedClient) UpdateOne(b *Breed) *BreedUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BreedClient) UpdateOneID

func (c *BreedClient) UpdateOneID(id uuid.UUID) *BreedUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BreedClient) Use

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

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

type BreedCreate

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

BreedCreate is the builder for creating a Breed entity.

func (*BreedCreate) AddCatIDs

func (bc *BreedCreate) AddCatIDs(ids ...uuid.UUID) *BreedCreate

AddCatIDs adds the "cats" edge to the Cat entity by IDs.

func (*BreedCreate) AddCats

func (bc *BreedCreate) AddCats(c ...*Cat) *BreedCreate

AddCats adds the "cats" edges to the Cat entity.

func (*BreedCreate) Exec

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

Exec executes the query.

func (*BreedCreate) ExecX

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

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

func (*BreedCreate) Mutation

func (bc *BreedCreate) Mutation() *BreedMutation

Mutation returns the BreedMutation object of the builder.

func (*BreedCreate) Save

func (bc *BreedCreate) Save(ctx context.Context) (*Breed, error)

Save creates the Breed in the database.

func (*BreedCreate) SaveX

func (bc *BreedCreate) SaveX(ctx context.Context) *Breed

SaveX calls Save and panics if Save returns an error.

func (*BreedCreate) SetCreateTime

func (bc *BreedCreate) SetCreateTime(t time.Time) *BreedCreate

SetCreateTime sets the "create_time" field.

func (*BreedCreate) SetDeletedTime

func (bc *BreedCreate) SetDeletedTime(t time.Time) *BreedCreate

SetDeletedTime sets the "deleted_time" field.

func (*BreedCreate) SetID

func (bc *BreedCreate) SetID(u uuid.UUID) *BreedCreate

SetID sets the "id" field.

func (*BreedCreate) SetName

func (bc *BreedCreate) SetName(s string) *BreedCreate

SetName sets the "name" field.

func (*BreedCreate) SetNillableCreateTime

func (bc *BreedCreate) SetNillableCreateTime(t *time.Time) *BreedCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*BreedCreate) SetNillableDeletedTime

func (bc *BreedCreate) SetNillableDeletedTime(t *time.Time) *BreedCreate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*BreedCreate) SetNillableID

func (bc *BreedCreate) SetNillableID(u *uuid.UUID) *BreedCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*BreedCreate) SetNillableUpdateTime

func (bc *BreedCreate) SetNillableUpdateTime(t *time.Time) *BreedCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*BreedCreate) SetUpdateTime

func (bc *BreedCreate) SetUpdateTime(t time.Time) *BreedCreate

SetUpdateTime sets the "update_time" field.

type BreedCreateBulk

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

BreedCreateBulk is the builder for creating many Breed entities in bulk.

func (*BreedCreateBulk) Exec

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

Exec executes the query.

func (*BreedCreateBulk) ExecX

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

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

func (*BreedCreateBulk) Save

func (bcb *BreedCreateBulk) Save(ctx context.Context) ([]*Breed, error)

Save creates the Breed entities in the database.

func (*BreedCreateBulk) SaveX

func (bcb *BreedCreateBulk) SaveX(ctx context.Context) []*Breed

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

type BreedDelete

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

BreedDelete is the builder for deleting a Breed entity.

func (*BreedDelete) Exec

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

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

func (*BreedDelete) ExecX

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

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

func (*BreedDelete) Where

func (bd *BreedDelete) Where(ps ...predicate.Breed) *BreedDelete

Where appends a list predicates to the BreedDelete builder.

type BreedDeleteOne

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

BreedDeleteOne is the builder for deleting a single Breed entity.

func (*BreedDeleteOne) Exec

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

Exec executes the deletion query.

func (*BreedDeleteOne) ExecX

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

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

func (*BreedDeleteOne) Where

func (bdo *BreedDeleteOne) Where(ps ...predicate.Breed) *BreedDeleteOne

Where appends a list predicates to the BreedDelete builder.

type BreedEdges

type BreedEdges struct {
	// Cats holds the value of the cats edge.
	Cats []*Cat `json:"cats,omitempty"`
	// contains filtered or unexported fields
}

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

func (BreedEdges) CatsOrErr

func (e BreedEdges) CatsOrErr() ([]*Cat, error)

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

type BreedGroupBy

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

BreedGroupBy is the group-by builder for Breed entities.

func (*BreedGroupBy) Aggregate

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

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

func (*BreedGroupBy) Bool

func (s *BreedGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*BreedGroupBy) BoolX

func (s *BreedGroupBy) BoolX(ctx context.Context) bool

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

func (*BreedGroupBy) Bools

func (s *BreedGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*BreedGroupBy) BoolsX

func (s *BreedGroupBy) BoolsX(ctx context.Context) []bool

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

func (*BreedGroupBy) Float64

func (s *BreedGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*BreedGroupBy) Float64X

func (s *BreedGroupBy) Float64X(ctx context.Context) float64

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

func (*BreedGroupBy) Float64s

func (s *BreedGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*BreedGroupBy) Float64sX

func (s *BreedGroupBy) Float64sX(ctx context.Context) []float64

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

func (*BreedGroupBy) Int

func (s *BreedGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*BreedGroupBy) IntX

func (s *BreedGroupBy) IntX(ctx context.Context) int

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

func (*BreedGroupBy) Ints

func (s *BreedGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*BreedGroupBy) IntsX

func (s *BreedGroupBy) IntsX(ctx context.Context) []int

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

func (*BreedGroupBy) Scan

func (bgb *BreedGroupBy) Scan(ctx context.Context, v any) error

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

func (*BreedGroupBy) ScanX

func (s *BreedGroupBy) ScanX(ctx context.Context, v any)

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

func (*BreedGroupBy) String

func (s *BreedGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*BreedGroupBy) StringX

func (s *BreedGroupBy) StringX(ctx context.Context) string

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

func (*BreedGroupBy) Strings

func (s *BreedGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*BreedGroupBy) StringsX

func (s *BreedGroupBy) StringsX(ctx context.Context) []string

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

type BreedMutation

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

BreedMutation represents an operation that mutates the Breed nodes in the graph.

func (*BreedMutation) AddCatIDs

func (m *BreedMutation) AddCatIDs(ids ...uuid.UUID)

AddCatIDs adds the "cats" edge to the Cat entity by ids.

func (*BreedMutation) AddField

func (m *BreedMutation) 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 (*BreedMutation) AddedEdges

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

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

func (*BreedMutation) AddedField

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

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

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

func (*BreedMutation) AddedIDs

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

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

func (*BreedMutation) CatsCleared

func (m *BreedMutation) CatsCleared() bool

CatsCleared reports if the "cats" edge to the Cat entity was cleared.

func (*BreedMutation) CatsIDs

func (m *BreedMutation) CatsIDs() (ids []uuid.UUID)

CatsIDs returns the "cats" edge IDs in the mutation.

func (*BreedMutation) ClearCats

func (m *BreedMutation) ClearCats()

ClearCats clears the "cats" edge to the Cat entity.

func (*BreedMutation) ClearDeletedTime

func (m *BreedMutation) ClearDeletedTime()

ClearDeletedTime clears the value of the "deleted_time" field.

func (*BreedMutation) ClearEdge

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

func (m *BreedMutation) 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 (*BreedMutation) ClearedEdges

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

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

func (*BreedMutation) ClearedFields

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

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

func (BreedMutation) Client

func (m BreedMutation) 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 (*BreedMutation) CreateTime

func (m *BreedMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*BreedMutation) DeletedTime

func (m *BreedMutation) DeletedTime() (r time.Time, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*BreedMutation) DeletedTimeCleared

func (m *BreedMutation) DeletedTimeCleared() bool

DeletedTimeCleared returns if the "deleted_time" field was cleared in this mutation.

func (*BreedMutation) EdgeCleared

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

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

func (*BreedMutation) Field

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

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

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

func (*BreedMutation) Fields

func (m *BreedMutation) 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 (*BreedMutation) ID

func (m *BreedMutation) 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 (*BreedMutation) IDs

func (m *BreedMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*BreedMutation) Name

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

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

func (*BreedMutation) OldCreateTime

func (m *BreedMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Breed entity. If the Breed 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 (*BreedMutation) OldDeletedTime

func (m *BreedMutation) OldDeletedTime(ctx context.Context) (v *time.Time, err error)

OldDeletedTime returns the old "deleted_time" field's value of the Breed entity. If the Breed 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 (*BreedMutation) OldField

func (m *BreedMutation) 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 (*BreedMutation) OldName

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

OldName returns the old "name" field's value of the Breed entity. If the Breed 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 (*BreedMutation) OldUpdateTime

func (m *BreedMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Breed entity. If the Breed 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 (*BreedMutation) Op

func (m *BreedMutation) Op() Op

Op returns the operation name.

func (*BreedMutation) RemoveCatIDs

func (m *BreedMutation) RemoveCatIDs(ids ...uuid.UUID)

RemoveCatIDs removes the "cats" edge to the Cat entity by IDs.

func (*BreedMutation) RemovedCatsIDs

func (m *BreedMutation) RemovedCatsIDs() (ids []uuid.UUID)

RemovedCats returns the removed IDs of the "cats" edge to the Cat entity.

func (*BreedMutation) RemovedEdges

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

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

func (*BreedMutation) RemovedIDs

func (m *BreedMutation) 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 (*BreedMutation) ResetCats

func (m *BreedMutation) ResetCats()

ResetCats resets all changes to the "cats" edge.

func (*BreedMutation) ResetCreateTime

func (m *BreedMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*BreedMutation) ResetDeletedTime

func (m *BreedMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*BreedMutation) ResetEdge

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

func (m *BreedMutation) 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 (*BreedMutation) ResetName

func (m *BreedMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*BreedMutation) ResetUpdateTime

func (m *BreedMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*BreedMutation) SetCreateTime

func (m *BreedMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*BreedMutation) SetDeletedTime

func (m *BreedMutation) SetDeletedTime(t time.Time)

SetDeletedTime sets the "deleted_time" field.

func (*BreedMutation) SetField

func (m *BreedMutation) 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 (*BreedMutation) SetID

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

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

func (*BreedMutation) SetName

func (m *BreedMutation) SetName(s string)

SetName sets the "name" field.

func (*BreedMutation) SetOp

func (m *BreedMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BreedMutation) SetUpdateTime

func (m *BreedMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (BreedMutation) Tx

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

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

func (*BreedMutation) Type

func (m *BreedMutation) Type() string

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

func (*BreedMutation) UpdateTime

func (m *BreedMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*BreedMutation) Where

func (m *BreedMutation) Where(ps ...predicate.Breed)

Where appends a list predicates to the BreedMutation builder.

func (*BreedMutation) WhereP

func (m *BreedMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the BreedMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type BreedQuery

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

BreedQuery is the builder for querying Breed entities.

func (*BreedQuery) Aggregate

func (bq *BreedQuery) Aggregate(fns ...AggregateFunc) *BreedSelect

Aggregate returns a BreedSelect configured with the given aggregations.

func (*BreedQuery) All

func (bq *BreedQuery) All(ctx context.Context) ([]*Breed, error)

All executes the query and returns a list of Breeds.

func (*BreedQuery) AllX

func (bq *BreedQuery) AllX(ctx context.Context) []*Breed

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

func (*BreedQuery) Clone

func (bq *BreedQuery) Clone() *BreedQuery

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

func (*BreedQuery) Count

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

Count returns the count of the given query.

func (*BreedQuery) CountX

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

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

func (*BreedQuery) Exist

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

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

func (*BreedQuery) ExistX

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

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

func (*BreedQuery) First

func (bq *BreedQuery) First(ctx context.Context) (*Breed, error)

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

func (*BreedQuery) FirstID

func (bq *BreedQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BreedQuery) FirstIDX

func (bq *BreedQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*BreedQuery) FirstX

func (bq *BreedQuery) FirstX(ctx context.Context) *Breed

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

func (*BreedQuery) GroupBy

func (bq *BreedQuery) GroupBy(field string, fields ...string) *BreedGroupBy

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Breed.Query().
	GroupBy(breed.FieldDeletedTime).
	Aggregate(gen.Count()).
	Scan(ctx, &v)

func (*BreedQuery) IDs

func (bq *BreedQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*BreedQuery) IDsX

func (bq *BreedQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*BreedQuery) Limit

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

Limit the number of records to be returned by this query.

func (*BreedQuery) Offset

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

Offset to start from.

func (*BreedQuery) Only

func (bq *BreedQuery) Only(ctx context.Context) (*Breed, error)

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

func (*BreedQuery) OnlyID

func (bq *BreedQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BreedQuery) OnlyIDX

func (bq *BreedQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*BreedQuery) OnlyX

func (bq *BreedQuery) OnlyX(ctx context.Context) *Breed

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

func (*BreedQuery) Order

func (bq *BreedQuery) Order(o ...breed.OrderOption) *BreedQuery

Order specifies how the records should be ordered.

func (*BreedQuery) QueryCats

func (bq *BreedQuery) QueryCats() *CatQuery

QueryCats chains the current query on the "cats" edge.

func (*BreedQuery) Select

func (bq *BreedQuery) Select(fields ...string) *BreedSelect

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
}

client.Breed.Query().
	Select(breed.FieldDeletedTime).
	Scan(ctx, &v)

func (*BreedQuery) Unique

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

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

func (bq *BreedQuery) Where(ps ...predicate.Breed) *BreedQuery

Where adds a new predicate for the BreedQuery builder.

func (*BreedQuery) WithCats

func (bq *BreedQuery) WithCats(opts ...func(*CatQuery)) *BreedQuery

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

type BreedSelect

type BreedSelect struct {
	*BreedQuery
	// contains filtered or unexported fields
}

BreedSelect is the builder for selecting fields of Breed entities.

func (*BreedSelect) Aggregate

func (bs *BreedSelect) Aggregate(fns ...AggregateFunc) *BreedSelect

Aggregate adds the given aggregation functions to the selector query.

func (*BreedSelect) Bool

func (s *BreedSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*BreedSelect) BoolX

func (s *BreedSelect) BoolX(ctx context.Context) bool

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

func (*BreedSelect) Bools

func (s *BreedSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*BreedSelect) BoolsX

func (s *BreedSelect) BoolsX(ctx context.Context) []bool

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

func (*BreedSelect) Float64

func (s *BreedSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*BreedSelect) Float64X

func (s *BreedSelect) Float64X(ctx context.Context) float64

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

func (*BreedSelect) Float64s

func (s *BreedSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*BreedSelect) Float64sX

func (s *BreedSelect) Float64sX(ctx context.Context) []float64

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

func (*BreedSelect) Int

func (s *BreedSelect) Int(ctx context.Context) (_ int, err error)

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

func (*BreedSelect) IntX

func (s *BreedSelect) IntX(ctx context.Context) int

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

func (*BreedSelect) Ints

func (s *BreedSelect) Ints(ctx context.Context) ([]int, error)

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

func (*BreedSelect) IntsX

func (s *BreedSelect) IntsX(ctx context.Context) []int

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

func (*BreedSelect) Scan

func (bs *BreedSelect) Scan(ctx context.Context, v any) error

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

func (*BreedSelect) ScanX

func (s *BreedSelect) ScanX(ctx context.Context, v any)

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

func (*BreedSelect) String

func (s *BreedSelect) String(ctx context.Context) (_ string, err error)

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

func (*BreedSelect) StringX

func (s *BreedSelect) StringX(ctx context.Context) string

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

func (*BreedSelect) Strings

func (s *BreedSelect) Strings(ctx context.Context) ([]string, error)

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

func (*BreedSelect) StringsX

func (s *BreedSelect) StringsX(ctx context.Context) []string

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

type BreedUpdate

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

BreedUpdate is the builder for updating Breed entities.

func (*BreedUpdate) AddCatIDs

func (bu *BreedUpdate) AddCatIDs(ids ...uuid.UUID) *BreedUpdate

AddCatIDs adds the "cats" edge to the Cat entity by IDs.

func (*BreedUpdate) AddCats

func (bu *BreedUpdate) AddCats(c ...*Cat) *BreedUpdate

AddCats adds the "cats" edges to the Cat entity.

func (*BreedUpdate) ClearCats

func (bu *BreedUpdate) ClearCats() *BreedUpdate

ClearCats clears all "cats" edges to the Cat entity.

func (*BreedUpdate) ClearDeletedTime

func (bu *BreedUpdate) ClearDeletedTime() *BreedUpdate

ClearDeletedTime clears the value of the "deleted_time" field.

func (*BreedUpdate) Exec

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

Exec executes the query.

func (*BreedUpdate) ExecX

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

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

func (*BreedUpdate) Mutation

func (bu *BreedUpdate) Mutation() *BreedMutation

Mutation returns the BreedMutation object of the builder.

func (*BreedUpdate) RemoveCatIDs

func (bu *BreedUpdate) RemoveCatIDs(ids ...uuid.UUID) *BreedUpdate

RemoveCatIDs removes the "cats" edge to Cat entities by IDs.

func (*BreedUpdate) RemoveCats

func (bu *BreedUpdate) RemoveCats(c ...*Cat) *BreedUpdate

RemoveCats removes "cats" edges to Cat entities.

func (*BreedUpdate) Save

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

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

func (*BreedUpdate) SaveX

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

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

func (*BreedUpdate) SetDeletedTime

func (bu *BreedUpdate) SetDeletedTime(t time.Time) *BreedUpdate

SetDeletedTime sets the "deleted_time" field.

func (*BreedUpdate) SetName

func (bu *BreedUpdate) SetName(s string) *BreedUpdate

SetName sets the "name" field.

func (*BreedUpdate) SetNillableDeletedTime

func (bu *BreedUpdate) SetNillableDeletedTime(t *time.Time) *BreedUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*BreedUpdate) SetNillableName

func (bu *BreedUpdate) SetNillableName(s *string) *BreedUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*BreedUpdate) SetUpdateTime

func (bu *BreedUpdate) SetUpdateTime(t time.Time) *BreedUpdate

SetUpdateTime sets the "update_time" field.

func (*BreedUpdate) Where

func (bu *BreedUpdate) Where(ps ...predicate.Breed) *BreedUpdate

Where appends a list predicates to the BreedUpdate builder.

type BreedUpdateOne

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

BreedUpdateOne is the builder for updating a single Breed entity.

func (*BreedUpdateOne) AddCatIDs

func (buo *BreedUpdateOne) AddCatIDs(ids ...uuid.UUID) *BreedUpdateOne

AddCatIDs adds the "cats" edge to the Cat entity by IDs.

func (*BreedUpdateOne) AddCats

func (buo *BreedUpdateOne) AddCats(c ...*Cat) *BreedUpdateOne

AddCats adds the "cats" edges to the Cat entity.

func (*BreedUpdateOne) ClearCats

func (buo *BreedUpdateOne) ClearCats() *BreedUpdateOne

ClearCats clears all "cats" edges to the Cat entity.

func (*BreedUpdateOne) ClearDeletedTime

func (buo *BreedUpdateOne) ClearDeletedTime() *BreedUpdateOne

ClearDeletedTime clears the value of the "deleted_time" field.

func (*BreedUpdateOne) Exec

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

Exec executes the query on the entity.

func (*BreedUpdateOne) ExecX

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

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

func (*BreedUpdateOne) Mutation

func (buo *BreedUpdateOne) Mutation() *BreedMutation

Mutation returns the BreedMutation object of the builder.

func (*BreedUpdateOne) RemoveCatIDs

func (buo *BreedUpdateOne) RemoveCatIDs(ids ...uuid.UUID) *BreedUpdateOne

RemoveCatIDs removes the "cats" edge to Cat entities by IDs.

func (*BreedUpdateOne) RemoveCats

func (buo *BreedUpdateOne) RemoveCats(c ...*Cat) *BreedUpdateOne

RemoveCats removes "cats" edges to Cat entities.

func (*BreedUpdateOne) Save

func (buo *BreedUpdateOne) Save(ctx context.Context) (*Breed, error)

Save executes the query and returns the updated Breed entity.

func (*BreedUpdateOne) SaveX

func (buo *BreedUpdateOne) SaveX(ctx context.Context) *Breed

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

func (*BreedUpdateOne) Select

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

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

func (*BreedUpdateOne) SetDeletedTime

func (buo *BreedUpdateOne) SetDeletedTime(t time.Time) *BreedUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*BreedUpdateOne) SetName

func (buo *BreedUpdateOne) SetName(s string) *BreedUpdateOne

SetName sets the "name" field.

func (*BreedUpdateOne) SetNillableDeletedTime

func (buo *BreedUpdateOne) SetNillableDeletedTime(t *time.Time) *BreedUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*BreedUpdateOne) SetNillableName

func (buo *BreedUpdateOne) SetNillableName(s *string) *BreedUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*BreedUpdateOne) SetUpdateTime

func (buo *BreedUpdateOne) SetUpdateTime(t time.Time) *BreedUpdateOne

SetUpdateTime sets the "update_time" field.

func (*BreedUpdateOne) Where

func (buo *BreedUpdateOne) Where(ps ...predicate.Breed) *BreedUpdateOne

Where appends a list predicates to the BreedUpdate builder.

type Breeds

type Breeds []*Breed

Breeds is a parsable slice of Breed.

type Cat

type Cat struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// DeletedTime holds the value of the "deleted_time" field.
	DeletedTime *time.Time `json:"deleted_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Идентификатор локации
	BreedID uuid.UUID `json:"breed_id,omitempty"`
	// Speed holds the value of the "speed" field.
	Speed int64 `json:"speed,omitempty"`
	// Дата начала
	DateFrom time.Time `json:"date_from,omitempty"`
	// Тип
	Type cat.Type `json:"type,omitempty"`
	// Другой тип
	OtherType cat.OtherType `json:"other_type,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CatQuery when eager-loading is set.
	Edges CatEdges `json:"edges"`

	// PhantomField defined by template.
	PhantomField string `json:"phantom_field,omitempty"`
	// contains filtered or unexported fields
}

Cat is the model entity for the Cat schema.

func (*Cat) QueryBreed

func (c *Cat) QueryBreed() *BreedQuery

QueryBreed queries the "breed" edge of the Cat entity.

func (*Cat) QueryKittens

func (c *Cat) QueryKittens() *KittenQuery

QueryKittens queries the "kittens" edge of the Cat entity.

func (*Cat) String

func (c *Cat) String() string

String implements the fmt.Stringer.

func (*Cat) Unwrap

func (c *Cat) Unwrap() *Cat

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

func (c *Cat) Update() *CatUpdateOne

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

func (*Cat) Value

func (c *Cat) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Cat. This includes values selected through modifiers, order, etc.

type CatClient

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

CatClient is a client for the Cat schema.

func NewCatClient

func NewCatClient(c config) *CatClient

NewCatClient returns a client for the Cat from the given config.

func (*CatClient) Create

func (c *CatClient) Create() *CatCreate

Create returns a builder for creating a Cat entity.

func (*CatClient) CreateBulk

func (c *CatClient) CreateBulk(builders ...*CatCreate) *CatCreateBulk

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

func (*CatClient) Delete

func (c *CatClient) Delete() *CatDelete

Delete returns a delete builder for Cat.

func (*CatClient) DeleteOne

func (c *CatClient) DeleteOne(ca *Cat) *CatDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CatClient) DeleteOneID

func (c *CatClient) DeleteOneID(id uuid.UUID) *CatDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*CatClient) Get

func (c *CatClient) Get(ctx context.Context, id uuid.UUID) (*Cat, error)

Get returns a Cat entity by its id.

func (*CatClient) GetX

func (c *CatClient) GetX(ctx context.Context, id uuid.UUID) *Cat

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

func (*CatClient) Hooks

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

Hooks returns the client hooks.

func (*CatClient) Intercept

func (c *CatClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `cat.Intercept(f(g(h())))`.

func (*CatClient) Interceptors

func (c *CatClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*CatClient) MapCreateBulk

func (c *CatClient) MapCreateBulk(slice any, setFunc func(*CatCreate, int)) *CatCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*CatClient) Query

func (c *CatClient) Query() *CatQuery

Query returns a query builder for Cat.

func (*CatClient) QueryBreed

func (c *CatClient) QueryBreed(ca *Cat) *BreedQuery

QueryBreed queries the breed edge of a Cat.

func (*CatClient) QueryKittens

func (c *CatClient) QueryKittens(ca *Cat) *KittenQuery

QueryKittens queries the kittens edge of a Cat.

func (*CatClient) Update

func (c *CatClient) Update() *CatUpdate

Update returns an update builder for Cat.

func (*CatClient) UpdateOne

func (c *CatClient) UpdateOne(ca *Cat) *CatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CatClient) UpdateOneID

func (c *CatClient) UpdateOneID(id uuid.UUID) *CatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CatClient) Use

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

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

type CatCreate

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

CatCreate is the builder for creating a Cat entity.

func (*CatCreate) AddKittenIDs

func (cc *CatCreate) AddKittenIDs(ids ...uuid.UUID) *CatCreate

AddKittenIDs adds the "kittens" edge to the Kitten entity by IDs.

func (*CatCreate) AddKittens

func (cc *CatCreate) AddKittens(k ...*Kitten) *CatCreate

AddKittens adds the "kittens" edges to the Kitten entity.

func (*CatCreate) Exec

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

Exec executes the query.

func (*CatCreate) ExecX

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

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

func (*CatCreate) Mutation

func (cc *CatCreate) Mutation() *CatMutation

Mutation returns the CatMutation object of the builder.

func (*CatCreate) Save

func (cc *CatCreate) Save(ctx context.Context) (*Cat, error)

Save creates the Cat in the database.

func (*CatCreate) SaveX

func (cc *CatCreate) SaveX(ctx context.Context) *Cat

SaveX calls Save and panics if Save returns an error.

func (*CatCreate) SetBreed

func (cc *CatCreate) SetBreed(b *Breed) *CatCreate

SetBreed sets the "breed" edge to the Breed entity.

func (*CatCreate) SetBreedID

func (cc *CatCreate) SetBreedID(u uuid.UUID) *CatCreate

SetBreedID sets the "breed_id" field.

func (*CatCreate) SetCreateTime

func (cc *CatCreate) SetCreateTime(t time.Time) *CatCreate

SetCreateTime sets the "create_time" field.

func (*CatCreate) SetDateFrom

func (cc *CatCreate) SetDateFrom(t time.Time) *CatCreate

SetDateFrom sets the "date_from" field.

func (*CatCreate) SetDeletedTime

func (cc *CatCreate) SetDeletedTime(t time.Time) *CatCreate

SetDeletedTime sets the "deleted_time" field.

func (*CatCreate) SetID

func (cc *CatCreate) SetID(u uuid.UUID) *CatCreate

SetID sets the "id" field.

func (*CatCreate) SetName

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

SetName sets the "name" field.

func (*CatCreate) SetNillableCreateTime

func (cc *CatCreate) SetNillableCreateTime(t *time.Time) *CatCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*CatCreate) SetNillableDeletedTime

func (cc *CatCreate) SetNillableDeletedTime(t *time.Time) *CatCreate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*CatCreate) SetNillableID

func (cc *CatCreate) SetNillableID(u *uuid.UUID) *CatCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*CatCreate) SetNillableUpdateTime

func (cc *CatCreate) SetNillableUpdateTime(t *time.Time) *CatCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*CatCreate) SetOtherType

func (cc *CatCreate) SetOtherType(ct cat.OtherType) *CatCreate

SetOtherType sets the "other_type" field.

func (*CatCreate) SetSpeed

func (cc *CatCreate) SetSpeed(i int64) *CatCreate

SetSpeed sets the "speed" field.

func (*CatCreate) SetType

func (cc *CatCreate) SetType(c cat.Type) *CatCreate

SetType sets the "type" field.

func (*CatCreate) SetUpdateTime

func (cc *CatCreate) SetUpdateTime(t time.Time) *CatCreate

SetUpdateTime sets the "update_time" field.

type CatCreateBulk

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

CatCreateBulk is the builder for creating many Cat entities in bulk.

func (*CatCreateBulk) Exec

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

Exec executes the query.

func (*CatCreateBulk) ExecX

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

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

func (*CatCreateBulk) Save

func (ccb *CatCreateBulk) Save(ctx context.Context) ([]*Cat, error)

Save creates the Cat entities in the database.

func (*CatCreateBulk) SaveX

func (ccb *CatCreateBulk) SaveX(ctx context.Context) []*Cat

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

type CatDelete

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

CatDelete is the builder for deleting a Cat entity.

func (*CatDelete) Exec

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

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

func (*CatDelete) ExecX

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

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

func (*CatDelete) Where

func (cd *CatDelete) Where(ps ...predicate.Cat) *CatDelete

Where appends a list predicates to the CatDelete builder.

type CatDeleteOne

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

CatDeleteOne is the builder for deleting a single Cat entity.

func (*CatDeleteOne) Exec

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

Exec executes the deletion query.

func (*CatDeleteOne) ExecX

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

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

func (*CatDeleteOne) Where

func (cdo *CatDeleteOne) Where(ps ...predicate.Cat) *CatDeleteOne

Where appends a list predicates to the CatDelete builder.

type CatEdges

type CatEdges struct {
	// Kittens holds the value of the kittens edge.
	Kittens []*Kitten `json:"kittens,omitempty"`
	// Breed holds the value of the breed edge.
	Breed *Breed `json:"breed,omitempty"`
	// contains filtered or unexported fields
}

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

func (CatEdges) BreedOrErr

func (e CatEdges) BreedOrErr() (*Breed, error)

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

func (CatEdges) KittensOrErr

func (e CatEdges) KittensOrErr() ([]*Kitten, error)

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

type CatGroupBy

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

CatGroupBy is the group-by builder for Cat entities.

func (*CatGroupBy) Aggregate

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

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

func (*CatGroupBy) Bool

func (s *CatGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*CatGroupBy) BoolX

func (s *CatGroupBy) BoolX(ctx context.Context) bool

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

func (*CatGroupBy) Bools

func (s *CatGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*CatGroupBy) BoolsX

func (s *CatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CatGroupBy) Float64

func (s *CatGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*CatGroupBy) Float64X

func (s *CatGroupBy) Float64X(ctx context.Context) float64

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

func (*CatGroupBy) Float64s

func (s *CatGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*CatGroupBy) Float64sX

func (s *CatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CatGroupBy) Int

func (s *CatGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*CatGroupBy) IntX

func (s *CatGroupBy) IntX(ctx context.Context) int

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

func (*CatGroupBy) Ints

func (s *CatGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*CatGroupBy) IntsX

func (s *CatGroupBy) IntsX(ctx context.Context) []int

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

func (*CatGroupBy) Scan

func (cgb *CatGroupBy) Scan(ctx context.Context, v any) error

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

func (*CatGroupBy) ScanX

func (s *CatGroupBy) ScanX(ctx context.Context, v any)

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

func (*CatGroupBy) String

func (s *CatGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*CatGroupBy) StringX

func (s *CatGroupBy) StringX(ctx context.Context) string

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

func (*CatGroupBy) Strings

func (s *CatGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*CatGroupBy) StringsX

func (s *CatGroupBy) StringsX(ctx context.Context) []string

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

type CatMutation

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

CatMutation represents an operation that mutates the Cat nodes in the graph.

func (*CatMutation) AddField

func (m *CatMutation) 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 (*CatMutation) AddKittenIDs

func (m *CatMutation) AddKittenIDs(ids ...uuid.UUID)

AddKittenIDs adds the "kittens" edge to the Kitten entity by ids.

func (*CatMutation) AddSpeed

func (m *CatMutation) AddSpeed(i int64)

AddSpeed adds i to the "speed" field.

func (*CatMutation) AddedEdges

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

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

func (*CatMutation) AddedField

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

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

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

func (*CatMutation) AddedIDs

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

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

func (*CatMutation) AddedSpeed

func (m *CatMutation) AddedSpeed() (r int64, exists bool)

AddedSpeed returns the value that was added to the "speed" field in this mutation.

func (*CatMutation) BreedCleared

func (m *CatMutation) BreedCleared() bool

BreedCleared reports if the "breed" edge to the Breed entity was cleared.

func (*CatMutation) BreedID

func (m *CatMutation) BreedID() (r uuid.UUID, exists bool)

BreedID returns the value of the "breed_id" field in the mutation.

func (*CatMutation) BreedIDs

func (m *CatMutation) BreedIDs() (ids []uuid.UUID)

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

func (*CatMutation) ClearBreed

func (m *CatMutation) ClearBreed()

ClearBreed clears the "breed" edge to the Breed entity.

func (*CatMutation) ClearDeletedTime

func (m *CatMutation) ClearDeletedTime()

ClearDeletedTime clears the value of the "deleted_time" field.

func (*CatMutation) ClearEdge

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

func (m *CatMutation) 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 (*CatMutation) ClearKittens

func (m *CatMutation) ClearKittens()

ClearKittens clears the "kittens" edge to the Kitten entity.

func (*CatMutation) ClearedEdges

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

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

func (*CatMutation) ClearedFields

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

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

func (CatMutation) Client

func (m CatMutation) 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 (*CatMutation) CreateTime

func (m *CatMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*CatMutation) DateFrom

func (m *CatMutation) DateFrom() (r time.Time, exists bool)

DateFrom returns the value of the "date_from" field in the mutation.

func (*CatMutation) DeletedTime

func (m *CatMutation) DeletedTime() (r time.Time, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*CatMutation) DeletedTimeCleared

func (m *CatMutation) DeletedTimeCleared() bool

DeletedTimeCleared returns if the "deleted_time" field was cleared in this mutation.

func (*CatMutation) EdgeCleared

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

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

func (*CatMutation) Field

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

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

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

func (*CatMutation) Fields

func (m *CatMutation) 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 (*CatMutation) GetType

func (m *CatMutation) GetType() (r cat.Type, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*CatMutation) ID

func (m *CatMutation) 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 (*CatMutation) IDs

func (m *CatMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*CatMutation) KittensCleared

func (m *CatMutation) KittensCleared() bool

KittensCleared reports if the "kittens" edge to the Kitten entity was cleared.

func (*CatMutation) KittensIDs

func (m *CatMutation) KittensIDs() (ids []uuid.UUID)

KittensIDs returns the "kittens" edge IDs in the mutation.

func (*CatMutation) Name

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

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

func (*CatMutation) OldBreedID

func (m *CatMutation) OldBreedID(ctx context.Context) (v uuid.UUID, err error)

OldBreedID returns the old "breed_id" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldCreateTime

func (m *CatMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldDateFrom

func (m *CatMutation) OldDateFrom(ctx context.Context) (v time.Time, err error)

OldDateFrom returns the old "date_from" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldDeletedTime

func (m *CatMutation) OldDeletedTime(ctx context.Context) (v *time.Time, err error)

OldDeletedTime returns the old "deleted_time" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldField

func (m *CatMutation) 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 (*CatMutation) OldName

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

OldName returns the old "name" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldOtherType

func (m *CatMutation) OldOtherType(ctx context.Context) (v cat.OtherType, err error)

OldOtherType returns the old "other_type" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldSpeed

func (m *CatMutation) OldSpeed(ctx context.Context) (v int64, err error)

OldSpeed returns the old "speed" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldType

func (m *CatMutation) OldType(ctx context.Context) (v cat.Type, err error)

OldType returns the old "type" field's value of the Cat entity. If the Cat 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 (*CatMutation) OldUpdateTime

func (m *CatMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Cat entity. If the Cat 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 (*CatMutation) Op

func (m *CatMutation) Op() Op

Op returns the operation name.

func (*CatMutation) OtherType

func (m *CatMutation) OtherType() (r cat.OtherType, exists bool)

OtherType returns the value of the "other_type" field in the mutation.

func (*CatMutation) RemoveKittenIDs

func (m *CatMutation) RemoveKittenIDs(ids ...uuid.UUID)

RemoveKittenIDs removes the "kittens" edge to the Kitten entity by IDs.

func (*CatMutation) RemovedEdges

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

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

func (*CatMutation) RemovedIDs

func (m *CatMutation) 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 (*CatMutation) RemovedKittensIDs

func (m *CatMutation) RemovedKittensIDs() (ids []uuid.UUID)

RemovedKittens returns the removed IDs of the "kittens" edge to the Kitten entity.

func (*CatMutation) ResetBreed

func (m *CatMutation) ResetBreed()

ResetBreed resets all changes to the "breed" edge.

func (*CatMutation) ResetBreedID

func (m *CatMutation) ResetBreedID()

ResetBreedID resets all changes to the "breed_id" field.

func (*CatMutation) ResetCreateTime

func (m *CatMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*CatMutation) ResetDateFrom

func (m *CatMutation) ResetDateFrom()

ResetDateFrom resets all changes to the "date_from" field.

func (*CatMutation) ResetDeletedTime

func (m *CatMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*CatMutation) ResetEdge

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

func (m *CatMutation) 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 (*CatMutation) ResetKittens

func (m *CatMutation) ResetKittens()

ResetKittens resets all changes to the "kittens" edge.

func (*CatMutation) ResetName

func (m *CatMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CatMutation) ResetOtherType

func (m *CatMutation) ResetOtherType()

ResetOtherType resets all changes to the "other_type" field.

func (*CatMutation) ResetSpeed

func (m *CatMutation) ResetSpeed()

ResetSpeed resets all changes to the "speed" field.

func (*CatMutation) ResetType

func (m *CatMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*CatMutation) ResetUpdateTime

func (m *CatMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*CatMutation) SetBreedID

func (m *CatMutation) SetBreedID(u uuid.UUID)

SetBreedID sets the "breed_id" field.

func (*CatMutation) SetCreateTime

func (m *CatMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*CatMutation) SetDateFrom

func (m *CatMutation) SetDateFrom(t time.Time)

SetDateFrom sets the "date_from" field.

func (*CatMutation) SetDeletedTime

func (m *CatMutation) SetDeletedTime(t time.Time)

SetDeletedTime sets the "deleted_time" field.

func (*CatMutation) SetField

func (m *CatMutation) 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 (*CatMutation) SetID

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

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

func (*CatMutation) SetName

func (m *CatMutation) SetName(s string)

SetName sets the "name" field.

func (*CatMutation) SetOp

func (m *CatMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CatMutation) SetOtherType

func (m *CatMutation) SetOtherType(ct cat.OtherType)

SetOtherType sets the "other_type" field.

func (*CatMutation) SetSpeed

func (m *CatMutation) SetSpeed(i int64)

SetSpeed sets the "speed" field.

func (*CatMutation) SetType

func (m *CatMutation) SetType(c cat.Type)

SetType sets the "type" field.

func (*CatMutation) SetUpdateTime

func (m *CatMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*CatMutation) Speed

func (m *CatMutation) Speed() (r int64, exists bool)

Speed returns the value of the "speed" field in the mutation.

func (CatMutation) Tx

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

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

func (*CatMutation) Type

func (m *CatMutation) Type() string

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

func (*CatMutation) UpdateTime

func (m *CatMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*CatMutation) Where

func (m *CatMutation) Where(ps ...predicate.Cat)

Where appends a list predicates to the CatMutation builder.

func (*CatMutation) WhereP

func (m *CatMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the CatMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type CatQuery

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

CatQuery is the builder for querying Cat entities.

func (*CatQuery) Aggregate

func (cq *CatQuery) Aggregate(fns ...AggregateFunc) *CatSelect

Aggregate returns a CatSelect configured with the given aggregations.

func (*CatQuery) All

func (cq *CatQuery) All(ctx context.Context) ([]*Cat, error)

All executes the query and returns a list of Cats.

func (*CatQuery) AllX

func (cq *CatQuery) AllX(ctx context.Context) []*Cat

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

func (*CatQuery) Clone

func (cq *CatQuery) Clone() *CatQuery

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

func (*CatQuery) Count

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

Count returns the count of the given query.

func (*CatQuery) CountX

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

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

func (*CatQuery) Exist

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

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

func (*CatQuery) ExistX

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

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

func (*CatQuery) First

func (cq *CatQuery) First(ctx context.Context) (*Cat, error)

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

func (*CatQuery) FirstID

func (cq *CatQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*CatQuery) FirstIDX

func (cq *CatQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*CatQuery) FirstX

func (cq *CatQuery) FirstX(ctx context.Context) *Cat

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

func (*CatQuery) GroupBy

func (cq *CatQuery) GroupBy(field string, fields ...string) *CatGroupBy

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Cat.Query().
	GroupBy(cat.FieldDeletedTime).
	Aggregate(gen.Count()).
	Scan(ctx, &v)

func (*CatQuery) IDs

func (cq *CatQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*CatQuery) IDsX

func (cq *CatQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*CatQuery) Limit

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

Limit the number of records to be returned by this query.

func (*CatQuery) Offset

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

Offset to start from.

func (*CatQuery) Only

func (cq *CatQuery) Only(ctx context.Context) (*Cat, error)

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

func (*CatQuery) OnlyID

func (cq *CatQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*CatQuery) OnlyIDX

func (cq *CatQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*CatQuery) OnlyX

func (cq *CatQuery) OnlyX(ctx context.Context) *Cat

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

func (*CatQuery) Order

func (cq *CatQuery) Order(o ...cat.OrderOption) *CatQuery

Order specifies how the records should be ordered.

func (*CatQuery) QueryBreed

func (cq *CatQuery) QueryBreed() *BreedQuery

QueryBreed chains the current query on the "breed" edge.

func (*CatQuery) QueryKittens

func (cq *CatQuery) QueryKittens() *KittenQuery

QueryKittens chains the current query on the "kittens" edge.

func (*CatQuery) Select

func (cq *CatQuery) Select(fields ...string) *CatSelect

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
}

client.Cat.Query().
	Select(cat.FieldDeletedTime).
	Scan(ctx, &v)

func (*CatQuery) Unique

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

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

func (cq *CatQuery) Where(ps ...predicate.Cat) *CatQuery

Where adds a new predicate for the CatQuery builder.

func (*CatQuery) WithBreed

func (cq *CatQuery) WithBreed(opts ...func(*BreedQuery)) *CatQuery

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

func (*CatQuery) WithKittens

func (cq *CatQuery) WithKittens(opts ...func(*KittenQuery)) *CatQuery

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

type CatSelect

type CatSelect struct {
	*CatQuery
	// contains filtered or unexported fields
}

CatSelect is the builder for selecting fields of Cat entities.

func (*CatSelect) Aggregate

func (cs *CatSelect) Aggregate(fns ...AggregateFunc) *CatSelect

Aggregate adds the given aggregation functions to the selector query.

func (*CatSelect) Bool

func (s *CatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CatSelect) BoolX

func (s *CatSelect) BoolX(ctx context.Context) bool

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

func (*CatSelect) Bools

func (s *CatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CatSelect) BoolsX

func (s *CatSelect) BoolsX(ctx context.Context) []bool

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

func (*CatSelect) Float64

func (s *CatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CatSelect) Float64X

func (s *CatSelect) Float64X(ctx context.Context) float64

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

func (*CatSelect) Float64s

func (s *CatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CatSelect) Float64sX

func (s *CatSelect) Float64sX(ctx context.Context) []float64

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

func (*CatSelect) Int

func (s *CatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CatSelect) IntX

func (s *CatSelect) IntX(ctx context.Context) int

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

func (*CatSelect) Ints

func (s *CatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CatSelect) IntsX

func (s *CatSelect) IntsX(ctx context.Context) []int

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

func (*CatSelect) Scan

func (cs *CatSelect) Scan(ctx context.Context, v any) error

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

func (*CatSelect) ScanX

func (s *CatSelect) ScanX(ctx context.Context, v any)

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

func (*CatSelect) String

func (s *CatSelect) String(ctx context.Context) (_ string, err error)

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

func (*CatSelect) StringX

func (s *CatSelect) StringX(ctx context.Context) string

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

func (*CatSelect) Strings

func (s *CatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CatSelect) StringsX

func (s *CatSelect) StringsX(ctx context.Context) []string

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

type CatUpdate

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

CatUpdate is the builder for updating Cat entities.

func (*CatUpdate) AddKittenIDs

func (cu *CatUpdate) AddKittenIDs(ids ...uuid.UUID) *CatUpdate

AddKittenIDs adds the "kittens" edge to the Kitten entity by IDs.

func (*CatUpdate) AddKittens

func (cu *CatUpdate) AddKittens(k ...*Kitten) *CatUpdate

AddKittens adds the "kittens" edges to the Kitten entity.

func (*CatUpdate) AddSpeed

func (cu *CatUpdate) AddSpeed(i int64) *CatUpdate

AddSpeed adds i to the "speed" field.

func (*CatUpdate) ClearBreed

func (cu *CatUpdate) ClearBreed() *CatUpdate

ClearBreed clears the "breed" edge to the Breed entity.

func (*CatUpdate) ClearDeletedTime

func (cu *CatUpdate) ClearDeletedTime() *CatUpdate

ClearDeletedTime clears the value of the "deleted_time" field.

func (*CatUpdate) ClearKittens

func (cu *CatUpdate) ClearKittens() *CatUpdate

ClearKittens clears all "kittens" edges to the Kitten entity.

func (*CatUpdate) Exec

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

Exec executes the query.

func (*CatUpdate) ExecX

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

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

func (*CatUpdate) Mutation

func (cu *CatUpdate) Mutation() *CatMutation

Mutation returns the CatMutation object of the builder.

func (*CatUpdate) RemoveKittenIDs

func (cu *CatUpdate) RemoveKittenIDs(ids ...uuid.UUID) *CatUpdate

RemoveKittenIDs removes the "kittens" edge to Kitten entities by IDs.

func (*CatUpdate) RemoveKittens

func (cu *CatUpdate) RemoveKittens(k ...*Kitten) *CatUpdate

RemoveKittens removes "kittens" edges to Kitten entities.

func (*CatUpdate) Save

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

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

func (*CatUpdate) SaveX

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

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

func (*CatUpdate) SetBreed

func (cu *CatUpdate) SetBreed(b *Breed) *CatUpdate

SetBreed sets the "breed" edge to the Breed entity.

func (*CatUpdate) SetBreedID

func (cu *CatUpdate) SetBreedID(u uuid.UUID) *CatUpdate

SetBreedID sets the "breed_id" field.

func (*CatUpdate) SetDateFrom

func (cu *CatUpdate) SetDateFrom(t time.Time) *CatUpdate

SetDateFrom sets the "date_from" field.

func (*CatUpdate) SetDeletedTime

func (cu *CatUpdate) SetDeletedTime(t time.Time) *CatUpdate

SetDeletedTime sets the "deleted_time" field.

func (*CatUpdate) SetName

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

SetName sets the "name" field.

func (*CatUpdate) SetNillableBreedID

func (cu *CatUpdate) SetNillableBreedID(u *uuid.UUID) *CatUpdate

SetNillableBreedID sets the "breed_id" field if the given value is not nil.

func (*CatUpdate) SetNillableDateFrom

func (cu *CatUpdate) SetNillableDateFrom(t *time.Time) *CatUpdate

SetNillableDateFrom sets the "date_from" field if the given value is not nil.

func (*CatUpdate) SetNillableDeletedTime

func (cu *CatUpdate) SetNillableDeletedTime(t *time.Time) *CatUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*CatUpdate) SetNillableName

func (cu *CatUpdate) SetNillableName(s *string) *CatUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*CatUpdate) SetNillableOtherType

func (cu *CatUpdate) SetNillableOtherType(ct *cat.OtherType) *CatUpdate

SetNillableOtherType sets the "other_type" field if the given value is not nil.

func (*CatUpdate) SetNillableSpeed

func (cu *CatUpdate) SetNillableSpeed(i *int64) *CatUpdate

SetNillableSpeed sets the "speed" field if the given value is not nil.

func (*CatUpdate) SetNillableType

func (cu *CatUpdate) SetNillableType(c *cat.Type) *CatUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*CatUpdate) SetOtherType

func (cu *CatUpdate) SetOtherType(ct cat.OtherType) *CatUpdate

SetOtherType sets the "other_type" field.

func (*CatUpdate) SetSpeed

func (cu *CatUpdate) SetSpeed(i int64) *CatUpdate

SetSpeed sets the "speed" field.

func (*CatUpdate) SetType

func (cu *CatUpdate) SetType(c cat.Type) *CatUpdate

SetType sets the "type" field.

func (*CatUpdate) SetUpdateTime

func (cu *CatUpdate) SetUpdateTime(t time.Time) *CatUpdate

SetUpdateTime sets the "update_time" field.

func (*CatUpdate) Where

func (cu *CatUpdate) Where(ps ...predicate.Cat) *CatUpdate

Where appends a list predicates to the CatUpdate builder.

type CatUpdateOne

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

CatUpdateOne is the builder for updating a single Cat entity.

func (*CatUpdateOne) AddKittenIDs

func (cuo *CatUpdateOne) AddKittenIDs(ids ...uuid.UUID) *CatUpdateOne

AddKittenIDs adds the "kittens" edge to the Kitten entity by IDs.

func (*CatUpdateOne) AddKittens

func (cuo *CatUpdateOne) AddKittens(k ...*Kitten) *CatUpdateOne

AddKittens adds the "kittens" edges to the Kitten entity.

func (*CatUpdateOne) AddSpeed

func (cuo *CatUpdateOne) AddSpeed(i int64) *CatUpdateOne

AddSpeed adds i to the "speed" field.

func (*CatUpdateOne) ClearBreed

func (cuo *CatUpdateOne) ClearBreed() *CatUpdateOne

ClearBreed clears the "breed" edge to the Breed entity.

func (*CatUpdateOne) ClearDeletedTime

func (cuo *CatUpdateOne) ClearDeletedTime() *CatUpdateOne

ClearDeletedTime clears the value of the "deleted_time" field.

func (*CatUpdateOne) ClearKittens

func (cuo *CatUpdateOne) ClearKittens() *CatUpdateOne

ClearKittens clears all "kittens" edges to the Kitten entity.

func (*CatUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CatUpdateOne) ExecX

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

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

func (*CatUpdateOne) Mutation

func (cuo *CatUpdateOne) Mutation() *CatMutation

Mutation returns the CatMutation object of the builder.

func (*CatUpdateOne) RemoveKittenIDs

func (cuo *CatUpdateOne) RemoveKittenIDs(ids ...uuid.UUID) *CatUpdateOne

RemoveKittenIDs removes the "kittens" edge to Kitten entities by IDs.

func (*CatUpdateOne) RemoveKittens

func (cuo *CatUpdateOne) RemoveKittens(k ...*Kitten) *CatUpdateOne

RemoveKittens removes "kittens" edges to Kitten entities.

func (*CatUpdateOne) Save

func (cuo *CatUpdateOne) Save(ctx context.Context) (*Cat, error)

Save executes the query and returns the updated Cat entity.

func (*CatUpdateOne) SaveX

func (cuo *CatUpdateOne) SaveX(ctx context.Context) *Cat

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

func (*CatUpdateOne) Select

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

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

func (*CatUpdateOne) SetBreed

func (cuo *CatUpdateOne) SetBreed(b *Breed) *CatUpdateOne

SetBreed sets the "breed" edge to the Breed entity.

func (*CatUpdateOne) SetBreedID

func (cuo *CatUpdateOne) SetBreedID(u uuid.UUID) *CatUpdateOne

SetBreedID sets the "breed_id" field.

func (*CatUpdateOne) SetDateFrom

func (cuo *CatUpdateOne) SetDateFrom(t time.Time) *CatUpdateOne

SetDateFrom sets the "date_from" field.

func (*CatUpdateOne) SetDeletedTime

func (cuo *CatUpdateOne) SetDeletedTime(t time.Time) *CatUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*CatUpdateOne) SetName

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

SetName sets the "name" field.

func (*CatUpdateOne) SetNillableBreedID

func (cuo *CatUpdateOne) SetNillableBreedID(u *uuid.UUID) *CatUpdateOne

SetNillableBreedID sets the "breed_id" field if the given value is not nil.

func (*CatUpdateOne) SetNillableDateFrom

func (cuo *CatUpdateOne) SetNillableDateFrom(t *time.Time) *CatUpdateOne

SetNillableDateFrom sets the "date_from" field if the given value is not nil.

func (*CatUpdateOne) SetNillableDeletedTime

func (cuo *CatUpdateOne) SetNillableDeletedTime(t *time.Time) *CatUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*CatUpdateOne) SetNillableName

func (cuo *CatUpdateOne) SetNillableName(s *string) *CatUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*CatUpdateOne) SetNillableOtherType

func (cuo *CatUpdateOne) SetNillableOtherType(ct *cat.OtherType) *CatUpdateOne

SetNillableOtherType sets the "other_type" field if the given value is not nil.

func (*CatUpdateOne) SetNillableSpeed

func (cuo *CatUpdateOne) SetNillableSpeed(i *int64) *CatUpdateOne

SetNillableSpeed sets the "speed" field if the given value is not nil.

func (*CatUpdateOne) SetNillableType

func (cuo *CatUpdateOne) SetNillableType(c *cat.Type) *CatUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*CatUpdateOne) SetOtherType

func (cuo *CatUpdateOne) SetOtherType(ct cat.OtherType) *CatUpdateOne

SetOtherType sets the "other_type" field.

func (*CatUpdateOne) SetSpeed

func (cuo *CatUpdateOne) SetSpeed(i int64) *CatUpdateOne

SetSpeed sets the "speed" field.

func (*CatUpdateOne) SetType

func (cuo *CatUpdateOne) SetType(c cat.Type) *CatUpdateOne

SetType sets the "type" field.

func (*CatUpdateOne) SetUpdateTime

func (cuo *CatUpdateOne) SetUpdateTime(t time.Time) *CatUpdateOne

SetUpdateTime sets the "update_time" field.

func (*CatUpdateOne) Where

func (cuo *CatUpdateOne) Where(ps ...predicate.Cat) *CatUpdateOne

Where appends a list predicates to the CatUpdate builder.

type Cats

type Cats []*Cat

Cats is a parsable slice of Cat.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Breed is the client for interacting with the Breed builders.
	Breed *BreedClient
	// Cat is the client for interacting with the Cat builders.
	Cat *CatClient
	// FatherCat is the client for interacting with the FatherCat builders.
	FatherCat *FatherCatClient
	// Kitten is the client for interacting with the Kitten builders.
	Kitten *KittenClient
	// 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().
	Breed.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

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

Committer is the interface that wraps the Commit 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 FatherCat

type FatherCat struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// DeletedTime holds the value of the "deleted_time" field.
	DeletedTime *time.Time `json:"deleted_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// contains filtered or unexported fields
}

FatherCat is the model entity for the FatherCat schema.

func (*FatherCat) String

func (fc *FatherCat) String() string

String implements the fmt.Stringer.

func (*FatherCat) Unwrap

func (fc *FatherCat) Unwrap() *FatherCat

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

func (fc *FatherCat) Update() *FatherCatUpdateOne

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

func (*FatherCat) Value

func (fc *FatherCat) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the FatherCat. This includes values selected through modifiers, order, etc.

type FatherCatClient

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

FatherCatClient is a client for the FatherCat schema.

func NewFatherCatClient

func NewFatherCatClient(c config) *FatherCatClient

NewFatherCatClient returns a client for the FatherCat from the given config.

func (*FatherCatClient) Create

func (c *FatherCatClient) Create() *FatherCatCreate

Create returns a builder for creating a FatherCat entity.

func (*FatherCatClient) CreateBulk

func (c *FatherCatClient) CreateBulk(builders ...*FatherCatCreate) *FatherCatCreateBulk

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

func (*FatherCatClient) Delete

func (c *FatherCatClient) Delete() *FatherCatDelete

Delete returns a delete builder for FatherCat.

func (*FatherCatClient) DeleteOne

func (c *FatherCatClient) DeleteOne(fc *FatherCat) *FatherCatDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FatherCatClient) DeleteOneID

func (c *FatherCatClient) DeleteOneID(id uuid.UUID) *FatherCatDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*FatherCatClient) Get

func (c *FatherCatClient) Get(ctx context.Context, id uuid.UUID) (*FatherCat, error)

Get returns a FatherCat entity by its id.

func (*FatherCatClient) GetX

func (c *FatherCatClient) GetX(ctx context.Context, id uuid.UUID) *FatherCat

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

func (*FatherCatClient) Hooks

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

Hooks returns the client hooks.

func (*FatherCatClient) Intercept

func (c *FatherCatClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `fathercat.Intercept(f(g(h())))`.

func (*FatherCatClient) Interceptors

func (c *FatherCatClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*FatherCatClient) MapCreateBulk

func (c *FatherCatClient) MapCreateBulk(slice any, setFunc func(*FatherCatCreate, int)) *FatherCatCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*FatherCatClient) Query

func (c *FatherCatClient) Query() *FatherCatQuery

Query returns a query builder for FatherCat.

func (*FatherCatClient) Update

func (c *FatherCatClient) Update() *FatherCatUpdate

Update returns an update builder for FatherCat.

func (*FatherCatClient) UpdateOne

func (c *FatherCatClient) UpdateOne(fc *FatherCat) *FatherCatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FatherCatClient) UpdateOneID

func (c *FatherCatClient) UpdateOneID(id uuid.UUID) *FatherCatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FatherCatClient) Use

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

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

type FatherCatCreate

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

FatherCatCreate is the builder for creating a FatherCat entity.

func (*FatherCatCreate) Exec

func (fcc *FatherCatCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FatherCatCreate) ExecX

func (fcc *FatherCatCreate) ExecX(ctx context.Context)

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

func (*FatherCatCreate) Mutation

func (fcc *FatherCatCreate) Mutation() *FatherCatMutation

Mutation returns the FatherCatMutation object of the builder.

func (*FatherCatCreate) Save

func (fcc *FatherCatCreate) Save(ctx context.Context) (*FatherCat, error)

Save creates the FatherCat in the database.

func (*FatherCatCreate) SaveX

func (fcc *FatherCatCreate) SaveX(ctx context.Context) *FatherCat

SaveX calls Save and panics if Save returns an error.

func (*FatherCatCreate) SetCreateTime

func (fcc *FatherCatCreate) SetCreateTime(t time.Time) *FatherCatCreate

SetCreateTime sets the "create_time" field.

func (*FatherCatCreate) SetDeletedTime

func (fcc *FatherCatCreate) SetDeletedTime(t time.Time) *FatherCatCreate

SetDeletedTime sets the "deleted_time" field.

func (*FatherCatCreate) SetID

func (fcc *FatherCatCreate) SetID(u uuid.UUID) *FatherCatCreate

SetID sets the "id" field.

func (*FatherCatCreate) SetName

func (fcc *FatherCatCreate) SetName(s string) *FatherCatCreate

SetName sets the "name" field.

func (*FatherCatCreate) SetNillableCreateTime

func (fcc *FatherCatCreate) SetNillableCreateTime(t *time.Time) *FatherCatCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*FatherCatCreate) SetNillableDeletedTime

func (fcc *FatherCatCreate) SetNillableDeletedTime(t *time.Time) *FatherCatCreate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*FatherCatCreate) SetNillableID

func (fcc *FatherCatCreate) SetNillableID(u *uuid.UUID) *FatherCatCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*FatherCatCreate) SetNillableUpdateTime

func (fcc *FatherCatCreate) SetNillableUpdateTime(t *time.Time) *FatherCatCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*FatherCatCreate) SetUpdateTime

func (fcc *FatherCatCreate) SetUpdateTime(t time.Time) *FatherCatCreate

SetUpdateTime sets the "update_time" field.

type FatherCatCreateBulk

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

FatherCatCreateBulk is the builder for creating many FatherCat entities in bulk.

func (*FatherCatCreateBulk) Exec

func (fccb *FatherCatCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FatherCatCreateBulk) ExecX

func (fccb *FatherCatCreateBulk) ExecX(ctx context.Context)

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

func (*FatherCatCreateBulk) Save

func (fccb *FatherCatCreateBulk) Save(ctx context.Context) ([]*FatherCat, error)

Save creates the FatherCat entities in the database.

func (*FatherCatCreateBulk) SaveX

func (fccb *FatherCatCreateBulk) SaveX(ctx context.Context) []*FatherCat

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

type FatherCatDelete

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

FatherCatDelete is the builder for deleting a FatherCat entity.

func (*FatherCatDelete) Exec

func (fcd *FatherCatDelete) Exec(ctx context.Context) (int, error)

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

func (*FatherCatDelete) ExecX

func (fcd *FatherCatDelete) ExecX(ctx context.Context) int

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

func (*FatherCatDelete) Where

Where appends a list predicates to the FatherCatDelete builder.

type FatherCatDeleteOne

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

FatherCatDeleteOne is the builder for deleting a single FatherCat entity.

func (*FatherCatDeleteOne) Exec

func (fcdo *FatherCatDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FatherCatDeleteOne) ExecX

func (fcdo *FatherCatDeleteOne) ExecX(ctx context.Context)

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

func (*FatherCatDeleteOne) Where

Where appends a list predicates to the FatherCatDelete builder.

type FatherCatGroupBy

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

FatherCatGroupBy is the group-by builder for FatherCat entities.

func (*FatherCatGroupBy) Aggregate

func (fcgb *FatherCatGroupBy) Aggregate(fns ...AggregateFunc) *FatherCatGroupBy

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

func (*FatherCatGroupBy) Bool

func (s *FatherCatGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*FatherCatGroupBy) BoolX

func (s *FatherCatGroupBy) BoolX(ctx context.Context) bool

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

func (*FatherCatGroupBy) Bools

func (s *FatherCatGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*FatherCatGroupBy) BoolsX

func (s *FatherCatGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FatherCatGroupBy) Float64

func (s *FatherCatGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*FatherCatGroupBy) Float64X

func (s *FatherCatGroupBy) Float64X(ctx context.Context) float64

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

func (*FatherCatGroupBy) Float64s

func (s *FatherCatGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*FatherCatGroupBy) Float64sX

func (s *FatherCatGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FatherCatGroupBy) Int

func (s *FatherCatGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*FatherCatGroupBy) IntX

func (s *FatherCatGroupBy) IntX(ctx context.Context) int

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

func (*FatherCatGroupBy) Ints

func (s *FatherCatGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*FatherCatGroupBy) IntsX

func (s *FatherCatGroupBy) IntsX(ctx context.Context) []int

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

func (*FatherCatGroupBy) Scan

func (fcgb *FatherCatGroupBy) Scan(ctx context.Context, v any) error

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

func (*FatherCatGroupBy) ScanX

func (s *FatherCatGroupBy) ScanX(ctx context.Context, v any)

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

func (*FatherCatGroupBy) String

func (s *FatherCatGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*FatherCatGroupBy) StringX

func (s *FatherCatGroupBy) StringX(ctx context.Context) string

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

func (*FatherCatGroupBy) Strings

func (s *FatherCatGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*FatherCatGroupBy) StringsX

func (s *FatherCatGroupBy) StringsX(ctx context.Context) []string

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

type FatherCatMutation

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

FatherCatMutation represents an operation that mutates the FatherCat nodes in the graph.

func (*FatherCatMutation) AddField

func (m *FatherCatMutation) 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 (*FatherCatMutation) AddedEdges

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

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

func (*FatherCatMutation) AddedField

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

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

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

func (*FatherCatMutation) AddedIDs

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

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

func (*FatherCatMutation) ClearDeletedTime

func (m *FatherCatMutation) ClearDeletedTime()

ClearDeletedTime clears the value of the "deleted_time" field.

func (*FatherCatMutation) ClearEdge

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

func (m *FatherCatMutation) 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 (*FatherCatMutation) ClearedEdges

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

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

func (*FatherCatMutation) ClearedFields

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

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

func (FatherCatMutation) Client

func (m FatherCatMutation) 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 (*FatherCatMutation) CreateTime

func (m *FatherCatMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*FatherCatMutation) DeletedTime

func (m *FatherCatMutation) DeletedTime() (r time.Time, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*FatherCatMutation) DeletedTimeCleared

func (m *FatherCatMutation) DeletedTimeCleared() bool

DeletedTimeCleared returns if the "deleted_time" field was cleared in this mutation.

func (*FatherCatMutation) EdgeCleared

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

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

func (*FatherCatMutation) Field

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

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

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

func (*FatherCatMutation) Fields

func (m *FatherCatMutation) 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 (*FatherCatMutation) ID

func (m *FatherCatMutation) 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 (*FatherCatMutation) IDs

func (m *FatherCatMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*FatherCatMutation) Name

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

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

func (*FatherCatMutation) OldCreateTime

func (m *FatherCatMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the FatherCat entity. If the FatherCat 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 (*FatherCatMutation) OldDeletedTime

func (m *FatherCatMutation) OldDeletedTime(ctx context.Context) (v *time.Time, err error)

OldDeletedTime returns the old "deleted_time" field's value of the FatherCat entity. If the FatherCat 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 (*FatherCatMutation) OldField

func (m *FatherCatMutation) 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 (*FatherCatMutation) OldName

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

OldName returns the old "name" field's value of the FatherCat entity. If the FatherCat 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 (*FatherCatMutation) OldUpdateTime

func (m *FatherCatMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the FatherCat entity. If the FatherCat 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 (*FatherCatMutation) Op

func (m *FatherCatMutation) Op() Op

Op returns the operation name.

func (*FatherCatMutation) RemovedEdges

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

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

func (*FatherCatMutation) RemovedIDs

func (m *FatherCatMutation) 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 (*FatherCatMutation) ResetCreateTime

func (m *FatherCatMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*FatherCatMutation) ResetDeletedTime

func (m *FatherCatMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*FatherCatMutation) ResetEdge

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

func (m *FatherCatMutation) 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 (*FatherCatMutation) ResetName

func (m *FatherCatMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*FatherCatMutation) ResetUpdateTime

func (m *FatherCatMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*FatherCatMutation) SetCreateTime

func (m *FatherCatMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*FatherCatMutation) SetDeletedTime

func (m *FatherCatMutation) SetDeletedTime(t time.Time)

SetDeletedTime sets the "deleted_time" field.

func (*FatherCatMutation) SetField

func (m *FatherCatMutation) 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 (*FatherCatMutation) SetID

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

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

func (*FatherCatMutation) SetName

func (m *FatherCatMutation) SetName(s string)

SetName sets the "name" field.

func (*FatherCatMutation) SetOp

func (m *FatherCatMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FatherCatMutation) SetUpdateTime

func (m *FatherCatMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (FatherCatMutation) Tx

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

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

func (*FatherCatMutation) Type

func (m *FatherCatMutation) Type() string

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

func (*FatherCatMutation) UpdateTime

func (m *FatherCatMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*FatherCatMutation) Where

func (m *FatherCatMutation) Where(ps ...predicate.FatherCat)

Where appends a list predicates to the FatherCatMutation builder.

func (*FatherCatMutation) WhereP

func (m *FatherCatMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the FatherCatMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type FatherCatQuery

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

FatherCatQuery is the builder for querying FatherCat entities.

func (*FatherCatQuery) Aggregate

func (fcq *FatherCatQuery) Aggregate(fns ...AggregateFunc) *FatherCatSelect

Aggregate returns a FatherCatSelect configured with the given aggregations.

func (*FatherCatQuery) All

func (fcq *FatherCatQuery) All(ctx context.Context) ([]*FatherCat, error)

All executes the query and returns a list of FatherCats.

func (*FatherCatQuery) AllX

func (fcq *FatherCatQuery) AllX(ctx context.Context) []*FatherCat

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

func (*FatherCatQuery) Clone

func (fcq *FatherCatQuery) Clone() *FatherCatQuery

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

func (*FatherCatQuery) Count

func (fcq *FatherCatQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FatherCatQuery) CountX

func (fcq *FatherCatQuery) CountX(ctx context.Context) int

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

func (*FatherCatQuery) Exist

func (fcq *FatherCatQuery) Exist(ctx context.Context) (bool, error)

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

func (*FatherCatQuery) ExistX

func (fcq *FatherCatQuery) ExistX(ctx context.Context) bool

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

func (*FatherCatQuery) First

func (fcq *FatherCatQuery) First(ctx context.Context) (*FatherCat, error)

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

func (*FatherCatQuery) FirstID

func (fcq *FatherCatQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*FatherCatQuery) FirstIDX

func (fcq *FatherCatQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*FatherCatQuery) FirstX

func (fcq *FatherCatQuery) FirstX(ctx context.Context) *FatherCat

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

func (*FatherCatQuery) GroupBy

func (fcq *FatherCatQuery) GroupBy(field string, fields ...string) *FatherCatGroupBy

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.FatherCat.Query().
	GroupBy(fathercat.FieldDeletedTime).
	Aggregate(gen.Count()).
	Scan(ctx, &v)

func (*FatherCatQuery) IDs

func (fcq *FatherCatQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*FatherCatQuery) IDsX

func (fcq *FatherCatQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*FatherCatQuery) Limit

func (fcq *FatherCatQuery) Limit(limit int) *FatherCatQuery

Limit the number of records to be returned by this query.

func (*FatherCatQuery) Offset

func (fcq *FatherCatQuery) Offset(offset int) *FatherCatQuery

Offset to start from.

func (*FatherCatQuery) Only

func (fcq *FatherCatQuery) Only(ctx context.Context) (*FatherCat, error)

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

func (*FatherCatQuery) OnlyID

func (fcq *FatherCatQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*FatherCatQuery) OnlyIDX

func (fcq *FatherCatQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*FatherCatQuery) OnlyX

func (fcq *FatherCatQuery) OnlyX(ctx context.Context) *FatherCat

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

func (*FatherCatQuery) Order

Order specifies how the records should be ordered.

func (*FatherCatQuery) Select

func (fcq *FatherCatQuery) Select(fields ...string) *FatherCatSelect

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
}

client.FatherCat.Query().
	Select(fathercat.FieldDeletedTime).
	Scan(ctx, &v)

func (*FatherCatQuery) Unique

func (fcq *FatherCatQuery) Unique(unique bool) *FatherCatQuery

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

func (fcq *FatherCatQuery) Where(ps ...predicate.FatherCat) *FatherCatQuery

Where adds a new predicate for the FatherCatQuery builder.

type FatherCatSelect

type FatherCatSelect struct {
	*FatherCatQuery
	// contains filtered or unexported fields
}

FatherCatSelect is the builder for selecting fields of FatherCat entities.

func (*FatherCatSelect) Aggregate

func (fcs *FatherCatSelect) Aggregate(fns ...AggregateFunc) *FatherCatSelect

Aggregate adds the given aggregation functions to the selector query.

func (*FatherCatSelect) Bool

func (s *FatherCatSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*FatherCatSelect) BoolX

func (s *FatherCatSelect) BoolX(ctx context.Context) bool

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

func (*FatherCatSelect) Bools

func (s *FatherCatSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FatherCatSelect) BoolsX

func (s *FatherCatSelect) BoolsX(ctx context.Context) []bool

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

func (*FatherCatSelect) Float64

func (s *FatherCatSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*FatherCatSelect) Float64X

func (s *FatherCatSelect) Float64X(ctx context.Context) float64

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

func (*FatherCatSelect) Float64s

func (s *FatherCatSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FatherCatSelect) Float64sX

func (s *FatherCatSelect) Float64sX(ctx context.Context) []float64

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

func (*FatherCatSelect) Int

func (s *FatherCatSelect) Int(ctx context.Context) (_ int, err error)

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

func (*FatherCatSelect) IntX

func (s *FatherCatSelect) IntX(ctx context.Context) int

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

func (*FatherCatSelect) Ints

func (s *FatherCatSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FatherCatSelect) IntsX

func (s *FatherCatSelect) IntsX(ctx context.Context) []int

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

func (*FatherCatSelect) Scan

func (fcs *FatherCatSelect) Scan(ctx context.Context, v any) error

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

func (*FatherCatSelect) ScanX

func (s *FatherCatSelect) ScanX(ctx context.Context, v any)

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

func (*FatherCatSelect) String

func (s *FatherCatSelect) String(ctx context.Context) (_ string, err error)

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

func (*FatherCatSelect) StringX

func (s *FatherCatSelect) StringX(ctx context.Context) string

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

func (*FatherCatSelect) Strings

func (s *FatherCatSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FatherCatSelect) StringsX

func (s *FatherCatSelect) StringsX(ctx context.Context) []string

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

type FatherCatUpdate

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

FatherCatUpdate is the builder for updating FatherCat entities.

func (*FatherCatUpdate) ClearDeletedTime

func (fcu *FatherCatUpdate) ClearDeletedTime() *FatherCatUpdate

ClearDeletedTime clears the value of the "deleted_time" field.

func (*FatherCatUpdate) Exec

func (fcu *FatherCatUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FatherCatUpdate) ExecX

func (fcu *FatherCatUpdate) ExecX(ctx context.Context)

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

func (*FatherCatUpdate) Mutation

func (fcu *FatherCatUpdate) Mutation() *FatherCatMutation

Mutation returns the FatherCatMutation object of the builder.

func (*FatherCatUpdate) Save

func (fcu *FatherCatUpdate) Save(ctx context.Context) (int, error)

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

func (*FatherCatUpdate) SaveX

func (fcu *FatherCatUpdate) SaveX(ctx context.Context) int

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

func (*FatherCatUpdate) SetDeletedTime

func (fcu *FatherCatUpdate) SetDeletedTime(t time.Time) *FatherCatUpdate

SetDeletedTime sets the "deleted_time" field.

func (*FatherCatUpdate) SetName

func (fcu *FatherCatUpdate) SetName(s string) *FatherCatUpdate

SetName sets the "name" field.

func (*FatherCatUpdate) SetNillableDeletedTime

func (fcu *FatherCatUpdate) SetNillableDeletedTime(t *time.Time) *FatherCatUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*FatherCatUpdate) SetNillableName

func (fcu *FatherCatUpdate) SetNillableName(s *string) *FatherCatUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*FatherCatUpdate) SetUpdateTime

func (fcu *FatherCatUpdate) SetUpdateTime(t time.Time) *FatherCatUpdate

SetUpdateTime sets the "update_time" field.

func (*FatherCatUpdate) Where

Where appends a list predicates to the FatherCatUpdate builder.

type FatherCatUpdateOne

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

FatherCatUpdateOne is the builder for updating a single FatherCat entity.

func (*FatherCatUpdateOne) ClearDeletedTime

func (fcuo *FatherCatUpdateOne) ClearDeletedTime() *FatherCatUpdateOne

ClearDeletedTime clears the value of the "deleted_time" field.

func (*FatherCatUpdateOne) Exec

func (fcuo *FatherCatUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FatherCatUpdateOne) ExecX

func (fcuo *FatherCatUpdateOne) ExecX(ctx context.Context)

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

func (*FatherCatUpdateOne) Mutation

func (fcuo *FatherCatUpdateOne) Mutation() *FatherCatMutation

Mutation returns the FatherCatMutation object of the builder.

func (*FatherCatUpdateOne) Save

func (fcuo *FatherCatUpdateOne) Save(ctx context.Context) (*FatherCat, error)

Save executes the query and returns the updated FatherCat entity.

func (*FatherCatUpdateOne) SaveX

func (fcuo *FatherCatUpdateOne) SaveX(ctx context.Context) *FatherCat

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

func (*FatherCatUpdateOne) Select

func (fcuo *FatherCatUpdateOne) Select(field string, fields ...string) *FatherCatUpdateOne

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

func (*FatherCatUpdateOne) SetDeletedTime

func (fcuo *FatherCatUpdateOne) SetDeletedTime(t time.Time) *FatherCatUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*FatherCatUpdateOne) SetName

func (fcuo *FatherCatUpdateOne) SetName(s string) *FatherCatUpdateOne

SetName sets the "name" field.

func (*FatherCatUpdateOne) SetNillableDeletedTime

func (fcuo *FatherCatUpdateOne) SetNillableDeletedTime(t *time.Time) *FatherCatUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*FatherCatUpdateOne) SetNillableName

func (fcuo *FatherCatUpdateOne) SetNillableName(s *string) *FatherCatUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*FatherCatUpdateOne) SetUpdateTime

func (fcuo *FatherCatUpdateOne) SetUpdateTime(t time.Time) *FatherCatUpdateOne

SetUpdateTime sets the "update_time" field.

func (*FatherCatUpdateOne) Where

Where appends a list predicates to the FatherCatUpdate builder.

type FatherCats

type FatherCats []*FatherCat

FatherCats is a parsable slice of FatherCat.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Kitten

type Kitten struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// DeletedTime holds the value of the "deleted_time" field.
	DeletedTime *time.Time `json:"deleted_time,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// MotherID holds the value of the "mother_id" field.
	MotherID uuid.UUID `json:"mother_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the KittenQuery when eager-loading is set.
	Edges KittenEdges `json:"edges"`
	// contains filtered or unexported fields
}

Kitten is the model entity for the Kitten schema.

func (*Kitten) QueryMother

func (k *Kitten) QueryMother() *CatQuery

QueryMother queries the "mother" edge of the Kitten entity.

func (*Kitten) String

func (k *Kitten) String() string

String implements the fmt.Stringer.

func (*Kitten) Unwrap

func (k *Kitten) Unwrap() *Kitten

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

func (k *Kitten) Update() *KittenUpdateOne

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

func (*Kitten) Value

func (k *Kitten) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Kitten. This includes values selected through modifiers, order, etc.

type KittenClient

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

KittenClient is a client for the Kitten schema.

func NewKittenClient

func NewKittenClient(c config) *KittenClient

NewKittenClient returns a client for the Kitten from the given config.

func (*KittenClient) Create

func (c *KittenClient) Create() *KittenCreate

Create returns a builder for creating a Kitten entity.

func (*KittenClient) CreateBulk

func (c *KittenClient) CreateBulk(builders ...*KittenCreate) *KittenCreateBulk

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

func (*KittenClient) Delete

func (c *KittenClient) Delete() *KittenDelete

Delete returns a delete builder for Kitten.

func (*KittenClient) DeleteOne

func (c *KittenClient) DeleteOne(k *Kitten) *KittenDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*KittenClient) DeleteOneID

func (c *KittenClient) DeleteOneID(id uuid.UUID) *KittenDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*KittenClient) Get

func (c *KittenClient) Get(ctx context.Context, id uuid.UUID) (*Kitten, error)

Get returns a Kitten entity by its id.

func (*KittenClient) GetX

func (c *KittenClient) GetX(ctx context.Context, id uuid.UUID) *Kitten

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

func (*KittenClient) Hooks

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

Hooks returns the client hooks.

func (*KittenClient) Intercept

func (c *KittenClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `kitten.Intercept(f(g(h())))`.

func (*KittenClient) Interceptors

func (c *KittenClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*KittenClient) MapCreateBulk

func (c *KittenClient) MapCreateBulk(slice any, setFunc func(*KittenCreate, int)) *KittenCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*KittenClient) Query

func (c *KittenClient) Query() *KittenQuery

Query returns a query builder for Kitten.

func (*KittenClient) QueryMother

func (c *KittenClient) QueryMother(k *Kitten) *CatQuery

QueryMother queries the mother edge of a Kitten.

func (*KittenClient) Update

func (c *KittenClient) Update() *KittenUpdate

Update returns an update builder for Kitten.

func (*KittenClient) UpdateOne

func (c *KittenClient) UpdateOne(k *Kitten) *KittenUpdateOne

UpdateOne returns an update builder for the given entity.

func (*KittenClient) UpdateOneID

func (c *KittenClient) UpdateOneID(id uuid.UUID) *KittenUpdateOne

UpdateOneID returns an update builder for the given id.

func (*KittenClient) Use

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

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

type KittenCreate

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

KittenCreate is the builder for creating a Kitten entity.

func (*KittenCreate) Exec

func (kc *KittenCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*KittenCreate) ExecX

func (kc *KittenCreate) ExecX(ctx context.Context)

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

func (*KittenCreate) Mutation

func (kc *KittenCreate) Mutation() *KittenMutation

Mutation returns the KittenMutation object of the builder.

func (*KittenCreate) Save

func (kc *KittenCreate) Save(ctx context.Context) (*Kitten, error)

Save creates the Kitten in the database.

func (*KittenCreate) SaveX

func (kc *KittenCreate) SaveX(ctx context.Context) *Kitten

SaveX calls Save and panics if Save returns an error.

func (*KittenCreate) SetCreateTime

func (kc *KittenCreate) SetCreateTime(t time.Time) *KittenCreate

SetCreateTime sets the "create_time" field.

func (*KittenCreate) SetDeletedTime

func (kc *KittenCreate) SetDeletedTime(t time.Time) *KittenCreate

SetDeletedTime sets the "deleted_time" field.

func (*KittenCreate) SetID

func (kc *KittenCreate) SetID(u uuid.UUID) *KittenCreate

SetID sets the "id" field.

func (*KittenCreate) SetMother

func (kc *KittenCreate) SetMother(c *Cat) *KittenCreate

SetMother sets the "mother" edge to the Cat entity.

func (*KittenCreate) SetMotherID

func (kc *KittenCreate) SetMotherID(u uuid.UUID) *KittenCreate

SetMotherID sets the "mother_id" field.

func (*KittenCreate) SetName

func (kc *KittenCreate) SetName(s string) *KittenCreate

SetName sets the "name" field.

func (*KittenCreate) SetNillableCreateTime

func (kc *KittenCreate) SetNillableCreateTime(t *time.Time) *KittenCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*KittenCreate) SetNillableDeletedTime

func (kc *KittenCreate) SetNillableDeletedTime(t *time.Time) *KittenCreate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*KittenCreate) SetNillableID

func (kc *KittenCreate) SetNillableID(u *uuid.UUID) *KittenCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*KittenCreate) SetNillableUpdateTime

func (kc *KittenCreate) SetNillableUpdateTime(t *time.Time) *KittenCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*KittenCreate) SetUpdateTime

func (kc *KittenCreate) SetUpdateTime(t time.Time) *KittenCreate

SetUpdateTime sets the "update_time" field.

type KittenCreateBulk

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

KittenCreateBulk is the builder for creating many Kitten entities in bulk.

func (*KittenCreateBulk) Exec

func (kcb *KittenCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*KittenCreateBulk) ExecX

func (kcb *KittenCreateBulk) ExecX(ctx context.Context)

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

func (*KittenCreateBulk) Save

func (kcb *KittenCreateBulk) Save(ctx context.Context) ([]*Kitten, error)

Save creates the Kitten entities in the database.

func (*KittenCreateBulk) SaveX

func (kcb *KittenCreateBulk) SaveX(ctx context.Context) []*Kitten

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

type KittenDelete

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

KittenDelete is the builder for deleting a Kitten entity.

func (*KittenDelete) Exec

func (kd *KittenDelete) Exec(ctx context.Context) (int, error)

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

func (*KittenDelete) ExecX

func (kd *KittenDelete) ExecX(ctx context.Context) int

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

func (*KittenDelete) Where

func (kd *KittenDelete) Where(ps ...predicate.Kitten) *KittenDelete

Where appends a list predicates to the KittenDelete builder.

type KittenDeleteOne

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

KittenDeleteOne is the builder for deleting a single Kitten entity.

func (*KittenDeleteOne) Exec

func (kdo *KittenDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*KittenDeleteOne) ExecX

func (kdo *KittenDeleteOne) ExecX(ctx context.Context)

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

func (*KittenDeleteOne) Where

func (kdo *KittenDeleteOne) Where(ps ...predicate.Kitten) *KittenDeleteOne

Where appends a list predicates to the KittenDelete builder.

type KittenEdges

type KittenEdges struct {
	// Mother holds the value of the mother edge.
	Mother *Cat `json:"mother,omitempty"`
	// contains filtered or unexported fields
}

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

func (KittenEdges) MotherOrErr

func (e KittenEdges) MotherOrErr() (*Cat, error)

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

type KittenGroupBy

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

KittenGroupBy is the group-by builder for Kitten entities.

func (*KittenGroupBy) Aggregate

func (kgb *KittenGroupBy) Aggregate(fns ...AggregateFunc) *KittenGroupBy

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

func (*KittenGroupBy) Bool

func (s *KittenGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*KittenGroupBy) BoolX

func (s *KittenGroupBy) BoolX(ctx context.Context) bool

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

func (*KittenGroupBy) Bools

func (s *KittenGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*KittenGroupBy) BoolsX

func (s *KittenGroupBy) BoolsX(ctx context.Context) []bool

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

func (*KittenGroupBy) Float64

func (s *KittenGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*KittenGroupBy) Float64X

func (s *KittenGroupBy) Float64X(ctx context.Context) float64

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

func (*KittenGroupBy) Float64s

func (s *KittenGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*KittenGroupBy) Float64sX

func (s *KittenGroupBy) Float64sX(ctx context.Context) []float64

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

func (*KittenGroupBy) Int

func (s *KittenGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*KittenGroupBy) IntX

func (s *KittenGroupBy) IntX(ctx context.Context) int

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

func (*KittenGroupBy) Ints

func (s *KittenGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*KittenGroupBy) IntsX

func (s *KittenGroupBy) IntsX(ctx context.Context) []int

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

func (*KittenGroupBy) Scan

func (kgb *KittenGroupBy) Scan(ctx context.Context, v any) error

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

func (*KittenGroupBy) ScanX

func (s *KittenGroupBy) ScanX(ctx context.Context, v any)

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

func (*KittenGroupBy) String

func (s *KittenGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*KittenGroupBy) StringX

func (s *KittenGroupBy) StringX(ctx context.Context) string

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

func (*KittenGroupBy) Strings

func (s *KittenGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*KittenGroupBy) StringsX

func (s *KittenGroupBy) StringsX(ctx context.Context) []string

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

type KittenMutation

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

KittenMutation represents an operation that mutates the Kitten nodes in the graph.

func (*KittenMutation) AddField

func (m *KittenMutation) 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 (*KittenMutation) AddedEdges

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

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

func (*KittenMutation) AddedField

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

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

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

func (*KittenMutation) AddedIDs

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

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

func (*KittenMutation) ClearDeletedTime

func (m *KittenMutation) ClearDeletedTime()

ClearDeletedTime clears the value of the "deleted_time" field.

func (*KittenMutation) ClearEdge

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

func (m *KittenMutation) 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 (*KittenMutation) ClearMother

func (m *KittenMutation) ClearMother()

ClearMother clears the "mother" edge to the Cat entity.

func (*KittenMutation) ClearedEdges

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

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

func (*KittenMutation) ClearedFields

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

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

func (KittenMutation) Client

func (m KittenMutation) 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 (*KittenMutation) CreateTime

func (m *KittenMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*KittenMutation) DeletedTime

func (m *KittenMutation) DeletedTime() (r time.Time, exists bool)

DeletedTime returns the value of the "deleted_time" field in the mutation.

func (*KittenMutation) DeletedTimeCleared

func (m *KittenMutation) DeletedTimeCleared() bool

DeletedTimeCleared returns if the "deleted_time" field was cleared in this mutation.

func (*KittenMutation) EdgeCleared

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

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

func (*KittenMutation) Field

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

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

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

func (*KittenMutation) Fields

func (m *KittenMutation) 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 (*KittenMutation) ID

func (m *KittenMutation) 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 (*KittenMutation) IDs

func (m *KittenMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*KittenMutation) MotherCleared

func (m *KittenMutation) MotherCleared() bool

MotherCleared reports if the "mother" edge to the Cat entity was cleared.

func (*KittenMutation) MotherID

func (m *KittenMutation) MotherID() (r uuid.UUID, exists bool)

MotherID returns the value of the "mother_id" field in the mutation.

func (*KittenMutation) MotherIDs

func (m *KittenMutation) MotherIDs() (ids []uuid.UUID)

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

func (*KittenMutation) Name

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

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

func (*KittenMutation) OldCreateTime

func (m *KittenMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Kitten entity. If the Kitten 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 (*KittenMutation) OldDeletedTime

func (m *KittenMutation) OldDeletedTime(ctx context.Context) (v *time.Time, err error)

OldDeletedTime returns the old "deleted_time" field's value of the Kitten entity. If the Kitten 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 (*KittenMutation) OldField

func (m *KittenMutation) 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 (*KittenMutation) OldMotherID

func (m *KittenMutation) OldMotherID(ctx context.Context) (v uuid.UUID, err error)

OldMotherID returns the old "mother_id" field's value of the Kitten entity. If the Kitten 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 (*KittenMutation) OldName

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

OldName returns the old "name" field's value of the Kitten entity. If the Kitten 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 (*KittenMutation) OldUpdateTime

func (m *KittenMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Kitten entity. If the Kitten 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 (*KittenMutation) Op

func (m *KittenMutation) Op() Op

Op returns the operation name.

func (*KittenMutation) RemovedEdges

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

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

func (*KittenMutation) RemovedIDs

func (m *KittenMutation) 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 (*KittenMutation) ResetCreateTime

func (m *KittenMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*KittenMutation) ResetDeletedTime

func (m *KittenMutation) ResetDeletedTime()

ResetDeletedTime resets all changes to the "deleted_time" field.

func (*KittenMutation) ResetEdge

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

func (m *KittenMutation) 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 (*KittenMutation) ResetMother

func (m *KittenMutation) ResetMother()

ResetMother resets all changes to the "mother" edge.

func (*KittenMutation) ResetMotherID

func (m *KittenMutation) ResetMotherID()

ResetMotherID resets all changes to the "mother_id" field.

func (*KittenMutation) ResetName

func (m *KittenMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*KittenMutation) ResetUpdateTime

func (m *KittenMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*KittenMutation) SetCreateTime

func (m *KittenMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*KittenMutation) SetDeletedTime

func (m *KittenMutation) SetDeletedTime(t time.Time)

SetDeletedTime sets the "deleted_time" field.

func (*KittenMutation) SetField

func (m *KittenMutation) 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 (*KittenMutation) SetID

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

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

func (*KittenMutation) SetMotherID

func (m *KittenMutation) SetMotherID(u uuid.UUID)

SetMotherID sets the "mother_id" field.

func (*KittenMutation) SetName

func (m *KittenMutation) SetName(s string)

SetName sets the "name" field.

func (*KittenMutation) SetOp

func (m *KittenMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*KittenMutation) SetUpdateTime

func (m *KittenMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (KittenMutation) Tx

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

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

func (*KittenMutation) Type

func (m *KittenMutation) Type() string

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

func (*KittenMutation) UpdateTime

func (m *KittenMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*KittenMutation) Where

func (m *KittenMutation) Where(ps ...predicate.Kitten)

Where appends a list predicates to the KittenMutation builder.

func (*KittenMutation) WhereP

func (m *KittenMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the KittenMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type KittenQuery

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

KittenQuery is the builder for querying Kitten entities.

func (*KittenQuery) Aggregate

func (kq *KittenQuery) Aggregate(fns ...AggregateFunc) *KittenSelect

Aggregate returns a KittenSelect configured with the given aggregations.

func (*KittenQuery) All

func (kq *KittenQuery) All(ctx context.Context) ([]*Kitten, error)

All executes the query and returns a list of Kittens.

func (*KittenQuery) AllX

func (kq *KittenQuery) AllX(ctx context.Context) []*Kitten

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

func (*KittenQuery) Clone

func (kq *KittenQuery) Clone() *KittenQuery

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

func (*KittenQuery) Count

func (kq *KittenQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*KittenQuery) CountX

func (kq *KittenQuery) CountX(ctx context.Context) int

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

func (*KittenQuery) Exist

func (kq *KittenQuery) Exist(ctx context.Context) (bool, error)

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

func (*KittenQuery) ExistX

func (kq *KittenQuery) ExistX(ctx context.Context) bool

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

func (*KittenQuery) First

func (kq *KittenQuery) First(ctx context.Context) (*Kitten, error)

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

func (*KittenQuery) FirstID

func (kq *KittenQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*KittenQuery) FirstIDX

func (kq *KittenQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*KittenQuery) FirstX

func (kq *KittenQuery) FirstX(ctx context.Context) *Kitten

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

func (*KittenQuery) GroupBy

func (kq *KittenQuery) GroupBy(field string, fields ...string) *KittenGroupBy

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Kitten.Query().
	GroupBy(kitten.FieldDeletedTime).
	Aggregate(gen.Count()).
	Scan(ctx, &v)

func (*KittenQuery) IDs

func (kq *KittenQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*KittenQuery) IDsX

func (kq *KittenQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*KittenQuery) Limit

func (kq *KittenQuery) Limit(limit int) *KittenQuery

Limit the number of records to be returned by this query.

func (*KittenQuery) Offset

func (kq *KittenQuery) Offset(offset int) *KittenQuery

Offset to start from.

func (*KittenQuery) Only

func (kq *KittenQuery) Only(ctx context.Context) (*Kitten, error)

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

func (*KittenQuery) OnlyID

func (kq *KittenQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*KittenQuery) OnlyIDX

func (kq *KittenQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*KittenQuery) OnlyX

func (kq *KittenQuery) OnlyX(ctx context.Context) *Kitten

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

func (*KittenQuery) Order

func (kq *KittenQuery) Order(o ...kitten.OrderOption) *KittenQuery

Order specifies how the records should be ordered.

func (*KittenQuery) QueryMother

func (kq *KittenQuery) QueryMother() *CatQuery

QueryMother chains the current query on the "mother" edge.

func (*KittenQuery) Select

func (kq *KittenQuery) Select(fields ...string) *KittenSelect

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 {
	DeletedTime time.Time `json:"deleted_time,omitempty"`
}

client.Kitten.Query().
	Select(kitten.FieldDeletedTime).
	Scan(ctx, &v)

func (*KittenQuery) Unique

func (kq *KittenQuery) Unique(unique bool) *KittenQuery

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

func (kq *KittenQuery) Where(ps ...predicate.Kitten) *KittenQuery

Where adds a new predicate for the KittenQuery builder.

func (*KittenQuery) WithMother

func (kq *KittenQuery) WithMother(opts ...func(*CatQuery)) *KittenQuery

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

type KittenSelect

type KittenSelect struct {
	*KittenQuery
	// contains filtered or unexported fields
}

KittenSelect is the builder for selecting fields of Kitten entities.

func (*KittenSelect) Aggregate

func (ks *KittenSelect) Aggregate(fns ...AggregateFunc) *KittenSelect

Aggregate adds the given aggregation functions to the selector query.

func (*KittenSelect) Bool

func (s *KittenSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*KittenSelect) BoolX

func (s *KittenSelect) BoolX(ctx context.Context) bool

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

func (*KittenSelect) Bools

func (s *KittenSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*KittenSelect) BoolsX

func (s *KittenSelect) BoolsX(ctx context.Context) []bool

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

func (*KittenSelect) Float64

func (s *KittenSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*KittenSelect) Float64X

func (s *KittenSelect) Float64X(ctx context.Context) float64

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

func (*KittenSelect) Float64s

func (s *KittenSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*KittenSelect) Float64sX

func (s *KittenSelect) Float64sX(ctx context.Context) []float64

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

func (*KittenSelect) Int

func (s *KittenSelect) Int(ctx context.Context) (_ int, err error)

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

func (*KittenSelect) IntX

func (s *KittenSelect) IntX(ctx context.Context) int

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

func (*KittenSelect) Ints

func (s *KittenSelect) Ints(ctx context.Context) ([]int, error)

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

func (*KittenSelect) IntsX

func (s *KittenSelect) IntsX(ctx context.Context) []int

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

func (*KittenSelect) Scan

func (ks *KittenSelect) Scan(ctx context.Context, v any) error

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

func (*KittenSelect) ScanX

func (s *KittenSelect) ScanX(ctx context.Context, v any)

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

func (*KittenSelect) String

func (s *KittenSelect) String(ctx context.Context) (_ string, err error)

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

func (*KittenSelect) StringX

func (s *KittenSelect) StringX(ctx context.Context) string

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

func (*KittenSelect) Strings

func (s *KittenSelect) Strings(ctx context.Context) ([]string, error)

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

func (*KittenSelect) StringsX

func (s *KittenSelect) StringsX(ctx context.Context) []string

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

type KittenUpdate

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

KittenUpdate is the builder for updating Kitten entities.

func (*KittenUpdate) ClearDeletedTime

func (ku *KittenUpdate) ClearDeletedTime() *KittenUpdate

ClearDeletedTime clears the value of the "deleted_time" field.

func (*KittenUpdate) ClearMother

func (ku *KittenUpdate) ClearMother() *KittenUpdate

ClearMother clears the "mother" edge to the Cat entity.

func (*KittenUpdate) Exec

func (ku *KittenUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*KittenUpdate) ExecX

func (ku *KittenUpdate) ExecX(ctx context.Context)

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

func (*KittenUpdate) Mutation

func (ku *KittenUpdate) Mutation() *KittenMutation

Mutation returns the KittenMutation object of the builder.

func (*KittenUpdate) Save

func (ku *KittenUpdate) Save(ctx context.Context) (int, error)

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

func (*KittenUpdate) SaveX

func (ku *KittenUpdate) SaveX(ctx context.Context) int

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

func (*KittenUpdate) SetDeletedTime

func (ku *KittenUpdate) SetDeletedTime(t time.Time) *KittenUpdate

SetDeletedTime sets the "deleted_time" field.

func (*KittenUpdate) SetMother

func (ku *KittenUpdate) SetMother(c *Cat) *KittenUpdate

SetMother sets the "mother" edge to the Cat entity.

func (*KittenUpdate) SetMotherID

func (ku *KittenUpdate) SetMotherID(u uuid.UUID) *KittenUpdate

SetMotherID sets the "mother_id" field.

func (*KittenUpdate) SetName

func (ku *KittenUpdate) SetName(s string) *KittenUpdate

SetName sets the "name" field.

func (*KittenUpdate) SetNillableDeletedTime

func (ku *KittenUpdate) SetNillableDeletedTime(t *time.Time) *KittenUpdate

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*KittenUpdate) SetNillableMotherID

func (ku *KittenUpdate) SetNillableMotherID(u *uuid.UUID) *KittenUpdate

SetNillableMotherID sets the "mother_id" field if the given value is not nil.

func (*KittenUpdate) SetNillableName

func (ku *KittenUpdate) SetNillableName(s *string) *KittenUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*KittenUpdate) SetUpdateTime

func (ku *KittenUpdate) SetUpdateTime(t time.Time) *KittenUpdate

SetUpdateTime sets the "update_time" field.

func (*KittenUpdate) Where

func (ku *KittenUpdate) Where(ps ...predicate.Kitten) *KittenUpdate

Where appends a list predicates to the KittenUpdate builder.

type KittenUpdateOne

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

KittenUpdateOne is the builder for updating a single Kitten entity.

func (*KittenUpdateOne) ClearDeletedTime

func (kuo *KittenUpdateOne) ClearDeletedTime() *KittenUpdateOne

ClearDeletedTime clears the value of the "deleted_time" field.

func (*KittenUpdateOne) ClearMother

func (kuo *KittenUpdateOne) ClearMother() *KittenUpdateOne

ClearMother clears the "mother" edge to the Cat entity.

func (*KittenUpdateOne) Exec

func (kuo *KittenUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*KittenUpdateOne) ExecX

func (kuo *KittenUpdateOne) ExecX(ctx context.Context)

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

func (*KittenUpdateOne) Mutation

func (kuo *KittenUpdateOne) Mutation() *KittenMutation

Mutation returns the KittenMutation object of the builder.

func (*KittenUpdateOne) Save

func (kuo *KittenUpdateOne) Save(ctx context.Context) (*Kitten, error)

Save executes the query and returns the updated Kitten entity.

func (*KittenUpdateOne) SaveX

func (kuo *KittenUpdateOne) SaveX(ctx context.Context) *Kitten

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

func (*KittenUpdateOne) Select

func (kuo *KittenUpdateOne) Select(field string, fields ...string) *KittenUpdateOne

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

func (*KittenUpdateOne) SetDeletedTime

func (kuo *KittenUpdateOne) SetDeletedTime(t time.Time) *KittenUpdateOne

SetDeletedTime sets the "deleted_time" field.

func (*KittenUpdateOne) SetMother

func (kuo *KittenUpdateOne) SetMother(c *Cat) *KittenUpdateOne

SetMother sets the "mother" edge to the Cat entity.

func (*KittenUpdateOne) SetMotherID

func (kuo *KittenUpdateOne) SetMotherID(u uuid.UUID) *KittenUpdateOne

SetMotherID sets the "mother_id" field.

func (*KittenUpdateOne) SetName

func (kuo *KittenUpdateOne) SetName(s string) *KittenUpdateOne

SetName sets the "name" field.

func (*KittenUpdateOne) SetNillableDeletedTime

func (kuo *KittenUpdateOne) SetNillableDeletedTime(t *time.Time) *KittenUpdateOne

SetNillableDeletedTime sets the "deleted_time" field if the given value is not nil.

func (*KittenUpdateOne) SetNillableMotherID

func (kuo *KittenUpdateOne) SetNillableMotherID(u *uuid.UUID) *KittenUpdateOne

SetNillableMotherID sets the "mother_id" field if the given value is not nil.

func (*KittenUpdateOne) SetNillableName

func (kuo *KittenUpdateOne) SetNillableName(s *string) *KittenUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*KittenUpdateOne) SetUpdateTime

func (kuo *KittenUpdateOne) SetUpdateTime(t time.Time) *KittenUpdateOne

SetUpdateTime sets the "update_time" field.

func (*KittenUpdateOne) Where

func (kuo *KittenUpdateOne) Where(ps ...predicate.Kitten) *KittenUpdateOne

Where appends a list predicates to the KittenUpdate builder.

type Kittens

type Kittens []*Kitten

Kittens is a parsable slice of Kitten.

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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 QueryContext

type QueryContext = ent.QueryContext

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(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Breed is the client for interacting with the Breed builders.
	Breed *BreedClient
	// Cat is the client for interacting with the Cat builders.
	Cat *CatClient
	// FatherCat is the client for interacting with the FatherCat builders.
	FatherCat *FatherCatClient
	// Kitten is the client for interacting with the Kitten builders.
	Kitten *KittenClient
	// 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 or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

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