ent

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 25 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.
	TypeBook           = "Book"
	TypeBookAuthor     = "BookAuthor"
	TypeDiscordMessage = "DiscordMessage"
	TypeDiscordUser    = "DiscordUser"
)

Variables

This section is empty.

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 Book

type Book struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// GoodreadsID holds the value of the "goodreads_id" field.
	GoodreadsID string `json:"goodreads_id,omitempty"`
	// GoogleVolumeID holds the value of the "google_volume_id" field.
	GoogleVolumeID string `json:"google_volume_id,omitempty"`
	// Isbn10 holds the value of the "isbn_10" field.
	Isbn10 string `json:"isbn_10,omitempty"`
	// Isbn13 holds the value of the "isbn_13" field.
	Isbn13 string `json:"isbn_13,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BookQuery when eager-loading is set.
	Edges BookEdges `json:"edges"`
	// contains filtered or unexported fields
}

Book is the model entity for the Book schema.

func (*Book) NamedBookAuthor

func (b *Book) NamedBookAuthor(name string) ([]*BookAuthor, error)

NamedBookAuthor returns the BookAuthor named value or an error if the edge was not loaded in eager-loading with this name.

func (*Book) QueryBookAuthor

func (b *Book) QueryBookAuthor() *BookAuthorQuery

QueryBookAuthor queries the "book_author" edge of the Book entity.

func (*Book) String

func (b *Book) String() string

String implements the fmt.Stringer.

func (*Book) Unwrap

func (b *Book) Unwrap() *Book

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

func (b *Book) Update() *BookUpdateOne

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

func (*Book) Value

func (b *Book) Value(name string) (ent.Value, error)

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

type BookAuthor

type BookAuthor struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// FullName holds the value of the "full_name" field.
	FullName string `json:"full_name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BookAuthorQuery when eager-loading is set.
	Edges BookAuthorEdges `json:"edges"`
	// contains filtered or unexported fields
}

BookAuthor is the model entity for the BookAuthor schema.

func (*BookAuthor) NamedBooks

func (ba *BookAuthor) NamedBooks(name string) ([]*Book, error)

NamedBooks returns the Books named value or an error if the edge was not loaded in eager-loading with this name.

func (*BookAuthor) QueryBooks

func (ba *BookAuthor) QueryBooks() *BookQuery

QueryBooks queries the "books" edge of the BookAuthor entity.

func (*BookAuthor) String

func (ba *BookAuthor) String() string

String implements the fmt.Stringer.

func (*BookAuthor) Unwrap

func (ba *BookAuthor) Unwrap() *BookAuthor

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

func (ba *BookAuthor) Update() *BookAuthorUpdateOne

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

func (*BookAuthor) Value

func (ba *BookAuthor) Value(name string) (ent.Value, error)

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

type BookAuthorClient

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

BookAuthorClient is a client for the BookAuthor schema.

func NewBookAuthorClient

func NewBookAuthorClient(c config) *BookAuthorClient

NewBookAuthorClient returns a client for the BookAuthor from the given config.

func (*BookAuthorClient) Create

func (c *BookAuthorClient) Create() *BookAuthorCreate

Create returns a builder for creating a BookAuthor entity.

func (*BookAuthorClient) CreateBulk

func (c *BookAuthorClient) CreateBulk(builders ...*BookAuthorCreate) *BookAuthorCreateBulk

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

func (*BookAuthorClient) Delete

func (c *BookAuthorClient) Delete() *BookAuthorDelete

Delete returns a delete builder for BookAuthor.

func (*BookAuthorClient) DeleteOne

func (c *BookAuthorClient) DeleteOne(ba *BookAuthor) *BookAuthorDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BookAuthorClient) DeleteOneID

func (c *BookAuthorClient) DeleteOneID(id uuid.UUID) *BookAuthorDeleteOne

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

func (*BookAuthorClient) Get

Get returns a BookAuthor entity by its id.

func (*BookAuthorClient) GetX

func (c *BookAuthorClient) GetX(ctx context.Context, id uuid.UUID) *BookAuthor

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

func (*BookAuthorClient) Hooks

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

Hooks returns the client hooks.

func (*BookAuthorClient) Intercept

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

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

func (*BookAuthorClient) Interceptors

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

Interceptors returns the client interceptors.

func (*BookAuthorClient) Query

func (c *BookAuthorClient) Query() *BookAuthorQuery

Query returns a query builder for BookAuthor.

func (*BookAuthorClient) QueryBooks

func (c *BookAuthorClient) QueryBooks(ba *BookAuthor) *BookQuery

QueryBooks queries the books edge of a BookAuthor.

func (*BookAuthorClient) Update

func (c *BookAuthorClient) Update() *BookAuthorUpdate

Update returns an update builder for BookAuthor.

func (*BookAuthorClient) UpdateOne

func (c *BookAuthorClient) UpdateOne(ba *BookAuthor) *BookAuthorUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BookAuthorClient) UpdateOneID

func (c *BookAuthorClient) UpdateOneID(id uuid.UUID) *BookAuthorUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BookAuthorClient) Use

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

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

type BookAuthorCreate

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

BookAuthorCreate is the builder for creating a BookAuthor entity.

func (*BookAuthorCreate) AddBookIDs

func (bac *BookAuthorCreate) AddBookIDs(ids ...uuid.UUID) *BookAuthorCreate

AddBookIDs adds the "books" edge to the Book entity by IDs.

func (*BookAuthorCreate) AddBooks

func (bac *BookAuthorCreate) AddBooks(b ...*Book) *BookAuthorCreate

AddBooks adds the "books" edges to the Book entity.

func (*BookAuthorCreate) Exec

func (bac *BookAuthorCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookAuthorCreate) ExecX

func (bac *BookAuthorCreate) ExecX(ctx context.Context)

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

func (*BookAuthorCreate) Mutation

func (bac *BookAuthorCreate) Mutation() *BookAuthorMutation

Mutation returns the BookAuthorMutation object of the builder.

func (*BookAuthorCreate) OnConflict

func (bac *BookAuthorCreate) OnConflict(opts ...sql.ConflictOption) *BookAuthorUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.BookAuthor.Create().
	SetFullName(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BookAuthorUpsert) {
		SetFullName(v+v).
	}).
	Exec(ctx)

func (*BookAuthorCreate) OnConflictColumns

func (bac *BookAuthorCreate) OnConflictColumns(columns ...string) *BookAuthorUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.BookAuthor.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BookAuthorCreate) Save

func (bac *BookAuthorCreate) Save(ctx context.Context) (*BookAuthor, error)

Save creates the BookAuthor in the database.

func (*BookAuthorCreate) SaveX

func (bac *BookAuthorCreate) SaveX(ctx context.Context) *BookAuthor

SaveX calls Save and panics if Save returns an error.

func (*BookAuthorCreate) SetFullName

func (bac *BookAuthorCreate) SetFullName(s string) *BookAuthorCreate

SetFullName sets the "full_name" field.

func (*BookAuthorCreate) SetID

func (bac *BookAuthorCreate) SetID(u uuid.UUID) *BookAuthorCreate

SetID sets the "id" field.

type BookAuthorCreateBulk

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

BookAuthorCreateBulk is the builder for creating many BookAuthor entities in bulk.

func (*BookAuthorCreateBulk) Exec

func (bacb *BookAuthorCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BookAuthorCreateBulk) ExecX

func (bacb *BookAuthorCreateBulk) ExecX(ctx context.Context)

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

func (*BookAuthorCreateBulk) OnConflict

func (bacb *BookAuthorCreateBulk) OnConflict(opts ...sql.ConflictOption) *BookAuthorUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.BookAuthor.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BookAuthorUpsert) {
		SetFullName(v+v).
	}).
	Exec(ctx)

func (*BookAuthorCreateBulk) OnConflictColumns

func (bacb *BookAuthorCreateBulk) OnConflictColumns(columns ...string) *BookAuthorUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.BookAuthor.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BookAuthorCreateBulk) Save

func (bacb *BookAuthorCreateBulk) Save(ctx context.Context) ([]*BookAuthor, error)

Save creates the BookAuthor entities in the database.

func (*BookAuthorCreateBulk) SaveX

func (bacb *BookAuthorCreateBulk) SaveX(ctx context.Context) []*BookAuthor

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

type BookAuthorDelete

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

BookAuthorDelete is the builder for deleting a BookAuthor entity.

func (*BookAuthorDelete) Exec

func (bad *BookAuthorDelete) Exec(ctx context.Context) (int, error)

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

func (*BookAuthorDelete) ExecX

func (bad *BookAuthorDelete) ExecX(ctx context.Context) int

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

func (*BookAuthorDelete) Where

Where appends a list predicates to the BookAuthorDelete builder.

type BookAuthorDeleteOne

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

BookAuthorDeleteOne is the builder for deleting a single BookAuthor entity.

func (*BookAuthorDeleteOne) Exec

func (bado *BookAuthorDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BookAuthorDeleteOne) ExecX

func (bado *BookAuthorDeleteOne) ExecX(ctx context.Context)

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

func (*BookAuthorDeleteOne) Where

Where appends a list predicates to the BookAuthorDelete builder.

type BookAuthorEdges

type BookAuthorEdges struct {
	// Books holds the value of the books edge.
	Books []*Book `json:"books,omitempty"`
	// contains filtered or unexported fields
}

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

func (BookAuthorEdges) BooksOrErr

func (e BookAuthorEdges) BooksOrErr() ([]*Book, error)

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

type BookAuthorGroupBy

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

BookAuthorGroupBy is the group-by builder for BookAuthor entities.

func (*BookAuthorGroupBy) Aggregate

func (bagb *BookAuthorGroupBy) Aggregate(fns ...AggregateFunc) *BookAuthorGroupBy

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

func (*BookAuthorGroupBy) Bool

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

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

func (*BookAuthorGroupBy) BoolX

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

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

func (*BookAuthorGroupBy) Bools

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

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

func (*BookAuthorGroupBy) BoolsX

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

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

func (*BookAuthorGroupBy) Float64

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

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

func (*BookAuthorGroupBy) Float64X

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

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

func (*BookAuthorGroupBy) Float64s

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

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

func (*BookAuthorGroupBy) Float64sX

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

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

func (*BookAuthorGroupBy) Int

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

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

func (*BookAuthorGroupBy) IntX

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

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

func (*BookAuthorGroupBy) Ints

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

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

func (*BookAuthorGroupBy) IntsX

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

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

func (*BookAuthorGroupBy) Scan

func (bagb *BookAuthorGroupBy) Scan(ctx context.Context, v any) error

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

func (*BookAuthorGroupBy) ScanX

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

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

func (*BookAuthorGroupBy) String

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

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

func (*BookAuthorGroupBy) StringX

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

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

func (*BookAuthorGroupBy) Strings

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

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

func (*BookAuthorGroupBy) StringsX

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

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

type BookAuthorMutation

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

BookAuthorMutation represents an operation that mutates the BookAuthor nodes in the graph.

func (*BookAuthorMutation) AddBookIDs

func (m *BookAuthorMutation) AddBookIDs(ids ...uuid.UUID)

AddBookIDs adds the "books" edge to the Book entity by ids.

func (*BookAuthorMutation) AddField

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

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

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

func (*BookAuthorMutation) AddedField

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

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

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

func (*BookAuthorMutation) AddedIDs

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

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

func (*BookAuthorMutation) BooksCleared

func (m *BookAuthorMutation) BooksCleared() bool

BooksCleared reports if the "books" edge to the Book entity was cleared.

func (*BookAuthorMutation) BooksIDs

func (m *BookAuthorMutation) BooksIDs() (ids []uuid.UUID)

BooksIDs returns the "books" edge IDs in the mutation.

func (*BookAuthorMutation) ClearBooks

func (m *BookAuthorMutation) ClearBooks()

ClearBooks clears the "books" edge to the Book entity.

func (*BookAuthorMutation) ClearEdge

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

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) ClearedEdges

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

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

func (*BookAuthorMutation) ClearedFields

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

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

func (BookAuthorMutation) Client

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

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

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

func (*BookAuthorMutation) Field

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

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

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

func (*BookAuthorMutation) Fields

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) FullName

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

FullName returns the value of the "full_name" field in the mutation.

func (*BookAuthorMutation) ID

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

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

func (*BookAuthorMutation) IDs

func (m *BookAuthorMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*BookAuthorMutation) OldField

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) OldFullName

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

OldFullName returns the old "full_name" field's value of the BookAuthor entity. If the BookAuthor 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 (*BookAuthorMutation) Op

func (m *BookAuthorMutation) Op() Op

Op returns the operation name.

func (*BookAuthorMutation) RemoveBookIDs

func (m *BookAuthorMutation) RemoveBookIDs(ids ...uuid.UUID)

RemoveBookIDs removes the "books" edge to the Book entity by IDs.

func (*BookAuthorMutation) RemovedBooksIDs

func (m *BookAuthorMutation) RemovedBooksIDs() (ids []uuid.UUID)

RemovedBooks returns the removed IDs of the "books" edge to the Book entity.

func (*BookAuthorMutation) RemovedEdges

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

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

func (*BookAuthorMutation) RemovedIDs

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) ResetBooks

func (m *BookAuthorMutation) ResetBooks()

ResetBooks resets all changes to the "books" edge.

func (*BookAuthorMutation) ResetEdge

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

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) ResetFullName

func (m *BookAuthorMutation) ResetFullName()

ResetFullName resets all changes to the "full_name" field.

func (*BookAuthorMutation) SetField

func (m *BookAuthorMutation) 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 (*BookAuthorMutation) SetFullName

func (m *BookAuthorMutation) SetFullName(s string)

SetFullName sets the "full_name" field.

func (*BookAuthorMutation) SetID

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

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

func (*BookAuthorMutation) SetOp

func (m *BookAuthorMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (BookAuthorMutation) Tx

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

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

func (*BookAuthorMutation) Type

func (m *BookAuthorMutation) Type() string

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

func (*BookAuthorMutation) Where

func (m *BookAuthorMutation) Where(ps ...predicate.BookAuthor)

Where appends a list predicates to the BookAuthorMutation builder.

func (*BookAuthorMutation) WhereP

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

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

type BookAuthorQuery

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

BookAuthorQuery is the builder for querying BookAuthor entities.

func (*BookAuthorQuery) Aggregate

func (baq *BookAuthorQuery) Aggregate(fns ...AggregateFunc) *BookAuthorSelect

Aggregate returns a BookAuthorSelect configured with the given aggregations.

func (*BookAuthorQuery) All

func (baq *BookAuthorQuery) All(ctx context.Context) ([]*BookAuthor, error)

All executes the query and returns a list of BookAuthors.

func (*BookAuthorQuery) AllX

func (baq *BookAuthorQuery) AllX(ctx context.Context) []*BookAuthor

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

func (*BookAuthorQuery) Clone

func (baq *BookAuthorQuery) Clone() *BookAuthorQuery

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

func (*BookAuthorQuery) Count

func (baq *BookAuthorQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BookAuthorQuery) CountX

func (baq *BookAuthorQuery) CountX(ctx context.Context) int

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

func (*BookAuthorQuery) Exist

func (baq *BookAuthorQuery) Exist(ctx context.Context) (bool, error)

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

func (*BookAuthorQuery) ExistX

func (baq *BookAuthorQuery) ExistX(ctx context.Context) bool

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

func (*BookAuthorQuery) First

func (baq *BookAuthorQuery) First(ctx context.Context) (*BookAuthor, error)

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

func (*BookAuthorQuery) FirstID

func (baq *BookAuthorQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BookAuthorQuery) FirstIDX

func (baq *BookAuthorQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*BookAuthorQuery) FirstX

func (baq *BookAuthorQuery) FirstX(ctx context.Context) *BookAuthor

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

func (*BookAuthorQuery) ForShare

func (baq *BookAuthorQuery) ForShare(opts ...sql.LockOption) *BookAuthorQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*BookAuthorQuery) ForUpdate

func (baq *BookAuthorQuery) ForUpdate(opts ...sql.LockOption) *BookAuthorQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*BookAuthorQuery) GroupBy

func (baq *BookAuthorQuery) GroupBy(field string, fields ...string) *BookAuthorGroupBy

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

client.BookAuthor.Query().
	GroupBy(bookauthor.FieldFullName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BookAuthorQuery) IDs

func (baq *BookAuthorQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*BookAuthorQuery) IDsX

func (baq *BookAuthorQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*BookAuthorQuery) Limit

func (baq *BookAuthorQuery) Limit(limit int) *BookAuthorQuery

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

func (*BookAuthorQuery) Offset

func (baq *BookAuthorQuery) Offset(offset int) *BookAuthorQuery

Offset to start from.

func (*BookAuthorQuery) Only

func (baq *BookAuthorQuery) Only(ctx context.Context) (*BookAuthor, error)

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

func (*BookAuthorQuery) OnlyID

func (baq *BookAuthorQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BookAuthorQuery) OnlyIDX

func (baq *BookAuthorQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*BookAuthorQuery) OnlyX

func (baq *BookAuthorQuery) OnlyX(ctx context.Context) *BookAuthor

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

func (*BookAuthorQuery) Order

Order specifies how the records should be ordered.

func (*BookAuthorQuery) QueryBooks

func (baq *BookAuthorQuery) QueryBooks() *BookQuery

QueryBooks chains the current query on the "books" edge.

func (*BookAuthorQuery) Select

func (baq *BookAuthorQuery) Select(fields ...string) *BookAuthorSelect

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

client.BookAuthor.Query().
	Select(bookauthor.FieldFullName).
	Scan(ctx, &v)

func (*BookAuthorQuery) Unique

func (baq *BookAuthorQuery) Unique(unique bool) *BookAuthorQuery

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

Where adds a new predicate for the BookAuthorQuery builder.

func (*BookAuthorQuery) WithBooks

func (baq *BookAuthorQuery) WithBooks(opts ...func(*BookQuery)) *BookAuthorQuery

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

func (*BookAuthorQuery) WithNamedBooks

func (baq *BookAuthorQuery) WithNamedBooks(name string, opts ...func(*BookQuery)) *BookAuthorQuery

WithNamedBooks tells the query-builder to eager-load the nodes that are connected to the "books" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type BookAuthorSelect

type BookAuthorSelect struct {
	*BookAuthorQuery
	// contains filtered or unexported fields
}

BookAuthorSelect is the builder for selecting fields of BookAuthor entities.

func (*BookAuthorSelect) Aggregate

func (bas *BookAuthorSelect) Aggregate(fns ...AggregateFunc) *BookAuthorSelect

Aggregate adds the given aggregation functions to the selector query.

func (*BookAuthorSelect) Bool

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

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

func (*BookAuthorSelect) BoolX

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

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

func (*BookAuthorSelect) Bools

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

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

func (*BookAuthorSelect) BoolsX

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

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

func (*BookAuthorSelect) Float64

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

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

func (*BookAuthorSelect) Float64X

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

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

func (*BookAuthorSelect) Float64s

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

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

func (*BookAuthorSelect) Float64sX

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

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

func (*BookAuthorSelect) Int

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

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

func (*BookAuthorSelect) IntX

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

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

func (*BookAuthorSelect) Ints

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

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

func (*BookAuthorSelect) IntsX

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

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

func (*BookAuthorSelect) Scan

func (bas *BookAuthorSelect) Scan(ctx context.Context, v any) error

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

func (*BookAuthorSelect) ScanX

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

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

func (*BookAuthorSelect) String

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

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

func (*BookAuthorSelect) StringX

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

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

func (*BookAuthorSelect) Strings

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

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

func (*BookAuthorSelect) StringsX

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

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

type BookAuthorUpdate

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

BookAuthorUpdate is the builder for updating BookAuthor entities.

func (*BookAuthorUpdate) AddBookIDs

func (bau *BookAuthorUpdate) AddBookIDs(ids ...uuid.UUID) *BookAuthorUpdate

AddBookIDs adds the "books" edge to the Book entity by IDs.

func (*BookAuthorUpdate) AddBooks

func (bau *BookAuthorUpdate) AddBooks(b ...*Book) *BookAuthorUpdate

AddBooks adds the "books" edges to the Book entity.

func (*BookAuthorUpdate) ClearBooks

func (bau *BookAuthorUpdate) ClearBooks() *BookAuthorUpdate

ClearBooks clears all "books" edges to the Book entity.

func (*BookAuthorUpdate) Exec

func (bau *BookAuthorUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookAuthorUpdate) ExecX

func (bau *BookAuthorUpdate) ExecX(ctx context.Context)

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

func (*BookAuthorUpdate) Mutation

func (bau *BookAuthorUpdate) Mutation() *BookAuthorMutation

Mutation returns the BookAuthorMutation object of the builder.

func (*BookAuthorUpdate) RemoveBookIDs

func (bau *BookAuthorUpdate) RemoveBookIDs(ids ...uuid.UUID) *BookAuthorUpdate

RemoveBookIDs removes the "books" edge to Book entities by IDs.

func (*BookAuthorUpdate) RemoveBooks

func (bau *BookAuthorUpdate) RemoveBooks(b ...*Book) *BookAuthorUpdate

RemoveBooks removes "books" edges to Book entities.

func (*BookAuthorUpdate) Save

func (bau *BookAuthorUpdate) Save(ctx context.Context) (int, error)

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

func (*BookAuthorUpdate) SaveX

func (bau *BookAuthorUpdate) SaveX(ctx context.Context) int

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

func (*BookAuthorUpdate) SetFullName

func (bau *BookAuthorUpdate) SetFullName(s string) *BookAuthorUpdate

SetFullName sets the "full_name" field.

func (*BookAuthorUpdate) Where

Where appends a list predicates to the BookAuthorUpdate builder.

type BookAuthorUpdateOne

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

BookAuthorUpdateOne is the builder for updating a single BookAuthor entity.

func (*BookAuthorUpdateOne) AddBookIDs

func (bauo *BookAuthorUpdateOne) AddBookIDs(ids ...uuid.UUID) *BookAuthorUpdateOne

AddBookIDs adds the "books" edge to the Book entity by IDs.

func (*BookAuthorUpdateOne) AddBooks

func (bauo *BookAuthorUpdateOne) AddBooks(b ...*Book) *BookAuthorUpdateOne

AddBooks adds the "books" edges to the Book entity.

func (*BookAuthorUpdateOne) ClearBooks

func (bauo *BookAuthorUpdateOne) ClearBooks() *BookAuthorUpdateOne

ClearBooks clears all "books" edges to the Book entity.

func (*BookAuthorUpdateOne) Exec

func (bauo *BookAuthorUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BookAuthorUpdateOne) ExecX

func (bauo *BookAuthorUpdateOne) ExecX(ctx context.Context)

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

func (*BookAuthorUpdateOne) Mutation

func (bauo *BookAuthorUpdateOne) Mutation() *BookAuthorMutation

Mutation returns the BookAuthorMutation object of the builder.

func (*BookAuthorUpdateOne) RemoveBookIDs

func (bauo *BookAuthorUpdateOne) RemoveBookIDs(ids ...uuid.UUID) *BookAuthorUpdateOne

RemoveBookIDs removes the "books" edge to Book entities by IDs.

func (*BookAuthorUpdateOne) RemoveBooks

func (bauo *BookAuthorUpdateOne) RemoveBooks(b ...*Book) *BookAuthorUpdateOne

RemoveBooks removes "books" edges to Book entities.

func (*BookAuthorUpdateOne) Save

func (bauo *BookAuthorUpdateOne) Save(ctx context.Context) (*BookAuthor, error)

Save executes the query and returns the updated BookAuthor entity.

func (*BookAuthorUpdateOne) SaveX

func (bauo *BookAuthorUpdateOne) SaveX(ctx context.Context) *BookAuthor

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

func (*BookAuthorUpdateOne) Select

func (bauo *BookAuthorUpdateOne) Select(field string, fields ...string) *BookAuthorUpdateOne

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

func (*BookAuthorUpdateOne) SetFullName

func (bauo *BookAuthorUpdateOne) SetFullName(s string) *BookAuthorUpdateOne

SetFullName sets the "full_name" field.

func (*BookAuthorUpdateOne) Where

Where appends a list predicates to the BookAuthorUpdate builder.

type BookAuthorUpsert

type BookAuthorUpsert struct {
	*sql.UpdateSet
}

BookAuthorUpsert is the "OnConflict" setter.

func (*BookAuthorUpsert) SetFullName

func (u *BookAuthorUpsert) SetFullName(v string) *BookAuthorUpsert

SetFullName sets the "full_name" field.

func (*BookAuthorUpsert) UpdateFullName

func (u *BookAuthorUpsert) UpdateFullName() *BookAuthorUpsert

UpdateFullName sets the "full_name" field to the value that was provided on create.

type BookAuthorUpsertBulk

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

BookAuthorUpsertBulk is the builder for "upsert"-ing a bulk of BookAuthor nodes.

func (*BookAuthorUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BookAuthorUpsertBulk) Exec

Exec executes the query.

func (*BookAuthorUpsertBulk) ExecX

func (u *BookAuthorUpsertBulk) ExecX(ctx context.Context)

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

func (*BookAuthorUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.BookAuthor.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*BookAuthorUpsertBulk) SetFullName

SetFullName sets the "full_name" field.

func (*BookAuthorUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the BookAuthorCreateBulk.OnConflict documentation for more info.

func (*BookAuthorUpsertBulk) UpdateFullName

func (u *BookAuthorUpsertBulk) UpdateFullName() *BookAuthorUpsertBulk

UpdateFullName sets the "full_name" field to the value that was provided on create.

func (*BookAuthorUpsertBulk) UpdateNewValues

func (u *BookAuthorUpsertBulk) UpdateNewValues() *BookAuthorUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.BookAuthor.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(bookauthor.FieldID)
		}),
	).
	Exec(ctx)

type BookAuthorUpsertOne

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

BookAuthorUpsertOne is the builder for "upsert"-ing

one BookAuthor node.

func (*BookAuthorUpsertOne) DoNothing

func (u *BookAuthorUpsertOne) DoNothing() *BookAuthorUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BookAuthorUpsertOne) Exec

Exec executes the query.

func (*BookAuthorUpsertOne) ExecX

func (u *BookAuthorUpsertOne) ExecX(ctx context.Context)

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

func (*BookAuthorUpsertOne) ID

func (u *BookAuthorUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*BookAuthorUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*BookAuthorUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.BookAuthor.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*BookAuthorUpsertOne) SetFullName

func (u *BookAuthorUpsertOne) SetFullName(v string) *BookAuthorUpsertOne

SetFullName sets the "full_name" field.

func (*BookAuthorUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the BookAuthorCreate.OnConflict documentation for more info.

func (*BookAuthorUpsertOne) UpdateFullName

func (u *BookAuthorUpsertOne) UpdateFullName() *BookAuthorUpsertOne

UpdateFullName sets the "full_name" field to the value that was provided on create.

func (*BookAuthorUpsertOne) UpdateNewValues

func (u *BookAuthorUpsertOne) UpdateNewValues() *BookAuthorUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.BookAuthor.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(bookauthor.FieldID)
		}),
	).
	Exec(ctx)

type BookAuthors

type BookAuthors []*BookAuthor

BookAuthors is a parsable slice of BookAuthor.

type BookClient

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

BookClient is a client for the Book schema.

func NewBookClient

func NewBookClient(c config) *BookClient

NewBookClient returns a client for the Book from the given config.

func (*BookClient) Create

func (c *BookClient) Create() *BookCreate

Create returns a builder for creating a Book entity.

func (*BookClient) CreateBulk

func (c *BookClient) CreateBulk(builders ...*BookCreate) *BookCreateBulk

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

func (*BookClient) Delete

func (c *BookClient) Delete() *BookDelete

Delete returns a delete builder for Book.

func (*BookClient) DeleteOne

func (c *BookClient) DeleteOne(b *Book) *BookDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BookClient) DeleteOneID

func (c *BookClient) DeleteOneID(id uuid.UUID) *BookDeleteOne

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

func (*BookClient) Get

func (c *BookClient) Get(ctx context.Context, id uuid.UUID) (*Book, error)

Get returns a Book entity by its id.

func (*BookClient) GetX

func (c *BookClient) GetX(ctx context.Context, id uuid.UUID) *Book

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

func (*BookClient) Hooks

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

Hooks returns the client hooks.

func (*BookClient) Intercept

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

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

func (*BookClient) Interceptors

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

Interceptors returns the client interceptors.

func (*BookClient) Query

func (c *BookClient) Query() *BookQuery

Query returns a query builder for Book.

func (*BookClient) QueryBookAuthor

func (c *BookClient) QueryBookAuthor(b *Book) *BookAuthorQuery

QueryBookAuthor queries the book_author edge of a Book.

func (*BookClient) Update

func (c *BookClient) Update() *BookUpdate

Update returns an update builder for Book.

func (*BookClient) UpdateOne

func (c *BookClient) UpdateOne(b *Book) *BookUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BookClient) UpdateOneID

func (c *BookClient) UpdateOneID(id uuid.UUID) *BookUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BookClient) Use

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

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

type BookCreate

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

BookCreate is the builder for creating a Book entity.

func (*BookCreate) AddBookAuthor

func (bc *BookCreate) AddBookAuthor(b ...*BookAuthor) *BookCreate

AddBookAuthor adds the "book_author" edges to the BookAuthor entity.

func (*BookCreate) AddBookAuthorIDs

func (bc *BookCreate) AddBookAuthorIDs(ids ...uuid.UUID) *BookCreate

AddBookAuthorIDs adds the "book_author" edge to the BookAuthor entity by IDs.

func (*BookCreate) Exec

func (bc *BookCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookCreate) ExecX

func (bc *BookCreate) ExecX(ctx context.Context)

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

func (*BookCreate) Mutation

func (bc *BookCreate) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookCreate) OnConflict

func (bc *BookCreate) OnConflict(opts ...sql.ConflictOption) *BookUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Book.Create().
	SetTitle(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BookUpsert) {
		SetTitle(v+v).
	}).
	Exec(ctx)

func (*BookCreate) OnConflictColumns

func (bc *BookCreate) OnConflictColumns(columns ...string) *BookUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Book.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BookCreate) Save

func (bc *BookCreate) Save(ctx context.Context) (*Book, error)

Save creates the Book in the database.

func (*BookCreate) SaveX

func (bc *BookCreate) SaveX(ctx context.Context) *Book

SaveX calls Save and panics if Save returns an error.

func (*BookCreate) SetDescription

func (bc *BookCreate) SetDescription(s string) *BookCreate

SetDescription sets the "description" field.

func (*BookCreate) SetGoodreadsID

func (bc *BookCreate) SetGoodreadsID(s string) *BookCreate

SetGoodreadsID sets the "goodreads_id" field.

func (*BookCreate) SetGoogleVolumeID

func (bc *BookCreate) SetGoogleVolumeID(s string) *BookCreate

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookCreate) SetID

func (bc *BookCreate) SetID(u uuid.UUID) *BookCreate

SetID sets the "id" field.

func (*BookCreate) SetIsbn10

func (bc *BookCreate) SetIsbn10(s string) *BookCreate

SetIsbn10 sets the "isbn_10" field.

func (*BookCreate) SetIsbn13

func (bc *BookCreate) SetIsbn13(s string) *BookCreate

SetIsbn13 sets the "isbn_13" field.

func (*BookCreate) SetTitle

func (bc *BookCreate) SetTitle(s string) *BookCreate

SetTitle sets the "title" field.

type BookCreateBulk

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

BookCreateBulk is the builder for creating many Book entities in bulk.

func (*BookCreateBulk) Exec

func (bcb *BookCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BookCreateBulk) ExecX

func (bcb *BookCreateBulk) ExecX(ctx context.Context)

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

func (*BookCreateBulk) OnConflict

func (bcb *BookCreateBulk) OnConflict(opts ...sql.ConflictOption) *BookUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Book.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.BookUpsert) {
		SetTitle(v+v).
	}).
	Exec(ctx)

func (*BookCreateBulk) OnConflictColumns

func (bcb *BookCreateBulk) OnConflictColumns(columns ...string) *BookUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Book.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*BookCreateBulk) Save

func (bcb *BookCreateBulk) Save(ctx context.Context) ([]*Book, error)

Save creates the Book entities in the database.

func (*BookCreateBulk) SaveX

func (bcb *BookCreateBulk) SaveX(ctx context.Context) []*Book

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

type BookDelete

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

BookDelete is the builder for deleting a Book entity.

func (*BookDelete) Exec

func (bd *BookDelete) Exec(ctx context.Context) (int, error)

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

func (*BookDelete) ExecX

func (bd *BookDelete) ExecX(ctx context.Context) int

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

func (*BookDelete) Where

func (bd *BookDelete) Where(ps ...predicate.Book) *BookDelete

Where appends a list predicates to the BookDelete builder.

type BookDeleteOne

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

BookDeleteOne is the builder for deleting a single Book entity.

func (*BookDeleteOne) Exec

func (bdo *BookDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BookDeleteOne) ExecX

func (bdo *BookDeleteOne) ExecX(ctx context.Context)

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

func (*BookDeleteOne) Where

func (bdo *BookDeleteOne) Where(ps ...predicate.Book) *BookDeleteOne

Where appends a list predicates to the BookDelete builder.

type BookEdges

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

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

func (BookEdges) BookAuthorOrErr

func (e BookEdges) BookAuthorOrErr() ([]*BookAuthor, error)

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

type BookGroupBy

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

BookGroupBy is the group-by builder for Book entities.

func (*BookGroupBy) Aggregate

func (bgb *BookGroupBy) Aggregate(fns ...AggregateFunc) *BookGroupBy

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

func (*BookGroupBy) Bool

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

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

func (*BookGroupBy) BoolX

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

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

func (*BookGroupBy) Bools

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

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

func (*BookGroupBy) BoolsX

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

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

func (*BookGroupBy) Float64

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

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

func (*BookGroupBy) Float64X

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

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

func (*BookGroupBy) Float64s

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

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

func (*BookGroupBy) Float64sX

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

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

func (*BookGroupBy) Int

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

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

func (*BookGroupBy) IntX

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

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

func (*BookGroupBy) Ints

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

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

func (*BookGroupBy) IntsX

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

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

func (*BookGroupBy) Scan

func (bgb *BookGroupBy) Scan(ctx context.Context, v any) error

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

func (*BookGroupBy) ScanX

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

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

func (*BookGroupBy) String

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

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

func (*BookGroupBy) StringX

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

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

func (*BookGroupBy) Strings

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

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

func (*BookGroupBy) StringsX

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

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

type BookMutation

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

BookMutation represents an operation that mutates the Book nodes in the graph.

func (*BookMutation) AddBookAuthorIDs

func (m *BookMutation) AddBookAuthorIDs(ids ...uuid.UUID)

AddBookAuthorIDs adds the "book_author" edge to the BookAuthor entity by ids.

func (*BookMutation) AddField

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

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

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

func (*BookMutation) AddedField

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

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

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

func (*BookMutation) AddedIDs

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

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

func (*BookMutation) BookAuthorCleared

func (m *BookMutation) BookAuthorCleared() bool

BookAuthorCleared reports if the "book_author" edge to the BookAuthor entity was cleared.

func (*BookMutation) BookAuthorIDs

func (m *BookMutation) BookAuthorIDs() (ids []uuid.UUID)

BookAuthorIDs returns the "book_author" edge IDs in the mutation.

func (*BookMutation) ClearBookAuthor

func (m *BookMutation) ClearBookAuthor()

ClearBookAuthor clears the "book_author" edge to the BookAuthor entity.

func (*BookMutation) ClearEdge

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

func (m *BookMutation) 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 (*BookMutation) ClearedEdges

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

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

func (*BookMutation) ClearedFields

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

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

func (BookMutation) Client

func (m BookMutation) 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 (*BookMutation) Description

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

Description returns the value of the "description" field in the mutation.

func (*BookMutation) EdgeCleared

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

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

func (*BookMutation) Field

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

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

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

func (*BookMutation) Fields

func (m *BookMutation) 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 (*BookMutation) GoodreadsID

func (m *BookMutation) GoodreadsID() (r string, exists bool)

GoodreadsID returns the value of the "goodreads_id" field in the mutation.

func (*BookMutation) GoogleVolumeID

func (m *BookMutation) GoogleVolumeID() (r string, exists bool)

GoogleVolumeID returns the value of the "google_volume_id" field in the mutation.

func (*BookMutation) ID

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

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

func (*BookMutation) IDs

func (m *BookMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*BookMutation) Isbn10

func (m *BookMutation) Isbn10() (r string, exists bool)

Isbn10 returns the value of the "isbn_10" field in the mutation.

func (*BookMutation) Isbn13

func (m *BookMutation) Isbn13() (r string, exists bool)

Isbn13 returns the value of the "isbn_13" field in the mutation.

func (*BookMutation) OldDescription

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

OldDescription returns the old "description" field's value of the Book entity. If the Book 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 (*BookMutation) OldField

func (m *BookMutation) 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 (*BookMutation) OldGoodreadsID

func (m *BookMutation) OldGoodreadsID(ctx context.Context) (v string, err error)

OldGoodreadsID returns the old "goodreads_id" field's value of the Book entity. If the Book 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 (*BookMutation) OldGoogleVolumeID

func (m *BookMutation) OldGoogleVolumeID(ctx context.Context) (v string, err error)

OldGoogleVolumeID returns the old "google_volume_id" field's value of the Book entity. If the Book 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 (*BookMutation) OldIsbn10

func (m *BookMutation) OldIsbn10(ctx context.Context) (v string, err error)

OldIsbn10 returns the old "isbn_10" field's value of the Book entity. If the Book 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 (*BookMutation) OldIsbn13

func (m *BookMutation) OldIsbn13(ctx context.Context) (v string, err error)

OldIsbn13 returns the old "isbn_13" field's value of the Book entity. If the Book 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 (*BookMutation) OldTitle

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

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

func (m *BookMutation) Op() Op

Op returns the operation name.

func (*BookMutation) RemoveBookAuthorIDs

func (m *BookMutation) RemoveBookAuthorIDs(ids ...uuid.UUID)

RemoveBookAuthorIDs removes the "book_author" edge to the BookAuthor entity by IDs.

func (*BookMutation) RemovedBookAuthorIDs

func (m *BookMutation) RemovedBookAuthorIDs() (ids []uuid.UUID)

RemovedBookAuthor returns the removed IDs of the "book_author" edge to the BookAuthor entity.

func (*BookMutation) RemovedEdges

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

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

func (*BookMutation) RemovedIDs

func (m *BookMutation) 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 (*BookMutation) ResetBookAuthor

func (m *BookMutation) ResetBookAuthor()

ResetBookAuthor resets all changes to the "book_author" edge.

func (*BookMutation) ResetDescription

func (m *BookMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*BookMutation) ResetEdge

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

func (m *BookMutation) 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 (*BookMutation) ResetGoodreadsID

func (m *BookMutation) ResetGoodreadsID()

ResetGoodreadsID resets all changes to the "goodreads_id" field.

func (*BookMutation) ResetGoogleVolumeID

func (m *BookMutation) ResetGoogleVolumeID()

ResetGoogleVolumeID resets all changes to the "google_volume_id" field.

func (*BookMutation) ResetIsbn10

func (m *BookMutation) ResetIsbn10()

ResetIsbn10 resets all changes to the "isbn_10" field.

func (*BookMutation) ResetIsbn13

func (m *BookMutation) ResetIsbn13()

ResetIsbn13 resets all changes to the "isbn_13" field.

func (*BookMutation) ResetTitle

func (m *BookMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*BookMutation) SetDescription

func (m *BookMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*BookMutation) SetField

func (m *BookMutation) 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 (*BookMutation) SetGoodreadsID

func (m *BookMutation) SetGoodreadsID(s string)

SetGoodreadsID sets the "goodreads_id" field.

func (*BookMutation) SetGoogleVolumeID

func (m *BookMutation) SetGoogleVolumeID(s string)

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookMutation) SetID

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

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

func (*BookMutation) SetIsbn10

func (m *BookMutation) SetIsbn10(s string)

SetIsbn10 sets the "isbn_10" field.

func (*BookMutation) SetIsbn13

func (m *BookMutation) SetIsbn13(s string)

SetIsbn13 sets the "isbn_13" field.

func (*BookMutation) SetOp

func (m *BookMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BookMutation) SetTitle

func (m *BookMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*BookMutation) Title

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

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

func (BookMutation) Tx

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

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

func (*BookMutation) Type

func (m *BookMutation) Type() string

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

func (*BookMutation) Where

func (m *BookMutation) Where(ps ...predicate.Book)

Where appends a list predicates to the BookMutation builder.

func (*BookMutation) WhereP

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

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

type BookQuery

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

BookQuery is the builder for querying Book entities.

func (*BookQuery) Aggregate

func (bq *BookQuery) Aggregate(fns ...AggregateFunc) *BookSelect

Aggregate returns a BookSelect configured with the given aggregations.

func (*BookQuery) All

func (bq *BookQuery) All(ctx context.Context) ([]*Book, error)

All executes the query and returns a list of Books.

func (*BookQuery) AllX

func (bq *BookQuery) AllX(ctx context.Context) []*Book

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

func (*BookQuery) Clone

func (bq *BookQuery) Clone() *BookQuery

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

func (*BookQuery) Count

func (bq *BookQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BookQuery) CountX

func (bq *BookQuery) CountX(ctx context.Context) int

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

func (*BookQuery) Exist

func (bq *BookQuery) Exist(ctx context.Context) (bool, error)

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

func (*BookQuery) ExistX

func (bq *BookQuery) ExistX(ctx context.Context) bool

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

func (*BookQuery) First

func (bq *BookQuery) First(ctx context.Context) (*Book, error)

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

func (*BookQuery) FirstID

func (bq *BookQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BookQuery) FirstIDX

func (bq *BookQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*BookQuery) FirstX

func (bq *BookQuery) FirstX(ctx context.Context) *Book

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

func (*BookQuery) ForShare

func (bq *BookQuery) ForShare(opts ...sql.LockOption) *BookQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*BookQuery) ForUpdate

func (bq *BookQuery) ForUpdate(opts ...sql.LockOption) *BookQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*BookQuery) GroupBy

func (bq *BookQuery) GroupBy(field string, fields ...string) *BookGroupBy

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

client.Book.Query().
	GroupBy(book.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BookQuery) IDs

func (bq *BookQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*BookQuery) IDsX

func (bq *BookQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*BookQuery) Limit

func (bq *BookQuery) Limit(limit int) *BookQuery

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

func (*BookQuery) Offset

func (bq *BookQuery) Offset(offset int) *BookQuery

Offset to start from.

func (*BookQuery) Only

func (bq *BookQuery) Only(ctx context.Context) (*Book, error)

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

func (*BookQuery) OnlyID

func (bq *BookQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*BookQuery) OnlyIDX

func (bq *BookQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*BookQuery) OnlyX

func (bq *BookQuery) OnlyX(ctx context.Context) *Book

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

func (*BookQuery) Order

func (bq *BookQuery) Order(o ...book.OrderOption) *BookQuery

Order specifies how the records should be ordered.

func (*BookQuery) QueryBookAuthor

func (bq *BookQuery) QueryBookAuthor() *BookAuthorQuery

QueryBookAuthor chains the current query on the "book_author" edge.

func (*BookQuery) Select

func (bq *BookQuery) Select(fields ...string) *BookSelect

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

client.Book.Query().
	Select(book.FieldTitle).
	Scan(ctx, &v)

func (*BookQuery) Unique

func (bq *BookQuery) Unique(unique bool) *BookQuery

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

func (bq *BookQuery) Where(ps ...predicate.Book) *BookQuery

Where adds a new predicate for the BookQuery builder.

func (*BookQuery) WithBookAuthor

func (bq *BookQuery) WithBookAuthor(opts ...func(*BookAuthorQuery)) *BookQuery

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

func (*BookQuery) WithNamedBookAuthor

func (bq *BookQuery) WithNamedBookAuthor(name string, opts ...func(*BookAuthorQuery)) *BookQuery

WithNamedBookAuthor tells the query-builder to eager-load the nodes that are connected to the "book_author" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type BookSelect

type BookSelect struct {
	*BookQuery
	// contains filtered or unexported fields
}

BookSelect is the builder for selecting fields of Book entities.

func (*BookSelect) Aggregate

func (bs *BookSelect) Aggregate(fns ...AggregateFunc) *BookSelect

Aggregate adds the given aggregation functions to the selector query.

func (*BookSelect) Bool

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

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

func (*BookSelect) BoolX

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

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

func (*BookSelect) Bools

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

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

func (*BookSelect) BoolsX

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

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

func (*BookSelect) Float64

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

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

func (*BookSelect) Float64X

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

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

func (*BookSelect) Float64s

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

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

func (*BookSelect) Float64sX

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

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

func (*BookSelect) Int

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

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

func (*BookSelect) IntX

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

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

func (*BookSelect) Ints

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

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

func (*BookSelect) IntsX

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

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

func (*BookSelect) Scan

func (bs *BookSelect) Scan(ctx context.Context, v any) error

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

func (*BookSelect) ScanX

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

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

func (*BookSelect) String

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

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

func (*BookSelect) StringX

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

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

func (*BookSelect) Strings

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

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

func (*BookSelect) StringsX

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

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

type BookUpdate

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

BookUpdate is the builder for updating Book entities.

func (*BookUpdate) AddBookAuthor

func (bu *BookUpdate) AddBookAuthor(b ...*BookAuthor) *BookUpdate

AddBookAuthor adds the "book_author" edges to the BookAuthor entity.

func (*BookUpdate) AddBookAuthorIDs

func (bu *BookUpdate) AddBookAuthorIDs(ids ...uuid.UUID) *BookUpdate

AddBookAuthorIDs adds the "book_author" edge to the BookAuthor entity by IDs.

func (*BookUpdate) ClearBookAuthor

func (bu *BookUpdate) ClearBookAuthor() *BookUpdate

ClearBookAuthor clears all "book_author" edges to the BookAuthor entity.

func (*BookUpdate) Exec

func (bu *BookUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookUpdate) ExecX

func (bu *BookUpdate) ExecX(ctx context.Context)

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

func (*BookUpdate) Mutation

func (bu *BookUpdate) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookUpdate) RemoveBookAuthor

func (bu *BookUpdate) RemoveBookAuthor(b ...*BookAuthor) *BookUpdate

RemoveBookAuthor removes "book_author" edges to BookAuthor entities.

func (*BookUpdate) RemoveBookAuthorIDs

func (bu *BookUpdate) RemoveBookAuthorIDs(ids ...uuid.UUID) *BookUpdate

RemoveBookAuthorIDs removes the "book_author" edge to BookAuthor entities by IDs.

func (*BookUpdate) Save

func (bu *BookUpdate) Save(ctx context.Context) (int, error)

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

func (*BookUpdate) SaveX

func (bu *BookUpdate) SaveX(ctx context.Context) int

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

func (*BookUpdate) SetDescription

func (bu *BookUpdate) SetDescription(s string) *BookUpdate

SetDescription sets the "description" field.

func (*BookUpdate) SetGoodreadsID

func (bu *BookUpdate) SetGoodreadsID(s string) *BookUpdate

SetGoodreadsID sets the "goodreads_id" field.

func (*BookUpdate) SetGoogleVolumeID

func (bu *BookUpdate) SetGoogleVolumeID(s string) *BookUpdate

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookUpdate) SetIsbn10

func (bu *BookUpdate) SetIsbn10(s string) *BookUpdate

SetIsbn10 sets the "isbn_10" field.

func (*BookUpdate) SetIsbn13

func (bu *BookUpdate) SetIsbn13(s string) *BookUpdate

SetIsbn13 sets the "isbn_13" field.

func (*BookUpdate) SetTitle

func (bu *BookUpdate) SetTitle(s string) *BookUpdate

SetTitle sets the "title" field.

func (*BookUpdate) Where

func (bu *BookUpdate) Where(ps ...predicate.Book) *BookUpdate

Where appends a list predicates to the BookUpdate builder.

type BookUpdateOne

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

BookUpdateOne is the builder for updating a single Book entity.

func (*BookUpdateOne) AddBookAuthor

func (buo *BookUpdateOne) AddBookAuthor(b ...*BookAuthor) *BookUpdateOne

AddBookAuthor adds the "book_author" edges to the BookAuthor entity.

func (*BookUpdateOne) AddBookAuthorIDs

func (buo *BookUpdateOne) AddBookAuthorIDs(ids ...uuid.UUID) *BookUpdateOne

AddBookAuthorIDs adds the "book_author" edge to the BookAuthor entity by IDs.

func (*BookUpdateOne) ClearBookAuthor

func (buo *BookUpdateOne) ClearBookAuthor() *BookUpdateOne

ClearBookAuthor clears all "book_author" edges to the BookAuthor entity.

func (*BookUpdateOne) Exec

func (buo *BookUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BookUpdateOne) ExecX

func (buo *BookUpdateOne) ExecX(ctx context.Context)

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

func (*BookUpdateOne) Mutation

func (buo *BookUpdateOne) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookUpdateOne) RemoveBookAuthor

func (buo *BookUpdateOne) RemoveBookAuthor(b ...*BookAuthor) *BookUpdateOne

RemoveBookAuthor removes "book_author" edges to BookAuthor entities.

func (*BookUpdateOne) RemoveBookAuthorIDs

func (buo *BookUpdateOne) RemoveBookAuthorIDs(ids ...uuid.UUID) *BookUpdateOne

RemoveBookAuthorIDs removes the "book_author" edge to BookAuthor entities by IDs.

func (*BookUpdateOne) Save

func (buo *BookUpdateOne) Save(ctx context.Context) (*Book, error)

Save executes the query and returns the updated Book entity.

func (*BookUpdateOne) SaveX

func (buo *BookUpdateOne) SaveX(ctx context.Context) *Book

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

func (*BookUpdateOne) Select

func (buo *BookUpdateOne) Select(field string, fields ...string) *BookUpdateOne

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

func (*BookUpdateOne) SetDescription

func (buo *BookUpdateOne) SetDescription(s string) *BookUpdateOne

SetDescription sets the "description" field.

func (*BookUpdateOne) SetGoodreadsID

func (buo *BookUpdateOne) SetGoodreadsID(s string) *BookUpdateOne

SetGoodreadsID sets the "goodreads_id" field.

func (*BookUpdateOne) SetGoogleVolumeID

func (buo *BookUpdateOne) SetGoogleVolumeID(s string) *BookUpdateOne

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookUpdateOne) SetIsbn10

func (buo *BookUpdateOne) SetIsbn10(s string) *BookUpdateOne

SetIsbn10 sets the "isbn_10" field.

func (*BookUpdateOne) SetIsbn13

func (buo *BookUpdateOne) SetIsbn13(s string) *BookUpdateOne

SetIsbn13 sets the "isbn_13" field.

func (*BookUpdateOne) SetTitle

func (buo *BookUpdateOne) SetTitle(s string) *BookUpdateOne

SetTitle sets the "title" field.

func (*BookUpdateOne) Where

func (buo *BookUpdateOne) Where(ps ...predicate.Book) *BookUpdateOne

Where appends a list predicates to the BookUpdate builder.

type BookUpsert

type BookUpsert struct {
	*sql.UpdateSet
}

BookUpsert is the "OnConflict" setter.

func (*BookUpsert) SetDescription

func (u *BookUpsert) SetDescription(v string) *BookUpsert

SetDescription sets the "description" field.

func (*BookUpsert) SetGoodreadsID

func (u *BookUpsert) SetGoodreadsID(v string) *BookUpsert

SetGoodreadsID sets the "goodreads_id" field.

func (*BookUpsert) SetGoogleVolumeID

func (u *BookUpsert) SetGoogleVolumeID(v string) *BookUpsert

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookUpsert) SetIsbn10

func (u *BookUpsert) SetIsbn10(v string) *BookUpsert

SetIsbn10 sets the "isbn_10" field.

func (*BookUpsert) SetIsbn13

func (u *BookUpsert) SetIsbn13(v string) *BookUpsert

SetIsbn13 sets the "isbn_13" field.

func (*BookUpsert) SetTitle

func (u *BookUpsert) SetTitle(v string) *BookUpsert

SetTitle sets the "title" field.

func (*BookUpsert) UpdateDescription

func (u *BookUpsert) UpdateDescription() *BookUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*BookUpsert) UpdateGoodreadsID

func (u *BookUpsert) UpdateGoodreadsID() *BookUpsert

UpdateGoodreadsID sets the "goodreads_id" field to the value that was provided on create.

func (*BookUpsert) UpdateGoogleVolumeID

func (u *BookUpsert) UpdateGoogleVolumeID() *BookUpsert

UpdateGoogleVolumeID sets the "google_volume_id" field to the value that was provided on create.

func (*BookUpsert) UpdateIsbn10

func (u *BookUpsert) UpdateIsbn10() *BookUpsert

UpdateIsbn10 sets the "isbn_10" field to the value that was provided on create.

func (*BookUpsert) UpdateIsbn13

func (u *BookUpsert) UpdateIsbn13() *BookUpsert

UpdateIsbn13 sets the "isbn_13" field to the value that was provided on create.

func (*BookUpsert) UpdateTitle

func (u *BookUpsert) UpdateTitle() *BookUpsert

UpdateTitle sets the "title" field to the value that was provided on create.

type BookUpsertBulk

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

BookUpsertBulk is the builder for "upsert"-ing a bulk of Book nodes.

func (*BookUpsertBulk) DoNothing

func (u *BookUpsertBulk) DoNothing() *BookUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BookUpsertBulk) Exec

func (u *BookUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BookUpsertBulk) ExecX

func (u *BookUpsertBulk) ExecX(ctx context.Context)

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

func (*BookUpsertBulk) Ignore

func (u *BookUpsertBulk) Ignore() *BookUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Book.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*BookUpsertBulk) SetDescription

func (u *BookUpsertBulk) SetDescription(v string) *BookUpsertBulk

SetDescription sets the "description" field.

func (*BookUpsertBulk) SetGoodreadsID

func (u *BookUpsertBulk) SetGoodreadsID(v string) *BookUpsertBulk

SetGoodreadsID sets the "goodreads_id" field.

func (*BookUpsertBulk) SetGoogleVolumeID

func (u *BookUpsertBulk) SetGoogleVolumeID(v string) *BookUpsertBulk

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookUpsertBulk) SetIsbn10

func (u *BookUpsertBulk) SetIsbn10(v string) *BookUpsertBulk

SetIsbn10 sets the "isbn_10" field.

func (*BookUpsertBulk) SetIsbn13

func (u *BookUpsertBulk) SetIsbn13(v string) *BookUpsertBulk

SetIsbn13 sets the "isbn_13" field.

func (*BookUpsertBulk) SetTitle

func (u *BookUpsertBulk) SetTitle(v string) *BookUpsertBulk

SetTitle sets the "title" field.

func (*BookUpsertBulk) Update

func (u *BookUpsertBulk) Update(set func(*BookUpsert)) *BookUpsertBulk

Update allows overriding fields `UPDATE` values. See the BookCreateBulk.OnConflict documentation for more info.

func (*BookUpsertBulk) UpdateDescription

func (u *BookUpsertBulk) UpdateDescription() *BookUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*BookUpsertBulk) UpdateGoodreadsID

func (u *BookUpsertBulk) UpdateGoodreadsID() *BookUpsertBulk

UpdateGoodreadsID sets the "goodreads_id" field to the value that was provided on create.

func (*BookUpsertBulk) UpdateGoogleVolumeID

func (u *BookUpsertBulk) UpdateGoogleVolumeID() *BookUpsertBulk

UpdateGoogleVolumeID sets the "google_volume_id" field to the value that was provided on create.

func (*BookUpsertBulk) UpdateIsbn10

func (u *BookUpsertBulk) UpdateIsbn10() *BookUpsertBulk

UpdateIsbn10 sets the "isbn_10" field to the value that was provided on create.

func (*BookUpsertBulk) UpdateIsbn13

func (u *BookUpsertBulk) UpdateIsbn13() *BookUpsertBulk

UpdateIsbn13 sets the "isbn_13" field to the value that was provided on create.

func (*BookUpsertBulk) UpdateNewValues

func (u *BookUpsertBulk) UpdateNewValues() *BookUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Book.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(book.FieldID)
		}),
	).
	Exec(ctx)

func (*BookUpsertBulk) UpdateTitle

func (u *BookUpsertBulk) UpdateTitle() *BookUpsertBulk

UpdateTitle sets the "title" field to the value that was provided on create.

type BookUpsertOne

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

BookUpsertOne is the builder for "upsert"-ing

one Book node.

func (*BookUpsertOne) DoNothing

func (u *BookUpsertOne) DoNothing() *BookUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*BookUpsertOne) Exec

func (u *BookUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*BookUpsertOne) ExecX

func (u *BookUpsertOne) ExecX(ctx context.Context)

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

func (*BookUpsertOne) ID

func (u *BookUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*BookUpsertOne) IDX

func (u *BookUpsertOne) IDX(ctx context.Context) uuid.UUID

IDX is like ID, but panics if an error occurs.

func (*BookUpsertOne) Ignore

func (u *BookUpsertOne) Ignore() *BookUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Book.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*BookUpsertOne) SetDescription

func (u *BookUpsertOne) SetDescription(v string) *BookUpsertOne

SetDescription sets the "description" field.

func (*BookUpsertOne) SetGoodreadsID

func (u *BookUpsertOne) SetGoodreadsID(v string) *BookUpsertOne

SetGoodreadsID sets the "goodreads_id" field.

func (*BookUpsertOne) SetGoogleVolumeID

func (u *BookUpsertOne) SetGoogleVolumeID(v string) *BookUpsertOne

SetGoogleVolumeID sets the "google_volume_id" field.

func (*BookUpsertOne) SetIsbn10

func (u *BookUpsertOne) SetIsbn10(v string) *BookUpsertOne

SetIsbn10 sets the "isbn_10" field.

func (*BookUpsertOne) SetIsbn13

func (u *BookUpsertOne) SetIsbn13(v string) *BookUpsertOne

SetIsbn13 sets the "isbn_13" field.

func (*BookUpsertOne) SetTitle

func (u *BookUpsertOne) SetTitle(v string) *BookUpsertOne

SetTitle sets the "title" field.

func (*BookUpsertOne) Update

func (u *BookUpsertOne) Update(set func(*BookUpsert)) *BookUpsertOne

Update allows overriding fields `UPDATE` values. See the BookCreate.OnConflict documentation for more info.

func (*BookUpsertOne) UpdateDescription

func (u *BookUpsertOne) UpdateDescription() *BookUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*BookUpsertOne) UpdateGoodreadsID

func (u *BookUpsertOne) UpdateGoodreadsID() *BookUpsertOne

UpdateGoodreadsID sets the "goodreads_id" field to the value that was provided on create.

func (*BookUpsertOne) UpdateGoogleVolumeID

func (u *BookUpsertOne) UpdateGoogleVolumeID() *BookUpsertOne

UpdateGoogleVolumeID sets the "google_volume_id" field to the value that was provided on create.

func (*BookUpsertOne) UpdateIsbn10

func (u *BookUpsertOne) UpdateIsbn10() *BookUpsertOne

UpdateIsbn10 sets the "isbn_10" field to the value that was provided on create.

func (*BookUpsertOne) UpdateIsbn13

func (u *BookUpsertOne) UpdateIsbn13() *BookUpsertOne

UpdateIsbn13 sets the "isbn_13" field to the value that was provided on create.

func (*BookUpsertOne) UpdateNewValues

func (u *BookUpsertOne) UpdateNewValues() *BookUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Book.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(book.FieldID)
		}),
	).
	Exec(ctx)

func (*BookUpsertOne) UpdateTitle

func (u *BookUpsertOne) UpdateTitle() *BookUpsertOne

UpdateTitle sets the "title" field to the value that was provided on create.

type Books

type Books []*Book

Books is a parsable slice of Book.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Book is the client for interacting with the Book builders.
	Book *BookClient
	// BookAuthor is the client for interacting with the BookAuthor builders.
	BookAuthor *BookAuthorClient
	// DiscordMessage is the client for interacting with the DiscordMessage builders.
	DiscordMessage *DiscordMessageClient
	// DiscordUser is the client for interacting with the DiscordUser builders.
	DiscordUser *DiscordUserClient
	// 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().
	Book.
	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 DiscordMessage

type DiscordMessage struct {

	// ID of the ent.
	ID string `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Raw holds the value of the "raw" field.
	Raw discordgo.Message `json:"raw,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DiscordMessageQuery when eager-loading is set.
	Edges DiscordMessageEdges `json:"edges"`
	// contains filtered or unexported fields
}

DiscordMessage is the model entity for the DiscordMessage schema.

func (*DiscordMessage) NamedAuthor

func (dm *DiscordMessage) NamedAuthor(name string) ([]*DiscordUser, error)

NamedAuthor returns the Author named value or an error if the edge was not loaded in eager-loading with this name.

func (*DiscordMessage) QueryAuthor

func (dm *DiscordMessage) QueryAuthor() *DiscordUserQuery

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

func (*DiscordMessage) String

func (dm *DiscordMessage) String() string

String implements the fmt.Stringer.

func (*DiscordMessage) Unwrap

func (dm *DiscordMessage) Unwrap() *DiscordMessage

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

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

func (*DiscordMessage) Value

func (dm *DiscordMessage) Value(name string) (ent.Value, error)

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

type DiscordMessageClient

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

DiscordMessageClient is a client for the DiscordMessage schema.

func NewDiscordMessageClient

func NewDiscordMessageClient(c config) *DiscordMessageClient

NewDiscordMessageClient returns a client for the DiscordMessage from the given config.

func (*DiscordMessageClient) Create

Create returns a builder for creating a DiscordMessage entity.

func (*DiscordMessageClient) CreateBulk

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

func (*DiscordMessageClient) Delete

Delete returns a delete builder for DiscordMessage.

func (*DiscordMessageClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DiscordMessageClient) DeleteOneID

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

func (*DiscordMessageClient) Get

Get returns a DiscordMessage entity by its id.

func (*DiscordMessageClient) GetX

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

func (*DiscordMessageClient) Hooks

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

Hooks returns the client hooks.

func (*DiscordMessageClient) Intercept

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

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

func (*DiscordMessageClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DiscordMessageClient) Query

Query returns a query builder for DiscordMessage.

func (*DiscordMessageClient) QueryAuthor

QueryAuthor queries the author edge of a DiscordMessage.

func (*DiscordMessageClient) Update

Update returns an update builder for DiscordMessage.

func (*DiscordMessageClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*DiscordMessageClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*DiscordMessageClient) Use

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

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

type DiscordMessageCreate

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

DiscordMessageCreate is the builder for creating a DiscordMessage entity.

func (*DiscordMessageCreate) AddAuthor

func (dmc *DiscordMessageCreate) AddAuthor(d ...*DiscordUser) *DiscordMessageCreate

AddAuthor adds the "author" edges to the DiscordUser entity.

func (*DiscordMessageCreate) AddAuthorIDs

func (dmc *DiscordMessageCreate) AddAuthorIDs(ids ...uuid.UUID) *DiscordMessageCreate

AddAuthorIDs adds the "author" edge to the DiscordUser entity by IDs.

func (*DiscordMessageCreate) Exec

func (dmc *DiscordMessageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiscordMessageCreate) ExecX

func (dmc *DiscordMessageCreate) ExecX(ctx context.Context)

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

func (*DiscordMessageCreate) Mutation

Mutation returns the DiscordMessageMutation object of the builder.

func (*DiscordMessageCreate) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.DiscordMessage.Create().
	SetCreateTime(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DiscordMessageUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*DiscordMessageCreate) OnConflictColumns

func (dmc *DiscordMessageCreate) OnConflictColumns(columns ...string) *DiscordMessageUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.DiscordMessage.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DiscordMessageCreate) Save

Save creates the DiscordMessage in the database.

func (*DiscordMessageCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*DiscordMessageCreate) SetCreateTime

func (dmc *DiscordMessageCreate) SetCreateTime(t time.Time) *DiscordMessageCreate

SetCreateTime sets the "create_time" field.

func (*DiscordMessageCreate) SetID

SetID sets the "id" field.

func (*DiscordMessageCreate) SetNillableCreateTime

func (dmc *DiscordMessageCreate) SetNillableCreateTime(t *time.Time) *DiscordMessageCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*DiscordMessageCreate) SetNillableUpdateTime

func (dmc *DiscordMessageCreate) SetNillableUpdateTime(t *time.Time) *DiscordMessageCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*DiscordMessageCreate) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageCreate) SetUpdateTime

func (dmc *DiscordMessageCreate) SetUpdateTime(t time.Time) *DiscordMessageCreate

SetUpdateTime sets the "update_time" field.

type DiscordMessageCreateBulk

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

DiscordMessageCreateBulk is the builder for creating many DiscordMessage entities in bulk.

func (*DiscordMessageCreateBulk) Exec

Exec executes the query.

func (*DiscordMessageCreateBulk) ExecX

func (dmcb *DiscordMessageCreateBulk) ExecX(ctx context.Context)

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

func (*DiscordMessageCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.DiscordMessage.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DiscordMessageUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*DiscordMessageCreateBulk) OnConflictColumns

func (dmcb *DiscordMessageCreateBulk) OnConflictColumns(columns ...string) *DiscordMessageUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.DiscordMessage.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DiscordMessageCreateBulk) Save

Save creates the DiscordMessage entities in the database.

func (*DiscordMessageCreateBulk) SaveX

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

type DiscordMessageDelete

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

DiscordMessageDelete is the builder for deleting a DiscordMessage entity.

func (*DiscordMessageDelete) Exec

func (dmd *DiscordMessageDelete) Exec(ctx context.Context) (int, error)

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

func (*DiscordMessageDelete) ExecX

func (dmd *DiscordMessageDelete) ExecX(ctx context.Context) int

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

func (*DiscordMessageDelete) Where

Where appends a list predicates to the DiscordMessageDelete builder.

type DiscordMessageDeleteOne

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

DiscordMessageDeleteOne is the builder for deleting a single DiscordMessage entity.

func (*DiscordMessageDeleteOne) Exec

func (dmdo *DiscordMessageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DiscordMessageDeleteOne) ExecX

func (dmdo *DiscordMessageDeleteOne) ExecX(ctx context.Context)

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

func (*DiscordMessageDeleteOne) Where

Where appends a list predicates to the DiscordMessageDelete builder.

type DiscordMessageEdges

type DiscordMessageEdges struct {
	// Author holds the value of the author edge.
	Author []*DiscordUser `json:"author,omitempty"`
	// contains filtered or unexported fields
}

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

func (DiscordMessageEdges) AuthorOrErr

func (e DiscordMessageEdges) AuthorOrErr() ([]*DiscordUser, error)

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

type DiscordMessageGroupBy

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

DiscordMessageGroupBy is the group-by builder for DiscordMessage entities.

func (*DiscordMessageGroupBy) Aggregate

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

func (*DiscordMessageGroupBy) Bool

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

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

func (*DiscordMessageGroupBy) BoolX

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

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

func (*DiscordMessageGroupBy) Bools

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

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

func (*DiscordMessageGroupBy) BoolsX

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

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

func (*DiscordMessageGroupBy) Float64

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

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

func (*DiscordMessageGroupBy) Float64X

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

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

func (*DiscordMessageGroupBy) Float64s

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

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

func (*DiscordMessageGroupBy) Float64sX

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

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

func (*DiscordMessageGroupBy) Int

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

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

func (*DiscordMessageGroupBy) IntX

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

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

func (*DiscordMessageGroupBy) Ints

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

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

func (*DiscordMessageGroupBy) IntsX

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

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

func (*DiscordMessageGroupBy) Scan

func (dmgb *DiscordMessageGroupBy) Scan(ctx context.Context, v any) error

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

func (*DiscordMessageGroupBy) ScanX

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

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

func (*DiscordMessageGroupBy) String

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

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

func (*DiscordMessageGroupBy) StringX

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

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

func (*DiscordMessageGroupBy) Strings

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

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

func (*DiscordMessageGroupBy) StringsX

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

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

type DiscordMessageMutation

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

DiscordMessageMutation represents an operation that mutates the DiscordMessage nodes in the graph.

func (*DiscordMessageMutation) AddAuthorIDs

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

AddAuthorIDs adds the "author" edge to the DiscordUser entity by ids.

func (*DiscordMessageMutation) AddField

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

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

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

func (*DiscordMessageMutation) AddedField

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

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

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

func (*DiscordMessageMutation) AddedIDs

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

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

func (*DiscordMessageMutation) AuthorCleared

func (m *DiscordMessageMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the DiscordUser entity was cleared.

func (*DiscordMessageMutation) AuthorIDs

func (m *DiscordMessageMutation) AuthorIDs() (ids []uuid.UUID)

AuthorIDs returns the "author" edge IDs in the mutation.

func (*DiscordMessageMutation) ClearAuthor

func (m *DiscordMessageMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the DiscordUser entity.

func (*DiscordMessageMutation) ClearEdge

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

func (m *DiscordMessageMutation) 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 (*DiscordMessageMutation) ClearedEdges

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

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

func (*DiscordMessageMutation) ClearedFields

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

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

func (DiscordMessageMutation) Client

func (m DiscordMessageMutation) 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 (*DiscordMessageMutation) CreateTime

func (m *DiscordMessageMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*DiscordMessageMutation) EdgeCleared

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

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

func (*DiscordMessageMutation) Field

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

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

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

func (*DiscordMessageMutation) Fields

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

func (m *DiscordMessageMutation) ID() (id string, 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 (*DiscordMessageMutation) IDs

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 (*DiscordMessageMutation) OldCreateTime

func (m *DiscordMessageMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the DiscordMessage entity. If the DiscordMessage 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 (*DiscordMessageMutation) OldField

func (m *DiscordMessageMutation) 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 (*DiscordMessageMutation) OldRaw

func (m *DiscordMessageMutation) OldRaw(ctx context.Context) (v discordgo.Message, err error)

OldRaw returns the old "raw" field's value of the DiscordMessage entity. If the DiscordMessage 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 (*DiscordMessageMutation) OldUpdateTime

func (m *DiscordMessageMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the DiscordMessage entity. If the DiscordMessage 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 (*DiscordMessageMutation) Op

func (m *DiscordMessageMutation) Op() Op

Op returns the operation name.

func (*DiscordMessageMutation) Raw

func (m *DiscordMessageMutation) Raw() (r discordgo.Message, exists bool)

Raw returns the value of the "raw" field in the mutation.

func (*DiscordMessageMutation) RemoveAuthorIDs

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

RemoveAuthorIDs removes the "author" edge to the DiscordUser entity by IDs.

func (*DiscordMessageMutation) RemovedAuthorIDs

func (m *DiscordMessageMutation) RemovedAuthorIDs() (ids []uuid.UUID)

RemovedAuthor returns the removed IDs of the "author" edge to the DiscordUser entity.

func (*DiscordMessageMutation) RemovedEdges

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

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

func (*DiscordMessageMutation) RemovedIDs

func (m *DiscordMessageMutation) 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 (*DiscordMessageMutation) ResetAuthor

func (m *DiscordMessageMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*DiscordMessageMutation) ResetCreateTime

func (m *DiscordMessageMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*DiscordMessageMutation) ResetEdge

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

func (m *DiscordMessageMutation) 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 (*DiscordMessageMutation) ResetRaw

func (m *DiscordMessageMutation) ResetRaw()

ResetRaw resets all changes to the "raw" field.

func (*DiscordMessageMutation) ResetUpdateTime

func (m *DiscordMessageMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*DiscordMessageMutation) SetCreateTime

func (m *DiscordMessageMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*DiscordMessageMutation) SetField

func (m *DiscordMessageMutation) 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 (*DiscordMessageMutation) SetID

func (m *DiscordMessageMutation) SetID(id string)

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

func (*DiscordMessageMutation) SetOp

func (m *DiscordMessageMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DiscordMessageMutation) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageMutation) SetUpdateTime

func (m *DiscordMessageMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (DiscordMessageMutation) Tx

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

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

func (*DiscordMessageMutation) Type

func (m *DiscordMessageMutation) Type() string

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

func (*DiscordMessageMutation) UpdateTime

func (m *DiscordMessageMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*DiscordMessageMutation) Where

Where appends a list predicates to the DiscordMessageMutation builder.

func (*DiscordMessageMutation) WhereP

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

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

type DiscordMessageQuery

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

DiscordMessageQuery is the builder for querying DiscordMessage entities.

func (*DiscordMessageQuery) Aggregate

func (dmq *DiscordMessageQuery) Aggregate(fns ...AggregateFunc) *DiscordMessageSelect

Aggregate returns a DiscordMessageSelect configured with the given aggregations.

func (*DiscordMessageQuery) All

All executes the query and returns a list of DiscordMessages.

func (*DiscordMessageQuery) AllX

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

func (*DiscordMessageQuery) Clone

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

func (*DiscordMessageQuery) Count

func (dmq *DiscordMessageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DiscordMessageQuery) CountX

func (dmq *DiscordMessageQuery) CountX(ctx context.Context) int

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

func (*DiscordMessageQuery) Exist

func (dmq *DiscordMessageQuery) Exist(ctx context.Context) (bool, error)

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

func (*DiscordMessageQuery) ExistX

func (dmq *DiscordMessageQuery) ExistX(ctx context.Context) bool

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

func (*DiscordMessageQuery) First

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

func (*DiscordMessageQuery) FirstID

func (dmq *DiscordMessageQuery) FirstID(ctx context.Context) (id string, err error)

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

func (*DiscordMessageQuery) FirstIDX

func (dmq *DiscordMessageQuery) FirstIDX(ctx context.Context) string

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

func (*DiscordMessageQuery) FirstX

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

func (*DiscordMessageQuery) ForShare

func (dmq *DiscordMessageQuery) ForShare(opts ...sql.LockOption) *DiscordMessageQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*DiscordMessageQuery) ForUpdate

func (dmq *DiscordMessageQuery) ForUpdate(opts ...sql.LockOption) *DiscordMessageQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*DiscordMessageQuery) GroupBy

func (dmq *DiscordMessageQuery) GroupBy(field string, fields ...string) *DiscordMessageGroupBy

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.DiscordMessage.Query().
	GroupBy(discordmessage.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DiscordMessageQuery) IDs

func (dmq *DiscordMessageQuery) IDs(ctx context.Context) (ids []string, err error)

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

func (*DiscordMessageQuery) IDsX

func (dmq *DiscordMessageQuery) IDsX(ctx context.Context) []string

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

func (*DiscordMessageQuery) Limit

func (dmq *DiscordMessageQuery) Limit(limit int) *DiscordMessageQuery

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

func (*DiscordMessageQuery) Offset

func (dmq *DiscordMessageQuery) Offset(offset int) *DiscordMessageQuery

Offset to start from.

func (*DiscordMessageQuery) Only

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

func (*DiscordMessageQuery) OnlyID

func (dmq *DiscordMessageQuery) OnlyID(ctx context.Context) (id string, err error)

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

func (*DiscordMessageQuery) OnlyIDX

func (dmq *DiscordMessageQuery) OnlyIDX(ctx context.Context) string

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

func (*DiscordMessageQuery) OnlyX

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

func (*DiscordMessageQuery) Order

Order specifies how the records should be ordered.

func (*DiscordMessageQuery) QueryAuthor

func (dmq *DiscordMessageQuery) QueryAuthor() *DiscordUserQuery

QueryAuthor chains the current query on the "author" edge.

func (*DiscordMessageQuery) Select

func (dmq *DiscordMessageQuery) Select(fields ...string) *DiscordMessageSelect

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 {
	CreateTime time.Time `json:"create_time,omitempty"`
}

client.DiscordMessage.Query().
	Select(discordmessage.FieldCreateTime).
	Scan(ctx, &v)

func (*DiscordMessageQuery) Unique

func (dmq *DiscordMessageQuery) Unique(unique bool) *DiscordMessageQuery

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

Where adds a new predicate for the DiscordMessageQuery builder.

func (*DiscordMessageQuery) WithAuthor

func (dmq *DiscordMessageQuery) WithAuthor(opts ...func(*DiscordUserQuery)) *DiscordMessageQuery

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

func (*DiscordMessageQuery) WithNamedAuthor

func (dmq *DiscordMessageQuery) WithNamedAuthor(name string, opts ...func(*DiscordUserQuery)) *DiscordMessageQuery

WithNamedAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type DiscordMessageSelect

type DiscordMessageSelect struct {
	*DiscordMessageQuery
	// contains filtered or unexported fields
}

DiscordMessageSelect is the builder for selecting fields of DiscordMessage entities.

func (*DiscordMessageSelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*DiscordMessageSelect) Bool

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

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

func (*DiscordMessageSelect) BoolX

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

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

func (*DiscordMessageSelect) Bools

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

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

func (*DiscordMessageSelect) BoolsX

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

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

func (*DiscordMessageSelect) Float64

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

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

func (*DiscordMessageSelect) Float64X

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

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

func (*DiscordMessageSelect) Float64s

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

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

func (*DiscordMessageSelect) Float64sX

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

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

func (*DiscordMessageSelect) Int

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

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

func (*DiscordMessageSelect) IntX

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

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

func (*DiscordMessageSelect) Ints

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

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

func (*DiscordMessageSelect) IntsX

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

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

func (*DiscordMessageSelect) Scan

func (dms *DiscordMessageSelect) Scan(ctx context.Context, v any) error

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

func (*DiscordMessageSelect) ScanX

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

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

func (*DiscordMessageSelect) String

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

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

func (*DiscordMessageSelect) StringX

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

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

func (*DiscordMessageSelect) Strings

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

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

func (*DiscordMessageSelect) StringsX

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

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

type DiscordMessageUpdate

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

DiscordMessageUpdate is the builder for updating DiscordMessage entities.

func (*DiscordMessageUpdate) AddAuthor

func (dmu *DiscordMessageUpdate) AddAuthor(d ...*DiscordUser) *DiscordMessageUpdate

AddAuthor adds the "author" edges to the DiscordUser entity.

func (*DiscordMessageUpdate) AddAuthorIDs

func (dmu *DiscordMessageUpdate) AddAuthorIDs(ids ...uuid.UUID) *DiscordMessageUpdate

AddAuthorIDs adds the "author" edge to the DiscordUser entity by IDs.

func (*DiscordMessageUpdate) ClearAuthor

func (dmu *DiscordMessageUpdate) ClearAuthor() *DiscordMessageUpdate

ClearAuthor clears all "author" edges to the DiscordUser entity.

func (*DiscordMessageUpdate) Exec

func (dmu *DiscordMessageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiscordMessageUpdate) ExecX

func (dmu *DiscordMessageUpdate) ExecX(ctx context.Context)

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

func (*DiscordMessageUpdate) Mutation

Mutation returns the DiscordMessageMutation object of the builder.

func (*DiscordMessageUpdate) RemoveAuthor

func (dmu *DiscordMessageUpdate) RemoveAuthor(d ...*DiscordUser) *DiscordMessageUpdate

RemoveAuthor removes "author" edges to DiscordUser entities.

func (*DiscordMessageUpdate) RemoveAuthorIDs

func (dmu *DiscordMessageUpdate) RemoveAuthorIDs(ids ...uuid.UUID) *DiscordMessageUpdate

RemoveAuthorIDs removes the "author" edge to DiscordUser entities by IDs.

func (*DiscordMessageUpdate) Save

func (dmu *DiscordMessageUpdate) Save(ctx context.Context) (int, error)

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

func (*DiscordMessageUpdate) SaveX

func (dmu *DiscordMessageUpdate) SaveX(ctx context.Context) int

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

func (*DiscordMessageUpdate) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageUpdate) SetUpdateTime

func (dmu *DiscordMessageUpdate) SetUpdateTime(t time.Time) *DiscordMessageUpdate

SetUpdateTime sets the "update_time" field.

func (*DiscordMessageUpdate) Where

Where appends a list predicates to the DiscordMessageUpdate builder.

type DiscordMessageUpdateOne

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

DiscordMessageUpdateOne is the builder for updating a single DiscordMessage entity.

func (*DiscordMessageUpdateOne) AddAuthor

AddAuthor adds the "author" edges to the DiscordUser entity.

func (*DiscordMessageUpdateOne) AddAuthorIDs

func (dmuo *DiscordMessageUpdateOne) AddAuthorIDs(ids ...uuid.UUID) *DiscordMessageUpdateOne

AddAuthorIDs adds the "author" edge to the DiscordUser entity by IDs.

func (*DiscordMessageUpdateOne) ClearAuthor

func (dmuo *DiscordMessageUpdateOne) ClearAuthor() *DiscordMessageUpdateOne

ClearAuthor clears all "author" edges to the DiscordUser entity.

func (*DiscordMessageUpdateOne) Exec

func (dmuo *DiscordMessageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DiscordMessageUpdateOne) ExecX

func (dmuo *DiscordMessageUpdateOne) ExecX(ctx context.Context)

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

func (*DiscordMessageUpdateOne) Mutation

Mutation returns the DiscordMessageMutation object of the builder.

func (*DiscordMessageUpdateOne) RemoveAuthor

func (dmuo *DiscordMessageUpdateOne) RemoveAuthor(d ...*DiscordUser) *DiscordMessageUpdateOne

RemoveAuthor removes "author" edges to DiscordUser entities.

func (*DiscordMessageUpdateOne) RemoveAuthorIDs

func (dmuo *DiscordMessageUpdateOne) RemoveAuthorIDs(ids ...uuid.UUID) *DiscordMessageUpdateOne

RemoveAuthorIDs removes the "author" edge to DiscordUser entities by IDs.

func (*DiscordMessageUpdateOne) Save

Save executes the query and returns the updated DiscordMessage entity.

func (*DiscordMessageUpdateOne) SaveX

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

func (*DiscordMessageUpdateOne) Select

func (dmuo *DiscordMessageUpdateOne) Select(field string, fields ...string) *DiscordMessageUpdateOne

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

func (*DiscordMessageUpdateOne) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageUpdateOne) SetUpdateTime

func (dmuo *DiscordMessageUpdateOne) SetUpdateTime(t time.Time) *DiscordMessageUpdateOne

SetUpdateTime sets the "update_time" field.

func (*DiscordMessageUpdateOne) Where

Where appends a list predicates to the DiscordMessageUpdate builder.

type DiscordMessageUpsert

type DiscordMessageUpsert struct {
	*sql.UpdateSet
}

DiscordMessageUpsert is the "OnConflict" setter.

func (*DiscordMessageUpsert) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageUpsert) SetUpdateTime

func (u *DiscordMessageUpsert) SetUpdateTime(v time.Time) *DiscordMessageUpsert

SetUpdateTime sets the "update_time" field.

func (*DiscordMessageUpsert) UpdateRaw

UpdateRaw sets the "raw" field to the value that was provided on create.

func (*DiscordMessageUpsert) UpdateUpdateTime

func (u *DiscordMessageUpsert) UpdateUpdateTime() *DiscordMessageUpsert

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type DiscordMessageUpsertBulk

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

DiscordMessageUpsertBulk is the builder for "upsert"-ing a bulk of DiscordMessage nodes.

func (*DiscordMessageUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DiscordMessageUpsertBulk) Exec

Exec executes the query.

func (*DiscordMessageUpsertBulk) ExecX

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

func (*DiscordMessageUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.DiscordMessage.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*DiscordMessageUpsertBulk) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageUpsertBulk) SetUpdateTime

SetUpdateTime sets the "update_time" field.

func (*DiscordMessageUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the DiscordMessageCreateBulk.OnConflict documentation for more info.

func (*DiscordMessageUpsertBulk) UpdateNewValues

func (u *DiscordMessageUpsertBulk) UpdateNewValues() *DiscordMessageUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.DiscordMessage.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(discordmessage.FieldID)
		}),
	).
	Exec(ctx)

func (*DiscordMessageUpsertBulk) UpdateRaw

UpdateRaw sets the "raw" field to the value that was provided on create.

func (*DiscordMessageUpsertBulk) UpdateUpdateTime

func (u *DiscordMessageUpsertBulk) UpdateUpdateTime() *DiscordMessageUpsertBulk

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type DiscordMessageUpsertOne

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

DiscordMessageUpsertOne is the builder for "upsert"-ing

one DiscordMessage node.

func (*DiscordMessageUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DiscordMessageUpsertOne) Exec

Exec executes the query.

func (*DiscordMessageUpsertOne) ExecX

func (u *DiscordMessageUpsertOne) ExecX(ctx context.Context)

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

func (*DiscordMessageUpsertOne) ID

func (u *DiscordMessageUpsertOne) ID(ctx context.Context) (id string, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*DiscordMessageUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*DiscordMessageUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.DiscordMessage.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*DiscordMessageUpsertOne) SetRaw

SetRaw sets the "raw" field.

func (*DiscordMessageUpsertOne) SetUpdateTime

SetUpdateTime sets the "update_time" field.

func (*DiscordMessageUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the DiscordMessageCreate.OnConflict documentation for more info.

func (*DiscordMessageUpsertOne) UpdateNewValues

func (u *DiscordMessageUpsertOne) UpdateNewValues() *DiscordMessageUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.DiscordMessage.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(discordmessage.FieldID)
		}),
	).
	Exec(ctx)

func (*DiscordMessageUpsertOne) UpdateRaw

UpdateRaw sets the "raw" field to the value that was provided on create.

func (*DiscordMessageUpsertOne) UpdateUpdateTime

func (u *DiscordMessageUpsertOne) UpdateUpdateTime() *DiscordMessageUpsertOne

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type DiscordMessages

type DiscordMessages []*DiscordMessage

DiscordMessages is a parsable slice of DiscordMessage.

type DiscordUser

type DiscordUser struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Discordid holds the value of the "discordid" field.
	Discordid string `json:"discordid,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DiscordUserQuery when eager-loading is set.
	Edges DiscordUserEdges `json:"edges"`
	// contains filtered or unexported fields
}

DiscordUser is the model entity for the DiscordUser schema.

func (*DiscordUser) NamedDiscordMessages

func (du *DiscordUser) NamedDiscordMessages(name string) ([]*DiscordMessage, error)

NamedDiscordMessages returns the DiscordMessages named value or an error if the edge was not loaded in eager-loading with this name.

func (*DiscordUser) QueryDiscordMessages

func (du *DiscordUser) QueryDiscordMessages() *DiscordMessageQuery

QueryDiscordMessages queries the "discord_messages" edge of the DiscordUser entity.

func (*DiscordUser) String

func (du *DiscordUser) String() string

String implements the fmt.Stringer.

func (*DiscordUser) Unwrap

func (du *DiscordUser) Unwrap() *DiscordUser

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

func (du *DiscordUser) Update() *DiscordUserUpdateOne

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

func (*DiscordUser) Value

func (du *DiscordUser) Value(name string) (ent.Value, error)

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

type DiscordUserClient

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

DiscordUserClient is a client for the DiscordUser schema.

func NewDiscordUserClient

func NewDiscordUserClient(c config) *DiscordUserClient

NewDiscordUserClient returns a client for the DiscordUser from the given config.

func (*DiscordUserClient) Create

func (c *DiscordUserClient) Create() *DiscordUserCreate

Create returns a builder for creating a DiscordUser entity.

func (*DiscordUserClient) CreateBulk

func (c *DiscordUserClient) CreateBulk(builders ...*DiscordUserCreate) *DiscordUserCreateBulk

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

func (*DiscordUserClient) Delete

func (c *DiscordUserClient) Delete() *DiscordUserDelete

Delete returns a delete builder for DiscordUser.

func (*DiscordUserClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DiscordUserClient) DeleteOneID

func (c *DiscordUserClient) DeleteOneID(id uuid.UUID) *DiscordUserDeleteOne

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

func (*DiscordUserClient) Get

Get returns a DiscordUser entity by its id.

func (*DiscordUserClient) GetX

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

func (*DiscordUserClient) Hooks

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

Hooks returns the client hooks.

func (*DiscordUserClient) Intercept

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

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

func (*DiscordUserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*DiscordUserClient) Query

func (c *DiscordUserClient) Query() *DiscordUserQuery

Query returns a query builder for DiscordUser.

func (*DiscordUserClient) QueryDiscordMessages

func (c *DiscordUserClient) QueryDiscordMessages(du *DiscordUser) *DiscordMessageQuery

QueryDiscordMessages queries the discord_messages edge of a DiscordUser.

func (*DiscordUserClient) Update

func (c *DiscordUserClient) Update() *DiscordUserUpdate

Update returns an update builder for DiscordUser.

func (*DiscordUserClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*DiscordUserClient) UpdateOneID

func (c *DiscordUserClient) UpdateOneID(id uuid.UUID) *DiscordUserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DiscordUserClient) Use

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

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

type DiscordUserCreate

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

DiscordUserCreate is the builder for creating a DiscordUser entity.

func (*DiscordUserCreate) AddDiscordMessageIDs

func (duc *DiscordUserCreate) AddDiscordMessageIDs(ids ...string) *DiscordUserCreate

AddDiscordMessageIDs adds the "discord_messages" edge to the DiscordMessage entity by IDs.

func (*DiscordUserCreate) AddDiscordMessages

func (duc *DiscordUserCreate) AddDiscordMessages(d ...*DiscordMessage) *DiscordUserCreate

AddDiscordMessages adds the "discord_messages" edges to the DiscordMessage entity.

func (*DiscordUserCreate) Exec

func (duc *DiscordUserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiscordUserCreate) ExecX

func (duc *DiscordUserCreate) ExecX(ctx context.Context)

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

func (*DiscordUserCreate) Mutation

func (duc *DiscordUserCreate) Mutation() *DiscordUserMutation

Mutation returns the DiscordUserMutation object of the builder.

func (*DiscordUserCreate) OnConflict

func (duc *DiscordUserCreate) OnConflict(opts ...sql.ConflictOption) *DiscordUserUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.DiscordUser.Create().
	SetDiscordid(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DiscordUserUpsert) {
		SetDiscordid(v+v).
	}).
	Exec(ctx)

func (*DiscordUserCreate) OnConflictColumns

func (duc *DiscordUserCreate) OnConflictColumns(columns ...string) *DiscordUserUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.DiscordUser.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DiscordUserCreate) Save

func (duc *DiscordUserCreate) Save(ctx context.Context) (*DiscordUser, error)

Save creates the DiscordUser in the database.

func (*DiscordUserCreate) SaveX

func (duc *DiscordUserCreate) SaveX(ctx context.Context) *DiscordUser

SaveX calls Save and panics if Save returns an error.

func (*DiscordUserCreate) SetDiscordid

func (duc *DiscordUserCreate) SetDiscordid(s string) *DiscordUserCreate

SetDiscordid sets the "discordid" field.

func (*DiscordUserCreate) SetID

SetID sets the "id" field.

func (*DiscordUserCreate) SetNillableDiscordid

func (duc *DiscordUserCreate) SetNillableDiscordid(s *string) *DiscordUserCreate

SetNillableDiscordid sets the "discordid" field if the given value is not nil.

func (*DiscordUserCreate) SetUsername

func (duc *DiscordUserCreate) SetUsername(s string) *DiscordUserCreate

SetUsername sets the "username" field.

type DiscordUserCreateBulk

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

DiscordUserCreateBulk is the builder for creating many DiscordUser entities in bulk.

func (*DiscordUserCreateBulk) Exec

func (ducb *DiscordUserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DiscordUserCreateBulk) ExecX

func (ducb *DiscordUserCreateBulk) ExecX(ctx context.Context)

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

func (*DiscordUserCreateBulk) OnConflict

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.DiscordUser.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DiscordUserUpsert) {
		SetDiscordid(v+v).
	}).
	Exec(ctx)

func (*DiscordUserCreateBulk) OnConflictColumns

func (ducb *DiscordUserCreateBulk) OnConflictColumns(columns ...string) *DiscordUserUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.DiscordUser.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DiscordUserCreateBulk) Save

func (ducb *DiscordUserCreateBulk) Save(ctx context.Context) ([]*DiscordUser, error)

Save creates the DiscordUser entities in the database.

func (*DiscordUserCreateBulk) SaveX

func (ducb *DiscordUserCreateBulk) SaveX(ctx context.Context) []*DiscordUser

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

type DiscordUserDelete

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

DiscordUserDelete is the builder for deleting a DiscordUser entity.

func (*DiscordUserDelete) Exec

func (dud *DiscordUserDelete) Exec(ctx context.Context) (int, error)

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

func (*DiscordUserDelete) ExecX

func (dud *DiscordUserDelete) ExecX(ctx context.Context) int

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

func (*DiscordUserDelete) Where

Where appends a list predicates to the DiscordUserDelete builder.

type DiscordUserDeleteOne

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

DiscordUserDeleteOne is the builder for deleting a single DiscordUser entity.

func (*DiscordUserDeleteOne) Exec

func (dudo *DiscordUserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DiscordUserDeleteOne) ExecX

func (dudo *DiscordUserDeleteOne) ExecX(ctx context.Context)

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

func (*DiscordUserDeleteOne) Where

Where appends a list predicates to the DiscordUserDelete builder.

type DiscordUserEdges

type DiscordUserEdges struct {
	// DiscordMessages holds the value of the discord_messages edge.
	DiscordMessages []*DiscordMessage `json:"discord_messages,omitempty"`
	// contains filtered or unexported fields
}

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

func (DiscordUserEdges) DiscordMessagesOrErr

func (e DiscordUserEdges) DiscordMessagesOrErr() ([]*DiscordMessage, error)

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

type DiscordUserGroupBy

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

DiscordUserGroupBy is the group-by builder for DiscordUser entities.

func (*DiscordUserGroupBy) Aggregate

func (dugb *DiscordUserGroupBy) Aggregate(fns ...AggregateFunc) *DiscordUserGroupBy

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

func (*DiscordUserGroupBy) Bool

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

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

func (*DiscordUserGroupBy) BoolX

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

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

func (*DiscordUserGroupBy) Bools

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

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

func (*DiscordUserGroupBy) BoolsX

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

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

func (*DiscordUserGroupBy) Float64

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

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

func (*DiscordUserGroupBy) Float64X

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

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

func (*DiscordUserGroupBy) Float64s

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

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

func (*DiscordUserGroupBy) Float64sX

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

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

func (*DiscordUserGroupBy) Int

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

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

func (*DiscordUserGroupBy) IntX

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

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

func (*DiscordUserGroupBy) Ints

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

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

func (*DiscordUserGroupBy) IntsX

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

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

func (*DiscordUserGroupBy) Scan

func (dugb *DiscordUserGroupBy) Scan(ctx context.Context, v any) error

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

func (*DiscordUserGroupBy) ScanX

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

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

func (*DiscordUserGroupBy) String

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

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

func (*DiscordUserGroupBy) StringX

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

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

func (*DiscordUserGroupBy) Strings

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

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

func (*DiscordUserGroupBy) StringsX

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

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

type DiscordUserMutation

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

DiscordUserMutation represents an operation that mutates the DiscordUser nodes in the graph.

func (*DiscordUserMutation) AddDiscordMessageIDs

func (m *DiscordUserMutation) AddDiscordMessageIDs(ids ...string)

AddDiscordMessageIDs adds the "discord_messages" edge to the DiscordMessage entity by ids.

func (*DiscordUserMutation) AddField

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

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

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

func (*DiscordUserMutation) AddedField

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

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

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

func (*DiscordUserMutation) AddedIDs

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

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

func (*DiscordUserMutation) ClearDiscordMessages

func (m *DiscordUserMutation) ClearDiscordMessages()

ClearDiscordMessages clears the "discord_messages" edge to the DiscordMessage entity.

func (*DiscordUserMutation) ClearEdge

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

func (m *DiscordUserMutation) 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 (*DiscordUserMutation) ClearedEdges

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

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

func (*DiscordUserMutation) ClearedFields

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

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

func (DiscordUserMutation) Client

func (m DiscordUserMutation) 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 (*DiscordUserMutation) DiscordMessagesCleared

func (m *DiscordUserMutation) DiscordMessagesCleared() bool

DiscordMessagesCleared reports if the "discord_messages" edge to the DiscordMessage entity was cleared.

func (*DiscordUserMutation) DiscordMessagesIDs

func (m *DiscordUserMutation) DiscordMessagesIDs() (ids []string)

DiscordMessagesIDs returns the "discord_messages" edge IDs in the mutation.

func (*DiscordUserMutation) Discordid

func (m *DiscordUserMutation) Discordid() (r string, exists bool)

Discordid returns the value of the "discordid" field in the mutation.

func (*DiscordUserMutation) EdgeCleared

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

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

func (*DiscordUserMutation) Field

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

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

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

func (*DiscordUserMutation) Fields

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

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

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

func (*DiscordUserMutation) IDs

func (m *DiscordUserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*DiscordUserMutation) OldDiscordid

func (m *DiscordUserMutation) OldDiscordid(ctx context.Context) (v string, err error)

OldDiscordid returns the old "discordid" field's value of the DiscordUser entity. If the DiscordUser 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 (*DiscordUserMutation) OldField

func (m *DiscordUserMutation) 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 (*DiscordUserMutation) OldUsername

func (m *DiscordUserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the DiscordUser entity. If the DiscordUser 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 (*DiscordUserMutation) Op

func (m *DiscordUserMutation) Op() Op

Op returns the operation name.

func (*DiscordUserMutation) RemoveDiscordMessageIDs

func (m *DiscordUserMutation) RemoveDiscordMessageIDs(ids ...string)

RemoveDiscordMessageIDs removes the "discord_messages" edge to the DiscordMessage entity by IDs.

func (*DiscordUserMutation) RemovedDiscordMessagesIDs

func (m *DiscordUserMutation) RemovedDiscordMessagesIDs() (ids []string)

RemovedDiscordMessages returns the removed IDs of the "discord_messages" edge to the DiscordMessage entity.

func (*DiscordUserMutation) RemovedEdges

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

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

func (*DiscordUserMutation) RemovedIDs

func (m *DiscordUserMutation) 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 (*DiscordUserMutation) ResetDiscordMessages

func (m *DiscordUserMutation) ResetDiscordMessages()

ResetDiscordMessages resets all changes to the "discord_messages" edge.

func (*DiscordUserMutation) ResetDiscordid

func (m *DiscordUserMutation) ResetDiscordid()

ResetDiscordid resets all changes to the "discordid" field.

func (*DiscordUserMutation) ResetEdge

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

func (m *DiscordUserMutation) 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 (*DiscordUserMutation) ResetUsername

func (m *DiscordUserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*DiscordUserMutation) SetDiscordid

func (m *DiscordUserMutation) SetDiscordid(s string)

SetDiscordid sets the "discordid" field.

func (*DiscordUserMutation) SetField

func (m *DiscordUserMutation) 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 (*DiscordUserMutation) SetID

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

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

func (*DiscordUserMutation) SetOp

func (m *DiscordUserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DiscordUserMutation) SetUsername

func (m *DiscordUserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (DiscordUserMutation) Tx

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

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

func (*DiscordUserMutation) Type

func (m *DiscordUserMutation) Type() string

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

func (*DiscordUserMutation) Username

func (m *DiscordUserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*DiscordUserMutation) Where

func (m *DiscordUserMutation) Where(ps ...predicate.DiscordUser)

Where appends a list predicates to the DiscordUserMutation builder.

func (*DiscordUserMutation) WhereP

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

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

type DiscordUserQuery

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

DiscordUserQuery is the builder for querying DiscordUser entities.

func (*DiscordUserQuery) Aggregate

func (duq *DiscordUserQuery) Aggregate(fns ...AggregateFunc) *DiscordUserSelect

Aggregate returns a DiscordUserSelect configured with the given aggregations.

func (*DiscordUserQuery) All

func (duq *DiscordUserQuery) All(ctx context.Context) ([]*DiscordUser, error)

All executes the query and returns a list of DiscordUsers.

func (*DiscordUserQuery) AllX

func (duq *DiscordUserQuery) AllX(ctx context.Context) []*DiscordUser

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

func (*DiscordUserQuery) Clone

func (duq *DiscordUserQuery) Clone() *DiscordUserQuery

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

func (*DiscordUserQuery) Count

func (duq *DiscordUserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DiscordUserQuery) CountX

func (duq *DiscordUserQuery) CountX(ctx context.Context) int

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

func (*DiscordUserQuery) Exist

func (duq *DiscordUserQuery) Exist(ctx context.Context) (bool, error)

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

func (*DiscordUserQuery) ExistX

func (duq *DiscordUserQuery) ExistX(ctx context.Context) bool

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

func (*DiscordUserQuery) First

func (duq *DiscordUserQuery) First(ctx context.Context) (*DiscordUser, error)

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

func (*DiscordUserQuery) FirstID

func (duq *DiscordUserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*DiscordUserQuery) FirstIDX

func (duq *DiscordUserQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*DiscordUserQuery) FirstX

func (duq *DiscordUserQuery) FirstX(ctx context.Context) *DiscordUser

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

func (*DiscordUserQuery) ForShare

func (duq *DiscordUserQuery) ForShare(opts ...sql.LockOption) *DiscordUserQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*DiscordUserQuery) ForUpdate

func (duq *DiscordUserQuery) ForUpdate(opts ...sql.LockOption) *DiscordUserQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*DiscordUserQuery) GroupBy

func (duq *DiscordUserQuery) GroupBy(field string, fields ...string) *DiscordUserGroupBy

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

client.DiscordUser.Query().
	GroupBy(discorduser.FieldDiscordid).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*DiscordUserQuery) IDs

func (duq *DiscordUserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*DiscordUserQuery) IDsX

func (duq *DiscordUserQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*DiscordUserQuery) Limit

func (duq *DiscordUserQuery) Limit(limit int) *DiscordUserQuery

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

func (*DiscordUserQuery) Offset

func (duq *DiscordUserQuery) Offset(offset int) *DiscordUserQuery

Offset to start from.

func (*DiscordUserQuery) Only

func (duq *DiscordUserQuery) Only(ctx context.Context) (*DiscordUser, error)

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

func (*DiscordUserQuery) OnlyID

func (duq *DiscordUserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*DiscordUserQuery) OnlyIDX

func (duq *DiscordUserQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*DiscordUserQuery) OnlyX

func (duq *DiscordUserQuery) OnlyX(ctx context.Context) *DiscordUser

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

func (*DiscordUserQuery) Order

Order specifies how the records should be ordered.

func (*DiscordUserQuery) QueryDiscordMessages

func (duq *DiscordUserQuery) QueryDiscordMessages() *DiscordMessageQuery

QueryDiscordMessages chains the current query on the "discord_messages" edge.

func (*DiscordUserQuery) Select

func (duq *DiscordUserQuery) Select(fields ...string) *DiscordUserSelect

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

client.DiscordUser.Query().
	Select(discorduser.FieldDiscordid).
	Scan(ctx, &v)

func (*DiscordUserQuery) Unique

func (duq *DiscordUserQuery) Unique(unique bool) *DiscordUserQuery

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

Where adds a new predicate for the DiscordUserQuery builder.

func (*DiscordUserQuery) WithDiscordMessages

func (duq *DiscordUserQuery) WithDiscordMessages(opts ...func(*DiscordMessageQuery)) *DiscordUserQuery

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

func (*DiscordUserQuery) WithNamedDiscordMessages

func (duq *DiscordUserQuery) WithNamedDiscordMessages(name string, opts ...func(*DiscordMessageQuery)) *DiscordUserQuery

WithNamedDiscordMessages tells the query-builder to eager-load the nodes that are connected to the "discord_messages" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type DiscordUserSelect

type DiscordUserSelect struct {
	*DiscordUserQuery
	// contains filtered or unexported fields
}

DiscordUserSelect is the builder for selecting fields of DiscordUser entities.

func (*DiscordUserSelect) Aggregate

func (dus *DiscordUserSelect) Aggregate(fns ...AggregateFunc) *DiscordUserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DiscordUserSelect) Bool

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

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

func (*DiscordUserSelect) BoolX

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

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

func (*DiscordUserSelect) Bools

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

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

func (*DiscordUserSelect) BoolsX

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

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

func (*DiscordUserSelect) Float64

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

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

func (*DiscordUserSelect) Float64X

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

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

func (*DiscordUserSelect) Float64s

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

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

func (*DiscordUserSelect) Float64sX

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

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

func (*DiscordUserSelect) Int

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

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

func (*DiscordUserSelect) IntX

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

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

func (*DiscordUserSelect) Ints

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

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

func (*DiscordUserSelect) IntsX

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

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

func (*DiscordUserSelect) Scan

func (dus *DiscordUserSelect) Scan(ctx context.Context, v any) error

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

func (*DiscordUserSelect) ScanX

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

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

func (*DiscordUserSelect) String

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

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

func (*DiscordUserSelect) StringX

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

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

func (*DiscordUserSelect) Strings

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

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

func (*DiscordUserSelect) StringsX

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

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

type DiscordUserUpdate

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

DiscordUserUpdate is the builder for updating DiscordUser entities.

func (*DiscordUserUpdate) AddDiscordMessageIDs

func (duu *DiscordUserUpdate) AddDiscordMessageIDs(ids ...string) *DiscordUserUpdate

AddDiscordMessageIDs adds the "discord_messages" edge to the DiscordMessage entity by IDs.

func (*DiscordUserUpdate) AddDiscordMessages

func (duu *DiscordUserUpdate) AddDiscordMessages(d ...*DiscordMessage) *DiscordUserUpdate

AddDiscordMessages adds the "discord_messages" edges to the DiscordMessage entity.

func (*DiscordUserUpdate) ClearDiscordMessages

func (duu *DiscordUserUpdate) ClearDiscordMessages() *DiscordUserUpdate

ClearDiscordMessages clears all "discord_messages" edges to the DiscordMessage entity.

func (*DiscordUserUpdate) Exec

func (duu *DiscordUserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DiscordUserUpdate) ExecX

func (duu *DiscordUserUpdate) ExecX(ctx context.Context)

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

func (*DiscordUserUpdate) Mutation

func (duu *DiscordUserUpdate) Mutation() *DiscordUserMutation

Mutation returns the DiscordUserMutation object of the builder.

func (*DiscordUserUpdate) RemoveDiscordMessageIDs

func (duu *DiscordUserUpdate) RemoveDiscordMessageIDs(ids ...string) *DiscordUserUpdate

RemoveDiscordMessageIDs removes the "discord_messages" edge to DiscordMessage entities by IDs.

func (*DiscordUserUpdate) RemoveDiscordMessages

func (duu *DiscordUserUpdate) RemoveDiscordMessages(d ...*DiscordMessage) *DiscordUserUpdate

RemoveDiscordMessages removes "discord_messages" edges to DiscordMessage entities.

func (*DiscordUserUpdate) Save

func (duu *DiscordUserUpdate) Save(ctx context.Context) (int, error)

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

func (*DiscordUserUpdate) SaveX

func (duu *DiscordUserUpdate) SaveX(ctx context.Context) int

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

func (*DiscordUserUpdate) SetDiscordid

func (duu *DiscordUserUpdate) SetDiscordid(s string) *DiscordUserUpdate

SetDiscordid sets the "discordid" field.

func (*DiscordUserUpdate) SetNillableDiscordid

func (duu *DiscordUserUpdate) SetNillableDiscordid(s *string) *DiscordUserUpdate

SetNillableDiscordid sets the "discordid" field if the given value is not nil.

func (*DiscordUserUpdate) SetUsername

func (duu *DiscordUserUpdate) SetUsername(s string) *DiscordUserUpdate

SetUsername sets the "username" field.

func (*DiscordUserUpdate) Where

Where appends a list predicates to the DiscordUserUpdate builder.

type DiscordUserUpdateOne

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

DiscordUserUpdateOne is the builder for updating a single DiscordUser entity.

func (*DiscordUserUpdateOne) AddDiscordMessageIDs

func (duuo *DiscordUserUpdateOne) AddDiscordMessageIDs(ids ...string) *DiscordUserUpdateOne

AddDiscordMessageIDs adds the "discord_messages" edge to the DiscordMessage entity by IDs.

func (*DiscordUserUpdateOne) AddDiscordMessages

func (duuo *DiscordUserUpdateOne) AddDiscordMessages(d ...*DiscordMessage) *DiscordUserUpdateOne

AddDiscordMessages adds the "discord_messages" edges to the DiscordMessage entity.

func (*DiscordUserUpdateOne) ClearDiscordMessages

func (duuo *DiscordUserUpdateOne) ClearDiscordMessages() *DiscordUserUpdateOne

ClearDiscordMessages clears all "discord_messages" edges to the DiscordMessage entity.

func (*DiscordUserUpdateOne) Exec

func (duuo *DiscordUserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DiscordUserUpdateOne) ExecX

func (duuo *DiscordUserUpdateOne) ExecX(ctx context.Context)

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

func (*DiscordUserUpdateOne) Mutation

func (duuo *DiscordUserUpdateOne) Mutation() *DiscordUserMutation

Mutation returns the DiscordUserMutation object of the builder.

func (*DiscordUserUpdateOne) RemoveDiscordMessageIDs

func (duuo *DiscordUserUpdateOne) RemoveDiscordMessageIDs(ids ...string) *DiscordUserUpdateOne

RemoveDiscordMessageIDs removes the "discord_messages" edge to DiscordMessage entities by IDs.

func (*DiscordUserUpdateOne) RemoveDiscordMessages

func (duuo *DiscordUserUpdateOne) RemoveDiscordMessages(d ...*DiscordMessage) *DiscordUserUpdateOne

RemoveDiscordMessages removes "discord_messages" edges to DiscordMessage entities.

func (*DiscordUserUpdateOne) Save

Save executes the query and returns the updated DiscordUser entity.

func (*DiscordUserUpdateOne) SaveX

func (duuo *DiscordUserUpdateOne) SaveX(ctx context.Context) *DiscordUser

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

func (*DiscordUserUpdateOne) Select

func (duuo *DiscordUserUpdateOne) Select(field string, fields ...string) *DiscordUserUpdateOne

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

func (*DiscordUserUpdateOne) SetDiscordid

func (duuo *DiscordUserUpdateOne) SetDiscordid(s string) *DiscordUserUpdateOne

SetDiscordid sets the "discordid" field.

func (*DiscordUserUpdateOne) SetNillableDiscordid

func (duuo *DiscordUserUpdateOne) SetNillableDiscordid(s *string) *DiscordUserUpdateOne

SetNillableDiscordid sets the "discordid" field if the given value is not nil.

func (*DiscordUserUpdateOne) SetUsername

func (duuo *DiscordUserUpdateOne) SetUsername(s string) *DiscordUserUpdateOne

SetUsername sets the "username" field.

func (*DiscordUserUpdateOne) Where

Where appends a list predicates to the DiscordUserUpdate builder.

type DiscordUserUpsert

type DiscordUserUpsert struct {
	*sql.UpdateSet
}

DiscordUserUpsert is the "OnConflict" setter.

func (*DiscordUserUpsert) SetDiscordid

func (u *DiscordUserUpsert) SetDiscordid(v string) *DiscordUserUpsert

SetDiscordid sets the "discordid" field.

func (*DiscordUserUpsert) SetUsername

func (u *DiscordUserUpsert) SetUsername(v string) *DiscordUserUpsert

SetUsername sets the "username" field.

func (*DiscordUserUpsert) UpdateDiscordid

func (u *DiscordUserUpsert) UpdateDiscordid() *DiscordUserUpsert

UpdateDiscordid sets the "discordid" field to the value that was provided on create.

func (*DiscordUserUpsert) UpdateUsername

func (u *DiscordUserUpsert) UpdateUsername() *DiscordUserUpsert

UpdateUsername sets the "username" field to the value that was provided on create.

type DiscordUserUpsertBulk

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

DiscordUserUpsertBulk is the builder for "upsert"-ing a bulk of DiscordUser nodes.

func (*DiscordUserUpsertBulk) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DiscordUserUpsertBulk) Exec

Exec executes the query.

func (*DiscordUserUpsertBulk) ExecX

func (u *DiscordUserUpsertBulk) ExecX(ctx context.Context)

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

func (*DiscordUserUpsertBulk) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.DiscordUser.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*DiscordUserUpsertBulk) SetDiscordid

SetDiscordid sets the "discordid" field.

func (*DiscordUserUpsertBulk) SetUsername

SetUsername sets the "username" field.

func (*DiscordUserUpsertBulk) Update

Update allows overriding fields `UPDATE` values. See the DiscordUserCreateBulk.OnConflict documentation for more info.

func (*DiscordUserUpsertBulk) UpdateDiscordid

func (u *DiscordUserUpsertBulk) UpdateDiscordid() *DiscordUserUpsertBulk

UpdateDiscordid sets the "discordid" field to the value that was provided on create.

func (*DiscordUserUpsertBulk) UpdateNewValues

func (u *DiscordUserUpsertBulk) UpdateNewValues() *DiscordUserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.DiscordUser.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(discorduser.FieldID)
		}),
	).
	Exec(ctx)

func (*DiscordUserUpsertBulk) UpdateUsername

func (u *DiscordUserUpsertBulk) UpdateUsername() *DiscordUserUpsertBulk

UpdateUsername sets the "username" field to the value that was provided on create.

type DiscordUserUpsertOne

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

DiscordUserUpsertOne is the builder for "upsert"-ing

one DiscordUser node.

func (*DiscordUserUpsertOne) DoNothing

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DiscordUserUpsertOne) Exec

Exec executes the query.

func (*DiscordUserUpsertOne) ExecX

func (u *DiscordUserUpsertOne) ExecX(ctx context.Context)

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

func (*DiscordUserUpsertOne) ID

func (u *DiscordUserUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*DiscordUserUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*DiscordUserUpsertOne) Ignore

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.DiscordUser.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*DiscordUserUpsertOne) SetDiscordid

func (u *DiscordUserUpsertOne) SetDiscordid(v string) *DiscordUserUpsertOne

SetDiscordid sets the "discordid" field.

func (*DiscordUserUpsertOne) SetUsername

SetUsername sets the "username" field.

func (*DiscordUserUpsertOne) Update

Update allows overriding fields `UPDATE` values. See the DiscordUserCreate.OnConflict documentation for more info.

func (*DiscordUserUpsertOne) UpdateDiscordid

func (u *DiscordUserUpsertOne) UpdateDiscordid() *DiscordUserUpsertOne

UpdateDiscordid sets the "discordid" field to the value that was provided on create.

func (*DiscordUserUpsertOne) UpdateNewValues

func (u *DiscordUserUpsertOne) UpdateNewValues() *DiscordUserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.DiscordUser.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(discorduser.FieldID)
		}),
	).
	Exec(ctx)

func (*DiscordUserUpsertOne) UpdateUsername

func (u *DiscordUserUpsertOne) UpdateUsername() *DiscordUserUpsertOne

UpdateUsername sets the "username" field to the value that was provided on create.

type DiscordUsers

type DiscordUsers []*DiscordUser

DiscordUsers is a parsable slice of DiscordUser.

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 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 {

	// Book is the client for interacting with the Book builders.
	Book *BookClient
	// BookAuthor is the client for interacting with the BookAuthor builders.
	BookAuthor *BookAuthorClient
	// DiscordMessage is the client for interacting with the DiscordMessage builders.
	DiscordMessage *DiscordMessageClient
	// DiscordUser is the client for interacting with the DiscordUser builders.
	DiscordUser *DiscordUserClient
	// 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