ent

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeCard     = "Card"
	TypeInfo     = "Info"
	TypeMetadata = "Metadata"
	TypePet      = "Pet"
	TypePost     = "Post"
	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 validaton 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, func(string) bool) 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 Card

type Card 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 CardQuery when eager-loading is set.
	Edges CardEdges `json:"edges"`
	// contains filtered or unexported fields
}

Card is the model entity for the Card schema.

func (*Card) QueryOwner

func (c *Card) QueryOwner() *UserQuery

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

func (*Card) String

func (c *Card) String() string

String implements the fmt.Stringer.

func (*Card) Unwrap

func (c *Card) Unwrap() *Card

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

func (*Card) Update

func (c *Card) Update() *CardUpdateOne

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

type CardClient

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

CardClient is a client for the Card schema.

func NewCardClient

func NewCardClient(c config) *CardClient

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

func (*CardClient) Create

func (c *CardClient) Create() *CardCreate

Create returns a create builder for Card.

func (*CardClient) CreateBulk

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

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

func (*CardClient) Delete

func (c *CardClient) Delete() *CardDelete

Delete returns a delete builder for Card.

func (*CardClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*CardClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*CardClient) Get

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

Get returns a Card entity by its id.

func (*CardClient) GetX

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

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

func (*CardClient) Hooks

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

Hooks returns the client hooks.

func (*CardClient) Query

func (c *CardClient) Query() *CardQuery

Query returns a query builder for Card.

func (*CardClient) QueryOwner

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

QueryOwner queries the owner edge of a Card.

func (*CardClient) Update

func (c *CardClient) Update() *CardUpdate

Update returns an update builder for Card.

func (*CardClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*CardClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*CardClient) Use

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

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

type CardCreate

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

CardCreate is the builder for creating a Card entity.

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

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

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

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) 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 adds a new predicate 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 (cgb *CardGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) BoolX

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

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

func (*CardGroupBy) Bools

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

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) BoolsX

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

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

func (*CardGroupBy) Float64

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

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) Float64X

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

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

func (*CardGroupBy) Float64s

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

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) Float64sX

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

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

func (*CardGroupBy) Int

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

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) IntX

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

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

func (*CardGroupBy) Ints

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

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) IntsX

func (cgb *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 (cgb *CardGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CardGroupBy) String

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

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) StringX

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

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

func (*CardGroupBy) Strings

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

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*CardGroupBy) StringsX

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

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) 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 returns 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) 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) 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).

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

client.Card.Query().
	GroupBy(card.FieldOwnerID).
	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 exactly one Card entity is not 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 exactly one Card ID is not 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(field string, 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 {
	OwnerID int `json:"owner_id,omitempty"`
}

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

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 (cs *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 (cs *CardSelect) BoolX(ctx context.Context) bool

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

func (*CardSelect) Bools

func (cs *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 (cs *CardSelect) BoolsX(ctx context.Context) []bool

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

func (*CardSelect) Float64

func (cs *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 (cs *CardSelect) Float64X(ctx context.Context) float64

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

func (*CardSelect) Float64s

func (cs *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 (cs *CardSelect) Float64sX(ctx context.Context) []float64

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

func (*CardSelect) Int

func (cs *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 (cs *CardSelect) IntX(ctx context.Context) int

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

func (*CardSelect) Ints

func (cs *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 (cs *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 (cs *CardSelect) ScanX(ctx context.Context, v interface{})

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

func (*CardSelect) String

func (cs *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 (cs *CardSelect) StringX(ctx context.Context) string

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

func (*CardSelect) Strings

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

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

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

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 adds a new predicate for 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) 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) SetNillableOwnerID

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

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

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 Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// 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
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// 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().
	Card.
	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(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 Committer method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type Info

type Info struct {

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

Info is the model entity for the Info schema.

func (*Info) QueryUser

func (i *Info) QueryUser() *UserQuery

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

func (*Info) String

func (i *Info) String() string

String implements the fmt.Stringer.

func (*Info) Unwrap

func (i *Info) Unwrap() *Info

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

func (*Info) Update

func (i *Info) Update() *InfoUpdateOne

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

type InfoClient

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

InfoClient is a client for the Info schema.

func NewInfoClient

func NewInfoClient(c config) *InfoClient

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

func (*InfoClient) Create

func (c *InfoClient) Create() *InfoCreate

Create returns a create builder for Info.

func (*InfoClient) CreateBulk

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

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

func (*InfoClient) Delete

func (c *InfoClient) Delete() *InfoDelete

Delete returns a delete builder for Info.

func (*InfoClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*InfoClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*InfoClient) Get

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

Get returns a Info entity by its id.

func (*InfoClient) GetX

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

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

func (*InfoClient) Hooks

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

Hooks returns the client hooks.

func (*InfoClient) Query

func (c *InfoClient) Query() *InfoQuery

Query returns a query builder for Info.

func (*InfoClient) QueryUser

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

QueryUser queries the user edge of a Info.

func (*InfoClient) Update

func (c *InfoClient) Update() *InfoUpdate

Update returns an update builder for Info.

func (*InfoClient) UpdateOne

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

UpdateOne returns an update builder for the given entity.

func (*InfoClient) UpdateOneID

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

UpdateOneID returns an update builder for the given id.

func (*InfoClient) Use

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

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

type InfoCreate

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

InfoCreate is the builder for creating a Info entity.

func (*InfoCreate) 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) 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 adds a new predicate 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 (igb *InfoGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) BoolX

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

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

func (*InfoGroupBy) Bools

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

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) BoolsX

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

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

func (*InfoGroupBy) Float64

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

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) Float64X

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

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

func (*InfoGroupBy) Float64s

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

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) Float64sX

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

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

func (*InfoGroupBy) Int

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

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) IntX

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

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

func (*InfoGroupBy) Ints

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

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) IntsX

func (igb *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 (igb *InfoGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*InfoGroupBy) String

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

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) StringX

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

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

func (*InfoGroupBy) Strings

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

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*InfoGroupBy) StringsX

func (igb *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.

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 returns 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.

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 exactly one Info entity is not 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 exactly one Info ID is not 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(field string, 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) 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 (is *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 (is *InfoSelect) BoolX(ctx context.Context) bool

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

func (*InfoSelect) Bools

func (is *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 (is *InfoSelect) BoolsX(ctx context.Context) []bool

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

func (*InfoSelect) Float64

func (is *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 (is *InfoSelect) Float64X(ctx context.Context) float64

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

func (*InfoSelect) Float64s

func (is *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 (is *InfoSelect) Float64sX(ctx context.Context) []float64

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

func (*InfoSelect) Int

func (is *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 (is *InfoSelect) IntX(ctx context.Context) int

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

func (*InfoSelect) Ints

func (is *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 (is *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 (is *InfoSelect) ScanX(ctx context.Context, v interface{})

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

func (*InfoSelect) String

func (is *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 (is *InfoSelect) StringX(ctx context.Context) string

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

func (*InfoSelect) Strings

func (is *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 (is *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 adds a new predicate for 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) 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"`
	// 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) QueryUser

func (m *Metadata) QueryUser() *UserQuery

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

func (*Metadata) String

func (m *Metadata) String() string

String implements the fmt.Stringer.

func (*Metadata) Unwrap

func (m *Metadata) Unwrap() *Metadata

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

func (*Metadata) Update

func (m *Metadata) Update() *MetadataUpdateOne

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

type MetadataClient

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

MetadataClient is a client for the Metadata schema.

func NewMetadataClient

func NewMetadataClient(c config) *MetadataClient

NewMetadataClient returns a client for the Metadata from the given config.

func (*MetadataClient) Create

func (c *MetadataClient) Create() *MetadataCreate

Create returns a create builder for Metadata.

func (*MetadataClient) CreateBulk

func (c *MetadataClient) CreateBulk(builders ...*MetadataCreate) *MetadataCreateBulk

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

func (*MetadataClient) Delete

func (c *MetadataClient) Delete() *MetadataDelete

Delete returns a delete builder for Metadata.

func (*MetadataClient) DeleteOne

func (c *MetadataClient) DeleteOne(m *Metadata) *MetadataDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*MetadataClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*MetadataClient) Get

func (c *MetadataClient) Get(ctx context.Context, id int) (*Metadata, error)

Get returns a Metadata entity by its id.

func (*MetadataClient) GetX

func (c *MetadataClient) GetX(ctx context.Context, id int) *Metadata

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

func (*MetadataClient) Hooks

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

Hooks returns the client hooks.

func (*MetadataClient) Query

func (c *MetadataClient) Query() *MetadataQuery

Query returns a query builder for Metadata.

func (*MetadataClient) 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) 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) 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) 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) 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 adds a new predicate 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"`
	// contains filtered or unexported fields
}

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

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 (mgb *MetadataGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) BoolX

func (mgb *MetadataGroupBy) BoolX(ctx context.Context) bool

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

func (*MetadataGroupBy) Bools

func (mgb *MetadataGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) BoolsX

func (mgb *MetadataGroupBy) BoolsX(ctx context.Context) []bool

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

func (*MetadataGroupBy) Float64

func (mgb *MetadataGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) Float64X

func (mgb *MetadataGroupBy) Float64X(ctx context.Context) float64

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

func (*MetadataGroupBy) Float64s

func (mgb *MetadataGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) Float64sX

func (mgb *MetadataGroupBy) Float64sX(ctx context.Context) []float64

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

func (*MetadataGroupBy) Int

func (mgb *MetadataGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) IntX

func (mgb *MetadataGroupBy) IntX(ctx context.Context) int

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

func (*MetadataGroupBy) Ints

func (mgb *MetadataGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) IntsX

func (mgb *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 (mgb *MetadataGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*MetadataGroupBy) String

func (mgb *MetadataGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) StringX

func (mgb *MetadataGroupBy) StringX(ctx context.Context) string

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

func (*MetadataGroupBy) Strings

func (mgb *MetadataGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*MetadataGroupBy) StringsX

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

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

func (m *MetadataMutation) Op() Op

Op returns the operation name.

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) 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) 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) 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 returns 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.

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 exactly one Metadata entity is not 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 exactly one Metadata ID is not 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) QueryUser

func (mq *MetadataQuery) QueryUser() *UserQuery

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

func (*MetadataQuery) Select

func (mq *MetadataQuery) Select(field string, 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) Where

func (mq *MetadataQuery) Where(ps ...predicate.Metadata) *MetadataQuery

Where adds a new predicate for the MetadataQuery builder.

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 (ms *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 (ms *MetadataSelect) BoolX(ctx context.Context) bool

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

func (*MetadataSelect) Bools

func (ms *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 (ms *MetadataSelect) BoolsX(ctx context.Context) []bool

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

func (*MetadataSelect) Float64

func (ms *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 (ms *MetadataSelect) Float64X(ctx context.Context) float64

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

func (*MetadataSelect) Float64s

func (ms *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 (ms *MetadataSelect) Float64sX(ctx context.Context) []float64

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

func (*MetadataSelect) Int

func (ms *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 (ms *MetadataSelect) IntX(ctx context.Context) int

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

func (*MetadataSelect) Ints

func (ms *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 (ms *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 (ms *MetadataSelect) ScanX(ctx context.Context, v interface{})

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

func (*MetadataSelect) String

func (ms *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 (ms *MetadataSelect) StringX(ctx context.Context) string

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

func (*MetadataSelect) Strings

func (ms *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 (ms *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) 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) 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) 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) 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 adds a new predicate for 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) 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) 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) 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) 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) 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 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, func(string) bool)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Pet

type Pet struct {

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

Pet is the model entity for the Pet schema.

func (*Pet) QueryOwner

func (pe *Pet) QueryOwner() *UserQuery

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

func (*Pet) String

func (pe *Pet) String() string

String implements the fmt.Stringer.

func (*Pet) Unwrap

func (pe *Pet) Unwrap() *Pet

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

func (*Pet) Update

func (pe *Pet) Update() *PetUpdateOne

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

type PetClient

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

PetClient is a client for the Pet schema.

func NewPetClient

func NewPetClient(c config) *PetClient

NewPetClient returns a client for the Pet from the given config.

func (*PetClient) Create

func (c *PetClient) Create() *PetCreate

Create returns a create builder for Pet.

func (*PetClient) CreateBulk

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

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

func (*PetClient) Delete

func (c *PetClient) Delete() *PetDelete

Delete returns a delete builder for Pet.

func (*PetClient) DeleteOne

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

DeleteOne returns a delete builder for the given entity.

func (*PetClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*PetClient) Get

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

Get returns a Pet entity by its id.

func (*PetClient) GetX

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

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

func (*PetClient) Hooks

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

Hooks returns the client hooks.

func (*PetClient) Query

func (c *PetClient) Query() *PetQuery

Query returns a query builder for Pet.

func (*PetClient) QueryOwner

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

QueryOwner queries the owner edge of a Pet.

func (*PetClient) Update

func (c *PetClient) Update() *PetUpdate

Update returns an update builder for Pet.

func (*PetClient) UpdateOne

func (c *PetClient) UpdateOne(pe *Pet) *PetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PetClient) UpdateOneID

func (c *PetClient) UpdateOneID(id int) *PetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PetClient) Use

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

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

type PetCreate

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

PetCreate is the builder for creating a Pet entity.

func (*PetCreate) 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) 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 adds a new predicate 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 (pgb *PetGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) BoolX

func (pgb *PetGroupBy) BoolX(ctx context.Context) bool

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

func (*PetGroupBy) Bools

func (pgb *PetGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) BoolsX

func (pgb *PetGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PetGroupBy) Float64

func (pgb *PetGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) Float64X

func (pgb *PetGroupBy) Float64X(ctx context.Context) float64

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

func (*PetGroupBy) Float64s

func (pgb *PetGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) Float64sX

func (pgb *PetGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PetGroupBy) Int

func (pgb *PetGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) IntX

func (pgb *PetGroupBy) IntX(ctx context.Context) int

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

func (*PetGroupBy) Ints

func (pgb *PetGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) IntsX

func (pgb *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 (pgb *PetGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PetGroupBy) String

func (pgb *PetGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) StringX

func (pgb *PetGroupBy) StringX(ctx context.Context) string

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

func (*PetGroupBy) Strings

func (pgb *PetGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PetGroupBy) StringsX

func (pgb *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.

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 returns 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).

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 exactly one Pet entity is not 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 exactly one Pet ID is not 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(field string, 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) 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 (ps *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 (ps *PetSelect) BoolX(ctx context.Context) bool

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

func (*PetSelect) Bools

func (ps *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 (ps *PetSelect) BoolsX(ctx context.Context) []bool

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

func (*PetSelect) Float64

func (ps *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 (ps *PetSelect) Float64X(ctx context.Context) float64

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

func (*PetSelect) Float64s

func (ps *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 (ps *PetSelect) Float64sX(ctx context.Context) []float64

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

func (*PetSelect) Int

func (ps *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 (ps *PetSelect) IntX(ctx context.Context) int

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

func (*PetSelect) Ints

func (ps *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 (ps *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 (ps *PetSelect) ScanX(ctx context.Context, v interface{})

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

func (*PetSelect) String

func (ps *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 (ps *PetSelect) StringX(ctx context.Context) string

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

func (*PetSelect) Strings

func (ps *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 (ps *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 adds a new predicate for 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) SetNillableOwnerID

func (puo *PetUpdateOne) SetNillableOwnerID(i *int) *PetUpdateOne

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

func (*PetUpdateOne) SetOwner

func (puo *PetUpdateOne) SetOwner(u *User) *PetUpdateOne

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

func (*PetUpdateOne) SetOwnerID

func (puo *PetUpdateOne) SetOwnerID(i int) *PetUpdateOne

SetOwnerID sets the "owner_id" field.

type Pets

type Pets []*Pet

Pets is a parsable slice of Pet.

type Policy

type Policy = ent.Policy

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

type Post

type Post struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// AuthorID holds the value of the "author_id" field.
	AuthorID *int `json:"author_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PostQuery when eager-loading is set.
	Edges PostEdges `json:"edges"`
	// contains filtered or unexported fields
}

Post is the model entity for the Post schema.

func (*Post) QueryAuthor

func (po *Post) QueryAuthor() *UserQuery

QueryAuthor queries the "author" edge of the Post entity.

func (*Post) String

func (po *Post) String() string

String implements the fmt.Stringer.

func (*Post) Unwrap

func (po *Post) Unwrap() *Post

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

func (*Post) Update

func (po *Post) Update() *PostUpdateOne

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

type PostClient

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

PostClient is a client for the Post schema.

func NewPostClient

func NewPostClient(c config) *PostClient

NewPostClient returns a client for the Post from the given config.

func (*PostClient) Create

func (c *PostClient) Create() *PostCreate

Create returns a create builder for Post.

func (*PostClient) CreateBulk

func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk

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

func (*PostClient) Delete

func (c *PostClient) Delete() *PostDelete

Delete returns a delete builder for Post.

func (*PostClient) DeleteOne

func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PostClient) DeleteOneID

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

DeleteOneID returns a delete builder for the given id.

func (*PostClient) Get

func (c *PostClient) Get(ctx context.Context, id int) (*Post, error)

Get returns a Post entity by its id.

func (*PostClient) GetX

func (c *PostClient) GetX(ctx context.Context, id int) *Post

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

func (*PostClient) Hooks

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

Hooks returns the client hooks.

func (*PostClient) Query

func (c *PostClient) Query() *PostQuery

Query returns a query builder for Post.

func (*PostClient) QueryAuthor

func (c *PostClient) QueryAuthor(po *Post) *UserQuery

QueryAuthor queries the author edge of a Post.

func (*PostClient) Update

func (c *PostClient) Update() *PostUpdate

Update returns an update builder for Post.

func (*PostClient) UpdateOne

func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PostClient) UpdateOneID

func (c *PostClient) UpdateOneID(id int) *PostUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PostClient) Use

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

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

type PostCreate

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

PostCreate is the builder for creating a Post entity.

func (*PostCreate) 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) 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 adds a new predicate 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 (pgb *PostGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) BoolX

func (pgb *PostGroupBy) BoolX(ctx context.Context) bool

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

func (*PostGroupBy) Bools

func (pgb *PostGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) BoolsX

func (pgb *PostGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PostGroupBy) Float64

func (pgb *PostGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) Float64X

func (pgb *PostGroupBy) Float64X(ctx context.Context) float64

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

func (*PostGroupBy) Float64s

func (pgb *PostGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) Float64sX

func (pgb *PostGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PostGroupBy) Int

func (pgb *PostGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) IntX

func (pgb *PostGroupBy) IntX(ctx context.Context) int

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

func (*PostGroupBy) Ints

func (pgb *PostGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) IntsX

func (pgb *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 (pgb *PostGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PostGroupBy) String

func (pgb *PostGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) StringX

func (pgb *PostGroupBy) StringX(ctx context.Context) string

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

func (*PostGroupBy) Strings

func (pgb *PostGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) StringsX

func (pgb *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 returns 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.

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

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 exactly one Post entity is not 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 exactly one Post ID is not 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(field string, 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) 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 (ps *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 (ps *PostSelect) BoolX(ctx context.Context) bool

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

func (*PostSelect) Bools

func (ps *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 (ps *PostSelect) BoolsX(ctx context.Context) []bool

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

func (*PostSelect) Float64

func (ps *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 (ps *PostSelect) Float64X(ctx context.Context) float64

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

func (*PostSelect) Float64s

func (ps *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 (ps *PostSelect) Float64sX(ctx context.Context) []float64

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

func (*PostSelect) Int

func (ps *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 (ps *PostSelect) IntX(ctx context.Context) int

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

func (*PostSelect) Ints

func (ps *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 (ps *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 (ps *PostSelect) ScanX(ctx context.Context, v interface{})

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

func (*PostSelect) String

func (ps *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 (ps *PostSelect) StringX(ctx context.Context) string

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

func (*PostSelect) Strings

func (ps *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 (ps *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 adds a new predicate for 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) 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 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(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 Rollbacker method.

type Tx

type Tx struct {

	// 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
	// Pet is the client for interacting with the Pet builders.
	Pet *PetClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// 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) QuerySpouse

func (u *User) QuerySpouse() *UserQuery

QuerySpouse queries the "spouse" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryCard

func (c *UserClient) QueryCard(u *User) *CardQuery

QueryCard queries the card edge of a User.

func (*UserClient) QueryChildren

func (c *UserClient) QueryChildren(u *User) *UserQuery

QueryChildren queries the children edge of a User.

func (*UserClient) QueryInfo

func (c *UserClient) QueryInfo(u *User) *InfoQuery

QueryInfo queries the info edge of a User.

func (*UserClient) QueryMetadata

func (c *UserClient) QueryMetadata(u *User) *MetadataQuery

QueryMetadata queries the metadata edge of a User.

func (*UserClient) QueryParent

func (c *UserClient) QueryParent(u *User) *UserQuery

QueryParent queries the parent edge of a User.

func (*UserClient) QueryPets

func (c *UserClient) QueryPets(u *User) *PetQuery

QueryPets queries the pets edge of a User.

func (*UserClient) 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) 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) 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) 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 adds a new predicate 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"`
	// 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) 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 (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

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

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

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

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

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

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

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

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

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

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntsX

func (ugb *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 (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

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

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringsX

func (ugb *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) 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 returns 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 returns 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) 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.

func (*UserMutation) InfoCleared

func (m *UserMutation) InfoCleared() bool

InfoCleared returns 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 returns 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 returns 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 returns 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) 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) 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) 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) 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 returns 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).

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 exactly one User entity is not 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 exactly one User ID is not 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) QuerySpouse

func (uq *UserQuery) QuerySpouse() *UserQuery

QuerySpouse chains the current query on the "spouse" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(field string, 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) 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) 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 (us *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 (us *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (us *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 (us *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (us *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 (us *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (us *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 (us *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (us *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 (us *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (us *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 (us *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 (us *UserSelect) ScanX(ctx context.Context, v interface{})

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

func (*UserSelect) String

func (us *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 (us *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (us *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 (us *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) 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) 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) 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 adds a new predicate for 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) 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) 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) 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) 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 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