ent

package
v0.0.0-...-ed3e5d4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 24 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.
	TypeAllTypes = "AllTypes"
	TypeCategory = "Category"
	TypeHat      = "Hat"
	TypePet      = "Pet"
	TypeUser     = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type AllTypes

type AllTypes struct {

	// ID of the ent.
	ID uint32 `json:"id,omitempty"`
	// Int holds the value of the "int" field.
	Int int `json:"int,omitempty"`
	// Int8 holds the value of the "int8" field.
	Int8 int8 `json:"int8,omitempty"`
	// Int16 holds the value of the "int16" field.
	Int16 int16 `json:"int16,omitempty"`
	// Int32 holds the value of the "int32" field.
	Int32 int32 `json:"int32,omitempty"`
	// Int64 holds the value of the "int64" field.
	Int64 int64 `json:"int64,omitempty"`
	// Uint holds the value of the "uint" field.
	Uint uint `json:"uint,omitempty"`
	// Uint8 holds the value of the "uint8" field.
	Uint8 uint8 `json:"uint8,omitempty"`
	// Uint16 holds the value of the "uint16" field.
	Uint16 uint16 `json:"uint16,omitempty"`
	// Uint32 holds the value of the "uint32" field.
	Uint32 uint32 `json:"uint32,omitempty"`
	// Uint64 holds the value of the "uint64" field.
	Uint64 uint64 `json:"uint64,omitempty"`
	// Float32 holds the value of the "float32" field.
	Float32 float32 `json:"float32,omitempty"`
	// Float64 holds the value of the "float64" field.
	Float64 float64 `json:"float64,omitempty"`
	// StringType holds the value of the "string_type" field.
	StringType string `json:"string_type,omitempty"`
	// Bool holds the value of the "bool" field.
	Bool bool `json:"bool,omitempty"`
	// UUID holds the value of the "uuid" field.
	UUID uuid.UUID `json:"uuid,omitempty"`
	// Time holds the value of the "time" field.
	Time time.Time `json:"time,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// State holds the value of the "state" field.
	State alltypes.State `json:"state,omitempty"`
	// Bytes holds the value of the "bytes" field.
	Bytes []byte `json:"bytes,omitempty"`
	// Nilable holds the value of the "nilable" field.
	Nilable *string `json:"nilable,omitempty"`
	// contains filtered or unexported fields
}

AllTypes is the model entity for the AllTypes schema.

func (*AllTypes) String

func (at *AllTypes) String() string

String implements the fmt.Stringer.

func (*AllTypes) Unwrap

func (at *AllTypes) Unwrap() *AllTypes

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

func (at *AllTypes) Update() *AllTypesUpdateOne

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

type AllTypesClient

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

AllTypesClient is a client for the AllTypes schema.

func NewAllTypesClient

func NewAllTypesClient(c config) *AllTypesClient

NewAllTypesClient returns a client for the AllTypes from the given config.

func (*AllTypesClient) Create

func (c *AllTypesClient) Create() *AllTypesCreate

Create returns a builder for creating a AllTypes entity.

func (*AllTypesClient) CreateBulk

func (c *AllTypesClient) CreateBulk(builders ...*AllTypesCreate) *AllTypesCreateBulk

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

func (*AllTypesClient) Delete

func (c *AllTypesClient) Delete() *AllTypesDelete

Delete returns a delete builder for AllTypes.

func (*AllTypesClient) DeleteOne

func (c *AllTypesClient) DeleteOne(at *AllTypes) *AllTypesDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*AllTypesClient) DeleteOneID

func (c *AllTypesClient) DeleteOneID(id uint32) *AllTypesDeleteOne

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

func (*AllTypesClient) Get

func (c *AllTypesClient) Get(ctx context.Context, id uint32) (*AllTypes, error)

Get returns a AllTypes entity by its id.

func (*AllTypesClient) GetX

func (c *AllTypesClient) GetX(ctx context.Context, id uint32) *AllTypes

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

func (*AllTypesClient) Hooks

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

Hooks returns the client hooks.

func (*AllTypesClient) Intercept

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

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

func (*AllTypesClient) Interceptors

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

Interceptors returns the client interceptors.

func (*AllTypesClient) Query

func (c *AllTypesClient) Query() *AllTypesQuery

Query returns a query builder for AllTypes.

func (*AllTypesClient) Update

func (c *AllTypesClient) Update() *AllTypesUpdate

Update returns an update builder for AllTypes.

func (*AllTypesClient) UpdateOne

func (c *AllTypesClient) UpdateOne(at *AllTypes) *AllTypesUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AllTypesClient) UpdateOneID

func (c *AllTypesClient) UpdateOneID(id uint32) *AllTypesUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AllTypesClient) Use

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

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

type AllTypesCreate

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

AllTypesCreate is the builder for creating a AllTypes entity.

func (*AllTypesCreate) Exec

func (atc *AllTypesCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*AllTypesCreate) ExecX

func (atc *AllTypesCreate) ExecX(ctx context.Context)

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

func (*AllTypesCreate) Mutation

func (atc *AllTypesCreate) Mutation() *AllTypesMutation

Mutation returns the AllTypesMutation object of the builder.

func (*AllTypesCreate) Save

func (atc *AllTypesCreate) Save(ctx context.Context) (*AllTypes, error)

Save creates the AllTypes in the database.

func (*AllTypesCreate) SaveX

func (atc *AllTypesCreate) SaveX(ctx context.Context) *AllTypes

SaveX calls Save and panics if Save returns an error.

func (*AllTypesCreate) SetBool

func (atc *AllTypesCreate) SetBool(b bool) *AllTypesCreate

SetBool sets the "bool" field.

func (*AllTypesCreate) SetBytes

func (atc *AllTypesCreate) SetBytes(b []byte) *AllTypesCreate

SetBytes sets the "bytes" field.

func (*AllTypesCreate) SetFloat32

func (atc *AllTypesCreate) SetFloat32(f float32) *AllTypesCreate

SetFloat32 sets the "float32" field.

func (*AllTypesCreate) SetFloat64

func (atc *AllTypesCreate) SetFloat64(f float64) *AllTypesCreate

SetFloat64 sets the "float64" field.

func (*AllTypesCreate) SetID

func (atc *AllTypesCreate) SetID(u uint32) *AllTypesCreate

SetID sets the "id" field.

func (*AllTypesCreate) SetInt

func (atc *AllTypesCreate) SetInt(i int) *AllTypesCreate

SetInt sets the "int" field.

func (*AllTypesCreate) SetInt16

func (atc *AllTypesCreate) SetInt16(i int16) *AllTypesCreate

SetInt16 sets the "int16" field.

func (*AllTypesCreate) SetInt32

func (atc *AllTypesCreate) SetInt32(i int32) *AllTypesCreate

SetInt32 sets the "int32" field.

func (*AllTypesCreate) SetInt64

func (atc *AllTypesCreate) SetInt64(i int64) *AllTypesCreate

SetInt64 sets the "int64" field.

func (*AllTypesCreate) SetInt8

func (atc *AllTypesCreate) SetInt8(i int8) *AllTypesCreate

SetInt8 sets the "int8" field.

func (*AllTypesCreate) SetNilable

func (atc *AllTypesCreate) SetNilable(s string) *AllTypesCreate

SetNilable sets the "nilable" field.

func (*AllTypesCreate) SetState

func (atc *AllTypesCreate) SetState(a alltypes.State) *AllTypesCreate

SetState sets the "state" field.

func (*AllTypesCreate) SetStringType

func (atc *AllTypesCreate) SetStringType(s string) *AllTypesCreate

SetStringType sets the "string_type" field.

func (*AllTypesCreate) SetText

func (atc *AllTypesCreate) SetText(s string) *AllTypesCreate

SetText sets the "text" field.

func (*AllTypesCreate) SetTime

func (atc *AllTypesCreate) SetTime(t time.Time) *AllTypesCreate

SetTime sets the "time" field.

func (*AllTypesCreate) SetUUID

func (atc *AllTypesCreate) SetUUID(u uuid.UUID) *AllTypesCreate

SetUUID sets the "uuid" field.

func (*AllTypesCreate) SetUint

func (atc *AllTypesCreate) SetUint(u uint) *AllTypesCreate

SetUint sets the "uint" field.

func (*AllTypesCreate) SetUint16

func (atc *AllTypesCreate) SetUint16(u uint16) *AllTypesCreate

SetUint16 sets the "uint16" field.

func (*AllTypesCreate) SetUint32

func (atc *AllTypesCreate) SetUint32(u uint32) *AllTypesCreate

SetUint32 sets the "uint32" field.

func (*AllTypesCreate) SetUint64

func (atc *AllTypesCreate) SetUint64(u uint64) *AllTypesCreate

SetUint64 sets the "uint64" field.

func (*AllTypesCreate) SetUint8

func (atc *AllTypesCreate) SetUint8(u uint8) *AllTypesCreate

SetUint8 sets the "uint8" field.

type AllTypesCreateBulk

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

AllTypesCreateBulk is the builder for creating many AllTypes entities in bulk.

func (*AllTypesCreateBulk) Exec

func (atcb *AllTypesCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*AllTypesCreateBulk) ExecX

func (atcb *AllTypesCreateBulk) ExecX(ctx context.Context)

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

func (*AllTypesCreateBulk) Save

func (atcb *AllTypesCreateBulk) Save(ctx context.Context) ([]*AllTypes, error)

Save creates the AllTypes entities in the database.

func (*AllTypesCreateBulk) SaveX

func (atcb *AllTypesCreateBulk) SaveX(ctx context.Context) []*AllTypes

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

type AllTypesDelete

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

AllTypesDelete is the builder for deleting a AllTypes entity.

func (*AllTypesDelete) Exec

func (atd *AllTypesDelete) Exec(ctx context.Context) (int, error)

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

func (*AllTypesDelete) ExecX

func (atd *AllTypesDelete) ExecX(ctx context.Context) int

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

func (*AllTypesDelete) Where

func (atd *AllTypesDelete) Where(ps ...predicate.AllTypes) *AllTypesDelete

Where appends a list predicates to the AllTypesDelete builder.

type AllTypesDeleteOne

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

AllTypesDeleteOne is the builder for deleting a single AllTypes entity.

func (*AllTypesDeleteOne) Exec

func (atdo *AllTypesDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AllTypesDeleteOne) ExecX

func (atdo *AllTypesDeleteOne) ExecX(ctx context.Context)

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

func (*AllTypesDeleteOne) Where

Where appends a list predicates to the AllTypesDelete builder.

type AllTypesGroupBy

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

AllTypesGroupBy is the group-by builder for AllTypes entities.

func (*AllTypesGroupBy) Aggregate

func (atgb *AllTypesGroupBy) Aggregate(fns ...AggregateFunc) *AllTypesGroupBy

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

func (*AllTypesGroupBy) Bool

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

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

func (*AllTypesGroupBy) BoolX

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

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

func (*AllTypesGroupBy) Bools

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

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

func (*AllTypesGroupBy) BoolsX

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

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

func (*AllTypesGroupBy) Float64

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

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

func (*AllTypesGroupBy) Float64X

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

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

func (*AllTypesGroupBy) Float64s

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

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

func (*AllTypesGroupBy) Float64sX

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

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

func (*AllTypesGroupBy) Int

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

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

func (*AllTypesGroupBy) IntX

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

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

func (*AllTypesGroupBy) Ints

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

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

func (*AllTypesGroupBy) IntsX

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

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

func (*AllTypesGroupBy) Scan

func (atgb *AllTypesGroupBy) Scan(ctx context.Context, v any) error

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

func (*AllTypesGroupBy) ScanX

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

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

func (*AllTypesGroupBy) String

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

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

func (*AllTypesGroupBy) StringX

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

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

func (*AllTypesGroupBy) Strings

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

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

func (*AllTypesGroupBy) StringsX

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

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

type AllTypesMutation

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

AllTypesMutation represents an operation that mutates the AllTypes nodes in the graph.

func (*AllTypesMutation) AddField

func (m *AllTypesMutation) 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 (*AllTypesMutation) AddFloat32

func (m *AllTypesMutation) AddFloat32(f float32)

AddFloat32 adds f to the "float32" field.

func (*AllTypesMutation) AddFloat64

func (m *AllTypesMutation) AddFloat64(f float64)

AddFloat64 adds f to the "float64" field.

func (*AllTypesMutation) AddInt

func (m *AllTypesMutation) AddInt(i int)

AddInt adds i to the "int" field.

func (*AllTypesMutation) AddInt16

func (m *AllTypesMutation) AddInt16(i int16)

AddInt16 adds i to the "int16" field.

func (*AllTypesMutation) AddInt32

func (m *AllTypesMutation) AddInt32(i int32)

AddInt32 adds i to the "int32" field.

func (*AllTypesMutation) AddInt64

func (m *AllTypesMutation) AddInt64(i int64)

AddInt64 adds i to the "int64" field.

func (*AllTypesMutation) AddInt8

func (m *AllTypesMutation) AddInt8(i int8)

AddInt8 adds i to the "int8" field.

func (*AllTypesMutation) AddUint

func (m *AllTypesMutation) AddUint(u int)

AddUint adds u to the "uint" field.

func (*AllTypesMutation) AddUint16

func (m *AllTypesMutation) AddUint16(u int16)

AddUint16 adds u to the "uint16" field.

func (*AllTypesMutation) AddUint32

func (m *AllTypesMutation) AddUint32(u int32)

AddUint32 adds u to the "uint32" field.

func (*AllTypesMutation) AddUint64

func (m *AllTypesMutation) AddUint64(u int64)

AddUint64 adds u to the "uint64" field.

func (*AllTypesMutation) AddUint8

func (m *AllTypesMutation) AddUint8(u int8)

AddUint8 adds u to the "uint8" field.

func (*AllTypesMutation) AddedEdges

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

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

func (*AllTypesMutation) AddedField

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

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

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

func (*AllTypesMutation) AddedFloat32

func (m *AllTypesMutation) AddedFloat32() (r float32, exists bool)

AddedFloat32 returns the value that was added to the "float32" field in this mutation.

func (*AllTypesMutation) AddedFloat64

func (m *AllTypesMutation) AddedFloat64() (r float64, exists bool)

AddedFloat64 returns the value that was added to the "float64" field in this mutation.

func (*AllTypesMutation) AddedIDs

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

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

func (*AllTypesMutation) AddedInt

func (m *AllTypesMutation) AddedInt() (r int, exists bool)

AddedInt returns the value that was added to the "int" field in this mutation.

func (*AllTypesMutation) AddedInt16

func (m *AllTypesMutation) AddedInt16() (r int16, exists bool)

AddedInt16 returns the value that was added to the "int16" field in this mutation.

func (*AllTypesMutation) AddedInt32

func (m *AllTypesMutation) AddedInt32() (r int32, exists bool)

AddedInt32 returns the value that was added to the "int32" field in this mutation.

func (*AllTypesMutation) AddedInt64

func (m *AllTypesMutation) AddedInt64() (r int64, exists bool)

AddedInt64 returns the value that was added to the "int64" field in this mutation.

func (*AllTypesMutation) AddedInt8

func (m *AllTypesMutation) AddedInt8() (r int8, exists bool)

AddedInt8 returns the value that was added to the "int8" field in this mutation.

func (*AllTypesMutation) AddedUint

func (m *AllTypesMutation) AddedUint() (r int, exists bool)

AddedUint returns the value that was added to the "uint" field in this mutation.

func (*AllTypesMutation) AddedUint16

func (m *AllTypesMutation) AddedUint16() (r int16, exists bool)

AddedUint16 returns the value that was added to the "uint16" field in this mutation.

func (*AllTypesMutation) AddedUint32

func (m *AllTypesMutation) AddedUint32() (r int32, exists bool)

AddedUint32 returns the value that was added to the "uint32" field in this mutation.

func (*AllTypesMutation) AddedUint64

func (m *AllTypesMutation) AddedUint64() (r int64, exists bool)

AddedUint64 returns the value that was added to the "uint64" field in this mutation.

func (*AllTypesMutation) AddedUint8

func (m *AllTypesMutation) AddedUint8() (r int8, exists bool)

AddedUint8 returns the value that was added to the "uint8" field in this mutation.

func (*AllTypesMutation) Bool

func (m *AllTypesMutation) Bool() (r bool, exists bool)

Bool returns the value of the "bool" field in the mutation.

func (*AllTypesMutation) Bytes

func (m *AllTypesMutation) Bytes() (r []byte, exists bool)

Bytes returns the value of the "bytes" field in the mutation.

func (*AllTypesMutation) ClearEdge

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

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

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

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

func (*AllTypesMutation) ClearedFields

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

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

func (AllTypesMutation) Client

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

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

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

func (*AllTypesMutation) Field

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

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

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

func (*AllTypesMutation) Fields

func (m *AllTypesMutation) 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 (*AllTypesMutation) Float32

func (m *AllTypesMutation) Float32() (r float32, exists bool)

Float32 returns the value of the "float32" field in the mutation.

func (*AllTypesMutation) Float64

func (m *AllTypesMutation) Float64() (r float64, exists bool)

Float64 returns the value of the "float64" field in the mutation.

func (*AllTypesMutation) ID

func (m *AllTypesMutation) ID() (id uint32, exists bool)

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

func (*AllTypesMutation) IDs

func (m *AllTypesMutation) IDs(ctx context.Context) ([]uint32, 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 (*AllTypesMutation) Int

func (m *AllTypesMutation) Int() (r int, exists bool)

Int returns the value of the "int" field in the mutation.

func (*AllTypesMutation) Int16

func (m *AllTypesMutation) Int16() (r int16, exists bool)

Int16 returns the value of the "int16" field in the mutation.

func (*AllTypesMutation) Int32

func (m *AllTypesMutation) Int32() (r int32, exists bool)

Int32 returns the value of the "int32" field in the mutation.

func (*AllTypesMutation) Int64

func (m *AllTypesMutation) Int64() (r int64, exists bool)

Int64 returns the value of the "int64" field in the mutation.

func (*AllTypesMutation) Int8

func (m *AllTypesMutation) Int8() (r int8, exists bool)

Int8 returns the value of the "int8" field in the mutation.

func (*AllTypesMutation) Nilable

func (m *AllTypesMutation) Nilable() (r string, exists bool)

Nilable returns the value of the "nilable" field in the mutation.

func (*AllTypesMutation) OldBool

func (m *AllTypesMutation) OldBool(ctx context.Context) (v bool, err error)

OldBool returns the old "bool" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldBytes

func (m *AllTypesMutation) OldBytes(ctx context.Context) (v []byte, err error)

OldBytes returns the old "bytes" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldField

func (m *AllTypesMutation) 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 (*AllTypesMutation) OldFloat32

func (m *AllTypesMutation) OldFloat32(ctx context.Context) (v float32, err error)

OldFloat32 returns the old "float32" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldFloat64

func (m *AllTypesMutation) OldFloat64(ctx context.Context) (v float64, err error)

OldFloat64 returns the old "float64" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldInt

func (m *AllTypesMutation) OldInt(ctx context.Context) (v int, err error)

OldInt returns the old "int" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldInt16

func (m *AllTypesMutation) OldInt16(ctx context.Context) (v int16, err error)

OldInt16 returns the old "int16" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldInt32

func (m *AllTypesMutation) OldInt32(ctx context.Context) (v int32, err error)

OldInt32 returns the old "int32" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldInt64

func (m *AllTypesMutation) OldInt64(ctx context.Context) (v int64, err error)

OldInt64 returns the old "int64" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldInt8

func (m *AllTypesMutation) OldInt8(ctx context.Context) (v int8, err error)

OldInt8 returns the old "int8" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldNilable

func (m *AllTypesMutation) OldNilable(ctx context.Context) (v *string, err error)

OldNilable returns the old "nilable" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldState

func (m *AllTypesMutation) OldState(ctx context.Context) (v alltypes.State, err error)

OldState returns the old "state" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldStringType

func (m *AllTypesMutation) OldStringType(ctx context.Context) (v string, err error)

OldStringType returns the old "string_type" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldText

func (m *AllTypesMutation) OldText(ctx context.Context) (v string, err error)

OldText returns the old "text" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldTime

func (m *AllTypesMutation) OldTime(ctx context.Context) (v time.Time, err error)

OldTime returns the old "time" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUUID

func (m *AllTypesMutation) OldUUID(ctx context.Context) (v uuid.UUID, err error)

OldUUID returns the old "uuid" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUint

func (m *AllTypesMutation) OldUint(ctx context.Context) (v uint, err error)

OldUint returns the old "uint" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUint16

func (m *AllTypesMutation) OldUint16(ctx context.Context) (v uint16, err error)

OldUint16 returns the old "uint16" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUint32

func (m *AllTypesMutation) OldUint32(ctx context.Context) (v uint32, err error)

OldUint32 returns the old "uint32" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUint64

func (m *AllTypesMutation) OldUint64(ctx context.Context) (v uint64, err error)

OldUint64 returns the old "uint64" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) OldUint8

func (m *AllTypesMutation) OldUint8(ctx context.Context) (v uint8, err error)

OldUint8 returns the old "uint8" field's value of the AllTypes entity. If the AllTypes 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 (*AllTypesMutation) Op

func (m *AllTypesMutation) Op() Op

Op returns the operation name.

func (*AllTypesMutation) RemovedEdges

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

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

func (*AllTypesMutation) RemovedIDs

func (m *AllTypesMutation) 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 (*AllTypesMutation) ResetBool

func (m *AllTypesMutation) ResetBool()

ResetBool resets all changes to the "bool" field.

func (*AllTypesMutation) ResetBytes

func (m *AllTypesMutation) ResetBytes()

ResetBytes resets all changes to the "bytes" field.

func (*AllTypesMutation) ResetEdge

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

func (m *AllTypesMutation) 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 (*AllTypesMutation) ResetFloat32

func (m *AllTypesMutation) ResetFloat32()

ResetFloat32 resets all changes to the "float32" field.

func (*AllTypesMutation) ResetFloat64

func (m *AllTypesMutation) ResetFloat64()

ResetFloat64 resets all changes to the "float64" field.

func (*AllTypesMutation) ResetInt

func (m *AllTypesMutation) ResetInt()

ResetInt resets all changes to the "int" field.

func (*AllTypesMutation) ResetInt16

func (m *AllTypesMutation) ResetInt16()

ResetInt16 resets all changes to the "int16" field.

func (*AllTypesMutation) ResetInt32

func (m *AllTypesMutation) ResetInt32()

ResetInt32 resets all changes to the "int32" field.

func (*AllTypesMutation) ResetInt64

func (m *AllTypesMutation) ResetInt64()

ResetInt64 resets all changes to the "int64" field.

func (*AllTypesMutation) ResetInt8

func (m *AllTypesMutation) ResetInt8()

ResetInt8 resets all changes to the "int8" field.

func (*AllTypesMutation) ResetNilable

func (m *AllTypesMutation) ResetNilable()

ResetNilable resets all changes to the "nilable" field.

func (*AllTypesMutation) ResetState

func (m *AllTypesMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*AllTypesMutation) ResetStringType

func (m *AllTypesMutation) ResetStringType()

ResetStringType resets all changes to the "string_type" field.

func (*AllTypesMutation) ResetText

func (m *AllTypesMutation) ResetText()

ResetText resets all changes to the "text" field.

func (*AllTypesMutation) ResetTime

func (m *AllTypesMutation) ResetTime()

ResetTime resets all changes to the "time" field.

func (*AllTypesMutation) ResetUUID

func (m *AllTypesMutation) ResetUUID()

ResetUUID resets all changes to the "uuid" field.

func (*AllTypesMutation) ResetUint

func (m *AllTypesMutation) ResetUint()

ResetUint resets all changes to the "uint" field.

func (*AllTypesMutation) ResetUint16

func (m *AllTypesMutation) ResetUint16()

ResetUint16 resets all changes to the "uint16" field.

func (*AllTypesMutation) ResetUint32

func (m *AllTypesMutation) ResetUint32()

ResetUint32 resets all changes to the "uint32" field.

func (*AllTypesMutation) ResetUint64

func (m *AllTypesMutation) ResetUint64()

ResetUint64 resets all changes to the "uint64" field.

func (*AllTypesMutation) ResetUint8

func (m *AllTypesMutation) ResetUint8()

ResetUint8 resets all changes to the "uint8" field.

func (*AllTypesMutation) SetBool

func (m *AllTypesMutation) SetBool(b bool)

SetBool sets the "bool" field.

func (*AllTypesMutation) SetBytes

func (m *AllTypesMutation) SetBytes(b []byte)

SetBytes sets the "bytes" field.

func (*AllTypesMutation) SetField

func (m *AllTypesMutation) 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 (*AllTypesMutation) SetFloat32

func (m *AllTypesMutation) SetFloat32(f float32)

SetFloat32 sets the "float32" field.

func (*AllTypesMutation) SetFloat64

func (m *AllTypesMutation) SetFloat64(f float64)

SetFloat64 sets the "float64" field.

func (*AllTypesMutation) SetID

func (m *AllTypesMutation) SetID(id uint32)

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

func (*AllTypesMutation) SetInt

func (m *AllTypesMutation) SetInt(i int)

SetInt sets the "int" field.

func (*AllTypesMutation) SetInt16

func (m *AllTypesMutation) SetInt16(i int16)

SetInt16 sets the "int16" field.

func (*AllTypesMutation) SetInt32

func (m *AllTypesMutation) SetInt32(i int32)

SetInt32 sets the "int32" field.

func (*AllTypesMutation) SetInt64

func (m *AllTypesMutation) SetInt64(i int64)

SetInt64 sets the "int64" field.

func (*AllTypesMutation) SetInt8

func (m *AllTypesMutation) SetInt8(i int8)

SetInt8 sets the "int8" field.

func (*AllTypesMutation) SetNilable

func (m *AllTypesMutation) SetNilable(s string)

SetNilable sets the "nilable" field.

func (*AllTypesMutation) SetOp

func (m *AllTypesMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*AllTypesMutation) SetState

func (m *AllTypesMutation) SetState(a alltypes.State)

SetState sets the "state" field.

func (*AllTypesMutation) SetStringType

func (m *AllTypesMutation) SetStringType(s string)

SetStringType sets the "string_type" field.

func (*AllTypesMutation) SetText

func (m *AllTypesMutation) SetText(s string)

SetText sets the "text" field.

func (*AllTypesMutation) SetTime

func (m *AllTypesMutation) SetTime(t time.Time)

SetTime sets the "time" field.

func (*AllTypesMutation) SetUUID

func (m *AllTypesMutation) SetUUID(u uuid.UUID)

SetUUID sets the "uuid" field.

func (*AllTypesMutation) SetUint

func (m *AllTypesMutation) SetUint(u uint)

SetUint sets the "uint" field.

func (*AllTypesMutation) SetUint16

func (m *AllTypesMutation) SetUint16(u uint16)

SetUint16 sets the "uint16" field.

func (*AllTypesMutation) SetUint32

func (m *AllTypesMutation) SetUint32(u uint32)

SetUint32 sets the "uint32" field.

func (*AllTypesMutation) SetUint64

func (m *AllTypesMutation) SetUint64(u uint64)

SetUint64 sets the "uint64" field.

func (*AllTypesMutation) SetUint8

func (m *AllTypesMutation) SetUint8(u uint8)

SetUint8 sets the "uint8" field.

func (*AllTypesMutation) State

func (m *AllTypesMutation) State() (r alltypes.State, exists bool)

State returns the value of the "state" field in the mutation.

func (*AllTypesMutation) StringType

func (m *AllTypesMutation) StringType() (r string, exists bool)

StringType returns the value of the "string_type" field in the mutation.

func (*AllTypesMutation) Text

func (m *AllTypesMutation) Text() (r string, exists bool)

Text returns the value of the "text" field in the mutation.

func (*AllTypesMutation) Time

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

Time returns the value of the "time" field in the mutation.

func (AllTypesMutation) Tx

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

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

func (*AllTypesMutation) Type

func (m *AllTypesMutation) Type() string

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

func (*AllTypesMutation) UUID

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

UUID returns the value of the "uuid" field in the mutation.

func (*AllTypesMutation) Uint

func (m *AllTypesMutation) Uint() (r uint, exists bool)

Uint returns the value of the "uint" field in the mutation.

func (*AllTypesMutation) Uint16

func (m *AllTypesMutation) Uint16() (r uint16, exists bool)

Uint16 returns the value of the "uint16" field in the mutation.

func (*AllTypesMutation) Uint32

func (m *AllTypesMutation) Uint32() (r uint32, exists bool)

Uint32 returns the value of the "uint32" field in the mutation.

func (*AllTypesMutation) Uint64

func (m *AllTypesMutation) Uint64() (r uint64, exists bool)

Uint64 returns the value of the "uint64" field in the mutation.

func (*AllTypesMutation) Uint8

func (m *AllTypesMutation) Uint8() (r uint8, exists bool)

Uint8 returns the value of the "uint8" field in the mutation.

func (*AllTypesMutation) Where

func (m *AllTypesMutation) Where(ps ...predicate.AllTypes)

Where appends a list predicates to the AllTypesMutation builder.

func (*AllTypesMutation) WhereP

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

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

type AllTypesQuery

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

AllTypesQuery is the builder for querying AllTypes entities.

func (*AllTypesQuery) Aggregate

func (atq *AllTypesQuery) Aggregate(fns ...AggregateFunc) *AllTypesSelect

Aggregate returns a AllTypesSelect configured with the given aggregations.

func (*AllTypesQuery) All

func (atq *AllTypesQuery) All(ctx context.Context) ([]*AllTypes, error)

All executes the query and returns a list of AllTypesSlice.

func (*AllTypesQuery) AllX

func (atq *AllTypesQuery) AllX(ctx context.Context) []*AllTypes

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

func (*AllTypesQuery) Clone

func (atq *AllTypesQuery) Clone() *AllTypesQuery

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

func (*AllTypesQuery) Count

func (atq *AllTypesQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AllTypesQuery) CountX

func (atq *AllTypesQuery) CountX(ctx context.Context) int

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

func (*AllTypesQuery) Exist

func (atq *AllTypesQuery) Exist(ctx context.Context) (bool, error)

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

func (*AllTypesQuery) ExistX

func (atq *AllTypesQuery) ExistX(ctx context.Context) bool

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

func (*AllTypesQuery) First

func (atq *AllTypesQuery) First(ctx context.Context) (*AllTypes, error)

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

func (*AllTypesQuery) FirstID

func (atq *AllTypesQuery) FirstID(ctx context.Context) (id uint32, err error)

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

func (*AllTypesQuery) FirstIDX

func (atq *AllTypesQuery) FirstIDX(ctx context.Context) uint32

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

func (*AllTypesQuery) FirstX

func (atq *AllTypesQuery) FirstX(ctx context.Context) *AllTypes

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

func (*AllTypesQuery) GroupBy

func (atq *AllTypesQuery) GroupBy(field string, fields ...string) *AllTypesGroupBy

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

client.AllTypes.Query().
	GroupBy(alltypes.FieldInt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AllTypesQuery) IDs

func (atq *AllTypesQuery) IDs(ctx context.Context) (ids []uint32, err error)

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

func (*AllTypesQuery) IDsX

func (atq *AllTypesQuery) IDsX(ctx context.Context) []uint32

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

func (*AllTypesQuery) Limit

func (atq *AllTypesQuery) Limit(limit int) *AllTypesQuery

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

func (*AllTypesQuery) Offset

func (atq *AllTypesQuery) Offset(offset int) *AllTypesQuery

Offset to start from.

func (*AllTypesQuery) Only

func (atq *AllTypesQuery) Only(ctx context.Context) (*AllTypes, error)

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

func (*AllTypesQuery) OnlyID

func (atq *AllTypesQuery) OnlyID(ctx context.Context) (id uint32, err error)

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

func (*AllTypesQuery) OnlyIDX

func (atq *AllTypesQuery) OnlyIDX(ctx context.Context) uint32

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

func (*AllTypesQuery) OnlyX

func (atq *AllTypesQuery) OnlyX(ctx context.Context) *AllTypes

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

func (*AllTypesQuery) Order

func (atq *AllTypesQuery) Order(o ...OrderFunc) *AllTypesQuery

Order specifies how the records should be ordered.

func (*AllTypesQuery) Select

func (atq *AllTypesQuery) Select(fields ...string) *AllTypesSelect

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

client.AllTypes.Query().
	Select(alltypes.FieldInt).
	Scan(ctx, &v)

func (*AllTypesQuery) Unique

func (atq *AllTypesQuery) Unique(unique bool) *AllTypesQuery

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

func (atq *AllTypesQuery) Where(ps ...predicate.AllTypes) *AllTypesQuery

Where adds a new predicate for the AllTypesQuery builder.

type AllTypesSelect

type AllTypesSelect struct {
	*AllTypesQuery
	// contains filtered or unexported fields
}

AllTypesSelect is the builder for selecting fields of AllTypes entities.

func (*AllTypesSelect) Aggregate

func (ats *AllTypesSelect) Aggregate(fns ...AggregateFunc) *AllTypesSelect

Aggregate adds the given aggregation functions to the selector query.

func (*AllTypesSelect) Bool

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

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

func (*AllTypesSelect) BoolX

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

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

func (*AllTypesSelect) Bools

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

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

func (*AllTypesSelect) BoolsX

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

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

func (*AllTypesSelect) Float64

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

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

func (*AllTypesSelect) Float64X

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

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

func (*AllTypesSelect) Float64s

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

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

func (*AllTypesSelect) Float64sX

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

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

func (*AllTypesSelect) Int

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

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

func (*AllTypesSelect) IntX

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

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

func (*AllTypesSelect) Ints

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

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

func (*AllTypesSelect) IntsX

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

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

func (*AllTypesSelect) Scan

func (ats *AllTypesSelect) Scan(ctx context.Context, v any) error

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

func (*AllTypesSelect) ScanX

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

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

func (*AllTypesSelect) String

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

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

func (*AllTypesSelect) StringX

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

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

func (*AllTypesSelect) Strings

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

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

func (*AllTypesSelect) StringsX

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

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

type AllTypesSlice

type AllTypesSlice []*AllTypes

AllTypesSlice is a parsable slice of AllTypes.

type AllTypesUpdate

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

AllTypesUpdate is the builder for updating AllTypes entities.

func (*AllTypesUpdate) AddFloat32

func (atu *AllTypesUpdate) AddFloat32(f float32) *AllTypesUpdate

AddFloat32 adds f to the "float32" field.

func (*AllTypesUpdate) AddFloat64

func (atu *AllTypesUpdate) AddFloat64(f float64) *AllTypesUpdate

AddFloat64 adds f to the "float64" field.

func (*AllTypesUpdate) AddInt

func (atu *AllTypesUpdate) AddInt(i int) *AllTypesUpdate

AddInt adds i to the "int" field.

func (*AllTypesUpdate) AddInt16

func (atu *AllTypesUpdate) AddInt16(i int16) *AllTypesUpdate

AddInt16 adds i to the "int16" field.

func (*AllTypesUpdate) AddInt32

func (atu *AllTypesUpdate) AddInt32(i int32) *AllTypesUpdate

AddInt32 adds i to the "int32" field.

func (*AllTypesUpdate) AddInt64

func (atu *AllTypesUpdate) AddInt64(i int64) *AllTypesUpdate

AddInt64 adds i to the "int64" field.

func (*AllTypesUpdate) AddInt8

func (atu *AllTypesUpdate) AddInt8(i int8) *AllTypesUpdate

AddInt8 adds i to the "int8" field.

func (*AllTypesUpdate) AddUint

func (atu *AllTypesUpdate) AddUint(u int) *AllTypesUpdate

AddUint adds u to the "uint" field.

func (*AllTypesUpdate) AddUint16

func (atu *AllTypesUpdate) AddUint16(u int16) *AllTypesUpdate

AddUint16 adds u to the "uint16" field.

func (*AllTypesUpdate) AddUint32

func (atu *AllTypesUpdate) AddUint32(u int32) *AllTypesUpdate

AddUint32 adds u to the "uint32" field.

func (*AllTypesUpdate) AddUint64

func (atu *AllTypesUpdate) AddUint64(u int64) *AllTypesUpdate

AddUint64 adds u to the "uint64" field.

func (*AllTypesUpdate) AddUint8

func (atu *AllTypesUpdate) AddUint8(u int8) *AllTypesUpdate

AddUint8 adds u to the "uint8" field.

func (*AllTypesUpdate) Exec

func (atu *AllTypesUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AllTypesUpdate) ExecX

func (atu *AllTypesUpdate) ExecX(ctx context.Context)

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

func (*AllTypesUpdate) Mutation

func (atu *AllTypesUpdate) Mutation() *AllTypesMutation

Mutation returns the AllTypesMutation object of the builder.

func (*AllTypesUpdate) Save

func (atu *AllTypesUpdate) Save(ctx context.Context) (int, error)

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

func (*AllTypesUpdate) SaveX

func (atu *AllTypesUpdate) SaveX(ctx context.Context) int

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

func (*AllTypesUpdate) SetBool

func (atu *AllTypesUpdate) SetBool(b bool) *AllTypesUpdate

SetBool sets the "bool" field.

func (*AllTypesUpdate) SetBytes

func (atu *AllTypesUpdate) SetBytes(b []byte) *AllTypesUpdate

SetBytes sets the "bytes" field.

func (*AllTypesUpdate) SetFloat32

func (atu *AllTypesUpdate) SetFloat32(f float32) *AllTypesUpdate

SetFloat32 sets the "float32" field.

func (*AllTypesUpdate) SetFloat64

func (atu *AllTypesUpdate) SetFloat64(f float64) *AllTypesUpdate

SetFloat64 sets the "float64" field.

func (*AllTypesUpdate) SetInt

func (atu *AllTypesUpdate) SetInt(i int) *AllTypesUpdate

SetInt sets the "int" field.

func (*AllTypesUpdate) SetInt16

func (atu *AllTypesUpdate) SetInt16(i int16) *AllTypesUpdate

SetInt16 sets the "int16" field.

func (*AllTypesUpdate) SetInt32

func (atu *AllTypesUpdate) SetInt32(i int32) *AllTypesUpdate

SetInt32 sets the "int32" field.

func (*AllTypesUpdate) SetInt64

func (atu *AllTypesUpdate) SetInt64(i int64) *AllTypesUpdate

SetInt64 sets the "int64" field.

func (*AllTypesUpdate) SetInt8

func (atu *AllTypesUpdate) SetInt8(i int8) *AllTypesUpdate

SetInt8 sets the "int8" field.

func (*AllTypesUpdate) SetNilable

func (atu *AllTypesUpdate) SetNilable(s string) *AllTypesUpdate

SetNilable sets the "nilable" field.

func (*AllTypesUpdate) SetState

func (atu *AllTypesUpdate) SetState(a alltypes.State) *AllTypesUpdate

SetState sets the "state" field.

func (*AllTypesUpdate) SetStringType

func (atu *AllTypesUpdate) SetStringType(s string) *AllTypesUpdate

SetStringType sets the "string_type" field.

func (*AllTypesUpdate) SetText

func (atu *AllTypesUpdate) SetText(s string) *AllTypesUpdate

SetText sets the "text" field.

func (*AllTypesUpdate) SetTime

func (atu *AllTypesUpdate) SetTime(t time.Time) *AllTypesUpdate

SetTime sets the "time" field.

func (*AllTypesUpdate) SetUUID

func (atu *AllTypesUpdate) SetUUID(u uuid.UUID) *AllTypesUpdate

SetUUID sets the "uuid" field.

func (*AllTypesUpdate) SetUint

func (atu *AllTypesUpdate) SetUint(u uint) *AllTypesUpdate

SetUint sets the "uint" field.

func (*AllTypesUpdate) SetUint16

func (atu *AllTypesUpdate) SetUint16(u uint16) *AllTypesUpdate

SetUint16 sets the "uint16" field.

func (*AllTypesUpdate) SetUint32

func (atu *AllTypesUpdate) SetUint32(u uint32) *AllTypesUpdate

SetUint32 sets the "uint32" field.

func (*AllTypesUpdate) SetUint64

func (atu *AllTypesUpdate) SetUint64(u uint64) *AllTypesUpdate

SetUint64 sets the "uint64" field.

func (*AllTypesUpdate) SetUint8

func (atu *AllTypesUpdate) SetUint8(u uint8) *AllTypesUpdate

SetUint8 sets the "uint8" field.

func (*AllTypesUpdate) Where

func (atu *AllTypesUpdate) Where(ps ...predicate.AllTypes) *AllTypesUpdate

Where appends a list predicates to the AllTypesUpdate builder.

type AllTypesUpdateOne

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

AllTypesUpdateOne is the builder for updating a single AllTypes entity.

func (*AllTypesUpdateOne) AddFloat32

func (atuo *AllTypesUpdateOne) AddFloat32(f float32) *AllTypesUpdateOne

AddFloat32 adds f to the "float32" field.

func (*AllTypesUpdateOne) AddFloat64

func (atuo *AllTypesUpdateOne) AddFloat64(f float64) *AllTypesUpdateOne

AddFloat64 adds f to the "float64" field.

func (*AllTypesUpdateOne) AddInt

func (atuo *AllTypesUpdateOne) AddInt(i int) *AllTypesUpdateOne

AddInt adds i to the "int" field.

func (*AllTypesUpdateOne) AddInt16

func (atuo *AllTypesUpdateOne) AddInt16(i int16) *AllTypesUpdateOne

AddInt16 adds i to the "int16" field.

func (*AllTypesUpdateOne) AddInt32

func (atuo *AllTypesUpdateOne) AddInt32(i int32) *AllTypesUpdateOne

AddInt32 adds i to the "int32" field.

func (*AllTypesUpdateOne) AddInt64

func (atuo *AllTypesUpdateOne) AddInt64(i int64) *AllTypesUpdateOne

AddInt64 adds i to the "int64" field.

func (*AllTypesUpdateOne) AddInt8

func (atuo *AllTypesUpdateOne) AddInt8(i int8) *AllTypesUpdateOne

AddInt8 adds i to the "int8" field.

func (*AllTypesUpdateOne) AddUint

func (atuo *AllTypesUpdateOne) AddUint(u int) *AllTypesUpdateOne

AddUint adds u to the "uint" field.

func (*AllTypesUpdateOne) AddUint16

func (atuo *AllTypesUpdateOne) AddUint16(u int16) *AllTypesUpdateOne

AddUint16 adds u to the "uint16" field.

func (*AllTypesUpdateOne) AddUint32

func (atuo *AllTypesUpdateOne) AddUint32(u int32) *AllTypesUpdateOne

AddUint32 adds u to the "uint32" field.

func (*AllTypesUpdateOne) AddUint64

func (atuo *AllTypesUpdateOne) AddUint64(u int64) *AllTypesUpdateOne

AddUint64 adds u to the "uint64" field.

func (*AllTypesUpdateOne) AddUint8

func (atuo *AllTypesUpdateOne) AddUint8(u int8) *AllTypesUpdateOne

AddUint8 adds u to the "uint8" field.

func (*AllTypesUpdateOne) Exec

func (atuo *AllTypesUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AllTypesUpdateOne) ExecX

func (atuo *AllTypesUpdateOne) ExecX(ctx context.Context)

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

func (*AllTypesUpdateOne) Mutation

func (atuo *AllTypesUpdateOne) Mutation() *AllTypesMutation

Mutation returns the AllTypesMutation object of the builder.

func (*AllTypesUpdateOne) Save

func (atuo *AllTypesUpdateOne) Save(ctx context.Context) (*AllTypes, error)

Save executes the query and returns the updated AllTypes entity.

func (*AllTypesUpdateOne) SaveX

func (atuo *AllTypesUpdateOne) SaveX(ctx context.Context) *AllTypes

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

func (*AllTypesUpdateOne) Select

func (atuo *AllTypesUpdateOne) Select(field string, fields ...string) *AllTypesUpdateOne

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

func (*AllTypesUpdateOne) SetBool

func (atuo *AllTypesUpdateOne) SetBool(b bool) *AllTypesUpdateOne

SetBool sets the "bool" field.

func (*AllTypesUpdateOne) SetBytes

func (atuo *AllTypesUpdateOne) SetBytes(b []byte) *AllTypesUpdateOne

SetBytes sets the "bytes" field.

func (*AllTypesUpdateOne) SetFloat32

func (atuo *AllTypesUpdateOne) SetFloat32(f float32) *AllTypesUpdateOne

SetFloat32 sets the "float32" field.

func (*AllTypesUpdateOne) SetFloat64

func (atuo *AllTypesUpdateOne) SetFloat64(f float64) *AllTypesUpdateOne

SetFloat64 sets the "float64" field.

func (*AllTypesUpdateOne) SetInt

func (atuo *AllTypesUpdateOne) SetInt(i int) *AllTypesUpdateOne

SetInt sets the "int" field.

func (*AllTypesUpdateOne) SetInt16

func (atuo *AllTypesUpdateOne) SetInt16(i int16) *AllTypesUpdateOne

SetInt16 sets the "int16" field.

func (*AllTypesUpdateOne) SetInt32

func (atuo *AllTypesUpdateOne) SetInt32(i int32) *AllTypesUpdateOne

SetInt32 sets the "int32" field.

func (*AllTypesUpdateOne) SetInt64

func (atuo *AllTypesUpdateOne) SetInt64(i int64) *AllTypesUpdateOne

SetInt64 sets the "int64" field.

func (*AllTypesUpdateOne) SetInt8

func (atuo *AllTypesUpdateOne) SetInt8(i int8) *AllTypesUpdateOne

SetInt8 sets the "int8" field.

func (*AllTypesUpdateOne) SetNilable

func (atuo *AllTypesUpdateOne) SetNilable(s string) *AllTypesUpdateOne

SetNilable sets the "nilable" field.

func (*AllTypesUpdateOne) SetState

SetState sets the "state" field.

func (*AllTypesUpdateOne) SetStringType

func (atuo *AllTypesUpdateOne) SetStringType(s string) *AllTypesUpdateOne

SetStringType sets the "string_type" field.

func (*AllTypesUpdateOne) SetText

func (atuo *AllTypesUpdateOne) SetText(s string) *AllTypesUpdateOne

SetText sets the "text" field.

func (*AllTypesUpdateOne) SetTime

func (atuo *AllTypesUpdateOne) SetTime(t time.Time) *AllTypesUpdateOne

SetTime sets the "time" field.

func (*AllTypesUpdateOne) SetUUID

func (atuo *AllTypesUpdateOne) SetUUID(u uuid.UUID) *AllTypesUpdateOne

SetUUID sets the "uuid" field.

func (*AllTypesUpdateOne) SetUint

func (atuo *AllTypesUpdateOne) SetUint(u uint) *AllTypesUpdateOne

SetUint sets the "uint" field.

func (*AllTypesUpdateOne) SetUint16

func (atuo *AllTypesUpdateOne) SetUint16(u uint16) *AllTypesUpdateOne

SetUint16 sets the "uint16" field.

func (*AllTypesUpdateOne) SetUint32

func (atuo *AllTypesUpdateOne) SetUint32(u uint32) *AllTypesUpdateOne

SetUint32 sets the "uint32" field.

func (*AllTypesUpdateOne) SetUint64

func (atuo *AllTypesUpdateOne) SetUint64(u uint64) *AllTypesUpdateOne

SetUint64 sets the "uint64" field.

func (*AllTypesUpdateOne) SetUint8

func (atuo *AllTypesUpdateOne) SetUint8(u uint8) *AllTypesUpdateOne

SetUint8 sets the "uint8" field.

func (*AllTypesUpdateOne) Where

Where appends a list predicates to the AllTypesUpdate builder.

type Categories

type Categories []*Category

Categories is a parsable slice of Category.

type Category

type Category struct {

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

Category is the model entity for the Category schema.

func (*Category) QueryPets

func (c *Category) QueryPets() *PetQuery

QueryPets queries the "pets" edge of the Category entity.

func (*Category) String

func (c *Category) String() string

String implements the fmt.Stringer.

func (*Category) Unwrap

func (c *Category) Unwrap() *Category

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

func (*Category) Update

func (c *Category) Update() *CategoryUpdateOne

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

type CategoryClient

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

CategoryClient is a client for the Category schema.

func NewCategoryClient

func NewCategoryClient(c config) *CategoryClient

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

func (*CategoryClient) Create

func (c *CategoryClient) Create() *CategoryCreate

Create returns a builder for creating a Category entity.

func (*CategoryClient) CreateBulk

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

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

func (*CategoryClient) Delete

func (c *CategoryClient) Delete() *CategoryDelete

Delete returns a delete builder for Category.

func (*CategoryClient) DeleteOne

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

DeleteOne returns a builder for deleting the given entity.

func (*CategoryClient) DeleteOneID

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

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

func (*CategoryClient) Get

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

Get returns a Category entity by its id.

func (*CategoryClient) GetX

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

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

func (*CategoryClient) Hooks

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

Hooks returns the client hooks.

func (*CategoryClient) Intercept

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

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

func (*CategoryClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CategoryClient) Query

func (c *CategoryClient) Query() *CategoryQuery

Query returns a query builder for Category.

func (*CategoryClient) QueryPets

func (c *CategoryClient) QueryPets(ca *Category) *PetQuery

QueryPets queries the pets edge of a Category.

func (*CategoryClient) Update

func (c *CategoryClient) Update() *CategoryUpdate

Update returns an update builder for Category.

func (*CategoryClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*CategoryClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*CategoryClient) Use

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

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

type CategoryCreate

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

CategoryCreate is the builder for creating a Category entity.

func (*CategoryCreate) AddPetIDs

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

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*CategoryCreate) AddPets

func (cc *CategoryCreate) AddPets(p ...*Pet) *CategoryCreate

AddPets adds the "pets" edges to the Pet entity.

func (*CategoryCreate) Exec

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

Exec executes the query.

func (*CategoryCreate) ExecX

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

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

func (*CategoryCreate) Mutation

func (cc *CategoryCreate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryCreate) Save

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

Save creates the Category in the database.

func (*CategoryCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*CategoryCreate) SetName

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

SetName sets the "name" field.

func (*CategoryCreate) SetNillableReadonly

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

SetNillableReadonly sets the "readonly" field if the given value is not nil.

func (*CategoryCreate) SetReadonly

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

SetReadonly sets the "readonly" field.

type CategoryCreateBulk

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

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

func (*CategoryCreateBulk) Exec

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

Exec executes the query.

func (*CategoryCreateBulk) ExecX

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

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

func (*CategoryCreateBulk) Save

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

Save creates the Category entities in the database.

func (*CategoryCreateBulk) SaveX

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

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

type CategoryDelete

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

CategoryDelete is the builder for deleting a Category entity.

func (*CategoryDelete) Exec

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

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

func (*CategoryDelete) ExecX

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

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

func (*CategoryDelete) Where

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

Where appends a list predicates to the CategoryDelete builder.

type CategoryDeleteOne

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

CategoryDeleteOne is the builder for deleting a single Category entity.

func (*CategoryDeleteOne) Exec

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

Exec executes the deletion query.

func (*CategoryDeleteOne) ExecX

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

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

func (*CategoryDeleteOne) Where

Where appends a list predicates to the CategoryDelete builder.

type CategoryEdges

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

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

func (CategoryEdges) PetsOrErr

func (e CategoryEdges) PetsOrErr() ([]*Pet, error)

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

type CategoryGroupBy

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

CategoryGroupBy is the group-by builder for Category entities.

func (*CategoryGroupBy) Aggregate

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

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

func (*CategoryGroupBy) Bool

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

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

func (*CategoryGroupBy) BoolX

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

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

func (*CategoryGroupBy) Bools

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

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

func (*CategoryGroupBy) BoolsX

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

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

func (*CategoryGroupBy) Float64

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

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

func (*CategoryGroupBy) Float64X

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

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

func (*CategoryGroupBy) Float64s

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

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

func (*CategoryGroupBy) Float64sX

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

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

func (*CategoryGroupBy) Int

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

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

func (*CategoryGroupBy) IntX

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

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

func (*CategoryGroupBy) Ints

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

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

func (*CategoryGroupBy) IntsX

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

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

func (*CategoryGroupBy) Scan

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

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

func (*CategoryGroupBy) ScanX

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

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

func (*CategoryGroupBy) String

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

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

func (*CategoryGroupBy) StringX

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

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

func (*CategoryGroupBy) Strings

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

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

func (*CategoryGroupBy) StringsX

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

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

type CategoryMutation

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

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

func (*CategoryMutation) AddField

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

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

func (*CategoryMutation) AddPetIDs

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

AddPetIDs adds the "pets" edge to the Pet entity by ids.

func (*CategoryMutation) AddedEdges

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

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

func (*CategoryMutation) AddedField

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

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

func (*CategoryMutation) AddedFields

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

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

func (*CategoryMutation) AddedIDs

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

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

func (*CategoryMutation) ClearEdge

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

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

func (*CategoryMutation) ClearField

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

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

func (*CategoryMutation) ClearPets

func (m *CategoryMutation) ClearPets()

ClearPets clears the "pets" edge to the Pet entity.

func (*CategoryMutation) ClearReadonly

func (m *CategoryMutation) ClearReadonly()

ClearReadonly clears the value of the "readonly" field.

func (*CategoryMutation) ClearedEdges

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

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

func (*CategoryMutation) ClearedFields

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

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

func (CategoryMutation) Client

func (m CategoryMutation) Client() *Client

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

func (*CategoryMutation) EdgeCleared

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

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

func (*CategoryMutation) Field

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

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

func (*CategoryMutation) FieldCleared

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

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

func (*CategoryMutation) Fields

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

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

func (*CategoryMutation) ID

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

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

func (*CategoryMutation) IDs

func (m *CategoryMutation) IDs(ctx context.Context) ([]int, 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 (*CategoryMutation) Name

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

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

func (*CategoryMutation) OldField

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

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

func (*CategoryMutation) OldName

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

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

func (*CategoryMutation) OldReadonly

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

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

func (*CategoryMutation) Op

func (m *CategoryMutation) Op() Op

Op returns the operation name.

func (*CategoryMutation) PetsCleared

func (m *CategoryMutation) PetsCleared() bool

PetsCleared reports if the "pets" edge to the Pet entity was cleared.

func (*CategoryMutation) PetsIDs

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

PetsIDs returns the "pets" edge IDs in the mutation.

func (*CategoryMutation) Readonly

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

Readonly returns the value of the "readonly" field in the mutation.

func (*CategoryMutation) ReadonlyCleared

func (m *CategoryMutation) ReadonlyCleared() bool

ReadonlyCleared returns if the "readonly" field was cleared in this mutation.

func (*CategoryMutation) RemovePetIDs

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

RemovePetIDs removes the "pets" edge to the Pet entity by IDs.

func (*CategoryMutation) RemovedEdges

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

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

func (*CategoryMutation) RemovedIDs

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

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

func (*CategoryMutation) RemovedPetsIDs

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

RemovedPets returns the removed IDs of the "pets" edge to the Pet entity.

func (*CategoryMutation) ResetEdge

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

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

func (*CategoryMutation) ResetField

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

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

func (*CategoryMutation) ResetName

func (m *CategoryMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CategoryMutation) ResetPets

func (m *CategoryMutation) ResetPets()

ResetPets resets all changes to the "pets" edge.

func (*CategoryMutation) ResetReadonly

func (m *CategoryMutation) ResetReadonly()

ResetReadonly resets all changes to the "readonly" field.

func (*CategoryMutation) SetField

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

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

func (*CategoryMutation) SetName

func (m *CategoryMutation) SetName(s string)

SetName sets the "name" field.

func (*CategoryMutation) SetOp

func (m *CategoryMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CategoryMutation) SetReadonly

func (m *CategoryMutation) SetReadonly(s string)

SetReadonly sets the "readonly" field.

func (CategoryMutation) Tx

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

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

func (*CategoryMutation) Type

func (m *CategoryMutation) Type() string

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

func (*CategoryMutation) Where

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

Where appends a list predicates to the CategoryMutation builder.

func (*CategoryMutation) WhereP

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

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

type CategoryQuery

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

CategoryQuery is the builder for querying Category entities.

func (*CategoryQuery) Aggregate

func (cq *CategoryQuery) Aggregate(fns ...AggregateFunc) *CategorySelect

Aggregate returns a CategorySelect configured with the given aggregations.

func (*CategoryQuery) All

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

All executes the query and returns a list of Categories.

func (*CategoryQuery) AllX

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

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

func (*CategoryQuery) Clone

func (cq *CategoryQuery) Clone() *CategoryQuery

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

func (*CategoryQuery) Count

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

Count returns the count of the given query.

func (*CategoryQuery) CountX

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

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

func (*CategoryQuery) Exist

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

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

func (*CategoryQuery) ExistX

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

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

func (*CategoryQuery) First

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

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

func (*CategoryQuery) FirstID

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

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

func (*CategoryQuery) FirstIDX

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

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

func (*CategoryQuery) FirstX

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

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

func (*CategoryQuery) GroupBy

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

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

Example:

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

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

func (*CategoryQuery) IDs

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

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

func (*CategoryQuery) IDsX

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

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

func (*CategoryQuery) Limit

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

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

func (*CategoryQuery) Offset

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

Offset to start from.

func (*CategoryQuery) Only

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

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

func (*CategoryQuery) OnlyID

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

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

func (*CategoryQuery) OnlyIDX

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

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

func (*CategoryQuery) OnlyX

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

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

func (*CategoryQuery) Order

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

Order specifies how the records should be ordered.

func (*CategoryQuery) QueryPets

func (cq *CategoryQuery) QueryPets() *PetQuery

QueryPets chains the current query on the "pets" edge.

func (*CategoryQuery) Select

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

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

Example:

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

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

func (*CategoryQuery) Unique

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

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

func (*CategoryQuery) Where

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

Where adds a new predicate for the CategoryQuery builder.

func (*CategoryQuery) WithPets

func (cq *CategoryQuery) WithPets(opts ...func(*PetQuery)) *CategoryQuery

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

type CategorySelect

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

CategorySelect is the builder for selecting fields of Category entities.

func (*CategorySelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*CategorySelect) Bool

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

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

func (*CategorySelect) BoolX

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

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

func (*CategorySelect) Bools

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

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

func (*CategorySelect) BoolsX

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

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

func (*CategorySelect) Float64

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

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

func (*CategorySelect) Float64X

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

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

func (*CategorySelect) Float64s

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

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

func (*CategorySelect) Float64sX

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

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

func (*CategorySelect) Int

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

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

func (*CategorySelect) IntX

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

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

func (*CategorySelect) Ints

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

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

func (*CategorySelect) IntsX

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

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

func (*CategorySelect) Scan

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

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

func (*CategorySelect) ScanX

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

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

func (*CategorySelect) String

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

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

func (*CategorySelect) StringX

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

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

func (*CategorySelect) Strings

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

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

func (*CategorySelect) StringsX

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

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

type CategoryUpdate

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

CategoryUpdate is the builder for updating Category entities.

func (*CategoryUpdate) AddPetIDs

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

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*CategoryUpdate) AddPets

func (cu *CategoryUpdate) AddPets(p ...*Pet) *CategoryUpdate

AddPets adds the "pets" edges to the Pet entity.

func (*CategoryUpdate) ClearPets

func (cu *CategoryUpdate) ClearPets() *CategoryUpdate

ClearPets clears all "pets" edges to the Pet entity.

func (*CategoryUpdate) ClearReadonly

func (cu *CategoryUpdate) ClearReadonly() *CategoryUpdate

ClearReadonly clears the value of the "readonly" field.

func (*CategoryUpdate) Exec

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

Exec executes the query.

func (*CategoryUpdate) ExecX

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

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

func (*CategoryUpdate) Mutation

func (cu *CategoryUpdate) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdate) RemovePetIDs

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

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*CategoryUpdate) RemovePets

func (cu *CategoryUpdate) RemovePets(p ...*Pet) *CategoryUpdate

RemovePets removes "pets" edges to Pet entities.

func (*CategoryUpdate) Save

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

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

func (*CategoryUpdate) SaveX

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

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

func (*CategoryUpdate) SetName

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

SetName sets the "name" field.

func (*CategoryUpdate) SetNillableReadonly

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

SetNillableReadonly sets the "readonly" field if the given value is not nil.

func (*CategoryUpdate) SetReadonly

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

SetReadonly sets the "readonly" field.

func (*CategoryUpdate) Where

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

Where appends a list predicates to the CategoryUpdate builder.

type CategoryUpdateOne

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

CategoryUpdateOne is the builder for updating a single Category entity.

func (*CategoryUpdateOne) AddPetIDs

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

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*CategoryUpdateOne) AddPets

func (cuo *CategoryUpdateOne) AddPets(p ...*Pet) *CategoryUpdateOne

AddPets adds the "pets" edges to the Pet entity.

func (*CategoryUpdateOne) ClearPets

func (cuo *CategoryUpdateOne) ClearPets() *CategoryUpdateOne

ClearPets clears all "pets" edges to the Pet entity.

func (*CategoryUpdateOne) ClearReadonly

func (cuo *CategoryUpdateOne) ClearReadonly() *CategoryUpdateOne

ClearReadonly clears the value of the "readonly" field.

func (*CategoryUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CategoryUpdateOne) ExecX

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

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

func (*CategoryUpdateOne) Mutation

func (cuo *CategoryUpdateOne) Mutation() *CategoryMutation

Mutation returns the CategoryMutation object of the builder.

func (*CategoryUpdateOne) RemovePetIDs

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

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*CategoryUpdateOne) RemovePets

func (cuo *CategoryUpdateOne) RemovePets(p ...*Pet) *CategoryUpdateOne

RemovePets removes "pets" edges to Pet entities.

func (*CategoryUpdateOne) Save

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

Save executes the query and returns the updated Category entity.

func (*CategoryUpdateOne) SaveX

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

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

func (*CategoryUpdateOne) Select

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

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

func (*CategoryUpdateOne) SetName

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

SetName sets the "name" field.

func (*CategoryUpdateOne) SetNillableReadonly

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

SetNillableReadonly sets the "readonly" field if the given value is not nil.

func (*CategoryUpdateOne) SetReadonly

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

SetReadonly sets the "readonly" field.

func (*CategoryUpdateOne) Where

Where appends a list predicates to the CategoryUpdate builder.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// AllTypes is the client for interacting with the AllTypes builders.
	AllTypes *AllTypesClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Hat is the client for interacting with the Hat builders.
	Hat *HatClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	AllTypes.
	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 Hat

type Hat struct {

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

Hat is the model entity for the Hat schema.

func (*Hat) QueryWearer

func (h *Hat) QueryWearer() *UserQuery

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

func (*Hat) String

func (h *Hat) String() string

String implements the fmt.Stringer.

func (*Hat) Unwrap

func (h *Hat) Unwrap() *Hat

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

func (h *Hat) Update() *HatUpdateOne

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

type HatClient

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

HatClient is a client for the Hat schema.

func NewHatClient

func NewHatClient(c config) *HatClient

NewHatClient returns a client for the Hat from the given config.

func (*HatClient) Create

func (c *HatClient) Create() *HatCreate

Create returns a builder for creating a Hat entity.

func (*HatClient) CreateBulk

func (c *HatClient) CreateBulk(builders ...*HatCreate) *HatCreateBulk

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

func (*HatClient) Delete

func (c *HatClient) Delete() *HatDelete

Delete returns a delete builder for Hat.

func (*HatClient) DeleteOne

func (c *HatClient) DeleteOne(h *Hat) *HatDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*HatClient) DeleteOneID

func (c *HatClient) DeleteOneID(id int) *HatDeleteOne

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

func (*HatClient) Get

func (c *HatClient) Get(ctx context.Context, id int) (*Hat, error)

Get returns a Hat entity by its id.

func (*HatClient) GetX

func (c *HatClient) GetX(ctx context.Context, id int) *Hat

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

func (*HatClient) Hooks

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

Hooks returns the client hooks.

func (*HatClient) Intercept

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

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

func (*HatClient) Interceptors

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

Interceptors returns the client interceptors.

func (*HatClient) Query

func (c *HatClient) Query() *HatQuery

Query returns a query builder for Hat.

func (*HatClient) QueryWearer

func (c *HatClient) QueryWearer(h *Hat) *UserQuery

QueryWearer queries the wearer edge of a Hat.

func (*HatClient) Update

func (c *HatClient) Update() *HatUpdate

Update returns an update builder for Hat.

func (*HatClient) UpdateOne

func (c *HatClient) UpdateOne(h *Hat) *HatUpdateOne

UpdateOne returns an update builder for the given entity.

func (*HatClient) UpdateOneID

func (c *HatClient) UpdateOneID(id int) *HatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*HatClient) Use

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

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

type HatCreate

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

HatCreate is the builder for creating a Hat entity.

func (*HatCreate) Exec

func (hc *HatCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*HatCreate) ExecX

func (hc *HatCreate) ExecX(ctx context.Context)

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

func (*HatCreate) Mutation

func (hc *HatCreate) Mutation() *HatMutation

Mutation returns the HatMutation object of the builder.

func (*HatCreate) Save

func (hc *HatCreate) Save(ctx context.Context) (*Hat, error)

Save creates the Hat in the database.

func (*HatCreate) SaveX

func (hc *HatCreate) SaveX(ctx context.Context) *Hat

SaveX calls Save and panics if Save returns an error.

func (*HatCreate) SetName

func (hc *HatCreate) SetName(s string) *HatCreate

SetName sets the "name" field.

func (*HatCreate) SetNillableWearerID

func (hc *HatCreate) SetNillableWearerID(id *int) *HatCreate

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

func (*HatCreate) SetType

func (hc *HatCreate) SetType(h hat.Type) *HatCreate

SetType sets the "type" field.

func (*HatCreate) SetWearer

func (hc *HatCreate) SetWearer(u *User) *HatCreate

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

func (*HatCreate) SetWearerID

func (hc *HatCreate) SetWearerID(id int) *HatCreate

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

type HatCreateBulk

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

HatCreateBulk is the builder for creating many Hat entities in bulk.

func (*HatCreateBulk) Exec

func (hcb *HatCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*HatCreateBulk) ExecX

func (hcb *HatCreateBulk) ExecX(ctx context.Context)

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

func (*HatCreateBulk) Save

func (hcb *HatCreateBulk) Save(ctx context.Context) ([]*Hat, error)

Save creates the Hat entities in the database.

func (*HatCreateBulk) SaveX

func (hcb *HatCreateBulk) SaveX(ctx context.Context) []*Hat

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

type HatDelete

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

HatDelete is the builder for deleting a Hat entity.

func (*HatDelete) Exec

func (hd *HatDelete) Exec(ctx context.Context) (int, error)

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

func (*HatDelete) ExecX

func (hd *HatDelete) ExecX(ctx context.Context) int

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

func (*HatDelete) Where

func (hd *HatDelete) Where(ps ...predicate.Hat) *HatDelete

Where appends a list predicates to the HatDelete builder.

type HatDeleteOne

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

HatDeleteOne is the builder for deleting a single Hat entity.

func (*HatDeleteOne) Exec

func (hdo *HatDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*HatDeleteOne) ExecX

func (hdo *HatDeleteOne) ExecX(ctx context.Context)

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

func (*HatDeleteOne) Where

func (hdo *HatDeleteOne) Where(ps ...predicate.Hat) *HatDeleteOne

Where appends a list predicates to the HatDelete builder.

type HatEdges

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

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

func (HatEdges) WearerOrErr

func (e HatEdges) WearerOrErr() (*User, error)

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

type HatGroupBy

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

HatGroupBy is the group-by builder for Hat entities.

func (*HatGroupBy) Aggregate

func (hgb *HatGroupBy) Aggregate(fns ...AggregateFunc) *HatGroupBy

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

func (*HatGroupBy) Bool

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

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

func (*HatGroupBy) BoolX

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

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

func (*HatGroupBy) Bools

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

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

func (*HatGroupBy) BoolsX

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

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

func (*HatGroupBy) Float64

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

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

func (*HatGroupBy) Float64X

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

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

func (*HatGroupBy) Float64s

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

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

func (*HatGroupBy) Float64sX

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

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

func (*HatGroupBy) Int

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

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

func (*HatGroupBy) IntX

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

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

func (*HatGroupBy) Ints

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

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

func (*HatGroupBy) IntsX

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

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

func (*HatGroupBy) Scan

func (hgb *HatGroupBy) Scan(ctx context.Context, v any) error

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

func (*HatGroupBy) ScanX

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

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

func (*HatGroupBy) String

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

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

func (*HatGroupBy) StringX

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

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

func (*HatGroupBy) Strings

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

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

func (*HatGroupBy) StringsX

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

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

type HatMutation

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

HatMutation represents an operation that mutates the Hat nodes in the graph.

func (*HatMutation) AddField

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

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

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

func (*HatMutation) AddedField

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

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

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

func (*HatMutation) AddedIDs

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

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

func (*HatMutation) ClearEdge

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

func (m *HatMutation) 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 (*HatMutation) ClearWearer

func (m *HatMutation) ClearWearer()

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

func (*HatMutation) ClearedEdges

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

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

func (*HatMutation) ClearedFields

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

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

func (HatMutation) Client

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

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

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

func (*HatMutation) Field

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

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

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

func (*HatMutation) Fields

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

func (m *HatMutation) GetType() (r hat.Type, exists bool)

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

func (*HatMutation) ID

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

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

func (*HatMutation) IDs

func (m *HatMutation) IDs(ctx context.Context) ([]int, 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 (*HatMutation) Name

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

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

func (*HatMutation) OldField

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

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

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

func (m *HatMutation) OldType(ctx context.Context) (v hat.Type, err error)

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

func (m *HatMutation) Op() Op

Op returns the operation name.

func (*HatMutation) RemovedEdges

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

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

func (*HatMutation) RemovedIDs

func (m *HatMutation) 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 (*HatMutation) ResetEdge

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

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

func (m *HatMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*HatMutation) ResetType

func (m *HatMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*HatMutation) ResetWearer

func (m *HatMutation) ResetWearer()

ResetWearer resets all changes to the "wearer" edge.

func (*HatMutation) SetField

func (m *HatMutation) 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 (*HatMutation) SetName

func (m *HatMutation) SetName(s string)

SetName sets the "name" field.

func (*HatMutation) SetOp

func (m *HatMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*HatMutation) SetType

func (m *HatMutation) SetType(h hat.Type)

SetType sets the "type" field.

func (*HatMutation) SetWearerID

func (m *HatMutation) SetWearerID(id int)

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

func (HatMutation) Tx

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

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

func (*HatMutation) Type

func (m *HatMutation) Type() string

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

func (*HatMutation) WearerCleared

func (m *HatMutation) WearerCleared() bool

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

func (*HatMutation) WearerID

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

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

func (*HatMutation) WearerIDs

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

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

func (*HatMutation) Where

func (m *HatMutation) Where(ps ...predicate.Hat)

Where appends a list predicates to the HatMutation builder.

func (*HatMutation) WhereP

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

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

type HatQuery

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

HatQuery is the builder for querying Hat entities.

func (*HatQuery) Aggregate

func (hq *HatQuery) Aggregate(fns ...AggregateFunc) *HatSelect

Aggregate returns a HatSelect configured with the given aggregations.

func (*HatQuery) All

func (hq *HatQuery) All(ctx context.Context) ([]*Hat, error)

All executes the query and returns a list of Hats.

func (*HatQuery) AllX

func (hq *HatQuery) AllX(ctx context.Context) []*Hat

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

func (*HatQuery) Clone

func (hq *HatQuery) Clone() *HatQuery

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

func (*HatQuery) Count

func (hq *HatQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*HatQuery) CountX

func (hq *HatQuery) CountX(ctx context.Context) int

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

func (*HatQuery) Exist

func (hq *HatQuery) Exist(ctx context.Context) (bool, error)

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

func (*HatQuery) ExistX

func (hq *HatQuery) ExistX(ctx context.Context) bool

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

func (*HatQuery) First

func (hq *HatQuery) First(ctx context.Context) (*Hat, error)

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

func (*HatQuery) FirstID

func (hq *HatQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*HatQuery) FirstIDX

func (hq *HatQuery) FirstIDX(ctx context.Context) int

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

func (*HatQuery) FirstX

func (hq *HatQuery) FirstX(ctx context.Context) *Hat

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

func (*HatQuery) GroupBy

func (hq *HatQuery) GroupBy(field string, fields ...string) *HatGroupBy

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

Example:

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

client.Hat.Query().
	GroupBy(hat.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*HatQuery) IDs

func (hq *HatQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*HatQuery) IDsX

func (hq *HatQuery) IDsX(ctx context.Context) []int

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

func (*HatQuery) Limit

func (hq *HatQuery) Limit(limit int) *HatQuery

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

func (*HatQuery) Offset

func (hq *HatQuery) Offset(offset int) *HatQuery

Offset to start from.

func (*HatQuery) Only

func (hq *HatQuery) Only(ctx context.Context) (*Hat, error)

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

func (*HatQuery) OnlyID

func (hq *HatQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*HatQuery) OnlyIDX

func (hq *HatQuery) OnlyIDX(ctx context.Context) int

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

func (*HatQuery) OnlyX

func (hq *HatQuery) OnlyX(ctx context.Context) *Hat

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

func (*HatQuery) Order

func (hq *HatQuery) Order(o ...OrderFunc) *HatQuery

Order specifies how the records should be ordered.

func (*HatQuery) QueryWearer

func (hq *HatQuery) QueryWearer() *UserQuery

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

func (*HatQuery) Select

func (hq *HatQuery) Select(fields ...string) *HatSelect

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

Example:

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

client.Hat.Query().
	Select(hat.FieldName).
	Scan(ctx, &v)

func (*HatQuery) Unique

func (hq *HatQuery) Unique(unique bool) *HatQuery

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

func (hq *HatQuery) Where(ps ...predicate.Hat) *HatQuery

Where adds a new predicate for the HatQuery builder.

func (*HatQuery) WithWearer

func (hq *HatQuery) WithWearer(opts ...func(*UserQuery)) *HatQuery

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

type HatSelect

type HatSelect struct {
	*HatQuery
	// contains filtered or unexported fields
}

HatSelect is the builder for selecting fields of Hat entities.

func (*HatSelect) Aggregate

func (hs *HatSelect) Aggregate(fns ...AggregateFunc) *HatSelect

Aggregate adds the given aggregation functions to the selector query.

func (*HatSelect) Bool

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

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

func (*HatSelect) BoolX

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

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

func (*HatSelect) Bools

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

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

func (*HatSelect) BoolsX

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

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

func (*HatSelect) Float64

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

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

func (*HatSelect) Float64X

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

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

func (*HatSelect) Float64s

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

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

func (*HatSelect) Float64sX

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

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

func (*HatSelect) Int

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

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

func (*HatSelect) IntX

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

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

func (*HatSelect) Ints

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

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

func (*HatSelect) IntsX

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

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

func (*HatSelect) Scan

func (hs *HatSelect) Scan(ctx context.Context, v any) error

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

func (*HatSelect) ScanX

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

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

func (*HatSelect) String

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

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

func (*HatSelect) StringX

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

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

func (*HatSelect) Strings

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

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

func (*HatSelect) StringsX

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

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

type HatUpdate

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

HatUpdate is the builder for updating Hat entities.

func (*HatUpdate) Exec

func (hu *HatUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*HatUpdate) ExecX

func (hu *HatUpdate) ExecX(ctx context.Context)

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

func (*HatUpdate) Mutation

func (hu *HatUpdate) Mutation() *HatMutation

Mutation returns the HatMutation object of the builder.

func (*HatUpdate) Save

func (hu *HatUpdate) Save(ctx context.Context) (int, error)

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

func (*HatUpdate) SaveX

func (hu *HatUpdate) SaveX(ctx context.Context) int

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

func (*HatUpdate) SetName

func (hu *HatUpdate) SetName(s string) *HatUpdate

SetName sets the "name" field.

func (*HatUpdate) Where

func (hu *HatUpdate) Where(ps ...predicate.Hat) *HatUpdate

Where appends a list predicates to the HatUpdate builder.

type HatUpdateOne

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

HatUpdateOne is the builder for updating a single Hat entity.

func (*HatUpdateOne) Exec

func (huo *HatUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*HatUpdateOne) ExecX

func (huo *HatUpdateOne) ExecX(ctx context.Context)

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

func (*HatUpdateOne) Mutation

func (huo *HatUpdateOne) Mutation() *HatMutation

Mutation returns the HatMutation object of the builder.

func (*HatUpdateOne) Save

func (huo *HatUpdateOne) Save(ctx context.Context) (*Hat, error)

Save executes the query and returns the updated Hat entity.

func (*HatUpdateOne) SaveX

func (huo *HatUpdateOne) SaveX(ctx context.Context) *Hat

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

func (*HatUpdateOne) Select

func (huo *HatUpdateOne) Select(field string, fields ...string) *HatUpdateOne

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

func (*HatUpdateOne) SetName

func (huo *HatUpdateOne) SetName(s string) *HatUpdateOne

SetName sets the "name" field.

func (*HatUpdateOne) Where

func (huo *HatUpdateOne) Where(ps ...predicate.Hat) *HatUpdateOne

Where appends a list predicates to the HatUpdate builder.

type Hats

type Hats []*Hat

Hats is a parsable slice of Hat.

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 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.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Pet

type Pet struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Weight holds the value of the "weight" field.
	Weight int `json:"weight,omitempty"`
	// Birthday holds the value of the "birthday" field.
	Birthday time.Time `json:"birthday,omitempty"`
	// TagID holds the value of the "tag_id" field.
	TagID []byte `json:"tag_id,omitempty"`
	// Height holds the value of the "height" field.
	Height *int `json:"height,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PetQuery when eager-loading is set.
	Edges PetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Pet is the model entity for the Pet schema.

func (*Pet) QueryCategories

func (pe *Pet) QueryCategories() *CategoryQuery

QueryCategories queries the "categories" edge of the Pet entity.

func (*Pet) QueryFriends

func (pe *Pet) QueryFriends() *PetQuery

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

func (*Pet) QueryOwner

func (pe *Pet) QueryOwner() *UserQuery

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

func (*Pet) QueryRescuer

func (pe *Pet) QueryRescuer() *UserQuery

QueryRescuer queries the "rescuer" edge of the Pet entity.

func (*Pet) String

func (pe *Pet) String() string

String implements the fmt.Stringer.

func (*Pet) Unwrap

func (pe *Pet) Unwrap() *Pet

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

func (*Pet) Update

func (pe *Pet) Update() *PetUpdateOne

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

type PetClient

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

PetClient is a client for the Pet schema.

func NewPetClient

func NewPetClient(c config) *PetClient

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

func (*PetClient) Create

func (c *PetClient) Create() *PetCreate

Create returns a builder for creating a Pet entity.

func (*PetClient) CreateBulk

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

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

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

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

DeleteOne returns a builder for deleting the given entity.

func (*PetClient) DeleteOneID

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

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

func (*PetClient) Get

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

Get returns a Pet entity by its id.

func (*PetClient) GetX

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

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

func (*PetClient) Hooks

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

Hooks returns the client hooks.

func (*PetClient) Intercept

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

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

func (*PetClient) Interceptors

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

Interceptors returns the client interceptors.

func (*PetClient) Query

func (c *PetClient) Query() *PetQuery

Query returns a query builder for Pet.

func (*PetClient) QueryCategories

func (c *PetClient) QueryCategories(pe *Pet) *CategoryQuery

QueryCategories queries the categories edge of a Pet.

func (*PetClient) QueryFriends

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

QueryFriends queries the friends edge of a Pet.

func (*PetClient) QueryOwner

func (c *PetClient) QueryOwner(pe *Pet) *UserQuery

QueryOwner queries the owner edge of a Pet.

func (*PetClient) QueryRescuer

func (c *PetClient) QueryRescuer(pe *Pet) *UserQuery

QueryRescuer queries the rescuer edge of a Pet.

func (*PetClient) Update

func (c *PetClient) Update() *PetUpdate

Update returns an update builder for Pet.

func (*PetClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*PetClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*PetClient) Use

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

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

type PetCreate

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

PetCreate is the builder for creating a Pet entity.

func (*PetCreate) AddCategories

func (pc *PetCreate) AddCategories(c ...*Category) *PetCreate

AddCategories adds the "categories" edges to the Category entity.

func (*PetCreate) AddCategoryIDs

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

AddCategoryIDs adds the "categories" edge to the Category entity by IDs.

func (*PetCreate) AddFriendIDs

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

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

func (*PetCreate) AddFriends

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

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

func (*PetCreate) AddRescuer

func (pc *PetCreate) AddRescuer(u ...*User) *PetCreate

AddRescuer adds the "rescuer" edges to the User entity.

func (*PetCreate) AddRescuerIDs

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

AddRescuerIDs adds the "rescuer" edge to the User entity by IDs.

func (*PetCreate) Exec

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

Exec executes the query.

func (*PetCreate) ExecX

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

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

func (*PetCreate) Mutation

func (pc *PetCreate) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetCreate) Save

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

Save creates the Pet in the database.

func (*PetCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*PetCreate) SetBirthday

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

SetBirthday sets the "birthday" field.

func (*PetCreate) SetHeight

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

SetHeight sets the "height" field.

func (*PetCreate) SetName

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

SetName sets the "name" field.

func (*PetCreate) SetNillableBirthday

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

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

func (*PetCreate) SetNillableHeight

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

SetNillableHeight sets the "height" field if the given value is not nil.

func (*PetCreate) SetNillableWeight

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

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

func (*PetCreate) SetOwner

func (pc *PetCreate) SetOwner(u *User) *PetCreate

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

func (*PetCreate) SetOwnerID

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

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

func (*PetCreate) SetTagID

func (pc *PetCreate) SetTagID(b []byte) *PetCreate

SetTagID sets the "tag_id" field.

func (*PetCreate) SetWeight

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

SetWeight sets the "weight" field.

type PetCreateBulk

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

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

func (*PetCreateBulk) Exec

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

Exec executes the query.

func (*PetCreateBulk) ExecX

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

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

func (*PetCreateBulk) Save

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

Save creates the Pet entities in the database.

func (*PetCreateBulk) SaveX

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

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

type PetDelete

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

PetDelete is the builder for deleting a Pet entity.

func (*PetDelete) Exec

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

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

func (*PetDelete) ExecX

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

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

func (*PetDelete) Where

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

Where appends a list predicates to the PetDelete builder.

type PetDeleteOne

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

PetDeleteOne is the builder for deleting a single Pet entity.

func (*PetDeleteOne) Exec

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

Exec executes the deletion query.

func (*PetDeleteOne) ExecX

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

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

func (*PetDeleteOne) Where

func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne

Where appends a list predicates to the PetDelete builder.

type PetEdges

type PetEdges struct {
	// Categories holds the value of the categories edge.
	Categories []*Category `json:"categories,omitempty"`
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// Rescuer holds the value of the rescuer edge.
	Rescuer []*User `json:"rescuer,omitempty"`
	// Friends holds the value of the friends edge.
	Friends []*Pet `json:"friends,omitempty"`
	// contains filtered or unexported fields
}

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

func (PetEdges) CategoriesOrErr

func (e PetEdges) CategoriesOrErr() ([]*Category, error)

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

func (PetEdges) FriendsOrErr

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

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

func (PetEdges) OwnerOrErr

func (e PetEdges) OwnerOrErr() (*User, error)

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

func (PetEdges) RescuerOrErr

func (e PetEdges) RescuerOrErr() ([]*User, error)

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

type PetGroupBy

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

PetGroupBy is the group-by builder for Pet entities.

