entc

package
v0.0.0-...-bf847f1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 20 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.
	TypeAuthor = "Author"
	TypeFilm   = "Film"
)

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 nor 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 Client 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(entc.As(entc.Sum(field1), "sum_field1"), (entc.As(entc.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 Author

type Author struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Status holds the value of the "status" field.
	Status int8 `json:"status,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// FullName holds the value of the "fullName" field.
	FullName string `json:"fullName,omitempty"`
	// Age holds the value of the "age" field.
	Age int8 `json:"age,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AuthorQuery when eager-loading is set.
	Edges AuthorEdges `json:"edges"`
	// contains filtered or unexported fields
}

Author is the model entity for the Author schema.

func (*Author) QueryFilms

func (a *Author) QueryFilms() *FilmQuery

QueryFilms queries the films edge of the Author.

func (*Author) String

func (a *Author) String() string

String implements the fmt.Stringer.

func (*Author) Unwrap

func (a *Author) Unwrap() *Author

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

func (*Author) Update

func (a *Author) Update() *AuthorUpdateOne

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

type AuthorClient

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

AuthorClient is a client for the Author schema.

func NewAuthorClient

func NewAuthorClient(c config) *AuthorClient

NewAuthorClient returns a client for the Author from the given config.

func (*AuthorClient) Create

func (c *AuthorClient) Create() *AuthorCreate

Create returns a create builder for Author.

func (*AuthorClient) Delete

func (c *AuthorClient) Delete() *AuthorDelete

Delete returns a delete builder for Author.

func (*AuthorClient) DeleteOne

func (c *AuthorClient) DeleteOne(a *Author) *AuthorDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AuthorClient) DeleteOneID

func (c *AuthorClient) DeleteOneID(id uuid.UUID) *AuthorDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AuthorClient) Get

func (c *AuthorClient) Get(ctx context.Context, id uuid.UUID) (*Author, error)

Get returns a Author entity by its id.

func (*AuthorClient) GetX

func (c *AuthorClient) GetX(ctx context.Context, id uuid.UUID) *Author

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

func (*AuthorClient) Hooks

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

Hooks returns the client hooks.

func (*AuthorClient) Query

func (c *AuthorClient) Query() *AuthorQuery

Create returns a query builder for Author.

func (*AuthorClient) QueryFilms

func (c *AuthorClient) QueryFilms(a *Author) *FilmQuery

QueryFilms queries the films edge of a Author.

func (*AuthorClient) Update

func (c *AuthorClient) Update() *AuthorUpdate

Update returns an update builder for Author.

func (*AuthorClient) UpdateOne

func (c *AuthorClient) UpdateOne(a *Author) *AuthorUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AuthorClient) UpdateOneID

func (c *AuthorClient) UpdateOneID(id uuid.UUID) *AuthorUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AuthorClient) Use

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

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

type AuthorCreate

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

AuthorCreate is the builder for creating a Author entity.

func (*AuthorCreate) AddFilmIDs

func (ac *AuthorCreate) AddFilmIDs(ids ...uuid.UUID) *AuthorCreate

AddFilmIDs adds the films edge to Film by ids.

func (*AuthorCreate) AddFilms

func (ac *AuthorCreate) AddFilms(f ...*Film) *AuthorCreate

AddFilms adds the films edges to Film.

func (*AuthorCreate) Mutation

func (ac *AuthorCreate) Mutation() *AuthorMutation

Mutation returns the AuthorMutation object of the builder.

func (*AuthorCreate) Save

func (ac *AuthorCreate) Save(ctx context.Context) (*Author, error)

Save creates the Author in the database.

func (*AuthorCreate) SaveX

func (ac *AuthorCreate) SaveX(ctx context.Context) *Author

SaveX calls Save and panics if Save returns an error.

func (*AuthorCreate) SetAge

func (ac *AuthorCreate) SetAge(i int8) *AuthorCreate

SetAge sets the age field.

func (*AuthorCreate) SetCreatedAt

func (ac *AuthorCreate) SetCreatedAt(t time.Time) *AuthorCreate

SetCreatedAt sets the created_at field.

func (*AuthorCreate) SetFullName

func (ac *AuthorCreate) SetFullName(s string) *AuthorCreate

SetFullName sets the fullName field.

func (*AuthorCreate) SetID

func (ac *AuthorCreate) SetID(u uuid.UUID) *AuthorCreate

SetID sets the id field.

func (*AuthorCreate) SetNillableCreatedAt

func (ac *AuthorCreate) SetNillableCreatedAt(t *time.Time) *AuthorCreate

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

func (*AuthorCreate) SetNillableStatus

func (ac *AuthorCreate) SetNillableStatus(i *int8) *AuthorCreate

SetNillableStatus sets the status field if the given value is not nil.

func (*AuthorCreate) SetNillableUpdatedAt

func (ac *AuthorCreate) SetNillableUpdatedAt(t *time.Time) *AuthorCreate

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

func (*AuthorCreate) SetStatus

func (ac *AuthorCreate) SetStatus(i int8) *AuthorCreate

SetStatus sets the status field.

func (*AuthorCreate) SetUpdatedAt

func (ac *AuthorCreate) SetUpdatedAt(t time.Time) *AuthorCreate

SetUpdatedAt sets the updated_at field.

type AuthorDelete

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

AuthorDelete is the builder for deleting a Author entity.

func (*AuthorDelete) Exec

func (ad *AuthorDelete) Exec(ctx context.Context) (int, error)

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

func (*AuthorDelete) ExecX

func (ad *AuthorDelete) ExecX(ctx context.Context) int

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

func (*AuthorDelete) Where

func (ad *AuthorDelete) Where(ps ...predicate.Author) *AuthorDelete

Where adds a new predicate to the delete builder.

type AuthorDeleteOne

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

AuthorDeleteOne is the builder for deleting a single Author entity.

func (*AuthorDeleteOne) Exec

func (ado *AuthorDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AuthorDeleteOne) ExecX

func (ado *AuthorDeleteOne) ExecX(ctx context.Context)

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

type AuthorEdges

type AuthorEdges struct {
	// Films holds the value of the films edge.
	Films []*Film
	// contains filtered or unexported fields
}

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

func (AuthorEdges) FilmsOrErr

func (e AuthorEdges) FilmsOrErr() ([]*Film, error)

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

type AuthorGroupBy

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

AuthorGroupBy is the builder for group-by Author entities.

func (*AuthorGroupBy) Aggregate

func (agb *AuthorGroupBy) Aggregate(fns ...AggregateFunc) *AuthorGroupBy

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

func (*AuthorGroupBy) Bool

func (agb *AuthorGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*AuthorGroupBy) BoolX

func (agb *AuthorGroupBy) BoolX(ctx context.Context) bool

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

func (*AuthorGroupBy) Bools

func (agb *AuthorGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*AuthorGroupBy) BoolsX

func (agb *AuthorGroupBy) BoolsX(ctx context.Context) []bool

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

func (*AuthorGroupBy) Float64

func (agb *AuthorGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*AuthorGroupBy) Float64X

func (agb *AuthorGroupBy) Float64X(ctx context.Context) float64

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

func (*AuthorGroupBy) Float64s

func (agb *AuthorGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*AuthorGroupBy) Float64sX

func (agb *AuthorGroupBy) Float64sX(ctx context.Context) []float64

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

func (*AuthorGroupBy) Int

func (agb *AuthorGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*AuthorGroupBy) IntX

func (agb *AuthorGroupBy) IntX(ctx context.Context) int

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

func (*AuthorGroupBy) Ints

func (agb *AuthorGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*AuthorGroupBy) IntsX

func (agb *AuthorGroupBy) IntsX(ctx context.Context) []int

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

func (*AuthorGroupBy) Scan

func (agb *AuthorGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*AuthorGroupBy) ScanX

func (agb *AuthorGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*AuthorGroupBy) String

func (agb *AuthorGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*AuthorGroupBy) StringX

func (agb *AuthorGroupBy) StringX(ctx context.Context) string

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

func (*AuthorGroupBy) Strings

func (agb *AuthorGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*AuthorGroupBy) StringsX

func (agb *AuthorGroupBy) StringsX(ctx context.Context) []string

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

type AuthorMutation

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

AuthorMutation represents an operation that mutate the Authors nodes in the graph.

func (*AuthorMutation) AddAge

func (m *AuthorMutation) AddAge(i int8)

AddAge adds i to age.

func (*AuthorMutation) AddField

func (m *AuthorMutation) AddField(name string, value ent.Value) error

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*AuthorMutation) AddFilmIDs

func (m *AuthorMutation) AddFilmIDs(ids ...uuid.UUID)

AddFilmIDs adds the films edge to Film by ids.

func (*AuthorMutation) AddStatus

func (m *AuthorMutation) AddStatus(i int8)

AddStatus adds i to status.

func (*AuthorMutation) AddedAge

func (m *AuthorMutation) AddedAge() (r int8, exists bool)

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

func (*AuthorMutation) AddedEdges

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

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

func (*AuthorMutation) AddedField

func (m *AuthorMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*AuthorMutation) AddedFields

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

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

func (*AuthorMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*AuthorMutation) AddedStatus

func (m *AuthorMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the status field in this mutation.

func (*AuthorMutation) Age

func (m *AuthorMutation) Age() (r int8, exists bool)

Age returns the age value in the mutation.

func (*AuthorMutation) ClearEdge

func (m *AuthorMutation) ClearEdge(name string) error

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*AuthorMutation) ClearField

func (m *AuthorMutation) ClearField(name string) error

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*AuthorMutation) ClearedEdges

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

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

func (*AuthorMutation) ClearedFields

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

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

func (AuthorMutation) Client

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

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

CreatedAt returns the created_at value in the mutation.

func (*AuthorMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*AuthorMutation) Field

func (m *AuthorMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*AuthorMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*AuthorMutation) Fields

func (m *AuthorMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*AuthorMutation) FilmsIDs

func (m *AuthorMutation) FilmsIDs() (ids []uuid.UUID)

FilmsIDs returns the films ids in the mutation.

func (*AuthorMutation) FullName

func (m *AuthorMutation) FullName() (r string, exists bool)

FullName returns the fullName value in the mutation.

func (*AuthorMutation) ID

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

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*AuthorMutation) OldAge

func (m *AuthorMutation) OldAge(ctx context.Context) (v int8, err error)

OldAge returns the old age value of the Author. If the Author 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 database query fails.

func (*AuthorMutation) OldCreatedAt

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

OldCreatedAt returns the old created_at value of the Author. If the Author 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 database query fails.

func (*AuthorMutation) OldField

func (m *AuthorMutation) 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 was failed.

func (*AuthorMutation) OldFullName

func (m *AuthorMutation) OldFullName(ctx context.Context) (v string, err error)

OldFullName returns the old fullName value of the Author. If the Author 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 database query fails.

func (*AuthorMutation) OldStatus

func (m *AuthorMutation) OldStatus(ctx context.Context) (v int8, err error)

OldStatus returns the old status value of the Author. If the Author 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 database query fails.

func (*AuthorMutation) OldUpdatedAt

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

OldUpdatedAt returns the old updated_at value of the Author. If the Author 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 database query fails.

func (*AuthorMutation) Op

func (m *AuthorMutation) Op() Op

Op returns the operation name.

func (*AuthorMutation) RemoveFilmIDs

func (m *AuthorMutation) RemoveFilmIDs(ids ...uuid.UUID)

RemoveFilmIDs removes the films edge to Film by ids.

func (*AuthorMutation) RemovedEdges

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

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

func (*AuthorMutation) RemovedFilmsIDs

func (m *AuthorMutation) RemovedFilmsIDs() (ids []uuid.UUID)

RemovedFilms returns the removed ids of films.

func (*AuthorMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*AuthorMutation) ResetAge

func (m *AuthorMutation) ResetAge()

ResetAge reset all changes of the "age" field.

func (*AuthorMutation) ResetCreatedAt

func (m *AuthorMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*AuthorMutation) ResetEdge

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

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

func (*AuthorMutation) ResetField

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

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

func (*AuthorMutation) ResetFilms

func (m *AuthorMutation) ResetFilms()

ResetFilms reset all changes of the "films" edge.

func (*AuthorMutation) ResetFullName

func (m *AuthorMutation) ResetFullName()

ResetFullName reset all changes of the "fullName" field.

func (*AuthorMutation) ResetStatus

func (m *AuthorMutation) ResetStatus()

ResetStatus reset all changes of the "status" field.

func (*AuthorMutation) ResetUpdatedAt

func (m *AuthorMutation) ResetUpdatedAt()

ResetUpdatedAt reset all changes of the "updated_at" field.

func (*AuthorMutation) SetAge

func (m *AuthorMutation) SetAge(i int8)

SetAge sets the age field.

func (*AuthorMutation) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*AuthorMutation) SetField

func (m *AuthorMutation) SetField(name string, value ent.Value) error

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*AuthorMutation) SetFullName

func (m *AuthorMutation) SetFullName(s string)

SetFullName sets the fullName field.

func (*AuthorMutation) SetID

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

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

func (*AuthorMutation) SetStatus

func (m *AuthorMutation) SetStatus(i int8)

SetStatus sets the status field.

func (*AuthorMutation) SetUpdatedAt

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

SetUpdatedAt sets the updated_at field.

func (*AuthorMutation) Status

func (m *AuthorMutation) Status() (r int8, exists bool)

Status returns the status value in the mutation.

func (AuthorMutation) Tx

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

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

func (*AuthorMutation) Type

func (m *AuthorMutation) Type() string

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

func (*AuthorMutation) UpdatedAt

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

UpdatedAt returns the updated_at value in the mutation.

type AuthorQuery

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

AuthorQuery is the builder for querying Author entities.

func (*AuthorQuery) All

func (aq *AuthorQuery) All(ctx context.Context) ([]*Author, error)

All executes the query and returns a list of Authors.

func (*AuthorQuery) AllX

func (aq *AuthorQuery) AllX(ctx context.Context) []*Author

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

func (*AuthorQuery) Clone

func (aq *AuthorQuery) Clone() *AuthorQuery

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

func (*AuthorQuery) Count

func (aq *AuthorQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AuthorQuery) CountX

func (aq *AuthorQuery) CountX(ctx context.Context) int

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

func (*AuthorQuery) Exist

func (aq *AuthorQuery) Exist(ctx context.Context) (bool, error)

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

func (*AuthorQuery) ExistX

func (aq *AuthorQuery) ExistX(ctx context.Context) bool

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

func (*AuthorQuery) First

func (aq *AuthorQuery) First(ctx context.Context) (*Author, error)

First returns the first Author entity in the query. Returns *NotFoundError when no author was found.

func (*AuthorQuery) FirstID

func (aq *AuthorQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Author id in the query. Returns *NotFoundError when no id was found.

func (*AuthorQuery) FirstX

func (aq *AuthorQuery) FirstX(ctx context.Context) *Author

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

func (*AuthorQuery) FirstXID

func (aq *AuthorQuery) FirstXID(ctx context.Context) uuid.UUID

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

func (*AuthorQuery) GroupBy

func (aq *AuthorQuery) GroupBy(field string, fields ...string) *AuthorGroupBy

GroupBy 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 {
	Status int8 `json:"status,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Author.Query().
	GroupBy(author.FieldStatus).
	Aggregate(entc.Count()).
	Scan(ctx, &v)

func (*AuthorQuery) IDs

func (aq *AuthorQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Author ids.

func (*AuthorQuery) IDsX

func (aq *AuthorQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*AuthorQuery) Limit

func (aq *AuthorQuery) Limit(limit int) *AuthorQuery

Limit adds a limit step to the query.

func (*AuthorQuery) Offset

func (aq *AuthorQuery) Offset(offset int) *AuthorQuery

Offset adds an offset step to the query.

func (*AuthorQuery) Only

func (aq *AuthorQuery) Only(ctx context.Context) (*Author, error)

Only returns the only Author entity in the query, returns an error if not exactly one entity was returned.

func (*AuthorQuery) OnlyID

func (aq *AuthorQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID returns the only Author id in the query, returns an error if not exactly one id was returned.

func (*AuthorQuery) OnlyIDX

func (aq *AuthorQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*AuthorQuery) OnlyX

func (aq *AuthorQuery) OnlyX(ctx context.Context) *Author

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

func (*AuthorQuery) Order

func (aq *AuthorQuery) Order(o ...OrderFunc) *AuthorQuery

Order adds an order step to the query.

func (*AuthorQuery) QueryFilms

func (aq *AuthorQuery) QueryFilms() *FilmQuery

QueryFilms chains the current query on the films edge.

func (*AuthorQuery) Select

func (aq *AuthorQuery) Select(field string, fields ...string) *AuthorSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Status int8 `json:"status,omitempty"`
}

client.Author.Query().
	Select(author.FieldStatus).
	Scan(ctx, &v)

func (*AuthorQuery) Where

func (aq *AuthorQuery) Where(ps ...predicate.Author) *AuthorQuery

Where adds a new predicate for the builder.

func (*AuthorQuery) WithFilms

func (aq *AuthorQuery) WithFilms(opts ...func(*FilmQuery)) *AuthorQuery
WithFilms tells the query-builder to eager-loads the nodes that are connected to

the "films" edge. The optional arguments used to configure the query builder of the edge.

type AuthorSelect

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

AuthorSelect is the builder for select fields of Author entities.

func (*AuthorSelect) Bool

func (as *AuthorSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*AuthorSelect) BoolX

func (as *AuthorSelect) BoolX(ctx context.Context) bool

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

func (*AuthorSelect) Bools

func (as *AuthorSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*AuthorSelect) BoolsX

func (as *AuthorSelect) BoolsX(ctx context.Context) []bool

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

func (*AuthorSelect) Float64

func (as *AuthorSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*AuthorSelect) Float64X

func (as *AuthorSelect) Float64X(ctx context.Context) float64

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

func (*AuthorSelect) Float64s

func (as *AuthorSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*AuthorSelect) Float64sX

func (as *AuthorSelect) Float64sX(ctx context.Context) []float64

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

func (*AuthorSelect) Int

func (as *AuthorSelect) Int(ctx context.Context) (_ int, err error)

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

func (*AuthorSelect) IntX

func (as *AuthorSelect) IntX(ctx context.Context) int

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

func (*AuthorSelect) Ints

func (as *AuthorSelect) Ints(ctx context.Context) ([]int, error)

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

func (*AuthorSelect) IntsX

func (as *AuthorSelect) IntsX(ctx context.Context) []int

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

func (*AuthorSelect) Scan

func (as *AuthorSelect) Scan(ctx context.Context, v interface{}) error

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

func (*AuthorSelect) ScanX

func (as *AuthorSelect) ScanX(ctx context.Context, v interface{})

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

func (*AuthorSelect) String

func (as *AuthorSelect) String(ctx context.Context) (_ string, err error)

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

func (*AuthorSelect) StringX

func (as *AuthorSelect) StringX(ctx context.Context) string

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

func (*AuthorSelect) Strings

func (as *AuthorSelect) Strings(ctx context.Context) ([]string, error)

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

func (*AuthorSelect) StringsX

func (as *AuthorSelect) StringsX(ctx context.Context) []string

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

type AuthorUpdate

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

AuthorUpdate is the builder for updating Author entities.

func (*AuthorUpdate) AddAge

func (au *AuthorUpdate) AddAge(i int8) *AuthorUpdate

AddAge adds i to age.

func (*AuthorUpdate) AddFilmIDs

func (au *AuthorUpdate) AddFilmIDs(ids ...uuid.UUID) *AuthorUpdate

AddFilmIDs adds the films edge to Film by ids.

func (*AuthorUpdate) AddFilms

func (au *AuthorUpdate) AddFilms(f ...*Film) *AuthorUpdate

AddFilms adds the films edges to Film.

func (*AuthorUpdate) AddStatus

func (au *AuthorUpdate) AddStatus(i int8) *AuthorUpdate

AddStatus adds i to status.

func (*AuthorUpdate) Exec

func (au *AuthorUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*AuthorUpdate) ExecX

func (au *AuthorUpdate) ExecX(ctx context.Context)

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

func (*AuthorUpdate) Mutation

func (au *AuthorUpdate) Mutation() *AuthorMutation

Mutation returns the AuthorMutation object of the builder.

func (*AuthorUpdate) RemoveFilmIDs

func (au *AuthorUpdate) RemoveFilmIDs(ids ...uuid.UUID) *AuthorUpdate

RemoveFilmIDs removes the films edge to Film by ids.

func (*AuthorUpdate) RemoveFilms

func (au *AuthorUpdate) RemoveFilms(f ...*Film) *AuthorUpdate

RemoveFilms removes films edges to Film.

func (*AuthorUpdate) Save

func (au *AuthorUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*AuthorUpdate) SaveX

func (au *AuthorUpdate) SaveX(ctx context.Context) int

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

func (*AuthorUpdate) SetAge

func (au *AuthorUpdate) SetAge(i int8) *AuthorUpdate

SetAge sets the age field.

func (*AuthorUpdate) SetFullName

func (au *AuthorUpdate) SetFullName(s string) *AuthorUpdate

SetFullName sets the fullName field.

func (*AuthorUpdate) SetNillableStatus

func (au *AuthorUpdate) SetNillableStatus(i *int8) *AuthorUpdate

SetNillableStatus sets the status field if the given value is not nil.

func (*AuthorUpdate) SetStatus

func (au *AuthorUpdate) SetStatus(i int8) *AuthorUpdate

SetStatus sets the status field.

func (*AuthorUpdate) SetUpdatedAt

func (au *AuthorUpdate) SetUpdatedAt(t time.Time) *AuthorUpdate

SetUpdatedAt sets the updated_at field.

func (*AuthorUpdate) Where

func (au *AuthorUpdate) Where(ps ...predicate.Author) *AuthorUpdate

Where adds a new predicate for the builder.

type AuthorUpdateOne

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

AuthorUpdateOne is the builder for updating a single Author entity.

func (*AuthorUpdateOne) AddAge

func (auo *AuthorUpdateOne) AddAge(i int8) *AuthorUpdateOne

AddAge adds i to age.

func (*AuthorUpdateOne) AddFilmIDs

func (auo *AuthorUpdateOne) AddFilmIDs(ids ...uuid.UUID) *AuthorUpdateOne

AddFilmIDs adds the films edge to Film by ids.

func (*AuthorUpdateOne) AddFilms

func (auo *AuthorUpdateOne) AddFilms(f ...*Film) *AuthorUpdateOne

AddFilms adds the films edges to Film.

func (*AuthorUpdateOne) AddStatus

func (auo *AuthorUpdateOne) AddStatus(i int8) *AuthorUpdateOne

AddStatus adds i to status.

func (*AuthorUpdateOne) Exec

func (auo *AuthorUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*AuthorUpdateOne) ExecX

func (auo *AuthorUpdateOne) ExecX(ctx context.Context)

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

func (*AuthorUpdateOne) Mutation

func (auo *AuthorUpdateOne) Mutation() *AuthorMutation

Mutation returns the AuthorMutation object of the builder.

func (*AuthorUpdateOne) RemoveFilmIDs

func (auo *AuthorUpdateOne) RemoveFilmIDs(ids ...uuid.UUID) *AuthorUpdateOne

RemoveFilmIDs removes the films edge to Film by ids.

func (*AuthorUpdateOne) RemoveFilms

func (auo *AuthorUpdateOne) RemoveFilms(f ...*Film) *AuthorUpdateOne

RemoveFilms removes films edges to Film.

func (*AuthorUpdateOne) Save

func (auo *AuthorUpdateOne) Save(ctx context.Context) (*Author, error)

Save executes the query and returns the updated entity.

func (*AuthorUpdateOne) SaveX

func (auo *AuthorUpdateOne) SaveX(ctx context.Context) *Author

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

func (*AuthorUpdateOne) SetAge

func (auo *AuthorUpdateOne) SetAge(i int8) *AuthorUpdateOne

SetAge sets the age field.

func (*AuthorUpdateOne) SetFullName

func (auo *AuthorUpdateOne) SetFullName(s string) *AuthorUpdateOne

SetFullName sets the fullName field.

func (*AuthorUpdateOne) SetNillableStatus

func (auo *AuthorUpdateOne) SetNillableStatus(i *int8) *AuthorUpdateOne

SetNillableStatus sets the status field if the given value is not nil.

func (*AuthorUpdateOne) SetStatus

func (auo *AuthorUpdateOne) SetStatus(i int8) *AuthorUpdateOne

SetStatus sets the status field.

func (*AuthorUpdateOne) SetUpdatedAt

func (auo *AuthorUpdateOne) SetUpdatedAt(t time.Time) *AuthorUpdateOne

SetUpdatedAt sets the updated_at field.

type Authors

type Authors []*Author

Authors is a parsable slice of Author.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Author is the client for interacting with the Author builders.
	Author *AuthorClient
	// Film is the client for interacting with the Film builders.
	Film *FilmClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns the Client stored in 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 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().
	Author.
	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 Film

type Film struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Status holds the value of the "status" field.
	Status int8 `json:"status,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FilmQuery when eager-loading is set.
	Edges FilmEdges `json:"edges"`
	// contains filtered or unexported fields
}

Film is the model entity for the Film schema.

func (*Film) QueryAuthors

func (f *Film) QueryAuthors() *AuthorQuery

QueryAuthors queries the authors edge of the Film.

func (*Film) String

func (f *Film) String() string

String implements the fmt.Stringer.

func (*Film) Unwrap

func (f *Film) Unwrap() *Film

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

func (*Film) Update

func (f *Film) Update() *FilmUpdateOne

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

type FilmClient

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

FilmClient is a client for the Film schema.

func NewFilmClient

func NewFilmClient(c config) *FilmClient

NewFilmClient returns a client for the Film from the given config.

func (*FilmClient) Create

func (c *FilmClient) Create() *FilmCreate

Create returns a create builder for Film.

func (*FilmClient) Delete

func (c *FilmClient) Delete() *FilmDelete

Delete returns a delete builder for Film.

func (*FilmClient) DeleteOne

func (c *FilmClient) DeleteOne(f *Film) *FilmDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FilmClient) DeleteOneID

func (c *FilmClient) DeleteOneID(id uuid.UUID) *FilmDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FilmClient) Get

func (c *FilmClient) Get(ctx context.Context, id uuid.UUID) (*Film, error)

Get returns a Film entity by its id.

func (*FilmClient) GetX

func (c *FilmClient) GetX(ctx context.Context, id uuid.UUID) *Film

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

func (*FilmClient) Hooks

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

Hooks returns the client hooks.

func (*FilmClient) Query

func (c *FilmClient) Query() *FilmQuery

Create returns a query builder for Film.

func (*FilmClient) QueryAuthors

func (c *FilmClient) QueryAuthors(f *Film) *AuthorQuery

QueryAuthors queries the authors edge of a Film.

func (*FilmClient) Update

func (c *FilmClient) Update() *FilmUpdate

Update returns an update builder for Film.

func (*FilmClient) UpdateOne

func (c *FilmClient) UpdateOne(f *Film) *FilmUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FilmClient) UpdateOneID

func (c *FilmClient) UpdateOneID(id uuid.UUID) *FilmUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FilmClient) Use

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

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

type FilmCreate

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

FilmCreate is the builder for creating a Film entity.

func (*FilmCreate) AddAuthorIDs

func (fc *FilmCreate) AddAuthorIDs(ids ...uuid.UUID) *FilmCreate

AddAuthorIDs adds the authors edge to Author by ids.

func (*FilmCreate) AddAuthors

func (fc *FilmCreate) AddAuthors(a ...*Author) *FilmCreate

AddAuthors adds the authors edges to Author.

func (*FilmCreate) Mutation

func (fc *FilmCreate) Mutation() *FilmMutation

Mutation returns the FilmMutation object of the builder.

func (*FilmCreate) Save

func (fc *FilmCreate) Save(ctx context.Context) (*Film, error)

Save creates the Film in the database.

func (*FilmCreate) SaveX

func (fc *FilmCreate) SaveX(ctx context.Context) *Film

SaveX calls Save and panics if Save returns an error.

func (*FilmCreate) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*FilmCreate) SetDescription

func (fc *FilmCreate) SetDescription(s string) *FilmCreate

SetDescription sets the description field.

func (*FilmCreate) SetID

func (fc *FilmCreate) SetID(u uuid.UUID) *FilmCreate

SetID sets the id field.

func (*FilmCreate) SetNillableCreatedAt

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

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

func (*FilmCreate) SetNillableStatus

func (fc *FilmCreate) SetNillableStatus(i *int8) *FilmCreate

SetNillableStatus sets the status field if the given value is not nil.

func (*FilmCreate) SetNillableUpdatedAt

func (fc *FilmCreate) SetNillableUpdatedAt(t *time.Time) *FilmCreate

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

func (*FilmCreate) SetStatus

func (fc *FilmCreate) SetStatus(i int8) *FilmCreate

SetStatus sets the status field.

func (*FilmCreate) SetTitle

func (fc *FilmCreate) SetTitle(s string) *FilmCreate

SetTitle sets the title field.

func (*FilmCreate) SetUpdatedAt

func (fc *FilmCreate) SetUpdatedAt(t time.Time) *FilmCreate

SetUpdatedAt sets the updated_at field.

type FilmDelete

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

FilmDelete is the builder for deleting a Film entity.

func (*FilmDelete) Exec

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

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

func (*FilmDelete) ExecX

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

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

func (*FilmDelete) Where

func (fd *FilmDelete) Where(ps ...predicate.Film) *FilmDelete

Where adds a new predicate to the delete builder.

type FilmDeleteOne

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

FilmDeleteOne is the builder for deleting a single Film entity.

func (*FilmDeleteOne) Exec

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

Exec executes the deletion query.

func (*FilmDeleteOne) ExecX

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

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

type FilmEdges

type FilmEdges struct {
	// Authors holds the value of the authors edge.
	Authors []*Author
	// contains filtered or unexported fields
}

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

func (FilmEdges) AuthorsOrErr

func (e FilmEdges) AuthorsOrErr() ([]*Author, error)

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

type FilmGroupBy

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

FilmGroupBy is the builder for group-by Film entities.

func (*FilmGroupBy) Aggregate

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

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

func (*FilmGroupBy) Bool

func (fgb *FilmGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*FilmGroupBy) BoolX

func (fgb *FilmGroupBy) BoolX(ctx context.Context) bool

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

func (*FilmGroupBy) Bools

func (fgb *FilmGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*FilmGroupBy) BoolsX

func (fgb *FilmGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FilmGroupBy) Float64

func (fgb *FilmGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*FilmGroupBy) Float64X

func (fgb *FilmGroupBy) Float64X(ctx context.Context) float64

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

func (*FilmGroupBy) Float64s

func (fgb *FilmGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*FilmGroupBy) Float64sX

func (fgb *FilmGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FilmGroupBy) Int

func (fgb *FilmGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*FilmGroupBy) IntX

func (fgb *FilmGroupBy) IntX(ctx context.Context) int

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

func (*FilmGroupBy) Ints

func (fgb *FilmGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*FilmGroupBy) IntsX

func (fgb *FilmGroupBy) IntsX(ctx context.Context) []int

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

func (*FilmGroupBy) Scan

func (fgb *FilmGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FilmGroupBy) ScanX

func (fgb *FilmGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FilmGroupBy) String

func (fgb *FilmGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*FilmGroupBy) StringX

func (fgb *FilmGroupBy) StringX(ctx context.Context) string

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

func (*FilmGroupBy) Strings

func (fgb *FilmGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*FilmGroupBy) StringsX

func (fgb *FilmGroupBy) StringsX(ctx context.Context) []string

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

type FilmMutation

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

FilmMutation represents an operation that mutate the Films nodes in the graph.

func (*FilmMutation) AddAuthorIDs

func (m *FilmMutation) AddAuthorIDs(ids ...uuid.UUID)

AddAuthorIDs adds the authors edge to Author by ids.

func (*FilmMutation) AddField

func (m *FilmMutation) AddField(name string, value ent.Value) error

AddField adds the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*FilmMutation) AddStatus

func (m *FilmMutation) AddStatus(i int8)

AddStatus adds i to status.

func (*FilmMutation) AddedEdges

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

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

func (*FilmMutation) AddedField

func (m *FilmMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema.

func (*FilmMutation) AddedFields

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

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

func (*FilmMutation) AddedIDs

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

AddedIDs returns all ids (to other nodes) that were added for the given edge name.

func (*FilmMutation) AddedStatus

func (m *FilmMutation) AddedStatus() (r int8, exists bool)

AddedStatus returns the value that was added to the status field in this mutation.

func (*FilmMutation) AuthorsIDs

func (m *FilmMutation) AuthorsIDs() (ids []uuid.UUID)

AuthorsIDs returns the authors ids in the mutation.

func (*FilmMutation) ClearEdge

func (m *FilmMutation) ClearEdge(name string) error

ClearEdge clears the value for the given name. It returns an error if the edge name is not defined in the schema.

func (*FilmMutation) ClearField

func (m *FilmMutation) ClearField(name string) error

ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.

func (*FilmMutation) ClearedEdges

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

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

func (*FilmMutation) ClearedFields

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

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

func (FilmMutation) Client

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

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

CreatedAt returns the created_at value in the mutation.

func (*FilmMutation) Description

func (m *FilmMutation) Description() (r string, exists bool)

Description returns the description value in the mutation.

func (*FilmMutation) EdgeCleared

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

EdgeCleared returns a boolean indicates if this edge was cleared in this mutation.

func (*FilmMutation) Field

func (m *FilmMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean value indicates that this field was not set, or was not define in the schema.

func (*FilmMutation) FieldCleared

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

FieldCleared returns a boolean indicates if this field was cleared in this mutation.

func (*FilmMutation) Fields

func (m *FilmMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields().

func (*FilmMutation) ID

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

ID returns the id value in the mutation. Note that, the id is available only if it was provided to the builder.

func (*FilmMutation) OldCreatedAt

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

OldCreatedAt returns the old created_at value of the Film. If the Film 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 database query fails.

func (*FilmMutation) OldDescription

func (m *FilmMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old description value of the Film. If the Film 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 database query fails.

func (*FilmMutation) OldField

func (m *FilmMutation) 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 was failed.

func (*FilmMutation) OldStatus

func (m *FilmMutation) OldStatus(ctx context.Context) (v int8, err error)

OldStatus returns the old status value of the Film. If the Film 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 database query fails.

func (*FilmMutation) OldTitle

func (m *FilmMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old title value of the Film. If the Film 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 database query fails.

func (*FilmMutation) OldUpdatedAt

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

OldUpdatedAt returns the old updated_at value of the Film. If the Film 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 database query fails.

func (*FilmMutation) Op

func (m *FilmMutation) Op() Op

Op returns the operation name.

func (*FilmMutation) RemoveAuthorIDs

func (m *FilmMutation) RemoveAuthorIDs(ids ...uuid.UUID)

RemoveAuthorIDs removes the authors edge to Author by ids.

func (*FilmMutation) RemovedAuthorsIDs

func (m *FilmMutation) RemovedAuthorsIDs() (ids []uuid.UUID)

RemovedAuthors returns the removed ids of authors.

func (*FilmMutation) RemovedEdges

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

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

func (*FilmMutation) RemovedIDs

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

RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.

func (*FilmMutation) ResetAuthors

func (m *FilmMutation) ResetAuthors()

ResetAuthors reset all changes of the "authors" edge.

func (*FilmMutation) ResetCreatedAt

func (m *FilmMutation) ResetCreatedAt()

ResetCreatedAt reset all changes of the "created_at" field.

func (*FilmMutation) ResetDescription

func (m *FilmMutation) ResetDescription()

ResetDescription reset all changes of the "description" field.

func (*FilmMutation) ResetEdge

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

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

func (*FilmMutation) ResetField

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

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

func (*FilmMutation) ResetStatus

func (m *FilmMutation) ResetStatus()

ResetStatus reset all changes of the "status" field.

func (*FilmMutation) ResetTitle

func (m *FilmMutation) ResetTitle()

ResetTitle reset all changes of the "title" field.

func (*FilmMutation) ResetUpdatedAt

func (m *FilmMutation) ResetUpdatedAt()

ResetUpdatedAt reset all changes of the "updated_at" field.

func (*FilmMutation) SetCreatedAt

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

SetCreatedAt sets the created_at field.

func (*FilmMutation) SetDescription

func (m *FilmMutation) SetDescription(s string)

SetDescription sets the description field.

func (*FilmMutation) SetField

func (m *FilmMutation) SetField(name string, value ent.Value) error

SetField sets the value for the given name. It returns an error if the field is not defined in the schema, or if the type mismatch the field type.

func (*FilmMutation) SetID

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

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

func (*FilmMutation) SetStatus

func (m *FilmMutation) SetStatus(i int8)

SetStatus sets the status field.

func (*FilmMutation) SetTitle

func (m *FilmMutation) SetTitle(s string)

SetTitle sets the title field.

func (*FilmMutation) SetUpdatedAt

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

SetUpdatedAt sets the updated_at field.

func (*FilmMutation) Status

func (m *FilmMutation) Status() (r int8, exists bool)

Status returns the status value in the mutation.

func (*FilmMutation) Title

func (m *FilmMutation) Title() (r string, exists bool)

Title returns the title value in the mutation.

func (FilmMutation) Tx

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

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

func (*FilmMutation) Type

func (m *FilmMutation) Type() string

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

func (*FilmMutation) UpdatedAt

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

UpdatedAt returns the updated_at value in the mutation.

type FilmQuery

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

FilmQuery is the builder for querying Film entities.

func (*FilmQuery) All

func (fq *FilmQuery) All(ctx context.Context) ([]*Film, error)

All executes the query and returns a list of Films.

func (*FilmQuery) AllX

func (fq *FilmQuery) AllX(ctx context.Context) []*Film

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

func (*FilmQuery) Clone

func (fq *FilmQuery) Clone() *FilmQuery

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

func (*FilmQuery) Count

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

Count returns the count of the given query.

func (*FilmQuery) CountX

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

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

func (*FilmQuery) Exist

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

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

func (*FilmQuery) ExistX

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

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

func (*FilmQuery) First

func (fq *FilmQuery) First(ctx context.Context) (*Film, error)

First returns the first Film entity in the query. Returns *NotFoundError when no film was found.

func (*FilmQuery) FirstID

func (fq *FilmQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Film id in the query. Returns *NotFoundError when no id was found.

func (*FilmQuery) FirstX

func (fq *FilmQuery) FirstX(ctx context.Context) *Film

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

func (*FilmQuery) FirstXID

func (fq *FilmQuery) FirstXID(ctx context.Context) uuid.UUID

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

func (*FilmQuery) GroupBy

func (fq *FilmQuery) GroupBy(field string, fields ...string) *FilmGroupBy

GroupBy 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 {
	Status int8 `json:"status,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Film.Query().
	GroupBy(film.FieldStatus).
	Aggregate(entc.Count()).
	Scan(ctx, &v)

func (*FilmQuery) IDs

func (fq *FilmQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Film ids.

func (*FilmQuery) IDsX

func (fq *FilmQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*FilmQuery) Limit

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

Limit adds a limit step to the query.

func (*FilmQuery) Offset

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

Offset adds an offset step to the query.

func (*FilmQuery) Only

func (fq *FilmQuery) Only(ctx context.Context) (*Film, error)

Only returns the only Film entity in the query, returns an error if not exactly one entity was returned.

func (*FilmQuery) OnlyID

func (fq *FilmQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID returns the only Film id in the query, returns an error if not exactly one id was returned.

func (*FilmQuery) OnlyIDX

func (fq *FilmQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*FilmQuery) OnlyX

func (fq *FilmQuery) OnlyX(ctx context.Context) *Film

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

func (*FilmQuery) Order

func (fq *FilmQuery) Order(o ...OrderFunc) *FilmQuery

Order adds an order step to the query.

func (*FilmQuery) QueryAuthors

func (fq *FilmQuery) QueryAuthors() *AuthorQuery

QueryAuthors chains the current query on the authors edge.

func (*FilmQuery) Select

func (fq *FilmQuery) Select(field string, fields ...string) *FilmSelect

Select one or more fields from the given query.

Example:

var v []struct {
	Status int8 `json:"status,omitempty"`
}

client.Film.Query().
	Select(film.FieldStatus).
	Scan(ctx, &v)

func (*FilmQuery) Where

func (fq *FilmQuery) Where(ps ...predicate.Film) *FilmQuery

Where adds a new predicate for the builder.

func (*FilmQuery) WithAuthors

func (fq *FilmQuery) WithAuthors(opts ...func(*AuthorQuery)) *FilmQuery
WithAuthors tells the query-builder to eager-loads the nodes that are connected to

the "authors" edge. The optional arguments used to configure the query builder of the edge.

type FilmSelect

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

FilmSelect is the builder for select fields of Film entities.

func (*FilmSelect) Bool

func (fs *FilmSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*FilmSelect) BoolX

func (fs *FilmSelect) BoolX(ctx context.Context) bool

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

func (*FilmSelect) Bools

func (fs *FilmSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FilmSelect) BoolsX

func (fs *FilmSelect) BoolsX(ctx context.Context) []bool

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

func (*FilmSelect) Float64

func (fs *FilmSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*FilmSelect) Float64X

func (fs *FilmSelect) Float64X(ctx context.Context) float64

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

func (*FilmSelect) Float64s

func (fs *FilmSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FilmSelect) Float64sX

func (fs *FilmSelect) Float64sX(ctx context.Context) []float64

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

func (*FilmSelect) Int

func (fs *FilmSelect) Int(ctx context.Context) (_ int, err error)

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

func (*FilmSelect) IntX

func (fs *FilmSelect) IntX(ctx context.Context) int

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

func (*FilmSelect) Ints

func (fs *FilmSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FilmSelect) IntsX

func (fs *FilmSelect) IntsX(ctx context.Context) []int

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

func (*FilmSelect) Scan

func (fs *FilmSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FilmSelect) ScanX

func (fs *FilmSelect) ScanX(ctx context.Context, v interface{})

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

func (*FilmSelect) String

func (fs *FilmSelect) String(ctx context.Context) (_ string, err error)

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

func (*FilmSelect) StringX

func (fs *FilmSelect) StringX(ctx context.Context) string

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

func (*FilmSelect) Strings

func (fs *FilmSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FilmSelect) StringsX

func (fs *FilmSelect) StringsX(ctx context.Context) []string

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

type FilmUpdate

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

FilmUpdate is the builder for updating Film entities.

func (*FilmUpdate) AddAuthorIDs

func (fu *FilmUpdate) AddAuthorIDs(ids ...uuid.UUID) *FilmUpdate

AddAuthorIDs adds the authors edge to Author by ids.

func (*FilmUpdate) AddAuthors

func (fu *FilmUpdate) AddAuthors(a ...*Author) *FilmUpdate

AddAuthors adds the authors edges to Author.

func (*FilmUpdate) AddStatus

func (fu *FilmUpdate) AddStatus(i int8) *FilmUpdate

AddStatus adds i to status.

func (*FilmUpdate) Exec

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

Exec executes the query.

func (*FilmUpdate) ExecX

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

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

func (*FilmUpdate) Mutation

func (fu *FilmUpdate) Mutation() *FilmMutation

Mutation returns the FilmMutation object of the builder.

func (*FilmUpdate) RemoveAuthorIDs

func (fu *FilmUpdate) RemoveAuthorIDs(ids ...uuid.UUID) *FilmUpdate

RemoveAuthorIDs removes the authors edge to Author by ids.

func (*FilmUpdate) RemoveAuthors

func (fu *FilmUpdate) RemoveAuthors(a ...*Author) *FilmUpdate

RemoveAuthors removes authors edges to Author.

func (*FilmUpdate) Save

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

Save executes the query and returns the number of rows/vertices matched by this operation.

func (*FilmUpdate) SaveX

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

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

func (*FilmUpdate) SetDescription

func (fu *FilmUpdate) SetDescription(s string) *FilmUpdate

SetDescription sets the description field.

func (*FilmUpdate) SetNillableStatus

func (fu *FilmUpdate) SetNillableStatus(i *int8) *FilmUpdate

SetNillableStatus sets the status field if the given value is not nil.

func (*FilmUpdate) SetStatus

func (fu *FilmUpdate) SetStatus(i int8) *FilmUpdate

SetStatus sets the status field.

func (*FilmUpdate) SetTitle

func (fu *FilmUpdate) SetTitle(s string) *FilmUpdate

SetTitle sets the title field.

func (*FilmUpdate) SetUpdatedAt

func (fu *FilmUpdate) SetUpdatedAt(t time.Time) *FilmUpdate

SetUpdatedAt sets the updated_at field.

func (*FilmUpdate) Where

func (fu *FilmUpdate) Where(ps ...predicate.Film) *FilmUpdate

Where adds a new predicate for the builder.

type FilmUpdateOne

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

FilmUpdateOne is the builder for updating a single Film entity.

func (*FilmUpdateOne) AddAuthorIDs

func (fuo *FilmUpdateOne) AddAuthorIDs(ids ...uuid.UUID) *FilmUpdateOne

AddAuthorIDs adds the authors edge to Author by ids.

func (*FilmUpdateOne) AddAuthors

func (fuo *FilmUpdateOne) AddAuthors(a ...*Author) *FilmUpdateOne

AddAuthors adds the authors edges to Author.

func (*FilmUpdateOne) AddStatus

func (fuo *FilmUpdateOne) AddStatus(i int8) *FilmUpdateOne

AddStatus adds i to status.

func (*FilmUpdateOne) Exec

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

Exec executes the query on the entity.

func (*FilmUpdateOne) ExecX

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

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

func (*FilmUpdateOne) Mutation

func (fuo *FilmUpdateOne) Mutation() *FilmMutation

Mutation returns the FilmMutation object of the builder.

func (*FilmUpdateOne) RemoveAuthorIDs

func (fuo *FilmUpdateOne) RemoveAuthorIDs(ids ...uuid.UUID) *FilmUpdateOne

RemoveAuthorIDs removes the authors edge to Author by ids.

func (*FilmUpdateOne) RemoveAuthors

func (fuo *FilmUpdateOne) RemoveAuthors(a ...*Author) *FilmUpdateOne

RemoveAuthors removes authors edges to Author.

func (*FilmUpdateOne) Save

func (fuo *FilmUpdateOne) Save(ctx context.Context) (*Film, error)

Save executes the query and returns the updated entity.

func (*FilmUpdateOne) SaveX

func (fuo *FilmUpdateOne) SaveX(ctx context.Context) *Film

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

func (*FilmUpdateOne) SetDescription

func (fuo *FilmUpdateOne) SetDescription(s string) *FilmUpdateOne

SetDescription sets the description field.

func (*FilmUpdateOne) SetNillableStatus

func (fuo *FilmUpdateOne) SetNillableStatus(i *int8) *FilmUpdateOne

SetNillableStatus sets the status field if the given value is not nil.

func (*FilmUpdateOne) SetStatus

func (fuo *FilmUpdateOne) SetStatus(i int8) *FilmUpdateOne

SetStatus sets the status field.

func (*FilmUpdateOne) SetTitle

func (fuo *FilmUpdateOne) SetTitle(s string) *FilmUpdateOne

SetTitle sets the title field.

func (*FilmUpdateOne) SetUpdatedAt

func (fuo *FilmUpdateOne) SetUpdatedAt(t time.Time) *FilmUpdateOne

SetUpdatedAt sets the updated_at field.

type Films

type Films []*Film

Films is a parsable slice of Film.

type Hook

type Hook = ent.Hook

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflict 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 conflict in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on either graph traversal or 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 Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

ent aliases to avoid import conflict 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 {

	// Author is the client for interacting with the Author builders.
	Author *AuthorClient
	// Film is the client for interacting with the Film builders.
	Film *FilmClient
	// 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 the Tx stored in 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 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 conflict 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