ent

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 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.
	TypeCar      = "Car"
	TypeCard     = "Card"
	TypeInfo     = "Info"
	TypeMetadata = "Metadata"
	TypeNode     = "Node"
	TypePet      = "Pet"
	TypePost     = "Post"
	TypeRental   = "Rental"
	TypeUser     = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Car

type Car struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Number holds the value of the "number" field.
	Number string `json:"number,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CarQuery when eager-loading is set.
	Edges CarEdges `json:"edges"`
	// contains filtered or unexported fields
}

Car is the model entity for the Car schema.

func (*Car) QueryRentals

func (c *Car) QueryRentals() *RentalQuery

QueryRentals queries the "rentals" edge of the Car entity.

func (*Car) String

func (c *Car) String() string

String implements the fmt.Stringer.

func (*Car) Unwrap

func (c *Car) Unwrap() *Car

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

func (c *Car) Update() *CarUpdateOne

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

type CarClient

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

CarClient is a client for the Car schema.

func NewCarClient

func NewCarClient(c config) *CarClient

NewCarClient returns a client for the Car from the given config.

func (*CarClient) Create

func (c *CarClient) Create() *CarCreate

Create returns a create builder for Car.

func (*CarClient) CreateBulk

func (c *CarClient) CreateBulk(builders ...*CarCreate) *CarCreateBulk

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

func (*CarClient) Delete

func (c *CarClient) Delete() *CarDelete

Delete returns a delete builder for Car.

func (*CarClient) DeleteOne

func (c *CarClient) DeleteOne(ca *Car) *CarDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CarClient) DeleteOneID

func (c *CarClient) DeleteOneID(id uuid.UUID) *CarDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CarClient) Get

func (c *CarClient) Get(ctx context.Context, id uuid.UUID) (*Car, error)

Get returns a Car entity by its id.

func (*CarClient) GetX

func (c *CarClient) GetX(ctx context.Context, id uuid.UUID) *Car

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

func (*CarClient) Hooks

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

Hooks returns the client hooks.

func (*CarClient) Query

func (c *CarClient) Query() *CarQuery

Query returns a query builder for Car.

func (*CarClient) QueryRentals

func (c *CarClient) QueryRentals(ca *Car) *RentalQuery

QueryRentals queries the rentals edge of a Car.

func (*CarClient) Update

func (c *CarClient) Update() *CarUpdate

Update returns an update builder for Car.

func (*CarClient) UpdateOne

func (c *CarClient) UpdateOne(ca *Car) *CarUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CarClient) UpdateOneID

func (c *CarClient) UpdateOneID(id uuid.UUID) *CarUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CarClient) Use

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

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

type CarCreate

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

CarCreate is the builder for creating a Car entity.

func (*CarCreate) AddRentalIDs

func (cc *CarCreate) AddRentalIDs(ids ...int) *CarCreate

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*CarCreate) AddRentals

func (cc *CarCreate) AddRentals(r ...*Rental) *CarCreate

AddRentals adds the "rentals" edges to the Rental entity.

func (*CarCreate) Exec

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

Exec executes the query.

func (*CarCreate) ExecX

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

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

func (*CarCreate) Mutation

func (cc *CarCreate) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarCreate) Save

func (cc *CarCreate) Save(ctx context.Context) (*Car, error)

Save creates the Car in the database.

func (*CarCreate) SaveX

func (cc *CarCreate) SaveX(ctx context.Context) *Car

SaveX calls Save and panics if Save returns an error.

func (*CarCreate) SetID

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

SetID sets the "id" field.

func (*CarCreate) SetNillableID

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

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

func (*CarCreate) SetNillableNumber

func (cc *CarCreate) SetNillableNumber(s *string) *CarCreate

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CarCreate) SetNumber

func (cc *CarCreate) SetNumber(s string) *CarCreate

SetNumber sets the "number" field.

type CarCreateBulk

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

CarCreateBulk is the builder for creating many Car entities in bulk.

func (*CarCreateBulk) Exec

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

Exec executes the query.

func (*CarCreateBulk) ExecX

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

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

func (*CarCreateBulk) Save

func (ccb *CarCreateBulk) Save(ctx context.Context) ([]*Car, error)

Save creates the Car entities in the database.

func (*CarCreateBulk) SaveX

func (ccb *CarCreateBulk) SaveX(ctx context.Context) []*Car

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

type CarDelete

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

CarDelete is the builder for deleting a Car entity.

func (*CarDelete) Exec

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

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

func (*CarDelete) ExecX

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

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

func (*CarDelete) Where

func (cd *CarDelete) Where(ps ...predicate.Car) *CarDelete

Where appends a list predicates to the CarDelete builder.

type CarDeleteOne

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

CarDeleteOne is the builder for deleting a single Car entity.

func (*CarDeleteOne) Exec

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

Exec executes the deletion query.

func (*CarDeleteOne) ExecX

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

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

type CarEdges

type CarEdges struct {
	// Rentals holds the value of the rentals edge.
	Rentals []*Rental `json:"rentals,omitempty"`
	// contains filtered or unexported fields
}

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

func (CarEdges) RentalsOrErr

func (e CarEdges) RentalsOrErr() ([]*Rental, error)

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

type CarGroupBy

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

CarGroupBy is the group-by builder for Car entities.

func (*CarGroupBy) Aggregate

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

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

func (*CarGroupBy) Bool

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

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

func (*CarGroupBy) BoolX

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

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

func (*CarGroupBy) Bools

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

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

func (*CarGroupBy) BoolsX

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

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

func (*CarGroupBy) Float64

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

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

func (*CarGroupBy) Float64X

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

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

func (*CarGroupBy) Float64s

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

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

func (*CarGroupBy) Float64sX

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

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

func (*CarGroupBy) Int

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

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

func (*CarGroupBy) IntX

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

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

func (*CarGroupBy) Ints

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

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

func (*CarGroupBy) IntsX

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

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

func (*CarGroupBy) Scan

func (cgb *CarGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CarGroupBy) ScanX

func (s *CarGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CarGroupBy) String

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

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

func (*CarGroupBy) StringX

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

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

func (*CarGroupBy) Strings

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

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

func (*CarGroupBy) StringsX

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

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

type CarMutation

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

CarMutation represents an operation that mutates the Car nodes in the graph.

func (*CarMutation) AddField

func (m *CarMutation) 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 (*CarMutation) AddRentalIDs

func (m *CarMutation) AddRentalIDs(ids ...int)

AddRentalIDs adds the "rentals" edge to the Rental entity by ids.

func (*CarMutation) AddedEdges

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

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

func (*CarMutation) AddedField

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

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

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

func (*CarMutation) AddedIDs

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

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

func (*CarMutation) ClearEdge

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

func (m *CarMutation) 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 (*CarMutation) ClearNumber

func (m *CarMutation) ClearNumber()

ClearNumber clears the value of the "number" field.

func (*CarMutation) ClearRentals

func (m *CarMutation) ClearRentals()

ClearRentals clears the "rentals" edge to the Rental entity.

func (*CarMutation) ClearedEdges

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

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

func (*CarMutation) ClearedFields

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

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

func (CarMutation) Client

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

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

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

func (*CarMutation) Field

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

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

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

func (*CarMutation) Fields

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

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

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

func (*CarMutation) IDs

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

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

func (*CarMutation) Number

func (m *CarMutation) Number() (r string, exists bool)

Number returns the value of the "number" field in the mutation.

func (*CarMutation) NumberCleared

func (m *CarMutation) NumberCleared() bool

NumberCleared returns if the "number" field was cleared in this mutation.

func (*CarMutation) OldField

func (m *CarMutation) 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 (*CarMutation) OldNumber

func (m *CarMutation) OldNumber(ctx context.Context) (v string, err error)

OldNumber returns the old "number" field's value of the Car entity. If the Car 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 (*CarMutation) Op

func (m *CarMutation) Op() Op

Op returns the operation name.

func (*CarMutation) RemoveRentalIDs

func (m *CarMutation) RemoveRentalIDs(ids ...int)

RemoveRentalIDs removes the "rentals" edge to the Rental entity by IDs.

func (*CarMutation) RemovedEdges

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

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

func (*CarMutation) RemovedIDs

func (m *CarMutation) 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 (*CarMutation) RemovedRentalsIDs

func (m *CarMutation) RemovedRentalsIDs() (ids []int)

RemovedRentals returns the removed IDs of the "rentals" edge to the Rental entity.

func (*CarMutation) RentalsCleared

func (m *CarMutation) RentalsCleared() bool

RentalsCleared reports if the "rentals" edge to the Rental entity was cleared.

func (*CarMutation) RentalsIDs

func (m *CarMutation) RentalsIDs() (ids []int)

RentalsIDs returns the "rentals" edge IDs in the mutation.

func (*CarMutation) ResetEdge

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

func (m *CarMutation) 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 (*CarMutation) ResetNumber

func (m *CarMutation) ResetNumber()

ResetNumber resets all changes to the "number" field.

func (*CarMutation) ResetRentals

func (m *CarMutation) ResetRentals()

ResetRentals resets all changes to the "rentals" edge.

func (*CarMutation) SetField

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

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

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

func (*CarMutation) SetNumber

func (m *CarMutation) SetNumber(s string)

SetNumber sets the "number" field.

func (CarMutation) Tx

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

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

func (*CarMutation) Type

func (m *CarMutation) Type() string

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

func (*CarMutation) Where

func (m *CarMutation) Where(ps ...predicate.Car)

Where appends a list predicates to the CarMutation builder.

type CarQuery

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

CarQuery is the builder for querying Car entities.

func (*CarQuery) All

func (cq *CarQuery) All(ctx context.Context) ([]*Car, error)

All executes the query and returns a list of Cars.

func (*CarQuery) AllX

func (cq *CarQuery) AllX(ctx context.Context) []*Car

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

func (*CarQuery) Clone

func (cq *CarQuery) Clone() *CarQuery

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

func (*CarQuery) Count

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

Count returns the count of the given query.

func (*CarQuery) CountX

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

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

func (*CarQuery) Exist

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

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

func (*CarQuery) ExistX

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

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

func (*CarQuery) First

func (cq *CarQuery) First(ctx context.Context) (*Car, error)

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

func (*CarQuery) FirstID

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

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

func (*CarQuery) FirstIDX

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

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

func (*CarQuery) FirstX

func (cq *CarQuery) FirstX(ctx context.Context) *Car

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

func (*CarQuery) GroupBy

func (cq *CarQuery) GroupBy(field string, fields ...string) *CarGroupBy

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

client.Car.Query().
	GroupBy(car.FieldNumber).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CarQuery) IDs

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

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

func (*CarQuery) IDsX

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

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

func (*CarQuery) Limit

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

Limit adds a limit step to the query.

func (*CarQuery) Offset

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

Offset adds an offset step to the query.

func (*CarQuery) Only

func (cq *CarQuery) Only(ctx context.Context) (*Car, error)

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

func (*CarQuery) OnlyID

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

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

func (*CarQuery) OnlyIDX

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

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

func (*CarQuery) OnlyX

func (cq *CarQuery) OnlyX(ctx context.Context) *Car

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

func (*CarQuery) Order

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

Order adds an order step to the query.

func (*CarQuery) QueryRentals

func (cq *CarQuery) QueryRentals() *RentalQuery

QueryRentals chains the current query on the "rentals" edge.

func (*CarQuery) Select

func (cq *CarQuery) Select(fields ...string) *CarSelect

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 {
	Number string `json:"number,omitempty"`
}

client.Car.Query().
	Select(car.FieldNumber).
	Scan(ctx, &v)

func (*CarQuery) Unique

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

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

func (cq *CarQuery) Where(ps ...predicate.Car) *CarQuery

Where adds a new predicate for the CarQuery builder.

func (*CarQuery) WithRentals

func (cq *CarQuery) WithRentals(opts ...func(*RentalQuery)) *CarQuery

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

type CarSelect

type CarSelect struct {
	*CarQuery
	// contains filtered or unexported fields
}

CarSelect is the builder for selecting fields of Car entities.

func (*CarSelect) Bool

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

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

func (*CarSelect) BoolX

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

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

func (*CarSelect) Bools

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

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

func (*CarSelect) BoolsX

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

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

func (*CarSelect) Float64

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

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

func (*CarSelect) Float64X

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

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

func (*CarSelect) Float64s

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

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

func (*CarSelect) Float64sX

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

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

func (*CarSelect) Int

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

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

func (*CarSelect) IntX

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

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

func (*CarSelect) Ints

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

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

func (*CarSelect) IntsX

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

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

func (*CarSelect) Scan

func (cs *CarSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CarSelect) ScanX

func (s *CarSelect) ScanX(ctx context.Context, v interface{})

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

func (*CarSelect) String

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

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

func (*CarSelect) StringX

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

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

func (*CarSelect) Strings

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

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

func (*CarSelect) StringsX

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

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

type CarUpdate

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

CarUpdate is the builder for updating Car entities.

func (*CarUpdate) AddRentalIDs

func (cu *CarUpdate) AddRentalIDs(ids ...int) *CarUpdate

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*CarUpdate) AddRentals

func (cu *CarUpdate) AddRentals(r ...*Rental) *CarUpdate

AddRentals adds the "rentals" edges to the Rental entity.

func (*CarUpdate) ClearNumber

func (cu *CarUpdate) ClearNumber() *CarUpdate

ClearNumber clears the value of the "number" field.

func (*CarUpdate) ClearRentals

func (cu *CarUpdate) ClearRentals() *CarUpdate

ClearRentals clears all "rentals" edges to the Rental entity.

func (*CarUpdate) Exec

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

Exec executes the query.

func (*CarUpdate) ExecX

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

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

func (*CarUpdate) Mutation

func (cu *CarUpdate) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarUpdate) RemoveRentalIDs

func (cu *CarUpdate) RemoveRentalIDs(ids ...int) *CarUpdate

RemoveRentalIDs removes the "rentals" edge to Rental entities by IDs.

func (*CarUpdate) RemoveRentals

func (cu *CarUpdate) RemoveRentals(r ...*Rental) *CarUpdate

RemoveRentals removes "rentals" edges to Rental entities.

func (*CarUpdate) Save

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

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

func (*CarUpdate) SaveX

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

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

func (*CarUpdate) SetNillableNumber

func (cu *CarUpdate) SetNillableNumber(s *string) *CarUpdate

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CarUpdate) SetNumber

func (cu *CarUpdate) SetNumber(s string) *CarUpdate

SetNumber sets the "number" field.

func (*CarUpdate) Where

func (cu *CarUpdate) Where(ps ...predicate.Car) *CarUpdate

Where appends a list predicates to the CarUpdate builder.

type CarUpdateOne

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

CarUpdateOne is the builder for updating a single Car entity.

func (*CarUpdateOne) AddRentalIDs

func (cuo *CarUpdateOne) AddRentalIDs(ids ...int) *CarUpdateOne

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*CarUpdateOne) AddRentals

func (cuo *CarUpdateOne) AddRentals(r ...*Rental) *CarUpdateOne

AddRentals adds the "rentals" edges to the Rental entity.

func (*CarUpdateOne) ClearNumber

func (cuo *CarUpdateOne) ClearNumber() *CarUpdateOne

ClearNumber clears the value of the "number" field.

func (*CarUpdateOne) ClearRentals

func (cuo *CarUpdateOne) ClearRentals() *CarUpdateOne

ClearRentals clears all "rentals" edges to the Rental entity.

func (*CarUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CarUpdateOne) ExecX

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

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

func (*CarUpdateOne) Mutation

func (cuo *CarUpdateOne) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarUpdateOne) RemoveRentalIDs

func (cuo *CarUpdateOne) RemoveRentalIDs(ids ...int) *CarUpdateOne

RemoveRentalIDs removes the "rentals" edge to Rental entities by IDs.

func (*CarUpdateOne) RemoveRentals

func (cuo *CarUpdateOne) RemoveRentals(r ...*Rental) *CarUpdateOne

RemoveRentals removes "rentals" edges to Rental entities.

func (*CarUpdateOne) Save

func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error)

Save executes the query and returns the updated Car entity.

func (*CarUpdateOne) SaveX

func (cuo *CarUpdateOne) SaveX(ctx context.Context) *Car

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

func (*CarUpdateOne) Select

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

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

func (*CarUpdateOne) SetNillableNumber

func (cuo *CarUpdateOne) SetNillableNumber(s *string) *CarUpdateOne

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CarUpdateOne) SetNumber

func (cuo *CarUpdateOne) SetNumber(s string) *CarUpdateOne

SetNumber sets the "number" field.

type Card

type Card struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Number holds the value of the "number" field.
	Number string `json:"number,omitempty"`
	// OwnerID holds the value of the "owner_id" field.
	OwnerID int `json:"owner_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CardQuery when eager-loading is set.
	Edges CardEdges `json:"edges"`
	// contains filtered or unexported fields
}

Card is the model entity for the Card schema.

func (*Card) QueryOwner

func (c *Card) QueryOwner() *UserQuery

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

func (*Card) String

func (c *Card) String() string

String implements the fmt.Stringer.

func (*Card) Unwrap

func (c *Card) Unwrap() *Card

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

func (c *Card) Update() *CardUpdateOne

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

type CardClient

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

CardClient is a client for the Card schema.

func NewCardClient

func NewCardClient(c config) *CardClient

NewCardClient returns a client for the Card from the given config.

func (*CardClient) Create

func (c *CardClient) Create() *CardCreate

Create returns a create builder for Card.

func (*CardClient) CreateBulk

func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk

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

func (*CardClient) Delete

func (c *CardClient) Delete() *CardDelete

Delete returns a delete builder for Card.

func (*CardClient) DeleteOne

func (c *CardClient) DeleteOne(ca *Card) *CardDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CardClient) DeleteOneID

func (c *CardClient) DeleteOneID(id int) *CardDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CardClient) Get

func (c *CardClient) Get(ctx context.Context, id int) (*Card, error)

Get returns a Card entity by its id.

func (*CardClient) GetX

func (c *CardClient) GetX(ctx context.Context, id int) *Card

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

func (*CardClient) Hooks

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

Hooks returns the client hooks.

func (*CardClient) Query

func (c *CardClient) Query() *CardQuery

Query returns a query builder for Card.

func (*CardClient) QueryOwner

func (c *CardClient) QueryOwner(ca *Card) *UserQuery

QueryOwner queries the owner edge of a Card.

func (*CardClient) Update

func (c *CardClient) Update() *CardUpdate

Update returns an update builder for Card.

func (*CardClient) UpdateOne

func (c *CardClient) UpdateOne(ca *Card) *CardUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CardClient) UpdateOneID

func (c *CardClient) UpdateOneID(id int) *CardUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CardClient) Use

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

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

type CardCreate

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

CardCreate is the builder for creating a Card entity.

func (*CardCreate) Exec

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

Exec executes the query.

func (*CardCreate) ExecX

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

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

func (*CardCreate) Mutation

func (cc *CardCreate) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardCreate) Save

func (cc *CardCreate) Save(ctx context.Context) (*Card, error)

Save creates the Card in the database.

func (*CardCreate) SaveX

func (cc *CardCreate) SaveX(ctx context.Context) *Card

SaveX calls Save and panics if Save returns an error.

func (*CardCreate) SetNillableNumber

func (cc *CardCreate) SetNillableNumber(s *string) *CardCreate

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CardCreate) SetNillableOwnerID

func (cc *CardCreate) SetNillableOwnerID(i *int) *CardCreate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*CardCreate) SetNumber

func (cc *CardCreate) SetNumber(s string) *CardCreate

SetNumber sets the "number" field.

func (*CardCreate) SetOwner

func (cc *CardCreate) SetOwner(u *User) *CardCreate

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

func (*CardCreate) SetOwnerID

func (cc *CardCreate) SetOwnerID(i int) *CardCreate

SetOwnerID sets the "owner_id" field.

type CardCreateBulk

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

CardCreateBulk is the builder for creating many Card entities in bulk.

func (*CardCreateBulk) Exec

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

Exec executes the query.

func (*CardCreateBulk) ExecX

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

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

func (*CardCreateBulk) Save

func (ccb *CardCreateBulk) Save(ctx context.Context) ([]*Card, error)

Save creates the Card entities in the database.

func (*CardCreateBulk) SaveX

func (ccb *CardCreateBulk) SaveX(ctx context.Context) []*Card

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

type CardDelete

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

CardDelete is the builder for deleting a Card entity.

func (*CardDelete) Exec

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

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

func (*CardDelete) ExecX

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

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

func (*CardDelete) Where

func (cd *CardDelete) Where(ps ...predicate.Card) *CardDelete

Where appends a list predicates to the CardDelete builder.

type CardDeleteOne

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

CardDeleteOne is the builder for deleting a single Card entity.

func (*CardDeleteOne) Exec

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

Exec executes the deletion query.

func (*CardDeleteOne) ExecX

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

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

type CardEdges

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

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

func (CardEdges) OwnerOrErr

func (e CardEdges) 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 CardGroupBy

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

CardGroupBy is the group-by builder for Card entities.

func (*CardGroupBy) Aggregate

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

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

func (*CardGroupBy) Bool

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

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

func (*CardGroupBy) BoolX

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

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

func (*CardGroupBy) Bools

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

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

func (*CardGroupBy) BoolsX

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

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

func (*CardGroupBy) Float64

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

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

func (*CardGroupBy) Float64X

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

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

func (*CardGroupBy) Float64s

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

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

func (*CardGroupBy) Float64sX

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

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

func (*CardGroupBy) Int

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

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

func (*CardGroupBy) IntX

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

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

func (*CardGroupBy) Ints

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

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

func (*CardGroupBy) IntsX

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

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

func (*CardGroupBy) Scan

func (cgb *CardGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CardGroupBy) ScanX

func (s *CardGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CardGroupBy) String

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

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

func (*CardGroupBy) StringX

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

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

func (*CardGroupBy) Strings

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

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

func (*CardGroupBy) StringsX

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

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

type CardMutation

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

CardMutation represents an operation that mutates the Card nodes in the graph.

func (*CardMutation) AddField

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

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

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

func (*CardMutation) AddedField

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

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

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

func (*CardMutation) AddedIDs

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

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

func (*CardMutation) ClearEdge

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

func (m *CardMutation) 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 (*CardMutation) ClearNumber

func (m *CardMutation) ClearNumber()

ClearNumber clears the value of the "number" field.

func (*CardMutation) ClearOwner

func (m *CardMutation) ClearOwner()

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

func (*CardMutation) ClearOwnerID

func (m *CardMutation) ClearOwnerID()

ClearOwnerID clears the value of the "owner_id" field.

func (*CardMutation) ClearedEdges

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

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

func (*CardMutation) ClearedFields

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

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

func (CardMutation) Client

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

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

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

func (*CardMutation) Field

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

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

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

func (*CardMutation) Fields

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

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

func (m *CardMutation) 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 (*CardMutation) Number

func (m *CardMutation) Number() (r string, exists bool)

Number returns the value of the "number" field in the mutation.

func (*CardMutation) NumberCleared

func (m *CardMutation) NumberCleared() bool

NumberCleared returns if the "number" field was cleared in this mutation.

func (*CardMutation) OldField

func (m *CardMutation) 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 (*CardMutation) OldNumber

func (m *CardMutation) OldNumber(ctx context.Context) (v string, err error)

OldNumber returns the old "number" field's value of the Card entity. If the Card 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 (*CardMutation) OldOwnerID

func (m *CardMutation) OldOwnerID(ctx context.Context) (v int, err error)

OldOwnerID returns the old "owner_id" field's value of the Card entity. If the Card 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 (*CardMutation) Op

func (m *CardMutation) Op() Op

Op returns the operation name.

func (*CardMutation) OwnerCleared

func (m *CardMutation) OwnerCleared() bool

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

func (*CardMutation) OwnerID

func (m *CardMutation) OwnerID() (r int, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*CardMutation) OwnerIDCleared

func (m *CardMutation) OwnerIDCleared() bool

OwnerIDCleared returns if the "owner_id" field was cleared in this mutation.

func (*CardMutation) OwnerIDs

func (m *CardMutation) 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 (*CardMutation) RemovedEdges

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

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

func (*CardMutation) RemovedIDs

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

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

func (m *CardMutation) 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 (*CardMutation) ResetNumber

func (m *CardMutation) ResetNumber()

ResetNumber resets all changes to the "number" field.

func (*CardMutation) ResetOwner

func (m *CardMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*CardMutation) ResetOwnerID

func (m *CardMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" field.

func (*CardMutation) SetField

func (m *CardMutation) 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 (*CardMutation) SetNumber

func (m *CardMutation) SetNumber(s string)

SetNumber sets the "number" field.

func (*CardMutation) SetOwnerID

func (m *CardMutation) SetOwnerID(i int)

SetOwnerID sets the "owner_id" field.

func (CardMutation) Tx

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

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

func (*CardMutation) Type

func (m *CardMutation) Type() string

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

func (*CardMutation) Where

func (m *CardMutation) Where(ps ...predicate.Card)

Where appends a list predicates to the CardMutation builder.

type CardQuery

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

CardQuery is the builder for querying Card entities.

func (*CardQuery) All

func (cq *CardQuery) All(ctx context.Context) ([]*Card, error)

All executes the query and returns a list of Cards.

func (*CardQuery) AllX

func (cq *CardQuery) AllX(ctx context.Context) []*Card

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

func (*CardQuery) Clone

func (cq *CardQuery) Clone() *CardQuery

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

func (*CardQuery) Count

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

Count returns the count of the given query.

func (*CardQuery) CountX

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

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

func (*CardQuery) Exist

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

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

func (*CardQuery) ExistX

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

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

func (*CardQuery) First

func (cq *CardQuery) First(ctx context.Context) (*Card, error)

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

func (*CardQuery) FirstID

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

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

func (*CardQuery) FirstIDX

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

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

func (*CardQuery) FirstX

func (cq *CardQuery) FirstX(ctx context.Context) *Card

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

func (*CardQuery) GroupBy

func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy

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

client.Card.Query().
	GroupBy(card.FieldNumber).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CardQuery) IDs

func (cq *CardQuery) IDs(ctx context.Context) ([]int, error)

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

func (*CardQuery) IDsX

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

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

func (*CardQuery) Limit

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

Limit adds a limit step to the query.

func (*CardQuery) Offset

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

Offset adds an offset step to the query.

func (*CardQuery) Only

func (cq *CardQuery) Only(ctx context.Context) (*Card, error)

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

func (*CardQuery) OnlyID

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

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

func (*CardQuery) OnlyIDX

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

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

func (*CardQuery) OnlyX

func (cq *CardQuery) OnlyX(ctx context.Context) *Card

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

func (*CardQuery) Order

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

Order adds an order step to the query.

func (*CardQuery) QueryOwner

func (cq *CardQuery) QueryOwner() *UserQuery

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

func (*CardQuery) Select

func (cq *CardQuery) Select(fields ...string) *CardSelect

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 {
	Number string `json:"number,omitempty"`
}

client.Card.Query().
	Select(card.FieldNumber).
	Scan(ctx, &v)

func (*CardQuery) Unique

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

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

func (cq *CardQuery) Where(ps ...predicate.Card) *CardQuery

Where adds a new predicate for the CardQuery builder.

func (*CardQuery) WithOwner

func (cq *CardQuery) WithOwner(opts ...func(*UserQuery)) *CardQuery

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 CardSelect

type CardSelect struct {
	*CardQuery
	// contains filtered or unexported fields
}

CardSelect is the builder for selecting fields of Card entities.

func (*CardSelect) Bool

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

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

func (*CardSelect) BoolX

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

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

func (*CardSelect) Bools

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

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

func (*CardSelect) BoolsX

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

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

func (*CardSelect) Float64

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

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

func (*CardSelect) Float64X

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

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

func (*CardSelect) Float64s

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

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

func (*CardSelect) Float64sX

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

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

func (*CardSelect) Int

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

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

func (*CardSelect) IntX

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

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

func (*CardSelect) Ints

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

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

func (*CardSelect) IntsX

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

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

func (*CardSelect) Scan

func (cs *CardSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CardSelect) ScanX

func (s *CardSelect) ScanX(ctx context.Context, v interface{})

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

func (*CardSelect) String

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

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

func (*CardSelect) StringX

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

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

func (*CardSelect) Strings

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

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

func (*CardSelect) StringsX

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

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

type CardUpdate

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

CardUpdate is the builder for updating Card entities.

func (*CardUpdate) ClearNumber

func (cu *CardUpdate) ClearNumber() *CardUpdate

ClearNumber clears the value of the "number" field.

func (*CardUpdate) ClearOwner

func (cu *CardUpdate) ClearOwner() *CardUpdate

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

func (*CardUpdate) ClearOwnerID

func (cu *CardUpdate) ClearOwnerID() *CardUpdate

ClearOwnerID clears the value of the "owner_id" field.

func (*CardUpdate) Exec

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

Exec executes the query.

func (*CardUpdate) ExecX

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

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

func (*CardUpdate) Mutation

func (cu *CardUpdate) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardUpdate) Save

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

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

func (*CardUpdate) SaveX

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

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

func (*CardUpdate) SetNillableNumber

func (cu *CardUpdate) SetNillableNumber(s *string) *CardUpdate

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CardUpdate) SetNillableOwnerID

func (cu *CardUpdate) SetNillableOwnerID(i *int) *CardUpdate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*CardUpdate) SetNumber

func (cu *CardUpdate) SetNumber(s string) *CardUpdate

SetNumber sets the "number" field.

func (*CardUpdate) SetOwner

func (cu *CardUpdate) SetOwner(u *User) *CardUpdate

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

func (*CardUpdate) SetOwnerID

func (cu *CardUpdate) SetOwnerID(i int) *CardUpdate

SetOwnerID sets the "owner_id" field.

func (*CardUpdate) Where

func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate

Where appends a list predicates to the CardUpdate builder.

type CardUpdateOne

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

CardUpdateOne is the builder for updating a single Card entity.

func (*CardUpdateOne) ClearNumber

func (cuo *CardUpdateOne) ClearNumber() *CardUpdateOne

ClearNumber clears the value of the "number" field.

func (*CardUpdateOne) ClearOwner

func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne

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

func (*CardUpdateOne) ClearOwnerID

func (cuo *CardUpdateOne) ClearOwnerID() *CardUpdateOne

ClearOwnerID clears the value of the "owner_id" field.

func (*CardUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CardUpdateOne) ExecX

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

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

func (*CardUpdateOne) Mutation

func (cuo *CardUpdateOne) Mutation() *CardMutation

Mutation returns the CardMutation object of the builder.

func (*CardUpdateOne) Save

func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error)

Save executes the query and returns the updated Card entity.

func (*CardUpdateOne) SaveX

func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card

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

func (*CardUpdateOne) Select

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

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

func (*CardUpdateOne) SetNillableNumber

func (cuo *CardUpdateOne) SetNillableNumber(s *string) *CardUpdateOne

SetNillableNumber sets the "number" field if the given value is not nil.

func (*CardUpdateOne) SetNillableOwnerID

func (cuo *CardUpdateOne) SetNillableOwnerID(i *int) *CardUpdateOne

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*CardUpdateOne) SetNumber

func (cuo *CardUpdateOne) SetNumber(s string) *CardUpdateOne

SetNumber sets the "number" field.

func (*CardUpdateOne) SetOwner

func (cuo *CardUpdateOne) SetOwner(u *User) *CardUpdateOne

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

func (*CardUpdateOne) SetOwnerID

func (cuo *CardUpdateOne) SetOwnerID(i int) *CardUpdateOne

SetOwnerID sets the "owner_id" field.

type Cards

type Cards []*Card

Cards is a parsable slice of Card.

type Cars

type Cars []*Car

Cars is a parsable slice of Car.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Car is the client for interacting with the Car builders.
	Car *CarClient
	// Card is the client for interacting with the Card builders.
	Card *CardClient
	// Info is the client for interacting with the Info builders.
	Info *InfoClient
	// Metadata is the client for interacting with the Metadata builders.
	Metadata *MetadataClient
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Rental is the client for interacting with the Rental builders.
	Rental *RentalClient
	// 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().
	Car.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(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 Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type Info

type Info struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Content holds the value of the "content" field.
	Content json.RawMessage `json:"content,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the InfoQuery when eager-loading is set.
	Edges InfoEdges `json:"edges"`
	// contains filtered or unexported fields
}

Info is the model entity for the Info schema.

func (*Info) QueryUser

func (i *Info) QueryUser() *UserQuery

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

func (*Info) String

func (i *Info) String() string

String implements the fmt.Stringer.

func (*Info) Unwrap

func (i *Info) Unwrap() *Info

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

func (i *Info) Update() *InfoUpdateOne

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

type InfoClient

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

InfoClient is a client for the Info schema.

func NewInfoClient

func NewInfoClient(c config) *InfoClient

NewInfoClient returns a client for the Info from the given config.

func (*InfoClient) Create

func (c *InfoClient) Create() *InfoCreate

Create returns a create builder for Info.

func (*InfoClient) CreateBulk

func (c *InfoClient) CreateBulk(builders ...*InfoCreate) *InfoCreateBulk

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

func (*InfoClient) Delete

func (c *InfoClient) Delete() *InfoDelete

Delete returns a delete builder for Info.

func (*InfoClient) DeleteOne

func (c *InfoClient) DeleteOne(i *Info) *InfoDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*InfoClient) DeleteOneID

func (c *InfoClient) DeleteOneID(id int) *InfoDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*InfoClient) Get

func (c *InfoClient) Get(ctx context.Context, id int) (*Info, error)

Get returns a Info entity by its id.

func (*InfoClient) GetX

func (c *InfoClient) GetX(ctx context.Context, id int) *Info

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

func (*InfoClient) Hooks

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

Hooks returns the client hooks.

func (*InfoClient) Query

func (c *InfoClient) Query() *InfoQuery

Query returns a query builder for Info.

func (*InfoClient) QueryUser

func (c *InfoClient) QueryUser(i *Info) *UserQuery

QueryUser queries the user edge of a Info.

func (*InfoClient) Update

func (c *InfoClient) Update() *InfoUpdate

Update returns an update builder for Info.

func (*InfoClient) UpdateOne

func (c *InfoClient) UpdateOne(i *Info) *InfoUpdateOne

UpdateOne returns an update builder for the given entity.

func (*InfoClient) UpdateOneID

func (c *InfoClient) UpdateOneID(id int) *InfoUpdateOne

UpdateOneID returns an update builder for the given id.

func (*InfoClient) Use

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

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

type InfoCreate

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

InfoCreate is the builder for creating a Info entity.

func (*InfoCreate) Exec

func (ic *InfoCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*InfoCreate) ExecX

func (ic *InfoCreate) ExecX(ctx context.Context)

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

func (*InfoCreate) Mutation

func (ic *InfoCreate) Mutation() *InfoMutation

Mutation returns the InfoMutation object of the builder.

func (*InfoCreate) Save

func (ic *InfoCreate) Save(ctx context.Context) (*Info, error)

Save creates the Info in the database.

func (*InfoCreate) SaveX

func (ic *InfoCreate) SaveX(ctx context.Context) *Info

SaveX calls Save and panics if Save returns an error.

func (*InfoCreate) SetContent

func (ic *InfoCreate) SetContent(jm json.RawMessage) *InfoCreate

SetContent sets the "content" field.

func (*InfoCreate) SetID

func (ic *InfoCreate) SetID(i int) *InfoCreate

SetID sets the "id" field.

func (*InfoCreate) SetNillableUserID

func (ic *InfoCreate) SetNillableUserID(id *int) *InfoCreate

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

func (*InfoCreate) SetUser

func (ic *InfoCreate) SetUser(u *User) *InfoCreate

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

func (*InfoCreate) SetUserID

func (ic *InfoCreate) SetUserID(id int) *InfoCreate

SetUserID sets the "user" edge to the User entity by ID.

type InfoCreateBulk

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

InfoCreateBulk is the builder for creating many Info entities in bulk.

func (*InfoCreateBulk) Exec

func (icb *InfoCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*InfoCreateBulk) ExecX

func (icb *InfoCreateBulk) ExecX(ctx context.Context)

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

func (*InfoCreateBulk) Save

func (icb *InfoCreateBulk) Save(ctx context.Context) ([]*Info, error)

Save creates the Info entities in the database.

func (*InfoCreateBulk) SaveX

func (icb *InfoCreateBulk) SaveX(ctx context.Context) []*Info

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

type InfoDelete

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

InfoDelete is the builder for deleting a Info entity.

func (*InfoDelete) Exec

func (id *InfoDelete) Exec(ctx context.Context) (int, error)

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

func (*InfoDelete) ExecX

func (id *InfoDelete) ExecX(ctx context.Context) int

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

func (*InfoDelete) Where

func (id *InfoDelete) Where(ps ...predicate.Info) *InfoDelete

Where appends a list predicates to the InfoDelete builder.

type InfoDeleteOne

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

InfoDeleteOne is the builder for deleting a single Info entity.

func (*InfoDeleteOne) Exec

func (ido *InfoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*InfoDeleteOne) ExecX

func (ido *InfoDeleteOne) ExecX(ctx context.Context)

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

type InfoEdges

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

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

func (InfoEdges) UserOrErr

func (e InfoEdges) 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 InfoGroupBy

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

InfoGroupBy is the group-by builder for Info entities.

func (*InfoGroupBy) Aggregate

func (igb *InfoGroupBy) Aggregate(fns ...AggregateFunc) *InfoGroupBy

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

func (*InfoGroupBy) Bool

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

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

func (*InfoGroupBy) BoolX

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

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

func (*InfoGroupBy) Bools

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

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

func (*InfoGroupBy) BoolsX

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

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

func (*InfoGroupBy) Float64

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

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

func (*InfoGroupBy) Float64X

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

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

func (*InfoGroupBy) Float64s

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

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

func (*InfoGroupBy) Float64sX

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

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

func (*InfoGroupBy) Int

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

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

func (*InfoGroupBy) IntX

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

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

func (*InfoGroupBy) Ints

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

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

func (*InfoGroupBy) IntsX

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

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

func (*InfoGroupBy) Scan

func (igb *InfoGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*InfoGroupBy) ScanX

func (s *InfoGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*InfoGroupBy) String

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

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

func (*InfoGroupBy) StringX

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

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

func (*InfoGroupBy) Strings

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

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

func (*InfoGroupBy) StringsX

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

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

type InfoMutation

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

InfoMutation represents an operation that mutates the Info nodes in the graph.

func (*InfoMutation) AddField

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

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

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

func (*InfoMutation) AddedField

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

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

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

func (*InfoMutation) AddedIDs

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

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

func (*InfoMutation) ClearEdge

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

func (m *InfoMutation) 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 (*InfoMutation) ClearUser

func (m *InfoMutation) ClearUser()

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

func (*InfoMutation) ClearedEdges

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

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

func (*InfoMutation) ClearedFields

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

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

func (InfoMutation) Client

func (m InfoMutation) 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 (*InfoMutation) Content

func (m *InfoMutation) Content() (r json.RawMessage, exists bool)

Content returns the value of the "content" field in the mutation.

func (*InfoMutation) EdgeCleared

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

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

func (*InfoMutation) Field

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

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

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

func (*InfoMutation) Fields

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

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

func (m *InfoMutation) 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 (*InfoMutation) OldContent

func (m *InfoMutation) OldContent(ctx context.Context) (v json.RawMessage, err error)

OldContent returns the old "content" field's value of the Info entity. If the Info 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 (*InfoMutation) OldField

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

func (m *InfoMutation) Op() Op

Op returns the operation name.

func (*InfoMutation) RemovedEdges

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

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

func (*InfoMutation) RemovedIDs

func (m *InfoMutation) 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 (*InfoMutation) ResetContent

func (m *InfoMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*InfoMutation) ResetEdge

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

func (m *InfoMutation) 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 (*InfoMutation) ResetUser

func (m *InfoMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*InfoMutation) SetContent

func (m *InfoMutation) SetContent(jm json.RawMessage)

SetContent sets the "content" field.

func (*InfoMutation) SetField

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

func (m *InfoMutation) SetID(id int)

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

func (*InfoMutation) SetUserID

func (m *InfoMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (InfoMutation) Tx

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

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

func (*InfoMutation) Type

func (m *InfoMutation) Type() string

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

func (*InfoMutation) UserCleared

func (m *InfoMutation) UserCleared() bool

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

func (*InfoMutation) UserID

func (m *InfoMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*InfoMutation) UserIDs

func (m *InfoMutation) 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 (*InfoMutation) Where

func (m *InfoMutation) Where(ps ...predicate.Info)

Where appends a list predicates to the InfoMutation builder.

type InfoQuery

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

InfoQuery is the builder for querying Info entities.

func (*InfoQuery) All

func (iq *InfoQuery) All(ctx context.Context) ([]*Info, error)

All executes the query and returns a list of Infos.

func (*InfoQuery) AllX

func (iq *InfoQuery) AllX(ctx context.Context) []*Info

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

func (*InfoQuery) Clone

func (iq *InfoQuery) Clone() *InfoQuery

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

func (*InfoQuery) Count

func (iq *InfoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*InfoQuery) CountX

func (iq *InfoQuery) CountX(ctx context.Context) int

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

func (*InfoQuery) Exist

func (iq *InfoQuery) Exist(ctx context.Context) (bool, error)

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

func (*InfoQuery) ExistX

func (iq *InfoQuery) ExistX(ctx context.Context) bool

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

func (*InfoQuery) First

func (iq *InfoQuery) First(ctx context.Context) (*Info, error)

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

func (*InfoQuery) FirstID

func (iq *InfoQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*InfoQuery) FirstIDX

func (iq *InfoQuery) FirstIDX(ctx context.Context) int

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

func (*InfoQuery) FirstX

func (iq *InfoQuery) FirstX(ctx context.Context) *Info

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

func (*InfoQuery) GroupBy

func (iq *InfoQuery) GroupBy(field string, fields ...string) *InfoGroupBy

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 {
	Content json.RawMessage `json:"content,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Info.Query().
	GroupBy(info.FieldContent).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*InfoQuery) IDs

func (iq *InfoQuery) IDs(ctx context.Context) ([]int, error)

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

func (*InfoQuery) IDsX

func (iq *InfoQuery) IDsX(ctx context.Context) []int

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

func (*InfoQuery) Limit

func (iq *InfoQuery) Limit(limit int) *InfoQuery

Limit adds a limit step to the query.

func (*InfoQuery) Offset

func (iq *InfoQuery) Offset(offset int) *InfoQuery

Offset adds an offset step to the query.

func (*InfoQuery) Only

func (iq *InfoQuery) Only(ctx context.Context) (*Info, error)

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

func (*InfoQuery) OnlyID

func (iq *InfoQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*InfoQuery) OnlyIDX

func (iq *InfoQuery) OnlyIDX(ctx context.Context) int

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

func (*InfoQuery) OnlyX

func (iq *InfoQuery) OnlyX(ctx context.Context) *Info

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

func (*InfoQuery) Order

func (iq *InfoQuery) Order(o ...OrderFunc) *InfoQuery

Order adds an order step to the query.

func (*InfoQuery) QueryUser

func (iq *InfoQuery) QueryUser() *UserQuery

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

func (*InfoQuery) Select

func (iq *InfoQuery) Select(fields ...string) *InfoSelect

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 {
	Content json.RawMessage `json:"content,omitempty"`
}

client.Info.Query().
	Select(info.FieldContent).
	Scan(ctx, &v)

func (*InfoQuery) Unique

func (iq *InfoQuery) Unique(unique bool) *InfoQuery

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

func (iq *InfoQuery) Where(ps ...predicate.Info) *InfoQuery

Where adds a new predicate for the InfoQuery builder.

func (*InfoQuery) WithUser

func (iq *InfoQuery) WithUser(opts ...func(*UserQuery)) *InfoQuery

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 InfoSelect

type InfoSelect struct {
	*InfoQuery
	// contains filtered or unexported fields
}

InfoSelect is the builder for selecting fields of Info entities.

func (*InfoSelect) Bool

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

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

func (*InfoSelect) BoolX

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

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

func (*InfoSelect) Bools

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

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

func (*InfoSelect) BoolsX

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

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

func (*InfoSelect) Float64

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

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

func (*InfoSelect) Float64X

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

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

func (*InfoSelect) Float64s

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

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

func (*InfoSelect) Float64sX

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

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

func (*InfoSelect) Int

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

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

func (*InfoSelect) IntX

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

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

func (*InfoSelect) Ints

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

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

func (*InfoSelect) IntsX

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

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

func (*InfoSelect) Scan

func (is *InfoSelect) Scan(ctx context.Context, v interface{}) error

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

func (*InfoSelect) ScanX

func (s *InfoSelect) ScanX(ctx context.Context, v interface{})

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

func (*InfoSelect) String

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

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

func (*InfoSelect) StringX

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

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

func (*InfoSelect) Strings

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

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

func (*InfoSelect) StringsX

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

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

type InfoUpdate

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

InfoUpdate is the builder for updating Info entities.

func (*InfoUpdate) ClearUser

func (iu *InfoUpdate) ClearUser() *InfoUpdate

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

func (*InfoUpdate) Exec

func (iu *InfoUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*InfoUpdate) ExecX

func (iu *InfoUpdate) ExecX(ctx context.Context)

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

func (*InfoUpdate) Mutation

func (iu *InfoUpdate) Mutation() *InfoMutation

Mutation returns the InfoMutation object of the builder.

func (*InfoUpdate) Save

func (iu *InfoUpdate) Save(ctx context.Context) (int, error)

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

func (*InfoUpdate) SaveX

func (iu *InfoUpdate) SaveX(ctx context.Context) int

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

func (*InfoUpdate) SetContent

func (iu *InfoUpdate) SetContent(jm json.RawMessage) *InfoUpdate

SetContent sets the "content" field.

func (*InfoUpdate) SetNillableUserID

func (iu *InfoUpdate) SetNillableUserID(id *int) *InfoUpdate

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

func (*InfoUpdate) SetUser

func (iu *InfoUpdate) SetUser(u *User) *InfoUpdate

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

func (*InfoUpdate) SetUserID

func (iu *InfoUpdate) SetUserID(id int) *InfoUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*InfoUpdate) Where

func (iu *InfoUpdate) Where(ps ...predicate.Info) *InfoUpdate

Where appends a list predicates to the InfoUpdate builder.

type InfoUpdateOne

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

InfoUpdateOne is the builder for updating a single Info entity.

func (*InfoUpdateOne) ClearUser

func (iuo *InfoUpdateOne) ClearUser() *InfoUpdateOne

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

func (*InfoUpdateOne) Exec

func (iuo *InfoUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*InfoUpdateOne) ExecX

func (iuo *InfoUpdateOne) ExecX(ctx context.Context)

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

func (*InfoUpdateOne) Mutation

func (iuo *InfoUpdateOne) Mutation() *InfoMutation

Mutation returns the InfoMutation object of the builder.

func (*InfoUpdateOne) Save

func (iuo *InfoUpdateOne) Save(ctx context.Context) (*Info, error)

Save executes the query and returns the updated Info entity.

func (*InfoUpdateOne) SaveX

func (iuo *InfoUpdateOne) SaveX(ctx context.Context) *Info

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

func (*InfoUpdateOne) Select

func (iuo *InfoUpdateOne) Select(field string, fields ...string) *InfoUpdateOne

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

func (*InfoUpdateOne) SetContent

func (iuo *InfoUpdateOne) SetContent(jm json.RawMessage) *InfoUpdateOne

SetContent sets the "content" field.

func (*InfoUpdateOne) SetNillableUserID

func (iuo *InfoUpdateOne) SetNillableUserID(id *int) *InfoUpdateOne

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

func (*InfoUpdateOne) SetUser

func (iuo *InfoUpdateOne) SetUser(u *User) *InfoUpdateOne

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

func (*InfoUpdateOne) SetUserID

func (iuo *InfoUpdateOne) SetUserID(id int) *InfoUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

type Infos

type Infos []*Info

Infos is a parsable slice of Info.

type Metadata

type Metadata struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Age holds the value of the "age" field.
	Age int `json:"age,omitempty"`
	// ParentID holds the value of the "parent_id" field.
	ParentID int `json:"parent_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MetadataQuery when eager-loading is set.
	Edges MetadataEdges `json:"edges"`
	// contains filtered or unexported fields
}

Metadata is the model entity for the Metadata schema.

func (*Metadata) QueryChildren

func (m *Metadata) QueryChildren() *MetadataQuery

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

func (*Metadata) QueryParent

func (m *Metadata) QueryParent() *MetadataQuery

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

func (*Metadata) QueryUser

func (m *Metadata) QueryUser() *UserQuery

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

func (*Metadata) String

func (m *Metadata) String() string

String implements the fmt.Stringer.

func (*Metadata) Unwrap

func (m *Metadata) Unwrap() *Metadata

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

func (m *Metadata) Update() *MetadataUpdateOne

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

type MetadataClient

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

MetadataClient is a client for the Metadata schema.

func NewMetadataClient

func NewMetadataClient(c config) *MetadataClient

NewMetadataClient returns a client for the Metadata from the given config.

func (*MetadataClient) Create

func (c *MetadataClient) Create() *MetadataCreate

Create returns a create builder for Metadata.

func (*MetadataClient) CreateBulk

func (c *MetadataClient) CreateBulk(builders ...*MetadataCreate) *MetadataCreateBulk

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

func (*MetadataClient) Delete

func (c *MetadataClient) Delete() *MetadataDelete

Delete returns a delete builder for Metadata.

func (*MetadataClient) DeleteOne

func (c *MetadataClient) DeleteOne(m *Metadata) *MetadataDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MetadataClient) DeleteOneID

func (c *MetadataClient) DeleteOneID(id int) *MetadataDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*MetadataClient) Get

func (c *MetadataClient) Get(ctx context.Context, id int) (*Metadata, error)

Get returns a Metadata entity by its id.

func (*MetadataClient) GetX

func (c *MetadataClient) GetX(ctx context.Context, id int) *Metadata

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

func (*MetadataClient) Hooks

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

Hooks returns the client hooks.

func (*MetadataClient) Query

func (c *MetadataClient) Query() *MetadataQuery

Query returns a query builder for Metadata.

func (*MetadataClient) QueryChildren

func (c *MetadataClient) QueryChildren(m *Metadata) *MetadataQuery

QueryChildren queries the children edge of a Metadata.

func (*MetadataClient) QueryParent

func (c *MetadataClient) QueryParent(m *Metadata) *MetadataQuery

QueryParent queries the parent edge of a Metadata.

func (*MetadataClient) QueryUser

func (c *MetadataClient) QueryUser(m *Metadata) *UserQuery

QueryUser queries the user edge of a Metadata.

func (*MetadataClient) Update

func (c *MetadataClient) Update() *MetadataUpdate

Update returns an update builder for Metadata.

func (*MetadataClient) UpdateOne

func (c *MetadataClient) UpdateOne(m *Metadata) *MetadataUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MetadataClient) UpdateOneID

func (c *MetadataClient) UpdateOneID(id int) *MetadataUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MetadataClient) Use

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

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

type MetadataCreate

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

MetadataCreate is the builder for creating a Metadata entity.

func (*MetadataCreate) AddChildIDs

func (mc *MetadataCreate) AddChildIDs(ids ...int) *MetadataCreate

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

func (*MetadataCreate) AddChildren

func (mc *MetadataCreate) AddChildren(m ...*Metadata) *MetadataCreate

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

func (*MetadataCreate) Exec

func (mc *MetadataCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreate) ExecX

func (mc *MetadataCreate) ExecX(ctx context.Context)

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

func (*MetadataCreate) Mutation

func (mc *MetadataCreate) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataCreate) Save

func (mc *MetadataCreate) Save(ctx context.Context) (*Metadata, error)

Save creates the Metadata in the database.

func (*MetadataCreate) SaveX

func (mc *MetadataCreate) SaveX(ctx context.Context) *Metadata

SaveX calls Save and panics if Save returns an error.

func (*MetadataCreate) SetAge

func (mc *MetadataCreate) SetAge(i int) *MetadataCreate

SetAge sets the "age" field.

func (*MetadataCreate) SetID

func (mc *MetadataCreate) SetID(i int) *MetadataCreate

SetID sets the "id" field.

func (*MetadataCreate) SetNillableAge

func (mc *MetadataCreate) SetNillableAge(i *int) *MetadataCreate

SetNillableAge sets the "age" field if the given value is not nil.

func (*MetadataCreate) SetNillableParentID

func (mc *MetadataCreate) SetNillableParentID(i *int) *MetadataCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*MetadataCreate) SetNillableUserID

func (mc *MetadataCreate) SetNillableUserID(id *int) *MetadataCreate

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

func (*MetadataCreate) SetParent

func (mc *MetadataCreate) SetParent(m *Metadata) *MetadataCreate

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

func (*MetadataCreate) SetParentID

func (mc *MetadataCreate) SetParentID(i int) *MetadataCreate

SetParentID sets the "parent_id" field.

func (*MetadataCreate) SetUser

func (mc *MetadataCreate) SetUser(u *User) *MetadataCreate

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

func (*MetadataCreate) SetUserID

func (mc *MetadataCreate) SetUserID(id int) *MetadataCreate

SetUserID sets the "user" edge to the User entity by ID.

type MetadataCreateBulk

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

MetadataCreateBulk is the builder for creating many Metadata entities in bulk.

func (*MetadataCreateBulk) Exec

func (mcb *MetadataCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreateBulk) ExecX

func (mcb *MetadataCreateBulk) ExecX(ctx context.Context)

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

func (*MetadataCreateBulk) Save

func (mcb *MetadataCreateBulk) Save(ctx context.Context) ([]*Metadata, error)

Save creates the Metadata entities in the database.

func (*MetadataCreateBulk) SaveX

func (mcb *MetadataCreateBulk) SaveX(ctx context.Context) []*Metadata

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

type MetadataDelete

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

MetadataDelete is the builder for deleting a Metadata entity.

func (*MetadataDelete) Exec

func (md *MetadataDelete) Exec(ctx context.Context) (int, error)

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

func (*MetadataDelete) ExecX

func (md *MetadataDelete) ExecX(ctx context.Context) int

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

func (*MetadataDelete) Where

func (md *MetadataDelete) Where(ps ...predicate.Metadata) *MetadataDelete

Where appends a list predicates to the MetadataDelete builder.

type MetadataDeleteOne

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

MetadataDeleteOne is the builder for deleting a single Metadata entity.

func (*MetadataDeleteOne) Exec

func (mdo *MetadataDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MetadataDeleteOne) ExecX

func (mdo *MetadataDeleteOne) ExecX(ctx context.Context)

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

type MetadataEdges

type MetadataEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Children holds the value of the children edge.
	Children []*Metadata `json:"children,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Metadata `json:"parent,omitempty"`
	// contains filtered or unexported fields
}

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

func (MetadataEdges) ChildrenOrErr

func (e MetadataEdges) ChildrenOrErr() ([]*Metadata, error)

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

func (MetadataEdges) ParentOrErr

func (e MetadataEdges) ParentOrErr() (*Metadata, error)

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

func (MetadataEdges) UserOrErr

func (e MetadataEdges) 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 MetadataGroupBy

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

MetadataGroupBy is the group-by builder for Metadata entities.

func (*MetadataGroupBy) Aggregate

func (mgb *MetadataGroupBy) Aggregate(fns ...AggregateFunc) *MetadataGroupBy

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

func (*MetadataGroupBy) Bool

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

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

func (*MetadataGroupBy) BoolX

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

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

func (*MetadataGroupBy) Bools

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

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

func (*MetadataGroupBy) BoolsX

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

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

func (*MetadataGroupBy) Float64

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

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

func (*MetadataGroupBy) Float64X

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

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

func (*MetadataGroupBy) Float64s

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

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

func (*MetadataGroupBy) Float64sX

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

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

func (*MetadataGroupBy) Int

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

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

func (*MetadataGroupBy) IntX

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

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

func (*MetadataGroupBy) Ints

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

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

func (*MetadataGroupBy) IntsX

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

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

func (*MetadataGroupBy) Scan

func (mgb *MetadataGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*MetadataGroupBy) ScanX

func (s *MetadataGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MetadataGroupBy) String

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

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

func (*MetadataGroupBy) StringX

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

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

func (*MetadataGroupBy) Strings

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

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

func (*MetadataGroupBy) StringsX

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

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

type MetadataMutation

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

MetadataMutation represents an operation that mutates the Metadata nodes in the graph.

func (*MetadataMutation) AddAge

func (m *MetadataMutation) AddAge(i int)

AddAge adds i to the "age" field.

func (*MetadataMutation) AddChildIDs

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

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

func (*MetadataMutation) AddField

func (m *MetadataMutation) 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 (*MetadataMutation) AddedAge

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

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

func (*MetadataMutation) AddedEdges

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

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

func (*MetadataMutation) AddedField

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

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

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

func (*MetadataMutation) AddedIDs

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

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

func (*MetadataMutation) Age

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

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

func (*MetadataMutation) ChildrenCleared

func (m *MetadataMutation) ChildrenCleared() bool

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

func (*MetadataMutation) ChildrenIDs

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

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

func (*MetadataMutation) ClearChildren

func (m *MetadataMutation) ClearChildren()

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

func (*MetadataMutation) ClearEdge

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

func (m *MetadataMutation) 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 (*MetadataMutation) ClearParent

func (m *MetadataMutation) ClearParent()

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

func (*MetadataMutation) ClearParentID

func (m *MetadataMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*MetadataMutation) ClearUser

func (m *MetadataMutation) ClearUser()

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

func (*MetadataMutation) ClearedEdges

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

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

func (*MetadataMutation) ClearedFields

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

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

func (MetadataMutation) Client

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

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

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

func (*MetadataMutation) Field

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

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

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

func (*MetadataMutation) Fields

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

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

func (m *MetadataMutation) 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 (*MetadataMutation) OldAge

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

OldAge returns the old "age" field's value of the Metadata entity. If the Metadata 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 (*MetadataMutation) OldField

func (m *MetadataMutation) 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 (*MetadataMutation) OldParentID

func (m *MetadataMutation) OldParentID(ctx context.Context) (v int, err error)

OldParentID returns the old "parent_id" field's value of the Metadata entity. If the Metadata 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 (*MetadataMutation) Op

func (m *MetadataMutation) Op() Op

Op returns the operation name.

func (*MetadataMutation) ParentCleared

func (m *MetadataMutation) ParentCleared() bool

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

func (*MetadataMutation) ParentID

func (m *MetadataMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*MetadataMutation) ParentIDCleared

func (m *MetadataMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*MetadataMutation) ParentIDs

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

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

func (*MetadataMutation) RemoveChildIDs

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

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

func (*MetadataMutation) RemovedChildrenIDs

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

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

func (*MetadataMutation) RemovedEdges

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

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

func (*MetadataMutation) RemovedIDs

func (m *MetadataMutation) 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 (*MetadataMutation) ResetAge

func (m *MetadataMutation) ResetAge()

ResetAge resets all changes to the "age" field.

func (*MetadataMutation) ResetChildren

func (m *MetadataMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*MetadataMutation) ResetEdge

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

func (m *MetadataMutation) 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 (*MetadataMutation) ResetParent

func (m *MetadataMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*MetadataMutation) ResetParentID

func (m *MetadataMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*MetadataMutation) ResetUser

func (m *MetadataMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*MetadataMutation) SetAge

func (m *MetadataMutation) SetAge(i int)

SetAge sets the "age" field.

func (*MetadataMutation) SetField

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

func (m *MetadataMutation) SetID(id int)

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

func (*MetadataMutation) SetParentID

func (m *MetadataMutation) SetParentID(i int)

SetParentID sets the "parent_id" field.

func (*MetadataMutation) SetUserID

func (m *MetadataMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (MetadataMutation) Tx

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

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

func (*MetadataMutation) Type

func (m *MetadataMutation) Type() string

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

func (*MetadataMutation) UserCleared

func (m *MetadataMutation) UserCleared() bool

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

func (*MetadataMutation) UserID

func (m *MetadataMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*MetadataMutation) UserIDs

func (m *MetadataMutation) 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 (*MetadataMutation) Where

func (m *MetadataMutation) Where(ps ...predicate.Metadata)

Where appends a list predicates to the MetadataMutation builder.

type MetadataQuery

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

MetadataQuery is the builder for querying Metadata entities.

func (*MetadataQuery) All

func (mq *MetadataQuery) All(ctx context.Context) ([]*Metadata, error)

All executes the query and returns a list of MetadataSlice.

func (*MetadataQuery) AllX

func (mq *MetadataQuery) AllX(ctx context.Context) []*Metadata

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

func (*MetadataQuery) Clone

func (mq *MetadataQuery) Clone() *MetadataQuery

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

func (*MetadataQuery) Count

func (mq *MetadataQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MetadataQuery) CountX

func (mq *MetadataQuery) CountX(ctx context.Context) int

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

func (*MetadataQuery) Exist

func (mq *MetadataQuery) Exist(ctx context.Context) (bool, error)

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

func (*MetadataQuery) ExistX

func (mq *MetadataQuery) ExistX(ctx context.Context) bool

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

func (*MetadataQuery) First

func (mq *MetadataQuery) First(ctx context.Context) (*Metadata, error)

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

func (*MetadataQuery) FirstID

func (mq *MetadataQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MetadataQuery) FirstIDX

func (mq *MetadataQuery) FirstIDX(ctx context.Context) int

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

func (*MetadataQuery) FirstX

func (mq *MetadataQuery) FirstX(ctx context.Context) *Metadata

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

func (*MetadataQuery) GroupBy

func (mq *MetadataQuery) GroupBy(field string, fields ...string) *MetadataGroupBy

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

client.Metadata.Query().
	GroupBy(metadata.FieldAge).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MetadataQuery) IDs

func (mq *MetadataQuery) IDs(ctx context.Context) ([]int, error)

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

func (*MetadataQuery) IDsX

func (mq *MetadataQuery) IDsX(ctx context.Context) []int

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

func (*MetadataQuery) Limit

func (mq *MetadataQuery) Limit(limit int) *MetadataQuery

Limit adds a limit step to the query.

func (*MetadataQuery) Offset

func (mq *MetadataQuery) Offset(offset int) *MetadataQuery

Offset adds an offset step to the query.

func (*MetadataQuery) Only

func (mq *MetadataQuery) Only(ctx context.Context) (*Metadata, error)

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

func (*MetadataQuery) OnlyID

func (mq *MetadataQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MetadataQuery) OnlyIDX

func (mq *MetadataQuery) OnlyIDX(ctx context.Context) int

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

func (*MetadataQuery) OnlyX

func (mq *MetadataQuery) OnlyX(ctx context.Context) *Metadata

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

func (*MetadataQuery) Order

func (mq *MetadataQuery) Order(o ...OrderFunc) *MetadataQuery

Order adds an order step to the query.

func (*MetadataQuery) QueryChildren

func (mq *MetadataQuery) QueryChildren() *MetadataQuery

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

func (*MetadataQuery) QueryParent

func (mq *MetadataQuery) QueryParent() *MetadataQuery

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

func (*MetadataQuery) QueryUser

func (mq *MetadataQuery) QueryUser() *UserQuery

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

func (*MetadataQuery) Select

func (mq *MetadataQuery) Select(fields ...string) *MetadataSelect

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

client.Metadata.Query().
	Select(metadata.FieldAge).
	Scan(ctx, &v)

func (*MetadataQuery) Unique

func (mq *MetadataQuery) Unique(unique bool) *MetadataQuery

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

func (mq *MetadataQuery) Where(ps ...predicate.Metadata) *MetadataQuery

Where adds a new predicate for the MetadataQuery builder.

func (*MetadataQuery) WithChildren

func (mq *MetadataQuery) WithChildren(opts ...func(*MetadataQuery)) *MetadataQuery

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

func (*MetadataQuery) WithParent

func (mq *MetadataQuery) WithParent(opts ...func(*MetadataQuery)) *MetadataQuery

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

func (*MetadataQuery) WithUser

func (mq *MetadataQuery) WithUser(opts ...func(*UserQuery)) *MetadataQuery

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 MetadataSelect

type MetadataSelect struct {
	*MetadataQuery
	// contains filtered or unexported fields
}

MetadataSelect is the builder for selecting fields of Metadata entities.

func (*MetadataSelect) Bool

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

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

func (*MetadataSelect) BoolX

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

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

func (*MetadataSelect) Bools

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

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

func (*MetadataSelect) BoolsX

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

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

func (*MetadataSelect) Float64

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

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

func (*MetadataSelect) Float64X

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

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

func (*MetadataSelect) Float64s

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

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

func (*MetadataSelect) Float64sX

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

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

func (*MetadataSelect) Int

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

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

func (*MetadataSelect) IntX

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

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

func (*MetadataSelect) Ints

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

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

func (*MetadataSelect) IntsX

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

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

func (*MetadataSelect) Scan

func (ms *MetadataSelect) Scan(ctx context.Context, v interface{}) error

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

func (*MetadataSelect) ScanX

func (s *MetadataSelect) ScanX(ctx context.Context, v interface{})

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

func (*MetadataSelect) String

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

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

func (*MetadataSelect) StringX

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

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

func (*MetadataSelect) Strings

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

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

func (*MetadataSelect) StringsX

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

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

type MetadataSlice

type MetadataSlice []*Metadata

MetadataSlice is a parsable slice of Metadata.

type MetadataUpdate

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

MetadataUpdate is the builder for updating Metadata entities.

func (*MetadataUpdate) AddAge

func (mu *MetadataUpdate) AddAge(i int) *MetadataUpdate

AddAge adds i to the "age" field.

func (*MetadataUpdate) AddChildIDs

func (mu *MetadataUpdate) AddChildIDs(ids ...int) *MetadataUpdate

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

func (*MetadataUpdate) AddChildren

func (mu *MetadataUpdate) AddChildren(m ...*Metadata) *MetadataUpdate

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

func (*MetadataUpdate) ClearChildren

func (mu *MetadataUpdate) ClearChildren() *MetadataUpdate

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

func (*MetadataUpdate) ClearParent

func (mu *MetadataUpdate) ClearParent() *MetadataUpdate

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

func (*MetadataUpdate) ClearParentID

func (mu *MetadataUpdate) ClearParentID() *MetadataUpdate

ClearParentID clears the value of the "parent_id" field.

func (*MetadataUpdate) ClearUser

func (mu *MetadataUpdate) ClearUser() *MetadataUpdate

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

func (*MetadataUpdate) Exec

func (mu *MetadataUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataUpdate) ExecX

func (mu *MetadataUpdate) ExecX(ctx context.Context)

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

func (*MetadataUpdate) Mutation

func (mu *MetadataUpdate) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataUpdate) RemoveChildIDs

func (mu *MetadataUpdate) RemoveChildIDs(ids ...int) *MetadataUpdate

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

func (*MetadataUpdate) RemoveChildren

func (mu *MetadataUpdate) RemoveChildren(m ...*Metadata) *MetadataUpdate

RemoveChildren removes "children" edges to Metadata entities.

func (*MetadataUpdate) Save

func (mu *MetadataUpdate) Save(ctx context.Context) (int, error)

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

func (*MetadataUpdate) SaveX

func (mu *MetadataUpdate) SaveX(ctx context.Context) int

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

func (*MetadataUpdate) SetAge

func (mu *MetadataUpdate) SetAge(i int) *MetadataUpdate

SetAge sets the "age" field.

func (*MetadataUpdate) SetNillableAge

func (mu *MetadataUpdate) SetNillableAge(i *int) *MetadataUpdate

SetNillableAge sets the "age" field if the given value is not nil.

func (*MetadataUpdate) SetNillableParentID

func (mu *MetadataUpdate) SetNillableParentID(i *int) *MetadataUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*MetadataUpdate) SetNillableUserID

func (mu *MetadataUpdate) SetNillableUserID(id *int) *MetadataUpdate

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

func (*MetadataUpdate) SetParent

func (mu *MetadataUpdate) SetParent(m *Metadata) *MetadataUpdate

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

func (*MetadataUpdate) SetParentID

func (mu *MetadataUpdate) SetParentID(i int) *MetadataUpdate

SetParentID sets the "parent_id" field.

func (*MetadataUpdate) SetUser

func (mu *MetadataUpdate) SetUser(u *User) *MetadataUpdate

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

func (*MetadataUpdate) SetUserID

func (mu *MetadataUpdate) SetUserID(id int) *MetadataUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*MetadataUpdate) Where

func (mu *MetadataUpdate) Where(ps ...predicate.Metadata) *MetadataUpdate

Where appends a list predicates to the MetadataUpdate builder.

type MetadataUpdateOne

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

MetadataUpdateOne is the builder for updating a single Metadata entity.

func (*MetadataUpdateOne) AddAge

func (muo *MetadataUpdateOne) AddAge(i int) *MetadataUpdateOne

AddAge adds i to the "age" field.

func (*MetadataUpdateOne) AddChildIDs

func (muo *MetadataUpdateOne) AddChildIDs(ids ...int) *MetadataUpdateOne

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

func (*MetadataUpdateOne) AddChildren

func (muo *MetadataUpdateOne) AddChildren(m ...*Metadata) *MetadataUpdateOne

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

func (*MetadataUpdateOne) ClearChildren

func (muo *MetadataUpdateOne) ClearChildren() *MetadataUpdateOne

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

func (*MetadataUpdateOne) ClearParent

func (muo *MetadataUpdateOne) ClearParent() *MetadataUpdateOne

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

func (*MetadataUpdateOne) ClearParentID

func (muo *MetadataUpdateOne) ClearParentID() *MetadataUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*MetadataUpdateOne) ClearUser

func (muo *MetadataUpdateOne) ClearUser() *MetadataUpdateOne

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

func (*MetadataUpdateOne) Exec

func (muo *MetadataUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MetadataUpdateOne) ExecX

func (muo *MetadataUpdateOne) ExecX(ctx context.Context)

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

func (*MetadataUpdateOne) Mutation

func (muo *MetadataUpdateOne) Mutation() *MetadataMutation

Mutation returns the MetadataMutation object of the builder.

func (*MetadataUpdateOne) RemoveChildIDs

func (muo *MetadataUpdateOne) RemoveChildIDs(ids ...int) *MetadataUpdateOne

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

func (*MetadataUpdateOne) RemoveChildren

func (muo *MetadataUpdateOne) RemoveChildren(m ...*Metadata) *MetadataUpdateOne

RemoveChildren removes "children" edges to Metadata entities.

func (*MetadataUpdateOne) Save

func (muo *MetadataUpdateOne) Save(ctx context.Context) (*Metadata, error)

Save executes the query and returns the updated Metadata entity.

func (*MetadataUpdateOne) SaveX

func (muo *MetadataUpdateOne) SaveX(ctx context.Context) *Metadata

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

func (*MetadataUpdateOne) Select

func (muo *MetadataUpdateOne) Select(field string, fields ...string) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetAge

func (muo *MetadataUpdateOne) SetAge(i int) *MetadataUpdateOne

SetAge sets the "age" field.

func (*MetadataUpdateOne) SetNillableAge

func (muo *MetadataUpdateOne) SetNillableAge(i *int) *MetadataUpdateOne

SetNillableAge sets the "age" field if the given value is not nil.

func (*MetadataUpdateOne) SetNillableParentID

func (muo *MetadataUpdateOne) SetNillableParentID(i *int) *MetadataUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*MetadataUpdateOne) SetNillableUserID

func (muo *MetadataUpdateOne) SetNillableUserID(id *int) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetParent

func (muo *MetadataUpdateOne) SetParent(m *Metadata) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetParentID

func (muo *MetadataUpdateOne) SetParentID(i int) *MetadataUpdateOne

SetParentID sets the "parent_id" field.

func (*MetadataUpdateOne) SetUser

func (muo *MetadataUpdateOne) SetUser(u *User) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetUserID

func (muo *MetadataUpdateOne) SetUserID(id int) *MetadataUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

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 Node

type Node struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Value holds the value of the "value" field.
	Value int `json:"value,omitempty"`
	// PrevID holds the value of the "prev_id" field.
	PrevID int `json:"prev_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the NodeQuery when eager-loading is set.
	Edges NodeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Node is the model entity for the Node schema.

func (*Node) QueryNext

func (n *Node) QueryNext() *NodeQuery

QueryNext queries the "next" edge of the Node entity.

func (*Node) QueryPrev

func (n *Node) QueryPrev() *NodeQuery

QueryPrev queries the "prev" edge of the Node entity.

func (*Node) String

func (n *Node) String() string

String implements the fmt.Stringer.

func (*Node) Unwrap

func (n *Node) Unwrap() *Node

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

func (n *Node) Update() *NodeUpdateOne

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

type NodeClient

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

NodeClient is a client for the Node schema.

func NewNodeClient

func NewNodeClient(c config) *NodeClient

NewNodeClient returns a client for the Node from the given config.

func (*NodeClient) Create

func (c *NodeClient) Create() *NodeCreate

Create returns a create builder for Node.

func (*NodeClient) CreateBulk

func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk

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

func (*NodeClient) Delete

func (c *NodeClient) Delete() *NodeDelete

Delete returns a delete builder for Node.

func (*NodeClient) DeleteOne

func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*NodeClient) DeleteOneID

func (c *NodeClient) DeleteOneID(id int) *NodeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*NodeClient) Get

func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error)

Get returns a Node entity by its id.

func (*NodeClient) GetX

func (c *NodeClient) GetX(ctx context.Context, id int) *Node

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

func (*NodeClient) Hooks

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

Hooks returns the client hooks.

func (*NodeClient) Query

func (c *NodeClient) Query() *NodeQuery

Query returns a query builder for Node.

func (*NodeClient) QueryNext

func (c *NodeClient) QueryNext(n *Node) *NodeQuery

QueryNext queries the next edge of a Node.

func (*NodeClient) QueryPrev

func (c *NodeClient) QueryPrev(n *Node) *NodeQuery

QueryPrev queries the prev edge of a Node.

func (*NodeClient) Update

func (c *NodeClient) Update() *NodeUpdate

Update returns an update builder for Node.

func (*NodeClient) UpdateOne

func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NodeClient) UpdateOneID

func (c *NodeClient) UpdateOneID(id int) *NodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NodeClient) Use

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

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

type NodeCreate

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

NodeCreate is the builder for creating a Node entity.

func (*NodeCreate) Exec

func (nc *NodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreate) ExecX

func (nc *NodeCreate) ExecX(ctx context.Context)

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

func (*NodeCreate) Mutation

func (nc *NodeCreate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeCreate) Save

func (nc *NodeCreate) Save(ctx context.Context) (*Node, error)

Save creates the Node in the database.

func (*NodeCreate) SaveX

func (nc *NodeCreate) SaveX(ctx context.Context) *Node

SaveX calls Save and panics if Save returns an error.

func (*NodeCreate) SetNext

func (nc *NodeCreate) SetNext(n *Node) *NodeCreate

SetNext sets the "next" edge to the Node entity.

func (*NodeCreate) SetNextID

func (nc *NodeCreate) SetNextID(id int) *NodeCreate

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeCreate) SetNillableNextID

func (nc *NodeCreate) SetNillableNextID(id *int) *NodeCreate

SetNillableNextID sets the "next" edge to the Node entity by ID if the given value is not nil.

func (*NodeCreate) SetNillablePrevID

func (nc *NodeCreate) SetNillablePrevID(i *int) *NodeCreate

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeCreate) SetNillableValue

func (nc *NodeCreate) SetNillableValue(i *int) *NodeCreate

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeCreate) SetPrev

func (nc *NodeCreate) SetPrev(n *Node) *NodeCreate

SetPrev sets the "prev" edge to the Node entity.

func (*NodeCreate) SetPrevID

func (nc *NodeCreate) SetPrevID(i int) *NodeCreate

SetPrevID sets the "prev_id" field.

func (*NodeCreate) SetValue

func (nc *NodeCreate) SetValue(i int) *NodeCreate

SetValue sets the "value" field.

type NodeCreateBulk

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

NodeCreateBulk is the builder for creating many Node entities in bulk.

func (*NodeCreateBulk) Exec

func (ncb *NodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreateBulk) ExecX

func (ncb *NodeCreateBulk) ExecX(ctx context.Context)

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

func (*NodeCreateBulk) Save

func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)

Save creates the Node entities in the database.

func (*NodeCreateBulk) SaveX

func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node

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

type NodeDelete

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

NodeDelete is the builder for deleting a Node entity.

func (*NodeDelete) Exec

func (nd *NodeDelete) Exec(ctx context.Context) (int, error)

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

func (*NodeDelete) ExecX

func (nd *NodeDelete) ExecX(ctx context.Context) int

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

func (*NodeDelete) Where

func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete

Where appends a list predicates to the NodeDelete builder.

type NodeDeleteOne

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

NodeDeleteOne is the builder for deleting a single Node entity.

func (*NodeDeleteOne) Exec

func (ndo *NodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NodeDeleteOne) ExecX

func (ndo *NodeDeleteOne) ExecX(ctx context.Context)

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

type NodeEdges

type NodeEdges struct {
	// Prev holds the value of the prev edge.
	Prev *Node `json:"prev,omitempty"`
	// Next holds the value of the next edge.
	Next *Node `json:"next,omitempty"`
	// contains filtered or unexported fields
}

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

func (NodeEdges) NextOrErr

func (e NodeEdges) NextOrErr() (*Node, error)

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

func (NodeEdges) PrevOrErr

func (e NodeEdges) PrevOrErr() (*Node, error)

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

type NodeGroupBy

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

NodeGroupBy is the group-by builder for Node entities.

func (*NodeGroupBy) Aggregate

func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy

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

func (*NodeGroupBy) Bool

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

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

func (*NodeGroupBy) BoolX

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

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

func (*NodeGroupBy) Bools

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

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

func (*NodeGroupBy) BoolsX

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

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

func (*NodeGroupBy) Float64

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

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

func (*NodeGroupBy) Float64X

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

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

func (*NodeGroupBy) Float64s

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

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

func (*NodeGroupBy) Float64sX

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

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

func (*NodeGroupBy) Int

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

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

func (*NodeGroupBy) IntX

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

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

func (*NodeGroupBy) Ints

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

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

func (*NodeGroupBy) IntsX

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

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

func (*NodeGroupBy) Scan

func (ngb *NodeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*NodeGroupBy) ScanX

func (s *NodeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*NodeGroupBy) String

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

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

func (*NodeGroupBy) StringX

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

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

func (*NodeGroupBy) Strings

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

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

func (*NodeGroupBy) StringsX

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

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

type NodeMutation

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

NodeMutation represents an operation that mutates the Node nodes in the graph.

func (*NodeMutation) AddField

func (m *NodeMutation) 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 (*NodeMutation) AddValue

func (m *NodeMutation) AddValue(i int)

AddValue adds i to the "value" field.

func (*NodeMutation) AddedEdges

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

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

func (*NodeMutation) AddedField

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

func (m *NodeMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*NodeMutation) AddedIDs

func (m *NodeMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*NodeMutation) AddedValue

func (m *NodeMutation) AddedValue() (r int, exists bool)

AddedValue returns the value that was added to the "value" field in this mutation.

func (*NodeMutation) ClearEdge

func (m *NodeMutation) 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 (*NodeMutation) ClearField

func (m *NodeMutation) 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 (*NodeMutation) ClearNext

func (m *NodeMutation) ClearNext()

ClearNext clears the "next" edge to the Node entity.

func (*NodeMutation) ClearPrev

func (m *NodeMutation) ClearPrev()

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeMutation) ClearPrevID

func (m *NodeMutation) ClearPrevID()

ClearPrevID clears the value of the "prev_id" field.

func (*NodeMutation) ClearedEdges

func (m *NodeMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*NodeMutation) ClearedFields

func (m *NodeMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (NodeMutation) Client

func (m NodeMutation) 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 (*NodeMutation) EdgeCleared

func (m *NodeMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*NodeMutation) Field

func (m *NodeMutation) 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 (*NodeMutation) FieldCleared

func (m *NodeMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*NodeMutation) Fields

func (m *NodeMutation) 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 (*NodeMutation) ID

func (m *NodeMutation) 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 (*NodeMutation) IDs

func (m *NodeMutation) 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 (*NodeMutation) NextCleared

func (m *NodeMutation) NextCleared() bool

NextCleared reports if the "next" edge to the Node entity was cleared.

func (*NodeMutation) NextID

func (m *NodeMutation) NextID() (id int, exists bool)

NextID returns the "next" edge ID in the mutation.

func (*NodeMutation) NextIDs

func (m *NodeMutation) NextIDs() (ids []int)

NextIDs returns the "next" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use NextID instead. It exists only for internal usage by the builders.

func (*NodeMutation) OldField

func (m *NodeMutation) 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 (*NodeMutation) OldPrevID

func (m *NodeMutation) OldPrevID(ctx context.Context) (v int, err error)

OldPrevID returns the old "prev_id" field's value of the Node entity. If the Node 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 (*NodeMutation) OldValue

func (m *NodeMutation) OldValue(ctx context.Context) (v int, err error)

OldValue returns the old "value" field's value of the Node entity. If the Node 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 (*NodeMutation) Op

func (m *NodeMutation) Op() Op

Op returns the operation name.

func (*NodeMutation) PrevCleared

func (m *NodeMutation) PrevCleared() bool

PrevCleared reports if the "prev" edge to the Node entity was cleared.

func (*NodeMutation) PrevID

func (m *NodeMutation) PrevID() (r int, exists bool)

PrevID returns the value of the "prev_id" field in the mutation.

func (*NodeMutation) PrevIDCleared

func (m *NodeMutation) PrevIDCleared() bool

PrevIDCleared returns if the "prev_id" field was cleared in this mutation.

func (*NodeMutation) PrevIDs

func (m *NodeMutation) PrevIDs() (ids []int)

PrevIDs returns the "prev" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use PrevID instead. It exists only for internal usage by the builders.

func (*NodeMutation) RemovedEdges

func (m *NodeMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*NodeMutation) RemovedIDs

func (m *NodeMutation) 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 (*NodeMutation) ResetEdge

func (m *NodeMutation) 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 (*NodeMutation) ResetField

func (m *NodeMutation) 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 (*NodeMutation) ResetNext

func (m *NodeMutation) ResetNext()

ResetNext resets all changes to the "next" edge.

func (*NodeMutation) ResetPrev

func (m *NodeMutation) ResetPrev()

ResetPrev resets all changes to the "prev" edge.

func (*NodeMutation) ResetPrevID

func (m *NodeMutation) ResetPrevID()

ResetPrevID resets all changes to the "prev_id" field.

func (*NodeMutation) ResetValue

func (m *NodeMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*NodeMutation) SetField

func (m *NodeMutation) 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 (*NodeMutation) SetNextID

func (m *NodeMutation) SetNextID(id int)

SetNextID sets the "next" edge to the Node entity by id.

func (*NodeMutation) SetPrevID

func (m *NodeMutation) SetPrevID(i int)

SetPrevID sets the "prev_id" field.

func (*NodeMutation) SetValue

func (m *NodeMutation) SetValue(i int)

SetValue sets the "value" field.

func (NodeMutation) Tx

func (m NodeMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*NodeMutation) Type

func (m *NodeMutation) Type() string

Type returns the node type of this mutation (Node).

func (*NodeMutation) Value

func (m *NodeMutation) Value() (r int, exists bool)

Value returns the value of the "value" field in the mutation.

func (*NodeMutation) Where

func (m *NodeMutation) Where(ps ...predicate.Node)

Where appends a list predicates to the NodeMutation builder.

type NodeQuery

type NodeQuery struct {
	// contains filtered or unexported fields
}

NodeQuery is the builder for querying Node entities.

func (*NodeQuery) All

func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error)

All executes the query and returns a list of Nodes.

func (*NodeQuery) AllX

func (nq *NodeQuery) AllX(ctx context.Context) []*Node

AllX is like All, but panics if an error occurs.

func (*NodeQuery) Clone

func (nq *NodeQuery) Clone() *NodeQuery

Clone returns a duplicate of the NodeQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*NodeQuery) Count

func (nq *NodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NodeQuery) CountX

func (nq *NodeQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*NodeQuery) Exist

func (nq *NodeQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*NodeQuery) ExistX

func (nq *NodeQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*NodeQuery) First

func (nq *NodeQuery) First(ctx context.Context) (*Node, error)

First returns the first Node entity from the query. Returns a *NotFoundError when no Node was found.

func (*NodeQuery) FirstID

func (nq *NodeQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Node ID from the query. Returns a *NotFoundError when no Node ID was found.

func (*NodeQuery) FirstIDX

func (nq *NodeQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*NodeQuery) FirstX

func (nq *NodeQuery) FirstX(ctx context.Context) *Node

FirstX is like First, but panics if an error occurs.

func (*NodeQuery) GroupBy

func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy

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 {
	Value int `json:"value,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Node.Query().
	GroupBy(node.FieldValue).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*NodeQuery) IDs

func (nq *NodeQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Node IDs.

func (*NodeQuery) IDsX

func (nq *NodeQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*NodeQuery) Limit

func (nq *NodeQuery) Limit(limit int) *NodeQuery

Limit adds a limit step to the query.

func (*NodeQuery) Offset

func (nq *NodeQuery) Offset(offset int) *NodeQuery

Offset adds an offset step to the query.

func (*NodeQuery) Only

func (nq *NodeQuery) Only(ctx context.Context) (*Node, error)

Only returns a single Node entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Node entity is found. Returns a *NotFoundError when no Node entities are found.

func (*NodeQuery) OnlyID

func (nq *NodeQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Node ID in the query. Returns a *NotSingularError when more than one Node ID is found. Returns a *NotFoundError when no entities are found.

func (*NodeQuery) OnlyIDX

func (nq *NodeQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*NodeQuery) OnlyX

func (nq *NodeQuery) OnlyX(ctx context.Context) *Node

OnlyX is like Only, but panics if an error occurs.

func (*NodeQuery) Order

func (nq *NodeQuery) Order(o ...OrderFunc) *NodeQuery

Order adds an order step to the query.

func (*NodeQuery) QueryNext

func (nq *NodeQuery) QueryNext() *NodeQuery

QueryNext chains the current query on the "next" edge.

func (*NodeQuery) QueryPrev

func (nq *NodeQuery) QueryPrev() *NodeQuery

QueryPrev chains the current query on the "prev" edge.

func (*NodeQuery) Select

func (nq *NodeQuery) Select(fields ...string) *NodeSelect

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 {
	Value int `json:"value,omitempty"`
}

client.Node.Query().
	Select(node.FieldValue).
	Scan(ctx, &v)

func (*NodeQuery) Unique

func (nq *NodeQuery) Unique(unique bool) *NodeQuery

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 (*NodeQuery) Where

func (nq *NodeQuery) Where(ps ...predicate.Node) *NodeQuery

Where adds a new predicate for the NodeQuery builder.

func (*NodeQuery) WithNext

func (nq *NodeQuery) WithNext(opts ...func(*NodeQuery)) *NodeQuery

WithNext tells the query-builder to eager-load the nodes that are connected to the "next" edge. The optional arguments are used to configure the query builder of the edge.

func (*NodeQuery) WithPrev

func (nq *NodeQuery) WithPrev(opts ...func(*NodeQuery)) *NodeQuery

WithPrev tells the query-builder to eager-load the nodes that are connected to the "prev" edge. The optional arguments are used to configure the query builder of the edge.

type NodeSelect

type NodeSelect struct {
	*NodeQuery
	// contains filtered or unexported fields
}

NodeSelect is the builder for selecting fields of Node entities.

func (*NodeSelect) Bool

func (s *NodeSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*NodeSelect) BoolX

func (s *NodeSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*NodeSelect) Bools

func (s *NodeSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*NodeSelect) BoolsX

func (s *NodeSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*NodeSelect) Float64

func (s *NodeSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*NodeSelect) Float64X

func (s *NodeSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*NodeSelect) Float64s

func (s *NodeSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*NodeSelect) Float64sX

func (s *NodeSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*NodeSelect) Int

func (s *NodeSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*NodeSelect) IntX

func (s *NodeSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*NodeSelect) Ints

func (s *NodeSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*NodeSelect) IntsX

func (s *NodeSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*NodeSelect) Scan

func (ns *NodeSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*NodeSelect) ScanX

func (s *NodeSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*NodeSelect) String

func (s *NodeSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*NodeSelect) StringX

func (s *NodeSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*NodeSelect) Strings

func (s *NodeSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*NodeSelect) StringsX

func (s *NodeSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type NodeUpdate

type NodeUpdate struct {
	// contains filtered or unexported fields
}

NodeUpdate is the builder for updating Node entities.

func (*NodeUpdate) AddValue

func (nu *NodeUpdate) AddValue(i int) *NodeUpdate

AddValue adds i to the "value" field.

func (*NodeUpdate) ClearNext

func (nu *NodeUpdate) ClearNext() *NodeUpdate

ClearNext clears the "next" edge to the Node entity.

func (*NodeUpdate) ClearPrev

func (nu *NodeUpdate) ClearPrev() *NodeUpdate

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeUpdate) ClearPrevID

func (nu *NodeUpdate) ClearPrevID() *NodeUpdate

ClearPrevID clears the value of the "prev_id" field.

func (*NodeUpdate) Exec

func (nu *NodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeUpdate) ExecX

func (nu *NodeUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeUpdate) Mutation

func (nu *NodeUpdate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdate) Save

func (nu *NodeUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*NodeUpdate) SaveX

func (nu *NodeUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*NodeUpdate) SetNext

func (nu *NodeUpdate) SetNext(n *Node) *NodeUpdate

SetNext sets the "next" edge to the Node entity.

func (*NodeUpdate) SetNextID

func (nu *NodeUpdate) SetNextID(id int) *NodeUpdate

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeUpdate) SetNillableNextID

func (nu *NodeUpdate) SetNillableNextID(id *int) *NodeUpdate

SetNillableNextID sets the "next" edge to the Node entity by ID if the given value is not nil.

func (*NodeUpdate) SetNillablePrevID

func (nu *NodeUpdate) SetNillablePrevID(i *int) *NodeUpdate

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeUpdate) SetNillableValue

func (nu *NodeUpdate) SetNillableValue(i *int) *NodeUpdate

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeUpdate) SetPrev

func (nu *NodeUpdate) SetPrev(n *Node) *NodeUpdate

SetPrev sets the "prev" edge to the Node entity.

func (*NodeUpdate) SetPrevID

func (nu *NodeUpdate) SetPrevID(i int) *NodeUpdate

SetPrevID sets the "prev_id" field.

func (*NodeUpdate) SetValue

func (nu *NodeUpdate) SetValue(i int) *NodeUpdate

SetValue sets the "value" field.

func (*NodeUpdate) Where

func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate

Where appends a list predicates to the NodeUpdate builder.

type NodeUpdateOne

type NodeUpdateOne struct {
	// contains filtered or unexported fields
}

NodeUpdateOne is the builder for updating a single Node entity.

func (*NodeUpdateOne) AddValue

func (nuo *NodeUpdateOne) AddValue(i int) *NodeUpdateOne

AddValue adds i to the "value" field.

func (*NodeUpdateOne) ClearNext

func (nuo *NodeUpdateOne) ClearNext() *NodeUpdateOne

ClearNext clears the "next" edge to the Node entity.

func (*NodeUpdateOne) ClearPrev

func (nuo *NodeUpdateOne) ClearPrev() *NodeUpdateOne

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeUpdateOne) ClearPrevID

func (nuo *NodeUpdateOne) ClearPrevID() *NodeUpdateOne

ClearPrevID clears the value of the "prev_id" field.

func (*NodeUpdateOne) Exec

func (nuo *NodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NodeUpdateOne) ExecX

func (nuo *NodeUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*NodeUpdateOne) Mutation

func (nuo *NodeUpdateOne) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdateOne) Save

func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error)

Save executes the query and returns the updated Node entity.

func (*NodeUpdateOne) SaveX

func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node

SaveX is like Save, but panics if an error occurs.

func (*NodeUpdateOne) Select

func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*NodeUpdateOne) SetNext

func (nuo *NodeUpdateOne) SetNext(n *Node) *NodeUpdateOne

SetNext sets the "next" edge to the Node entity.

func (*NodeUpdateOne) SetNextID

func (nuo *NodeUpdateOne) SetNextID(id int) *NodeUpdateOne

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeUpdateOne) SetNillableNextID

func (nuo *NodeUpdateOne) SetNillableNextID(id *int) *NodeUpdateOne

SetNillableNextID sets the "next" edge to the Node entity by ID if the given value is not nil.

func (*NodeUpdateOne) SetNillablePrevID

func (nuo *NodeUpdateOne) SetNillablePrevID(i *int) *NodeUpdateOne

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableValue

func (nuo *NodeUpdateOne) SetNillableValue(i *int) *NodeUpdateOne

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeUpdateOne) SetPrev

func (nuo *NodeUpdateOne) SetPrev(n *Node) *NodeUpdateOne

SetPrev sets the "prev" edge to the Node entity.

func (*NodeUpdateOne) SetPrevID

func (nuo *NodeUpdateOne) SetPrevID(i int) *NodeUpdateOne

SetPrevID sets the "prev_id" field.

func (*NodeUpdateOne) SetValue

func (nuo *NodeUpdateOne) SetValue(i int) *NodeUpdateOne

SetValue sets the "value" field.

type Nodes

type Nodes []*Node

Nodes is a parsable slice of Node.

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

type NotLoadedError struct {
	// contains filtered or unexported fields
}

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

type NotSingularError struct {
	// contains filtered or unexported fields
}

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Pet

type Pet struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// OwnerID holds the value of the "owner_id" field.
	OwnerID int `json:"owner_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PetQuery when eager-loading is set.
	Edges PetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Pet is the model entity for the Pet schema.

func (*Pet) 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.

type PetClient

type PetClient struct {
	// contains filtered or unexported fields
}

PetClient is a client for the Pet schema.

func NewPetClient

func NewPetClient(c config) *PetClient

NewPetClient returns a client for the Pet from the given config.

func (*PetClient) Create

func (c *PetClient) Create() *PetCreate

Create returns a create builder for Pet.

func (*PetClient) CreateBulk

func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk

CreateBulk returns a builder for creating a bulk of Pet entities.

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

func (c *PetClient) DeleteOne(pe *Pet) *PetDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PetClient) DeleteOneID

func (c *PetClient) DeleteOneID(id int) *PetDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PetClient) Get

func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error)

Get returns a Pet entity by its id.

func (*PetClient) GetX

func (c *PetClient) GetX(ctx context.Context, id int) *Pet

GetX is like Get, but panics if an error occurs.

func (*PetClient) Hooks

func (c *PetClient) Hooks() []Hook

Hooks returns the client hooks.

func (*PetClient) Query

func (c *PetClient) Query() *PetQuery

Query returns a query builder for Pet.

func (*PetClient) 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) 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) SetNillableOwnerID

func (pc *PetCreate) SetNillableOwnerID(i *int) *PetCreate

SetNillableOwnerID sets the "owner_id" field if the given value is not nil.

func (*PetCreate) SetOwner

func (pc *PetCreate) SetOwner(u *User) *PetCreate

SetOwner sets the "owner" edge to the User entity.

func (*PetCreate) SetOwnerID

func (pc *PetCreate) SetOwnerID(i int) *PetCreate

SetOwnerID sets the "owner_id" field.

type PetCreateBulk

type PetCreateBulk struct {
	// contains filtered or unexported fields
}

PetCreateBulk is the builder for creating many Pet entities in bulk.

func (*PetCreateBulk) Exec

func (pcb *PetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PetCreateBulk) ExecX

func (pcb *PetCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PetCreateBulk) Save

func (pcb *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error)

Save creates the Pet entities in the database.

func (*PetCreateBulk) SaveX

func (pcb *PetCreateBulk) SaveX(ctx context.Context) []*Pet

SaveX is like Save, but panics if an error occurs.

type PetDelete

type PetDelete struct {
	// contains filtered or unexported fields
}

PetDelete is the builder for deleting a Pet entity.

func (*PetDelete) Exec

func (pd *PetDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*PetDelete) ExecX

func (pd *PetDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*PetDelete) Where

func (pd *PetDelete) Where(ps ...predicate.Pet) *PetDelete

Where appends a list predicates to the PetDelete builder.

type PetDeleteOne

type PetDeleteOne struct {
	// contains filtered or unexported fields
}

PetDeleteOne is the builder for deleting a single Pet entity.

func (*PetDeleteOne) Exec

func (pdo *PetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PetDeleteOne) ExecX

func (pdo *PetDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type PetEdges

type PetEdges struct {
	// Owner holds the value of the owner edge.
	Owner *User `json:"owner,omitempty"`
	// contains filtered or unexported fields
}

PetEdges holds the relations/edges for other nodes in the graph.

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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*PetGroupBy) ScanX

func (s *PetGroupBy) ScanX(ctx context.Context, v interface{})

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) 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) 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) 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) ClearOwner

func (m *PetMutation) ClearOwner()

ClearOwner clears the "owner" edge to the User entity.

func (*PetMutation) ClearOwnerID

func (m *PetMutation) ClearOwnerID()

ClearOwnerID clears the value of the "owner_id" field.

func (*PetMutation) ClearedEdges

func (m *PetMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*PetMutation) ClearedFields

func (m *PetMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (PetMutation) Client

func (m PetMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*PetMutation) EdgeCleared

func (m *PetMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*PetMutation) Field

func (m *PetMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*PetMutation) FieldCleared

func (m *PetMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*PetMutation) Fields

func (m *PetMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*PetMutation) 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) 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) OldOwnerID

func (m *PetMutation) OldOwnerID(ctx context.Context) (v int, err error)

OldOwnerID returns the old "owner_id" field's value of the Pet entity. If the Pet object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*PetMutation) 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() (r int, exists bool)

OwnerID returns the value of the "owner_id" field in the mutation.

func (*PetMutation) OwnerIDCleared

func (m *PetMutation) OwnerIDCleared() bool

OwnerIDCleared returns if the "owner_id" field was cleared in this 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) RemovedEdges

func (m *PetMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

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) 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) ResetOwner

func (m *PetMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*PetMutation) ResetOwnerID

func (m *PetMutation) ResetOwnerID()

ResetOwnerID resets all changes to the "owner_id" 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) SetOwnerID

func (m *PetMutation) SetOwnerID(i int)

SetOwnerID sets the "owner_id" 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.

type PetQuery

type PetQuery struct {
	// contains filtered or unexported fields
}

PetQuery is the builder for querying Pet entities.

func (*PetQuery) All

func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error)

All executes the query and returns a list of Pets.

func (*PetQuery) AllX

func (pq *PetQuery) AllX(ctx context.Context) []*Pet

AllX is like All, but panics if an error occurs.

func (*PetQuery) Clone

func (pq *PetQuery) Clone() *PetQuery

Clone returns a duplicate of the PetQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PetQuery) Count

func (pq *PetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PetQuery) CountX

func (pq *PetQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PetQuery) Exist

func (pq *PetQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PetQuery) ExistX

func (pq *PetQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PetQuery) First

func (pq *PetQuery) First(ctx context.Context) (*Pet, error)

First returns the first Pet entity from the query. Returns a *NotFoundError when no Pet was found.

func (*PetQuery) FirstID

func (pq *PetQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Pet ID from the query. Returns a *NotFoundError when no Pet ID was found.

func (*PetQuery) FirstIDX

func (pq *PetQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*PetQuery) FirstX

func (pq *PetQuery) FirstX(ctx context.Context) *Pet

FirstX is like First, but panics if an error occurs.

func (*PetQuery) GroupBy

func (pq *PetQuery) GroupBy(field string, fields ...string) *PetGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	OwnerID int `json:"owner_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Pet.Query().
	GroupBy(pet.FieldOwnerID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PetQuery) IDs

func (pq *PetQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Pet IDs.

func (*PetQuery) IDsX

func (pq *PetQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*PetQuery) Limit

func (pq *PetQuery) Limit(limit int) *PetQuery

Limit adds a limit step to the query.

func (*PetQuery) Offset

func (pq *PetQuery) Offset(offset int) *PetQuery

Offset adds an offset step to the query.

func (*PetQuery) Only

func (pq *PetQuery) Only(ctx context.Context) (*Pet, error)

Only returns a single Pet entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Pet entity is found. Returns a *NotFoundError when no Pet entities are found.

func (*PetQuery) OnlyID

func (pq *PetQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Pet ID in the query. Returns a *NotSingularError when more than one Pet ID is found. Returns a *NotFoundError when no entities are found.

func (*PetQuery) OnlyIDX

func (pq *PetQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PetQuery) OnlyX

func (pq *PetQuery) OnlyX(ctx context.Context) *Pet

OnlyX is like Only, but panics if an error occurs.

func (*PetQuery) Order

func (pq *PetQuery) Order(o ...OrderFunc) *PetQuery

Order adds an order step to the query.

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 {
	OwnerID int `json:"owner_id,omitempty"`
}

client.Pet.Query().
	Select(pet.FieldOwnerID).
	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) 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) 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 interface{}) 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 interface{})

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) ClearOwner

func (pu *PetUpdate) ClearOwner() *PetUpdate

ClearOwner clears the "owner" edge to the User entity.

func (*PetUpdate) ClearOwnerID

func (pu *PetUpdate) ClearOwnerID() *PetUpdate

ClearOwnerID clears the value of the "owner_id" field.

func (*PetUpdate) Exec

func (pu *PetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PetUpdate) ExecX

func (pu *PetUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PetUpdate) Mutation

func (pu *PetUpdate) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdate) 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) SetNillableOwnerID

func (pu *PetUpdate) SetNillableOwnerID(i *int) *PetUpdate

SetNillableOwnerID sets the "owner_id" 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(i int) *PetUpdate

SetOwnerID sets the "owner_id" 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) ClearOwner

func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne

ClearOwner clears the "owner" edge to the User entity.

func (*PetUpdateOne) ClearOwnerID

func (puo *PetUpdateOne) ClearOwnerID() *PetUpdateOne

ClearOwnerID clears the value of the "owner_id" field.

func (*PetUpdateOne) Exec

func (puo *PetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PetUpdateOne) ExecX

func (puo *PetUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PetUpdateOne) Mutation

func (puo *PetUpdateOne) Mutation() *PetMutation

Mutation returns the PetMutation object of the builder.

func (*PetUpdateOne) 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) SetNillableOwnerID

func (puo *PetUpdateOne) SetNillableOwnerID(i *int) *PetUpdateOne

SetNillableOwnerID sets the "owner_id" 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(i int) *PetUpdateOne

SetOwnerID sets the "owner_id" field.

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 Post

type Post struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// AuthorID holds the value of the "author_id" field.
	AuthorID *int `json:"author_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PostQuery when eager-loading is set.
	Edges PostEdges `json:"edges"`
	// contains filtered or unexported fields
}

Post is the model entity for the Post schema.

func (*Post) QueryAuthor

func (po *Post) QueryAuthor() *UserQuery

QueryAuthor queries the "author" edge of the Post entity.

func (*Post) String

func (po *Post) String() string

String implements the fmt.Stringer.

func (*Post) Unwrap

func (po *Post) Unwrap() *Post

Unwrap unwraps the Post 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 (*Post) Update

func (po *Post) Update() *PostUpdateOne

Update returns a builder for updating this Post. Note that you need to call Post.Unwrap() before calling this method if this Post was returned from a transaction, and the transaction was committed or rolled back.

type PostClient

type PostClient struct {
	// contains filtered or unexported fields
}

PostClient is a client for the Post schema.

func NewPostClient

func NewPostClient(c config) *PostClient

NewPostClient returns a client for the Post from the given config.

func (*PostClient) Create

func (c *PostClient) Create() *PostCreate

Create returns a create builder for Post.

func (*PostClient) CreateBulk

func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk

CreateBulk returns a builder for creating a bulk of Post entities.

func (*PostClient) Delete

func (c *PostClient) Delete() *PostDelete

Delete returns a delete builder for Post.

func (*PostClient) DeleteOne

func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PostClient) DeleteOneID

func (c *PostClient) DeleteOneID(id int) *PostDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PostClient) Get

func (c *PostClient) Get(ctx context.Context, id int) (*Post, error)

Get returns a Post entity by its id.

func (*PostClient) GetX

func (c *PostClient) GetX(ctx context.Context, id int) *Post

GetX is like Get, but panics if an error occurs.

func (*PostClient) Hooks

func (c *PostClient) Hooks() []Hook

Hooks returns the client hooks.

func (*PostClient) Query

func (c *PostClient) Query() *PostQuery

Query returns a query builder for Post.

func (*PostClient) QueryAuthor

func (c *PostClient) QueryAuthor(po *Post) *UserQuery

QueryAuthor queries the author edge of a Post.

func (*PostClient) Update

func (c *PostClient) Update() *PostUpdate

Update returns an update builder for Post.

func (*PostClient) UpdateOne

func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PostClient) UpdateOneID

func (c *PostClient) UpdateOneID(id int) *PostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PostClient) Use

func (c *PostClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `post.Hooks(f(g(h())))`.

type PostCreate

type PostCreate struct {
	// contains filtered or unexported fields
}

PostCreate is the builder for creating a Post entity.

func (*PostCreate) Exec

func (pc *PostCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreate) ExecX

func (pc *PostCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostCreate) Mutation

func (pc *PostCreate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostCreate) Save

func (pc *PostCreate) Save(ctx context.Context) (*Post, error)

Save creates the Post in the database.

func (*PostCreate) SaveX

func (pc *PostCreate) SaveX(ctx context.Context) *Post

SaveX calls Save and panics if Save returns an error.

func (*PostCreate) SetAuthor

func (pc *PostCreate) SetAuthor(u *User) *PostCreate

SetAuthor sets the "author" edge to the User entity.

func (*PostCreate) SetAuthorID

func (pc *PostCreate) SetAuthorID(i int) *PostCreate

SetAuthorID sets the "author_id" field.

func (*PostCreate) SetNillableAuthorID

func (pc *PostCreate) SetNillableAuthorID(i *int) *PostCreate

SetNillableAuthorID sets the "author_id" field if the given value is not nil.

func (*PostCreate) SetText

func (pc *PostCreate) SetText(s string) *PostCreate

SetText sets the "text" field.

type PostCreateBulk

type PostCreateBulk struct {
	// contains filtered or unexported fields
}

PostCreateBulk is the builder for creating many Post entities in bulk.

func (*PostCreateBulk) Exec

func (pcb *PostCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PostCreateBulk) ExecX

func (pcb *PostCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostCreateBulk) Save

func (pcb *PostCreateBulk) Save(ctx context.Context) ([]*Post, error)

Save creates the Post entities in the database.

func (*PostCreateBulk) SaveX

func (pcb *PostCreateBulk) SaveX(ctx context.Context) []*Post

SaveX is like Save, but panics if an error occurs.

type PostDelete

type PostDelete struct {
	// contains filtered or unexported fields
}

PostDelete is the builder for deleting a Post entity.

func (*PostDelete) Exec

func (pd *PostDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*PostDelete) ExecX

func (pd *PostDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*PostDelete) Where

func (pd *PostDelete) Where(ps ...predicate.Post) *PostDelete

Where appends a list predicates to the PostDelete builder.

type PostDeleteOne

type PostDeleteOne struct {
	// contains filtered or unexported fields
}

PostDeleteOne is the builder for deleting a single Post entity.

func (*PostDeleteOne) Exec

func (pdo *PostDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PostDeleteOne) ExecX

func (pdo *PostDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type PostEdges

type PostEdges struct {
	// Author holds the value of the author edge.
	Author *User `json:"author,omitempty"`
	// contains filtered or unexported fields
}

PostEdges holds the relations/edges for other nodes in the graph.

func (PostEdges) AuthorOrErr

func (e PostEdges) AuthorOrErr() (*User, error)

AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type PostGroupBy

type PostGroupBy struct {
	// contains filtered or unexported fields
}

PostGroupBy is the group-by builder for Post entities.

func (*PostGroupBy) Aggregate

func (pgb *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*PostGroupBy) Bool

func (s *PostGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) BoolX

func (s *PostGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostGroupBy) Bools

func (s *PostGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) BoolsX

func (s *PostGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostGroupBy) Float64

func (s *PostGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) Float64X

func (s *PostGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostGroupBy) Float64s

func (s *PostGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) Float64sX

func (s *PostGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostGroupBy) Int

func (s *PostGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) IntX

func (s *PostGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostGroupBy) Ints

func (s *PostGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) IntsX

func (s *PostGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PostGroupBy) Scan

func (pgb *PostGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*PostGroupBy) ScanX

func (s *PostGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostGroupBy) String

func (s *PostGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) StringX

func (s *PostGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostGroupBy) Strings

func (s *PostGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PostGroupBy) StringsX

func (s *PostGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PostMutation

type PostMutation struct {
	// contains filtered or unexported fields
}

PostMutation represents an operation that mutates the Post nodes in the graph.

func (*PostMutation) AddField

func (m *PostMutation) 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 (*PostMutation) AddedEdges

func (m *PostMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*PostMutation) AddedField

func (m *PostMutation) 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 (*PostMutation) AddedFields

func (m *PostMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*PostMutation) AddedIDs

func (m *PostMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*PostMutation) AuthorCleared

func (m *PostMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the User entity was cleared.

func (*PostMutation) AuthorID

func (m *PostMutation) AuthorID() (r int, exists bool)

AuthorID returns the value of the "author_id" field in the mutation.

func (*PostMutation) AuthorIDCleared

func (m *PostMutation) AuthorIDCleared() bool

AuthorIDCleared returns if the "author_id" field was cleared in this mutation.

func (*PostMutation) AuthorIDs

func (m *PostMutation) AuthorIDs() (ids []int)

AuthorIDs returns the "author" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AuthorID instead. It exists only for internal usage by the builders.

func (*PostMutation) ClearAuthor

func (m *PostMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the User entity.

func (*PostMutation) ClearAuthorID

func (m *PostMutation) ClearAuthorID()

ClearAuthorID clears the value of the "author_id" field.

func (*PostMutation) ClearEdge

func (m *PostMutation) 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 (*PostMutation) ClearField

func (m *PostMutation) 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 (*PostMutation) ClearedEdges

func (m *PostMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*PostMutation) ClearedFields

func (m *PostMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (PostMutation) Client

func (m PostMutation) 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 (*PostMutation) EdgeCleared

func (m *PostMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*PostMutation) Field

func (m *PostMutation) 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 (*PostMutation) FieldCleared

func (m *PostMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*PostMutation) Fields

func (m *PostMutation) 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 (*PostMutation) ID

func (m *PostMutation) 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 (*PostMutation) IDs

func (m *PostMutation) 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 (*PostMutation) OldAuthorID

func (m *PostMutation) OldAuthorID(ctx context.Context) (v *int, err error)

OldAuthorID returns the old "author_id" field's value of the Post entity. If the Post 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 (*PostMutation) OldField

func (m *PostMutation) 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 (*PostMutation) OldText

func (m *PostMutation) OldText(ctx context.Context) (v string, err error)

OldText returns the old "text" field's value of the Post entity. If the Post 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 (*PostMutation) Op

func (m *PostMutation) Op() Op

Op returns the operation name.

func (*PostMutation) RemovedEdges

func (m *PostMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*PostMutation) RemovedIDs

func (m *PostMutation) 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 (*PostMutation) ResetAuthor

func (m *PostMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*PostMutation) ResetAuthorID

func (m *PostMutation) ResetAuthorID()

ResetAuthorID resets all changes to the "author_id" field.

func (*PostMutation) ResetEdge

func (m *PostMutation) 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 (*PostMutation) ResetField

func (m *PostMutation) 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 (*PostMutation) ResetText

func (m *PostMutation) ResetText()

ResetText resets all changes to the "text" field.

func (*PostMutation) SetAuthorID

func (m *PostMutation) SetAuthorID(i int)

SetAuthorID sets the "author_id" field.

func (*PostMutation) SetField

func (m *PostMutation) 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 (*PostMutation) SetText

func (m *PostMutation) SetText(s string)

SetText sets the "text" field.

func (*PostMutation) Text

func (m *PostMutation) Text() (r string, exists bool)

Text returns the value of the "text" field in the mutation.

func (PostMutation) Tx

func (m PostMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*PostMutation) Type

func (m *PostMutation) Type() string

Type returns the node type of this mutation (Post).

func (*PostMutation) Where

func (m *PostMutation) Where(ps ...predicate.Post)

Where appends a list predicates to the PostMutation builder.

type PostQuery

type PostQuery struct {
	// contains filtered or unexported fields
}

PostQuery is the builder for querying Post entities.

func (*PostQuery) All

func (pq *PostQuery) All(ctx context.Context) ([]*Post, error)

All executes the query and returns a list of Posts.

func (*PostQuery) AllX

func (pq *PostQuery) AllX(ctx context.Context) []*Post

AllX is like All, but panics if an error occurs.

func (*PostQuery) Clone

func (pq *PostQuery) Clone() *PostQuery

Clone returns a duplicate of the PostQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*PostQuery) Count

func (pq *PostQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PostQuery) CountX

func (pq *PostQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*PostQuery) Exist

func (pq *PostQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*PostQuery) ExistX

func (pq *PostQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*PostQuery) First

func (pq *PostQuery) First(ctx context.Context) (*Post, error)

First returns the first Post entity from the query. Returns a *NotFoundError when no Post was found.

func (*PostQuery) FirstID

func (pq *PostQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Post ID from the query. Returns a *NotFoundError when no Post ID was found.

func (*PostQuery) FirstIDX

func (pq *PostQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*PostQuery) FirstX

func (pq *PostQuery) FirstX(ctx context.Context) *Post

FirstX is like First, but panics if an error occurs.

func (*PostQuery) GroupBy

func (pq *PostQuery) GroupBy(field string, fields ...string) *PostGroupBy

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 {
	Text string `json:"text,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Post.Query().
	GroupBy(post.FieldText).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PostQuery) IDs

func (pq *PostQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Post IDs.

func (*PostQuery) IDsX

func (pq *PostQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*PostQuery) Limit

func (pq *PostQuery) Limit(limit int) *PostQuery

Limit adds a limit step to the query.

func (*PostQuery) Offset

func (pq *PostQuery) Offset(offset int) *PostQuery

Offset adds an offset step to the query.

func (*PostQuery) Only

func (pq *PostQuery) Only(ctx context.Context) (*Post, error)

Only returns a single Post entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Post entity is found. Returns a *NotFoundError when no Post entities are found.

func (*PostQuery) OnlyID

func (pq *PostQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Post ID in the query. Returns a *NotSingularError when more than one Post ID is found. Returns a *NotFoundError when no entities are found.

func (*PostQuery) OnlyIDX

func (pq *PostQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*PostQuery) OnlyX

func (pq *PostQuery) OnlyX(ctx context.Context) *Post

OnlyX is like Only, but panics if an error occurs.

func (*PostQuery) Order

func (pq *PostQuery) Order(o ...OrderFunc) *PostQuery

Order adds an order step to the query.

func (*PostQuery) QueryAuthor

func (pq *PostQuery) QueryAuthor() *UserQuery

QueryAuthor chains the current query on the "author" edge.

func (*PostQuery) Select

func (pq *PostQuery) Select(fields ...string) *PostSelect

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 {
	Text string `json:"text,omitempty"`
}

client.Post.Query().
	Select(post.FieldText).
	Scan(ctx, &v)

func (*PostQuery) Unique

func (pq *PostQuery) Unique(unique bool) *PostQuery

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 (*PostQuery) Where

func (pq *PostQuery) Where(ps ...predicate.Post) *PostQuery

Where adds a new predicate for the PostQuery builder.

func (*PostQuery) WithAuthor

func (pq *PostQuery) WithAuthor(opts ...func(*UserQuery)) *PostQuery

WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.

type PostSelect

type PostSelect struct {
	*PostQuery
	// contains filtered or unexported fields
}

PostSelect is the builder for selecting fields of Post entities.

func (*PostSelect) Bool

func (s *PostSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*PostSelect) BoolX

func (s *PostSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostSelect) Bools

func (s *PostSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*PostSelect) BoolsX

func (s *PostSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostSelect) Float64

func (s *PostSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*PostSelect) Float64X

func (s *PostSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostSelect) Float64s

func (s *PostSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*PostSelect) Float64sX

func (s *PostSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostSelect) Int

func (s *PostSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*PostSelect) IntX

func (s *PostSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostSelect) Ints

func (s *PostSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*PostSelect) IntsX

func (s *PostSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*PostSelect) Scan

func (ps *PostSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*PostSelect) ScanX

func (s *PostSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostSelect) String

func (s *PostSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*PostSelect) StringX

func (s *PostSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostSelect) Strings

func (s *PostSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*PostSelect) StringsX

func (s *PostSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type PostUpdate

type PostUpdate struct {
	// contains filtered or unexported fields
}

PostUpdate is the builder for updating Post entities.

func (*PostUpdate) ClearAuthor

func (pu *PostUpdate) ClearAuthor() *PostUpdate

ClearAuthor clears the "author" edge to the User entity.

func (*PostUpdate) ClearAuthorID

func (pu *PostUpdate) ClearAuthorID() *PostUpdate

ClearAuthorID clears the value of the "author_id" field.

func (*PostUpdate) Exec

func (pu *PostUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PostUpdate) ExecX

func (pu *PostUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpdate) Mutation

func (pu *PostUpdate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdate) Save

func (pu *PostUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*PostUpdate) SaveX

func (pu *PostUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*PostUpdate) SetAuthor

func (pu *PostUpdate) SetAuthor(u *User) *PostUpdate

SetAuthor sets the "author" edge to the User entity.

func (*PostUpdate) SetAuthorID

func (pu *PostUpdate) SetAuthorID(i int) *PostUpdate

SetAuthorID sets the "author_id" field.

func (*PostUpdate) SetNillableAuthorID

func (pu *PostUpdate) SetNillableAuthorID(i *int) *PostUpdate

SetNillableAuthorID sets the "author_id" field if the given value is not nil.

func (*PostUpdate) SetText

func (pu *PostUpdate) SetText(s string) *PostUpdate

SetText sets the "text" field.

func (*PostUpdate) Where

func (pu *PostUpdate) Where(ps ...predicate.Post) *PostUpdate

Where appends a list predicates to the PostUpdate builder.

type PostUpdateOne

type PostUpdateOne struct {
	// contains filtered or unexported fields
}

PostUpdateOne is the builder for updating a single Post entity.

func (*PostUpdateOne) ClearAuthor

func (puo *PostUpdateOne) ClearAuthor() *PostUpdateOne

ClearAuthor clears the "author" edge to the User entity.

func (*PostUpdateOne) ClearAuthorID

func (puo *PostUpdateOne) ClearAuthorID() *PostUpdateOne

ClearAuthorID clears the value of the "author_id" field.

func (*PostUpdateOne) Exec

func (puo *PostUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PostUpdateOne) ExecX

func (puo *PostUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*PostUpdateOne) Mutation

func (puo *PostUpdateOne) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdateOne) Save

func (puo *PostUpdateOne) Save(ctx context.Context) (*Post, error)

Save executes the query and returns the updated Post entity.

func (*PostUpdateOne) SaveX

func (puo *PostUpdateOne) SaveX(ctx context.Context) *Post

SaveX is like Save, but panics if an error occurs.

func (*PostUpdateOne) Select

func (puo *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*PostUpdateOne) SetAuthor

func (puo *PostUpdateOne) SetAuthor(u *User) *PostUpdateOne

SetAuthor sets the "author" edge to the User entity.

func (*PostUpdateOne) SetAuthorID

func (puo *PostUpdateOne) SetAuthorID(i int) *PostUpdateOne

SetAuthorID sets the "author_id" field.

func (*PostUpdateOne) SetNillableAuthorID

func (puo *PostUpdateOne) SetNillableAuthorID(i *int) *PostUpdateOne

SetNillableAuthorID sets the "author_id" field if the given value is not nil.

func (*PostUpdateOne) SetText

func (puo *PostUpdateOne) SetText(s string) *PostUpdateOne

SetText sets the "text" field.

type Posts

type Posts []*Post

Posts is a parsable slice of Post.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type Rental

type Rental struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Date holds the value of the "date" field.
	Date time.Time `json:"date,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id,omitempty"`
	// CarID holds the value of the "car_id" field.
	CarID uuid.UUID `json:"car_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RentalQuery when eager-loading is set.
	Edges RentalEdges `json:"edges"`
	// contains filtered or unexported fields
}

Rental is the model entity for the Rental schema.

func (*Rental) QueryCar

func (r *Rental) QueryCar() *CarQuery

QueryCar queries the "car" edge of the Rental entity.

func (*Rental) QueryUser

func (r *Rental) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Rental entity.

func (*Rental) String

func (r *Rental) String() string

String implements the fmt.Stringer.

func (*Rental) Unwrap

func (r *Rental) Unwrap() *Rental

Unwrap unwraps the Rental 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 (*Rental) Update

func (r *Rental) Update() *RentalUpdateOne

Update returns a builder for updating this Rental. Note that you need to call Rental.Unwrap() before calling this method if this Rental was returned from a transaction, and the transaction was committed or rolled back.

type RentalClient

type RentalClient struct {
	// contains filtered or unexported fields
}

RentalClient is a client for the Rental schema.

func NewRentalClient

func NewRentalClient(c config) *RentalClient

NewRentalClient returns a client for the Rental from the given config.

func (*RentalClient) Create

func (c *RentalClient) Create() *RentalCreate

Create returns a create builder for Rental.

func (*RentalClient) CreateBulk

func (c *RentalClient) CreateBulk(builders ...*RentalCreate) *RentalCreateBulk

CreateBulk returns a builder for creating a bulk of Rental entities.

func (*RentalClient) Delete

func (c *RentalClient) Delete() *RentalDelete

Delete returns a delete builder for Rental.

func (*RentalClient) DeleteOne

func (c *RentalClient) DeleteOne(r *Rental) *RentalDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*RentalClient) DeleteOneID

func (c *RentalClient) DeleteOneID(id int) *RentalDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RentalClient) Get

func (c *RentalClient) Get(ctx context.Context, id int) (*Rental, error)

Get returns a Rental entity by its id.

func (*RentalClient) GetX

func (c *RentalClient) GetX(ctx context.Context, id int) *Rental

GetX is like Get, but panics if an error occurs.

func (*RentalClient) Hooks

func (c *RentalClient) Hooks() []Hook

Hooks returns the client hooks.

func (*RentalClient) Query

func (c *RentalClient) Query() *RentalQuery

Query returns a query builder for Rental.

func (*RentalClient) QueryCar

func (c *RentalClient) QueryCar(r *Rental) *CarQuery

QueryCar queries the car edge of a Rental.

func (*RentalClient) QueryUser

func (c *RentalClient) QueryUser(r *Rental) *UserQuery

QueryUser queries the user edge of a Rental.

func (*RentalClient) Update

func (c *RentalClient) Update() *RentalUpdate

Update returns an update builder for Rental.

func (*RentalClient) UpdateOne

func (c *RentalClient) UpdateOne(r *Rental) *RentalUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RentalClient) UpdateOneID

func (c *RentalClient) UpdateOneID(id int) *RentalUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RentalClient) Use

func (c *RentalClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `rental.Hooks(f(g(h())))`.

type RentalCreate

type RentalCreate struct {
	// contains filtered or unexported fields
}

RentalCreate is the builder for creating a Rental entity.

func (*RentalCreate) Exec

func (rc *RentalCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalCreate) ExecX

func (rc *RentalCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RentalCreate) Mutation

func (rc *RentalCreate) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalCreate) Save

func (rc *RentalCreate) Save(ctx context.Context) (*Rental, error)

Save creates the Rental in the database.

func (*RentalCreate) SaveX

func (rc *RentalCreate) SaveX(ctx context.Context) *Rental

SaveX calls Save and panics if Save returns an error.

func (*RentalCreate) SetCar

func (rc *RentalCreate) SetCar(c *Car) *RentalCreate

SetCar sets the "car" edge to the Car entity.

func (*RentalCreate) SetCarID

func (rc *RentalCreate) SetCarID(u uuid.UUID) *RentalCreate

SetCarID sets the "car_id" field.

func (*RentalCreate) SetDate

func (rc *RentalCreate) SetDate(t time.Time) *RentalCreate

SetDate sets the "date" field.

func (*RentalCreate) SetNillableDate

func (rc *RentalCreate) SetNillableDate(t *time.Time) *RentalCreate

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalCreate) SetUser

func (rc *RentalCreate) SetUser(u *User) *RentalCreate

SetUser sets the "user" edge to the User entity.

func (*RentalCreate) SetUserID

func (rc *RentalCreate) SetUserID(i int) *RentalCreate

SetUserID sets the "user_id" field.

type RentalCreateBulk

type RentalCreateBulk struct {
	// contains filtered or unexported fields
}

RentalCreateBulk is the builder for creating many Rental entities in bulk.

func (*RentalCreateBulk) Exec

func (rcb *RentalCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalCreateBulk) ExecX

func (rcb *RentalCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RentalCreateBulk) Save

func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error)

Save creates the Rental entities in the database.

func (*RentalCreateBulk) SaveX

func (rcb *RentalCreateBulk) SaveX(ctx context.Context) []*Rental

SaveX is like Save, but panics if an error occurs.

type RentalDelete

type RentalDelete struct {
	// contains filtered or unexported fields
}

RentalDelete is the builder for deleting a Rental entity.

func (*RentalDelete) Exec

func (rd *RentalDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*RentalDelete) ExecX

func (rd *RentalDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*RentalDelete) Where

func (rd *RentalDelete) Where(ps ...predicate.Rental) *RentalDelete

Where appends a list predicates to the RentalDelete builder.

type RentalDeleteOne

type RentalDeleteOne struct {
	// contains filtered or unexported fields
}

RentalDeleteOne is the builder for deleting a single Rental entity.

func (*RentalDeleteOne) Exec

func (rdo *RentalDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RentalDeleteOne) ExecX

func (rdo *RentalDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type RentalEdges

type RentalEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Car holds the value of the car edge.
	Car *Car `json:"car,omitempty"`
	// contains filtered or unexported fields
}

RentalEdges holds the relations/edges for other nodes in the graph.

func (RentalEdges) CarOrErr

func (e RentalEdges) CarOrErr() (*Car, error)

CarOrErr returns the Car value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (RentalEdges) UserOrErr

func (e RentalEdges) 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 RentalGroupBy

type RentalGroupBy struct {
	// contains filtered or unexported fields
}

RentalGroupBy is the group-by builder for Rental entities.

func (*RentalGroupBy) Aggregate

func (rgb *RentalGroupBy) Aggregate(fns ...AggregateFunc) *RentalGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*RentalGroupBy) Bool

func (s *RentalGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) BoolX

func (s *RentalGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RentalGroupBy) Bools

func (s *RentalGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) BoolsX

func (s *RentalGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RentalGroupBy) Float64

func (s *RentalGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) Float64X

func (s *RentalGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RentalGroupBy) Float64s

func (s *RentalGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) Float64sX

func (s *RentalGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RentalGroupBy) Int

func (s *RentalGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) IntX

func (s *RentalGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RentalGroupBy) Ints

func (s *RentalGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) IntsX

func (s *RentalGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RentalGroupBy) Scan

func (rgb *RentalGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*RentalGroupBy) ScanX

func (s *RentalGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RentalGroupBy) String

func (s *RentalGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) StringX

func (s *RentalGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RentalGroupBy) Strings

func (s *RentalGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RentalGroupBy) StringsX

func (s *RentalGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RentalMutation

type RentalMutation struct {
	// contains filtered or unexported fields
}

RentalMutation represents an operation that mutates the Rental nodes in the graph.

func (*RentalMutation) AddField

func (m *RentalMutation) 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 (*RentalMutation) AddedEdges

func (m *RentalMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*RentalMutation) AddedField

func (m *RentalMutation) 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 (*RentalMutation) AddedFields

func (m *RentalMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*RentalMutation) AddedIDs

func (m *RentalMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*RentalMutation) CarCleared

func (m *RentalMutation) CarCleared() bool

CarCleared reports if the "car" edge to the Car entity was cleared.

func (*RentalMutation) CarID

func (m *RentalMutation) CarID() (r uuid.UUID, exists bool)

CarID returns the value of the "car_id" field in the mutation.

func (*RentalMutation) CarIDs

func (m *RentalMutation) CarIDs() (ids []uuid.UUID)

CarIDs returns the "car" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CarID instead. It exists only for internal usage by the builders.

func (*RentalMutation) ClearCar

func (m *RentalMutation) ClearCar()

ClearCar clears the "car" edge to the Car entity.

func (*RentalMutation) ClearEdge

func (m *RentalMutation) 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 (*RentalMutation) ClearField

func (m *RentalMutation) 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 (*RentalMutation) ClearUser

func (m *RentalMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*RentalMutation) ClearedEdges

func (m *RentalMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*RentalMutation) ClearedFields

func (m *RentalMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (RentalMutation) Client

func (m RentalMutation) 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 (*RentalMutation) Date

func (m *RentalMutation) Date() (r time.Time, exists bool)

Date returns the value of the "date" field in the mutation.

func (*RentalMutation) EdgeCleared

func (m *RentalMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*RentalMutation) Field

func (m *RentalMutation) 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 (*RentalMutation) FieldCleared

func (m *RentalMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*RentalMutation) Fields

func (m *RentalMutation) 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 (*RentalMutation) ID

func (m *RentalMutation) 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 (*RentalMutation) IDs

func (m *RentalMutation) 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 (*RentalMutation) OldCarID

func (m *RentalMutation) OldCarID(ctx context.Context) (v uuid.UUID, err error)

OldCarID returns the old "car_id" field's value of the Rental entity. If the Rental 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 (*RentalMutation) OldDate

func (m *RentalMutation) OldDate(ctx context.Context) (v time.Time, err error)

OldDate returns the old "date" field's value of the Rental entity. If the Rental 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 (*RentalMutation) OldField

func (m *RentalMutation) 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 (*RentalMutation) OldUserID

func (m *RentalMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_id" field's value of the Rental entity. If the Rental 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 (*RentalMutation) Op

func (m *RentalMutation) Op() Op

Op returns the operation name.

func (*RentalMutation) RemovedEdges

func (m *RentalMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*RentalMutation) RemovedIDs

func (m *RentalMutation) 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 (*RentalMutation) ResetCar

func (m *RentalMutation) ResetCar()

ResetCar resets all changes to the "car" edge.

func (*RentalMutation) ResetCarID

func (m *RentalMutation) ResetCarID()

ResetCarID resets all changes to the "car_id" field.

func (*RentalMutation) ResetDate

func (m *RentalMutation) ResetDate()

ResetDate resets all changes to the "date" field.

func (*RentalMutation) ResetEdge

func (m *RentalMutation) 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 (*RentalMutation) ResetField

func (m *RentalMutation) 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 (*RentalMutation) ResetUser

func (m *RentalMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*RentalMutation) ResetUserID

func (m *RentalMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*RentalMutation) SetCarID

func (m *RentalMutation) SetCarID(u uuid.UUID)

SetCarID sets the "car_id" field.

func (*RentalMutation) SetDate

func (m *RentalMutation) SetDate(t time.Time)

SetDate sets the "date" field.

func (*RentalMutation) SetField

func (m *RentalMutation) 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 (*RentalMutation) SetUserID

func (m *RentalMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (RentalMutation) Tx

func (m RentalMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*RentalMutation) Type

func (m *RentalMutation) Type() string

Type returns the node type of this mutation (Rental).

func (*RentalMutation) UserCleared

func (m *RentalMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*RentalMutation) UserID

func (m *RentalMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*RentalMutation) UserIDs

func (m *RentalMutation) 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 (*RentalMutation) Where

func (m *RentalMutation) Where(ps ...predicate.Rental)

Where appends a list predicates to the RentalMutation builder.

type RentalQuery

type RentalQuery struct {
	// contains filtered or unexported fields
}

RentalQuery is the builder for querying Rental entities.

func (*RentalQuery) All

func (rq *RentalQuery) All(ctx context.Context) ([]*Rental, error)

All executes the query and returns a list of Rentals.

func (*RentalQuery) AllX

func (rq *RentalQuery) AllX(ctx context.Context) []*Rental

AllX is like All, but panics if an error occurs.

func (*RentalQuery) Clone

func (rq *RentalQuery) Clone() *RentalQuery

Clone returns a duplicate of the RentalQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*RentalQuery) Count

func (rq *RentalQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RentalQuery) CountX

func (rq *RentalQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*RentalQuery) Exist

func (rq *RentalQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*RentalQuery) ExistX

func (rq *RentalQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*RentalQuery) First

func (rq *RentalQuery) First(ctx context.Context) (*Rental, error)

First returns the first Rental entity from the query. Returns a *NotFoundError when no Rental was found.

func (*RentalQuery) FirstID

func (rq *RentalQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Rental ID from the query. Returns a *NotFoundError when no Rental ID was found.

func (*RentalQuery) FirstIDX

func (rq *RentalQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*RentalQuery) FirstX

func (rq *RentalQuery) FirstX(ctx context.Context) *Rental

FirstX is like First, but panics if an error occurs.

func (*RentalQuery) GroupBy

func (rq *RentalQuery) GroupBy(field string, fields ...string) *RentalGroupBy

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 {
	Date time.Time `json:"date,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Rental.Query().
	GroupBy(rental.FieldDate).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RentalQuery) IDs

func (rq *RentalQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Rental IDs.

func (*RentalQuery) IDsX

func (rq *RentalQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*RentalQuery) Limit

func (rq *RentalQuery) Limit(limit int) *RentalQuery

Limit adds a limit step to the query.

func (*RentalQuery) Offset

func (rq *RentalQuery) Offset(offset int) *RentalQuery

Offset adds an offset step to the query.

func (*RentalQuery) Only

func (rq *RentalQuery) Only(ctx context.Context) (*Rental, error)

Only returns a single Rental entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Rental entity is found. Returns a *NotFoundError when no Rental entities are found.

func (*RentalQuery) OnlyID

func (rq *RentalQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Rental ID in the query. Returns a *NotSingularError when more than one Rental ID is found. Returns a *NotFoundError when no entities are found.

func (*RentalQuery) OnlyIDX

func (rq *RentalQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*RentalQuery) OnlyX

func (rq *RentalQuery) OnlyX(ctx context.Context) *Rental

OnlyX is like Only, but panics if an error occurs.

func (*RentalQuery) Order

func (rq *RentalQuery) Order(o ...OrderFunc) *RentalQuery

Order adds an order step to the query.

func (*RentalQuery) QueryCar

func (rq *RentalQuery) QueryCar() *CarQuery

QueryCar chains the current query on the "car" edge.

func (*RentalQuery) QueryUser

func (rq *RentalQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*RentalQuery) Select

func (rq *RentalQuery) Select(fields ...string) *RentalSelect

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 {
	Date time.Time `json:"date,omitempty"`
}

client.Rental.Query().
	Select(rental.FieldDate).
	Scan(ctx, &v)

func (*RentalQuery) Unique

func (rq *RentalQuery) Unique(unique bool) *RentalQuery

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 (*RentalQuery) Where

func (rq *RentalQuery) Where(ps ...predicate.Rental) *RentalQuery

Where adds a new predicate for the RentalQuery builder.

func (*RentalQuery) WithCar

func (rq *RentalQuery) WithCar(opts ...func(*CarQuery)) *RentalQuery

WithCar tells the query-builder to eager-load the nodes that are connected to the "car" edge. The optional arguments are used to configure the query builder of the edge.

func (*RentalQuery) WithUser

func (rq *RentalQuery) WithUser(opts ...func(*UserQuery)) *RentalQuery

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 RentalSelect

type RentalSelect struct {
	*RentalQuery
	// contains filtered or unexported fields
}

RentalSelect is the builder for selecting fields of Rental entities.

func (*RentalSelect) Bool

func (s *RentalSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*RentalSelect) BoolX

func (s *RentalSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RentalSelect) Bools

func (s *RentalSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*RentalSelect) BoolsX

func (s *RentalSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RentalSelect) Float64

func (s *RentalSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*RentalSelect) Float64X

func (s *RentalSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RentalSelect) Float64s

func (s *RentalSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*RentalSelect) Float64sX

func (s *RentalSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RentalSelect) Int

func (s *RentalSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*RentalSelect) IntX

func (s *RentalSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RentalSelect) Ints

func (s *RentalSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*RentalSelect) IntsX

func (s *RentalSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*RentalSelect) Scan

func (rs *RentalSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*RentalSelect) ScanX

func (s *RentalSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RentalSelect) String

func (s *RentalSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*RentalSelect) StringX

func (s *RentalSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RentalSelect) Strings

func (s *RentalSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*RentalSelect) StringsX

func (s *RentalSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type RentalUpdate

type RentalUpdate struct {
	// contains filtered or unexported fields
}

RentalUpdate is the builder for updating Rental entities.

func (*RentalUpdate) ClearCar

func (ru *RentalUpdate) ClearCar() *RentalUpdate

ClearCar clears the "car" edge to the Car entity.

func (*RentalUpdate) ClearUser

func (ru *RentalUpdate) ClearUser() *RentalUpdate

ClearUser clears the "user" edge to the User entity.

func (*RentalUpdate) Exec

func (ru *RentalUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalUpdate) ExecX

func (ru *RentalUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RentalUpdate) Mutation

func (ru *RentalUpdate) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalUpdate) Save

func (ru *RentalUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*RentalUpdate) SaveX

func (ru *RentalUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*RentalUpdate) SetCar

func (ru *RentalUpdate) SetCar(c *Car) *RentalUpdate

SetCar sets the "car" edge to the Car entity.

func (*RentalUpdate) SetCarID

func (ru *RentalUpdate) SetCarID(u uuid.UUID) *RentalUpdate

SetCarID sets the "car_id" field.

func (*RentalUpdate) SetDate

func (ru *RentalUpdate) SetDate(t time.Time) *RentalUpdate

SetDate sets the "date" field.

func (*RentalUpdate) SetNillableDate

func (ru *RentalUpdate) SetNillableDate(t *time.Time) *RentalUpdate

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalUpdate) SetUser

func (ru *RentalUpdate) SetUser(u *User) *RentalUpdate

SetUser sets the "user" edge to the User entity.

func (*RentalUpdate) SetUserID

func (ru *RentalUpdate) SetUserID(i int) *RentalUpdate

SetUserID sets the "user_id" field.

func (*RentalUpdate) Where

func (ru *RentalUpdate) Where(ps ...predicate.Rental) *RentalUpdate

Where appends a list predicates to the RentalUpdate builder.

type RentalUpdateOne

type RentalUpdateOne struct {
	// contains filtered or unexported fields
}

RentalUpdateOne is the builder for updating a single Rental entity.

func (*RentalUpdateOne) ClearCar

func (ruo *RentalUpdateOne) ClearCar() *RentalUpdateOne

ClearCar clears the "car" edge to the Car entity.

func (*RentalUpdateOne) ClearUser

func (ruo *RentalUpdateOne) ClearUser() *RentalUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*RentalUpdateOne) Exec

func (ruo *RentalUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RentalUpdateOne) ExecX

func (ruo *RentalUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*RentalUpdateOne) Mutation

func (ruo *RentalUpdateOne) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalUpdateOne) Save

func (ruo *RentalUpdateOne) Save(ctx context.Context) (*Rental, error)

Save executes the query and returns the updated Rental entity.

func (*RentalUpdateOne) SaveX

func (ruo *RentalUpdateOne) SaveX(ctx context.Context) *Rental

SaveX is like Save, but panics if an error occurs.

func (*RentalUpdateOne) Select

func (ruo *RentalUpdateOne) Select(field string, fields ...string) *RentalUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*RentalUpdateOne) SetCar

func (ruo *RentalUpdateOne) SetCar(c *Car) *RentalUpdateOne

SetCar sets the "car" edge to the Car entity.

func (*RentalUpdateOne) SetCarID

func (ruo *RentalUpdateOne) SetCarID(u uuid.UUID) *RentalUpdateOne

SetCarID sets the "car_id" field.

func (*RentalUpdateOne) SetDate

func (ruo *RentalUpdateOne) SetDate(t time.Time) *RentalUpdateOne

SetDate sets the "date" field.

func (*RentalUpdateOne) SetNillableDate

func (ruo *RentalUpdateOne) SetNillableDate(t *time.Time) *RentalUpdateOne

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalUpdateOne) SetUser

func (ruo *RentalUpdateOne) SetUser(u *User) *RentalUpdateOne

SetUser sets the "user" edge to the User entity.

func (*RentalUpdateOne) SetUserID

func (ruo *RentalUpdateOne) SetUserID(i int) *RentalUpdateOne

SetUserID sets the "user_id" field.

type Rentals

type Rentals []*Rental

Rentals is a parsable slice of Rental.

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 Tx

type Tx struct {

	// Car is the client for interacting with the Car builders.
	Car *CarClient
	// Card is the client for interacting with the Card builders.
	Card *CardClient
	// Info is the client for interacting with the Info builders.
	Info *InfoClient
	// Metadata is the client for interacting with the Metadata builders.
	Metadata *MetadataClient
	// Node is the client for interacting with the Node builders.
	Node *NodeClient
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Rental is the client for interacting with the Rental builders.
	Rental *RentalClient
	// 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"`
	// ParentID holds the value of the "parent_id" field.
	ParentID int `json:"parent_id,omitempty"`
	// SpouseID holds the value of the "spouse_id" field.
	SpouseID int `json:"spouse_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryCard

func (u *User) QueryCard() *CardQuery

QueryCard queries the "card" edge of the User entity.

func (*User) QueryChildren

func (u *User) QueryChildren() *UserQuery

QueryChildren queries the "children" edge of the User entity.

func (*User) QueryInfo

func (u *User) QueryInfo() *InfoQuery

QueryInfo queries the "info" edge of the User entity.

func (*User) QueryMetadata

func (u *User) QueryMetadata() *MetadataQuery

QueryMetadata queries the "metadata" edge of the User entity.

func (*User) QueryParent

func (u *User) QueryParent() *UserQuery

QueryParent queries the "parent" edge of the User entity.

func (*User) QueryPets

func (u *User) QueryPets() *PetQuery

QueryPets queries the "pets" edge of the User entity.

func (*User) QueryRentals

func (u *User) QueryRentals() *RentalQuery

QueryRentals queries the "rentals" edge of the User entity.

func (*User) QuerySpouse

func (u *User) QuerySpouse() *UserQuery

QuerySpouse queries the "spouse" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

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 delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a delete builder for the given 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) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryCard

func (c *UserClient) QueryCard(u *User) *CardQuery

QueryCard queries the card edge of a User.

func (*UserClient) QueryChildren

func (c *UserClient) QueryChildren(u *User) *UserQuery

QueryChildren queries the children edge of a User.

func (*UserClient) QueryInfo

func (c *UserClient) QueryInfo(u *User) *InfoQuery

QueryInfo queries the info edge of a User.

func (*UserClient) QueryMetadata

func (c *UserClient) QueryMetadata(u *User) *MetadataQuery

QueryMetadata queries the metadata edge of a User.

func (*UserClient) QueryParent

func (c *UserClient) QueryParent(u *User) *UserQuery

QueryParent queries the parent edge of a User.

func (*UserClient) QueryPets

func (c *UserClient) QueryPets(u *User) *PetQuery

QueryPets queries the pets edge of a User.

func (*UserClient) QueryRentals

func (c *UserClient) QueryRentals(u *User) *RentalQuery

QueryRentals queries the rentals edge of a User.

func (*UserClient) QuerySpouse

func (c *UserClient) QuerySpouse(u *User) *UserQuery

QuerySpouse queries the spouse 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) AddChildIDs

func (uc *UserCreate) AddChildIDs(ids ...int) *UserCreate

AddChildIDs adds the "children" edge to the User entity by IDs.

func (*UserCreate) AddChildren

func (uc *UserCreate) AddChildren(u ...*User) *UserCreate

AddChildren adds the "children" edges to the User entity.

func (*UserCreate) AddInfo

func (uc *UserCreate) AddInfo(i ...*Info) *UserCreate

AddInfo adds the "info" edges to the Info entity.

func (*UserCreate) AddInfoIDs

func (uc *UserCreate) AddInfoIDs(ids ...int) *UserCreate

AddInfoIDs adds the "info" edge to the Info entity by IDs.

func (*UserCreate) AddPetIDs

func (uc *UserCreate) AddPetIDs(ids ...int) *UserCreate

AddPetIDs adds the "pets" edge to the Pet entity by IDs.

func (*UserCreate) AddPets

func (uc *UserCreate) AddPets(p ...*Pet) *UserCreate

AddPets adds the "pets" edges to the Pet entity.

func (*UserCreate) AddRentalIDs

func (uc *UserCreate) AddRentalIDs(ids ...int) *UserCreate

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*UserCreate) AddRentals

func (uc *UserCreate) AddRentals(r ...*Rental) *UserCreate

AddRentals adds the "rentals" edges to the Rental 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) SetCard

func (uc *UserCreate) SetCard(c *Card) *UserCreate

SetCard sets the "card" edge to the Card entity.

func (*UserCreate) SetCardID

func (uc *UserCreate) SetCardID(id int) *UserCreate

SetCardID sets the "card" edge to the Card entity by ID.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(i int) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetMetadata

func (uc *UserCreate) SetMetadata(m *Metadata) *UserCreate

SetMetadata sets the "metadata" edge to the Metadata entity.

func (*UserCreate) SetMetadataID

func (uc *UserCreate) SetMetadataID(id int) *UserCreate

SetMetadataID sets the "metadata" edge to the Metadata entity by ID.

func (*UserCreate) SetNillableCardID

func (uc *UserCreate) SetNillableCardID(id *int) *UserCreate

SetNillableCardID sets the "card" edge to the Card entity by ID if the given value is not nil.

func (*UserCreate) SetNillableMetadataID

func (uc *UserCreate) SetNillableMetadataID(id *int) *UserCreate

SetNillableMetadataID sets the "metadata" edge to the Metadata entity by ID if the given value is not nil.

func (*UserCreate) SetNillableParentID

func (uc *UserCreate) SetNillableParentID(i *int) *UserCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*UserCreate) SetNillableSpouseID

func (uc *UserCreate) SetNillableSpouseID(i *int) *UserCreate

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*UserCreate) SetParent

func (uc *UserCreate) SetParent(u *User) *UserCreate

SetParent sets the "parent" edge to the User entity.

func (*UserCreate) SetParentID

func (uc *UserCreate) SetParentID(i int) *UserCreate

SetParentID sets the "parent_id" field.

func (*UserCreate) SetSpouse

func (uc *UserCreate) SetSpouse(u *User) *UserCreate

SetSpouse sets the "spouse" edge to the User entity.

func (*UserCreate) SetSpouseID

func (uc *UserCreate) SetSpouseID(i int) *UserCreate

SetSpouseID sets the "spouse_id" 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.

type UserEdges

type UserEdges struct {
	// Pets holds the value of the pets edge.
	Pets []*Pet `json:"pets,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *User `json:"parent,omitempty"`
	// Children holds the value of the children edge.
	Children []*User `json:"children,omitempty"`
	// Spouse holds the value of the spouse edge.
	Spouse *User `json:"spouse,omitempty"`
	// Card holds the value of the card edge.
	Card *Card `json:"card,omitempty"`
	// Metadata holds the value of the metadata edge.
	Metadata *Metadata `json:"metadata,omitempty"`
	// Info holds the value of the info edge.
	Info []*Info `json:"info,omitempty"`
	// Rentals holds the value of the rentals edge.
	Rentals []*Rental `json:"rentals,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) CardOrErr

func (e UserEdges) CardOrErr() (*Card, error)

CardOrErr returns the Card value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) ChildrenOrErr

func (e UserEdges) ChildrenOrErr() ([]*User, error)

ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.

func (UserEdges) InfoOrErr

func (e UserEdges) InfoOrErr() ([]*Info, error)

InfoOrErr returns the Info value or an error if the edge was not loaded in eager-loading.

func (UserEdges) MetadataOrErr

func (e UserEdges) MetadataOrErr() (*Metadata, error)

MetadataOrErr returns the Metadata value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) ParentOrErr

func (e UserEdges) ParentOrErr() (*User, error)

ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (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.

func (UserEdges) RentalsOrErr

func (e UserEdges) RentalsOrErr() ([]*Rental, error)

RentalsOrErr returns the Rentals value or an error if the edge was not loaded in eager-loading.

func (UserEdges) SpouseOrErr

func (e UserEdges) SpouseOrErr() (*User, error)

SpouseOrErr returns the Spouse value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

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 interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v interface{})

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) AddChildIDs

func (m *UserMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the User entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddInfoIDs

func (m *UserMutation) AddInfoIDs(ids ...int)

AddInfoIDs adds the "info" edge to the Info 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) AddRentalIDs

func (m *UserMutation) AddRentalIDs(ids ...int)

AddRentalIDs adds the "rentals" edge to the Rental 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) CardCleared

func (m *UserMutation) CardCleared() bool

CardCleared reports if the "card" edge to the Card entity was cleared.

func (*UserMutation) CardID

func (m *UserMutation) CardID() (id int, exists bool)

CardID returns the "card" edge ID in the mutation.

func (*UserMutation) CardIDs

func (m *UserMutation) CardIDs() (ids []int)

CardIDs returns the "card" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use CardID instead. It exists only for internal usage by the builders.

func (*UserMutation) ChildrenCleared

func (m *UserMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the User entity was cleared.

func (*UserMutation) ChildrenIDs

func (m *UserMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*UserMutation) ClearCard

func (m *UserMutation) ClearCard()

ClearCard clears the "card" edge to the Card entity.

func (*UserMutation) ClearChildren

func (m *UserMutation) ClearChildren()

ClearChildren clears the "children" edge to the User entity.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) 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) ClearInfo

func (m *UserMutation) ClearInfo()

ClearInfo clears the "info" edge to the Info entity.

func (*UserMutation) ClearMetadata

func (m *UserMutation) ClearMetadata()

ClearMetadata clears the "metadata" edge to the Metadata entity.

func (*UserMutation) ClearParent

func (m *UserMutation) ClearParent()

ClearParent clears the "parent" edge to the User entity.

func (*UserMutation) ClearParentID

func (m *UserMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*UserMutation) ClearPets

func (m *UserMutation) ClearPets()

ClearPets clears the "pets" edge to the Pet entity.

func (*UserMutation) ClearRentals

func (m *UserMutation) ClearRentals()

ClearRentals clears the "rentals" edge to the Rental entity.

func (*UserMutation) ClearSpouse

func (m *UserMutation) ClearSpouse()

ClearSpouse clears the "spouse" edge to the User entity.

func (*UserMutation) ClearSpouseID

func (m *UserMutation) ClearSpouseID()

ClearSpouseID clears the value of the "spouse_id" 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) 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) 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) 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) InfoCleared

func (m *UserMutation) InfoCleared() bool

InfoCleared reports if the "info" edge to the Info entity was cleared.

func (*UserMutation) InfoIDs

func (m *UserMutation) InfoIDs() (ids []int)

InfoIDs returns the "info" edge IDs in the mutation.

func (*UserMutation) MetadataCleared

func (m *UserMutation) MetadataCleared() bool

MetadataCleared reports if the "metadata" edge to the Metadata entity was cleared.

func (*UserMutation) MetadataID

func (m *UserMutation) MetadataID() (id int, exists bool)

MetadataID returns the "metadata" edge ID in the mutation.

func (*UserMutation) MetadataIDs

func (m *UserMutation) MetadataIDs() (ids []int)

MetadataIDs returns the "metadata" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use MetadataID instead. It exists only for internal usage by the builders.

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) OldParentID

func (m *UserMutation) OldParentID(ctx context.Context) (v int, err error)

OldParentID returns the old "parent_id" 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) OldSpouseID

func (m *UserMutation) OldSpouseID(ctx context.Context) (v int, err error)

OldSpouseID returns the old "spouse_id" 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) ParentCleared

func (m *UserMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the User entity was cleared.

func (*UserMutation) ParentID

func (m *UserMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*UserMutation) ParentIDCleared

func (m *UserMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*UserMutation) ParentIDs

func (m *UserMutation) ParentIDs() (ids []int)

ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.

func (*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) RemoveChildIDs

func (m *UserMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the User entity by IDs.

func (*UserMutation) RemoveInfoIDs

func (m *UserMutation) RemoveInfoIDs(ids ...int)

RemoveInfoIDs removes the "info" edge to the Info 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) RemoveRentalIDs

func (m *UserMutation) RemoveRentalIDs(ids ...int)

RemoveRentalIDs removes the "rentals" edge to the Rental entity by IDs.

func (*UserMutation) RemovedChildrenIDs

func (m *UserMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the User entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedInfoIDs

func (m *UserMutation) RemovedInfoIDs() (ids []int)

RemovedInfo returns the removed IDs of the "info" edge to the Info entity.

func (*UserMutation) RemovedPetsIDs

func (m *UserMutation) RemovedPetsIDs() (ids []int)

RemovedPets returns the removed IDs of the "pets" edge to the Pet entity.

func (*UserMutation) RemovedRentalsIDs

func (m *UserMutation) RemovedRentalsIDs() (ids []int)

RemovedRentals returns the removed IDs of the "rentals" edge to the Rental entity.

func (*UserMutation) RentalsCleared

func (m *UserMutation) RentalsCleared() bool

RentalsCleared reports if the "rentals" edge to the Rental entity was cleared.

func (*UserMutation) RentalsIDs

func (m *UserMutation) RentalsIDs() (ids []int)

RentalsIDs returns the "rentals" edge IDs in the mutation.

func (*UserMutation) ResetCard

func (m *UserMutation) ResetCard()

ResetCard resets all changes to the "card" edge.

func (*UserMutation) ResetChildren

func (m *UserMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) 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) ResetInfo

func (m *UserMutation) ResetInfo()

ResetInfo resets all changes to the "info" edge.

func (*UserMutation) ResetMetadata

func (m *UserMutation) ResetMetadata()

ResetMetadata resets all changes to the "metadata" edge.

func (*UserMutation) ResetParent

func (m *UserMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*UserMutation) ResetParentID

func (m *UserMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*UserMutation) ResetPets

func (m *UserMutation) ResetPets()

ResetPets resets all changes to the "pets" edge.

func (*UserMutation) ResetRentals

func (m *UserMutation) ResetRentals()

ResetRentals resets all changes to the "rentals" edge.

func (*UserMutation) ResetSpouse

func (m *UserMutation) ResetSpouse()

ResetSpouse resets all changes to the "spouse" edge.

func (*UserMutation) ResetSpouseID

func (m *UserMutation) ResetSpouseID()

ResetSpouseID resets all changes to the "spouse_id" field.

func (*UserMutation) SetCardID

func (m *UserMutation) SetCardID(id int)

SetCardID sets the "card" edge to the Card entity by id.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) 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) SetMetadataID

func (m *UserMutation) SetMetadataID(id int)

SetMetadataID sets the "metadata" edge to the Metadata entity by id.

func (*UserMutation) SetParentID

func (m *UserMutation) SetParentID(i int)

SetParentID sets the "parent_id" field.

func (*UserMutation) SetSpouseID

func (m *UserMutation) SetSpouseID(i int)

SetSpouseID sets the "spouse_id" field.

func (*UserMutation) SpouseCleared

func (m *UserMutation) SpouseCleared() bool

SpouseCleared reports if the "spouse" edge to the User entity was cleared.

func (*UserMutation) SpouseID

func (m *UserMutation) SpouseID() (r int, exists bool)

SpouseID returns the value of the "spouse_id" field in the mutation.

func (*UserMutation) SpouseIDCleared

func (m *UserMutation) SpouseIDCleared() bool

SpouseIDCleared returns if the "spouse_id" field was cleared in this mutation.

func (*UserMutation) SpouseIDs

func (m *UserMutation) SpouseIDs() (ids []int)

SpouseIDs returns the "spouse" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use SpouseID instead. It exists only for internal usage by the builders.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

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 {
	ParentID int `json:"parent_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldParentID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, 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 adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryCard

func (uq *UserQuery) QueryCard() *CardQuery

QueryCard chains the current query on the "card" edge.

func (*UserQuery) QueryChildren

func (uq *UserQuery) QueryChildren() *UserQuery

QueryChildren chains the current query on the "children" edge.

func (*UserQuery) QueryInfo

func (uq *UserQuery) QueryInfo() *InfoQuery

QueryInfo chains the current query on the "info" edge.

func (*UserQuery) QueryMetadata

func (uq *UserQuery) QueryMetadata() *MetadataQuery

QueryMetadata chains the current query on the "metadata" edge.

func (*UserQuery) QueryParent

func (uq *UserQuery) QueryParent() *UserQuery

QueryParent chains the current query on the "parent" edge.

func (*UserQuery) QueryPets

func (uq *UserQuery) QueryPets() *PetQuery

QueryPets chains the current query on the "pets" edge.

func (*UserQuery) QueryRentals

func (uq *UserQuery) QueryRentals() *RentalQuery

QueryRentals chains the current query on the "rentals" edge.

func (*UserQuery) QuerySpouse

func (uq *UserQuery) QuerySpouse() *UserQuery

QuerySpouse chains the current query on the "spouse" 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 {
	ParentID int `json:"parent_id,omitempty"`
}

client.User.Query().
	Select(user.FieldParentID).
	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) WithCard

func (uq *UserQuery) WithCard(opts ...func(*CardQuery)) *UserQuery

WithCard tells the query-builder to eager-load the nodes that are connected to the "card" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithChildren

func (uq *UserQuery) WithChildren(opts ...func(*UserQuery)) *UserQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithInfo

func (uq *UserQuery) WithInfo(opts ...func(*InfoQuery)) *UserQuery

WithInfo tells the query-builder to eager-load the nodes that are connected to the "info" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithMetadata

func (uq *UserQuery) WithMetadata(opts ...func(*MetadataQuery)) *UserQuery

WithMetadata tells the query-builder to eager-load the nodes that are connected to the "metadata" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithParent

func (uq *UserQuery) WithParent(opts ...func(*UserQuery)) *UserQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

func (*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.

func (*UserQuery) WithRentals

func (uq *UserQuery) WithRentals(opts ...func(*RentalQuery)) *UserQuery

WithRentals tells the query-builder to eager-load the nodes that are connected to the "rentals" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithSpouse

func (uq *UserQuery) WithSpouse(opts ...func(*UserQuery)) *UserQuery

WithSpouse tells the query-builder to eager-load the nodes that are connected to the "spouse" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

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 interface{}) 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 interface{})

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) AddChildIDs

func (uu *UserUpdate) AddChildIDs(ids ...int) *UserUpdate

AddChildIDs adds the "children" edge to the User entity by IDs.

func (*UserUpdate) AddChildren

func (uu *UserUpdate) AddChildren(u ...*User) *UserUpdate

AddChildren adds the "children" edges to the User entity.

func (*UserUpdate) AddInfo

func (uu *UserUpdate) AddInfo(i ...*Info) *UserUpdate

AddInfo adds the "info" edges to the Info entity.

func (*UserUpdate) AddInfoIDs

func (uu *UserUpdate) AddInfoIDs(ids ...int) *UserUpdate

AddInfoIDs adds the "info" edge to the Info entity by IDs.

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) AddRentalIDs

func (uu *UserUpdate) AddRentalIDs(ids ...int) *UserUpdate

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*UserUpdate) AddRentals

func (uu *UserUpdate) AddRentals(r ...*Rental) *UserUpdate

AddRentals adds the "rentals" edges to the Rental entity.

func (*UserUpdate) ClearCard

func (uu *UserUpdate) ClearCard() *UserUpdate

ClearCard clears the "card" edge to the Card entity.

func (*UserUpdate) ClearChildren

func (uu *UserUpdate) ClearChildren() *UserUpdate

ClearChildren clears all "children" edges to the User entity.

func (*UserUpdate) ClearInfo

func (uu *UserUpdate) ClearInfo() *UserUpdate

ClearInfo clears all "info" edges to the Info entity.

func (*UserUpdate) ClearMetadata

func (uu *UserUpdate) ClearMetadata() *UserUpdate

ClearMetadata clears the "metadata" edge to the Metadata entity.

func (*UserUpdate) ClearParent

func (uu *UserUpdate) ClearParent() *UserUpdate

ClearParent clears the "parent" edge to the User entity.

func (*UserUpdate) ClearParentID

func (uu *UserUpdate) ClearParentID() *UserUpdate

ClearParentID clears the value of the "parent_id" field.

func (*UserUpdate) ClearPets

func (uu *UserUpdate) ClearPets() *UserUpdate

ClearPets clears all "pets" edges to the Pet entity.

func (*UserUpdate) ClearRentals

func (uu *UserUpdate) ClearRentals() *UserUpdate

ClearRentals clears all "rentals" edges to the Rental entity.

func (*UserUpdate) ClearSpouse

func (uu *UserUpdate) ClearSpouse() *UserUpdate

ClearSpouse clears the "spouse" edge to the User entity.

func (*UserUpdate) ClearSpouseID

func (uu *UserUpdate) ClearSpouseID() *UserUpdate

ClearSpouseID clears the value of the "spouse_id" 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) RemoveChildIDs

func (uu *UserUpdate) RemoveChildIDs(ids ...int) *UserUpdate

RemoveChildIDs removes the "children" edge to User entities by IDs.

func (*UserUpdate) RemoveChildren

func (uu *UserUpdate) RemoveChildren(u ...*User) *UserUpdate

RemoveChildren removes "children" edges to User entities.

func (*UserUpdate) RemoveInfo

func (uu *UserUpdate) RemoveInfo(i ...*Info) *UserUpdate

RemoveInfo removes "info" edges to Info entities.

func (*UserUpdate) RemoveInfoIDs

func (uu *UserUpdate) RemoveInfoIDs(ids ...int) *UserUpdate

RemoveInfoIDs removes the "info" edge to Info entities by IDs.

func (*UserUpdate) RemovePetIDs

func (uu *UserUpdate) RemovePetIDs(ids ...int) *UserUpdate

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*UserUpdate) RemovePets

func (uu *UserUpdate) RemovePets(p ...*Pet) *UserUpdate

RemovePets removes "pets" edges to Pet entities.

func (*UserUpdate) RemoveRentalIDs

func (uu *UserUpdate) RemoveRentalIDs(ids ...int) *UserUpdate

RemoveRentalIDs removes the "rentals" edge to Rental entities by IDs.

func (*UserUpdate) RemoveRentals

func (uu *UserUpdate) RemoveRentals(r ...*Rental) *UserUpdate

RemoveRentals removes "rentals" edges to Rental 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) SetCard

func (uu *UserUpdate) SetCard(c *Card) *UserUpdate

SetCard sets the "card" edge to the Card entity.

func (*UserUpdate) SetCardID

func (uu *UserUpdate) SetCardID(id int) *UserUpdate

SetCardID sets the "card" edge to the Card entity by ID.

func (*UserUpdate) SetMetadata

func (uu *UserUpdate) SetMetadata(m *Metadata) *UserUpdate

SetMetadata sets the "metadata" edge to the Metadata entity.

func (*UserUpdate) SetMetadataID

func (uu *UserUpdate) SetMetadataID(id int) *UserUpdate

SetMetadataID sets the "metadata" edge to the Metadata entity by ID.

func (*UserUpdate) SetNillableCardID

func (uu *UserUpdate) SetNillableCardID(id *int) *UserUpdate

SetNillableCardID sets the "card" edge to the Card entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableMetadataID

func (uu *UserUpdate) SetNillableMetadataID(id *int) *UserUpdate

SetNillableMetadataID sets the "metadata" edge to the Metadata entity by ID if the given value is not nil.

func (*UserUpdate) SetNillableParentID

func (uu *UserUpdate) SetNillableParentID(i *int) *UserUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*UserUpdate) SetNillableSpouseID

func (uu *UserUpdate) SetNillableSpouseID(i *int) *UserUpdate

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*UserUpdate) SetParent

func (uu *UserUpdate) SetParent(u *User) *UserUpdate

SetParent sets the "parent" edge to the User entity.

func (*UserUpdate) SetParentID

func (uu *UserUpdate) SetParentID(i int) *UserUpdate

SetParentID sets the "parent_id" field.

func (*UserUpdate) SetSpouse

func (uu *UserUpdate) SetSpouse(u *User) *UserUpdate

SetSpouse sets the "spouse" edge to the User entity.

func (*UserUpdate) SetSpouseID

func (uu *UserUpdate) SetSpouseID(i int) *UserUpdate

SetSpouseID sets the "spouse_id" 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) AddChildIDs

func (uuo *UserUpdateOne) AddChildIDs(ids ...int) *UserUpdateOne

AddChildIDs adds the "children" edge to the User entity by IDs.

func (*UserUpdateOne) AddChildren

func (uuo *UserUpdateOne) AddChildren(u ...*User) *UserUpdateOne

AddChildren adds the "children" edges to the User entity.

func (*UserUpdateOne) AddInfo

func (uuo *UserUpdateOne) AddInfo(i ...*Info) *UserUpdateOne

AddInfo adds the "info" edges to the Info entity.

func (*UserUpdateOne) AddInfoIDs

func (uuo *UserUpdateOne) AddInfoIDs(ids ...int) *UserUpdateOne

AddInfoIDs adds the "info" edge to the Info entity by IDs.

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) AddRentalIDs

func (uuo *UserUpdateOne) AddRentalIDs(ids ...int) *UserUpdateOne

AddRentalIDs adds the "rentals" edge to the Rental entity by IDs.

func (*UserUpdateOne) AddRentals

func (uuo *UserUpdateOne) AddRentals(r ...*Rental) *UserUpdateOne

AddRentals adds the "rentals" edges to the Rental entity.

func (*UserUpdateOne) ClearCard

func (uuo *UserUpdateOne) ClearCard() *UserUpdateOne

ClearCard clears the "card" edge to the Card entity.

func (*UserUpdateOne) ClearChildren

func (uuo *UserUpdateOne) ClearChildren() *UserUpdateOne

ClearChildren clears all "children" edges to the User entity.

func (*UserUpdateOne) ClearInfo

func (uuo *UserUpdateOne) ClearInfo() *UserUpdateOne

ClearInfo clears all "info" edges to the Info entity.

func (*UserUpdateOne) ClearMetadata

func (uuo *UserUpdateOne) ClearMetadata() *UserUpdateOne

ClearMetadata clears the "metadata" edge to the Metadata entity.

func (*UserUpdateOne) ClearParent

func (uuo *UserUpdateOne) ClearParent() *UserUpdateOne

ClearParent clears the "parent" edge to the User entity.

func (*UserUpdateOne) ClearParentID

func (uuo *UserUpdateOne) ClearParentID() *UserUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*UserUpdateOne) ClearPets

func (uuo *UserUpdateOne) ClearPets() *UserUpdateOne

ClearPets clears all "pets" edges to the Pet entity.

func (*UserUpdateOne) ClearRentals

func (uuo *UserUpdateOne) ClearRentals() *UserUpdateOne

ClearRentals clears all "rentals" edges to the Rental entity.

func (*UserUpdateOne) ClearSpouse

func (uuo *UserUpdateOne) ClearSpouse() *UserUpdateOne

ClearSpouse clears the "spouse" edge to the User entity.

func (*UserUpdateOne) ClearSpouseID

func (uuo *UserUpdateOne) ClearSpouseID() *UserUpdateOne

ClearSpouseID clears the value of the "spouse_id" 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) RemoveChildIDs

func (uuo *UserUpdateOne) RemoveChildIDs(ids ...int) *UserUpdateOne

RemoveChildIDs removes the "children" edge to User entities by IDs.

func (*UserUpdateOne) RemoveChildren

func (uuo *UserUpdateOne) RemoveChildren(u ...*User) *UserUpdateOne

RemoveChildren removes "children" edges to User entities.

func (*UserUpdateOne) RemoveInfo

func (uuo *UserUpdateOne) RemoveInfo(i ...*Info) *UserUpdateOne

RemoveInfo removes "info" edges to Info entities.

func (*UserUpdateOne) RemoveInfoIDs

func (uuo *UserUpdateOne) RemoveInfoIDs(ids ...int) *UserUpdateOne

RemoveInfoIDs removes the "info" edge to Info entities by IDs.

func (*UserUpdateOne) RemovePetIDs

func (uuo *UserUpdateOne) RemovePetIDs(ids ...int) *UserUpdateOne

RemovePetIDs removes the "pets" edge to Pet entities by IDs.

func (*UserUpdateOne) RemovePets

func (uuo *UserUpdateOne) RemovePets(p ...*Pet) *UserUpdateOne

RemovePets removes "pets" edges to Pet entities.

func (*UserUpdateOne) RemoveRentalIDs

func (uuo *UserUpdateOne) RemoveRentalIDs(ids ...int) *UserUpdateOne

RemoveRentalIDs removes the "rentals" edge to Rental entities by IDs.

func (*UserUpdateOne) RemoveRentals

func (uuo *UserUpdateOne) RemoveRentals(r ...*Rental) *UserUpdateOne

RemoveRentals removes "rentals" edges to Rental 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) SetCard

func (uuo *UserUpdateOne) SetCard(c *Card) *UserUpdateOne

SetCard sets the "card" edge to the Card entity.

func (*UserUpdateOne) SetCardID

func (uuo *UserUpdateOne) SetCardID(id int) *UserUpdateOne

SetCardID sets the "card" edge to the Card entity by ID.

func (*UserUpdateOne) SetMetadata

func (uuo *UserUpdateOne) SetMetadata(m *Metadata) *UserUpdateOne

SetMetadata sets the "metadata" edge to the Metadata entity.

func (*UserUpdateOne) SetMetadataID

func (uuo *UserUpdateOne) SetMetadataID(id int) *UserUpdateOne

SetMetadataID sets the "metadata" edge to the Metadata entity by ID.

func (*UserUpdateOne) SetNillableCardID

func (uuo *UserUpdateOne) SetNillableCardID(id *int) *UserUpdateOne

SetNillableCardID sets the "card" edge to the Card entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableMetadataID

func (uuo *UserUpdateOne) SetNillableMetadataID(id *int) *UserUpdateOne

SetNillableMetadataID sets the "metadata" edge to the Metadata entity by ID if the given value is not nil.

func (*UserUpdateOne) SetNillableParentID

func (uuo *UserUpdateOne) SetNillableParentID(i *int) *UserUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*UserUpdateOne) SetNillableSpouseID

func (uuo *UserUpdateOne) SetNillableSpouseID(i *int) *UserUpdateOne

SetNillableSpouseID sets the "spouse_id" field if the given value is not nil.

func (*UserUpdateOne) SetParent

func (uuo *UserUpdateOne) SetParent(u *User) *UserUpdateOne

SetParent sets the "parent" edge to the User entity.

func (*UserUpdateOne) SetParentID

func (uuo *UserUpdateOne) SetParentID(i int) *UserUpdateOne

SetParentID sets the "parent_id" field.

func (*UserUpdateOne) SetSpouse

func (uuo *UserUpdateOne) SetSpouse(u *User) *UserUpdateOne

SetSpouse sets the "spouse" edge to the User entity.

func (*UserUpdateOne) SetSpouseID

func (uuo *UserUpdateOne) SetSpouseID(i int) *UserUpdateOne

SetSpouseID sets the "spouse_id" field.

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