func (*PetGroupBy) Aggregate

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

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

func (*PetGroupBy) Bool

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

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

func (*PetGroupBy) BoolX

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

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

func (*PetGroupBy) Bools

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

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

func (*PetGroupBy) BoolsX

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

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

func (*PetGroupBy) Float64

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

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

func (*PetGroupBy) Float64X

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

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

func (*PetGroupBy) Float64s

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

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

func (*PetGroupBy) Float64sX

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

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

func (*PetGroupBy) Int

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

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

func (*PetGroupBy) IntX

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

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

func (*PetGroupBy) Ints

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

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

func (*PetGroupBy) IntsX

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

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

func (*PetGroupBy) Scan

func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error

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

func (*PetGroupBy) ScanX

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

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

func (*PetGroupBy) String

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

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

func (*PetGroupBy) StringX

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

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

func (*PetGroupBy) Strings

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

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

func (*PetGroupBy) StringsX

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

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

type PetMutation

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

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

func (*PetMutation) AddCategoryIDs

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

AddCategoryIDs adds the "categories" edge to the Category entity by ids.

func (*PetMutation) AddField

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

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

func (*PetMutation) AddFriendIDs

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

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

func (*PetMutation) AddHeight

func (m *PetMutation) AddHeight(i int)

AddHeight adds i to the "height" field.

