ent

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 22 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.
	TypeChapter = "Chapter"
	TypeManga   = "Manga"
)

Variables

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Chapter

type Chapter struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// ChapterID holds the value of the "ChapterID" field.
	ChapterID string `json:"ChapterID,omitempty"`
	// Num holds the value of the "Num" field.
	Num string `json:"Num,omitempty"`
	// Title holds the value of the "Title" field.
	Title string `json:"Title,omitempty"`
	// CreatedOn holds the value of the "CreatedOn" field.
	CreatedOn time.Time `json:"CreatedOn,omitempty"`
	// RegisteredOn holds the value of the "RegisteredOn" field.
	RegisteredOn time.Time `json:"RegisteredOn,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChapterQuery when eager-loading is set.
	Edges ChapterEdges `json:"edges"`
	// contains filtered or unexported fields
}

Chapter is the model entity for the Chapter schema.

func (*Chapter) QueryManga

func (c *Chapter) QueryManga() *MangaQuery

QueryManga queries the "Manga" edge of the Chapter entity.

func (*Chapter) String

func (c *Chapter) String() string

String implements the fmt.Stringer.

func (*Chapter) Unwrap

func (c *Chapter) Unwrap() *Chapter

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

func (c *Chapter) Update() *ChapterUpdateOne

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

func (*Chapter) Value added in v2.3.0

func (c *Chapter) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Chapter. This includes values selected through modifiers, order, etc.

type ChapterClient

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

ChapterClient is a client for the Chapter schema.

func NewChapterClient

func NewChapterClient(c config) *ChapterClient

NewChapterClient returns a client for the Chapter from the given config.

func (*ChapterClient) Create

func (c *ChapterClient) Create() *ChapterCreate

Create returns a builder for creating a Chapter entity.

func (*ChapterClient) CreateBulk

func (c *ChapterClient) CreateBulk(builders ...*ChapterCreate) *ChapterCreateBulk

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

func (*ChapterClient) Delete

func (c *ChapterClient) Delete() *ChapterDelete

Delete returns a delete builder for Chapter.

func (*ChapterClient) DeleteOne

func (c *ChapterClient) DeleteOne(ch *Chapter) *ChapterDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChapterClient) DeleteOneID

func (c *ChapterClient) DeleteOneID(id int) *ChapterDeleteOne

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

func (*ChapterClient) Get

func (c *ChapterClient) Get(ctx context.Context, id int) (*Chapter, error)

Get returns a Chapter entity by its id.

func (*ChapterClient) GetX

func (c *ChapterClient) GetX(ctx context.Context, id int) *Chapter

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

func (*ChapterClient) Hooks

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

Hooks returns the client hooks.

func (*ChapterClient) Intercept

func (c *ChapterClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `chapter.Intercept(f(g(h())))`.

func (*ChapterClient) Interceptors

func (c *ChapterClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*ChapterClient) MapCreateBulk added in v2.3.0

func (c *ChapterClient) MapCreateBulk(slice any, setFunc func(*ChapterCreate, int)) *ChapterCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*ChapterClient) Query

func (c *ChapterClient) Query() *ChapterQuery

Query returns a query builder for Chapter.

func (*ChapterClient) QueryManga

func (c *ChapterClient) QueryManga(ch *Chapter) *MangaQuery

QueryManga queries the Manga edge of a Chapter.

func (*ChapterClient) Update

func (c *ChapterClient) Update() *ChapterUpdate

Update returns an update builder for Chapter.

func (*ChapterClient) UpdateOne

func (c *ChapterClient) UpdateOne(ch *Chapter) *ChapterUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChapterClient) UpdateOneID

func (c *ChapterClient) UpdateOneID(id int) *ChapterUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChapterClient) Use

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

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

type ChapterCreate

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

ChapterCreate is the builder for creating a Chapter entity.

func (*ChapterCreate) Exec

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

Exec executes the query.

func (*ChapterCreate) ExecX

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

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

func (*ChapterCreate) Mutation

func (cc *ChapterCreate) Mutation() *ChapterMutation

Mutation returns the ChapterMutation object of the builder.

func (*ChapterCreate) Save

func (cc *ChapterCreate) Save(ctx context.Context) (*Chapter, error)

Save creates the Chapter in the database.

func (*ChapterCreate) SaveX

func (cc *ChapterCreate) SaveX(ctx context.Context) *Chapter

SaveX calls Save and panics if Save returns an error.

func (*ChapterCreate) SetChapterID

func (cc *ChapterCreate) SetChapterID(s string) *ChapterCreate

SetChapterID sets the "ChapterID" field.

func (*ChapterCreate) SetCreatedOn

func (cc *ChapterCreate) SetCreatedOn(t time.Time) *ChapterCreate

SetCreatedOn sets the "CreatedOn" field.

func (*ChapterCreate) SetManga

func (cc *ChapterCreate) SetManga(m *Manga) *ChapterCreate

SetManga sets the "Manga" edge to the Manga entity.

func (*ChapterCreate) SetMangaID

func (cc *ChapterCreate) SetMangaID(id int) *ChapterCreate

SetMangaID sets the "Manga" edge to the Manga entity by ID.

func (*ChapterCreate) SetNillableCreatedOn

func (cc *ChapterCreate) SetNillableCreatedOn(t *time.Time) *ChapterCreate

SetNillableCreatedOn sets the "CreatedOn" field if the given value is not nil.

func (*ChapterCreate) SetNillableMangaID

func (cc *ChapterCreate) SetNillableMangaID(id *int) *ChapterCreate

SetNillableMangaID sets the "Manga" edge to the Manga entity by ID if the given value is not nil.

func (*ChapterCreate) SetNillableTitle

func (cc *ChapterCreate) SetNillableTitle(s *string) *ChapterCreate

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*ChapterCreate) SetNum

func (cc *ChapterCreate) SetNum(s string) *ChapterCreate

SetNum sets the "Num" field.

func (*ChapterCreate) SetRegisteredOn

func (cc *ChapterCreate) SetRegisteredOn(t time.Time) *ChapterCreate

SetRegisteredOn sets the "RegisteredOn" field.

func (*ChapterCreate) SetTitle

func (cc *ChapterCreate) SetTitle(s string) *ChapterCreate

SetTitle sets the "Title" field.

type ChapterCreateBulk

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

ChapterCreateBulk is the builder for creating many Chapter entities in bulk.

func (*ChapterCreateBulk) Exec

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

Exec executes the query.

func (*ChapterCreateBulk) ExecX

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

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

func (*ChapterCreateBulk) Save

func (ccb *ChapterCreateBulk) Save(ctx context.Context) ([]*Chapter, error)

Save creates the Chapter entities in the database.

func (*ChapterCreateBulk) SaveX

func (ccb *ChapterCreateBulk) SaveX(ctx context.Context) []*Chapter

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

type ChapterDelete

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

ChapterDelete is the builder for deleting a Chapter entity.

func (*ChapterDelete) Exec

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

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

func (*ChapterDelete) ExecX

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

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

func (*ChapterDelete) Where

func (cd *ChapterDelete) Where(ps ...predicate.Chapter) *ChapterDelete

Where appends a list predicates to the ChapterDelete builder.

type ChapterDeleteOne

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

ChapterDeleteOne is the builder for deleting a single Chapter entity.

func (*ChapterDeleteOne) Exec

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

Exec executes the deletion query.

func (*ChapterDeleteOne) ExecX

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

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

func (*ChapterDeleteOne) Where

Where appends a list predicates to the ChapterDelete builder.

type ChapterEdges

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

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

func (ChapterEdges) MangaOrErr

func (e ChapterEdges) MangaOrErr() (*Manga, error)

MangaOrErr returns the Manga value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type ChapterGroupBy

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

ChapterGroupBy is the group-by builder for Chapter entities.

func (*ChapterGroupBy) Aggregate

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

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

func (*ChapterGroupBy) Bool

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

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

func (*ChapterGroupBy) BoolX

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

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

func (*ChapterGroupBy) Bools

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

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

func (*ChapterGroupBy) BoolsX

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

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

func (*ChapterGroupBy) Float64

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

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

func (*ChapterGroupBy) Float64X

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

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

func (*ChapterGroupBy) Float64s

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

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

func (*ChapterGroupBy) Float64sX

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

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

func (*ChapterGroupBy) Int

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

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

func (*ChapterGroupBy) IntX

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

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

func (*ChapterGroupBy) Ints

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

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

func (*ChapterGroupBy) IntsX

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

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

func (*ChapterGroupBy) Scan

func (cgb *ChapterGroupBy) Scan(ctx context.Context, v any) error

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

func (*ChapterGroupBy) ScanX

func (s *ChapterGroupBy) ScanX(ctx context.Context, v any)

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

func (*ChapterGroupBy) String

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

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

func (*ChapterGroupBy) StringX

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

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

func (*ChapterGroupBy) Strings

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

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

func (*ChapterGroupBy) StringsX

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

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

type ChapterMutation

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

ChapterMutation represents an operation that mutates the Chapter nodes in the graph.

func (*ChapterMutation) AddField

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

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

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

func (*ChapterMutation) AddedField

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

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

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

func (*ChapterMutation) AddedIDs

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

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

func (*ChapterMutation) ChapterID

func (m *ChapterMutation) ChapterID() (r string, exists bool)

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

func (*ChapterMutation) ClearCreatedOn

func (m *ChapterMutation) ClearCreatedOn()

ClearCreatedOn clears the value of the "CreatedOn" field.

func (*ChapterMutation) ClearEdge

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

func (m *ChapterMutation) 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 (*ChapterMutation) ClearManga

func (m *ChapterMutation) ClearManga()

ClearManga clears the "Manga" edge to the Manga entity.

func (*ChapterMutation) ClearTitle

func (m *ChapterMutation) ClearTitle()

ClearTitle clears the value of the "Title" field.

func (*ChapterMutation) ClearedEdges

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

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

func (*ChapterMutation) ClearedFields

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

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

func (ChapterMutation) Client

func (m ChapterMutation) 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 (*ChapterMutation) CreatedOn

func (m *ChapterMutation) CreatedOn() (r time.Time, exists bool)

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

func (*ChapterMutation) CreatedOnCleared

func (m *ChapterMutation) CreatedOnCleared() bool

CreatedOnCleared returns if the "CreatedOn" field was cleared in this mutation.

func (*ChapterMutation) EdgeCleared

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

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

func (*ChapterMutation) Field

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

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

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

func (*ChapterMutation) Fields

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

func (m *ChapterMutation) ID() (id int, exists bool)

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

func (*ChapterMutation) IDs

func (m *ChapterMutation) IDs(ctx context.Context) ([]int, error)

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

func (*ChapterMutation) MangaCleared

func (m *ChapterMutation) MangaCleared() bool

MangaCleared reports if the "Manga" edge to the Manga entity was cleared.

func (*ChapterMutation) MangaID

func (m *ChapterMutation) MangaID() (id int, exists bool)

MangaID returns the "Manga" edge ID in the mutation.

func (*ChapterMutation) MangaIDs

func (m *ChapterMutation) MangaIDs() (ids []int)

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

func (*ChapterMutation) Num

func (m *ChapterMutation) Num() (r string, exists bool)

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

func (*ChapterMutation) OldChapterID

func (m *ChapterMutation) OldChapterID(ctx context.Context) (v string, err error)

OldChapterID returns the old "ChapterID" field's value of the Chapter entity. If the Chapter 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 (*ChapterMutation) OldCreatedOn

func (m *ChapterMutation) OldCreatedOn(ctx context.Context) (v time.Time, err error)

OldCreatedOn returns the old "CreatedOn" field's value of the Chapter entity. If the Chapter 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 (*ChapterMutation) OldField

func (m *ChapterMutation) 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 (*ChapterMutation) OldNum

func (m *ChapterMutation) OldNum(ctx context.Context) (v string, err error)

OldNum returns the old "Num" field's value of the Chapter entity. If the Chapter 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 (*ChapterMutation) OldRegisteredOn

func (m *ChapterMutation) OldRegisteredOn(ctx context.Context) (v time.Time, err error)

OldRegisteredOn returns the old "RegisteredOn" field's value of the Chapter entity. If the Chapter 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 (*ChapterMutation) OldTitle

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

OldTitle returns the old "Title" field's value of the Chapter entity. If the Chapter 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 (*ChapterMutation) Op

func (m *ChapterMutation) Op() Op

Op returns the operation name.

func (*ChapterMutation) RegisteredOn

func (m *ChapterMutation) RegisteredOn() (r time.Time, exists bool)

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

func (*ChapterMutation) RemovedEdges

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

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

func (*ChapterMutation) RemovedIDs

func (m *ChapterMutation) 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 (*ChapterMutation) ResetChapterID

func (m *ChapterMutation) ResetChapterID()

ResetChapterID resets all changes to the "ChapterID" field.

func (*ChapterMutation) ResetCreatedOn

func (m *ChapterMutation) ResetCreatedOn()

ResetCreatedOn resets all changes to the "CreatedOn" field.

func (*ChapterMutation) ResetEdge

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

func (m *ChapterMutation) 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 (*ChapterMutation) ResetManga

func (m *ChapterMutation) ResetManga()

ResetManga resets all changes to the "Manga" edge.

func (*ChapterMutation) ResetNum

func (m *ChapterMutation) ResetNum()

ResetNum resets all changes to the "Num" field.

func (*ChapterMutation) ResetRegisteredOn

func (m *ChapterMutation) ResetRegisteredOn()

ResetRegisteredOn resets all changes to the "RegisteredOn" field.

func (*ChapterMutation) ResetTitle

func (m *ChapterMutation) ResetTitle()

ResetTitle resets all changes to the "Title" field.

func (*ChapterMutation) SetChapterID

func (m *ChapterMutation) SetChapterID(s string)

SetChapterID sets the "ChapterID" field.

func (*ChapterMutation) SetCreatedOn

func (m *ChapterMutation) SetCreatedOn(t time.Time)

SetCreatedOn sets the "CreatedOn" field.

func (*ChapterMutation) SetField

func (m *ChapterMutation) 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 (*ChapterMutation) SetMangaID

func (m *ChapterMutation) SetMangaID(id int)

SetMangaID sets the "Manga" edge to the Manga entity by id.

func (*ChapterMutation) SetNum

func (m *ChapterMutation) SetNum(s string)

SetNum sets the "Num" field.

func (*ChapterMutation) SetOp

func (m *ChapterMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ChapterMutation) SetRegisteredOn

func (m *ChapterMutation) SetRegisteredOn(t time.Time)

SetRegisteredOn sets the "RegisteredOn" field.

func (*ChapterMutation) SetTitle

func (m *ChapterMutation) SetTitle(s string)

SetTitle sets the "Title" field.

func (*ChapterMutation) Title

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

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

func (*ChapterMutation) TitleCleared

func (m *ChapterMutation) TitleCleared() bool

TitleCleared returns if the "Title" field was cleared in this mutation.

func (ChapterMutation) Tx

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

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

func (*ChapterMutation) Type

func (m *ChapterMutation) Type() string

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

func (*ChapterMutation) Where

func (m *ChapterMutation) Where(ps ...predicate.Chapter)

Where appends a list predicates to the ChapterMutation builder.

func (*ChapterMutation) WhereP

func (m *ChapterMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the ChapterMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type ChapterQuery

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

ChapterQuery is the builder for querying Chapter entities.

func (*ChapterQuery) Aggregate

func (cq *ChapterQuery) Aggregate(fns ...AggregateFunc) *ChapterSelect

Aggregate returns a ChapterSelect configured with the given aggregations.

func (*ChapterQuery) All

func (cq *ChapterQuery) All(ctx context.Context) ([]*Chapter, error)

All executes the query and returns a list of Chapters.

func (*ChapterQuery) AllX

func (cq *ChapterQuery) AllX(ctx context.Context) []*Chapter

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

func (*ChapterQuery) Clone

func (cq *ChapterQuery) Clone() *ChapterQuery

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

func (*ChapterQuery) Count

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

Count returns the count of the given query.

func (*ChapterQuery) CountX

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

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

func (*ChapterQuery) Exist

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

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

func (*ChapterQuery) ExistX

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

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

func (*ChapterQuery) First

func (cq *ChapterQuery) First(ctx context.Context) (*Chapter, error)

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

func (*ChapterQuery) FirstID

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

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

func (*ChapterQuery) FirstIDX

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

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

func (*ChapterQuery) FirstX

func (cq *ChapterQuery) FirstX(ctx context.Context) *Chapter

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

func (*ChapterQuery) GroupBy

func (cq *ChapterQuery) GroupBy(field string, fields ...string) *ChapterGroupBy

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

client.Chapter.Query().
	GroupBy(chapter.FieldChapterID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChapterQuery) IDs

func (cq *ChapterQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*ChapterQuery) IDsX

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

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

func (*ChapterQuery) Limit

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

Limit the number of records to be returned by this query.

func (*ChapterQuery) Offset

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

Offset to start from.

func (*ChapterQuery) Only

func (cq *ChapterQuery) Only(ctx context.Context) (*Chapter, error)

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

func (*ChapterQuery) OnlyID

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

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

func (*ChapterQuery) OnlyIDX

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

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

func (*ChapterQuery) OnlyX

func (cq *ChapterQuery) OnlyX(ctx context.Context) *Chapter

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

func (*ChapterQuery) Order

func (cq *ChapterQuery) Order(o ...chapter.OrderOption) *ChapterQuery

Order specifies how the records should be ordered.

func (*ChapterQuery) QueryManga

func (cq *ChapterQuery) QueryManga() *MangaQuery

QueryManga chains the current query on the "Manga" edge.

func (*ChapterQuery) Select

func (cq *ChapterQuery) Select(fields ...string) *ChapterSelect

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

client.Chapter.Query().
	Select(chapter.FieldChapterID).
	Scan(ctx, &v)

func (*ChapterQuery) Unique

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

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

func (cq *ChapterQuery) Where(ps ...predicate.Chapter) *ChapterQuery

Where adds a new predicate for the ChapterQuery builder.

func (*ChapterQuery) WithManga

func (cq *ChapterQuery) WithManga(opts ...func(*MangaQuery)) *ChapterQuery

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

type ChapterSelect

type ChapterSelect struct {
	*ChapterQuery
	// contains filtered or unexported fields
}

ChapterSelect is the builder for selecting fields of Chapter entities.

func (*ChapterSelect) Aggregate

func (cs *ChapterSelect) Aggregate(fns ...AggregateFunc) *ChapterSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ChapterSelect) Bool

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

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

func (*ChapterSelect) BoolX

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

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

func (*ChapterSelect) Bools

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

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

func (*ChapterSelect) BoolsX

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

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

func (*ChapterSelect) Float64

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

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

func (*ChapterSelect) Float64X

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

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

func (*ChapterSelect) Float64s

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

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

func (*ChapterSelect) Float64sX

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

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

func (*ChapterSelect) Int

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

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

func (*ChapterSelect) IntX

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

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

func (*ChapterSelect) Ints

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

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

func (*ChapterSelect) IntsX

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

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

func (*ChapterSelect) Scan

func (cs *ChapterSelect) Scan(ctx context.Context, v any) error

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

func (*ChapterSelect) ScanX

func (s *ChapterSelect) ScanX(ctx context.Context, v any)

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

func (*ChapterSelect) String

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

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

func (*ChapterSelect) StringX

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

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

func (*ChapterSelect) Strings

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

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

func (*ChapterSelect) StringsX

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

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

type ChapterUpdate

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

ChapterUpdate is the builder for updating Chapter entities.

func (*ChapterUpdate) ClearCreatedOn

func (cu *ChapterUpdate) ClearCreatedOn() *ChapterUpdate

ClearCreatedOn clears the value of the "CreatedOn" field.

func (*ChapterUpdate) ClearManga

func (cu *ChapterUpdate) ClearManga() *ChapterUpdate

ClearManga clears the "Manga" edge to the Manga entity.

func (*ChapterUpdate) ClearTitle

func (cu *ChapterUpdate) ClearTitle() *ChapterUpdate

ClearTitle clears the value of the "Title" field.

func (*ChapterUpdate) Exec

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

Exec executes the query.

func (*ChapterUpdate) ExecX

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

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

func (*ChapterUpdate) Mutation

func (cu *ChapterUpdate) Mutation() *ChapterMutation

Mutation returns the ChapterMutation object of the builder.

func (*ChapterUpdate) Save

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

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

func (*ChapterUpdate) SaveX

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

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

func (*ChapterUpdate) SetChapterID

func (cu *ChapterUpdate) SetChapterID(s string) *ChapterUpdate

SetChapterID sets the "ChapterID" field.

func (*ChapterUpdate) SetCreatedOn

func (cu *ChapterUpdate) SetCreatedOn(t time.Time) *ChapterUpdate

SetCreatedOn sets the "CreatedOn" field.

func (*ChapterUpdate) SetManga

func (cu *ChapterUpdate) SetManga(m *Manga) *ChapterUpdate

SetManga sets the "Manga" edge to the Manga entity.

func (*ChapterUpdate) SetMangaID

func (cu *ChapterUpdate) SetMangaID(id int) *ChapterUpdate

SetMangaID sets the "Manga" edge to the Manga entity by ID.

func (*ChapterUpdate) SetNillableChapterID added in v2.3.0

func (cu *ChapterUpdate) SetNillableChapterID(s *string) *ChapterUpdate

SetNillableChapterID sets the "ChapterID" field if the given value is not nil.

func (*ChapterUpdate) SetNillableCreatedOn

func (cu *ChapterUpdate) SetNillableCreatedOn(t *time.Time) *ChapterUpdate

SetNillableCreatedOn sets the "CreatedOn" field if the given value is not nil.

func (*ChapterUpdate) SetNillableMangaID

func (cu *ChapterUpdate) SetNillableMangaID(id *int) *ChapterUpdate

SetNillableMangaID sets the "Manga" edge to the Manga entity by ID if the given value is not nil.

func (*ChapterUpdate) SetNillableNum added in v2.3.0

func (cu *ChapterUpdate) SetNillableNum(s *string) *ChapterUpdate

SetNillableNum sets the "Num" field if the given value is not nil.

func (*ChapterUpdate) SetNillableRegisteredOn added in v2.3.0

func (cu *ChapterUpdate) SetNillableRegisteredOn(t *time.Time) *ChapterUpdate

SetNillableRegisteredOn sets the "RegisteredOn" field if the given value is not nil.

func (*ChapterUpdate) SetNillableTitle

func (cu *ChapterUpdate) SetNillableTitle(s *string) *ChapterUpdate

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*ChapterUpdate) SetNum

func (cu *ChapterUpdate) SetNum(s string) *ChapterUpdate

SetNum sets the "Num" field.

func (*ChapterUpdate) SetRegisteredOn

func (cu *ChapterUpdate) SetRegisteredOn(t time.Time) *ChapterUpdate

SetRegisteredOn sets the "RegisteredOn" field.

func (*ChapterUpdate) SetTitle

func (cu *ChapterUpdate) SetTitle(s string) *ChapterUpdate

SetTitle sets the "Title" field.

func (*ChapterUpdate) Where

func (cu *ChapterUpdate) Where(ps ...predicate.Chapter) *ChapterUpdate

Where appends a list predicates to the ChapterUpdate builder.

type ChapterUpdateOne

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

ChapterUpdateOne is the builder for updating a single Chapter entity.

func (*ChapterUpdateOne) ClearCreatedOn

func (cuo *ChapterUpdateOne) ClearCreatedOn() *ChapterUpdateOne

ClearCreatedOn clears the value of the "CreatedOn" field.

func (*ChapterUpdateOne) ClearManga

func (cuo *ChapterUpdateOne) ClearManga() *ChapterUpdateOne

ClearManga clears the "Manga" edge to the Manga entity.

func (*ChapterUpdateOne) ClearTitle

func (cuo *ChapterUpdateOne) ClearTitle() *ChapterUpdateOne

ClearTitle clears the value of the "Title" field.

func (*ChapterUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ChapterUpdateOne) ExecX

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

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

func (*ChapterUpdateOne) Mutation

func (cuo *ChapterUpdateOne) Mutation() *ChapterMutation

Mutation returns the ChapterMutation object of the builder.

func (*ChapterUpdateOne) Save

func (cuo *ChapterUpdateOne) Save(ctx context.Context) (*Chapter, error)

Save executes the query and returns the updated Chapter entity.

func (*ChapterUpdateOne) SaveX

func (cuo *ChapterUpdateOne) SaveX(ctx context.Context) *Chapter

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

func (*ChapterUpdateOne) Select

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

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

func (*ChapterUpdateOne) SetChapterID

func (cuo *ChapterUpdateOne) SetChapterID(s string) *ChapterUpdateOne

SetChapterID sets the "ChapterID" field.

func (*ChapterUpdateOne) SetCreatedOn

func (cuo *ChapterUpdateOne) SetCreatedOn(t time.Time) *ChapterUpdateOne

SetCreatedOn sets the "CreatedOn" field.

func (*ChapterUpdateOne) SetManga

func (cuo *ChapterUpdateOne) SetManga(m *Manga) *ChapterUpdateOne

SetManga sets the "Manga" edge to the Manga entity.

func (*ChapterUpdateOne) SetMangaID

func (cuo *ChapterUpdateOne) SetMangaID(id int) *ChapterUpdateOne

SetMangaID sets the "Manga" edge to the Manga entity by ID.

func (*ChapterUpdateOne) SetNillableChapterID added in v2.3.0

func (cuo *ChapterUpdateOne) SetNillableChapterID(s *string) *ChapterUpdateOne

SetNillableChapterID sets the "ChapterID" field if the given value is not nil.

func (*ChapterUpdateOne) SetNillableCreatedOn

func (cuo *ChapterUpdateOne) SetNillableCreatedOn(t *time.Time) *ChapterUpdateOne

SetNillableCreatedOn sets the "CreatedOn" field if the given value is not nil.

func (*ChapterUpdateOne) SetNillableMangaID

func (cuo *ChapterUpdateOne) SetNillableMangaID(id *int) *ChapterUpdateOne

SetNillableMangaID sets the "Manga" edge to the Manga entity by ID if the given value is not nil.

func (*ChapterUpdateOne) SetNillableNum added in v2.3.0

func (cuo *ChapterUpdateOne) SetNillableNum(s *string) *ChapterUpdateOne

SetNillableNum sets the "Num" field if the given value is not nil.

func (*ChapterUpdateOne) SetNillableRegisteredOn added in v2.3.0

func (cuo *ChapterUpdateOne) SetNillableRegisteredOn(t *time.Time) *ChapterUpdateOne

SetNillableRegisteredOn sets the "RegisteredOn" field if the given value is not nil.

func (*ChapterUpdateOne) SetNillableTitle

func (cuo *ChapterUpdateOne) SetNillableTitle(s *string) *ChapterUpdateOne

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*ChapterUpdateOne) SetNum

func (cuo *ChapterUpdateOne) SetNum(s string) *ChapterUpdateOne

SetNum sets the "Num" field.

func (*ChapterUpdateOne) SetRegisteredOn

func (cuo *ChapterUpdateOne) SetRegisteredOn(t time.Time) *ChapterUpdateOne

SetRegisteredOn sets the "RegisteredOn" field.

func (*ChapterUpdateOne) SetTitle

func (cuo *ChapterUpdateOne) SetTitle(s string) *ChapterUpdateOne

SetTitle sets the "Title" field.

func (*ChapterUpdateOne) Where

Where appends a list predicates to the ChapterUpdate builder.

type Chapters

type Chapters []*Chapter

Chapters is a parsable slice of Chapter.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Chapter is the client for interacting with the Chapter builders.
	Chapter *ChapterClient
	// Manga is the client for interacting with the Manga builders.
	Manga *MangaClient
	// 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().
	Chapter.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Manga

type Manga struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// MangaID holds the value of the "MangaID" field.
	MangaID string `json:"MangaID,omitempty"`
	// Source holds the value of the "Source" field.
	Source string `json:"Source,omitempty"`
	// Title holds the value of the "Title" field.
	Title string `json:"Title,omitempty"`
	// Mapping holds the value of the "Mapping" field.
	Mapping string `json:"Mapping,omitempty"`
	// RegisteredOn holds the value of the "RegisteredOn" field.
	RegisteredOn time.Time `json:"RegisteredOn,omitempty"`
	// FilteredGroups holds the value of the "FilteredGroups" field.
	FilteredGroups []string `json:"FilteredGroups,omitempty"`
	// ExcludedGroups holds the value of the "ExcludedGroups" field.
	ExcludedGroups []string `json:"ExcludedGroups,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MangaQuery when eager-loading is set.
	Edges MangaEdges `json:"edges"`
	// contains filtered or unexported fields
}

Manga is the model entity for the Manga schema.

func (*Manga) QueryChapters

func (m *Manga) QueryChapters() *ChapterQuery

QueryChapters queries the "Chapters" edge of the Manga entity.

func (*Manga) String

func (m *Manga) String() string

String implements the fmt.Stringer.

func (*Manga) Unwrap

func (m *Manga) Unwrap() *Manga

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

func (m *Manga) Update() *MangaUpdateOne

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

func (*Manga) Value added in v2.3.0

func (m *Manga) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Manga. This includes values selected through modifiers, order, etc.

type MangaClient

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

MangaClient is a client for the Manga schema.

func NewMangaClient

func NewMangaClient(c config) *MangaClient

NewMangaClient returns a client for the Manga from the given config.

func (*MangaClient) Create

func (c *MangaClient) Create() *MangaCreate

Create returns a builder for creating a Manga entity.

func (*MangaClient) CreateBulk

func (c *MangaClient) CreateBulk(builders ...*MangaCreate) *MangaCreateBulk

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

func (*MangaClient) Delete

func (c *MangaClient) Delete() *MangaDelete

Delete returns a delete builder for Manga.

func (*MangaClient) DeleteOne

func (c *MangaClient) DeleteOne(m *Manga) *MangaDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MangaClient) DeleteOneID

func (c *MangaClient) DeleteOneID(id int) *MangaDeleteOne

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

func (*MangaClient) Get

func (c *MangaClient) Get(ctx context.Context, id int) (*Manga, error)

Get returns a Manga entity by its id.

func (*MangaClient) GetX

func (c *MangaClient) GetX(ctx context.Context, id int) *Manga

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

func (*MangaClient) Hooks

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

Hooks returns the client hooks.

func (*MangaClient) Intercept

func (c *MangaClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `manga.Intercept(f(g(h())))`.

func (*MangaClient) Interceptors

func (c *MangaClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*MangaClient) MapCreateBulk added in v2.3.0

func (c *MangaClient) MapCreateBulk(slice any, setFunc func(*MangaCreate, int)) *MangaCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*MangaClient) Query

func (c *MangaClient) Query() *MangaQuery

Query returns a query builder for Manga.

func (*MangaClient) QueryChapters

func (c *MangaClient) QueryChapters(m *Manga) *ChapterQuery

QueryChapters queries the Chapters edge of a Manga.

func (*MangaClient) Update

func (c *MangaClient) Update() *MangaUpdate

Update returns an update builder for Manga.

func (*MangaClient) UpdateOne

func (c *MangaClient) UpdateOne(m *Manga) *MangaUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MangaClient) UpdateOneID

func (c *MangaClient) UpdateOneID(id int) *MangaUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MangaClient) Use

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

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

type MangaCreate

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

MangaCreate is the builder for creating a Manga entity.

func (*MangaCreate) AddChapterIDs

func (mc *MangaCreate) AddChapterIDs(ids ...int) *MangaCreate

AddChapterIDs adds the "Chapters" edge to the Chapter entity by IDs.

func (*MangaCreate) AddChapters

func (mc *MangaCreate) AddChapters(c ...*Chapter) *MangaCreate

AddChapters adds the "Chapters" edges to the Chapter entity.

func (*MangaCreate) Exec

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

Exec executes the query.

func (*MangaCreate) ExecX

func (mc *MangaCreate) ExecX(ctx context.Context)

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

func (*MangaCreate) Mutation

func (mc *MangaCreate) Mutation() *MangaMutation

Mutation returns the MangaMutation object of the builder.

func (*MangaCreate) Save

func (mc *MangaCreate) Save(ctx context.Context) (*Manga, error)

Save creates the Manga in the database.

func (*MangaCreate) SaveX

func (mc *MangaCreate) SaveX(ctx context.Context) *Manga

SaveX calls Save and panics if Save returns an error.

func (*MangaCreate) SetExcludedGroups added in v2.4.0

func (mc *MangaCreate) SetExcludedGroups(s []string) *MangaCreate

SetExcludedGroups sets the "ExcludedGroups" field.

func (*MangaCreate) SetFilteredGroups

func (mc *MangaCreate) SetFilteredGroups(s []string) *MangaCreate

SetFilteredGroups sets the "FilteredGroups" field.

func (*MangaCreate) SetMangaID

func (mc *MangaCreate) SetMangaID(s string) *MangaCreate

SetMangaID sets the "MangaID" field.

func (*MangaCreate) SetMapping

func (mc *MangaCreate) SetMapping(s string) *MangaCreate

SetMapping sets the "Mapping" field.

func (*MangaCreate) SetRegisteredOn

func (mc *MangaCreate) SetRegisteredOn(t time.Time) *MangaCreate

SetRegisteredOn sets the "RegisteredOn" field.

func (*MangaCreate) SetSource

func (mc *MangaCreate) SetSource(s string) *MangaCreate

SetSource sets the "Source" field.

func (*MangaCreate) SetTitle

func (mc *MangaCreate) SetTitle(s string) *MangaCreate

SetTitle sets the "Title" field.

type MangaCreateBulk

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

MangaCreateBulk is the builder for creating many Manga entities in bulk.

func (*MangaCreateBulk) Exec

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

Exec executes the query.

func (*MangaCreateBulk) ExecX

func (mcb *MangaCreateBulk) ExecX(ctx context.Context)

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

func (*MangaCreateBulk) Save

func (mcb *MangaCreateBulk) Save(ctx context.Context) ([]*Manga, error)

Save creates the Manga entities in the database.

func (*MangaCreateBulk) SaveX

func (mcb *MangaCreateBulk) SaveX(ctx context.Context) []*Manga

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

type MangaDelete

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

MangaDelete is the builder for deleting a Manga entity.

func (*MangaDelete) Exec

func (md *MangaDelete) Exec(ctx context.Context) (int, error)

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

func (*MangaDelete) ExecX

func (md *MangaDelete) ExecX(ctx context.Context) int

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

func (*MangaDelete) Where

func (md *MangaDelete) Where(ps ...predicate.Manga) *MangaDelete

Where appends a list predicates to the MangaDelete builder.

type MangaDeleteOne

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

MangaDeleteOne is the builder for deleting a single Manga entity.

func (*MangaDeleteOne) Exec

func (mdo *MangaDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MangaDeleteOne) ExecX

func (mdo *MangaDeleteOne) ExecX(ctx context.Context)

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

func (*MangaDeleteOne) Where

func (mdo *MangaDeleteOne) Where(ps ...predicate.Manga) *MangaDeleteOne

Where appends a list predicates to the MangaDelete builder.

type MangaEdges

type MangaEdges struct {
	// Chapters holds the value of the Chapters edge.
	Chapters []*Chapter `json:"Chapters,omitempty"`
	// contains filtered or unexported fields
}

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

func (MangaEdges) ChaptersOrErr

func (e MangaEdges) ChaptersOrErr() ([]*Chapter, error)

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

type MangaGroupBy

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

MangaGroupBy is the group-by builder for Manga entities.

func (*MangaGroupBy) Aggregate

func (mgb *MangaGroupBy) Aggregate(fns ...AggregateFunc) *MangaGroupBy

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

func (*MangaGroupBy) Bool

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

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

func (*MangaGroupBy) BoolX

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

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

func (*MangaGroupBy) Bools

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

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

func (*MangaGroupBy) BoolsX

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

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

func (*MangaGroupBy) Float64

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

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

func (*MangaGroupBy) Float64X

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

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

func (*MangaGroupBy) Float64s

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

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

func (*MangaGroupBy) Float64sX

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

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

func (*MangaGroupBy) Int

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

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

func (*MangaGroupBy) IntX

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

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

func (*MangaGroupBy) Ints

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

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

func (*MangaGroupBy) IntsX

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

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

func (*MangaGroupBy) Scan

func (mgb *MangaGroupBy) Scan(ctx context.Context, v any) error

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

func (*MangaGroupBy) ScanX

func (s *MangaGroupBy) ScanX(ctx context.Context, v any)

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

func (*MangaGroupBy) String

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

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

func (*MangaGroupBy) StringX

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

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

func (*MangaGroupBy) Strings

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

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

func (*MangaGroupBy) StringsX

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

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

type MangaMutation

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

MangaMutation represents an operation that mutates the Manga nodes in the graph.

func (*MangaMutation) AddChapterIDs

func (m *MangaMutation) AddChapterIDs(ids ...int)

AddChapterIDs adds the "Chapters" edge to the Chapter entity by ids.

func (*MangaMutation) AddField

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

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

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

func (*MangaMutation) AddedField

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

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

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

func (*MangaMutation) AddedIDs

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

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

func (*MangaMutation) AppendExcludedGroups added in v2.4.0

func (m *MangaMutation) AppendExcludedGroups(s []string)

AppendExcludedGroups adds s to the "ExcludedGroups" field.

func (*MangaMutation) AppendFilteredGroups

func (m *MangaMutation) AppendFilteredGroups(s []string)

AppendFilteredGroups adds s to the "FilteredGroups" field.

func (*MangaMutation) AppendedExcludedGroups added in v2.4.0

func (m *MangaMutation) AppendedExcludedGroups() ([]string, bool)

AppendedExcludedGroups returns the list of values that were appended to the "ExcludedGroups" field in this mutation.

func (*MangaMutation) AppendedFilteredGroups

func (m *MangaMutation) AppendedFilteredGroups() ([]string, bool)

AppendedFilteredGroups returns the list of values that were appended to the "FilteredGroups" field in this mutation.

func (*MangaMutation) ChaptersCleared

func (m *MangaMutation) ChaptersCleared() bool

ChaptersCleared reports if the "Chapters" edge to the Chapter entity was cleared.

func (*MangaMutation) ChaptersIDs

func (m *MangaMutation) ChaptersIDs() (ids []int)

ChaptersIDs returns the "Chapters" edge IDs in the mutation.

func (*MangaMutation) ClearChapters

func (m *MangaMutation) ClearChapters()

ClearChapters clears the "Chapters" edge to the Chapter entity.

func (*MangaMutation) ClearEdge

func (m *MangaMutation) 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 (*MangaMutation) ClearExcludedGroups added in v2.4.0

func (m *MangaMutation) ClearExcludedGroups()

ClearExcludedGroups clears the value of the "ExcludedGroups" field.

func (*MangaMutation) ClearField

func (m *MangaMutation) 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 (*MangaMutation) ClearFilteredGroups added in v2.4.0

func (m *MangaMutation) ClearFilteredGroups()

ClearFilteredGroups clears the value of the "FilteredGroups" field.

func (*MangaMutation) ClearedEdges

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

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

func (*MangaMutation) ClearedFields

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

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

func (MangaMutation) Client

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

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

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

func (*MangaMutation) ExcludedGroups added in v2.4.0

func (m *MangaMutation) ExcludedGroups() (r []string, exists bool)

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

func (*MangaMutation) ExcludedGroupsCleared added in v2.4.0

func (m *MangaMutation) ExcludedGroupsCleared() bool

ExcludedGroupsCleared returns if the "ExcludedGroups" field was cleared in this mutation.

func (*MangaMutation) Field

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

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

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

func (*MangaMutation) Fields

func (m *MangaMutation) 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 (*MangaMutation) FilteredGroups

func (m *MangaMutation) FilteredGroups() (r []string, exists bool)

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

func (*MangaMutation) FilteredGroupsCleared added in v2.4.0

func (m *MangaMutation) FilteredGroupsCleared() bool

FilteredGroupsCleared returns if the "FilteredGroups" field was cleared in this mutation.

func (*MangaMutation) ID

func (m *MangaMutation) ID() (id int, exists bool)

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

func (*MangaMutation) IDs

func (m *MangaMutation) IDs(ctx context.Context) ([]int, error)

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

func (*MangaMutation) MangaID

func (m *MangaMutation) MangaID() (r string, exists bool)

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

func (*MangaMutation) Mapping

func (m *MangaMutation) Mapping() (r string, exists bool)

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

func (*MangaMutation) OldExcludedGroups added in v2.4.0

func (m *MangaMutation) OldExcludedGroups(ctx context.Context) (v []string, err error)

OldExcludedGroups returns the old "ExcludedGroups" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldField

func (m *MangaMutation) 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 (*MangaMutation) OldFilteredGroups

func (m *MangaMutation) OldFilteredGroups(ctx context.Context) (v []string, err error)

OldFilteredGroups returns the old "FilteredGroups" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldMangaID

func (m *MangaMutation) OldMangaID(ctx context.Context) (v string, err error)

OldMangaID returns the old "MangaID" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldMapping

func (m *MangaMutation) OldMapping(ctx context.Context) (v string, err error)

OldMapping returns the old "Mapping" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldRegisteredOn

func (m *MangaMutation) OldRegisteredOn(ctx context.Context) (v time.Time, err error)

OldRegisteredOn returns the old "RegisteredOn" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldSource

func (m *MangaMutation) OldSource(ctx context.Context) (v string, err error)

OldSource returns the old "Source" field's value of the Manga entity. If the Manga 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 (*MangaMutation) OldTitle

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

OldTitle returns the old "Title" field's value of the Manga entity. If the Manga 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 (*MangaMutation) Op

func (m *MangaMutation) Op() Op

Op returns the operation name.

func (*MangaMutation) RegisteredOn

func (m *MangaMutation) RegisteredOn() (r time.Time, exists bool)

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

func (*MangaMutation) RemoveChapterIDs

func (m *MangaMutation) RemoveChapterIDs(ids ...int)

RemoveChapterIDs removes the "Chapters" edge to the Chapter entity by IDs.

func (*MangaMutation) RemovedChaptersIDs

func (m *MangaMutation) RemovedChaptersIDs() (ids []int)

RemovedChapters returns the removed IDs of the "Chapters" edge to the Chapter entity.

func (*MangaMutation) RemovedEdges

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

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

func (*MangaMutation) RemovedIDs

func (m *MangaMutation) 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 (*MangaMutation) ResetChapters

func (m *MangaMutation) ResetChapters()

ResetChapters resets all changes to the "Chapters" edge.

func (*MangaMutation) ResetEdge

func (m *MangaMutation) 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 (*MangaMutation) ResetExcludedGroups added in v2.4.0

func (m *MangaMutation) ResetExcludedGroups()

ResetExcludedGroups resets all changes to the "ExcludedGroups" field.

func (*MangaMutation) ResetField

func (m *MangaMutation) 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 (*MangaMutation) ResetFilteredGroups

func (m *MangaMutation) ResetFilteredGroups()

ResetFilteredGroups resets all changes to the "FilteredGroups" field.

func (*MangaMutation) ResetMangaID

func (m *MangaMutation) ResetMangaID()

ResetMangaID resets all changes to the "MangaID" field.

func (*MangaMutation) ResetMapping

func (m *MangaMutation) ResetMapping()

ResetMapping resets all changes to the "Mapping" field.

func (*MangaMutation) ResetRegisteredOn

func (m *MangaMutation) ResetRegisteredOn()

ResetRegisteredOn resets all changes to the "RegisteredOn" field.

func (*MangaMutation) ResetSource

func (m *MangaMutation) ResetSource()

ResetSource resets all changes to the "Source" field.

func (*MangaMutation) ResetTitle

func (m *MangaMutation) ResetTitle()

ResetTitle resets all changes to the "Title" field.

func (*MangaMutation) SetExcludedGroups added in v2.4.0

func (m *MangaMutation) SetExcludedGroups(s []string)

SetExcludedGroups sets the "ExcludedGroups" field.

func (*MangaMutation) SetField

func (m *MangaMutation) 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 (*MangaMutation) SetFilteredGroups

func (m *MangaMutation) SetFilteredGroups(s []string)

SetFilteredGroups sets the "FilteredGroups" field.

func (*MangaMutation) SetMangaID

func (m *MangaMutation) SetMangaID(s string)

SetMangaID sets the "MangaID" field.

func (*MangaMutation) SetMapping

func (m *MangaMutation) SetMapping(s string)

SetMapping sets the "Mapping" field.

func (*MangaMutation) SetOp

func (m *MangaMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MangaMutation) SetRegisteredOn

func (m *MangaMutation) SetRegisteredOn(t time.Time)

SetRegisteredOn sets the "RegisteredOn" field.

func (*MangaMutation) SetSource

func (m *MangaMutation) SetSource(s string)

SetSource sets the "Source" field.

func (*MangaMutation) SetTitle

func (m *MangaMutation) SetTitle(s string)

SetTitle sets the "Title" field.

func (*MangaMutation) Source

func (m *MangaMutation) Source() (r string, exists bool)

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

func (*MangaMutation) Title

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

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

func (MangaMutation) Tx

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

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

func (*MangaMutation) Type

func (m *MangaMutation) Type() string

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

func (*MangaMutation) Where

func (m *MangaMutation) Where(ps ...predicate.Manga)

Where appends a list predicates to the MangaMutation builder.

func (*MangaMutation) WhereP

func (m *MangaMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the MangaMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type MangaQuery

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

MangaQuery is the builder for querying Manga entities.

func (*MangaQuery) Aggregate

func (mq *MangaQuery) Aggregate(fns ...AggregateFunc) *MangaSelect

Aggregate returns a MangaSelect configured with the given aggregations.

func (*MangaQuery) All

func (mq *MangaQuery) All(ctx context.Context) ([]*Manga, error)

All executes the query and returns a list of Mangas.

func (*MangaQuery) AllX

func (mq *MangaQuery) AllX(ctx context.Context) []*Manga

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

func (*MangaQuery) Clone

func (mq *MangaQuery) Clone() *MangaQuery

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

func (*MangaQuery) Count

func (mq *MangaQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MangaQuery) CountX

func (mq *MangaQuery) CountX(ctx context.Context) int

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

func (*MangaQuery) Exist

func (mq *MangaQuery) Exist(ctx context.Context) (bool, error)

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

func (*MangaQuery) ExistX

func (mq *MangaQuery) ExistX(ctx context.Context) bool

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

func (*MangaQuery) First

func (mq *MangaQuery) First(ctx context.Context) (*Manga, error)

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

func (*MangaQuery) FirstID

func (mq *MangaQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*MangaQuery) FirstIDX

func (mq *MangaQuery) FirstIDX(ctx context.Context) int

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

func (*MangaQuery) FirstX

func (mq *MangaQuery) FirstX(ctx context.Context) *Manga

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

func (*MangaQuery) GroupBy

func (mq *MangaQuery) GroupBy(field string, fields ...string) *MangaGroupBy

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

client.Manga.Query().
	GroupBy(manga.FieldMangaID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MangaQuery) IDs

func (mq *MangaQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*MangaQuery) IDsX

func (mq *MangaQuery) IDsX(ctx context.Context) []int

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

func (*MangaQuery) Limit

func (mq *MangaQuery) Limit(limit int) *MangaQuery

Limit the number of records to be returned by this query.

func (*MangaQuery) Offset

func (mq *MangaQuery) Offset(offset int) *MangaQuery

Offset to start from.

func (*MangaQuery) Only

func (mq *MangaQuery) Only(ctx context.Context) (*Manga, error)

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

func (*MangaQuery) OnlyID

func (mq *MangaQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*MangaQuery) OnlyIDX

func (mq *MangaQuery) OnlyIDX(ctx context.Context) int

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

func (*MangaQuery) OnlyX

func (mq *MangaQuery) OnlyX(ctx context.Context) *Manga

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

func (*MangaQuery) Order

func (mq *MangaQuery) Order(o ...manga.OrderOption) *MangaQuery

Order specifies how the records should be ordered.

func (*MangaQuery) QueryChapters

func (mq *MangaQuery) QueryChapters() *ChapterQuery

QueryChapters chains the current query on the "Chapters" edge.

func (*MangaQuery) Select

func (mq *MangaQuery) Select(fields ...string) *MangaSelect

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

client.Manga.Query().
	Select(manga.FieldMangaID).
	Scan(ctx, &v)

func (*MangaQuery) Unique

func (mq *MangaQuery) Unique(unique bool) *MangaQuery

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

func (mq *MangaQuery) Where(ps ...predicate.Manga) *MangaQuery

Where adds a new predicate for the MangaQuery builder.

func (*MangaQuery) WithChapters

func (mq *MangaQuery) WithChapters(opts ...func(*ChapterQuery)) *MangaQuery

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

type MangaSelect

type MangaSelect struct {
	*MangaQuery
	// contains filtered or unexported fields
}

MangaSelect is the builder for selecting fields of Manga entities.

func (*MangaSelect) Aggregate

func (ms *MangaSelect) Aggregate(fns ...AggregateFunc) *MangaSelect

Aggregate adds the given aggregation functions to the selector query.

func (*MangaSelect) Bool

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

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

func (*MangaSelect) BoolX

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

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

func (*MangaSelect) Bools

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

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

func (*MangaSelect) BoolsX

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

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

func (*MangaSelect) Float64

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

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

func (*MangaSelect) Float64X

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

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

func (*MangaSelect) Float64s

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

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

func (*MangaSelect) Float64sX

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

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

func (*MangaSelect) Int

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

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

func (*MangaSelect) IntX

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

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

func (*MangaSelect) Ints

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

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

func (*MangaSelect) IntsX

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

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

func (*MangaSelect) Scan

func (ms *MangaSelect) Scan(ctx context.Context, v any) error

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

func (*MangaSelect) ScanX

func (s *MangaSelect) ScanX(ctx context.Context, v any)

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

func (*MangaSelect) String

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

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

func (*MangaSelect) StringX

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

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

func (*MangaSelect) Strings

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

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

func (*MangaSelect) StringsX

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

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

type MangaUpdate

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

MangaUpdate is the builder for updating Manga entities.

func (*MangaUpdate) AddChapterIDs

func (mu *MangaUpdate) AddChapterIDs(ids ...int) *MangaUpdate

AddChapterIDs adds the "Chapters" edge to the Chapter entity by IDs.

func (*MangaUpdate) AddChapters

func (mu *MangaUpdate) AddChapters(c ...*Chapter) *MangaUpdate

AddChapters adds the "Chapters" edges to the Chapter entity.

func (*MangaUpdate) AppendExcludedGroups added in v2.4.0

func (mu *MangaUpdate) AppendExcludedGroups(s []string) *MangaUpdate

AppendExcludedGroups appends s to the "ExcludedGroups" field.

func (*MangaUpdate) AppendFilteredGroups

func (mu *MangaUpdate) AppendFilteredGroups(s []string) *MangaUpdate

AppendFilteredGroups appends s to the "FilteredGroups" field.

func (*MangaUpdate) ClearChapters

func (mu *MangaUpdate) ClearChapters() *MangaUpdate

ClearChapters clears all "Chapters" edges to the Chapter entity.

func (*MangaUpdate) ClearExcludedGroups added in v2.4.0

func (mu *MangaUpdate) ClearExcludedGroups() *MangaUpdate

ClearExcludedGroups clears the value of the "ExcludedGroups" field.

func (*MangaUpdate) ClearFilteredGroups added in v2.4.0

func (mu *MangaUpdate) ClearFilteredGroups() *MangaUpdate

ClearFilteredGroups clears the value of the "FilteredGroups" field.

func (*MangaUpdate) Exec

func (mu *MangaUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MangaUpdate) ExecX

func (mu *MangaUpdate) ExecX(ctx context.Context)

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

func (*MangaUpdate) Mutation

func (mu *MangaUpdate) Mutation() *MangaMutation

Mutation returns the MangaMutation object of the builder.

func (*MangaUpdate) RemoveChapterIDs

func (mu *MangaUpdate) RemoveChapterIDs(ids ...int) *MangaUpdate

RemoveChapterIDs removes the "Chapters" edge to Chapter entities by IDs.

func (*MangaUpdate) RemoveChapters

func (mu *MangaUpdate) RemoveChapters(c ...*Chapter) *MangaUpdate

RemoveChapters removes "Chapters" edges to Chapter entities.

func (*MangaUpdate) Save

func (mu *MangaUpdate) Save(ctx context.Context) (int, error)

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

func (*MangaUpdate) SaveX

func (mu *MangaUpdate) SaveX(ctx context.Context) int

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

func (*MangaUpdate) SetExcludedGroups added in v2.4.0

func (mu *MangaUpdate) SetExcludedGroups(s []string) *MangaUpdate

SetExcludedGroups sets the "ExcludedGroups" field.

func (*MangaUpdate) SetFilteredGroups

func (mu *MangaUpdate) SetFilteredGroups(s []string) *MangaUpdate

SetFilteredGroups sets the "FilteredGroups" field.

func (*MangaUpdate) SetMangaID

func (mu *MangaUpdate) SetMangaID(s string) *MangaUpdate

SetMangaID sets the "MangaID" field.

func (*MangaUpdate) SetMapping

func (mu *MangaUpdate) SetMapping(s string) *MangaUpdate

SetMapping sets the "Mapping" field.

func (*MangaUpdate) SetNillableMangaID added in v2.3.0

func (mu *MangaUpdate) SetNillableMangaID(s *string) *MangaUpdate

SetNillableMangaID sets the "MangaID" field if the given value is not nil.

func (*MangaUpdate) SetNillableMapping added in v2.3.0

func (mu *MangaUpdate) SetNillableMapping(s *string) *MangaUpdate

SetNillableMapping sets the "Mapping" field if the given value is not nil.

func (*MangaUpdate) SetNillableRegisteredOn added in v2.3.0

func (mu *MangaUpdate) SetNillableRegisteredOn(t *time.Time) *MangaUpdate

SetNillableRegisteredOn sets the "RegisteredOn" field if the given value is not nil.

func (*MangaUpdate) SetNillableSource added in v2.3.0

func (mu *MangaUpdate) SetNillableSource(s *string) *MangaUpdate

SetNillableSource sets the "Source" field if the given value is not nil.

func (*MangaUpdate) SetNillableTitle added in v2.3.0

func (mu *MangaUpdate) SetNillableTitle(s *string) *MangaUpdate

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*MangaUpdate) SetRegisteredOn

func (mu *MangaUpdate) SetRegisteredOn(t time.Time) *MangaUpdate

SetRegisteredOn sets the "RegisteredOn" field.

func (*MangaUpdate) SetSource

func (mu *MangaUpdate) SetSource(s string) *MangaUpdate

SetSource sets the "Source" field.

func (*MangaUpdate) SetTitle

func (mu *MangaUpdate) SetTitle(s string) *MangaUpdate

SetTitle sets the "Title" field.

func (*MangaUpdate) Where

func (mu *MangaUpdate) Where(ps ...predicate.Manga) *MangaUpdate

Where appends a list predicates to the MangaUpdate builder.

type MangaUpdateOne

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

MangaUpdateOne is the builder for updating a single Manga entity.

func (*MangaUpdateOne) AddChapterIDs

func (muo *MangaUpdateOne) AddChapterIDs(ids ...int) *MangaUpdateOne

AddChapterIDs adds the "Chapters" edge to the Chapter entity by IDs.

func (*MangaUpdateOne) AddChapters

func (muo *MangaUpdateOne) AddChapters(c ...*Chapter) *MangaUpdateOne

AddChapters adds the "Chapters" edges to the Chapter entity.

func (*MangaUpdateOne) AppendExcludedGroups added in v2.4.0

func (muo *MangaUpdateOne) AppendExcludedGroups(s []string) *MangaUpdateOne

AppendExcludedGroups appends s to the "ExcludedGroups" field.

func (*MangaUpdateOne) AppendFilteredGroups

func (muo *MangaUpdateOne) AppendFilteredGroups(s []string) *MangaUpdateOne

AppendFilteredGroups appends s to the "FilteredGroups" field.

func (*MangaUpdateOne) ClearChapters

func (muo *MangaUpdateOne) ClearChapters() *MangaUpdateOne

ClearChapters clears all "Chapters" edges to the Chapter entity.

func (*MangaUpdateOne) ClearExcludedGroups added in v2.4.0

func (muo *MangaUpdateOne) ClearExcludedGroups() *MangaUpdateOne

ClearExcludedGroups clears the value of the "ExcludedGroups" field.

func (*MangaUpdateOne) ClearFilteredGroups added in v2.4.0

func (muo *MangaUpdateOne) ClearFilteredGroups() *MangaUpdateOne

ClearFilteredGroups clears the value of the "FilteredGroups" field.

func (*MangaUpdateOne) Exec

func (muo *MangaUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MangaUpdateOne) ExecX

func (muo *MangaUpdateOne) ExecX(ctx context.Context)

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

func (*MangaUpdateOne) Mutation

func (muo *MangaUpdateOne) Mutation() *MangaMutation

Mutation returns the MangaMutation object of the builder.

func (*MangaUpdateOne) RemoveChapterIDs

func (muo *MangaUpdateOne) RemoveChapterIDs(ids ...int) *MangaUpdateOne

RemoveChapterIDs removes the "Chapters" edge to Chapter entities by IDs.

func (*MangaUpdateOne) RemoveChapters

func (muo *MangaUpdateOne) RemoveChapters(c ...*Chapter) *MangaUpdateOne

RemoveChapters removes "Chapters" edges to Chapter entities.

func (*MangaUpdateOne) Save

func (muo *MangaUpdateOne) Save(ctx context.Context) (*Manga, error)

Save executes the query and returns the updated Manga entity.

func (*MangaUpdateOne) SaveX

func (muo *MangaUpdateOne) SaveX(ctx context.Context) *Manga

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

func (*MangaUpdateOne) Select

func (muo *MangaUpdateOne) Select(field string, fields ...string) *MangaUpdateOne

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

func (*MangaUpdateOne) SetExcludedGroups added in v2.4.0

func (muo *MangaUpdateOne) SetExcludedGroups(s []string) *MangaUpdateOne

SetExcludedGroups sets the "ExcludedGroups" field.

func (*MangaUpdateOne) SetFilteredGroups

func (muo *MangaUpdateOne) SetFilteredGroups(s []string) *MangaUpdateOne

SetFilteredGroups sets the "FilteredGroups" field.

func (*MangaUpdateOne) SetMangaID

func (muo *MangaUpdateOne) SetMangaID(s string) *MangaUpdateOne

SetMangaID sets the "MangaID" field.

func (*MangaUpdateOne) SetMapping

func (muo *MangaUpdateOne) SetMapping(s string) *MangaUpdateOne

SetMapping sets the "Mapping" field.

func (*MangaUpdateOne) SetNillableMangaID added in v2.3.0

func (muo *MangaUpdateOne) SetNillableMangaID(s *string) *MangaUpdateOne

SetNillableMangaID sets the "MangaID" field if the given value is not nil.

func (*MangaUpdateOne) SetNillableMapping added in v2.3.0

func (muo *MangaUpdateOne) SetNillableMapping(s *string) *MangaUpdateOne

SetNillableMapping sets the "Mapping" field if the given value is not nil.

func (*MangaUpdateOne) SetNillableRegisteredOn added in v2.3.0

func (muo *MangaUpdateOne) SetNillableRegisteredOn(t *time.Time) *MangaUpdateOne

SetNillableRegisteredOn sets the "RegisteredOn" field if the given value is not nil.

func (*MangaUpdateOne) SetNillableSource added in v2.3.0

func (muo *MangaUpdateOne) SetNillableSource(s *string) *MangaUpdateOne

SetNillableSource sets the "Source" field if the given value is not nil.

func (*MangaUpdateOne) SetNillableTitle added in v2.3.0

func (muo *MangaUpdateOne) SetNillableTitle(s *string) *MangaUpdateOne

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*MangaUpdateOne) SetRegisteredOn

func (muo *MangaUpdateOne) SetRegisteredOn(t time.Time) *MangaUpdateOne

SetRegisteredOn sets the "RegisteredOn" field.

func (*MangaUpdateOne) SetSource

func (muo *MangaUpdateOne) SetSource(s string) *MangaUpdateOne

SetSource sets the "Source" field.

func (*MangaUpdateOne) SetTitle

func (muo *MangaUpdateOne) SetTitle(s string) *MangaUpdateOne

SetTitle sets the "Title" field.

func (*MangaUpdateOne) Where

func (muo *MangaUpdateOne) Where(ps ...predicate.Manga) *MangaUpdateOne

Where appends a list predicates to the MangaUpdate builder.

type Mangas

type Mangas []*Manga

Mangas is a parsable slice of Manga.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Chapter is the client for interacting with the Chapter builders.
	Chapter *ChapterClient
	// Manga is the client for interacting with the Manga builders.
	Manga *MangaClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL