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) 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 reports if the "owner" edge to the User entity was cleared.

func (*CardMutation) OwnerID

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

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

func (*CardMutation) OwnerIDCleared

func (m *CardMutation) OwnerIDCleared() bool

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

func (*CardMutation) OwnerIDs

func (m *CardMutation) OwnerIDs() (ids []int)

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

func (*CardMutation) RemovedEdges

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

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

func (*CardMutation) RemovedIDs

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

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

func (*CardMutation) ResetEdge

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

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

func (*CardMutation) ResetField

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

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

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

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

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

func (*CardQuery) Where

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

Where adds a new predicate for the CardQuery builder.

func (*CardQuery) WithOwner

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

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

type CardSelect

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

CardSelect is the builder for selecting fields of Card entities.

func (*CardSelect) Bool

func (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) Select

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

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

func (*CardUpdateOne) 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 reports if the "user" edge to the User entity was cleared.

func (*InfoMutation) UserID

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

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

func (*InfoMutation) UserIDs

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

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

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

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

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

func (*InfoQuery) Where

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

Where adds a new predicate for the InfoQuery builder.

func (*InfoQuery) WithUser

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

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

type InfoSelect

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

InfoSelect is the builder for selecting fields of Info entities.

func (*InfoSelect) Bool

func (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) Select

func (iuo *InfoUpdateOne) Select(field string, fields ...string) *InfoUpdateOne

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

func (*InfoUpdateOne) SetContent

func (iuo *InfoUpdateOne) SetContent(jm json.RawMessage) *InfoUpdateOne

SetContent sets the "content" field.

func (*InfoUpdateOne) SetNillableUserID

func (iuo *InfoUpdateOne) SetNillableUserID(id *int) *InfoUpdateOne

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

func (*InfoUpdateOne) SetUser

func (iuo *InfoUpdateOne) SetUser(u *User) *InfoUpdateOne

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

func (*InfoUpdateOne) SetUserID

func (iuo *InfoUpdateOne) SetUserID(id int) *InfoUpdateOne

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

type Infos

type Infos []*Info

Infos is a parsable slice of Info.

type Metadata

type Metadata struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Age holds the value of the "age" field.
	Age int `json:"age,omitempty"`
	// 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 reports if the "user" edge to the User entity was cleared.

func (*MetadataMutation) UserID

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

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

func (*MetadataMutation) UserIDs

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

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

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 *