func (*PetMutation) AddRescuerIDs

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

AddRescuerIDs adds the "rescuer" edge to the User entity by ids.

func (*PetMutation) AddWeight

func (m *PetMutation) AddWeight(i int)

AddWeight adds i to the "weight" field.

func (*PetMutation) AddedEdges

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

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

func (*PetMutation) AddedField

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

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

func (*PetMutation) AddedFields

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

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

func (*PetMutation) AddedHeight

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

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

func (*PetMutation) AddedIDs

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

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

func (*PetMutation) AddedWeight

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

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

func (*PetMutation) Birthday

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

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

func (*PetMutation) BirthdayCleared

func (m *PetMutation) BirthdayCleared() bool

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

func (*PetMutation) CategoriesCleared

func (m *PetMutation) CategoriesCleared() bool

CategoriesCleared reports if the "categories" edge to the Category entity was cleared.

func (*PetMutation) CategoriesIDs

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

CategoriesIDs returns the "categories" edge IDs in the mutation.

func (*PetMutation) ClearBirthday

func (m *PetMutation) ClearBirthday()

ClearBirthday clears the value of the "birthday" field.

func (*PetMutation) ClearCategories

func (m *PetMutation) ClearCategories()

ClearCategories clears the "categories" edge to the Category entity.

func (*PetMutation) ClearEdge

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

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

func (*PetMutation) ClearField

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

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

func (*PetMutation) ClearFriends

func (m *PetMutation) ClearFriends()

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

func (*PetMutation) ClearHeight

func (m *PetMutation) ClearHeight()

ClearHeight clears the value of the "height" field.

func (*PetMutation) ClearOwner

func (m *PetMutation) ClearOwner()

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

func (*PetMutation) ClearRescuer

func (m *PetMutation) ClearRescuer()

ClearRescuer clears the "rescuer" edge to the User entity.

func (*PetMutation) ClearTagID

func (m *PetMutation) ClearTagID()

ClearTagID clears the value of the "tag_id" field.

func (*PetMutation) ClearWeight

func (m *PetMutation) ClearWeight()

ClearWeight clears the value of the "weight" field.

func (*PetMutation) ClearedEdges

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

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

func (*PetMutation) ClearedFields

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

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

func (PetMutation) Client

func (m PetMutation) Client() *Client

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

func (*PetMutation) EdgeCleared

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

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

func (*PetMutation) Field

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

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

func (*PetMutation) FieldCleared

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

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

func (*PetMutation) Fields

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

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

func (*PetMutation) FriendsCleared

func (m *PetMutation) FriendsCleared() bool

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

func (*PetMutation) FriendsIDs

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

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

func (*PetMutation) Height

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

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

func (*PetMutation) HeightCleared

func (m *PetMutation) HeightCleared() bool

HeightCleared returns if the "height" field was cleared in this mutation.

func (*PetMutation) ID

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

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

func (*PetMutation) IDs

func (m *PetMutation) IDs(ctx context.Context) ([]int, 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 (*PetMutation) Name

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

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

func (*PetMutation) OldBirthday

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

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

func (*PetMutation) OldField

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

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

func (*PetMutation) OldHeight

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

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

func (*PetMutation) OldName

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

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

func (*PetMutation) OldTagID

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

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

func (*PetMutation) OldWeight

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

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

func (*PetMutation) Op

func (m *PetMutation) Op() Op

Op returns the operation name.

func (*PetMutation) OwnerCleared

func (m *PetMutation) OwnerCleared() bool

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

func (*PetMutation) OwnerID

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

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

func (*PetMutation) OwnerIDs

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

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

func (*PetMutation) RemoveCategoryIDs

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

RemoveCategoryIDs removes the "categories" edge to the Category entity by IDs.

func (*PetMutation) RemoveFriendIDs

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

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

func (*PetMutation) RemoveRescuerIDs

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

RemoveRescuerIDs removes the "rescuer" edge to the User entity by IDs.

func (*PetMutation) RemovedCategoriesIDs

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

RemovedCategories returns the removed IDs of the "categories" edge to the Category entity.

func (*PetMutation) RemovedEdges

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

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

func (*PetMutation) RemovedFriendsIDs

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

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

func (*PetMutation) RemovedIDs

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

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

func (*PetMutation) RemovedRescuerIDs

func (m *PetMutation) RemovedRescuerIDs() (ids []int)

RemovedRescuer returns the removed IDs of the "rescuer" edge to the User entity.

func (*PetMutation) RescuerCleared

func (m *PetMutation) RescuerCleared() bool

RescuerCleared reports if the "rescuer" edge to the User entity was cleared.

func (*PetMutation) RescuerIDs

func (m *PetMutation) RescuerIDs() (ids []int)

RescuerIDs returns the "rescuer" edge IDs in the mutation.

func (*PetMutation) ResetBirthday

func (m *PetMutation) ResetBirthday()

ResetBirthday resets all changes to the "birthday" field.

func (*PetMutation) ResetCategories

func (m *PetMutation) ResetCategories()

ResetCategories resets all changes to the "categories" edge.

func (*PetMutation) ResetEdge

func (m *PetMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*PetMutation) ResetField

func (m *PetMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*PetMutation) ResetFriends

func (m *PetMutation) ResetFriends()

ResetFriends resets all changes to the "friends" edge.

func (*PetMutation) ResetHeight

func (m *PetMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*PetMutation) ResetName

func (m *PetMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PetMutation) ResetOwner

func (m *PetMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*PetMutation) ResetRescuer

func (m *PetMutation) ResetRescuer()

ResetRescuer resets all changes to the "rescuer" edge.

func (*PetMutation) ResetTagID

func (m *PetMutation) ResetTagID()

ResetTagID resets all changes to the "tag_id" field.

func (*PetMutation) ResetWeight

func (m *PetMutation) ResetWeight()

ResetWeight resets all changes to the "weight" field.

func (*PetMutation) SetBirthday

func (m *PetMutation) SetBirthday(t time.Time)

SetBirthday sets the "birthday" field.

func (*PetMutation) SetField

func (m *PetMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*PetMutation) SetHeight

func (m *PetMutation) SetHeight(i int)

SetHeight sets the "height" field.

func (*PetMutation) SetName

func (m *PetMutation) SetName(s string)

SetName sets the "name" field.

func (*PetMutation) SetOp

func (m *PetMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*PetMutation) SetOwnerID

func (m *PetMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*PetMutation) SetTagID

func (m *PetMutation) SetTagID(b []byte)

SetTagID sets the "tag_id" field.

func (*PetMutation) SetWeight

func (m *PetMutation) SetWeight(i int)

SetWeight sets the "weight" field.

func (*PetMutation) TagID

func (m *PetMutation) TagID() (r []byte, exists bool)

TagID returns the value of the "tag_id" field in the mutation.

func (*PetMutation) TagIDCleared

func (m *PetMutation) TagIDCleared() bool

TagIDCleared returns if the "tag_id" field was cleared in this mutation.

func (PetMutation) Tx

func (m PetMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*PetMutation) Type

func (m *PetMutation) Type() string

Type returns the node type of this mutation (Pet).

func (*PetMutation) Weight

func (m *PetMutation) Weight() (r int, exists bool)

Weight returns the value of the "weight" field in the mutation.

func (*PetMutation) WeightCleared

func (m *PetMutation) WeightCleared() bool

WeightCleared returns if the "weight" field was cleared in this mutation.

func (*PetMutation) Where

func (m *PetMutation) Where(ps ...predicate.Pet)

Where appends a list predicates to the PetMutation builder.

func (*PetMutation) WhereP

func (m *PetMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the PetMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type PetQuery

type PetQuery struct {
	// contains filtered or unexported fields
}

PetQuery is the builder for querying Pet entities.

func (*PetQuery) Aggregate

func (pq *PetQuery) Aggregate(fns ...AggregateFunc) *PetSelect

Aggregate returns a PetSelect configured with the given aggregations.

func (*PetQuery) All

func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error)

All executes the query and returns a list of Pets.

func (*PetQuery) AllX

func (pq *PetQuery) AllX(ctx context.Context) []*Pet

AllX is like All, but panics if an error occurs.

func (*PetQuery) Clone

func (pq *PetQuery) Clone() *PetQuery

Clone returns a duplicate of the PetQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PetQuery) Count

func (pq *PetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PetQuery) CountX

func (pq *PetQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PetQuery) Exist

func (pq *PetQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PetQuery) ExistX

func (pq *PetQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PetQuery) First

func (pq *PetQuery) First(ctx context.Context) (*Pet, error)

First returns the first Pet entity from the query. Returns a *NotFoundError when no Pet was found.

func (*PetQuery) FirstID

func (pq *PetQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Pet ID from the query. Returns a *NotFoundError when no Pet ID was found.

func (*PetQuery) FirstIDX

func (pq *PetQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*PetQuery) FirstX

func (pq *PetQuery) FirstX(ctx context.Context) *Pet

FirstX is like First, but panics if an error occurs.

func (*PetQuery) GroupBy

func (pq *PetQuery) GroupBy(field string, fields ...string) *PetGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Pet.Query().
	GroupBy(pet.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PetQuery) IDs

func (pq *PetQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of Pet IDs.

func (*PetQuery) IDsX

func (pq *PetQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*PetQuery) Limit

func (pq *PetQuery) Limit(limit int) *PetQuery

Limit the number of records to be returned by this query.

func (*PetQuery) Offset

func (pq *PetQuery) Offset(offset int) *PetQuery

Offset to start from.

func (*PetQuery) Only

func (pq *PetQuery) Only(ctx context.Context) (*Pet, error)

Only returns a single Pet entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Pet entity is found. Returns a *NotFoundError when no Pet entities are found.

func (*PetQuery) OnlyID

func (pq *PetQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Pet ID in the query. Returns a *NotSingularError when more than one Pet ID is found. Returns a *NotFoundError when no entities are found.

func (*PetQuery) OnlyIDX

func (pq *PetQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PetQuery) OnlyX

func (pq *PetQuery) OnlyX(ctx context.Context) *Pet

OnlyX is like Only, but panics if an error occurs.

func (*PetQuery) Order

func (pq *PetQuery) Order(o ...OrderFunc) *PetQuery

Order specifies how the records should be ordered.

func (*PetQuery) QueryCategories

func (pq *PetQuery) QueryCategories() *CategoryQuery

QueryCategories chains the current query on the "categories" edge.

func (*PetQuery) QueryFriends

func (pq *PetQuery) QueryFriends() *PetQuery

QueryFriends chains the current query on the "friends" edge.

func (*PetQuery) QueryOwner

func (pq *PetQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" edge.

func (*PetQuery) QueryRescuer

func (pq *PetQuery) QueryRescuer() *UserQuery

QueryRescuer chains the current query on the "rescuer" edge.

func (*PetQuery) Select

func (pq *PetQuery) Select(fields ...string) *PetSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.Pet.Query().
	Select(pet.FieldName).
	Scan(ctx, &v)

func (*PetQuery) Unique

func (pq *PetQuery) Unique(unique bool) *PetQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*PetQuery) Where

func (pq *PetQuery) Where(ps ...predicate.Pet) *PetQuery

Where adds a new predicate for the PetQuery builder.

func (*PetQuery) WithCategories

func (pq *PetQuery) WithCategories(opts ...func(*CategoryQuery)) *PetQuery

WithCategories tells the query-builder to eager-load the nodes that are connected to the "categories" edge. The optional arguments are used to configure the query builder of the edge.

func (*PetQuery) WithFriends

func (pq *PetQuery) WithFriends(opts ...func(*PetQuery)) *PetQuery

WithFriends tells the query-builder to eager-load the nodes that are connected to the "friends" edge. The optional arguments are used to configure the query builder of the edge.

func (*PetQuery) WithOwner

func (pq *PetQuery) WithOwner(opts ...func(*UserQuery)) *PetQuery

WithOwner tells the query-builder to eager-load the nodes that are connected to the "owner" edge. The optional arguments are used to configure the query builder of the edge.

func (*PetQuery) WithRescuer

func (pq *PetQuery) WithRescuer(opts ...func(*UserQuery)) *PetQuery

WithRescuer tells the query-builder to eager-load the nodes that are connected to the "rescuer" edge. The optional arguments are used to configure the query builder of the edge.

type PetSelect

type PetSelect struct {
	*PetQuery
	// contains filtered or unexported fields
}

PetSelect is the builder for selecting fields of Pet entities.

func (*PetSelect) Aggregate

func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect

Aggregate adds the given aggregation functions to the selector query.

func (*PetSelect) Bool

func (s *PetSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PetSelect) BoolX

func (s *PetSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PetSelect) Bools

func (s *PetSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PetSelect) BoolsX

func (s *PetSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PetSelect) Float64

func (s *PetSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PetSelect) Float64X

func (s *PetSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PetSelect) Float64s

func (s *PetSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PetSelect) Float64sX

func (s *PetSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PetSelect) Int

func (s *PetSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PetSelect) IntX

func (s *PetSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PetSelect) Ints

func (s *PetSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PetSelect) IntsX

func (s *PetSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PetSelect) Scan

func (ps *PetSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*PetSelect) ScanX

func (s *PetSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*PetSelect) String

func (s *PetSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PetSelect) StringX

func (s *PetSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PetSelect) Strings

func (s *PetSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PetSelect) StringsX

func (s *PetSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PetUpdate

type PetUpdate struct {
	// contains filtered or unexported fields
}

PetUpdate is the builder for updating Pet entities.

func (*PetUpdate) AddCategories

func (pu *PetUpdate) AddCategories(c ...*Category) *PetUpdate

AddCategories adds the "categories" edges to the Category entity.

func (*PetUpdate) AddCategoryIDs

func (pu *PetUpdate) AddCategoryIDs(ids ...int) *PetUpdate

AddCategoryIDs adds the "categories" edge to the Category entity by IDs.

func (*PetUpdate) AddFriendIDs

func (pu *PetUpdate) AddFriendIDs(ids ...int) *PetUpdate

AddFriendIDs adds the "friends" edge to the Pet entity by IDs.

func (*PetUpdate) AddFriends

func (pu *PetUpdate) AddFriends(p ...*Pet) *PetUpdate

AddFriends adds the "friends" edges to the Pet entity.

func (*PetUpdate) AddHeight

func (pu *PetUpdate) AddHeight(i int) *PetUpdate

AddHeight adds i to the "height" field.

func (*PetUpdate) AddWeight

func (pu *PetUpdate) AddWeight(i int) *PetUpdate

AddWeight adds i to the "weight" field.

func (*PetUpdate) ClearBirthday

func (pu *PetUpdate) ClearBirthday() *PetUpdate

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdate) ClearCategories

func (pu *PetUpdate) ClearCategories() *PetUpdate

ClearCategories clears all "categories" edges to the Category entity.

func (*PetUpdate) ClearFriends

func (pu *PetUpdate) ClearFriends() *PetUpdate

ClearFriends clears all "friends" edges to the Pet entity.

func (*PetUpdate) ClearHeight

func (pu *PetUpdate) ClearHeight() *PetUpdate

ClearHeight clears the value of the "height" field.

func (*PetUpdate) ClearOwner

func (pu *PetUpdate) ClearOwner() *PetUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*PetUpdate) ClearTagID

func (pu *PetUpdate) ClearTagID() *PetUpdate

ClearTagID clears the value of the "tag_id" field.

func (*PetUpdate) ClearWeight

func (pu *PetUpdate) ClearWeight() *PetUpdate

ClearWeight clears the value of the "weight" field.

func (*PetUpdate) Exec

func (pu *PetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PetUpdate) ExecX

func (pu *PetUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PetUpdate) Mutation

func (pu *PetUpdate) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdate) RemoveCategories

func (pu *PetUpdate) RemoveCategories(c ...*Category) *PetUpdate

RemoveCategories removes "categories" edges to Category entities.

func (*PetUpdate) RemoveCategoryIDs

func (pu *PetUpdate) RemoveCategoryIDs(ids ...int) *PetUpdate

RemoveCategoryIDs removes the "categories" edge to Category entities by IDs.

func (*PetUpdate) RemoveFriendIDs

func (pu *PetUpdate) RemoveFriendIDs(ids ...int) *PetUpdate

RemoveFriendIDs removes the "friends" edge to Pet entities by IDs.

func (*PetUpdate) RemoveFriends

func (pu *PetUpdate) RemoveFriends(p ...*Pet) *PetUpdate

RemoveFriends removes "friends" edges to Pet entities.

func (*PetUpdate) Save

func (pu *PetUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*PetUpdate) SaveX

func (pu *PetUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*PetUpdate) SetBirthday

func (pu *PetUpdate) SetBirthday(t time.Time) *PetUpdate

SetBirthday sets the "birthday" field.

func (*PetUpdate) SetHeight

func (pu *PetUpdate) SetHeight(i int) *PetUpdate

SetHeight sets the "height" field.

func (*PetUpdate) SetName

func (pu *PetUpdate) SetName(s string) *PetUpdate

SetName sets the "name" field.

func (*PetUpdate) SetNillableBirthday

func (pu *PetUpdate) SetNillableBirthday(t *time.Time) *PetUpdate

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*PetUpdate) SetNillableHeight

func (pu *PetUpdate) SetNillableHeight(i *int) *PetUpdate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*PetUpdate) SetNillableWeight

func (pu *PetUpdate) SetNillableWeight(i *int) *PetUpdate

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PetUpdate) SetOwner

func (pu *PetUpdate) SetOwner(u *User) *PetUpdate

SetOwner sets the "owner" edge to the User entity.

func (*PetUpdate) SetOwnerID

func (pu *PetUpdate) SetOwnerID(id int) *PetUpdate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*PetUpdate) SetTagID

func (pu *PetUpdate) SetTagID(b []byte) *PetUpdate

SetTagID sets the "tag_id" field.

func (*PetUpdate) SetWeight

func (pu *PetUpdate) SetWeight(i int) *PetUpdate

SetWeight sets the "weight" field.

func (*PetUpdate) Where

func (pu *PetUpdate) Where(ps ...predicate.Pet) *PetUpdate

Where appends a list predicates to the PetUpdate builder.

type PetUpdateOne

type PetUpdateOne struct {
	// contains filtered or unexported fields
}

PetUpdateOne is the builder for updating a single Pet entity.

func (*PetUpdateOne) AddCategories

func (puo *PetUpdateOne) AddCategories(c ...*Category) *PetUpdateOne

AddCategories adds the "categories" edges to the Category entity.

func (*PetUpdateOne) AddCategoryIDs

func (puo *PetUpdateOne) AddCategoryIDs(ids ...int) *PetUpdateOne

AddCategoryIDs adds the "categories" edge to the Category entity by IDs.

func (*PetUpdateOne) AddFriendIDs

func (puo *PetUpdateOne) AddFriendIDs(ids ...int) *PetUpdateOne

AddFriendIDs adds the "friends" edge to the Pet entity by IDs.

func (*PetUpdateOne) AddFriends

func (puo *PetUpdateOne) AddFriends(p ...*Pet) *PetUpdateOne

AddFriends adds the "friends" edges to the Pet entity.

func (*PetUpdateOne) AddHeight

func (puo *PetUpdateOne) AddHeight(i int) *PetUpdateOne

AddHeight adds i to the "height" field.

func (*PetUpdateOne) AddWeight

func (puo *PetUpdateOne) AddWeight(i int) *PetUpdateOne

AddWeight adds i to the "weight" field.

func (*PetUpdateOne) ClearBirthday

func (puo *PetUpdateOne) ClearBirthday() *PetUpdateOne

ClearBirthday clears the value of the "birthday" field.

func (*PetUpdateOne) ClearCategories

func (puo *PetUpdateOne) ClearCategories() *PetUpdateOne

ClearCategories clears all "categories" edges to the Category entity.

func (*PetUpdateOne) ClearFriends

func (puo *PetUpdateOne) ClearFriends() *PetUpdateOne

ClearFriends clears all "friends" edges to the Pet entity.

func (*PetUpdateOne) ClearHeight

func (puo *PetUpdateOne) ClearHeight() *PetUpdateOne

ClearHeight clears the value of the "height" field.

func (*PetUpdateOne) ClearOwner

func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*PetUpdateOne) ClearTagID

func (puo *PetUpdateOne) ClearTagID() *PetUpdateOne

ClearTagID clears the value of the "tag_id" field.

func (*PetUpdateOne) ClearWeight

func (puo *PetUpdateOne) ClearWeight() *PetUpdateOne

ClearWeight clears the value of the "weight" field.

func (*PetUpdateOne) Exec

func (puo *PetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PetUpdateOne) ExecX

func (puo *PetUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PetUpdateOne) Mutation

func (puo *PetUpdateOne) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdateOne) RemoveCategories

func (puo *PetUpdateOne) RemoveCategories(c ...*Category) *PetUpdateOne

RemoveCategories removes "categories" edges to Category entities.

func (*PetUpdateOne) RemoveCategoryIDs

func (puo *PetUpdateOne) RemoveCategoryIDs(ids ...int) *PetUpdateOne

RemoveCategoryIDs removes the "categories" edge to Category entities by IDs.

func (*PetUpdateOne) RemoveFriendIDs

func (puo *PetUpdateOne) RemoveFriendIDs(ids ...int) *PetUpdateOne

RemoveFriendIDs removes the "friends" edge to Pet entities by IDs.

func (*PetUpdateOne) RemoveFriends

func (puo *PetUpdateOne) RemoveFriends(p ...*Pet) *PetUpdateOne

RemoveFriends removes "friends" edges to Pet entities.

func (*PetUpdateOne) Save

func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error)

Save executes the query and returns the updated Pet entity.

func (*PetUpdateOne) SaveX

func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet

SaveX is like Save, but panics if an error occurs.

func (*PetUpdateOne) Select

func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*PetUpdateOne) SetBirthday

func (puo *PetUpdateOne) SetBirthday(t time.Time) *PetUpdateOne

SetBirthday sets the "birthday" field.

func (*PetUpdateOne) SetHeight

func (puo *PetUpdateOne) SetHeight(i int) *PetUpdateOne

SetHeight sets the "height" field.

func (*PetUpdateOne) SetName

func (puo *PetUpdateOne) SetName(s string) *PetUpdateOne

SetName sets the "name" field.

func (*PetUpdateOne) SetNillableBirthday

func (puo *PetUpdateOne) SetNillableBirthday(t *time.Time) *PetUpdateOne

SetNillableBirthday sets the "birthday" field if the given value is not nil.

func (*PetUpdateOne) SetNillableHeight

func (puo *PetUpdateOne) SetNillableHeight(i *int) *PetUpdateOne

SetNillableHeight sets the "height" field if the given value is not nil.

func (*PetUpdateOne) SetNillableWeight

func (puo *PetUpdateOne) SetNillableWeight(i *int) *PetUpdateOne

SetNillableWeight sets the "weight" field if the given value is not nil.

func (*PetUpdateOne) SetOwner

func (puo *PetUpdateOne) SetOwner(u *User) *PetUpdateOne

SetOwner sets the "owner" edge to the User entity.

func (*PetUpdateOne) SetOwnerID

func (puo *PetUpdateOne) SetOwnerID(id int) *PetUpdateOne

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*PetUpdateOne) SetTagID

func (puo *PetUpdateOne) SetTagID(b []byte) *PetUpdateOne

SetTagID sets the "tag_id" field.

func (*PetUpdateOne) SetWeight

func (puo *PetUpdateOne) SetWeight(i int) *PetUpdateOne

SetWeight sets the "weight" field.

func (*PetUpdateOne) Where

func (puo *PetUpdateOne) Where(ps ...predicate.Pet) *PetUpdateOne

Where appends a list predicates to the PetUpdate builder.

type Pets

type Pets []*Pet

Pets is a parsable slice of Pet.

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 {

	// AllTypes is the client for interacting with the AllTypes builders.
	AllTypes *AllTypesClient
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Hat is the client for interacting with the Hat builders.
	Hat *HatClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Age holds the value of the "age" field.
	Age uint `json:"age,omitempty"`
	// Height holds the value of the "height" field.
	Height uint `json:"height,omitempty"`
	// FavoriteCatBreed holds the value of the "favorite_cat_breed" field.
	FavoriteCatBreed user.FavoriteCatBreed `json:"favorite_cat_breed,omitempty"`
	// FavoriteColor holds the value of the "favorite_color" field.
	FavoriteColor user.FavoriteColor `json:"favorite_color,omitempty"`
	// FavoriteDogBreed holds the value of the "favorite_dog_breed" field.
	FavoriteDogBreed user.FavoriteDogBreed `json:"favorite_dog_breed,omitempty"`
	// FavoriteFishBreed holds the value of the "favorite_fish_breed" field.
	FavoriteFishBreed schema.FishBreed `json:"favorite_fish_breed,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAnimalsSaved

func (u *User) QueryAnimalsSaved() *PetQuery

QueryAnimalsSaved queries the "animals_saved" edge of the User entity.

func (*User) QueryBestFriend

func (u *User) QueryBestFriend() *UserQuery

QueryBestFriend queries the "best_friend" edge of the User entity.

func (*User) QueryFavoriteHat

func (u *User) QueryFavoriteHat() *HatQuery

QueryFavoriteHat queries the "favorite_hat" edge of the User entity.

func (*User) QueryPets

func (u *User) QueryPets() *PetQuery

QueryPets queries the "pets" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAnimalsSaved

func (c *UserClient) QueryAnimalsSaved(u *User) *PetQuery

QueryAnimalsSaved queries the animals_saved edge of a User.

func (*UserClient) QueryBestFriend

func (c *UserClient) QueryBestFriend(u *User) *UserQuery

QueryBestFriend queries the best_friend edge of a User.

func (*UserClient) QueryFavoriteHat

func (c *UserClient) QueryFavoriteHat(u *User) *HatQuery

QueryFavoriteHat queries the favorite_hat edge of a User.

func (*UserClient) QueryPets

func (c *UserClient) QueryPets(u *User) *PetQuery

QueryPets queries the pets edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAnimalsSaved

func (uc *UserCreate) AddAnimalsSaved(p ...*Pet) *UserCreate

AddAnimalsSaved adds the "animals_saved" edges to the Pet entity.

func (*UserCreate) AddAnimalsSavedIDs

func (uc *UserCreate) AddAnimalsSavedIDs(ids ...int) *UserCreate

AddAnimalsSavedIDs adds the "animals_saved" edge to the Pet entity by IDs.

func (*UserCreate) AddPetIDs

func (uc *UserCreate) AddPetIDs(ids ...int) *UserCreate

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*UserCreate) AddPets

func (uc *UserCreate) AddPets(p ...*Pet) *UserCreate

AddPets adds the "pets" edges to the Pet entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAge

func (uc *UserCreate) SetAge(u uint) *UserCreate

SetAge sets the "age" field.

func (*UserCreate) SetBestFriend

func (uc *UserCreate) SetBestFriend(u *User) *UserCreate

SetBestFriend sets the "best_friend" edge to the User entity.

func (*UserCreate) SetBestFriendID

func (uc *UserCreate) SetBestFriendID(id int) *UserCreate

SetBestFriendID sets the "best_friend" edge to the User entity by ID.

func (*UserCreate) SetFavoriteCatBreed

func (uc *UserCreate) SetFavoriteCatBreed(ucb user.FavoriteCatBreed) *UserCreate

SetFavoriteCatBreed sets the "favorite_cat_breed" field.

func (*UserCreate) SetFavoriteColor

func (uc *UserCreate) SetFavoriteColor(value user.FavoriteColor) *UserCreate

SetFavoriteColor sets the "favorite_color" field.

func (*UserCreate) SetFavoriteDogBreed

func (uc *UserCreate) SetFavoriteDogBreed(udb user.FavoriteDogBreed) *UserCreate

SetFavoriteDogBreed sets the "favorite_dog_breed" field.

func (*UserCreate) SetFavoriteFishBreed

func (uc *UserCreate) SetFavoriteFishBreed(sb schema.FishBreed) *UserCreate

SetFavoriteFishBreed sets the "favorite_fish_breed" field.

func (*UserCreate) SetFavoriteHat

func (uc *UserCreate) SetFavoriteHat(h *Hat) *UserCreate

SetFavoriteHat sets the "favorite_hat" edge to the Hat entity.

func (*UserCreate) SetFavoriteHatID

func (uc *UserCreate) SetFavoriteHatID(id int) *UserCreate

SetFavoriteHatID sets the "favorite_hat" edge to the Hat entity by ID.

func (*UserCreate) SetHeight

func (uc *UserCreate) SetHeight(u uint) *UserCreate

SetHeight sets the "height" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableBestFriendID

func (uc *UserCreate) SetNillableBestFriendID(id *int) *UserCreate

SetNillableBestFriendID sets the "best_friend" edge to the User entity by ID if the given value is not nil.

func (*UserCreate) SetNillableFavoriteColor

func (uc *UserCreate) SetNillableFavoriteColor(value *user.FavoriteColor) *UserCreate

SetNillableFavoriteColor sets the "favorite_color" field if the given value is not nil.

func (*UserCreate) SetNillableFavoriteDogBreed

func (uc *UserCreate) SetNillableFavoriteDogBreed(udb *user.FavoriteDogBreed) *UserCreate

SetNillableFavoriteDogBreed sets the "favorite_dog_breed" field if the given value is not nil.

func (*UserCreate) SetNillableFavoriteFishBreed

func (uc *UserCreate) SetNillableFavoriteFishBreed(sb *schema.FishBreed) *UserCreate

SetNillableFavoriteFishBreed sets the "favorite_fish_breed" field if the given value is not nil.

func (*UserCreate) SetNillableFavoriteHatID

func (uc *UserCreate) SetNillableFavoriteHatID(id *int) *UserCreate

SetNillableFavoriteHatID sets the "favorite_hat" edge to the Hat entity by ID if the given value is not nil.

func (*UserCreate) SetNillableHeight

func (uc *UserCreate) SetNillableHeight(u *uint) *UserCreate

SetNillableHeight sets the "height" field if the given value is not nil.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Pets holds the value of the pets edge.
	Pets []*Pet `json:"pets,omitempty"`
	// AnimalsSaved holds the value of the animals_saved edge.
	AnimalsSaved []*Pet `json:"animals_saved,omitempty"`
	// BestFriend holds the value of the best_friend edge.
	BestFriend *User `json:"best_friend,omitempty"`
	// FavoriteHat holds the value of the favorite_hat edge.
	FavoriteHat *Hat `json:"favorite_hat,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AnimalsSavedOrErr

func (e UserEdges) AnimalsSavedOrErr() ([]*Pet, error)

AnimalsSavedOrErr returns the AnimalsSaved value or an error if the edge was not loaded in eager-loading.

func (UserEdges) BestFriendOrErr

func (e UserEdges) BestFriendOrErr() (*User, error)

BestFriendOrErr returns the BestFriend value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) FavoriteHatOrErr

func (e UserEdges) FavoriteHatOrErr() (*Hat, error)

FavoriteHatOrErr returns the FavoriteHat value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) PetsOrErr

func (e UserEdges) PetsOrErr() ([]*Pet, error)

PetsOrErr returns the Pets value or an error if the edge was not loaded in eager-loading.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolX

func (s *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) BoolsX

func (s *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64X

func (s *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) Float64sX

func (s *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntX

func (s *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) IntsX

func (s *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringX

func (s *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserGroupBy) StringsX

func (s *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddAge

func (m *UserMutation) AddAge(u int)

AddAge adds u to the "age" field.

func (*UserMutation) AddAnimalsSavedIDs

func (m *UserMutation) AddAnimalsSavedIDs(ids ...int)

AddAnimalsSavedIDs adds the "animals_saved" edge to the Pet entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddHeight

func (m *UserMutation) AddHeight(u int)

AddHeight adds u to the "height" field.

func (*UserMutation) AddPetIDs

func (m *UserMutation) AddPetIDs(ids ...int)

AddPetIDs adds the "pets" edge to the Pet entity by ids.

func (*UserMutation) AddedAge

func (m *UserMutation) AddedAge() (r int, exists bool)

AddedAge returns the value that was added to the "age" field in this mutation.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedHeight

func (m *UserMutation) AddedHeight() (r int, exists bool)

AddedHeight returns the value that was added to the "height" field in this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) Age

func (m *UserMutation) Age() (r uint, exists bool)

Age returns the value of the "age" field in the mutation.

func (*UserMutation) AnimalsSavedCleared

func (m *UserMutation) AnimalsSavedCleared() bool

AnimalsSavedCleared reports if the "animals_saved" edge to the Pet entity was cleared.

func (*UserMutation) AnimalsSavedIDs

func (m *UserMutation) AnimalsSavedIDs() (ids []int)

AnimalsSavedIDs returns the "animals_saved" edge IDs in the mutation.

func (*UserMutation) BestFriendCleared

func (m *UserMutation) BestFriendCleared() bool

BestFriendCleared reports if the "best_friend" edge to the User entity was cleared.

func (*UserMutation) BestFriendID

func (m *UserMutation) BestFriendID() (id int, exists bool)

BestFriendID returns the "best_friend" edge ID in the mutation.

func (*UserMutation) BestFriendIDs

func (m *UserMutation) BestFriendIDs() (ids []int)

BestFriendIDs returns the "best_friend" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use BestFriendID instead. It exists only for internal usage by the builders.

func (*UserMutation) ClearAnimalsSaved

func (m *UserMutation) ClearAnimalsSaved()

ClearAnimalsSaved clears the "animals_saved" edge to the Pet entity.

func (*UserMutation) ClearBestFriend

func (m *UserMutation) ClearBestFriend()

ClearBestFriend clears the "best_friend" edge to the User entity.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearFavoriteDogBreed

func (m *UserMutation) ClearFavoriteDogBreed()

ClearFavoriteDogBreed clears the value of the "favorite_dog_breed" field.

func (*UserMutation) ClearFavoriteFishBreed

func (m *UserMutation) ClearFavoriteFishBreed()

ClearFavoriteFishBreed clears the value of the "favorite_fish_breed" field.

func (*UserMutation) ClearFavoriteHat

func (m *UserMutation) ClearFavoriteHat()

ClearFavoriteHat clears the "favorite_hat" edge to the Hat entity.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearHeight

func (m *UserMutation) ClearHeight()

ClearHeight clears the value of the "height" field.

func (*UserMutation) ClearPets

func (m *UserMutation) ClearPets()

ClearPets clears the "pets" edge to the Pet entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) FavoriteCatBreed

func (m *UserMutation) FavoriteCatBreed() (r user.FavoriteCatBreed, exists bool)

FavoriteCatBreed returns the value of the "favorite_cat_breed" field in the mutation.

func (*UserMutation) FavoriteColor

func (m *UserMutation) FavoriteColor() (r user.FavoriteColor, exists bool)

FavoriteColor returns the value of the "favorite_color" field in the mutation.

func (*UserMutation) FavoriteDogBreed

func (m *UserMutation) FavoriteDogBreed() (r user.FavoriteDogBreed, exists bool)

FavoriteDogBreed returns the value of the "favorite_dog_breed" field in the mutation.

func (*UserMutation) FavoriteDogBreedCleared

func (m *UserMutation) FavoriteDogBreedCleared() bool

FavoriteDogBreedCleared returns if the "favorite_dog_breed" field was cleared in this mutation.

func (*UserMutation) FavoriteFishBreed

func (m *UserMutation) FavoriteFishBreed() (r schema.FishBreed, exists bool)

FavoriteFishBreed returns the value of the "favorite_fish_breed" field in the mutation.

func (*UserMutation) FavoriteFishBreedCleared

func (m *UserMutation) FavoriteFishBreedCleared() bool

FavoriteFishBreedCleared returns if the "favorite_fish_breed" field was cleared in this mutation.

func (*UserMutation) FavoriteHatCleared

func (m *UserMutation) FavoriteHatCleared() bool

FavoriteHatCleared reports if the "favorite_hat" edge to the Hat entity was cleared.

func (*UserMutation) FavoriteHatID

func (m *UserMutation) FavoriteHatID() (id int, exists bool)

FavoriteHatID returns the "favorite_hat" edge ID in the mutation.

func (*UserMutation) FavoriteHatIDs

func (m *UserMutation) FavoriteHatIDs() (ids []int)

FavoriteHatIDs returns the "favorite_hat" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use FavoriteHatID instead. It exists only for internal usage by the builders.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) Height

func (m *UserMutation) Height() (r uint, exists bool)

Height returns the value of the "height" field in the mutation.

func (*UserMutation) HeightCleared

func (m *UserMutation) HeightCleared() bool

HeightCleared returns if the "height" field was cleared in this mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int, 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 (*UserMutation) Name

func (m *UserMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldAge

func (m *UserMutation) OldAge(ctx context.Context) (v uint, err error)

OldAge returns the old "age" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldFavoriteCatBreed

func (m *UserMutation) OldFavoriteCatBreed(ctx context.Context) (v user.FavoriteCatBreed, err error)

OldFavoriteCatBreed returns the old "favorite_cat_breed" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldFavoriteColor

func (m *UserMutation) OldFavoriteColor(ctx context.Context) (v user.FavoriteColor, err error)

OldFavoriteColor returns the old "favorite_color" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldFavoriteDogBreed

func (m *UserMutation) OldFavoriteDogBreed(ctx context.Context) (v user.FavoriteDogBreed, err error)

OldFavoriteDogBreed returns the old "favorite_dog_breed" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldFavoriteFishBreed

func (m *UserMutation) OldFavoriteFishBreed(ctx context.Context) (v schema.FishBreed, err error)

OldFavoriteFishBreed returns the old "favorite_fish_breed" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldHeight

func (m *UserMutation) OldHeight(ctx context.Context) (v uint, err error)

OldHeight returns the old "height" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldName

func (m *UserMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PetsCleared

func (m *UserMutation) PetsCleared() bool

PetsCleared reports if the "pets" edge to the Pet entity was cleared.

func (*UserMutation) PetsIDs

func (m *UserMutation) PetsIDs() (ids []int)

PetsIDs returns the "pets" edge IDs in the mutation.

func (*UserMutation) RemoveAnimalsSavedIDs

func (m *UserMutation) RemoveAnimalsSavedIDs(ids ...int)

RemoveAnimalsSavedIDs removes the "animals_saved" edge to the Pet entity by IDs.

func (*UserMutation) RemovePetIDs

func (m *UserMutation) RemovePetIDs(ids ...int)

RemovePetIDs removes the "pets" edge to the Pet entity by IDs.

func (*UserMutation) RemovedAnimalsSavedIDs

func (m *UserMutation) RemovedAnimalsSavedIDs() (ids []int)

RemovedAnimalsSaved returns the removed IDs of the "animals_saved" edge to the Pet entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedPetsIDs

func (m *UserMutation) RemovedPetsIDs() (ids []int)

RemovedPets returns the removed IDs of the "pets" edge to the Pet entity.

func (*UserMutation) ResetAge

func (m *UserMutation) ResetAge()

ResetAge resets all changes to the "age" field.

func (*UserMutation) ResetAnimalsSaved

func (m *UserMutation) ResetAnimalsSaved()

ResetAnimalsSaved resets all changes to the "animals_saved" edge.

func (*UserMutation) ResetBestFriend

func (m *UserMutation) ResetBestFriend()

ResetBestFriend resets all changes to the "best_friend" edge.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetFavoriteCatBreed

func (m *UserMutation) ResetFavoriteCatBreed()

ResetFavoriteCatBreed resets all changes to the "favorite_cat_breed" field.

func (*UserMutation) ResetFavoriteColor

func (m *UserMutation) ResetFavoriteColor()

ResetFavoriteColor resets all changes to the "favorite_color" field.

func (*UserMutation) ResetFavoriteDogBreed

func (m *UserMutation) ResetFavoriteDogBreed()

ResetFavoriteDogBreed resets all changes to the "favorite_dog_breed" field.

func (*UserMutation) ResetFavoriteFishBreed

func (m *UserMutation) ResetFavoriteFishBreed()

ResetFavoriteFishBreed resets all changes to the "favorite_fish_breed" field.

func (*UserMutation) ResetFavoriteHat

func (m *UserMutation) ResetFavoriteHat()

ResetFavoriteHat resets all changes to the "favorite_hat" edge.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetHeight

func (m *UserMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetPets

func (m *UserMutation) ResetPets()

ResetPets resets all changes to the "pets" edge.

func (*UserMutation) SetAge

func (m *UserMutation) SetAge(u uint)

SetAge sets the "age" field.

func (*UserMutation) SetBestFriendID

func (m *UserMutation) SetBestFriendID(id int)

SetBestFriendID sets the "best_friend" edge to the User entity by id.

func (*UserMutation) SetFavoriteCatBreed

func (m *UserMutation) SetFavoriteCatBreed(ucb user.FavoriteCatBreed)

SetFavoriteCatBreed sets the "favorite_cat_breed" field.

func (*UserMutation) SetFavoriteColor

func (m *UserMutation) SetFavoriteColor(uc user.FavoriteColor)

SetFavoriteColor sets the "favorite_color" field.

func (*UserMutation) SetFavoriteDogBreed

func (m *UserMutation) SetFavoriteDogBreed(udb user.FavoriteDogBreed)

SetFavoriteDogBreed sets the "favorite_dog_breed" field.

func (*UserMutation) SetFavoriteFishBreed

func (m *UserMutation) SetFavoriteFishBreed(sb schema.FishBreed)

SetFavoriteFishBreed sets the "favorite_fish_breed" field.

func (*UserMutation) SetFavoriteHatID

func (m *UserMutation) SetFavoriteHatID(id int)

SetFavoriteHatID sets the "favorite_hat" edge to the Hat entity by id.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetHeight

func (m *UserMutation) SetHeight(u uint)

SetHeight sets the "height" field.

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAnimalsSaved

func (uq *UserQuery) QueryAnimalsSaved() *PetQuery

QueryAnimalsSaved chains the current query on the "animals_saved" edge.

func (*UserQuery) QueryBestFriend

func (uq *UserQuery) QueryBestFriend() *UserQuery

QueryBestFriend chains the current query on the "best_friend" edge.

func (*UserQuery) QueryFavoriteHat

func (uq *UserQuery) QueryFavoriteHat() *HatQuery

QueryFavoriteHat chains the current query on the "favorite_hat" edge.

func (*UserQuery) QueryPets

func (uq *UserQuery) QueryPets() *PetQuery

QueryPets chains the current query on the "pets" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAnimalsSaved

func (uq *UserQuery) WithAnimalsSaved(opts ...func(*PetQuery)) *UserQuery

WithAnimalsSaved tells the query-builder to eager-load the nodes that are connected to the "animals_saved" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithBestFriend

func (uq *UserQuery) WithBestFriend(opts ...func(*UserQuery)) *UserQuery

WithBestFriend tells the query-builder to eager-load the nodes that are connected to the "best_friend" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithFavoriteHat

func (uq *UserQuery) WithFavoriteHat(opts ...func(*HatQuery)) *UserQuery

WithFavoriteHat tells the query-builder to eager-load the nodes that are connected to the "favorite_hat" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithPets

func (uq *UserQuery) WithPets(opts ...func(*PetQuery)) *UserQuery

WithPets tells the query-builder to eager-load the nodes that are connected to the "pets" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAge

func (uu *UserUpdate) AddAge(u int) *UserUpdate

AddAge adds u to the "age" field.

func (*UserUpdate) AddAnimalsSaved

func (uu *UserUpdate) AddAnimalsSaved(p ...*Pet) *UserUpdate

AddAnimalsSaved adds the "animals_saved" edges to the Pet entity.

func (*UserUpdate) AddAnimalsSavedIDs

func (uu *UserUpdate) AddAnimalsSavedIDs(ids ...int) *UserUpdate

AddAnimalsSavedIDs adds the "animals_saved" edge to the Pet entity by IDs.

func (*UserUpdate) AddHeight

func (uu *UserUpdate) AddHeight(u int) *UserUpdate

AddHeight adds u to the "height" field.

func (*UserUpdate) AddPetIDs

func (uu *UserUpdate) AddPetIDs(ids ...int) *UserUpdate

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*UserUpdate) AddPets

func (uu *UserUpdate) AddPets(p ...*Pet) *UserUpdate

AddPets adds the "pets" edges to the Pet entity.

func (*UserUpdate) ClearAnimalsSaved

func (uu *UserUpdate) ClearAnimalsSaved() *UserUpdate

ClearAnimalsSaved clears all "animals_saved" edges to the Pet entity.

func (*UserUpdate) ClearBestFriend

func (uu *UserUpdate) ClearBestFriend() *UserUpdate

ClearBestFriend clears the "best_friend" edge to the User entity.

func (*UserUpdate) ClearFavoriteDogBreed

func (uu *UserUpdate) ClearFavoriteDogBreed() *UserUpdate

ClearFavoriteDogBreed clears the value of the "favorite_dog_breed" field.

func (*UserUpdate) ClearFavoriteFishBreed

func (uu *UserUpdate) ClearFavoriteFishBreed() *UserUpdate

ClearFavoriteFishBreed clears the value of the "favorite_fish_breed" field.

func (*UserUpdate) ClearHeight

func (uu *UserUpdate) ClearHeight() *UserUpdate

ClearHeight clears the value of the "height" field.

func (*UserUpdate) ClearPets

func (uu *UserUpdate) ClearPets() *UserUpdate

ClearPets clears all "pets" edges to the Pet entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAnimalsSaved

func (uu *UserUpdate) RemoveAnimalsSaved(p ...*Pet) *UserUpdate

RemoveAnimalsSaved removes "animals_saved" edges to Pet entities.

func (*UserUpdate) RemoveAnimalsSavedIDs

func (uu *UserUpdate) RemoveAnimalsSavedIDs(ids ...int) *UserUpdate

RemoveAnimalsSavedIDs removes the "animals_saved" edge to Pet entities by IDs.

func (*UserUpdate) RemovePetIDs

func (uu *UserUpdate) RemovePetIDs(ids ...int) *UserUpdate

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*UserUpdate) RemovePets

func (uu *UserUpdate) RemovePets(p ...*Pet) *UserUpdate

RemovePets removes "pets" edges to Pet entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetAge

func (uu *UserUpdate) SetAge(u uint) *UserUpdate

SetAge sets the "age" field.

func (*UserUpdate) SetBestFriend

func (uu *UserUpdate) SetBestFriend(u *User) *UserUpdate

SetBestFriend sets the "best_friend" edge to the User entity.

func (*UserUpdate) SetBestFriendID

func (uu *UserUpdate) SetBestFriendID(id int) *UserUpdate

SetBestFriendID sets the "best_friend" edge to the User entity by ID.

func (*UserUpdate) SetFavoriteCatBreed

func (uu *UserUpdate) SetFavoriteCatBreed(ucb user.FavoriteCatBreed) *UserUpdate

SetFavoriteCatBreed sets the "favorite_cat_breed" field.

func (*UserUpdate) SetFavoriteDogBreed

func (uu *UserUpdate) SetFavoriteDogBreed(udb user.FavoriteDogBreed) *UserUpdate

SetFavoriteDogBreed sets the "favorite_dog_breed" field.

func (*UserUpdate) SetFavoriteFishBreed

func (uu *UserUpdate) SetFavoriteFishBreed(sb schema.FishBreed) *UserUpdate

SetFavoriteFishBreed sets the "favorite_fish_breed" field.

func (*UserUpdate) SetHeight

func (uu *UserUpdate) SetHeight(u uint) *UserUpdate

SetHeight sets the "height" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableBestFriendID

func (uu *UserUpdate) SetNillableBestFriendID(id *int) *UserUpdate

SetNillableBestFriendID sets the "best_friend" edge to the User entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableFavoriteDogBreed

func (uu *UserUpdate) SetNillableFavoriteDogBreed(udb *user.FavoriteDogBreed) *UserUpdate

SetNillableFavoriteDogBreed sets the "favorite_dog_breed" field if the given value is not nil.

func (*UserUpdate) SetNillableFavoriteFishBreed

func (uu *UserUpdate) SetNillableFavoriteFishBreed(sb *schema.FishBreed) *UserUpdate

SetNillableFavoriteFishBreed sets the "favorite_fish_breed" field if the given value is not nil.

func (*UserUpdate) SetNillableHeight

func (uu *UserUpdate) SetNillableHeight(u *uint) *UserUpdate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAge

func (uuo *UserUpdateOne) AddAge(u int) *UserUpdateOne

AddAge adds u to the "age" field.

func (*UserUpdateOne) AddAnimalsSaved

func (uuo *UserUpdateOne) AddAnimalsSaved(p ...*Pet) *UserUpdateOne

AddAnimalsSaved adds the "animals_saved" edges to the Pet entity.

func (*UserUpdateOne) AddAnimalsSavedIDs

func (uuo *UserUpdateOne) AddAnimalsSavedIDs(ids ...int) *UserUpdateOne

AddAnimalsSavedIDs adds the "animals_saved" edge to the Pet entity by IDs.

func (*UserUpdateOne) AddHeight

func (uuo *UserUpdateOne) AddHeight(u int) *UserUpdateOne

AddHeight adds u to the "height" field.

func (*UserUpdateOne) AddPetIDs

func (uuo *UserUpdateOne) AddPetIDs(ids ...int) *UserUpdateOne

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*UserUpdateOne) AddPets

func (uuo *UserUpdateOne) AddPets(p ...*Pet) *UserUpdateOne

AddPets adds the "pets" edges to the Pet entity.

func (*UserUpdateOne) ClearAnimalsSaved

func (uuo *UserUpdateOne) ClearAnimalsSaved() *UserUpdateOne

ClearAnimalsSaved clears all "animals_saved" edges to the Pet entity.

func (*UserUpdateOne) ClearBestFriend

func (uuo *UserUpdateOne) ClearBestFriend() *UserUpdateOne

ClearBestFriend clears the "best_friend" edge to the User entity.

func (*UserUpdateOne) ClearFavoriteDogBreed

func (uuo *UserUpdateOne) ClearFavoriteDogBreed() *UserUpdateOne

ClearFavoriteDogBreed clears the value of the "favorite_dog_breed" field.

func (*UserUpdateOne) ClearFavoriteFishBreed

func (uuo *UserUpdateOne) ClearFavoriteFishBreed() *UserUpdateOne

ClearFavoriteFishBreed clears the value of the "favorite_fish_breed" field.

func (*UserUpdateOne) ClearHeight

func (uuo *UserUpdateOne) ClearHeight() *UserUpdateOne

ClearHeight clears the value of the "height" field.

func (*UserUpdateOne) ClearPets

func (uuo *UserUpdateOne) ClearPets() *UserUpdateOne

ClearPets clears all "pets" edges to the Pet entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAnimalsSaved

func (uuo *UserUpdateOne) RemoveAnimalsSaved(p ...*Pet) *UserUpdateOne

RemoveAnimalsSaved removes "animals_saved" edges to Pet entities.

func (*UserUpdateOne) RemoveAnimalsSavedIDs

func (uuo *UserUpdateOne) RemoveAnimalsSavedIDs(ids ...int) *UserUpdateOne

RemoveAnimalsSavedIDs removes the "animals_saved" edge to Pet entities by IDs.

func (*UserUpdateOne) RemovePetIDs

func (uuo *UserUpdateOne) RemovePetIDs(ids ...int) *UserUpdateOne

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*UserUpdateOne) RemovePets

func (uuo *UserUpdateOne) RemovePets(p ...*Pet) *UserUpdateOne

RemovePets removes "pets" edges to Pet entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetAge

func (uuo *UserUpdateOne) SetAge(u uint) *UserUpdateOne

SetAge sets the "age" field.

func (*UserUpdateOne) SetBestFriend

func (uuo *UserUpdateOne) SetBestFriend(u *User) *UserUpdateOne

SetBestFriend sets the "best_friend" edge to the User entity.

func (*UserUpdateOne) SetBestFriendID

func (uuo *UserUpdateOne) SetBestFriendID(id int) *UserUpdateOne

SetBestFriendID sets the "best_friend" edge to the User entity by ID.

func (*UserUpdateOne) SetFavoriteCatBreed

func (uuo *UserUpdateOne) SetFavoriteCatBreed(ucb user.FavoriteCatBreed) *UserUpdateOne

SetFavoriteCatBreed sets the "favorite_cat_breed" field.

func (*UserUpdateOne) SetFavoriteDogBreed

func (uuo *UserUpdateOne) SetFavoriteDogBreed(udb user.FavoriteDogBreed) *UserUpdateOne

SetFavoriteDogBreed sets the "favorite_dog_breed" field.

func (*UserUpdateOne) SetFavoriteFishBreed

func (uuo *UserUpdateOne) SetFavoriteFishBreed(sb schema.FishBreed) *UserUpdateOne

SetFavoriteFishBreed sets the "favorite_fish_breed" field.

func (*UserUpdateOne) SetHeight

func (uuo *UserUpdateOne) SetHeight(u uint) *UserUpdateOne

SetHeight sets the "height" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableBestFriendID

func (uuo *UserUpdateOne) SetNillableBestFriendID(id *int) *UserUpdateOne

SetNillableBestFriendID sets the "best_friend" edge to the User entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableFavoriteDogBreed

func (uuo *UserUpdateOne) SetNillableFavoriteDogBreed(udb *user.FavoriteDogBreed) *UserUpdateOne

SetNillableFavoriteDogBreed sets the "favorite_dog_breed" field if the given value is not nil.

func (*UserUpdateOne) SetNillableFavoriteFishBreed

func (uuo *UserUpdateOne) SetNillableFavoriteFishBreed(sb *schema.FishBreed) *UserUpdateOne

SetNillableFavoriteFishBreed sets the "favorite_fish_breed" field if the given value is not nil.

func (*UserUpdateOne) SetNillableHeight

func (uuo *UserUpdateOne) SetNillableHeight(u *uint) *UserUpdateOne

SetNillableHeight sets the "height" field if the given value is not nil.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field 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
Code generated by ogen, DO NOT EDIT.
Code generated by ogen, DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL