ent

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 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 added in v0.9.0

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 added in v0.9.0

func (c *Car) QueryRentals() *RentalQuery

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

func (*Car) String added in v0.9.0

func (c *Car) String() string

String implements the fmt.Stringer.

func (*Car) Unwrap added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

CarClient is a client for the Car schema.

func NewCarClient added in v0.9.0

func NewCarClient(c config) *CarClient

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

func (*CarClient) Create added in v0.9.0

func (c *CarClient) Create() *CarCreate

Create returns a builder for creating a Car entity.

func (*CarClient) CreateBulk added in v0.9.0

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

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

func (*CarClient) Delete added in v0.9.0

func (c *CarClient) Delete() *CarDelete

Delete returns a delete builder for Car.

func (*CarClient) DeleteOne added in v0.9.0

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

DeleteOne returns a builder for deleting the given entity.

func (*CarClient) DeleteOneID added in v0.9.0

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

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

func (*CarClient) Get added in v0.9.0

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

Get returns a Car entity by its id.

func (*CarClient) GetX added in v0.9.0

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

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

func (*CarClient) Hooks added in v0.9.0

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

Hooks returns the client hooks.

func (*CarClient) Query added in v0.9.0

func (c *CarClient) Query() *CarQuery

Query returns a query builder for Car.

func (*CarClient) QueryRentals added in v0.9.0

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

QueryRentals queries the rentals edge of a Car.

func (*CarClient) Update added in v0.9.0

func (c *CarClient) Update() *CarUpdate

Update returns an update builder for Car.

func (*CarClient) UpdateOne added in v0.9.0

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

UpdateOne returns an update builder for the given entity.

func (*CarClient) UpdateOneID added in v0.9.0

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

UpdateOneID returns an update builder for the given id.

func (*CarClient) Use added in v0.9.0

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 added in v0.9.0

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

CarCreate is the builder for creating a Car entity.

func (*CarCreate) AddRentalIDs added in v0.9.0

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

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

func (*CarCreate) AddRentals added in v0.9.0

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

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

func (*CarCreate) Exec added in v0.9.0

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

Exec executes the query.

func (*CarCreate) ExecX added in v0.9.0

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

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

func (*CarCreate) Mutation added in v0.9.0

func (cc *CarCreate) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarCreate) Save added in v0.9.0

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

Save creates the Car in the database.

func (*CarCreate) SaveX added in v0.9.0

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

SaveX calls Save and panics if Save returns an error.

func (*CarCreate) SetID added in v0.9.0

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

SetID sets the "id" field.

func (*CarCreate) SetNillableID added in v0.10.0

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

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

func (*CarCreate) SetNillableNumber added in v0.9.0

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

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

func (*CarCreate) SetNumber added in v0.9.0

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

SetNumber sets the "number" field.

type CarCreateBulk added in v0.9.0

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

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

func (*CarCreateBulk) Exec added in v0.9.0

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

Exec executes the query.

func (*CarCreateBulk) ExecX added in v0.9.0

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

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

func (*CarCreateBulk) Save added in v0.9.0

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

Save creates the Car entities in the database.

func (*CarCreateBulk) SaveX added in v0.9.0

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

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

type CarDelete added in v0.9.0

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

CarDelete is the builder for deleting a Car entity.

func (*CarDelete) Exec added in v0.9.0

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

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

func (*CarDelete) ExecX added in v0.9.0

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

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

func (*CarDelete) Where added in v0.9.0

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

Where appends a list predicates to the CarDelete builder.

type CarDeleteOne added in v0.9.0

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

CarDeleteOne is the builder for deleting a single Car entity.

func (*CarDeleteOne) Exec added in v0.9.0

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

Exec executes the deletion query.

func (*CarDeleteOne) ExecX added in v0.9.0

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

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

type CarEdges added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

CarGroupBy is the group-by builder for Car entities.

func (*CarGroupBy) Aggregate added in v0.9.0

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

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

func (*CarGroupBy) Bool added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Bools added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Float64 added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Float64s added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Int added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Ints added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Scan added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) String added in v0.9.0

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 added in v0.9.0

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

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

func (*CarGroupBy) Strings added in v0.9.0

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 added in v0.9.0

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

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

type CarMutation added in v0.9.0

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

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

func (*CarMutation) AddField added in v0.9.0

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 added in v0.9.0

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

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

func (*CarMutation) AddedEdges added in v0.9.0

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

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

func (*CarMutation) AddedField added in v0.9.0

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 added in v0.9.0

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

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

func (*CarMutation) AddedIDs added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *CarMutation) ClearNumber()

ClearNumber clears the value of the "number" field.

func (*CarMutation) ClearRentals added in v0.9.0

func (m *CarMutation) ClearRentals()

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

func (*CarMutation) ClearedEdges added in v0.9.0

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

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

func (*CarMutation) ClearedFields added in v0.9.0

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

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

func (CarMutation) Client added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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

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

func (*CarMutation) NumberCleared added in v0.9.0

func (m *CarMutation) NumberCleared() bool

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

func (*CarMutation) OldField added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *CarMutation) Op() Op

Op returns the operation name.

func (*CarMutation) RemoveRentalIDs added in v0.9.0

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

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

func (*CarMutation) RemovedEdges added in v0.9.0

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

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

func (*CarMutation) RemovedIDs added in v0.9.0

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 added in v0.9.0

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

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

func (*CarMutation) RentalsCleared added in v0.9.0

func (m *CarMutation) RentalsCleared() bool

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

func (*CarMutation) RentalsIDs added in v0.9.0

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

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

func (*CarMutation) ResetEdge added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *CarMutation) ResetNumber()

ResetNumber resets all changes to the "number" field.

func (*CarMutation) ResetRentals added in v0.9.0

func (m *CarMutation) ResetRentals()

ResetRentals resets all changes to the "rentals" edge.

func (*CarMutation) SetField added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *CarMutation) SetNumber(s string)

SetNumber sets the "number" field.

func (CarMutation) Tx added in v0.9.0

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 added in v0.9.0

func (m *CarMutation) Type() string

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

func (*CarMutation) Where added in v0.9.0

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

Where appends a list predicates to the CarMutation builder.

type CarQuery added in v0.9.0

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

CarQuery is the builder for querying Car entities.

func (*CarQuery) All added in v0.9.0

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

All executes the query and returns a list of Cars.

func (*CarQuery) AllX added in v0.9.0

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

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

func (*CarQuery) Clone added in v0.9.0

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 added in v0.9.0

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

Count returns the count of the given query.

func (*CarQuery) CountX added in v0.9.0

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

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

func (*CarQuery) Exist added in v0.9.0

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

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

func (*CarQuery) ExistX added in v0.9.0

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

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

func (*CarQuery) First added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

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

func (*CarQuery) FirstX added in v0.9.0

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

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

func (*CarQuery) GroupBy added in v0.9.0

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 added in v0.9.0

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

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

func (*CarQuery) IDsX added in v0.9.0

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

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

func (*CarQuery) Limit added in v0.9.0

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

Limit adds a limit step to the query.

func (*CarQuery) Offset added in v0.9.0

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

Offset adds an offset step to the query.

func (*CarQuery) Only added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

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

func (*CarQuery) OnlyX added in v0.9.0

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

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

func (*CarQuery) Order added in v0.9.0

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

Order adds an order step to the query.

func (*CarQuery) QueryRentals added in v0.9.0

func (cq *CarQuery) QueryRentals() *RentalQuery

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

func (*CarQuery) Select added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

Where adds a new predicate for the CarQuery builder.

func (*CarQuery) WithRentals added in v0.9.0

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 added in v0.9.0

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

CarSelect is the builder for selecting fields of Car entities.

func (*CarSelect) Bool added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Bools added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Float64 added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Float64s added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Int added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Ints added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Scan added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) String added in v0.9.0

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 added in v0.9.0

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

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

func (*CarSelect) Strings added in v0.9.0

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 added in v0.9.0

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

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

type CarUpdate added in v0.9.0

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

CarUpdate is the builder for updating Car entities.

func (*CarUpdate) AddRentalIDs added in v0.9.0

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

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

func (*CarUpdate) AddRentals added in v0.9.0

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

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

func (*CarUpdate) ClearNumber added in v0.9.0

func (cu *CarUpdate) ClearNumber() *CarUpdate

ClearNumber clears the value of the "number" field.

func (*CarUpdate) ClearRentals added in v0.9.0

func (cu *CarUpdate) ClearRentals() *CarUpdate

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

func (*CarUpdate) Exec added in v0.9.0

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

Exec executes the query.

func (*CarUpdate) ExecX added in v0.9.0

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

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

func (*CarUpdate) Mutation added in v0.9.0

func (cu *CarUpdate) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarUpdate) RemoveRentalIDs added in v0.9.0

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

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

func (*CarUpdate) RemoveRentals added in v0.9.0

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

RemoveRentals removes "rentals" edges to Rental entities.

func (*CarUpdate) Save added in v0.9.0

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 added in v0.9.0

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

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

func (*CarUpdate) SetNillableNumber added in v0.9.0

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

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

func (*CarUpdate) SetNumber added in v0.9.0

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

SetNumber sets the "number" field.

func (*CarUpdate) Where added in v0.9.0

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

Where appends a list predicates to the CarUpdate builder.

type CarUpdateOne added in v0.9.0

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

CarUpdateOne is the builder for updating a single Car entity.

func (*CarUpdateOne) AddRentalIDs added in v0.9.0

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

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

func (*CarUpdateOne) AddRentals added in v0.9.0

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

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

func (*CarUpdateOne) ClearNumber added in v0.9.0

func (cuo *CarUpdateOne) ClearNumber() *CarUpdateOne

ClearNumber clears the value of the "number" field.

func (*CarUpdateOne) ClearRentals added in v0.9.0

func (cuo *CarUpdateOne) ClearRentals() *CarUpdateOne

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

func (*CarUpdateOne) Exec added in v0.9.0

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

Exec executes the query on the entity.

func (*CarUpdateOne) ExecX added in v0.9.0

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

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

func (*CarUpdateOne) Mutation added in v0.9.0

func (cuo *CarUpdateOne) Mutation() *CarMutation

Mutation returns the CarMutation object of the builder.

func (*CarUpdateOne) RemoveRentalIDs added in v0.9.0

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

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

func (*CarUpdateOne) RemoveRentals added in v0.9.0

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

RemoveRentals removes "rentals" edges to Rental entities.

func (*CarUpdateOne) Save added in v0.9.0

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

Save executes the query and returns the updated Car entity.

func (*CarUpdateOne) SaveX added in v0.9.0

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

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

func (*CarUpdateOne) Select added in v0.9.0

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 added in v0.9.0

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

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

func (*CarUpdateOne) SetNumber added in v0.9.0

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 builder for creating a Card entity.

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 builder for deleting the given entity.

func (*CardClient) DeleteOneID

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

DeleteOne returns a builder for deleting the given entity by its 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 added in v0.9.0

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

Exec executes the query.

func (*CardCreate) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

Exec executes the query.

func (*CardCreateBulk) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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

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

func (*CardMutation) NumberCleared added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 builder for creating a Info entity.

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 builder for deleting the given entity.

func (*InfoClient) DeleteOneID

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

DeleteOne returns a builder for deleting the given entity by its 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 added in v0.9.0

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

Exec executes the query.

func (*InfoCreate) ExecX added in v0.9.0

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 added in v0.9.0

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

Exec executes the query.

func (*InfoCreateBulk) ExecX added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.9.0

func (m *Metadata) QueryChildren() *MetadataQuery

QueryChildren queries the "children" edge of the Metadata entity.

func (*Metadata) QueryParent added in v0.9.0

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 builder for creating a Metadata entity.

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 builder for deleting the given entity.

func (*MetadataClient) DeleteOneID

func (c *MetadataClient) DeleteOneID(id int) *MetadataDeleteOne

DeleteOne returns a builder for deleting the given entity by its 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 added in v0.9.0

func (c *MetadataClient) QueryChildren(m *Metadata) *MetadataQuery

QueryChildren queries the children edge of a Metadata.

func (*MetadataClient) QueryParent added in v0.9.0

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 added in v0.9.0

func (mc *MetadataCreate) AddChildIDs(ids ...int) *MetadataCreate

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

func (*MetadataCreate) AddChildren added in v0.9.0

func (mc *MetadataCreate) AddChildren(m ...*Metadata) *MetadataCreate

AddChildren adds the "children" edges to the Metadata entity.

func (*MetadataCreate) Exec added in v0.9.0

func (mc *MetadataCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreate) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (mc *MetadataCreate) SetParent(m *Metadata) *MetadataCreate

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

func (*MetadataCreate) SetParentID added in v0.9.0

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 added in v0.9.0

func (mcb *MetadataCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MetadataCreateBulk) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *MetadataMutation) ChildrenCleared() bool

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

func (*MetadataMutation) ChildrenIDs added in v0.9.0

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

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

func (*MetadataMutation) ClearChildren added in v0.9.0

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 added in v0.9.0

func (m *MetadataMutation) ClearParent()

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

func (*MetadataMutation) ClearParentID added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.9.0

func (m *MetadataMutation) ParentCleared() bool

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

func (*MetadataMutation) ParentID added in v0.9.0

func (m *MetadataMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*MetadataMutation) ParentIDCleared added in v0.9.0

func (m *MetadataMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*MetadataMutation) ParentIDs added in v0.9.0

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 added in v0.9.0

func (m *MetadataMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Metadata entity by IDs.

func (*MetadataMutation) RemovedChildrenIDs added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *MetadataMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*MetadataMutation) ResetParentID added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (mq *MetadataQuery) QueryChildren() *MetadataQuery

QueryChildren chains the current query on the "children" edge.

func (*MetadataQuery) QueryParent added in v0.9.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (mu *MetadataUpdate) AddChildIDs(ids ...int) *MetadataUpdate

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

func (*MetadataUpdate) AddChildren added in v0.9.0

func (mu *MetadataUpdate) AddChildren(m ...*Metadata) *MetadataUpdate

AddChildren adds the "children" edges to the Metadata entity.

func (*MetadataUpdate) ClearChildren added in v0.9.0

func (mu *MetadataUpdate) ClearChildren() *MetadataUpdate

ClearChildren clears all "children" edges to the Metadata entity.

func (*MetadataUpdate) ClearParent added in v0.9.0

func (mu *MetadataUpdate) ClearParent() *MetadataUpdate

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

func (*MetadataUpdate) ClearParentID added in v0.9.0

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 added in v0.9.0

func (mu *MetadataUpdate) RemoveChildIDs(ids ...int) *MetadataUpdate

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

func (*MetadataUpdate) RemoveChildren added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (mu *MetadataUpdate) SetParent(m *Metadata) *MetadataUpdate

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

func (*MetadataUpdate) SetParentID added in v0.9.0

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 added in v0.9.0

func (muo *MetadataUpdateOne) AddChildIDs(ids ...int) *MetadataUpdateOne

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

func (*MetadataUpdateOne) AddChildren added in v0.9.0

func (muo *MetadataUpdateOne) AddChildren(m ...*Metadata) *MetadataUpdateOne

AddChildren adds the "children" edges to the Metadata entity.

func (*MetadataUpdateOne) ClearChildren added in v0.9.0

func (muo *MetadataUpdateOne) ClearChildren() *MetadataUpdateOne

ClearChildren clears all "children" edges to the Metadata entity.

func (*MetadataUpdateOne) ClearParent added in v0.9.0

func (muo *MetadataUpdateOne) ClearParent() *MetadataUpdateOne

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

func (*MetadataUpdateOne) ClearParentID added in v0.9.0

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 added in v0.9.0

func (muo *MetadataUpdateOne) RemoveChildIDs(ids ...int) *MetadataUpdateOne

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

func (*MetadataUpdateOne) RemoveChildren added in v0.9.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

func (muo *MetadataUpdateOne) SetParent(m *Metadata) *MetadataUpdateOne

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

func (*MetadataUpdateOne) SetParentID added in v0.9.0

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 added in v0.10.0

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 added in v0.10.0

func (n *Node) QueryNext() *NodeQuery

QueryNext queries the "next" edge of the Node entity.

func (*Node) QueryPrev added in v0.10.0

func (n *Node) QueryPrev() *NodeQuery

QueryPrev queries the "prev" edge of the Node entity.

func (*Node) String added in v0.10.0

func (n *Node) String() string

String implements the fmt.Stringer.

func (*Node) Unwrap added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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

NodeClient is a client for the Node schema.

func NewNodeClient added in v0.10.0

func NewNodeClient(c config) *NodeClient

NewNodeClient returns a client for the Node from the given config.

func (*NodeClient) Create added in v0.10.0

func (c *NodeClient) Create() *NodeCreate

Create returns a builder for creating a Node entity.

func (*NodeClient) CreateBulk added in v0.10.0

func (c *NodeClient) CreateBulk(builders ...*NodeCreate) *NodeCreateBulk

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

func (*NodeClient) Delete added in v0.10.0

func (c *NodeClient) Delete() *NodeDelete

Delete returns a delete builder for Node.

func (*NodeClient) DeleteOne added in v0.10.0

func (c *NodeClient) DeleteOne(n *Node) *NodeDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*NodeClient) DeleteOneID added in v0.10.0

func (c *NodeClient) DeleteOneID(id int) *NodeDeleteOne

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

func (*NodeClient) Get added in v0.10.0

func (c *NodeClient) Get(ctx context.Context, id int) (*Node, error)

Get returns a Node entity by its id.

func (*NodeClient) GetX added in v0.10.0

func (c *NodeClient) GetX(ctx context.Context, id int) *Node

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

func (*NodeClient) Hooks added in v0.10.0

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

Hooks returns the client hooks.

func (*NodeClient) Query added in v0.10.0

func (c *NodeClient) Query() *NodeQuery

Query returns a query builder for Node.

func (*NodeClient) QueryNext added in v0.10.0

func (c *NodeClient) QueryNext(n *Node) *NodeQuery

QueryNext queries the next edge of a Node.

func (*NodeClient) QueryPrev added in v0.10.0

func (c *NodeClient) QueryPrev(n *Node) *NodeQuery

QueryPrev queries the prev edge of a Node.

func (*NodeClient) Update added in v0.10.0

func (c *NodeClient) Update() *NodeUpdate

Update returns an update builder for Node.

func (*NodeClient) UpdateOne added in v0.10.0

func (c *NodeClient) UpdateOne(n *Node) *NodeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*NodeClient) UpdateOneID added in v0.10.0

func (c *NodeClient) UpdateOneID(id int) *NodeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*NodeClient) Use added in v0.10.0

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 added in v0.10.0

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

NodeCreate is the builder for creating a Node entity.

func (*NodeCreate) Exec added in v0.10.0

func (nc *NodeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreate) ExecX added in v0.10.0

func (nc *NodeCreate) ExecX(ctx context.Context)

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

func (*NodeCreate) Mutation added in v0.10.0

func (nc *NodeCreate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeCreate) Save added in v0.10.0

func (nc *NodeCreate) Save(ctx context.Context) (*Node, error)

Save creates the Node in the database.

func (*NodeCreate) SaveX added in v0.10.0

func (nc *NodeCreate) SaveX(ctx context.Context) *Node

SaveX calls Save and panics if Save returns an error.

func (*NodeCreate) SetNext added in v0.10.0

func (nc *NodeCreate) SetNext(n *Node) *NodeCreate

SetNext sets the "next" edge to the Node entity.

func (*NodeCreate) SetNextID added in v0.10.0

func (nc *NodeCreate) SetNextID(id int) *NodeCreate

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeCreate) SetNillableNextID added in v0.10.0

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 added in v0.10.0

func (nc *NodeCreate) SetNillablePrevID(i *int) *NodeCreate

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeCreate) SetNillableValue added in v0.10.0

func (nc *NodeCreate) SetNillableValue(i *int) *NodeCreate

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeCreate) SetPrev added in v0.10.0

func (nc *NodeCreate) SetPrev(n *Node) *NodeCreate

SetPrev sets the "prev" edge to the Node entity.

func (*NodeCreate) SetPrevID added in v0.10.0

func (nc *NodeCreate) SetPrevID(i int) *NodeCreate

SetPrevID sets the "prev_id" field.

func (*NodeCreate) SetValue added in v0.10.0

func (nc *NodeCreate) SetValue(i int) *NodeCreate

SetValue sets the "value" field.

type NodeCreateBulk added in v0.10.0

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

NodeCreateBulk is the builder for creating many Node entities in bulk.

func (*NodeCreateBulk) Exec added in v0.10.0

func (ncb *NodeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeCreateBulk) ExecX added in v0.10.0

func (ncb *NodeCreateBulk) ExecX(ctx context.Context)

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

func (*NodeCreateBulk) Save added in v0.10.0

func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error)

Save creates the Node entities in the database.

func (*NodeCreateBulk) SaveX added in v0.10.0

func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node

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

type NodeDelete added in v0.10.0

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

NodeDelete is the builder for deleting a Node entity.

func (*NodeDelete) Exec added in v0.10.0

func (nd *NodeDelete) Exec(ctx context.Context) (int, error)

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

func (*NodeDelete) ExecX added in v0.10.0

func (nd *NodeDelete) ExecX(ctx context.Context) int

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

func (*NodeDelete) Where added in v0.10.0

func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete

Where appends a list predicates to the NodeDelete builder.

type NodeDeleteOne added in v0.10.0

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

NodeDeleteOne is the builder for deleting a single Node entity.

func (*NodeDeleteOne) Exec added in v0.10.0

func (ndo *NodeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*NodeDeleteOne) ExecX added in v0.10.0

func (ndo *NodeDeleteOne) ExecX(ctx context.Context)

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

type NodeEdges added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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

NodeGroupBy is the group-by builder for Node entities.

func (*NodeGroupBy) Aggregate added in v0.10.0

func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy

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

func (*NodeGroupBy) Bool added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Bools added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Float64 added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Float64s added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Int added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Ints added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Scan added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) String added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeGroupBy) Strings added in v0.10.0

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 added in v0.10.0

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

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

type NodeMutation added in v0.10.0

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

NodeMutation represents an operation that mutates the Node nodes in the graph.

func (*NodeMutation) AddField added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) AddValue(i int)

AddValue adds i to the "value" field.

func (*NodeMutation) AddedEdges added in v0.10.0

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

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

func (*NodeMutation) AddedField added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeMutation) AddedIDs added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) ClearNext()

ClearNext clears the "next" edge to the Node entity.

func (*NodeMutation) ClearPrev added in v0.10.0

func (m *NodeMutation) ClearPrev()

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeMutation) ClearPrevID added in v0.10.0

func (m *NodeMutation) ClearPrevID()

ClearPrevID clears the value of the "prev_id" field.

func (*NodeMutation) ClearedEdges added in v0.10.0

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

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

func (*NodeMutation) ClearedFields added in v0.10.0

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

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

func (NodeMutation) Client added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) NextCleared() bool

NextCleared reports if the "next" edge to the Node entity was cleared.

func (*NodeMutation) NextID added in v0.10.0

func (m *NodeMutation) NextID() (id int, exists bool)

NextID returns the "next" edge ID in the mutation.

func (*NodeMutation) NextIDs added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) Op() Op

Op returns the operation name.

func (*NodeMutation) PrevCleared added in v0.10.0

func (m *NodeMutation) PrevCleared() bool

PrevCleared reports if the "prev" edge to the Node entity was cleared.

func (*NodeMutation) PrevID added in v0.10.0

func (m *NodeMutation) PrevID() (r int, exists bool)

PrevID returns the value of the "prev_id" field in the mutation.

func (*NodeMutation) PrevIDCleared added in v0.10.0

func (m *NodeMutation) PrevIDCleared() bool

PrevIDCleared returns if the "prev_id" field was cleared in this mutation.

func (*NodeMutation) PrevIDs added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeMutation) RemovedIDs added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) ResetNext()

ResetNext resets all changes to the "next" edge.

func (*NodeMutation) ResetPrev added in v0.10.0

func (m *NodeMutation) ResetPrev()

ResetPrev resets all changes to the "prev" edge.

func (*NodeMutation) ResetPrevID added in v0.10.0

func (m *NodeMutation) ResetPrevID()

ResetPrevID resets all changes to the "prev_id" field.

func (*NodeMutation) ResetValue added in v0.10.0

func (m *NodeMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*NodeMutation) SetField added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) SetNextID(id int)

SetNextID sets the "next" edge to the Node entity by id.

func (*NodeMutation) SetPrevID added in v0.10.0

func (m *NodeMutation) SetPrevID(i int)

SetPrevID sets the "prev_id" field.

func (*NodeMutation) SetValue added in v0.10.0

func (m *NodeMutation) SetValue(i int)

SetValue sets the "value" field.

func (NodeMutation) Tx added in v0.10.0

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 added in v0.10.0

func (m *NodeMutation) Type() string

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

func (*NodeMutation) Value added in v0.10.0

func (m *NodeMutation) Value() (r int, exists bool)

Value returns the value of the "value" field in the mutation.

func (*NodeMutation) Where added in v0.10.0

func (m *NodeMutation) Where(ps ...predicate.Node)

Where appends a list predicates to the NodeMutation builder.

type NodeQuery added in v0.10.0

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

NodeQuery is the builder for querying Node entities.

func (*NodeQuery) All added in v0.10.0

func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error)

All executes the query and returns a list of Nodes.

func (*NodeQuery) AllX added in v0.10.0

func (nq *NodeQuery) AllX(ctx context.Context) []*Node

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

func (*NodeQuery) Clone added in v0.10.0

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 added in v0.10.0

func (nq *NodeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*NodeQuery) CountX added in v0.10.0

func (nq *NodeQuery) CountX(ctx context.Context) int

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

func (*NodeQuery) Exist added in v0.10.0

func (nq *NodeQuery) Exist(ctx context.Context) (bool, error)

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

func (*NodeQuery) ExistX added in v0.10.0

func (nq *NodeQuery) ExistX(ctx context.Context) bool

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

func (*NodeQuery) First added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (nq *NodeQuery) FirstIDX(ctx context.Context) int

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

func (*NodeQuery) FirstX added in v0.10.0

func (nq *NodeQuery) FirstX(ctx context.Context) *Node

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

func (*NodeQuery) GroupBy added in v0.10.0

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 added in v0.10.0

func (nq *NodeQuery) IDs(ctx context.Context) ([]int, error)

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

func (*NodeQuery) IDsX added in v0.10.0

func (nq *NodeQuery) IDsX(ctx context.Context) []int

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

func (*NodeQuery) Limit added in v0.10.0

func (nq *NodeQuery) Limit(limit int) *NodeQuery

Limit adds a limit step to the query.

func (*NodeQuery) Offset added in v0.10.0

func (nq *NodeQuery) Offset(offset int) *NodeQuery

Offset adds an offset step to the query.

func (*NodeQuery) Only added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (nq *NodeQuery) OnlyIDX(ctx context.Context) int

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

func (*NodeQuery) OnlyX added in v0.10.0

func (nq *NodeQuery) OnlyX(ctx context.Context) *Node

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

func (*NodeQuery) Order added in v0.10.0

func (nq *NodeQuery) Order(o ...OrderFunc) *NodeQuery

Order adds an order step to the query.

func (*NodeQuery) QueryNext added in v0.10.0

func (nq *NodeQuery) QueryNext() *NodeQuery

QueryNext chains the current query on the "next" edge.

func (*NodeQuery) QueryPrev added in v0.10.0

func (nq *NodeQuery) QueryPrev() *NodeQuery

QueryPrev chains the current query on the "prev" edge.

func (*NodeQuery) Select added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (nq *NodeQuery) Where(ps ...predicate.Node) *NodeQuery

Where adds a new predicate for the NodeQuery builder.

func (*NodeQuery) WithNext added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

type NodeSelect struct {
	*NodeQuery
	// contains filtered or unexported fields
}

NodeSelect is the builder for selecting fields of Node entities.

func (*NodeSelect) Bool added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Bools added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Float64 added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Float64s added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Int added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Ints added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Scan added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) String added in v0.10.0

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 added in v0.10.0

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

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

func (*NodeSelect) Strings added in v0.10.0

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 added in v0.10.0

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

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

type NodeUpdate added in v0.10.0

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

NodeUpdate is the builder for updating Node entities.

func (*NodeUpdate) AddValue added in v0.10.0

func (nu *NodeUpdate) AddValue(i int) *NodeUpdate

AddValue adds i to the "value" field.

func (*NodeUpdate) ClearNext added in v0.10.0

func (nu *NodeUpdate) ClearNext() *NodeUpdate

ClearNext clears the "next" edge to the Node entity.

func (*NodeUpdate) ClearPrev added in v0.10.0

func (nu *NodeUpdate) ClearPrev() *NodeUpdate

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeUpdate) ClearPrevID added in v0.10.0

func (nu *NodeUpdate) ClearPrevID() *NodeUpdate

ClearPrevID clears the value of the "prev_id" field.

func (*NodeUpdate) Exec added in v0.10.0

func (nu *NodeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*NodeUpdate) ExecX added in v0.10.0

func (nu *NodeUpdate) ExecX(ctx context.Context)

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

func (*NodeUpdate) Mutation added in v0.10.0

func (nu *NodeUpdate) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdate) Save added in v0.10.0

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 added in v0.10.0

func (nu *NodeUpdate) SaveX(ctx context.Context) int

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

func (*NodeUpdate) SetNext added in v0.10.0

func (nu *NodeUpdate) SetNext(n *Node) *NodeUpdate

SetNext sets the "next" edge to the Node entity.

func (*NodeUpdate) SetNextID added in v0.10.0

func (nu *NodeUpdate) SetNextID(id int) *NodeUpdate

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeUpdate) SetNillableNextID added in v0.10.0

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 added in v0.10.0

func (nu *NodeUpdate) SetNillablePrevID(i *int) *NodeUpdate

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeUpdate) SetNillableValue added in v0.10.0

func (nu *NodeUpdate) SetNillableValue(i *int) *NodeUpdate

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeUpdate) SetPrev added in v0.10.0

func (nu *NodeUpdate) SetPrev(n *Node) *NodeUpdate

SetPrev sets the "prev" edge to the Node entity.

func (*NodeUpdate) SetPrevID added in v0.10.0

func (nu *NodeUpdate) SetPrevID(i int) *NodeUpdate

SetPrevID sets the "prev_id" field.

func (*NodeUpdate) SetValue added in v0.10.0

func (nu *NodeUpdate) SetValue(i int) *NodeUpdate

SetValue sets the "value" field.

func (*NodeUpdate) Where added in v0.10.0

func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate

Where appends a list predicates to the NodeUpdate builder.

type NodeUpdateOne added in v0.10.0

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

NodeUpdateOne is the builder for updating a single Node entity.

func (*NodeUpdateOne) AddValue added in v0.10.0

func (nuo *NodeUpdateOne) AddValue(i int) *NodeUpdateOne

AddValue adds i to the "value" field.

func (*NodeUpdateOne) ClearNext added in v0.10.0

func (nuo *NodeUpdateOne) ClearNext() *NodeUpdateOne

ClearNext clears the "next" edge to the Node entity.

func (*NodeUpdateOne) ClearPrev added in v0.10.0

func (nuo *NodeUpdateOne) ClearPrev() *NodeUpdateOne

ClearPrev clears the "prev" edge to the Node entity.

func (*NodeUpdateOne) ClearPrevID added in v0.10.0

func (nuo *NodeUpdateOne) ClearPrevID() *NodeUpdateOne

ClearPrevID clears the value of the "prev_id" field.

func (*NodeUpdateOne) Exec added in v0.10.0

func (nuo *NodeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*NodeUpdateOne) ExecX added in v0.10.0

func (nuo *NodeUpdateOne) ExecX(ctx context.Context)

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

func (*NodeUpdateOne) Mutation added in v0.10.0

func (nuo *NodeUpdateOne) Mutation() *NodeMutation

Mutation returns the NodeMutation object of the builder.

func (*NodeUpdateOne) Save added in v0.10.0

func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error)

Save executes the query and returns the updated Node entity.

func (*NodeUpdateOne) SaveX added in v0.10.0

func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node

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

func (*NodeUpdateOne) Select added in v0.10.0

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 added in v0.10.0

func (nuo *NodeUpdateOne) SetNext(n *Node) *NodeUpdateOne

SetNext sets the "next" edge to the Node entity.

func (*NodeUpdateOne) SetNextID added in v0.10.0

func (nuo *NodeUpdateOne) SetNextID(id int) *NodeUpdateOne

SetNextID sets the "next" edge to the Node entity by ID.

func (*NodeUpdateOne) SetNillableNextID added in v0.10.0

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 added in v0.10.0

func (nuo *NodeUpdateOne) SetNillablePrevID(i *int) *NodeUpdateOne

SetNillablePrevID sets the "prev_id" field if the given value is not nil.

func (*NodeUpdateOne) SetNillableValue added in v0.10.0

func (nuo *NodeUpdateOne) SetNillableValue(i *int) *NodeUpdateOne

SetNillableValue sets the "value" field if the given value is not nil.

func (*NodeUpdateOne) SetPrev added in v0.10.0

func (nuo *NodeUpdateOne) SetPrev(n *Node) *NodeUpdateOne

SetPrev sets the "prev" edge to the Node entity.

func (*NodeUpdateOne) SetPrevID added in v0.10.0

func (nuo *NodeUpdateOne) SetPrevID(i int) *NodeUpdateOne

SetPrevID sets the "prev_id" field.

func (*NodeUpdateOne) SetValue added in v0.10.0

func (nuo *NodeUpdateOne) SetValue(i int) *NodeUpdateOne

SetValue sets the "value" field.

type Nodes added in v0.10.0

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 builder for creating a Pet entity.

func (*PetClient) CreateBulk

func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk

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

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

func (c *PetClient) DeleteOne(pe *Pet) *PetDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*PetClient) DeleteOneID

func (c *PetClient) DeleteOneID(id int) *PetDeleteOne

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

func (*PetClient) Get

func (c *PetClient) Get(ctx context.Context, id int) (*Pet, error)

Get returns a Pet entity by its id.

func (*PetClient) GetX

func (c *PetClient) GetX(ctx context.Context, id int) *Pet

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

func (*PetClient) Hooks

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

Hooks returns the client hooks.

func (*PetClient) 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 added in v0.9.0

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

Exec executes the query.

func (*PetCreate) ExecX added in v0.9.0

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 added in v0.9.0

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

Exec executes the query.

func (*PetCreateBulk) ExecX added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.8.0

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 builder for creating a Post entity.

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 builder for deleting the given entity.

func (*PostClient) DeleteOneID

func (c *PostClient) DeleteOneID(id int) *PostDeleteOne

DeleteOne returns a builder for deleting the given entity by its 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 added in v0.9.0

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

Exec executes the query.

func (*PostCreate) ExecX added in v0.9.0

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 added in v0.9.0

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

Exec executes the query.

func (*PostCreateBulk) ExecX added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

func (r *Rental) QueryCar() *CarQuery

QueryCar queries the "car" edge of the Rental entity.

func (*Rental) QueryUser added in v0.9.0

func (r *Rental) QueryUser() *UserQuery

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

func (*Rental) String added in v0.9.0

func (r *Rental) String() string

String implements the fmt.Stringer.

func (*Rental) Unwrap added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

RentalClient is a client for the Rental schema.

func NewRentalClient added in v0.9.0

func NewRentalClient(c config) *RentalClient

NewRentalClient returns a client for the Rental from the given config.

func (*RentalClient) Create added in v0.9.0

func (c *RentalClient) Create() *RentalCreate

Create returns a builder for creating a Rental entity.

func (*RentalClient) CreateBulk added in v0.9.0

func (c *RentalClient) CreateBulk(builders ...*RentalCreate) *RentalCreateBulk

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

func (*RentalClient) Delete added in v0.9.0

func (c *RentalClient) Delete() *RentalDelete

Delete returns a delete builder for Rental.

func (*RentalClient) DeleteOne added in v0.9.0

func (c *RentalClient) DeleteOne(r *Rental) *RentalDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RentalClient) DeleteOneID added in v0.9.0

func (c *RentalClient) DeleteOneID(id int) *RentalDeleteOne

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

func (*RentalClient) Get added in v0.9.0

func (c *RentalClient) Get(ctx context.Context, id int) (*Rental, error)

Get returns a Rental entity by its id.

func (*RentalClient) GetX added in v0.9.0

func (c *RentalClient) GetX(ctx context.Context, id int) *Rental

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

func (*RentalClient) Hooks added in v0.9.0

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

Hooks returns the client hooks.

func (*RentalClient) Query added in v0.9.0

func (c *RentalClient) Query() *RentalQuery

Query returns a query builder for Rental.

func (*RentalClient) QueryCar added in v0.9.0

func (c *RentalClient) QueryCar(r *Rental) *CarQuery

QueryCar queries the car edge of a Rental.

func (*RentalClient) QueryUser added in v0.9.0

func (c *RentalClient) QueryUser(r *Rental) *UserQuery

QueryUser queries the user edge of a Rental.

func (*RentalClient) Update added in v0.9.0

func (c *RentalClient) Update() *RentalUpdate

Update returns an update builder for Rental.

func (*RentalClient) UpdateOne added in v0.9.0

func (c *RentalClient) UpdateOne(r *Rental) *RentalUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RentalClient) UpdateOneID added in v0.9.0

func (c *RentalClient) UpdateOneID(id int) *RentalUpdateOne

UpdateOneID returns an update builder for the given id.

func (*RentalClient) Use added in v0.9.0

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 added in v0.9.0

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

RentalCreate is the builder for creating a Rental entity.

func (*RentalCreate) Exec added in v0.9.0

func (rc *RentalCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalCreate) ExecX added in v0.9.0

func (rc *RentalCreate) ExecX(ctx context.Context)

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

func (*RentalCreate) Mutation added in v0.9.0

func (rc *RentalCreate) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalCreate) Save added in v0.9.0

func (rc *RentalCreate) Save(ctx context.Context) (*Rental, error)

Save creates the Rental in the database.

func (*RentalCreate) SaveX added in v0.9.0

func (rc *RentalCreate) SaveX(ctx context.Context) *Rental

SaveX calls Save and panics if Save returns an error.

func (*RentalCreate) SetCar added in v0.9.0

func (rc *RentalCreate) SetCar(c *Car) *RentalCreate

SetCar sets the "car" edge to the Car entity.

func (*RentalCreate) SetCarID added in v0.9.0

func (rc *RentalCreate) SetCarID(u uuid.UUID) *RentalCreate

SetCarID sets the "car_id" field.

func (*RentalCreate) SetDate added in v0.9.0

func (rc *RentalCreate) SetDate(t time.Time) *RentalCreate

SetDate sets the "date" field.

func (*RentalCreate) SetNillableDate added in v0.9.0

func (rc *RentalCreate) SetNillableDate(t *time.Time) *RentalCreate

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalCreate) SetUser added in v0.9.0

func (rc *RentalCreate) SetUser(u *User) *RentalCreate

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

func (*RentalCreate) SetUserID added in v0.9.0

func (rc *RentalCreate) SetUserID(i int) *RentalCreate

SetUserID sets the "user_id" field.

type RentalCreateBulk added in v0.9.0

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

RentalCreateBulk is the builder for creating many Rental entities in bulk.

func (*RentalCreateBulk) Exec added in v0.9.0

func (rcb *RentalCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalCreateBulk) ExecX added in v0.9.0

func (rcb *RentalCreateBulk) ExecX(ctx context.Context)

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

func (*RentalCreateBulk) Save added in v0.9.0

func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error)

Save creates the Rental entities in the database.

func (*RentalCreateBulk) SaveX added in v0.9.0

func (rcb *RentalCreateBulk) SaveX(ctx context.Context) []*Rental

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

type RentalDelete added in v0.9.0

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

RentalDelete is the builder for deleting a Rental entity.

func (*RentalDelete) Exec added in v0.9.0

func (rd *RentalDelete) Exec(ctx context.Context) (int, error)

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

func (*RentalDelete) ExecX added in v0.9.0

func (rd *RentalDelete) ExecX(ctx context.Context) int

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

func (*RentalDelete) Where added in v0.9.0

func (rd *RentalDelete) Where(ps ...predicate.Rental) *RentalDelete

Where appends a list predicates to the RentalDelete builder.

type RentalDeleteOne added in v0.9.0

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

RentalDeleteOne is the builder for deleting a single Rental entity.

func (*RentalDeleteOne) Exec added in v0.9.0

func (rdo *RentalDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RentalDeleteOne) ExecX added in v0.9.0

func (rdo *RentalDeleteOne) ExecX(ctx context.Context)

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

type RentalEdges added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

RentalGroupBy is the group-by builder for Rental entities.

func (*RentalGroupBy) Aggregate added in v0.9.0

func (rgb *RentalGroupBy) Aggregate(fns ...AggregateFunc) *RentalGroupBy

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

func (*RentalGroupBy) Bool added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Bools added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Float64 added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Float64s added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Int added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Ints added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Scan added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) String added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalGroupBy) Strings added in v0.9.0

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 added in v0.9.0

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

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

type RentalMutation added in v0.9.0

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

RentalMutation represents an operation that mutates the Rental nodes in the graph.

func (*RentalMutation) AddField added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalMutation) AddedField added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalMutation) AddedIDs added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) CarCleared() bool

CarCleared reports if the "car" edge to the Car entity was cleared.

func (*RentalMutation) CarID added in v0.9.0

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

CarID returns the value of the "car_id" field in the mutation.

func (*RentalMutation) CarIDs added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) ClearCar()

ClearCar clears the "car" edge to the Car entity.

func (*RentalMutation) ClearEdge added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) ClearUser()

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

func (*RentalMutation) ClearedEdges added in v0.9.0

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

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

func (*RentalMutation) ClearedFields added in v0.9.0

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

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

func (RentalMutation) Client added in v0.9.0

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 added in v0.9.0

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

Date returns the value of the "date" field in the mutation.

func (*RentalMutation) EdgeCleared added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) Op() Op

Op returns the operation name.

func (*RentalMutation) RemovedEdges added in v0.9.0

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

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

func (*RentalMutation) RemovedIDs added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) ResetCar()

ResetCar resets all changes to the "car" edge.

func (*RentalMutation) ResetCarID added in v0.9.0

func (m *RentalMutation) ResetCarID()

ResetCarID resets all changes to the "car_id" field.

func (*RentalMutation) ResetDate added in v0.9.0

func (m *RentalMutation) ResetDate()

ResetDate resets all changes to the "date" field.

func (*RentalMutation) ResetEdge added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*RentalMutation) ResetUserID added in v0.9.0

func (m *RentalMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*RentalMutation) SetCarID added in v0.9.0

func (m *RentalMutation) SetCarID(u uuid.UUID)

SetCarID sets the "car_id" field.

func (*RentalMutation) SetDate added in v0.9.0

func (m *RentalMutation) SetDate(t time.Time)

SetDate sets the "date" field.

func (*RentalMutation) SetField added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (RentalMutation) Tx added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) Type() string

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

func (*RentalMutation) UserCleared added in v0.9.0

func (m *RentalMutation) UserCleared() bool

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

func (*RentalMutation) UserID added in v0.9.0

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

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

func (*RentalMutation) UserIDs added in v0.9.0

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 added in v0.9.0

func (m *RentalMutation) Where(ps ...predicate.Rental)

Where appends a list predicates to the RentalMutation builder.

type RentalQuery added in v0.9.0

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

RentalQuery is the builder for querying Rental entities.

func (*RentalQuery) All added in v0.9.0

func (rq *RentalQuery) All(ctx context.Context) ([]*Rental, error)

All executes the query and returns a list of Rentals.

func (*RentalQuery) AllX added in v0.9.0

func (rq *RentalQuery) AllX(ctx context.Context) []*Rental

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

func (*RentalQuery) Clone added in v0.9.0

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 added in v0.9.0

func (rq *RentalQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RentalQuery) CountX added in v0.9.0

func (rq *RentalQuery) CountX(ctx context.Context) int

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

func (*RentalQuery) Exist added in v0.9.0

func (rq *RentalQuery) Exist(ctx context.Context) (bool, error)

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

func (*RentalQuery) ExistX added in v0.9.0

func (rq *RentalQuery) ExistX(ctx context.Context) bool

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

func (*RentalQuery) First added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (rq *RentalQuery) FirstIDX(ctx context.Context) int

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

func (*RentalQuery) FirstX added in v0.9.0

func (rq *RentalQuery) FirstX(ctx context.Context) *Rental

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

func (*RentalQuery) GroupBy added in v0.9.0

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 added in v0.9.0

func (rq *RentalQuery) IDs(ctx context.Context) ([]int, error)

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

func (*RentalQuery) IDsX added in v0.9.0

func (rq *RentalQuery) IDsX(ctx context.Context) []int

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

func (*RentalQuery) Limit added in v0.9.0

func (rq *RentalQuery) Limit(limit int) *RentalQuery

Limit adds a limit step to the query.

func (*RentalQuery) Offset added in v0.9.0

func (rq *RentalQuery) Offset(offset int) *RentalQuery

Offset adds an offset step to the query.

func (*RentalQuery) Only added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (rq *RentalQuery) OnlyIDX(ctx context.Context) int

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

func (*RentalQuery) OnlyX added in v0.9.0

func (rq *RentalQuery) OnlyX(ctx context.Context) *Rental

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

func (*RentalQuery) Order added in v0.9.0

func (rq *RentalQuery) Order(o ...OrderFunc) *RentalQuery

Order adds an order step to the query.

func (*RentalQuery) QueryCar added in v0.9.0

func (rq *RentalQuery) QueryCar() *CarQuery

QueryCar chains the current query on the "car" edge.

func (*RentalQuery) QueryUser added in v0.9.0

func (rq *RentalQuery) QueryUser() *UserQuery

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

func (*RentalQuery) Select added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (rq *RentalQuery) Where(ps ...predicate.Rental) *RentalQuery

Where adds a new predicate for the RentalQuery builder.

func (*RentalQuery) WithCar added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

type RentalSelect struct {
	*RentalQuery
	// contains filtered or unexported fields
}

RentalSelect is the builder for selecting fields of Rental entities.

func (*RentalSelect) Bool added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Bools added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Float64 added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Float64s added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Int added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Ints added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Scan added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) String added in v0.9.0

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 added in v0.9.0

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

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

func (*RentalSelect) Strings added in v0.9.0

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 added in v0.9.0

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

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

type RentalUpdate added in v0.9.0

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

RentalUpdate is the builder for updating Rental entities.

func (*RentalUpdate) ClearCar added in v0.9.0

func (ru *RentalUpdate) ClearCar() *RentalUpdate

ClearCar clears the "car" edge to the Car entity.

func (*RentalUpdate) ClearUser added in v0.9.0

func (ru *RentalUpdate) ClearUser() *RentalUpdate

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

func (*RentalUpdate) Exec added in v0.9.0

func (ru *RentalUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RentalUpdate) ExecX added in v0.9.0

func (ru *RentalUpdate) ExecX(ctx context.Context)

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

func (*RentalUpdate) Mutation added in v0.9.0

func (ru *RentalUpdate) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalUpdate) Save added in v0.9.0

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 added in v0.9.0

func (ru *RentalUpdate) SaveX(ctx context.Context) int

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

func (*RentalUpdate) SetCar added in v0.9.0

func (ru *RentalUpdate) SetCar(c *Car) *RentalUpdate

SetCar sets the "car" edge to the Car entity.

func (*RentalUpdate) SetCarID added in v0.9.0

func (ru *RentalUpdate) SetCarID(u uuid.UUID) *RentalUpdate

SetCarID sets the "car_id" field.

func (*RentalUpdate) SetDate added in v0.9.0

func (ru *RentalUpdate) SetDate(t time.Time) *RentalUpdate

SetDate sets the "date" field.

func (*RentalUpdate) SetNillableDate added in v0.9.0

func (ru *RentalUpdate) SetNillableDate(t *time.Time) *RentalUpdate

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalUpdate) SetUser added in v0.9.0

func (ru *RentalUpdate) SetUser(u *User) *RentalUpdate

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

func (*RentalUpdate) SetUserID added in v0.9.0

func (ru *RentalUpdate) SetUserID(i int) *RentalUpdate

SetUserID sets the "user_id" field.

func (*RentalUpdate) Where added in v0.9.0

func (ru *RentalUpdate) Where(ps ...predicate.Rental) *RentalUpdate

Where appends a list predicates to the RentalUpdate builder.

type RentalUpdateOne added in v0.9.0

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

RentalUpdateOne is the builder for updating a single Rental entity.

func (*RentalUpdateOne) ClearCar added in v0.9.0

func (ruo *RentalUpdateOne) ClearCar() *RentalUpdateOne

ClearCar clears the "car" edge to the Car entity.

func (*RentalUpdateOne) ClearUser added in v0.9.0

func (ruo *RentalUpdateOne) ClearUser() *RentalUpdateOne

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

func (*RentalUpdateOne) Exec added in v0.9.0

func (ruo *RentalUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RentalUpdateOne) ExecX added in v0.9.0

func (ruo *RentalUpdateOne) ExecX(ctx context.Context)

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

func (*RentalUpdateOne) Mutation added in v0.9.0

func (ruo *RentalUpdateOne) Mutation() *RentalMutation

Mutation returns the RentalMutation object of the builder.

func (*RentalUpdateOne) Save added in v0.9.0

func (ruo *RentalUpdateOne) Save(ctx context.Context) (*Rental, error)

Save executes the query and returns the updated Rental entity.

func (*RentalUpdateOne) SaveX added in v0.9.0

func (ruo *RentalUpdateOne) SaveX(ctx context.Context) *Rental

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

func (*RentalUpdateOne) Select added in v0.9.0

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 added in v0.9.0

func (ruo *RentalUpdateOne) SetCar(c *Car) *RentalUpdateOne

SetCar sets the "car" edge to the Car entity.

func (*RentalUpdateOne) SetCarID added in v0.9.0

func (ruo *RentalUpdateOne) SetCarID(u uuid.UUID) *RentalUpdateOne

SetCarID sets the "car_id" field.

func (*RentalUpdateOne) SetDate added in v0.9.0

func (ruo *RentalUpdateOne) SetDate(t time.Time) *RentalUpdateOne

SetDate sets the "date" field.

func (*RentalUpdateOne) SetNillableDate added in v0.9.0

func (ruo *RentalUpdateOne) SetNillableDate(t *time.Time) *RentalUpdateOne

SetNillableDate sets the "date" field if the given value is not nil.

func (*RentalUpdateOne) SetUser added in v0.9.0

func (ruo *RentalUpdateOne) SetUser(u *User) *RentalUpdateOne

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

func (*RentalUpdateOne) SetUserID added in v0.9.0

func (ruo *RentalUpdateOne) SetUserID(i int) *RentalUpdateOne

SetUserID sets the "user_id" field.

type Rentals added in v0.9.0

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 added in v0.9.0

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 builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) 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 added in v0.9.0

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 added in v0.9.0

func (uc *UserCreate) AddRentalIDs(ids ...int) *UserCreate

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

func (*UserCreate) AddRentals added in v0.9.0

func (uc *UserCreate) AddRentals(r ...*Rental) *UserCreate

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

func (*UserCreate) Exec added in v0.9.0

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.10.0

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 added in v0.9.0

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 added in v0.9.0

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

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

func (*UserMutation) RentalsCleared added in v0.9.0

func (m *UserMutation) RentalsCleared() bool

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

func (*UserMutation) RentalsIDs added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.8.0

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 added in v0.9.0

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 added in v0.9.0

func (uu *UserUpdate) AddRentalIDs(ids ...int) *UserUpdate

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

func (*UserUpdate) AddRentals added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (uu *UserUpdate) RemoveRentalIDs(ids ...int) *UserUpdate

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

func (*UserUpdate) RemoveRentals added in v0.9.0

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 added in v0.9.0

func (uuo *UserUpdateOne) AddRentalIDs(ids ...int) *UserUpdateOne

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

func (*UserUpdateOne) AddRentals added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

func (uuo *UserUpdateOne) RemoveRentalIDs(ids ...int) *UserUpdateOne

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

func (*UserUpdateOne) RemoveRentals added in v0.9.0

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 added in v0.8.0

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