ent

package
v0.0.0-...-65daeca Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 28 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.
	TypeCategory   = "Category"
	TypeFollows    = "Follows"
	TypeFriendship = "Friendship"
	TypePet        = "Pet"
	TypeSettings   = "Settings"
	TypeSkipped    = "Skipped"
	TypeUser       = "User"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

GroupBy(field1, field2).
Aggregate(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 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"`
	// Time in which the resource was initially created.
	CreatedAt time.Time `json:"created_at"`
	// Time that the resource was last updated.
	UpdatedAt time.Time `json:"updated_at"`
	// Name holds the value of the "name" field.
	Name string `json:"name"`
	// Readonly holds the value of the "readonly" field.
	Readonly string `json:"readonly"`
	// SkipInSpec holds the value of the "skip_in_spec" field.
	SkipInSpec string `json:"skip_in_spec"`
	// Nillable holds the value of the "nillable" field.
	Nillable *string `json:"nillable"`
	// Strings holds the value of the "strings" field.
	Strings []string `json:"strings"`
	// Ints holds the value of the "ints" field.
	Ints []int `json:"ints"`
	// 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.

func (*Category) Value

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

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

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) MapCreateBulk

func (c *CategoryClient) MapCreateBulk(slice any, setFunc func(*CategoryCreate, int)) *CategoryCreateBulk

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

func (*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) SetCreatedAt

func (cc *CategoryCreate) SetCreatedAt(t time.Time) *CategoryCreate

SetCreatedAt sets the "created_at" field.

func (*CategoryCreate) SetInts

func (cc *CategoryCreate) SetInts(i []int) *CategoryCreate

SetInts sets the "ints" field.

func (*CategoryCreate) SetName

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

SetName sets the "name" field.

func (*CategoryCreate) SetNillable

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

SetNillable sets the "nillable" field.

func (*CategoryCreate) SetNillableCreatedAt

func (cc *CategoryCreate) SetNillableCreatedAt(t *time.Time) *CategoryCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*CategoryCreate) SetNillableNillable

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

SetNillableNillable sets the "nillable" field if the given value is not nil.

func (*CategoryCreate) SetNillableSkipInSpec

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

SetNillableSkipInSpec sets the "skip_in_spec" field if the given value is not nil.

func (*CategoryCreate) SetNillableUpdatedAt

func (cc *CategoryCreate) SetNillableUpdatedAt(t *time.Time) *CategoryCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*CategoryCreate) SetReadonly

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

SetReadonly sets the "readonly" field.

func (*CategoryCreate) SetSkipInSpec

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

SetSkipInSpec sets the "skip_in_spec" field.

func (*CategoryCreate) SetStrings

func (cc *CategoryCreate) SetStrings(s []string) *CategoryCreate

SetStrings sets the "strings" field.

func (*CategoryCreate) SetUpdatedAt

func (cc *CategoryCreate) SetUpdatedAt(t time.Time) *CategoryCreate

SetUpdatedAt sets the "updated_at" 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) AppendInts

func (m *CategoryMutation) AppendInts(i []int)

AppendInts adds i to the "ints" field.

func (*CategoryMutation) AppendStrings

func (m *CategoryMutation) AppendStrings(s []string)

AppendStrings adds s to the "strings" field.

func (*CategoryMutation) AppendedInts

func (m *CategoryMutation) AppendedInts() ([]int, bool)

AppendedInts returns the list of values that were appended to the "ints" field in this mutation.

func (*CategoryMutation) AppendedStrings

func (m *CategoryMutation) AppendedStrings() ([]string, bool)

AppendedStrings returns the list of values that were appended to the "strings" field 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) ClearInts

func (m *CategoryMutation) ClearInts()

ClearInts clears the value of the "ints" field.

func (*CategoryMutation) ClearPets

func (m *CategoryMutation) ClearPets()

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

func (*CategoryMutation) ClearSkipInSpec

func (m *CategoryMutation) ClearSkipInSpec()

ClearSkipInSpec clears the value of the "skip_in_spec" field.

func (*CategoryMutation) ClearStrings

func (m *CategoryMutation) ClearStrings()

ClearStrings clears the value of the "strings" 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) CreatedAt

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

CreatedAt returns the value of the "created_at" field in the mutation.

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) Ints

func (m *CategoryMutation) Ints() (r []int, exists bool)

Ints returns the value of the "ints" field in the mutation.

func (*CategoryMutation) IntsCleared

func (m *CategoryMutation) IntsCleared() bool

IntsCleared returns if the "ints" field was cleared in this 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) Nillable

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

Nillable returns the value of the "nillable" field in the mutation.

func (*CategoryMutation) OldCreatedAt

func (m *CategoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" 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) 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) OldInts

func (m *CategoryMutation) OldInts(ctx context.Context) (v []int, err error)

OldInts returns the old "ints" 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) 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) OldNillable

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

OldNillable returns the old "nillable" 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) OldSkipInSpec

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

OldSkipInSpec returns the old "skip_in_spec" 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) OldStrings

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

OldStrings returns the old "strings" 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) OldUpdatedAt

func (m *CategoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" 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) 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) ResetCreatedAt

func (m *CategoryMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

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) ResetInts

func (m *CategoryMutation) ResetInts()

ResetInts resets all changes to the "ints" field.

func (*CategoryMutation) ResetName

func (m *CategoryMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*CategoryMutation) ResetNillable

func (m *CategoryMutation) ResetNillable()

ResetNillable resets all changes to the "nillable" 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) ResetSkipInSpec

func (m *CategoryMutation) ResetSkipInSpec()

ResetSkipInSpec resets all changes to the "skip_in_spec" field.

func (*CategoryMutation) ResetStrings

func (m *CategoryMutation) ResetStrings()

ResetStrings resets all changes to the "strings" field.

func (*CategoryMutation) ResetUpdatedAt

func (m *CategoryMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CategoryMutation) SetCreatedAt

func (m *CategoryMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" 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) SetInts

func (m *CategoryMutation) SetInts(i []int)

SetInts sets the "ints" field.

func (*CategoryMutation) SetName

func (m *CategoryMutation) SetName(s string)

SetName sets the "name" field.

func (*CategoryMutation) SetNillable

func (m *CategoryMutation) SetNillable(s string)

SetNillable sets the "nillable" 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) SetSkipInSpec

func (m *CategoryMutation) SetSkipInSpec(s string)

SetSkipInSpec sets the "skip_in_spec" field.

func (*CategoryMutation) SetStrings

func (m *CategoryMutation) SetStrings(s []string)

SetStrings sets the "strings" field.

func (*CategoryMutation) SetUpdatedAt

func (m *CategoryMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*CategoryMutation) SkipInSpec

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

SkipInSpec returns the value of the "skip_in_spec" field in the mutation.

func (*CategoryMutation) SkipInSpecCleared

func (m *CategoryMutation) SkipInSpecCleared() bool

SkipInSpecCleared returns if the "skip_in_spec" field was cleared in this mutation.

func (*CategoryMutation) Strings

func (m *CategoryMutation) Strings() (r []string, exists bool)

Strings returns the value of the "strings" field in the mutation.

func (*CategoryMutation) StringsCleared

func (m *CategoryMutation) StringsCleared() bool

StringsCleared returns if the "strings" field was cleared in this mutation.

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) UpdatedAt

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

UpdatedAt returns the value of the "updated_at" field in the mutation.

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

client.Category.Query().
	GroupBy(category.FieldCreatedAt).
	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

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 {
	CreatedAt time.Time `json:"created_at"`
}

client.Category.Query().
	Select(category.FieldCreatedAt).
	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) AppendInts

func (cu *CategoryUpdate) AppendInts(i []int) *CategoryUpdate

AppendInts appends i to the "ints" field.

func (*CategoryUpdate) AppendStrings

func (cu *CategoryUpdate) AppendStrings(s []string) *CategoryUpdate

AppendStrings appends s to the "strings" field.

func (*CategoryUpdate) ClearInts

func (cu *CategoryUpdate) ClearInts() *CategoryUpdate

ClearInts clears the value of the "ints" field.

func (*CategoryUpdate) ClearPets

func (cu *CategoryUpdate) ClearPets() *CategoryUpdate

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

func (*CategoryUpdate) ClearSkipInSpec

func (cu *CategoryUpdate) ClearSkipInSpec() *CategoryUpdate

ClearSkipInSpec clears the value of the "skip_in_spec" field.

func (*CategoryUpdate) ClearStrings

func (cu *CategoryUpdate) ClearStrings() *CategoryUpdate

ClearStrings clears the value of the "strings" 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) SetInts

func (cu *CategoryUpdate) SetInts(i []int) *CategoryUpdate

SetInts sets the "ints" field.

func (*CategoryUpdate) SetName

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

SetName sets the "name" field.

func (*CategoryUpdate) SetNillable

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

SetNillable sets the "nillable" field.

func (*CategoryUpdate) SetNillableName

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

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

func (*CategoryUpdate) SetNillableNillable

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

SetNillableNillable sets the "nillable" field if the given value is not nil.

func (*CategoryUpdate) SetNillableReadonly

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

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

func (*CategoryUpdate) SetNillableSkipInSpec

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

SetNillableSkipInSpec sets the "skip_in_spec" 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) SetSkipInSpec

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

SetSkipInSpec sets the "skip_in_spec" field.

func (*CategoryUpdate) SetStrings

func (cu *CategoryUpdate) SetStrings(s []string) *CategoryUpdate

SetStrings sets the "strings" field.

func (*CategoryUpdate) SetUpdatedAt

func (cu *CategoryUpdate) SetUpdatedAt(t time.Time) *CategoryUpdate

SetUpdatedAt sets the "updated_at" 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) AppendInts

func (cuo *CategoryUpdateOne) AppendInts(i []int) *CategoryUpdateOne

AppendInts appends i to the "ints" field.

func (*CategoryUpdateOne) AppendStrings

func (cuo *CategoryUpdateOne) AppendStrings(s []string) *CategoryUpdateOne

AppendStrings appends s to the "strings" field.

func (*CategoryUpdateOne) ClearInts

func (cuo *CategoryUpdateOne) ClearInts() *CategoryUpdateOne

ClearInts clears the value of the "ints" field.

func (*CategoryUpdateOne) ClearPets

func (cuo *CategoryUpdateOne) ClearPets() *CategoryUpdateOne

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

func (*CategoryUpdateOne) ClearSkipInSpec

func (cuo *CategoryUpdateOne) ClearSkipInSpec() *CategoryUpdateOne

ClearSkipInSpec clears the value of the "skip_in_spec" field.

func (*CategoryUpdateOne) ClearStrings

func (cuo *CategoryUpdateOne) ClearStrings() *CategoryUpdateOne

ClearStrings clears the value of the "strings" 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) SetInts

func (cuo *CategoryUpdateOne) SetInts(i []int) *CategoryUpdateOne

SetInts sets the "ints" field.

func (*CategoryUpdateOne) SetName

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

SetName sets the "name" field.

func (*CategoryUpdateOne) SetNillable

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

SetNillable sets the "nillable" field.

func (*CategoryUpdateOne) SetNillableName

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

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

func (*CategoryUpdateOne) SetNillableNillable

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

SetNillableNillable sets the "nillable" field if the given value is not nil.

func (*CategoryUpdateOne) SetNillableReadonly

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

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

func (*CategoryUpdateOne) SetNillableSkipInSpec

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

SetNillableSkipInSpec sets the "skip_in_spec" 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) SetSkipInSpec

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

SetSkipInSpec sets the "skip_in_spec" field.

func (*CategoryUpdateOne) SetStrings

func (cuo *CategoryUpdateOne) SetStrings(s []string) *CategoryUpdateOne

SetStrings sets the "strings" field.

func (*CategoryUpdateOne) SetUpdatedAt

func (cuo *CategoryUpdateOne) SetUpdatedAt(t time.Time) *CategoryUpdateOne

SetUpdatedAt sets the "updated_at" 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
	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Follows is the client for interacting with the Follows builders.
	Follows *FollowsClient
	// Friendship is the client for interacting with the Friendship builders.
	Friendship *FriendshipClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Settings is the client for interacting with the Settings builders.
	Settings *SettingsClient
	// Skipped is the client for interacting with the Skipped builders.
	Skipped *SkippedClient
	// 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().
	Category.
	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 Follows

type Follows struct {

	// FollowedAt holds the value of the "followed_at" field.
	FollowedAt time.Time `json:"followed_at"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id"`
	// PetID holds the value of the "pet_id" field.
	PetID int `json:"pet_id"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FollowsQuery when eager-loading is set.
	Edges FollowsEdges `json:"edges"`
	// contains filtered or unexported fields
}

Follows is the model entity for the Follows schema.

func (*Follows) QueryPet

func (f *Follows) QueryPet() *PetQuery

QueryPet queries the "pet" edge of the Follows entity.

func (*Follows) QueryUser

func (f *Follows) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Follows entity.

func (*Follows) String

func (f *Follows) String() string

String implements the fmt.Stringer.

func (*Follows) Unwrap

func (f *Follows) Unwrap() *Follows

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

func (f *Follows) Update() *FollowsUpdateOne

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

func (*Follows) Value

func (f *Follows) Value(name string) (ent.Value, error)

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

type FollowsClient

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

FollowsClient is a client for the Follows schema.

func NewFollowsClient

func NewFollowsClient(c config) *FollowsClient

NewFollowsClient returns a client for the Follows from the given config.

func (*FollowsClient) Create

func (c *FollowsClient) Create() *FollowsCreate

Create returns a builder for creating a Follows entity.

func (*FollowsClient) CreateBulk

func (c *FollowsClient) CreateBulk(builders ...*FollowsCreate) *FollowsCreateBulk

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

func (*FollowsClient) Delete

func (c *FollowsClient) Delete() *FollowsDelete

Delete returns a delete builder for Follows.

func (*FollowsClient) Hooks

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

Hooks returns the client hooks.

func (*FollowsClient) Intercept

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

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

func (*FollowsClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FollowsClient) MapCreateBulk

func (c *FollowsClient) MapCreateBulk(slice any, setFunc func(*FollowsCreate, int)) *FollowsCreateBulk

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

func (*FollowsClient) Query

func (c *FollowsClient) Query() *FollowsQuery

Query returns a query builder for Follows.

func (*FollowsClient) QueryPet

func (c *FollowsClient) QueryPet(f *Follows) *PetQuery

QueryPet queries the pet edge of a Follows.

func (*FollowsClient) QueryUser

func (c *FollowsClient) QueryUser(f *Follows) *UserQuery

QueryUser queries the user edge of a Follows.

func (*FollowsClient) Update

func (c *FollowsClient) Update() *FollowsUpdate

Update returns an update builder for Follows.

func (*FollowsClient) UpdateOne

func (c *FollowsClient) UpdateOne(f *Follows) *FollowsUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FollowsClient) Use

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

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

type FollowsCreate

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

FollowsCreate is the builder for creating a Follows entity.

func (*FollowsCreate) Exec

func (fc *FollowsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FollowsCreate) ExecX

func (fc *FollowsCreate) ExecX(ctx context.Context)

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

func (*FollowsCreate) Mutation

func (fc *FollowsCreate) Mutation() *FollowsMutation

Mutation returns the FollowsMutation object of the builder.

func (*FollowsCreate) Save

func (fc *FollowsCreate) Save(ctx context.Context) (*Follows, error)

Save creates the Follows in the database.

func (*FollowsCreate) SaveX

func (fc *FollowsCreate) SaveX(ctx context.Context) *Follows

SaveX calls Save and panics if Save returns an error.

func (*FollowsCreate) SetFollowedAt

func (fc *FollowsCreate) SetFollowedAt(t time.Time) *FollowsCreate

SetFollowedAt sets the "followed_at" field.

func (*FollowsCreate) SetNillableFollowedAt

func (fc *FollowsCreate) SetNillableFollowedAt(t *time.Time) *FollowsCreate

SetNillableFollowedAt sets the "followed_at" field if the given value is not nil.

func (*FollowsCreate) SetPet

func (fc *FollowsCreate) SetPet(p *Pet) *FollowsCreate

SetPet sets the "pet" edge to the Pet entity.

func (*FollowsCreate) SetPetID

func (fc *FollowsCreate) SetPetID(i int) *FollowsCreate

SetPetID sets the "pet_id" field.

func (*FollowsCreate) SetUser

func (fc *FollowsCreate) SetUser(u *User) *FollowsCreate

SetUser sets the "user" edge to the User entity.

func (*FollowsCreate) SetUserID

func (fc *FollowsCreate) SetUserID(i int) *FollowsCreate

SetUserID sets the "user_id" field.

type FollowsCreateBulk

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

FollowsCreateBulk is the builder for creating many Follows entities in bulk.

func (*FollowsCreateBulk) Exec

func (fcb *FollowsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FollowsCreateBulk) ExecX

func (fcb *FollowsCreateBulk) ExecX(ctx context.Context)

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

func (*FollowsCreateBulk) Save

func (fcb *FollowsCreateBulk) Save(ctx context.Context) ([]*Follows, error)

Save creates the Follows entities in the database.

func (*FollowsCreateBulk) SaveX

func (fcb *FollowsCreateBulk) SaveX(ctx context.Context) []*Follows

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

type FollowsDelete

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

FollowsDelete is the builder for deleting a Follows entity.

func (*FollowsDelete) Exec

func (fd *FollowsDelete) Exec(ctx context.Context) (int, error)

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

func (*FollowsDelete) ExecX

func (fd *FollowsDelete) ExecX(ctx context.Context) int

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

func (*FollowsDelete) Where

func (fd *FollowsDelete) Where(ps ...predicate.Follows) *FollowsDelete

Where appends a list predicates to the FollowsDelete builder.

type FollowsDeleteOne

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

FollowsDeleteOne is the builder for deleting a single Follows entity.

func (*FollowsDeleteOne) Exec

func (fdo *FollowsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FollowsDeleteOne) ExecX

func (fdo *FollowsDeleteOne) ExecX(ctx context.Context)

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

func (*FollowsDeleteOne) Where

Where appends a list predicates to the FollowsDelete builder.

type FollowsEdges

type FollowsEdges struct {
	// The user that is following the pet.
	User *User `json:"user,omitempty"`
	// The pet that is being followed by the user.
	Pet *Pet `json:"pet,omitempty"`
	// contains filtered or unexported fields
}

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

func (FollowsEdges) PetOrErr

func (e FollowsEdges) PetOrErr() (*Pet, error)

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

func (FollowsEdges) UserOrErr

func (e FollowsEdges) UserOrErr() (*User, error)

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

type FollowsGroupBy

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

FollowsGroupBy is the group-by builder for Follows entities.

func (*FollowsGroupBy) Aggregate

func (fgb *FollowsGroupBy) Aggregate(fns ...AggregateFunc) *FollowsGroupBy

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

func (*FollowsGroupBy) Bool

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

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

func (*FollowsGroupBy) BoolX

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

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

func (*FollowsGroupBy) Bools

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

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

func (*FollowsGroupBy) BoolsX

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

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

func (*FollowsGroupBy) Float64

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

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

func (*FollowsGroupBy) Float64X

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

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

func (*FollowsGroupBy) Float64s

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

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

func (*FollowsGroupBy) Float64sX

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

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

func (*FollowsGroupBy) Int

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

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

func (*FollowsGroupBy) IntX

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

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

func (*FollowsGroupBy) Ints

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

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

func (*FollowsGroupBy) IntsX

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

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

func (*FollowsGroupBy) Scan

func (fgb *FollowsGroupBy) Scan(ctx context.Context, v any) error

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

func (*FollowsGroupBy) ScanX

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

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

func (*FollowsGroupBy) String

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

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

func (*FollowsGroupBy) StringX

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

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

func (*FollowsGroupBy) Strings

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

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

func (*FollowsGroupBy) StringsX

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

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

type FollowsMutation

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

FollowsMutation represents an operation that mutates the Follows nodes in the graph.

func (*FollowsMutation) AddField

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

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

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

func (*FollowsMutation) AddedField

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

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

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

func (*FollowsMutation) AddedIDs

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

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

func (*FollowsMutation) ClearEdge

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

func (m *FollowsMutation) 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 (*FollowsMutation) ClearPet

func (m *FollowsMutation) ClearPet()

ClearPet clears the "pet" edge to the Pet entity.

func (*FollowsMutation) ClearUser

func (m *FollowsMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*FollowsMutation) ClearedEdges

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

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

func (*FollowsMutation) ClearedFields

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

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

func (FollowsMutation) Client

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

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

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

func (*FollowsMutation) Field

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

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

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

func (*FollowsMutation) Fields

func (m *FollowsMutation) 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 (*FollowsMutation) FollowedAt

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

FollowedAt returns the value of the "followed_at" field in the mutation.

func (*FollowsMutation) OldField

func (m *FollowsMutation) 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 (*FollowsMutation) Op

func (m *FollowsMutation) Op() Op

Op returns the operation name.

func (*FollowsMutation) PetCleared

func (m *FollowsMutation) PetCleared() bool

PetCleared reports if the "pet" edge to the Pet entity was cleared.

func (*FollowsMutation) PetID

func (m *FollowsMutation) PetID() (r int, exists bool)

PetID returns the value of the "pet_id" field in the mutation.

func (*FollowsMutation) PetIDs

func (m *FollowsMutation) PetIDs() (ids []int)

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

func (*FollowsMutation) RemovedEdges

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

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

func (*FollowsMutation) RemovedIDs

func (m *FollowsMutation) 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 (*FollowsMutation) ResetEdge

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

func (m *FollowsMutation) 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 (*FollowsMutation) ResetFollowedAt

func (m *FollowsMutation) ResetFollowedAt()

ResetFollowedAt resets all changes to the "followed_at" field.

func (*FollowsMutation) ResetPet

func (m *FollowsMutation) ResetPet()

ResetPet resets all changes to the "pet" edge.

func (*FollowsMutation) ResetPetID

func (m *FollowsMutation) ResetPetID()

ResetPetID resets all changes to the "pet_id" field.

func (*FollowsMutation) ResetUser

func (m *FollowsMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*FollowsMutation) ResetUserID

func (m *FollowsMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*FollowsMutation) SetField

func (m *FollowsMutation) 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 (*FollowsMutation) SetFollowedAt

func (m *FollowsMutation) SetFollowedAt(t time.Time)

SetFollowedAt sets the "followed_at" field.

func (*FollowsMutation) SetOp

func (m *FollowsMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FollowsMutation) SetPetID

func (m *FollowsMutation) SetPetID(i int)

SetPetID sets the "pet_id" field.

func (*FollowsMutation) SetUserID

func (m *FollowsMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (FollowsMutation) Tx

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

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

func (*FollowsMutation) Type

func (m *FollowsMutation) Type() string

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

func (*FollowsMutation) UserCleared

func (m *FollowsMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*FollowsMutation) UserID

func (m *FollowsMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*FollowsMutation) UserIDs

func (m *FollowsMutation) UserIDs() (ids []int)

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

func (*FollowsMutation) Where

func (m *FollowsMutation) Where(ps ...predicate.Follows)

Where appends a list predicates to the FollowsMutation builder.

func (*FollowsMutation) WhereP

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

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

type FollowsQuery

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

FollowsQuery is the builder for querying Follows entities.

func (*FollowsQuery) Aggregate

func (fq *FollowsQuery) Aggregate(fns ...AggregateFunc) *FollowsSelect

Aggregate returns a FollowsSelect configured with the given aggregations.

func (*FollowsQuery) All

func (fq *FollowsQuery) All(ctx context.Context) ([]*Follows, error)

All executes the query and returns a list of FollowsSlice.

func (*FollowsQuery) AllX

func (fq *FollowsQuery) AllX(ctx context.Context) []*Follows

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

func (*FollowsQuery) Clone

func (fq *FollowsQuery) Clone() *FollowsQuery

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

func (*FollowsQuery) Count

func (fq *FollowsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FollowsQuery) CountX

func (fq *FollowsQuery) CountX(ctx context.Context) int

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

func (*FollowsQuery) Exist

func (fq *FollowsQuery) Exist(ctx context.Context) (bool, error)

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

func (*FollowsQuery) ExistX

func (fq *FollowsQuery) ExistX(ctx context.Context) bool

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

func (*FollowsQuery) First

func (fq *FollowsQuery) First(ctx context.Context) (*Follows, error)

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

func (*FollowsQuery) FirstX

func (fq *FollowsQuery) FirstX(ctx context.Context) *Follows

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

func (*FollowsQuery) GroupBy

func (fq *FollowsQuery) GroupBy(field string, fields ...string) *FollowsGroupBy

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

client.Follows.Query().
	GroupBy(follows.FieldFollowedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FollowsQuery) Limit

func (fq *FollowsQuery) Limit(limit int) *FollowsQuery

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

func (*FollowsQuery) Offset

func (fq *FollowsQuery) Offset(offset int) *FollowsQuery

Offset to start from.

func (*FollowsQuery) Only

func (fq *FollowsQuery) Only(ctx context.Context) (*Follows, error)

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

func (*FollowsQuery) OnlyX

func (fq *FollowsQuery) OnlyX(ctx context.Context) *Follows

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

func (*FollowsQuery) Order

func (fq *FollowsQuery) Order(o ...follows.OrderOption) *FollowsQuery

Order specifies how the records should be ordered.

func (*FollowsQuery) QueryPet

func (fq *FollowsQuery) QueryPet() *PetQuery

QueryPet chains the current query on the "pet" edge.

func (*FollowsQuery) QueryUser

func (fq *FollowsQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*FollowsQuery) Select

func (fq *FollowsQuery) Select(fields ...string) *FollowsSelect

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 {
	FollowedAt time.Time `json:"followed_at"`
}

client.Follows.Query().
	Select(follows.FieldFollowedAt).
	Scan(ctx, &v)

func (*FollowsQuery) Unique

func (fq *FollowsQuery) Unique(unique bool) *FollowsQuery

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

func (fq *FollowsQuery) Where(ps ...predicate.Follows) *FollowsQuery

Where adds a new predicate for the FollowsQuery builder.

func (*FollowsQuery) WithPet

func (fq *FollowsQuery) WithPet(opts ...func(*PetQuery)) *FollowsQuery

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

func (*FollowsQuery) WithUser

func (fq *FollowsQuery) WithUser(opts ...func(*UserQuery)) *FollowsQuery

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

type FollowsSelect

type FollowsSelect struct {
	*FollowsQuery
	// contains filtered or unexported fields
}

FollowsSelect is the builder for selecting fields of Follows entities.

func (*FollowsSelect) Aggregate

func (fs *FollowsSelect) Aggregate(fns ...AggregateFunc) *FollowsSelect

Aggregate adds the given aggregation functions to the selector query.

func (*FollowsSelect) Bool

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

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

func (*FollowsSelect) BoolX

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

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

func (*FollowsSelect) Bools

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

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

func (*FollowsSelect) BoolsX

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

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

func (*FollowsSelect) Float64

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

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

func (*FollowsSelect) Float64X

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

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

func (*FollowsSelect) Float64s

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

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

func (*FollowsSelect) Float64sX

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

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

func (*FollowsSelect) Int

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

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

func (*FollowsSelect) IntX

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

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

func (*FollowsSelect) Ints

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

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

func (*FollowsSelect) IntsX

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

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

func (*FollowsSelect) Scan

func (fs *FollowsSelect) Scan(ctx context.Context, v any) error

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

func (*FollowsSelect) ScanX

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

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

func (*FollowsSelect) String

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

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

func (*FollowsSelect) StringX

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

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

func (*FollowsSelect) Strings

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

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

func (*FollowsSelect) StringsX

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

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

type FollowsSlice

type FollowsSlice []*Follows

FollowsSlice is a parsable slice of Follows.

type FollowsUpdate

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

FollowsUpdate is the builder for updating Follows entities.

func (*FollowsUpdate) ClearPet

func (fu *FollowsUpdate) ClearPet() *FollowsUpdate

ClearPet clears the "pet" edge to the Pet entity.

func (*FollowsUpdate) ClearUser

func (fu *FollowsUpdate) ClearUser() *FollowsUpdate

ClearUser clears the "user" edge to the User entity.

func (*FollowsUpdate) Exec

func (fu *FollowsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FollowsUpdate) ExecX

func (fu *FollowsUpdate) ExecX(ctx context.Context)

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

func (*FollowsUpdate) Mutation

func (fu *FollowsUpdate) Mutation() *FollowsMutation

Mutation returns the FollowsMutation object of the builder.

func (*FollowsUpdate) Save

func (fu *FollowsUpdate) Save(ctx context.Context) (int, error)

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

func (*FollowsUpdate) SaveX

func (fu *FollowsUpdate) SaveX(ctx context.Context) int

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

func (*FollowsUpdate) SetFollowedAt

func (fu *FollowsUpdate) SetFollowedAt(t time.Time) *FollowsUpdate

SetFollowedAt sets the "followed_at" field.

func (*FollowsUpdate) SetNillableFollowedAt

func (fu *FollowsUpdate) SetNillableFollowedAt(t *time.Time) *FollowsUpdate

SetNillableFollowedAt sets the "followed_at" field if the given value is not nil.

func (*FollowsUpdate) SetNillablePetID

func (fu *FollowsUpdate) SetNillablePetID(i *int) *FollowsUpdate

SetNillablePetID sets the "pet_id" field if the given value is not nil.

func (*FollowsUpdate) SetNillableUserID

func (fu *FollowsUpdate) SetNillableUserID(i *int) *FollowsUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FollowsUpdate) SetPet

func (fu *FollowsUpdate) SetPet(p *Pet) *FollowsUpdate

SetPet sets the "pet" edge to the Pet entity.

func (*FollowsUpdate) SetPetID

func (fu *FollowsUpdate) SetPetID(i int) *FollowsUpdate

SetPetID sets the "pet_id" field.

func (*FollowsUpdate) SetUser

func (fu *FollowsUpdate) SetUser(u *User) *FollowsUpdate

SetUser sets the "user" edge to the User entity.

func (*FollowsUpdate) SetUserID

func (fu *FollowsUpdate) SetUserID(i int) *FollowsUpdate

SetUserID sets the "user_id" field.

func (*FollowsUpdate) Where

func (fu *FollowsUpdate) Where(ps ...predicate.Follows) *FollowsUpdate

Where appends a list predicates to the FollowsUpdate builder.

type FollowsUpdateOne

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

FollowsUpdateOne is the builder for updating a single Follows entity.

func (*FollowsUpdateOne) ClearPet

func (fuo *FollowsUpdateOne) ClearPet() *FollowsUpdateOne

ClearPet clears the "pet" edge to the Pet entity.

func (*FollowsUpdateOne) ClearUser

func (fuo *FollowsUpdateOne) ClearUser() *FollowsUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*FollowsUpdateOne) Exec

func (fuo *FollowsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FollowsUpdateOne) ExecX

func (fuo *FollowsUpdateOne) ExecX(ctx context.Context)

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

func (*FollowsUpdateOne) Mutation

func (fuo *FollowsUpdateOne) Mutation() *FollowsMutation

Mutation returns the FollowsMutation object of the builder.

func (*FollowsUpdateOne) Save

func (fuo *FollowsUpdateOne) Save(ctx context.Context) (*Follows, error)

Save executes the query and returns the updated Follows entity.

func (*FollowsUpdateOne) SaveX

func (fuo *FollowsUpdateOne) SaveX(ctx context.Context) *Follows

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

func (*FollowsUpdateOne) Select

func (fuo *FollowsUpdateOne) Select(field string, fields ...string) *FollowsUpdateOne

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

func (*FollowsUpdateOne) SetFollowedAt

func (fuo *FollowsUpdateOne) SetFollowedAt(t time.Time) *FollowsUpdateOne

SetFollowedAt sets the "followed_at" field.

func (*FollowsUpdateOne) SetNillableFollowedAt

func (fuo *FollowsUpdateOne) SetNillableFollowedAt(t *time.Time) *FollowsUpdateOne

SetNillableFollowedAt sets the "followed_at" field if the given value is not nil.

func (*FollowsUpdateOne) SetNillablePetID

func (fuo *FollowsUpdateOne) SetNillablePetID(i *int) *FollowsUpdateOne

SetNillablePetID sets the "pet_id" field if the given value is not nil.

func (*FollowsUpdateOne) SetNillableUserID

func (fuo *FollowsUpdateOne) SetNillableUserID(i *int) *FollowsUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FollowsUpdateOne) SetPet

func (fuo *FollowsUpdateOne) SetPet(p *Pet) *FollowsUpdateOne

SetPet sets the "pet" edge to the Pet entity.

func (*FollowsUpdateOne) SetPetID

func (fuo *FollowsUpdateOne) SetPetID(i int) *FollowsUpdateOne

SetPetID sets the "pet_id" field.

func (*FollowsUpdateOne) SetUser

func (fuo *FollowsUpdateOne) SetUser(u *User) *FollowsUpdateOne

SetUser sets the "user" edge to the User entity.

func (*FollowsUpdateOne) SetUserID

func (fuo *FollowsUpdateOne) SetUserID(i int) *FollowsUpdateOne

SetUserID sets the "user_id" field.

func (*FollowsUpdateOne) Where

Where appends a list predicates to the FollowsUpdate builder.

type Friendship

type Friendship struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id"`
	// FriendID holds the value of the "friend_id" field.
	FriendID int `json:"friend_id"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FriendshipQuery when eager-loading is set.
	Edges FriendshipEdges `json:"edges"`
	// contains filtered or unexported fields
}

Friendship is the model entity for the Friendship schema.

func (*Friendship) QueryFriend

func (f *Friendship) QueryFriend() *UserQuery

QueryFriend queries the "friend" edge of the Friendship entity.

func (*Friendship) QueryUser

func (f *Friendship) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Friendship entity.

func (*Friendship) String

func (f *Friendship) String() string

String implements the fmt.Stringer.

func (*Friendship) Unwrap

func (f *Friendship) Unwrap() *Friendship

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

func (f *Friendship) Update() *FriendshipUpdateOne

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

func (*Friendship) Value

func (f *Friendship) Value(name string) (ent.Value, error)

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

type FriendshipClient

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

FriendshipClient is a client for the Friendship schema.

func NewFriendshipClient

func NewFriendshipClient(c config) *FriendshipClient

NewFriendshipClient returns a client for the Friendship from the given config.

func (*FriendshipClient) Create

func (c *FriendshipClient) Create() *FriendshipCreate

Create returns a builder for creating a Friendship entity.

func (*FriendshipClient) CreateBulk

func (c *FriendshipClient) CreateBulk(builders ...*FriendshipCreate) *FriendshipCreateBulk

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

func (*FriendshipClient) Delete

func (c *FriendshipClient) Delete() *FriendshipDelete

Delete returns a delete builder for Friendship.

func (*FriendshipClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*FriendshipClient) DeleteOneID

func (c *FriendshipClient) DeleteOneID(id int) *FriendshipDeleteOne

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

func (*FriendshipClient) Get

func (c *FriendshipClient) Get(ctx context.Context, id int) (*Friendship, error)

Get returns a Friendship entity by its id.

func (*FriendshipClient) GetX

func (c *FriendshipClient) GetX(ctx context.Context, id int) *Friendship

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

func (*FriendshipClient) Hooks

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

Hooks returns the client hooks.

func (*FriendshipClient) Intercept

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

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

func (*FriendshipClient) Interceptors

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

Interceptors returns the client interceptors.

func (*FriendshipClient) MapCreateBulk

func (c *FriendshipClient) MapCreateBulk(slice any, setFunc func(*FriendshipCreate, int)) *FriendshipCreateBulk

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

func (*FriendshipClient) Query

func (c *FriendshipClient) Query() *FriendshipQuery

Query returns a query builder for Friendship.

func (*FriendshipClient) QueryFriend

func (c *FriendshipClient) QueryFriend(f *Friendship) *UserQuery

QueryFriend queries the friend edge of a Friendship.

func (*FriendshipClient) QueryUser

func (c *FriendshipClient) QueryUser(f *Friendship) *UserQuery

QueryUser queries the user edge of a Friendship.

func (*FriendshipClient) Update

func (c *FriendshipClient) Update() *FriendshipUpdate

Update returns an update builder for Friendship.

func (*FriendshipClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*FriendshipClient) UpdateOneID

func (c *FriendshipClient) UpdateOneID(id int) *FriendshipUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FriendshipClient) Use

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

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

type FriendshipCreate

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

FriendshipCreate is the builder for creating a Friendship entity.

func (*FriendshipCreate) Exec

func (fc *FriendshipCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FriendshipCreate) ExecX

func (fc *FriendshipCreate) ExecX(ctx context.Context)

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

func (*FriendshipCreate) Mutation

func (fc *FriendshipCreate) Mutation() *FriendshipMutation

Mutation returns the FriendshipMutation object of the builder.

func (*FriendshipCreate) Save

func (fc *FriendshipCreate) Save(ctx context.Context) (*Friendship, error)

Save creates the Friendship in the database.

func (*FriendshipCreate) SaveX

func (fc *FriendshipCreate) SaveX(ctx context.Context) *Friendship

SaveX calls Save and panics if Save returns an error.

func (*FriendshipCreate) SetCreatedAt

func (fc *FriendshipCreate) SetCreatedAt(t time.Time) *FriendshipCreate

SetCreatedAt sets the "created_at" field.

func (*FriendshipCreate) SetFriend

func (fc *FriendshipCreate) SetFriend(u *User) *FriendshipCreate

SetFriend sets the "friend" edge to the User entity.

func (*FriendshipCreate) SetFriendID

func (fc *FriendshipCreate) SetFriendID(i int) *FriendshipCreate

SetFriendID sets the "friend_id" field.

func (*FriendshipCreate) SetNillableCreatedAt

func (fc *FriendshipCreate) SetNillableCreatedAt(t *time.Time) *FriendshipCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*FriendshipCreate) SetUser

func (fc *FriendshipCreate) SetUser(u *User) *FriendshipCreate

SetUser sets the "user" edge to the User entity.

func (*FriendshipCreate) SetUserID

func (fc *FriendshipCreate) SetUserID(i int) *FriendshipCreate

SetUserID sets the "user_id" field.

type FriendshipCreateBulk

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

FriendshipCreateBulk is the builder for creating many Friendship entities in bulk.

func (*FriendshipCreateBulk) Exec

func (fcb *FriendshipCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FriendshipCreateBulk) ExecX

func (fcb *FriendshipCreateBulk) ExecX(ctx context.Context)

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

func (*FriendshipCreateBulk) Save

func (fcb *FriendshipCreateBulk) Save(ctx context.Context) ([]*Friendship, error)

Save creates the Friendship entities in the database.

func (*FriendshipCreateBulk) SaveX

func (fcb *FriendshipCreateBulk) SaveX(ctx context.Context) []*Friendship

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

type FriendshipDelete

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

FriendshipDelete is the builder for deleting a Friendship entity.

func (*FriendshipDelete) Exec

func (fd *FriendshipDelete) Exec(ctx context.Context) (int, error)

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

func (*FriendshipDelete) ExecX

func (fd *FriendshipDelete) ExecX(ctx context.Context) int

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

func (*FriendshipDelete) Where

Where appends a list predicates to the FriendshipDelete builder.

type FriendshipDeleteOne

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

FriendshipDeleteOne is the builder for deleting a single Friendship entity.

func (*FriendshipDeleteOne) Exec

func (fdo *FriendshipDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FriendshipDeleteOne) ExecX

func (fdo *FriendshipDeleteOne) ExecX(ctx context.Context)

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

func (*FriendshipDeleteOne) Where

Where appends a list predicates to the FriendshipDelete builder.

type FriendshipEdges

type FriendshipEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Friend holds the value of the friend edge.
	Friend *User `json:"friend,omitempty"`
	// contains filtered or unexported fields
}

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

func (FriendshipEdges) FriendOrErr

func (e FriendshipEdges) FriendOrErr() (*User, error)

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

func (FriendshipEdges) UserOrErr

func (e FriendshipEdges) UserOrErr() (*User, error)

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

type FriendshipGroupBy

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

FriendshipGroupBy is the group-by builder for Friendship entities.

func (*FriendshipGroupBy) Aggregate

func (fgb *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy

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

func (*FriendshipGroupBy) Bool

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

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

func (*FriendshipGroupBy) BoolX

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

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

func (*FriendshipGroupBy) Bools

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

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

func (*FriendshipGroupBy) BoolsX

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

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

func (*FriendshipGroupBy) Float64

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

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

func (*FriendshipGroupBy) Float64X

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

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

func (*FriendshipGroupBy) Float64s

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

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

func (*FriendshipGroupBy) Float64sX

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

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

func (*FriendshipGroupBy) Int

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

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

func (*FriendshipGroupBy) IntX

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

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

func (*FriendshipGroupBy) Ints

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

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

func (*FriendshipGroupBy) IntsX

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

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

func (*FriendshipGroupBy) Scan

func (fgb *FriendshipGroupBy) Scan(ctx context.Context, v any) error

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

func (*FriendshipGroupBy) ScanX

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

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

func (*FriendshipGroupBy) String

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

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

func (*FriendshipGroupBy) StringX

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

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

func (*FriendshipGroupBy) Strings

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

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

func (*FriendshipGroupBy) StringsX

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

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

type FriendshipMutation

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

FriendshipMutation represents an operation that mutates the Friendship nodes in the graph.

func (*FriendshipMutation) AddField

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

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

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

func (*FriendshipMutation) AddedField

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

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

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

func (*FriendshipMutation) AddedIDs

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

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

func (*FriendshipMutation) ClearEdge

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

func (m *FriendshipMutation) 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 (*FriendshipMutation) ClearFriend

func (m *FriendshipMutation) ClearFriend()

ClearFriend clears the "friend" edge to the User entity.

func (*FriendshipMutation) ClearUser

func (m *FriendshipMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*FriendshipMutation) ClearedEdges

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

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

func (*FriendshipMutation) ClearedFields

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

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

func (FriendshipMutation) Client

func (m FriendshipMutation) 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 (*FriendshipMutation) CreatedAt

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

CreatedAt returns the value of the "created_at" field in the mutation.

func (*FriendshipMutation) EdgeCleared

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

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

func (*FriendshipMutation) Field

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

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

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

func (*FriendshipMutation) Fields

func (m *FriendshipMutation) 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 (*FriendshipMutation) FriendCleared

func (m *FriendshipMutation) FriendCleared() bool

FriendCleared reports if the "friend" edge to the User entity was cleared.

func (*FriendshipMutation) FriendID

func (m *FriendshipMutation) FriendID() (r int, exists bool)

FriendID returns the value of the "friend_id" field in the mutation.

func (*FriendshipMutation) FriendIDs

func (m *FriendshipMutation) FriendIDs() (ids []int)

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

func (*FriendshipMutation) ID

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

func (m *FriendshipMutation) 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 (*FriendshipMutation) OldCreatedAt

func (m *FriendshipMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Friendship entity. If the Friendship 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 (*FriendshipMutation) OldField

func (m *FriendshipMutation) 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 (*FriendshipMutation) OldFriendID

func (m *FriendshipMutation) OldFriendID(ctx context.Context) (v int, err error)

OldFriendID returns the old "friend_id" field's value of the Friendship entity. If the Friendship 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 (*FriendshipMutation) OldUserID

func (m *FriendshipMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_id" field's value of the Friendship entity. If the Friendship 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 (*FriendshipMutation) Op

func (m *FriendshipMutation) Op() Op

Op returns the operation name.

func (*FriendshipMutation) RemovedEdges

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

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

func (*FriendshipMutation) RemovedIDs

func (m *FriendshipMutation) 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 (*FriendshipMutation) ResetCreatedAt

func (m *FriendshipMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FriendshipMutation) ResetEdge

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

func (m *FriendshipMutation) 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 (*FriendshipMutation) ResetFriend

func (m *FriendshipMutation) ResetFriend()

ResetFriend resets all changes to the "friend" edge.

func (*FriendshipMutation) ResetFriendID

func (m *FriendshipMutation) ResetFriendID()

ResetFriendID resets all changes to the "friend_id" field.

func (*FriendshipMutation) ResetUser

func (m *FriendshipMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*FriendshipMutation) ResetUserID

func (m *FriendshipMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*FriendshipMutation) SetCreatedAt

func (m *FriendshipMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*FriendshipMutation) SetField

func (m *FriendshipMutation) 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 (*FriendshipMutation) SetFriendID

func (m *FriendshipMutation) SetFriendID(i int)

SetFriendID sets the "friend_id" field.

func (*FriendshipMutation) SetOp

func (m *FriendshipMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*FriendshipMutation) SetUserID

func (m *FriendshipMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (FriendshipMutation) Tx

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

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

func (*FriendshipMutation) Type

func (m *FriendshipMutation) Type() string

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

func (*FriendshipMutation) UserCleared

func (m *FriendshipMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*FriendshipMutation) UserID

func (m *FriendshipMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*FriendshipMutation) UserIDs

func (m *FriendshipMutation) UserIDs() (ids []int)

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

func (*FriendshipMutation) Where

func (m *FriendshipMutation) Where(ps ...predicate.Friendship)

Where appends a list predicates to the FriendshipMutation builder.

func (*FriendshipMutation) WhereP

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

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

type FriendshipQuery

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

FriendshipQuery is the builder for querying Friendship entities.

func (*FriendshipQuery) Aggregate

func (fq *FriendshipQuery) Aggregate(fns ...AggregateFunc) *FriendshipSelect

Aggregate returns a FriendshipSelect configured with the given aggregations.

func (*FriendshipQuery) All

func (fq *FriendshipQuery) All(ctx context.Context) ([]*Friendship, error)

All executes the query and returns a list of Friendships.

func (*FriendshipQuery) AllX

func (fq *FriendshipQuery) AllX(ctx context.Context) []*Friendship

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

func (*FriendshipQuery) Clone

func (fq *FriendshipQuery) Clone() *FriendshipQuery

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

func (*FriendshipQuery) Count

func (fq *FriendshipQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FriendshipQuery) CountX

func (fq *FriendshipQuery) CountX(ctx context.Context) int

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

func (*FriendshipQuery) Exist

func (fq *FriendshipQuery) Exist(ctx context.Context) (bool, error)

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

func (*FriendshipQuery) ExistX

func (fq *FriendshipQuery) ExistX(ctx context.Context) bool

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

func (*FriendshipQuery) First

func (fq *FriendshipQuery) First(ctx context.Context) (*Friendship, error)

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

func (*FriendshipQuery) FirstID

func (fq *FriendshipQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*FriendshipQuery) FirstIDX

func (fq *FriendshipQuery) FirstIDX(ctx context.Context) int

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

func (*FriendshipQuery) FirstX

func (fq *FriendshipQuery) FirstX(ctx context.Context) *Friendship

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

func (*FriendshipQuery) GroupBy

func (fq *FriendshipQuery) GroupBy(field string, fields ...string) *FriendshipGroupBy

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

client.Friendship.Query().
	GroupBy(friendship.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FriendshipQuery) IDs

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

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

func (*FriendshipQuery) IDsX

func (fq *FriendshipQuery) IDsX(ctx context.Context) []int

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

func (*FriendshipQuery) Limit

func (fq *FriendshipQuery) Limit(limit int) *FriendshipQuery

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

func (*FriendshipQuery) Offset

func (fq *FriendshipQuery) Offset(offset int) *FriendshipQuery

Offset to start from.

func (*FriendshipQuery) Only

func (fq *FriendshipQuery) Only(ctx context.Context) (*Friendship, error)

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

func (*FriendshipQuery) OnlyID

func (fq *FriendshipQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*FriendshipQuery) OnlyIDX

func (fq *FriendshipQuery) OnlyIDX(ctx context.Context) int

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

func (*FriendshipQuery) OnlyX

func (fq *FriendshipQuery) OnlyX(ctx context.Context) *Friendship

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

func (*FriendshipQuery) Order

Order specifies how the records should be ordered.

func (*FriendshipQuery) QueryFriend

func (fq *FriendshipQuery) QueryFriend() *UserQuery

QueryFriend chains the current query on the "friend" edge.

func (*FriendshipQuery) QueryUser

func (fq *FriendshipQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*FriendshipQuery) Select

func (fq *FriendshipQuery) Select(fields ...string) *FriendshipSelect

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 {
	CreatedAt time.Time `json:"created_at"`
}

client.Friendship.Query().
	Select(friendship.FieldCreatedAt).
	Scan(ctx, &v)

func (*FriendshipQuery) Unique

func (fq *FriendshipQuery) Unique(unique bool) *FriendshipQuery

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

Where adds a new predicate for the FriendshipQuery builder.

func (*FriendshipQuery) WithFriend

func (fq *FriendshipQuery) WithFriend(opts ...func(*UserQuery)) *FriendshipQuery

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

func (*FriendshipQuery) WithUser

func (fq *FriendshipQuery) WithUser(opts ...func(*UserQuery)) *FriendshipQuery

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

type FriendshipSelect

type FriendshipSelect struct {
	*FriendshipQuery
	// contains filtered or unexported fields
}

FriendshipSelect is the builder for selecting fields of Friendship entities.

func (*FriendshipSelect) Aggregate

func (fs *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect

Aggregate adds the given aggregation functions to the selector query.

func (*FriendshipSelect) Bool

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

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

func (*FriendshipSelect) BoolX

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

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

func (*FriendshipSelect) Bools

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

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

func (*FriendshipSelect) BoolsX

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

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

func (*FriendshipSelect) Float64

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

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

func (*FriendshipSelect) Float64X

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

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

func (*FriendshipSelect) Float64s

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

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

func (*FriendshipSelect) Float64sX

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

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

func (*FriendshipSelect) Int

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

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

func (*FriendshipSelect) IntX

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

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

func (*FriendshipSelect) Ints

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

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

func (*FriendshipSelect) IntsX

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

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

func (*FriendshipSelect) Scan

func (fs *FriendshipSelect) Scan(ctx context.Context, v any) error

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

func (*FriendshipSelect) ScanX

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

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

func (*FriendshipSelect) String

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

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

func (*FriendshipSelect) StringX

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

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

func (*FriendshipSelect) Strings

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

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

func (*FriendshipSelect) StringsX

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

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

type FriendshipUpdate

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

FriendshipUpdate is the builder for updating Friendship entities.

func (*FriendshipUpdate) ClearFriend

func (fu *FriendshipUpdate) ClearFriend() *FriendshipUpdate

ClearFriend clears the "friend" edge to the User entity.

func (*FriendshipUpdate) ClearUser

func (fu *FriendshipUpdate) ClearUser() *FriendshipUpdate

ClearUser clears the "user" edge to the User entity.

func (*FriendshipUpdate) Exec

func (fu *FriendshipUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FriendshipUpdate) ExecX

func (fu *FriendshipUpdate) ExecX(ctx context.Context)

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

func (*FriendshipUpdate) Mutation

func (fu *FriendshipUpdate) Mutation() *FriendshipMutation

Mutation returns the FriendshipMutation object of the builder.

func (*FriendshipUpdate) Save

func (fu *FriendshipUpdate) Save(ctx context.Context) (int, error)

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

func (*FriendshipUpdate) SaveX

func (fu *FriendshipUpdate) SaveX(ctx context.Context) int

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

func (*FriendshipUpdate) SetCreatedAt

func (fu *FriendshipUpdate) SetCreatedAt(t time.Time) *FriendshipUpdate

SetCreatedAt sets the "created_at" field.

func (*FriendshipUpdate) SetFriend

func (fu *FriendshipUpdate) SetFriend(u *User) *FriendshipUpdate

SetFriend sets the "friend" edge to the User entity.

func (*FriendshipUpdate) SetFriendID

func (fu *FriendshipUpdate) SetFriendID(i int) *FriendshipUpdate

SetFriendID sets the "friend_id" field.

func (*FriendshipUpdate) SetNillableCreatedAt

func (fu *FriendshipUpdate) SetNillableCreatedAt(t *time.Time) *FriendshipUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*FriendshipUpdate) SetNillableFriendID

func (fu *FriendshipUpdate) SetNillableFriendID(i *int) *FriendshipUpdate

SetNillableFriendID sets the "friend_id" field if the given value is not nil.

func (*FriendshipUpdate) SetNillableUserID

func (fu *FriendshipUpdate) SetNillableUserID(i *int) *FriendshipUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FriendshipUpdate) SetUser

func (fu *FriendshipUpdate) SetUser(u *User) *FriendshipUpdate

SetUser sets the "user" edge to the User entity.

func (*FriendshipUpdate) SetUserID

func (fu *FriendshipUpdate) SetUserID(i int) *FriendshipUpdate

SetUserID sets the "user_id" field.

func (*FriendshipUpdate) Where

Where appends a list predicates to the FriendshipUpdate builder.

type FriendshipUpdateOne

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

FriendshipUpdateOne is the builder for updating a single Friendship entity.

func (*FriendshipUpdateOne) ClearFriend

func (fuo *FriendshipUpdateOne) ClearFriend() *FriendshipUpdateOne

ClearFriend clears the "friend" edge to the User entity.

func (*FriendshipUpdateOne) ClearUser

func (fuo *FriendshipUpdateOne) ClearUser() *FriendshipUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*FriendshipUpdateOne) Exec

func (fuo *FriendshipUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FriendshipUpdateOne) ExecX

func (fuo *FriendshipUpdateOne) ExecX(ctx context.Context)

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

func (*FriendshipUpdateOne) Mutation

func (fuo *FriendshipUpdateOne) Mutation() *FriendshipMutation

Mutation returns the FriendshipMutation object of the builder.

func (*FriendshipUpdateOne) Save

func (fuo *FriendshipUpdateOne) Save(ctx context.Context) (*Friendship, error)

Save executes the query and returns the updated Friendship entity.

func (*FriendshipUpdateOne) SaveX

func (fuo *FriendshipUpdateOne) SaveX(ctx context.Context) *Friendship

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

func (*FriendshipUpdateOne) Select

func (fuo *FriendshipUpdateOne) Select(field string, fields ...string) *FriendshipUpdateOne

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

func (*FriendshipUpdateOne) SetCreatedAt

func (fuo *FriendshipUpdateOne) SetCreatedAt(t time.Time) *FriendshipUpdateOne

SetCreatedAt sets the "created_at" field.

func (*FriendshipUpdateOne) SetFriend

func (fuo *FriendshipUpdateOne) SetFriend(u *User) *FriendshipUpdateOne

SetFriend sets the "friend" edge to the User entity.

func (*FriendshipUpdateOne) SetFriendID

func (fuo *FriendshipUpdateOne) SetFriendID(i int) *FriendshipUpdateOne

SetFriendID sets the "friend_id" field.

func (*FriendshipUpdateOne) SetNillableCreatedAt

func (fuo *FriendshipUpdateOne) SetNillableCreatedAt(t *time.Time) *FriendshipUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*FriendshipUpdateOne) SetNillableFriendID

func (fuo *FriendshipUpdateOne) SetNillableFriendID(i *int) *FriendshipUpdateOne

SetNillableFriendID sets the "friend_id" field if the given value is not nil.

func (*FriendshipUpdateOne) SetNillableUserID

func (fuo *FriendshipUpdateOne) SetNillableUserID(i *int) *FriendshipUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FriendshipUpdateOne) SetUser

func (fuo *FriendshipUpdateOne) SetUser(u *User) *FriendshipUpdateOne

SetUser sets the "user" edge to the User entity.

func (*FriendshipUpdateOne) SetUserID

func (fuo *FriendshipUpdateOne) SetUserID(i int) *FriendshipUpdateOne

SetUserID sets the "user_id" field.

func (*FriendshipUpdateOne) Where

Where appends a list predicates to the FriendshipUpdate builder.

type Friendships

type Friendships []*Friendship

Friendships is a parsable slice of Friendship.

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. Deprecated: Use Asc/Desc functions or the package builders instead.

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"`
	// Nicknames holds the value of the "nicknames" field.
	Nicknames []string `json:"nicknames"`
	// Age holds the value of the "age" field.
	Age int `json:"age"`
	// Type holds the value of the "type" field.
	Type pet.Type `json:"type"`
	// 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) QueryFollowedBy

func (pe *Pet) QueryFollowedBy() *UserQuery

QueryFollowedBy queries the "followed_by" edge of the Pet entity.

func (*Pet) QueryFollowing

func (pe *Pet) QueryFollowing() *FollowsQuery

QueryFollowing queries the "following" 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) 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.

func (*Pet) Value

func (pe *Pet) Value(name string) (ent.Value, error)

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

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) MapCreateBulk

func (c *PetClient) MapCreateBulk(slice any, setFunc func(*PetCreate, int)) *PetCreateBulk

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

func (*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) QueryFollowedBy

func (c *PetClient) QueryFollowedBy(pe *Pet) *UserQuery

QueryFollowedBy queries the followed_by edge of a Pet.

func (*PetClient) QueryFollowing

func (c *PetClient) QueryFollowing(pe *Pet) *FollowsQuery

QueryFollowing queries the following 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) 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) AddFollowedBy

func (pc *PetCreate) AddFollowedBy(u ...*User) *PetCreate

AddFollowedBy adds the "followed_by" edges to the User entity.

func (*PetCreate) AddFollowedByIDs

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

AddFollowedByIDs adds the "followed_by" edge to the User 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) 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) SetAge

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

SetAge sets the "age" field.

func (*PetCreate) SetID

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

SetID sets the "id" field.

func (*PetCreate) SetName

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

SetName sets the "name" field.

func (*PetCreate) SetNicknames

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

SetNicknames sets the "nicknames" field.

func (*PetCreate) SetNillableOwnerID

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

SetNillableOwnerID sets the "owner" edge to the User entity by ID 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) SetType

func (pc *PetCreate) SetType(pe pet.Type) *PetCreate

SetType sets the "type" 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 that the pet belongs to.
	Categories []*Category `json:"categories,omitempty"`
	// The user that owns the pet.
	Owner *User `json:"owner,omitempty"`
	// Pets that this pet is friends with.
	Friends []*Pet `json:"friends,omitempty"`
	// Users that this pet is followed by.
	FollowedBy []*User `json:"followed_by,omitempty"`
	// Following holds the value of the following edge.
	Following []*Follows `json:"following,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) FollowedByOrErr

func (e PetEdges) FollowedByOrErr() ([]*User, error)

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

func (PetEdges) FollowingOrErr

func (e PetEdges) FollowingOrErr() ([]*Follows, error)

FollowingOrErr returns the Following 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.

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) AddAge

func (m *PetMutation) AddAge(i int)

AddAge adds i to the "age" field.

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) AddFollowedByIDs

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

AddFollowedByIDs adds the "followed_by" edge to the User entity by ids.

func (*PetMutation) AddFriendIDs

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

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

func (*PetMutation) AddedAge

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

AddedAge returns the value that was added to the "age" field in this mutation.

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) 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) Age

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

Age returns the value of the "age" field in the mutation.

func (*PetMutation) AppendNicknames

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

AppendNicknames adds s to the "nicknames" field.

func (*PetMutation) AppendedNicknames

func (m *PetMutation) AppendedNicknames() ([]string, bool)

AppendedNicknames returns the list of values that were appended to the "nicknames" field 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) 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) ClearFollowedBy

func (m *PetMutation) ClearFollowedBy()

ClearFollowedBy clears the "followed_by" edge to the User entity.

func (*PetMutation) ClearFriends

func (m *PetMutation) ClearFriends()

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

func (*PetMutation) ClearNicknames

func (m *PetMutation) ClearNicknames()

ClearNicknames clears the value of the "nicknames" field.

func (*PetMutation) ClearOwner

func (m *PetMutation) ClearOwner()

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

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) FollowedByCleared

func (m *PetMutation) FollowedByCleared() bool

FollowedByCleared reports if the "followed_by" edge to the User entity was cleared.

func (*PetMutation) FollowedByIDs

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

FollowedByIDs returns the "followed_by" edge IDs in the mutation.

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) GetType

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

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

func (*PetMutation) ID

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

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

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

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

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

func (*PetMutation) NicknamesCleared

func (m *PetMutation) NicknamesCleared() bool

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

func (*PetMutation) OldAge

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

OldAge returns the old "age" 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) OldName

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

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

func (*PetMutation) OldNicknames

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

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

func (*PetMutation) OldType

func (m *PetMutation) OldType(ctx context.Context) (v pet.Type, err error)

OldType returns the old "type" 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) RemoveFollowedByIDs

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

RemoveFollowedByIDs removes the "followed_by" edge to the User 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) 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) RemovedFollowedByIDs

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

RemovedFollowedBy returns the removed IDs of the "followed_by" edge to the User entity.

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) ResetAge

func (m *PetMutation) ResetAge()

ResetAge resets all changes to the "age" 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) ResetFollowedBy

func (m *PetMutation) ResetFollowedBy()

ResetFollowedBy resets all changes to the "followed_by" edge.

func (*PetMutation) ResetFriends

func (m *PetMutation) ResetFriends()

ResetFriends resets all changes to the "friends" edge.

func (*PetMutation) ResetName

func (m *PetMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PetMutation) ResetNicknames

func (m *PetMutation) ResetNicknames()

ResetNicknames resets all changes to the "nicknames" field.

func (*PetMutation) ResetOwner

func (m *PetMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*PetMutation) ResetType

func (m *PetMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*PetMutation) SetAge

func (m *PetMutation) SetAge(i int)

SetAge sets the "age" 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) SetID

func (m *PetMutation) SetID(id int)

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

func (*PetMutation) SetName

func (m *PetMutation) SetName(s string)

SetName sets the "name" field.

func (*PetMutation) SetNicknames

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

SetNicknames sets the "nicknames" field.

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

func (m *PetMutation) SetType(pe pet.Type)

SetType sets the "type" field.

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) 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"`
	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 ...pet.OrderOption) *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) QueryFollowedBy

func (pq *PetQuery) QueryFollowedBy() *UserQuery

QueryFollowedBy chains the current query on the "followed_by" edge.

func (*PetQuery) QueryFollowing

func (pq *PetQuery) QueryFollowing() *FollowsQuery

QueryFollowing chains the current query on the "following" 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) 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"`
}

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) WithFollowedBy

func (pq *PetQuery) WithFollowedBy(opts ...func(*UserQuery)) *PetQuery

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

func (*PetQuery) WithFollowing

func (pq *PetQuery) WithFollowing(opts ...func(*FollowsQuery)) *PetQuery

WithFollowing tells the query-builder to eager-load the nodes that are connected to the "following" 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.

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) AddAge

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

AddAge adds i to the "age" field.

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) AddFollowedBy

func (pu *PetUpdate) AddFollowedBy(u ...*User) *PetUpdate

AddFollowedBy adds the "followed_by" edges to the User entity.

func (*PetUpdate) AddFollowedByIDs

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

AddFollowedByIDs adds the "followed_by" edge to the User 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) AppendNicknames

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

AppendNicknames appends s to the "nicknames" field.

func (*PetUpdate) ClearCategories

func (pu *PetUpdate) ClearCategories() *PetUpdate

ClearCategories clears all "categories" edges to the Category entity.

func (*PetUpdate) ClearFollowedBy

func (pu *PetUpdate) ClearFollowedBy() *PetUpdate

ClearFollowedBy clears all "followed_by" edges to the User entity.

func (*PetUpdate) ClearFriends

func (pu *PetUpdate) ClearFriends() *PetUpdate

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

func (*PetUpdate) ClearNicknames

func (pu *PetUpdate) ClearNicknames() *PetUpdate

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdate) ClearOwner

func (pu *PetUpdate) ClearOwner() *PetUpdate

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

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) RemoveFollowedBy

func (pu *PetUpdate) RemoveFollowedBy(u ...*User) *PetUpdate

RemoveFollowedBy removes "followed_by" edges to User entities.

func (*PetUpdate) RemoveFollowedByIDs

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

RemoveFollowedByIDs removes the "followed_by" edge to User 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) SetAge

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

SetAge sets the "age" field.

func (*PetUpdate) SetName

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

SetName sets the "name" field.

func (*PetUpdate) SetNicknames

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

SetNicknames sets the "nicknames" field.

func (*PetUpdate) SetNillableAge

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

SetNillableAge sets the "age" field if the given value is not nil.

func (*PetUpdate) SetNillableName

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

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

func (*PetUpdate) SetNillableOwnerID

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

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

func (*PetUpdate) SetNillableType

func (pu *PetUpdate) SetNillableType(pe *pet.Type) *PetUpdate

SetNillableType sets the "type" 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) SetType

func (pu *PetUpdate) SetType(pe pet.Type) *PetUpdate

SetType sets the "type" 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) AddAge

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

AddAge adds i to the "age" field.

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) AddFollowedBy

func (puo *PetUpdateOne) AddFollowedBy(u ...*User) *PetUpdateOne

AddFollowedBy adds the "followed_by" edges to the User entity.

func (*PetUpdateOne) AddFollowedByIDs

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

AddFollowedByIDs adds the "followed_by" edge to the User 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) AppendNicknames

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

AppendNicknames appends s to the "nicknames" field.

func (*PetUpdateOne) ClearCategories

func (puo *PetUpdateOne) ClearCategories() *PetUpdateOne

ClearCategories clears all "categories" edges to the Category entity.

func (*PetUpdateOne) ClearFollowedBy

func (puo *PetUpdateOne) ClearFollowedBy() *PetUpdateOne

ClearFollowedBy clears all "followed_by" edges to the User entity.

func (*PetUpdateOne) ClearFriends

func (puo *PetUpdateOne) ClearFriends() *PetUpdateOne

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

func (*PetUpdateOne) ClearNicknames

func (puo *PetUpdateOne) ClearNicknames() *PetUpdateOne

ClearNicknames clears the value of the "nicknames" field.

func (*PetUpdateOne) ClearOwner

func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne

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

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) RemoveFollowedBy

func (puo *PetUpdateOne) RemoveFollowedBy(u ...*User) *PetUpdateOne

RemoveFollowedBy removes "followed_by" edges to User entities.

func (*PetUpdateOne) RemoveFollowedByIDs

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

RemoveFollowedByIDs removes the "followed_by" edge to User 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) SetAge

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

SetAge sets the "age" field.

func (*PetUpdateOne) SetName

func (puo *PetUpdateOne) SetName(s string) *PetUpdateOne

SetName sets the "name" field.

func (*PetUpdateOne) SetNicknames

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

SetNicknames sets the "nicknames" field.

func (*PetUpdateOne) SetNillableAge

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

SetNillableAge sets the "age" field if the given value is not nil.

func (*PetUpdateOne) SetNillableName

func (puo *PetUpdateOne) SetNillableName(s *string) *PetUpdateOne

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

func (*PetUpdateOne) SetNillableOwnerID

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

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

func (*PetUpdateOne) SetNillableType

func (puo *PetUpdateOne) SetNillableType(pe *pet.Type) *PetUpdateOne

SetNillableType sets the "type" 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) SetType

func (puo *PetUpdateOne) SetType(pe pet.Type) *PetUpdateOne

SetType sets the "type" 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 Settings

type Settings struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Time in which the resource was initially created.
	CreatedAt time.Time `json:"created_at"`
	// Time that the resource was last updated.
	UpdatedAt time.Time `json:"updated_at"`
	// Global banner text to apply to the frontend.
	GlobalBanner *string `json:"global_banner"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SettingsQuery when eager-loading is set.
	Edges SettingsEdges `json:"edges"`
	// contains filtered or unexported fields
}

Settings is the model entity for the Settings schema.

func (*Settings) QueryAdmins

func (s *Settings) QueryAdmins() *UserQuery

QueryAdmins queries the "admins" edge of the Settings entity.

func (*Settings) String

func (s *Settings) String() string

String implements the fmt.Stringer.

func (*Settings) Unwrap

func (s *Settings) Unwrap() *Settings

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

func (s *Settings) Update() *SettingsUpdateOne

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

func (*Settings) Value

func (s *Settings) Value(name string) (ent.Value, error)

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

type SettingsClient

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

SettingsClient is a client for the Settings schema.

func NewSettingsClient

func NewSettingsClient(c config) *SettingsClient

NewSettingsClient returns a client for the Settings from the given config.

func (*SettingsClient) Create

func (c *SettingsClient) Create() *SettingsCreate

Create returns a builder for creating a Settings entity.

func (*SettingsClient) CreateBulk

func (c *SettingsClient) CreateBulk(builders ...*SettingsCreate) *SettingsCreateBulk

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

func (*SettingsClient) Delete

func (c *SettingsClient) Delete() *SettingsDelete

Delete returns a delete builder for Settings.

func (*SettingsClient) DeleteOne

func (c *SettingsClient) DeleteOne(s *Settings) *SettingsDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SettingsClient) DeleteOneID

func (c *SettingsClient) DeleteOneID(id int) *SettingsDeleteOne

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

func (*SettingsClient) Get

func (c *SettingsClient) Get(ctx context.Context, id int) (*Settings, error)

Get returns a Settings entity by its id.

func (*SettingsClient) GetX

func (c *SettingsClient) GetX(ctx context.Context, id int) *Settings

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

func (*SettingsClient) Hooks

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

Hooks returns the client hooks.

func (*SettingsClient) Intercept

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

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

func (*SettingsClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SettingsClient) MapCreateBulk

func (c *SettingsClient) MapCreateBulk(slice any, setFunc func(*SettingsCreate, int)) *SettingsCreateBulk

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

func (*SettingsClient) Query

func (c *SettingsClient) Query() *SettingsQuery

Query returns a query builder for Settings.

func (*SettingsClient) QueryAdmins

func (c *SettingsClient) QueryAdmins(s *Settings) *UserQuery

QueryAdmins queries the admins edge of a Settings.

func (*SettingsClient) Update

func (c *SettingsClient) Update() *SettingsUpdate

Update returns an update builder for Settings.

func (*SettingsClient) UpdateOne

func (c *SettingsClient) UpdateOne(s *Settings) *SettingsUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SettingsClient) UpdateOneID

func (c *SettingsClient) UpdateOneID(id int) *SettingsUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SettingsClient) Use

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

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

type SettingsCreate

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

SettingsCreate is the builder for creating a Settings entity.

func (*SettingsCreate) AddAdminIDs

func (sc *SettingsCreate) AddAdminIDs(ids ...int) *SettingsCreate

AddAdminIDs adds the "admins" edge to the User entity by IDs.

func (*SettingsCreate) AddAdmins

func (sc *SettingsCreate) AddAdmins(u ...*User) *SettingsCreate

AddAdmins adds the "admins" edges to the User entity.

func (*SettingsCreate) Exec

func (sc *SettingsCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingsCreate) ExecX

func (sc *SettingsCreate) ExecX(ctx context.Context)

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

func (*SettingsCreate) Mutation

func (sc *SettingsCreate) Mutation() *SettingsMutation

Mutation returns the SettingsMutation object of the builder.

func (*SettingsCreate) Save

func (sc *SettingsCreate) Save(ctx context.Context) (*Settings, error)

Save creates the Settings in the database.

func (*SettingsCreate) SaveX

func (sc *SettingsCreate) SaveX(ctx context.Context) *Settings

SaveX calls Save and panics if Save returns an error.

func (*SettingsCreate) SetCreatedAt

func (sc *SettingsCreate) SetCreatedAt(t time.Time) *SettingsCreate

SetCreatedAt sets the "created_at" field.

func (*SettingsCreate) SetGlobalBanner

func (sc *SettingsCreate) SetGlobalBanner(s string) *SettingsCreate

SetGlobalBanner sets the "global_banner" field.

func (*SettingsCreate) SetNillableCreatedAt

func (sc *SettingsCreate) SetNillableCreatedAt(t *time.Time) *SettingsCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SettingsCreate) SetNillableGlobalBanner

func (sc *SettingsCreate) SetNillableGlobalBanner(s *string) *SettingsCreate

SetNillableGlobalBanner sets the "global_banner" field if the given value is not nil.

func (*SettingsCreate) SetNillableUpdatedAt

func (sc *SettingsCreate) SetNillableUpdatedAt(t *time.Time) *SettingsCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*SettingsCreate) SetUpdatedAt

func (sc *SettingsCreate) SetUpdatedAt(t time.Time) *SettingsCreate

SetUpdatedAt sets the "updated_at" field.

type SettingsCreateBulk

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

SettingsCreateBulk is the builder for creating many Settings entities in bulk.

func (*SettingsCreateBulk) Exec

func (scb *SettingsCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingsCreateBulk) ExecX

func (scb *SettingsCreateBulk) ExecX(ctx context.Context)

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

func (*SettingsCreateBulk) Save

func (scb *SettingsCreateBulk) Save(ctx context.Context) ([]*Settings, error)

Save creates the Settings entities in the database.

func (*SettingsCreateBulk) SaveX

func (scb *SettingsCreateBulk) SaveX(ctx context.Context) []*Settings

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

type SettingsDelete

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

SettingsDelete is the builder for deleting a Settings entity.

func (*SettingsDelete) Exec

func (sd *SettingsDelete) Exec(ctx context.Context) (int, error)

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

func (*SettingsDelete) ExecX

func (sd *SettingsDelete) ExecX(ctx context.Context) int

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

func (*SettingsDelete) Where

func (sd *SettingsDelete) Where(ps ...predicate.Settings) *SettingsDelete

Where appends a list predicates to the SettingsDelete builder.

type SettingsDeleteOne

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

SettingsDeleteOne is the builder for deleting a single Settings entity.

func (*SettingsDeleteOne) Exec

func (sdo *SettingsDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SettingsDeleteOne) ExecX

func (sdo *SettingsDeleteOne) ExecX(ctx context.Context)

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

func (*SettingsDeleteOne) Where

Where appends a list predicates to the SettingsDelete builder.

type SettingsEdges

type SettingsEdges struct {
	// Administrators for the platform.
	Admins []*User `json:"admins,omitempty"`
	// contains filtered or unexported fields
}

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

func (SettingsEdges) AdminsOrErr

func (e SettingsEdges) AdminsOrErr() ([]*User, error)

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

type SettingsGroupBy

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

SettingsGroupBy is the group-by builder for Settings entities.

func (*SettingsGroupBy) Aggregate

func (sgb *SettingsGroupBy) Aggregate(fns ...AggregateFunc) *SettingsGroupBy

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

func (*SettingsGroupBy) Bool

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

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

func (*SettingsGroupBy) BoolX

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

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

func (*SettingsGroupBy) Bools

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

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

func (*SettingsGroupBy) BoolsX

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

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

func (*SettingsGroupBy) Float64

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

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

func (*SettingsGroupBy) Float64X

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

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

func (*SettingsGroupBy) Float64s

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

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

func (*SettingsGroupBy) Float64sX

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

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

func (*SettingsGroupBy) Int

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

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

func (*SettingsGroupBy) IntX

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

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

func (*SettingsGroupBy) Ints

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

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

func (*SettingsGroupBy) IntsX

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

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

func (*SettingsGroupBy) Scan

func (sgb *SettingsGroupBy) Scan(ctx context.Context, v any) error

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

func (*SettingsGroupBy) ScanX

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

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

func (*SettingsGroupBy) String

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

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

func (*SettingsGroupBy) StringX

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

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

func (*SettingsGroupBy) Strings

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

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

func (*SettingsGroupBy) StringsX

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

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

type SettingsMutation

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

SettingsMutation represents an operation that mutates the Settings nodes in the graph.

func (*SettingsMutation) AddAdminIDs

func (m *SettingsMutation) AddAdminIDs(ids ...int)

AddAdminIDs adds the "admins" edge to the User entity by ids.

func (*SettingsMutation) AddField

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

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

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

func (*SettingsMutation) AddedField

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

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

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

func (*SettingsMutation) AddedIDs

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

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

func (*SettingsMutation) AdminsCleared

func (m *SettingsMutation) AdminsCleared() bool

AdminsCleared reports if the "admins" edge to the User entity was cleared.

func (*SettingsMutation) AdminsIDs

func (m *SettingsMutation) AdminsIDs() (ids []int)

AdminsIDs returns the "admins" edge IDs in the mutation.

func (*SettingsMutation) ClearAdmins

func (m *SettingsMutation) ClearAdmins()

ClearAdmins clears the "admins" edge to the User entity.

func (*SettingsMutation) ClearEdge

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

func (m *SettingsMutation) 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 (*SettingsMutation) ClearGlobalBanner

func (m *SettingsMutation) ClearGlobalBanner()

ClearGlobalBanner clears the value of the "global_banner" field.

func (*SettingsMutation) ClearedEdges

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

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

func (*SettingsMutation) ClearedFields

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

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

func (SettingsMutation) Client

func (m SettingsMutation) 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 (*SettingsMutation) CreatedAt

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

CreatedAt returns the value of the "created_at" field in the mutation.

func (*SettingsMutation) EdgeCleared

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

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

func (*SettingsMutation) Field

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

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

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

func (*SettingsMutation) Fields

func (m *SettingsMutation) 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 (*SettingsMutation) GlobalBanner

func (m *SettingsMutation) GlobalBanner() (r string, exists bool)

GlobalBanner returns the value of the "global_banner" field in the mutation.

func (*SettingsMutation) GlobalBannerCleared

func (m *SettingsMutation) GlobalBannerCleared() bool

GlobalBannerCleared returns if the "global_banner" field was cleared in this mutation.

func (*SettingsMutation) ID

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

func (m *SettingsMutation) 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 (*SettingsMutation) OldCreatedAt

func (m *SettingsMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Settings entity. If the Settings 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 (*SettingsMutation) OldField

func (m *SettingsMutation) 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 (*SettingsMutation) OldGlobalBanner

func (m *SettingsMutation) OldGlobalBanner(ctx context.Context) (v *string, err error)

OldGlobalBanner returns the old "global_banner" field's value of the Settings entity. If the Settings 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 (*SettingsMutation) OldUpdatedAt

func (m *SettingsMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Settings entity. If the Settings 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 (*SettingsMutation) Op

func (m *SettingsMutation) Op() Op

Op returns the operation name.

func (*SettingsMutation) RemoveAdminIDs

func (m *SettingsMutation) RemoveAdminIDs(ids ...int)

RemoveAdminIDs removes the "admins" edge to the User entity by IDs.

func (*SettingsMutation) RemovedAdminsIDs

func (m *SettingsMutation) RemovedAdminsIDs() (ids []int)

RemovedAdmins returns the removed IDs of the "admins" edge to the User entity.

func (*SettingsMutation) RemovedEdges

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

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

func (*SettingsMutation) RemovedIDs

func (m *SettingsMutation) 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 (*SettingsMutation) ResetAdmins

func (m *SettingsMutation) ResetAdmins()

ResetAdmins resets all changes to the "admins" edge.

func (*SettingsMutation) ResetCreatedAt

func (m *SettingsMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SettingsMutation) ResetEdge

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

func (m *SettingsMutation) 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 (*SettingsMutation) ResetGlobalBanner

func (m *SettingsMutation) ResetGlobalBanner()

ResetGlobalBanner resets all changes to the "global_banner" field.

func (*SettingsMutation) ResetUpdatedAt

func (m *SettingsMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SettingsMutation) SetCreatedAt

func (m *SettingsMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*SettingsMutation) SetField

func (m *SettingsMutation) 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 (*SettingsMutation) SetGlobalBanner

func (m *SettingsMutation) SetGlobalBanner(s string)

SetGlobalBanner sets the "global_banner" field.

func (*SettingsMutation) SetOp

func (m *SettingsMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SettingsMutation) SetUpdatedAt

func (m *SettingsMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (SettingsMutation) Tx

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

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

func (*SettingsMutation) Type

func (m *SettingsMutation) Type() string

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

func (*SettingsMutation) UpdatedAt

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

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*SettingsMutation) Where

func (m *SettingsMutation) Where(ps ...predicate.Settings)

Where appends a list predicates to the SettingsMutation builder.

func (*SettingsMutation) WhereP

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

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

type SettingsQuery

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

SettingsQuery is the builder for querying Settings entities.

func (*SettingsQuery) Aggregate

func (sq *SettingsQuery) Aggregate(fns ...AggregateFunc) *SettingsSelect

Aggregate returns a SettingsSelect configured with the given aggregations.

func (*SettingsQuery) All

func (sq *SettingsQuery) All(ctx context.Context) ([]*Settings, error)

All executes the query and returns a list of SettingsSlice.

func (*SettingsQuery) AllX

func (sq *SettingsQuery) AllX(ctx context.Context) []*Settings

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

func (*SettingsQuery) Clone

func (sq *SettingsQuery) Clone() *SettingsQuery

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

func (*SettingsQuery) Count

func (sq *SettingsQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SettingsQuery) CountX

func (sq *SettingsQuery) CountX(ctx context.Context) int

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

func (*SettingsQuery) Exist

func (sq *SettingsQuery) Exist(ctx context.Context) (bool, error)

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

func (*SettingsQuery) ExistX

func (sq *SettingsQuery) ExistX(ctx context.Context) bool

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

func (*SettingsQuery) First

func (sq *SettingsQuery) First(ctx context.Context) (*Settings, error)

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

func (*SettingsQuery) FirstID

func (sq *SettingsQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SettingsQuery) FirstIDX

func (sq *SettingsQuery) FirstIDX(ctx context.Context) int

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

func (*SettingsQuery) FirstX

func (sq *SettingsQuery) FirstX(ctx context.Context) *Settings

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

func (*SettingsQuery) GroupBy

func (sq *SettingsQuery) GroupBy(field string, fields ...string) *SettingsGroupBy

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

client.Settings.Query().
	GroupBy(settings.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SettingsQuery) IDs

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

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

func (*SettingsQuery) IDsX

func (sq *SettingsQuery) IDsX(ctx context.Context) []int

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

func (*SettingsQuery) Limit

func (sq *SettingsQuery) Limit(limit int) *SettingsQuery

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

func (*SettingsQuery) Offset

func (sq *SettingsQuery) Offset(offset int) *SettingsQuery

Offset to start from.

func (*SettingsQuery) Only

func (sq *SettingsQuery) Only(ctx context.Context) (*Settings, error)

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

func (*SettingsQuery) OnlyID

func (sq *SettingsQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SettingsQuery) OnlyIDX

func (sq *SettingsQuery) OnlyIDX(ctx context.Context) int

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

func (*SettingsQuery) OnlyX

func (sq *SettingsQuery) OnlyX(ctx context.Context) *Settings

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

func (*SettingsQuery) Order

Order specifies how the records should be ordered.

func (*SettingsQuery) QueryAdmins

func (sq *SettingsQuery) QueryAdmins() *UserQuery

QueryAdmins chains the current query on the "admins" edge.

func (*SettingsQuery) Select

func (sq *SettingsQuery) Select(fields ...string) *SettingsSelect

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 {
	CreatedAt time.Time `json:"created_at"`
}

client.Settings.Query().
	Select(settings.FieldCreatedAt).
	Scan(ctx, &v)

func (*SettingsQuery) Unique

func (sq *SettingsQuery) Unique(unique bool) *SettingsQuery

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

func (sq *SettingsQuery) Where(ps ...predicate.Settings) *SettingsQuery

Where adds a new predicate for the SettingsQuery builder.

func (*SettingsQuery) WithAdmins

func (sq *SettingsQuery) WithAdmins(opts ...func(*UserQuery)) *SettingsQuery

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

type SettingsSelect

type SettingsSelect struct {
	*SettingsQuery
	// contains filtered or unexported fields
}

SettingsSelect is the builder for selecting fields of Settings entities.

func (*SettingsSelect) Aggregate

func (ss *SettingsSelect) Aggregate(fns ...AggregateFunc) *SettingsSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SettingsSelect) Bool

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

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

func (*SettingsSelect) BoolX

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

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

func (*SettingsSelect) Bools

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

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

func (*SettingsSelect) BoolsX

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

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

func (*SettingsSelect) Float64

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

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

func (*SettingsSelect) Float64X

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

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

func (*SettingsSelect) Float64s

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

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

func (*SettingsSelect) Float64sX

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

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

func (*SettingsSelect) Int

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

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

func (*SettingsSelect) IntX

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

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

func (*SettingsSelect) Ints

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

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

func (*SettingsSelect) IntsX

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

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

func (*SettingsSelect) Scan

func (ss *SettingsSelect) Scan(ctx context.Context, v any) error

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

func (*SettingsSelect) ScanX

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

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

func (*SettingsSelect) String

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

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

func (*SettingsSelect) StringX

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

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

func (*SettingsSelect) Strings

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

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

func (*SettingsSelect) StringsX

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

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

type SettingsSlice

type SettingsSlice []*Settings

SettingsSlice is a parsable slice of Settings.

type SettingsUpdate

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

SettingsUpdate is the builder for updating Settings entities.

func (*SettingsUpdate) AddAdminIDs

func (su *SettingsUpdate) AddAdminIDs(ids ...int) *SettingsUpdate

AddAdminIDs adds the "admins" edge to the User entity by IDs.

func (*SettingsUpdate) AddAdmins

func (su *SettingsUpdate) AddAdmins(u ...*User) *SettingsUpdate

AddAdmins adds the "admins" edges to the User entity.

func (*SettingsUpdate) ClearAdmins

func (su *SettingsUpdate) ClearAdmins() *SettingsUpdate

ClearAdmins clears all "admins" edges to the User entity.

func (*SettingsUpdate) ClearGlobalBanner

func (su *SettingsUpdate) ClearGlobalBanner() *SettingsUpdate

ClearGlobalBanner clears the value of the "global_banner" field.

func (*SettingsUpdate) Exec

func (su *SettingsUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingsUpdate) ExecX

func (su *SettingsUpdate) ExecX(ctx context.Context)

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

func (*SettingsUpdate) Mutation

func (su *SettingsUpdate) Mutation() *SettingsMutation

Mutation returns the SettingsMutation object of the builder.

func (*SettingsUpdate) RemoveAdminIDs

func (su *SettingsUpdate) RemoveAdminIDs(ids ...int) *SettingsUpdate

RemoveAdminIDs removes the "admins" edge to User entities by IDs.

func (*SettingsUpdate) RemoveAdmins

func (su *SettingsUpdate) RemoveAdmins(u ...*User) *SettingsUpdate

RemoveAdmins removes "admins" edges to User entities.

func (*SettingsUpdate) Save

func (su *SettingsUpdate) Save(ctx context.Context) (int, error)

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

func (*SettingsUpdate) SaveX

func (su *SettingsUpdate) SaveX(ctx context.Context) int

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

func (*SettingsUpdate) SetGlobalBanner

func (su *SettingsUpdate) SetGlobalBanner(s string) *SettingsUpdate

SetGlobalBanner sets the "global_banner" field.

func (*SettingsUpdate) SetNillableGlobalBanner

func (su *SettingsUpdate) SetNillableGlobalBanner(s *string) *SettingsUpdate

SetNillableGlobalBanner sets the "global_banner" field if the given value is not nil.

func (*SettingsUpdate) SetUpdatedAt

func (su *SettingsUpdate) SetUpdatedAt(t time.Time) *SettingsUpdate

SetUpdatedAt sets the "updated_at" field.

func (*SettingsUpdate) Where

func (su *SettingsUpdate) Where(ps ...predicate.Settings) *SettingsUpdate

Where appends a list predicates to the SettingsUpdate builder.

type SettingsUpdateOne

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

SettingsUpdateOne is the builder for updating a single Settings entity.

func (*SettingsUpdateOne) AddAdminIDs

func (suo *SettingsUpdateOne) AddAdminIDs(ids ...int) *SettingsUpdateOne

AddAdminIDs adds the "admins" edge to the User entity by IDs.

func (*SettingsUpdateOne) AddAdmins

func (suo *SettingsUpdateOne) AddAdmins(u ...*User) *SettingsUpdateOne

AddAdmins adds the "admins" edges to the User entity.

func (*SettingsUpdateOne) ClearAdmins

func (suo *SettingsUpdateOne) ClearAdmins() *SettingsUpdateOne

ClearAdmins clears all "admins" edges to the User entity.

func (*SettingsUpdateOne) ClearGlobalBanner

func (suo *SettingsUpdateOne) ClearGlobalBanner() *SettingsUpdateOne

ClearGlobalBanner clears the value of the "global_banner" field.

func (*SettingsUpdateOne) Exec

func (suo *SettingsUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SettingsUpdateOne) ExecX

func (suo *SettingsUpdateOne) ExecX(ctx context.Context)

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

func (*SettingsUpdateOne) Mutation

func (suo *SettingsUpdateOne) Mutation() *SettingsMutation

Mutation returns the SettingsMutation object of the builder.

func (*SettingsUpdateOne) RemoveAdminIDs

func (suo *SettingsUpdateOne) RemoveAdminIDs(ids ...int) *SettingsUpdateOne

RemoveAdminIDs removes the "admins" edge to User entities by IDs.

func (*SettingsUpdateOne) RemoveAdmins

func (suo *SettingsUpdateOne) RemoveAdmins(u ...*User) *SettingsUpdateOne

RemoveAdmins removes "admins" edges to User entities.

func (*SettingsUpdateOne) Save

func (suo *SettingsUpdateOne) Save(ctx context.Context) (*Settings, error)

Save executes the query and returns the updated Settings entity.

func (*SettingsUpdateOne) SaveX

func (suo *SettingsUpdateOne) SaveX(ctx context.Context) *Settings

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

func (*SettingsUpdateOne) Select

func (suo *SettingsUpdateOne) Select(field string, fields ...string) *SettingsUpdateOne

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

func (*SettingsUpdateOne) SetGlobalBanner

func (suo *SettingsUpdateOne) SetGlobalBanner(s string) *SettingsUpdateOne

SetGlobalBanner sets the "global_banner" field.

func (*SettingsUpdateOne) SetNillableGlobalBanner

func (suo *SettingsUpdateOne) SetNillableGlobalBanner(s *string) *SettingsUpdateOne

SetNillableGlobalBanner sets the "global_banner" field if the given value is not nil.

func (*SettingsUpdateOne) SetUpdatedAt

func (suo *SettingsUpdateOne) SetUpdatedAt(t time.Time) *SettingsUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*SettingsUpdateOne) Where

Where appends a list predicates to the SettingsUpdate builder.

type Skipped

type Skipped struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name"`
	// contains filtered or unexported fields
}

Skipped is the model entity for the Skipped schema.

func (*Skipped) String

func (s *Skipped) String() string

String implements the fmt.Stringer.

func (*Skipped) Unwrap

func (s *Skipped) Unwrap() *Skipped

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

func (s *Skipped) Update() *SkippedUpdateOne

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

func (*Skipped) Value

func (s *Skipped) Value(name string) (ent.Value, error)

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

type SkippedClient

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

SkippedClient is a client for the Skipped schema.

func NewSkippedClient

func NewSkippedClient(c config) *SkippedClient

NewSkippedClient returns a client for the Skipped from the given config.

func (*SkippedClient) Create

func (c *SkippedClient) Create() *SkippedCreate

Create returns a builder for creating a Skipped entity.

func (*SkippedClient) CreateBulk

func (c *SkippedClient) CreateBulk(builders ...*SkippedCreate) *SkippedCreateBulk

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

func (*SkippedClient) Delete

func (c *SkippedClient) Delete() *SkippedDelete

Delete returns a delete builder for Skipped.

func (*SkippedClient) DeleteOne

func (c *SkippedClient) DeleteOne(s *Skipped) *SkippedDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SkippedClient) DeleteOneID

func (c *SkippedClient) DeleteOneID(id int) *SkippedDeleteOne

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

func (*SkippedClient) Get

func (c *SkippedClient) Get(ctx context.Context, id int) (*Skipped, error)

Get returns a Skipped entity by its id.

func (*SkippedClient) GetX

func (c *SkippedClient) GetX(ctx context.Context, id int) *Skipped

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

func (*SkippedClient) Hooks

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

Hooks returns the client hooks.

func (*SkippedClient) Intercept

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

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

func (*SkippedClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SkippedClient) MapCreateBulk

func (c *SkippedClient) MapCreateBulk(slice any, setFunc func(*SkippedCreate, int)) *SkippedCreateBulk

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

func (*SkippedClient) Query

func (c *SkippedClient) Query() *SkippedQuery

Query returns a query builder for Skipped.

func (*SkippedClient) Update

func (c *SkippedClient) Update() *SkippedUpdate

Update returns an update builder for Skipped.

func (*SkippedClient) UpdateOne

func (c *SkippedClient) UpdateOne(s *Skipped) *SkippedUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SkippedClient) UpdateOneID

func (c *SkippedClient) UpdateOneID(id int) *SkippedUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SkippedClient) Use

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

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

type SkippedCreate

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

SkippedCreate is the builder for creating a Skipped entity.

func (*SkippedCreate) Exec

func (sc *SkippedCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SkippedCreate) ExecX

func (sc *SkippedCreate) ExecX(ctx context.Context)

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

func (*SkippedCreate) Mutation

func (sc *SkippedCreate) Mutation() *SkippedMutation

Mutation returns the SkippedMutation object of the builder.

func (*SkippedCreate) Save

func (sc *SkippedCreate) Save(ctx context.Context) (*Skipped, error)

Save creates the Skipped in the database.

func (*SkippedCreate) SaveX

func (sc *SkippedCreate) SaveX(ctx context.Context) *Skipped

SaveX calls Save and panics if Save returns an error.

func (*SkippedCreate) SetName

func (sc *SkippedCreate) SetName(s string) *SkippedCreate

SetName sets the "name" field.

type SkippedCreateBulk

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

SkippedCreateBulk is the builder for creating many Skipped entities in bulk.

func (*SkippedCreateBulk) Exec

func (scb *SkippedCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SkippedCreateBulk) ExecX

func (scb *SkippedCreateBulk) ExecX(ctx context.Context)

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

func (*SkippedCreateBulk) Save

func (scb *SkippedCreateBulk) Save(ctx context.Context) ([]*Skipped, error)

Save creates the Skipped entities in the database.

func (*SkippedCreateBulk) SaveX

func (scb *SkippedCreateBulk) SaveX(ctx context.Context) []*Skipped

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

type SkippedDelete

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

SkippedDelete is the builder for deleting a Skipped entity.

func (*SkippedDelete) Exec

func (sd *SkippedDelete) Exec(ctx context.Context) (int, error)

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

func (*SkippedDelete) ExecX

func (sd *SkippedDelete) ExecX(ctx context.Context) int

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

func (*SkippedDelete) Where

func (sd *SkippedDelete) Where(ps ...predicate.Skipped) *SkippedDelete

Where appends a list predicates to the SkippedDelete builder.

type SkippedDeleteOne

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

SkippedDeleteOne is the builder for deleting a single Skipped entity.

func (*SkippedDeleteOne) Exec

func (sdo *SkippedDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SkippedDeleteOne) ExecX

func (sdo *SkippedDeleteOne) ExecX(ctx context.Context)

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

func (*SkippedDeleteOne) Where

Where appends a list predicates to the SkippedDelete builder.

type SkippedGroupBy

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

SkippedGroupBy is the group-by builder for Skipped entities.

func (*SkippedGroupBy) Aggregate

func (sgb *SkippedGroupBy) Aggregate(fns ...AggregateFunc) *SkippedGroupBy

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

func (*SkippedGroupBy) Bool

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

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

func (*SkippedGroupBy) BoolX

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

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

func (*SkippedGroupBy) Bools

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

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

func (*SkippedGroupBy) BoolsX

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

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

func (*SkippedGroupBy) Float64

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

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

func (*SkippedGroupBy) Float64X

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

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

func (*SkippedGroupBy) Float64s

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

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

func (*SkippedGroupBy) Float64sX

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

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

func (*SkippedGroupBy) Int

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

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

func (*SkippedGroupBy) IntX

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

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

func (*SkippedGroupBy) Ints

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

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

func (*SkippedGroupBy) IntsX

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

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

func (*SkippedGroupBy) Scan

func (sgb *SkippedGroupBy) Scan(ctx context.Context, v any) error

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

func (*SkippedGroupBy) ScanX

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

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

func (*SkippedGroupBy) String

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

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

func (*SkippedGroupBy) StringX

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

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

func (*SkippedGroupBy) Strings

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

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

func (*SkippedGroupBy) StringsX

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

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

type SkippedMutation

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

SkippedMutation represents an operation that mutates the Skipped nodes in the graph.

func (*SkippedMutation) AddField

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

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

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

func (*SkippedMutation) AddedField

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

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

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

func (*SkippedMutation) AddedIDs

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

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

func (*SkippedMutation) ClearEdge

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

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

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

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

func (*SkippedMutation) ClearedFields

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

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

func (SkippedMutation) Client

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

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

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

func (*SkippedMutation) Field

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

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

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

func (*SkippedMutation) Fields

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

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

func (m *SkippedMutation) 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 (*SkippedMutation) Name

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

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

func (*SkippedMutation) OldField

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

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

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

func (m *SkippedMutation) Op() Op

Op returns the operation name.

func (*SkippedMutation) RemovedEdges

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

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

func (*SkippedMutation) RemovedIDs

func (m *SkippedMutation) 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 (*SkippedMutation) ResetEdge

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

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

func (m *SkippedMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*SkippedMutation) SetField

func (m *SkippedMutation) 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 (*SkippedMutation) SetName

func (m *SkippedMutation) SetName(s string)

SetName sets the "name" field.

func (*SkippedMutation) SetOp

func (m *SkippedMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (SkippedMutation) Tx

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

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

func (*SkippedMutation) Type

func (m *SkippedMutation) Type() string

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

func (*SkippedMutation) Where

func (m *SkippedMutation) Where(ps ...predicate.Skipped)

Where appends a list predicates to the SkippedMutation builder.

func (*SkippedMutation) WhereP

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

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

type SkippedQuery

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

SkippedQuery is the builder for querying Skipped entities.

func (*SkippedQuery) Aggregate

func (sq *SkippedQuery) Aggregate(fns ...AggregateFunc) *SkippedSelect

Aggregate returns a SkippedSelect configured with the given aggregations.

func (*SkippedQuery) All

func (sq *SkippedQuery) All(ctx context.Context) ([]*Skipped, error)

All executes the query and returns a list of Skippeds.

func (*SkippedQuery) AllX

func (sq *SkippedQuery) AllX(ctx context.Context) []*Skipped

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

func (*SkippedQuery) Clone

func (sq *SkippedQuery) Clone() *SkippedQuery

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

func (*SkippedQuery) Count

func (sq *SkippedQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SkippedQuery) CountX

func (sq *SkippedQuery) CountX(ctx context.Context) int

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

func (*SkippedQuery) Exist

func (sq *SkippedQuery) Exist(ctx context.Context) (bool, error)

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

func (*SkippedQuery) ExistX

func (sq *SkippedQuery) ExistX(ctx context.Context) bool

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

func (*SkippedQuery) First

func (sq *SkippedQuery) First(ctx context.Context) (*Skipped, error)

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

func (*SkippedQuery) FirstID

func (sq *SkippedQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SkippedQuery) FirstIDX

func (sq *SkippedQuery) FirstIDX(ctx context.Context) int

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

func (*SkippedQuery) FirstX

func (sq *SkippedQuery) FirstX(ctx context.Context) *Skipped

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

func (*SkippedQuery) GroupBy

func (sq *SkippedQuery) GroupBy(field string, fields ...string) *SkippedGroupBy

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

client.Skipped.Query().
	GroupBy(skipped.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SkippedQuery) IDs

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

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

func (*SkippedQuery) IDsX

func (sq *SkippedQuery) IDsX(ctx context.Context) []int

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

func (*SkippedQuery) Limit

func (sq *SkippedQuery) Limit(limit int) *SkippedQuery

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

func (*SkippedQuery) Offset

func (sq *SkippedQuery) Offset(offset int) *SkippedQuery

Offset to start from.

func (*SkippedQuery) Only

func (sq *SkippedQuery) Only(ctx context.Context) (*Skipped, error)

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

func (*SkippedQuery) OnlyID

func (sq *SkippedQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SkippedQuery) OnlyIDX

func (sq *SkippedQuery) OnlyIDX(ctx context.Context) int

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

func (*SkippedQuery) OnlyX

func (sq *SkippedQuery) OnlyX(ctx context.Context) *Skipped

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

func (*SkippedQuery) Order

func (sq *SkippedQuery) Order(o ...skipped.OrderOption) *SkippedQuery

Order specifies how the records should be ordered.

func (*SkippedQuery) Select

func (sq *SkippedQuery) Select(fields ...string) *SkippedSelect

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"`
}

client.Skipped.Query().
	Select(skipped.FieldName).
	Scan(ctx, &v)

func (*SkippedQuery) Unique

func (sq *SkippedQuery) Unique(unique bool) *SkippedQuery

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

func (sq *SkippedQuery) Where(ps ...predicate.Skipped) *SkippedQuery

Where adds a new predicate for the SkippedQuery builder.

type SkippedSelect

type SkippedSelect struct {
	*SkippedQuery
	// contains filtered or unexported fields
}

SkippedSelect is the builder for selecting fields of Skipped entities.

func (*SkippedSelect) Aggregate

func (ss *SkippedSelect) Aggregate(fns ...AggregateFunc) *SkippedSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SkippedSelect) Bool

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

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

func (*SkippedSelect) BoolX

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

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

func (*SkippedSelect) Bools

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

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

func (*SkippedSelect) BoolsX

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

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

func (*SkippedSelect) Float64

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

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

func (*SkippedSelect) Float64X

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

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

func (*SkippedSelect) Float64s

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

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

func (*SkippedSelect) Float64sX

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

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

func (*SkippedSelect) Int

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

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

func (*SkippedSelect) IntX

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

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

func (*SkippedSelect) Ints

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

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

func (*SkippedSelect) IntsX

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

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

func (*SkippedSelect) Scan

func (ss *SkippedSelect) Scan(ctx context.Context, v any) error

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

func (*SkippedSelect) ScanX

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

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

func (*SkippedSelect) String

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

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

func (*SkippedSelect) StringX

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

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

func (*SkippedSelect) Strings

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

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

func (*SkippedSelect) StringsX

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

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

type SkippedUpdate

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

SkippedUpdate is the builder for updating Skipped entities.

func (*SkippedUpdate) Exec

func (su *SkippedUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SkippedUpdate) ExecX

func (su *SkippedUpdate) ExecX(ctx context.Context)

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

func (*SkippedUpdate) Mutation

func (su *SkippedUpdate) Mutation() *SkippedMutation

Mutation returns the SkippedMutation object of the builder.

func (*SkippedUpdate) Save

func (su *SkippedUpdate) Save(ctx context.Context) (int, error)

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

func (*SkippedUpdate) SaveX

func (su *SkippedUpdate) SaveX(ctx context.Context) int

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

func (*SkippedUpdate) SetName

func (su *SkippedUpdate) SetName(s string) *SkippedUpdate

SetName sets the "name" field.

func (*SkippedUpdate) SetNillableName

func (su *SkippedUpdate) SetNillableName(s *string) *SkippedUpdate

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

func (*SkippedUpdate) Where

func (su *SkippedUpdate) Where(ps ...predicate.Skipped) *SkippedUpdate

Where appends a list predicates to the SkippedUpdate builder.

type SkippedUpdateOne

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

SkippedUpdateOne is the builder for updating a single Skipped entity.

func (*SkippedUpdateOne) Exec

func (suo *SkippedUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SkippedUpdateOne) ExecX

func (suo *SkippedUpdateOne) ExecX(ctx context.Context)

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

func (*SkippedUpdateOne) Mutation

func (suo *SkippedUpdateOne) Mutation() *SkippedMutation

Mutation returns the SkippedMutation object of the builder.

func (*SkippedUpdateOne) Save

func (suo *SkippedUpdateOne) Save(ctx context.Context) (*Skipped, error)

Save executes the query and returns the updated Skipped entity.

func (*SkippedUpdateOne) SaveX

func (suo *SkippedUpdateOne) SaveX(ctx context.Context) *Skipped

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

func (*SkippedUpdateOne) Select

func (suo *SkippedUpdateOne) Select(field string, fields ...string) *SkippedUpdateOne

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

func (*SkippedUpdateOne) SetName

func (suo *SkippedUpdateOne) SetName(s string) *SkippedUpdateOne

SetName sets the "name" field.

func (*SkippedUpdateOne) SetNillableName

func (suo *SkippedUpdateOne) SetNillableName(s *string) *SkippedUpdateOne

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

func (*SkippedUpdateOne) Where

Where appends a list predicates to the SkippedUpdate builder.

type Skippeds

type Skippeds []*Skipped

Skippeds is a parsable slice of Skipped.

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 {

	// Category is the client for interacting with the Category builders.
	Category *CategoryClient
	// Follows is the client for interacting with the Follows builders.
	Follows *FollowsClient
	// Friendship is the client for interacting with the Friendship builders.
	Friendship *FriendshipClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Settings is the client for interacting with the Settings builders.
	Settings *SettingsClient
	// Skipped is the client for interacting with the Skipped builders.
	Skipped *SkippedClient
	// 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"`
	// Time in which the resource was initially created.
	CreatedAt time.Time `json:"created_at"`
	// Time that the resource was last updated.
	UpdatedAt time.Time `json:"updated_at"`
	// Name of the user.
	Name string `json:"name"`
	// Type of object being defined (user or system which is for internal usecases).
	Type user.Type `json:"type"`
	// Full name if USER, otherwise null.
	Description *string `json:"description"`
	// If the user is still in the source system.
	Enabled bool `json:"enabled"`
	// Email associated with the user. Note that not all users have an associated email address.
	Email *string `json:"email"`
	// Avatar data for the user. This should generally only apply to the USER user type.
	Avatar *[]byte `json:"-"`
	// Hashed password for the user, this shouldn't be readable in the spec anywhere.
	PasswordHashed string `json:"-"`
	// The github user raw JSON data.
	GithubData *github.User `json:"github_data"`
	// ProfileURL holds the value of the "profile_url" field.
	ProfileURL *schema.ExampleValuer `json:"profile_url"`
	// 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) QueryFollowedPets

func (u *User) QueryFollowedPets() *PetQuery

QueryFollowedPets queries the "followed_pets" edge of the User entity.

func (*User) QueryFollowing

func (u *User) QueryFollowing() *FollowsQuery

QueryFollowing queries the "following" edge of the User entity.

func (*User) QueryFriends

func (u *User) QueryFriends() *UserQuery

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

func (*User) QueryFriendships

func (u *User) QueryFriendships() *FriendshipQuery

QueryFriendships queries the "friendships" 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.

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

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

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) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryFollowedPets

func (c *UserClient) QueryFollowedPets(u *User) *PetQuery

QueryFollowedPets queries the followed_pets edge of a User.

func (*UserClient) QueryFollowing

func (c *UserClient) QueryFollowing(u *User) *FollowsQuery

QueryFollowing queries the following edge of a User.

func (*UserClient) QueryFriends

func (c *UserClient) QueryFriends(u *User) *UserQuery

QueryFriends queries the friends edge of a User.

func (*UserClient) QueryFriendships

func (c *UserClient) QueryFriendships(u *User) *FriendshipQuery

QueryFriendships queries the friendships 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) AddFollowedPetIDs

func (uc *UserCreate) AddFollowedPetIDs(ids ...int) *UserCreate

AddFollowedPetIDs adds the "followed_pets" edge to the Pet entity by IDs.

func (*UserCreate) AddFollowedPets

func (uc *UserCreate) AddFollowedPets(p ...*Pet) *UserCreate

AddFollowedPets adds the "followed_pets" edges to the Pet entity.

func (*UserCreate) AddFriendIDs

func (uc *UserCreate) AddFriendIDs(ids ...int) *UserCreate

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

func (*UserCreate) AddFriends

func (uc *UserCreate) AddFriends(u ...*User) *UserCreate

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

func (*UserCreate) AddFriendshipIDs

func (uc *UserCreate) AddFriendshipIDs(ids ...int) *UserCreate

AddFriendshipIDs adds the "friendships" edge to the Friendship entity by IDs.

func (*UserCreate) AddFriendships

func (uc *UserCreate) AddFriendships(f ...*Friendship) *UserCreate

AddFriendships adds the "friendships" edges to the Friendship entity.

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) SetAvatar

func (uc *UserCreate) SetAvatar(b []byte) *UserCreate

SetAvatar sets the "avatar" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetDescription

func (uc *UserCreate) SetDescription(s string) *UserCreate

SetDescription sets the "description" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetEnabled

func (uc *UserCreate) SetEnabled(b bool) *UserCreate

SetEnabled sets the "enabled" field.

func (*UserCreate) SetGithubData

func (uc *UserCreate) SetGithubData(gi *github.User) *UserCreate

SetGithubData sets the "github_data" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableDescription

func (uc *UserCreate) SetNillableDescription(s *string) *UserCreate

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

func (*UserCreate) SetNillableEmail

func (uc *UserCreate) SetNillableEmail(s *string) *UserCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserCreate) SetNillableEnabled

func (uc *UserCreate) SetNillableEnabled(b *bool) *UserCreate

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*UserCreate) SetNillableType

func (uc *UserCreate) SetNillableType(u *user.Type) *UserCreate

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

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetPasswordHashed

func (uc *UserCreate) SetPasswordHashed(s string) *UserCreate

SetPasswordHashed sets the "password_hashed" field.

func (*UserCreate) SetProfileURL

func (uc *UserCreate) SetProfileURL(sv *schema.ExampleValuer) *UserCreate

SetProfileURL sets the "profile_url" field.

func (*UserCreate) SetType

func (uc *UserCreate) SetType(u user.Type) *UserCreate

SetType sets the "type" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

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 owned by the user.
	Pets []*Pet `json:"pets,omitempty"`
	// Pets that the user is following.
	FollowedPets []*Pet `json:"followed_pets,omitempty"`
	// Friends of the user.
	Friends []*User `json:"friends,omitempty"`
	// Following holds the value of the following edge.
	Following []*Follows `json:"following,omitempty"`
	// Friendships holds the value of the friendships edge.
	Friendships []*Friendship `json:"friendships,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) FollowedPetsOrErr

func (e UserEdges) FollowedPetsOrErr() ([]*Pet, error)

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

func (UserEdges) FollowingOrErr

func (e UserEdges) FollowingOrErr() ([]*Follows, error)

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

func (UserEdges) FriendsOrErr

func (e UserEdges) FriendsOrErr() ([]*User, error)

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

func (UserEdges) FriendshipsOrErr

func (e UserEdges) FriendshipsOrErr() ([]*Friendship, error)

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

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) 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) AddFollowedPetIDs

func (m *UserMutation) AddFollowedPetIDs(ids ...int)

AddFollowedPetIDs adds the "followed_pets" edge to the Pet entity by ids.

func (*UserMutation) AddFriendIDs

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

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

func (*UserMutation) AddFriendshipIDs

func (m *UserMutation) AddFriendshipIDs(ids ...int)

AddFriendshipIDs adds the "friendships" edge to the Friendship entity by ids.

func (*UserMutation) AddPetIDs

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

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

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) 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) Avatar

func (m *UserMutation) Avatar() (r []byte, exists bool)

Avatar returns the value of the "avatar" field in the mutation.

func (*UserMutation) AvatarCleared

func (m *UserMutation) AvatarCleared() bool

AvatarCleared returns if the "avatar" field was cleared in this mutation.

func (*UserMutation) ClearAvatar

func (m *UserMutation) ClearAvatar()

ClearAvatar clears the value of the "avatar" field.

func (*UserMutation) ClearDescription

func (m *UserMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

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) ClearEmail

func (m *UserMutation) ClearEmail()

ClearEmail clears the value of the "email" field.

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) ClearFollowedPets

func (m *UserMutation) ClearFollowedPets()

ClearFollowedPets clears the "followed_pets" edge to the Pet entity.

func (*UserMutation) ClearFriends

func (m *UserMutation) ClearFriends()

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

func (*UserMutation) ClearFriendships

func (m *UserMutation) ClearFriendships()

ClearFriendships clears the "friendships" edge to the Friendship entity.

func (*UserMutation) ClearGithubData

func (m *UserMutation) ClearGithubData()

ClearGithubData clears the value of the "github_data" field.

func (*UserMutation) ClearPets

func (m *UserMutation) ClearPets()

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

func (*UserMutation) ClearProfileURL

func (m *UserMutation) ClearProfileURL()

ClearProfileURL clears the value of the "profile_url" field.

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) CreatedAt

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

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) Description

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

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

func (*UserMutation) DescriptionCleared

func (m *UserMutation) DescriptionCleared() bool

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

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) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) EmailCleared

func (m *UserMutation) EmailCleared() bool

EmailCleared returns if the "email" field was cleared in this mutation.

func (*UserMutation) Enabled

func (m *UserMutation) Enabled() (r bool, exists bool)

Enabled returns the value of the "enabled" field in the mutation.

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) FollowedPetsCleared

func (m *UserMutation) FollowedPetsCleared() bool

FollowedPetsCleared reports if the "followed_pets" edge to the Pet entity was cleared.

func (*UserMutation) FollowedPetsIDs

func (m *UserMutation) FollowedPetsIDs() (ids []int)

FollowedPetsIDs returns the "followed_pets" edge IDs in the mutation.

func (*UserMutation) FriendsCleared

func (m *UserMutation) FriendsCleared() bool

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

func (*UserMutation) FriendsIDs

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

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

func (*UserMutation) FriendshipsCleared

func (m *UserMutation) FriendshipsCleared() bool

FriendshipsCleared reports if the "friendships" edge to the Friendship entity was cleared.

func (*UserMutation) FriendshipsIDs

func (m *UserMutation) FriendshipsIDs() (ids []int)

FriendshipsIDs returns the "friendships" edge IDs in the mutation.

func (*UserMutation) GetType

func (m *UserMutation) GetType() (r user.Type, exists bool)

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

func (*UserMutation) GithubData

func (m *UserMutation) GithubData() (r *github.User, exists bool)

GithubData returns the value of the "github_data" field in the mutation.

func (*UserMutation) GithubDataCleared

func (m *UserMutation) GithubDataCleared() bool

GithubDataCleared returns if the "github_data" 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) OldAvatar

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

OldAvatar returns the old "avatar" 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) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" 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) OldDescription

func (m *UserMutation) OldDescription(ctx context.Context) (v *string, err error)

OldDescription returns the old "description" 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) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v *string, err error)

OldEmail returns the old "email" 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) OldEnabled

func (m *UserMutation) OldEnabled(ctx context.Context) (v bool, err error)

OldEnabled returns the old "enabled" 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) OldGithubData

func (m *UserMutation) OldGithubData(ctx context.Context) (v *github.User, err error)

OldGithubData returns the old "github_data" 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) OldPasswordHashed

func (m *UserMutation) OldPasswordHashed(ctx context.Context) (v string, err error)

OldPasswordHashed returns the old "password_hashed" 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) OldProfileURL

func (m *UserMutation) OldProfileURL(ctx context.Context) (v *schema.ExampleValuer, err error)

OldProfileURL returns the old "profile_url" 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) OldType

func (m *UserMutation) OldType(ctx context.Context) (v user.Type, err error)

OldType returns the old "type" 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) OldUpdatedAt

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" 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) PasswordHashed

func (m *UserMutation) PasswordHashed() (r string, exists bool)

PasswordHashed returns the value of the "password_hashed" field in the mutation.

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) ProfileURL

func (m *UserMutation) ProfileURL() (r *schema.ExampleValuer, exists bool)

ProfileURL returns the value of the "profile_url" field in the mutation.

func (*UserMutation) ProfileURLCleared

func (m *UserMutation) ProfileURLCleared() bool

ProfileURLCleared returns if the "profile_url" field was cleared in this mutation.

func (*UserMutation) RemoveFollowedPetIDs

func (m *UserMutation) RemoveFollowedPetIDs(ids ...int)

RemoveFollowedPetIDs removes the "followed_pets" edge to the Pet entity by IDs.

func (*UserMutation) RemoveFriendIDs

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

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

func (*UserMutation) RemoveFriendshipIDs

func (m *UserMutation) RemoveFriendshipIDs(ids ...int)

RemoveFriendshipIDs removes the "friendships" edge to the Friendship 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) RemovedEdges

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

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

func (*UserMutation) RemovedFollowedPetsIDs

func (m *UserMutation) RemovedFollowedPetsIDs() (ids []int)

RemovedFollowedPets returns the removed IDs of the "followed_pets" edge to the Pet entity.

func (*UserMutation) RemovedFriendsIDs

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

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

func (*UserMutation) RemovedFriendshipsIDs

func (m *UserMutation) RemovedFriendshipsIDs() (ids []int)

RemovedFriendships returns the removed IDs of the "friendships" edge to the Friendship entity.

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) ResetAvatar

func (m *UserMutation) ResetAvatar()

ResetAvatar resets all changes to the "avatar" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetDescription

func (m *UserMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

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) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetEnabled

func (m *UserMutation) ResetEnabled()

ResetEnabled resets all changes to the "enabled" field.

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) ResetFollowedPets

func (m *UserMutation) ResetFollowedPets()

ResetFollowedPets resets all changes to the "followed_pets" edge.

func (*UserMutation) ResetFriends

func (m *UserMutation) ResetFriends()

ResetFriends resets all changes to the "friends" edge.

func (*UserMutation) ResetFriendships

func (m *UserMutation) ResetFriendships()

ResetFriendships resets all changes to the "friendships" edge.

func (*UserMutation) ResetGithubData

func (m *UserMutation) ResetGithubData()

ResetGithubData resets all changes to the "github_data" field.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetPasswordHashed

func (m *UserMutation) ResetPasswordHashed()

ResetPasswordHashed resets all changes to the "password_hashed" field.

func (*UserMutation) ResetPets

func (m *UserMutation) ResetPets()

ResetPets resets all changes to the "pets" edge.

func (*UserMutation) ResetProfileURL

func (m *UserMutation) ResetProfileURL()

ResetProfileURL resets all changes to the "profile_url" field.

func (*UserMutation) ResetType

func (m *UserMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) SetAvatar

func (m *UserMutation) SetAvatar(b []byte)

SetAvatar sets the "avatar" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetDescription

func (m *UserMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetEnabled

func (m *UserMutation) SetEnabled(b bool)

SetEnabled sets the "enabled" field.

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) SetGithubData

func (m *UserMutation) SetGithubData(gi *github.User)

SetGithubData sets the "github_data" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id int)

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

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) SetPasswordHashed

func (m *UserMutation) SetPasswordHashed(s string)

SetPasswordHashed sets the "password_hashed" field.

func (*UserMutation) SetProfileURL

func (m *UserMutation) SetProfileURL(sv *schema.ExampleValuer)

SetProfileURL sets the "profile_url" field.

func (*UserMutation) SetType

func (m *UserMutation) SetType(u user.Type)

SetType sets the "type" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

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) UpdatedAt

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

UpdatedAt returns the value of the "updated_at" field in the mutation.

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

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	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 ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryFollowedPets

func (uq *UserQuery) QueryFollowedPets() *PetQuery

QueryFollowedPets chains the current query on the "followed_pets" edge.

func (*UserQuery) QueryFollowing

func (uq *UserQuery) QueryFollowing() *FollowsQuery

QueryFollowing chains the current query on the "following" edge.

func (*UserQuery) QueryFriends

func (uq *UserQuery) QueryFriends() *UserQuery

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

func (*UserQuery) QueryFriendships

func (uq *UserQuery) QueryFriendships() *FriendshipQuery

QueryFriendships chains the current query on the "friendships" 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 {
	CreatedAt time.Time `json:"created_at"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	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) WithFollowedPets

func (uq *UserQuery) WithFollowedPets(opts ...func(*PetQuery)) *UserQuery

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

func (*UserQuery) WithFollowing

func (uq *UserQuery) WithFollowing(opts ...func(*FollowsQuery)) *UserQuery

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

func (*UserQuery) WithFriends

func (uq *UserQuery) WithFriends(opts ...func(*UserQuery)) *UserQuery

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 (*UserQuery) WithFriendships

func (uq *UserQuery) WithFriendships(opts ...func(*FriendshipQuery)) *UserQuery

WithFriendships tells the query-builder to eager-load the nodes that are connected to the "friendships" 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) AddFollowedPetIDs

func (uu *UserUpdate) AddFollowedPetIDs(ids ...int) *UserUpdate

AddFollowedPetIDs adds the "followed_pets" edge to the Pet entity by IDs.

func (*UserUpdate) AddFollowedPets

func (uu *UserUpdate) AddFollowedPets(p ...*Pet) *UserUpdate

AddFollowedPets adds the "followed_pets" edges to the Pet entity.

func (*UserUpdate) AddFriendIDs

func (uu *UserUpdate) AddFriendIDs(ids ...int) *UserUpdate

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

func (*UserUpdate) AddFriends

func (uu *UserUpdate) AddFriends(u ...*User) *UserUpdate

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

func (*UserUpdate) AddFriendshipIDs

func (uu *UserUpdate) AddFriendshipIDs(ids ...int) *UserUpdate

AddFriendshipIDs adds the "friendships" edge to the Friendship entity by IDs.

func (*UserUpdate) AddFriendships

func (uu *UserUpdate) AddFriendships(f ...*Friendship) *UserUpdate

AddFriendships adds the "friendships" edges to the Friendship entity.

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) ClearAvatar

func (uu *UserUpdate) ClearAvatar() *UserUpdate

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdate) ClearDescription

func (uu *UserUpdate) ClearDescription() *UserUpdate

ClearDescription clears the value of the "description" field.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of the "email" field.

func (*UserUpdate) ClearFollowedPets

func (uu *UserUpdate) ClearFollowedPets() *UserUpdate

ClearFollowedPets clears all "followed_pets" edges to the Pet entity.

func (*UserUpdate) ClearFriends

func (uu *UserUpdate) ClearFriends() *UserUpdate

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

func (*UserUpdate) ClearFriendships

func (uu *UserUpdate) ClearFriendships() *UserUpdate

ClearFriendships clears all "friendships" edges to the Friendship entity.

func (*UserUpdate) ClearGithubData

func (uu *UserUpdate) ClearGithubData() *UserUpdate

ClearGithubData clears the value of the "github_data" field.

func (*UserUpdate) ClearPets

func (uu *UserUpdate) ClearPets() *UserUpdate

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

func (*UserUpdate) ClearProfileURL

func (uu *UserUpdate) ClearProfileURL() *UserUpdate

ClearProfileURL clears the value of the "profile_url" field.

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) RemoveFollowedPetIDs

func (uu *UserUpdate) RemoveFollowedPetIDs(ids ...int) *UserUpdate

RemoveFollowedPetIDs removes the "followed_pets" edge to Pet entities by IDs.

func (*UserUpdate) RemoveFollowedPets

func (uu *UserUpdate) RemoveFollowedPets(p ...*Pet) *UserUpdate

RemoveFollowedPets removes "followed_pets" edges to Pet entities.

func (*UserUpdate) RemoveFriendIDs

func (uu *UserUpdate) RemoveFriendIDs(ids ...int) *UserUpdate

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

func (*UserUpdate) RemoveFriends

func (uu *UserUpdate) RemoveFriends(u ...*User) *UserUpdate

RemoveFriends removes "friends" edges to User entities.

func (*UserUpdate) RemoveFriendshipIDs

func (uu *UserUpdate) RemoveFriendshipIDs(ids ...int) *UserUpdate

RemoveFriendshipIDs removes the "friendships" edge to Friendship entities by IDs.

func (*UserUpdate) RemoveFriendships

func (uu *UserUpdate) RemoveFriendships(f ...*Friendship) *UserUpdate

RemoveFriendships removes "friendships" edges to Friendship entities.

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) SetAvatar

func (uu *UserUpdate) SetAvatar(b []byte) *UserUpdate

SetAvatar sets the "avatar" field.

func (*UserUpdate) SetDescription

func (uu *UserUpdate) SetDescription(s string) *UserUpdate

SetDescription sets the "description" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetEnabled

func (uu *UserUpdate) SetEnabled(b bool) *UserUpdate

SetEnabled sets the "enabled" field.

func (*UserUpdate) SetGithubData

func (uu *UserUpdate) SetGithubData(gi *github.User) *UserUpdate

SetGithubData sets the "github_data" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableDescription

func (uu *UserUpdate) SetNillableDescription(s *string) *UserUpdate

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

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillableEnabled

func (uu *UserUpdate) SetNillableEnabled(b *bool) *UserUpdate

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

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

func (*UserUpdate) SetNillablePasswordHashed

func (uu *UserUpdate) SetNillablePasswordHashed(s *string) *UserUpdate

SetNillablePasswordHashed sets the "password_hashed" field if the given value is not nil.

func (*UserUpdate) SetNillableType

func (uu *UserUpdate) SetNillableType(u *user.Type) *UserUpdate

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

func (*UserUpdate) SetPasswordHashed

func (uu *UserUpdate) SetPasswordHashed(s string) *UserUpdate

SetPasswordHashed sets the "password_hashed" field.

func (*UserUpdate) SetProfileURL

func (uu *UserUpdate) SetProfileURL(sv *schema.ExampleValuer) *UserUpdate

SetProfileURL sets the "profile_url" field.

func (*UserUpdate) SetType

func (uu *UserUpdate) SetType(u user.Type) *UserUpdate

SetType sets the "type" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

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) AddFollowedPetIDs

func (uuo *UserUpdateOne) AddFollowedPetIDs(ids ...int) *UserUpdateOne

AddFollowedPetIDs adds the "followed_pets" edge to the Pet entity by IDs.

func (*UserUpdateOne) AddFollowedPets

func (uuo *UserUpdateOne) AddFollowedPets(p ...*Pet) *UserUpdateOne

AddFollowedPets adds the "followed_pets" edges to the Pet entity.

func (*UserUpdateOne) AddFriendIDs

func (uuo *UserUpdateOne) AddFriendIDs(ids ...int) *UserUpdateOne

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

func (*UserUpdateOne) AddFriends

func (uuo *UserUpdateOne) AddFriends(u ...*User) *UserUpdateOne

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

func (*UserUpdateOne) AddFriendshipIDs

func (uuo *UserUpdateOne) AddFriendshipIDs(ids ...int) *UserUpdateOne

AddFriendshipIDs adds the "friendships" edge to the Friendship entity by IDs.

func (*UserUpdateOne) AddFriendships

func (uuo *UserUpdateOne) AddFriendships(f ...*Friendship) *UserUpdateOne

AddFriendships adds the "friendships" edges to the Friendship entity.

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) ClearAvatar

func (uuo *UserUpdateOne) ClearAvatar() *UserUpdateOne

ClearAvatar clears the value of the "avatar" field.

func (*UserUpdateOne) ClearDescription

func (uuo *UserUpdateOne) ClearDescription() *UserUpdateOne

ClearDescription clears the value of the "description" field.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of the "email" field.

func (*UserUpdateOne) ClearFollowedPets

func (uuo *UserUpdateOne) ClearFollowedPets() *UserUpdateOne

ClearFollowedPets clears all "followed_pets" edges to the Pet entity.

func (*UserUpdateOne) ClearFriends

func (uuo *UserUpdateOne) ClearFriends() *UserUpdateOne

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

func (*UserUpdateOne) ClearFriendships

func (uuo *UserUpdateOne) ClearFriendships() *UserUpdateOne

ClearFriendships clears all "friendships" edges to the Friendship entity.

func (*UserUpdateOne) ClearGithubData

func (uuo *UserUpdateOne) ClearGithubData() *UserUpdateOne

ClearGithubData clears the value of the "github_data" field.

func (*UserUpdateOne) ClearPets

func (uuo *UserUpdateOne) ClearPets() *UserUpdateOne

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

func (*UserUpdateOne) ClearProfileURL

func (uuo *UserUpdateOne) ClearProfileURL() *UserUpdateOne

ClearProfileURL clears the value of the "profile_url" field.

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) RemoveFollowedPetIDs

func (uuo *UserUpdateOne) RemoveFollowedPetIDs(ids ...int) *UserUpdateOne

RemoveFollowedPetIDs removes the "followed_pets" edge to Pet entities by IDs.

func (*UserUpdateOne) RemoveFollowedPets

func (uuo *UserUpdateOne) RemoveFollowedPets(p ...*Pet) *UserUpdateOne

RemoveFollowedPets removes "followed_pets" edges to Pet entities.

func (*UserUpdateOne) RemoveFriendIDs

func (uuo *UserUpdateOne) RemoveFriendIDs(ids ...int) *UserUpdateOne

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

func (*UserUpdateOne) RemoveFriends

func (uuo *UserUpdateOne) RemoveFriends(u ...*User) *UserUpdateOne

RemoveFriends removes "friends" edges to User entities.

func (*UserUpdateOne) RemoveFriendshipIDs

func (uuo *UserUpdateOne) RemoveFriendshipIDs(ids ...int) *UserUpdateOne

RemoveFriendshipIDs removes the "friendships" edge to Friendship entities by IDs.

func (*UserUpdateOne) RemoveFriendships

func (uuo *UserUpdateOne) RemoveFriendships(f ...*Friendship) *UserUpdateOne

RemoveFriendships removes "friendships" edges to Friendship entities.

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) SetAvatar

func (uuo *UserUpdateOne) SetAvatar(b []byte) *UserUpdateOne

SetAvatar sets the "avatar" field.

func (*UserUpdateOne) SetDescription

func (uuo *UserUpdateOne) SetDescription(s string) *UserUpdateOne

SetDescription sets the "description" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetEnabled

func (uuo *UserUpdateOne) SetEnabled(b bool) *UserUpdateOne

SetEnabled sets the "enabled" field.

func (*UserUpdateOne) SetGithubData

func (uuo *UserUpdateOne) SetGithubData(gi *github.User) *UserUpdateOne

SetGithubData sets the "github_data" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableDescription

func (uuo *UserUpdateOne) SetNillableDescription(s *string) *UserUpdateOne

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

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEnabled

func (uuo *UserUpdateOne) SetNillableEnabled(b *bool) *UserUpdateOne

SetNillableEnabled sets the "enabled" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

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

func (*UserUpdateOne) SetNillablePasswordHashed

func (uuo *UserUpdateOne) SetNillablePasswordHashed(s *string) *UserUpdateOne

SetNillablePasswordHashed sets the "password_hashed" field if the given value is not nil.

func (*UserUpdateOne) SetNillableType

func (uuo *UserUpdateOne) SetNillableType(u *user.Type) *UserUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*UserUpdateOne) SetPasswordHashed

func (uuo *UserUpdateOne) SetPasswordHashed(s string) *UserUpdateOne

SetPasswordHashed sets the "password_hashed" field.

func (*UserUpdateOne) SetProfileURL

func (uuo *UserUpdateOne) SetProfileURL(sv *schema.ExampleValuer) *UserUpdateOne

SetProfileURL sets the "profile_url" field.

func (*UserUpdateOne) SetType

func (uuo *UserUpdateOne) SetType(u user.Type) *UserUpdateOne

SetType sets the "type" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL