ent

package
v0.0.0-...-b1298dc Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 27 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.
	TypeArtist = "Artist"
	TypeSong   = "Song"
)

Variables

View Source
var DefaultArtistOrder = &ArtistOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &ArtistOrderField{
		Value: func(a *Artist) (ent.Value, error) {
			return a.ID, nil
		},
		column: artist.FieldID,
		toTerm: artist.ByID,
		toCursor: func(a *Artist) Cursor {
			return Cursor{ID: a.ID}
		},
	},
}

DefaultArtistOrder is the default ordering of Artist.

View Source
var DefaultSongOrder = &SongOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &SongOrderField{
		Value: func(s *Song) (ent.Value, error) {
			return s.ID, nil
		},
		column: song.FieldID,
		toTerm: song.ByID,
		toCursor: func(s *Song) Cursor {
			return Cursor{ID: s.ID}
		},
	},
}

DefaultSongOrder is the default ordering of Song.

View Source
var ErrEmptyArtistWhereInput = errors.New("ent: empty predicate ArtistWhereInput")

ErrEmptyArtistWhereInput is returned in case the ArtistWhereInput is empty.

View Source
var ErrEmptySongWhereInput = errors.New("ent: empty predicate SongWhereInput")

ErrEmptySongWhereInput is returned in case the SongWhereInput 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.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

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 Artist

type Artist struct {

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

Artist is the model entity for the Artist schema.

func (*Artist) ExecContext

func (c *Artist) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Artist) IsNode

func (n *Artist) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Artist) NamedSongs

func (a *Artist) NamedSongs(name string) ([]*Song, error)

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

func (*Artist) QueryContext

func (c *Artist) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Artist) QuerySongs

func (a *Artist) QuerySongs() *SongQuery

QuerySongs queries the "songs" edge of the Artist entity.

func (*Artist) Songs

func (a *Artist) Songs(ctx context.Context) (result []*Song, err error)

func (*Artist) String

func (a *Artist) String() string

String implements the fmt.Stringer.

func (*Artist) ToEdge

func (a *Artist) ToEdge(order *ArtistOrder) *ArtistEdge

ToEdge converts Artist into ArtistEdge.

func (*Artist) Unwrap

func (a *Artist) Unwrap() *Artist

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

func (a *Artist) Update() *ArtistUpdateOne

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

func (*Artist) Value

func (a *Artist) Value(name string) (ent.Value, error)

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

type ArtistClient

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

ArtistClient is a client for the Artist schema.

func NewArtistClient

func NewArtistClient(c config) *ArtistClient

NewArtistClient returns a client for the Artist from the given config.

func (*ArtistClient) Create

func (c *ArtistClient) Create() *ArtistCreate

Create returns a builder for creating a Artist entity.

func (*ArtistClient) CreateBulk

func (c *ArtistClient) CreateBulk(builders ...*ArtistCreate) *ArtistCreateBulk

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

func (*ArtistClient) Delete

func (c *ArtistClient) Delete() *ArtistDelete

Delete returns a delete builder for Artist.

func (*ArtistClient) DeleteOne

func (c *ArtistClient) DeleteOne(a *Artist) *ArtistDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ArtistClient) DeleteOneID

func (c *ArtistClient) DeleteOneID(id int) *ArtistDeleteOne

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

func (*ArtistClient) ExecContext

func (c *ArtistClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistClient) Get

func (c *ArtistClient) Get(ctx context.Context, id int) (*Artist, error)

Get returns a Artist entity by its id.

func (*ArtistClient) GetX

func (c *ArtistClient) GetX(ctx context.Context, id int) *Artist

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

func (*ArtistClient) Hooks

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

Hooks returns the client hooks.

func (*ArtistClient) Intercept

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

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

func (*ArtistClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ArtistClient) Query

func (c *ArtistClient) Query() *ArtistQuery

Query returns a query builder for Artist.

func (*ArtistClient) QueryContext

func (c *ArtistClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistClient) QuerySongs

func (c *ArtistClient) QuerySongs(a *Artist) *SongQuery

QuerySongs queries the songs edge of a Artist.

func (*ArtistClient) Update

func (c *ArtistClient) Update() *ArtistUpdate

Update returns an update builder for Artist.

func (*ArtistClient) UpdateOne

func (c *ArtistClient) UpdateOne(a *Artist) *ArtistUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArtistClient) UpdateOneID

func (c *ArtistClient) UpdateOneID(id int) *ArtistUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArtistClient) Use

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

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

type ArtistConnection

type ArtistConnection struct {
	Edges      []*ArtistEdge `json:"edges"`
	PageInfo   PageInfo      `json:"pageInfo"`
	TotalCount int           `json:"totalCount"`
}

ArtistConnection is the connection containing edges to Artist.

type ArtistCreate

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

ArtistCreate is the builder for creating a Artist entity.

func (*ArtistCreate) AddSongIDs

func (ac *ArtistCreate) AddSongIDs(ids ...int) *ArtistCreate

AddSongIDs adds the "songs" edge to the Song entity by IDs.

func (*ArtistCreate) AddSongs

func (ac *ArtistCreate) AddSongs(s ...*Song) *ArtistCreate

AddSongs adds the "songs" edges to the Song entity.

func (*ArtistCreate) Exec

func (ac *ArtistCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArtistCreate) ExecContext

func (c *ArtistCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistCreate) ExecX

func (ac *ArtistCreate) ExecX(ctx context.Context)

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

func (*ArtistCreate) Mutation

func (ac *ArtistCreate) Mutation() *ArtistMutation

Mutation returns the ArtistMutation object of the builder.

func (*ArtistCreate) QueryContext

func (c *ArtistCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistCreate) Save

func (ac *ArtistCreate) Save(ctx context.Context) (*Artist, error)

Save creates the Artist in the database.

func (*ArtistCreate) SaveX

func (ac *ArtistCreate) SaveX(ctx context.Context) *Artist

SaveX calls Save and panics if Save returns an error.

func (*ArtistCreate) SetID

func (ac *ArtistCreate) SetID(i int) *ArtistCreate

SetID sets the "id" field.

func (*ArtistCreate) SetName

func (ac *ArtistCreate) SetName(s string) *ArtistCreate

SetName sets the "name" field.

type ArtistCreateBulk

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

ArtistCreateBulk is the builder for creating many Artist entities in bulk.

func (*ArtistCreateBulk) Exec

func (acb *ArtistCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ArtistCreateBulk) ExecContext

func (c *ArtistCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistCreateBulk) ExecX

func (acb *ArtistCreateBulk) ExecX(ctx context.Context)

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

func (*ArtistCreateBulk) QueryContext

func (c *ArtistCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistCreateBulk) Save

func (acb *ArtistCreateBulk) Save(ctx context.Context) ([]*Artist, error)

Save creates the Artist entities in the database.

func (*ArtistCreateBulk) SaveX

func (acb *ArtistCreateBulk) SaveX(ctx context.Context) []*Artist

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

type ArtistDelete

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

ArtistDelete is the builder for deleting a Artist entity.

func (*ArtistDelete) Exec

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

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

func (*ArtistDelete) ExecContext

func (c *ArtistDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistDelete) ExecX

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

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

func (*ArtistDelete) QueryContext

func (c *ArtistDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistDelete) Where

func (ad *ArtistDelete) Where(ps ...predicate.Artist) *ArtistDelete

Where appends a list predicates to the ArtistDelete builder.

type ArtistDeleteOne

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

ArtistDeleteOne is the builder for deleting a single Artist entity.

func (*ArtistDeleteOne) Exec

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

Exec executes the deletion query.

func (*ArtistDeleteOne) ExecX

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

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

func (*ArtistDeleteOne) Where

func (ado *ArtistDeleteOne) Where(ps ...predicate.Artist) *ArtistDeleteOne

Where appends a list predicates to the ArtistDelete builder.

type ArtistEdge

type ArtistEdge struct {
	Node   *Artist `json:"node"`
	Cursor Cursor  `json:"cursor"`
}

ArtistEdge is the edge representation of Artist.

type ArtistEdges

type ArtistEdges struct {
	// Songs holds the value of the songs edge.
	Songs []*Song `json:"songs,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArtistEdges) SongsOrErr

func (e ArtistEdges) SongsOrErr() ([]*Song, error)

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

type ArtistGroupBy

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

ArtistGroupBy is the group-by builder for Artist entities.

func (*ArtistGroupBy) Aggregate

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

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

func (*ArtistGroupBy) Bool

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

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

func (*ArtistGroupBy) BoolX

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

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

func (*ArtistGroupBy) Bools

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

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

func (*ArtistGroupBy) BoolsX

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

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

func (*ArtistGroupBy) Float64

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

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

func (*ArtistGroupBy) Float64X

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

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

func (*ArtistGroupBy) Float64s

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

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

func (*ArtistGroupBy) Float64sX

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

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

func (*ArtistGroupBy) Int

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

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

func (*ArtistGroupBy) IntX

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

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

func (*ArtistGroupBy) Ints

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

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

func (*ArtistGroupBy) IntsX

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

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

func (*ArtistGroupBy) Scan

func (agb *ArtistGroupBy) Scan(ctx context.Context, v any) error

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

func (*ArtistGroupBy) ScanX

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

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

func (*ArtistGroupBy) String

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

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

func (*ArtistGroupBy) StringX

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

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

func (*ArtistGroupBy) Strings

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

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

func (*ArtistGroupBy) StringsX

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

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

type ArtistMutation

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

ArtistMutation represents an operation that mutates the Artist nodes in the graph.

func (*ArtistMutation) AddField

func (m *ArtistMutation) 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 (*ArtistMutation) AddSongIDs

func (m *ArtistMutation) AddSongIDs(ids ...int)

AddSongIDs adds the "songs" edge to the Song entity by ids.

func (*ArtistMutation) AddedEdges

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

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

func (*ArtistMutation) AddedField

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

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

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

func (*ArtistMutation) AddedIDs

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

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

func (*ArtistMutation) ClearEdge

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

func (m *ArtistMutation) 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 (*ArtistMutation) ClearSongs

func (m *ArtistMutation) ClearSongs()

ClearSongs clears the "songs" edge to the Song entity.

func (*ArtistMutation) ClearedEdges

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

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

func (*ArtistMutation) ClearedFields

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

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

func (ArtistMutation) Client

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

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

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

func (*ArtistMutation) ExecContext

func (c *ArtistMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistMutation) Field

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

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

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

func (*ArtistMutation) Fields

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

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

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

func (*ArtistMutation) IDs

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

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

func (*ArtistMutation) Name

func (m *ArtistMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ArtistMutation) OldField

func (m *ArtistMutation) 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 (*ArtistMutation) OldName

func (m *ArtistMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Artist entity. If the Artist 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 (*ArtistMutation) Op

func (m *ArtistMutation) Op() Op

Op returns the operation name.

func (*ArtistMutation) QueryContext

func (c *ArtistMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistMutation) RemoveSongIDs

func (m *ArtistMutation) RemoveSongIDs(ids ...int)

RemoveSongIDs removes the "songs" edge to the Song entity by IDs.

func (*ArtistMutation) RemovedEdges

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

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

func (*ArtistMutation) RemovedIDs

func (m *ArtistMutation) 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 (*ArtistMutation) RemovedSongsIDs

func (m *ArtistMutation) RemovedSongsIDs() (ids []int)

RemovedSongs returns the removed IDs of the "songs" edge to the Song entity.

func (*ArtistMutation) ResetEdge

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

func (m *ArtistMutation) 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 (*ArtistMutation) ResetName

func (m *ArtistMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ArtistMutation) ResetSongs

func (m *ArtistMutation) ResetSongs()

ResetSongs resets all changes to the "songs" edge.

func (*ArtistMutation) SetField

func (m *ArtistMutation) 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 (*ArtistMutation) SetID

func (m *ArtistMutation) SetID(id int)

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

func (*ArtistMutation) SetName

func (m *ArtistMutation) SetName(s string)

SetName sets the "name" field.

func (*ArtistMutation) SetOp

func (m *ArtistMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ArtistMutation) SongsCleared

func (m *ArtistMutation) SongsCleared() bool

SongsCleared reports if the "songs" edge to the Song entity was cleared.

func (*ArtistMutation) SongsIDs

func (m *ArtistMutation) SongsIDs() (ids []int)

SongsIDs returns the "songs" edge IDs in the mutation.

func (ArtistMutation) Tx

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

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

func (*ArtistMutation) Type

func (m *ArtistMutation) Type() string

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

func (*ArtistMutation) Where

func (m *ArtistMutation) Where(ps ...predicate.Artist)

Where appends a list predicates to the ArtistMutation builder.

func (*ArtistMutation) WhereP

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

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

type ArtistOrder

type ArtistOrder struct {
	Direction OrderDirection    `json:"direction"`
	Field     *ArtistOrderField `json:"field"`
}

ArtistOrder defines the ordering of Artist.

type ArtistOrderField

type ArtistOrderField struct {
	// Value extracts the ordering value from the given Artist.
	Value func(*Artist) (ent.Value, error)
	// contains filtered or unexported fields
}

ArtistOrderField defines the ordering field of Artist.

type ArtistPaginateOption

type ArtistPaginateOption func(*artistPager) error

ArtistPaginateOption enables pagination customization.

func WithArtistFilter

func WithArtistFilter(filter func(*ArtistQuery) (*ArtistQuery, error)) ArtistPaginateOption

WithArtistFilter configures pagination filter.

func WithArtistOrder

func WithArtistOrder(order *ArtistOrder) ArtistPaginateOption

WithArtistOrder configures pagination ordering.

type ArtistQuery

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

ArtistQuery is the builder for querying Artist entities.

func (*ArtistQuery) Aggregate

func (aq *ArtistQuery) Aggregate(fns ...AggregateFunc) *ArtistSelect

Aggregate returns a ArtistSelect configured with the given aggregations.

func (*ArtistQuery) All

func (aq *ArtistQuery) All(ctx context.Context) ([]*Artist, error)

All executes the query and returns a list of Artists.

func (*ArtistQuery) AllX

func (aq *ArtistQuery) AllX(ctx context.Context) []*Artist

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

func (*ArtistQuery) Clone

func (aq *ArtistQuery) Clone() *ArtistQuery

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

func (*ArtistQuery) CollectFields

func (a *ArtistQuery) CollectFields(ctx context.Context, satisfies ...string) (*ArtistQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*ArtistQuery) Count

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

Count returns the count of the given query.

func (*ArtistQuery) CountX

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

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

func (*ArtistQuery) ExecContext

func (c *ArtistQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistQuery) Exist

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

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

func (*ArtistQuery) ExistX

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

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

func (*ArtistQuery) First

func (aq *ArtistQuery) First(ctx context.Context) (*Artist, error)

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

func (*ArtistQuery) FirstID

func (aq *ArtistQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ArtistQuery) FirstIDX

func (aq *ArtistQuery) FirstIDX(ctx context.Context) int

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

func (*ArtistQuery) FirstX

func (aq *ArtistQuery) FirstX(ctx context.Context) *Artist

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

func (*ArtistQuery) GroupBy

func (aq *ArtistQuery) GroupBy(field string, fields ...string) *ArtistGroupBy

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

client.Artist.Query().
	GroupBy(artist.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArtistQuery) IDs

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

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

func (*ArtistQuery) IDsX

func (aq *ArtistQuery) IDsX(ctx context.Context) []int

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

func (*ArtistQuery) Limit

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

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

func (*ArtistQuery) Offset

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

Offset to start from.

func (*ArtistQuery) Only

func (aq *ArtistQuery) Only(ctx context.Context) (*Artist, error)

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

func (*ArtistQuery) OnlyID

func (aq *ArtistQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*ArtistQuery) OnlyIDX

func (aq *ArtistQuery) OnlyIDX(ctx context.Context) int

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

func (*ArtistQuery) OnlyX

func (aq *ArtistQuery) OnlyX(ctx context.Context) *Artist

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

func (*ArtistQuery) Order

func (aq *ArtistQuery) Order(o ...artist.OrderOption) *ArtistQuery

Order specifies how the records should be ordered.

func (*ArtistQuery) Paginate

func (a *ArtistQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...ArtistPaginateOption,
) (*ArtistConnection, error)

Paginate executes the query and returns a relay based cursor connection to Artist.

func (*ArtistQuery) QueryContext

func (c *ArtistQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistQuery) QuerySongs

func (aq *ArtistQuery) QuerySongs() *SongQuery

QuerySongs chains the current query on the "songs" edge.

func (*ArtistQuery) Select

func (aq *ArtistQuery) Select(fields ...string) *ArtistSelect

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

client.Artist.Query().
	Select(artist.FieldName).
	Scan(ctx, &v)

func (*ArtistQuery) Unique

func (aq *ArtistQuery) Unique(unique bool) *ArtistQuery

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

func (aq *ArtistQuery) Where(ps ...predicate.Artist) *ArtistQuery

Where adds a new predicate for the ArtistQuery builder.

func (*ArtistQuery) WithNamedSongs

func (aq *ArtistQuery) WithNamedSongs(name string, opts ...func(*SongQuery)) *ArtistQuery

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

func (*ArtistQuery) WithSongs

func (aq *ArtistQuery) WithSongs(opts ...func(*SongQuery)) *ArtistQuery

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

type ArtistSelect

type ArtistSelect struct {
	*ArtistQuery
	// contains filtered or unexported fields
}

ArtistSelect is the builder for selecting fields of Artist entities.

func (*ArtistSelect) Aggregate

func (as *ArtistSelect) Aggregate(fns ...AggregateFunc) *ArtistSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ArtistSelect) Bool

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

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

func (*ArtistSelect) BoolX

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

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

func (*ArtistSelect) Bools

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

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

func (*ArtistSelect) BoolsX

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

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

func (ArtistSelect) ExecContext

func (c ArtistSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistSelect) Float64

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

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

func (*ArtistSelect) Float64X

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

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

func (*ArtistSelect) Float64s

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

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

func (*ArtistSelect) Float64sX

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

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

func (*ArtistSelect) Int

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

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

func (*ArtistSelect) IntX

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

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

func (*ArtistSelect) Ints

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

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

func (*ArtistSelect) IntsX

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

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

func (ArtistSelect) QueryContext

func (c ArtistSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistSelect) Scan

func (as *ArtistSelect) Scan(ctx context.Context, v any) error

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

func (*ArtistSelect) ScanX

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

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

func (*ArtistSelect) String

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

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

func (*ArtistSelect) StringX

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

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

func (*ArtistSelect) Strings

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

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

func (*ArtistSelect) StringsX

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

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

type ArtistUpdate

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

ArtistUpdate is the builder for updating Artist entities.

func (*ArtistUpdate) AddSongIDs

func (au *ArtistUpdate) AddSongIDs(ids ...int) *ArtistUpdate

AddSongIDs adds the "songs" edge to the Song entity by IDs.

func (*ArtistUpdate) AddSongs

func (au *ArtistUpdate) AddSongs(s ...*Song) *ArtistUpdate

AddSongs adds the "songs" edges to the Song entity.

func (*ArtistUpdate) ClearSongs

func (au *ArtistUpdate) ClearSongs() *ArtistUpdate

ClearSongs clears all "songs" edges to the Song entity.

func (*ArtistUpdate) Exec

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

Exec executes the query.

func (*ArtistUpdate) ExecContext

func (c *ArtistUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistUpdate) ExecX

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

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

func (*ArtistUpdate) Mutation

func (au *ArtistUpdate) Mutation() *ArtistMutation

Mutation returns the ArtistMutation object of the builder.

func (*ArtistUpdate) QueryContext

func (c *ArtistUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistUpdate) RemoveSongIDs

func (au *ArtistUpdate) RemoveSongIDs(ids ...int) *ArtistUpdate

RemoveSongIDs removes the "songs" edge to Song entities by IDs.

func (*ArtistUpdate) RemoveSongs

func (au *ArtistUpdate) RemoveSongs(s ...*Song) *ArtistUpdate

RemoveSongs removes "songs" edges to Song entities.

func (*ArtistUpdate) Save

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

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

func (*ArtistUpdate) SaveX

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

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

func (*ArtistUpdate) SetName

func (au *ArtistUpdate) SetName(s string) *ArtistUpdate

SetName sets the "name" field.

func (*ArtistUpdate) Where

func (au *ArtistUpdate) Where(ps ...predicate.Artist) *ArtistUpdate

Where appends a list predicates to the ArtistUpdate builder.

type ArtistUpdateOne

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

ArtistUpdateOne is the builder for updating a single Artist entity.

func (*ArtistUpdateOne) AddSongIDs

func (auo *ArtistUpdateOne) AddSongIDs(ids ...int) *ArtistUpdateOne

AddSongIDs adds the "songs" edge to the Song entity by IDs.

func (*ArtistUpdateOne) AddSongs

func (auo *ArtistUpdateOne) AddSongs(s ...*Song) *ArtistUpdateOne

AddSongs adds the "songs" edges to the Song entity.

func (*ArtistUpdateOne) ClearSongs

func (auo *ArtistUpdateOne) ClearSongs() *ArtistUpdateOne

ClearSongs clears all "songs" edges to the Song entity.

func (*ArtistUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ArtistUpdateOne) ExecContext

func (c *ArtistUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArtistUpdateOne) ExecX

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

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

func (*ArtistUpdateOne) Mutation

func (auo *ArtistUpdateOne) Mutation() *ArtistMutation

Mutation returns the ArtistMutation object of the builder.

func (*ArtistUpdateOne) QueryContext

func (c *ArtistUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArtistUpdateOne) RemoveSongIDs

func (auo *ArtistUpdateOne) RemoveSongIDs(ids ...int) *ArtistUpdateOne

RemoveSongIDs removes the "songs" edge to Song entities by IDs.

func (*ArtistUpdateOne) RemoveSongs

func (auo *ArtistUpdateOne) RemoveSongs(s ...*Song) *ArtistUpdateOne

RemoveSongs removes "songs" edges to Song entities.

func (*ArtistUpdateOne) Save

func (auo *ArtistUpdateOne) Save(ctx context.Context) (*Artist, error)

Save executes the query and returns the updated Artist entity.

func (*ArtistUpdateOne) SaveX

func (auo *ArtistUpdateOne) SaveX(ctx context.Context) *Artist

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

func (*ArtistUpdateOne) Select

func (auo *ArtistUpdateOne) Select(field string, fields ...string) *ArtistUpdateOne

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

func (*ArtistUpdateOne) SetName

func (auo *ArtistUpdateOne) SetName(s string) *ArtistUpdateOne

SetName sets the "name" field.

func (*ArtistUpdateOne) Where

func (auo *ArtistUpdateOne) Where(ps ...predicate.Artist) *ArtistUpdateOne

Where appends a list predicates to the ArtistUpdate builder.

type ArtistWhereInput

type ArtistWhereInput struct {
	Predicates []predicate.Artist  `json:"-"`
	Not        *ArtistWhereInput   `json:"not,omitempty"`
	Or         []*ArtistWhereInput `json:"or,omitempty"`
	And        []*ArtistWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID      *int  `json:"id,omitempty"`
	IDNEQ   *int  `json:"idNEQ,omitempty"`
	IDIn    []int `json:"idIn,omitempty"`
	IDNotIn []int `json:"idNotIn,omitempty"`
	IDGT    *int  `json:"idGT,omitempty"`
	IDGTE   *int  `json:"idGTE,omitempty"`
	IDLT    *int  `json:"idLT,omitempty"`
	IDLTE   *int  `json:"idLTE,omitempty"`

	// "name" field predicates.
	Name             *string  `json:"name,omitempty"`
	NameNEQ          *string  `json:"nameNEQ,omitempty"`
	NameIn           []string `json:"nameIn,omitempty"`
	NameNotIn        []string `json:"nameNotIn,omitempty"`
	NameGT           *string  `json:"nameGT,omitempty"`
	NameGTE          *string  `json:"nameGTE,omitempty"`
	NameLT           *string  `json:"nameLT,omitempty"`
	NameLTE          *string  `json:"nameLTE,omitempty"`
	NameContains     *string  `json:"nameContains,omitempty"`
	NameHasPrefix    *string  `json:"nameHasPrefix,omitempty"`
	NameHasSuffix    *string  `json:"nameHasSuffix,omitempty"`
	NameEqualFold    *string  `json:"nameEqualFold,omitempty"`
	NameContainsFold *string  `json:"nameContainsFold,omitempty"`

	// "songs" edge predicates.
	HasSongs     *bool             `json:"hasSongs,omitempty"`
	HasSongsWith []*SongWhereInput `json:"hasSongsWith,omitempty"`
}

ArtistWhereInput represents a where input for filtering Artist queries.

func (*ArtistWhereInput) AddPredicates

func (i *ArtistWhereInput) AddPredicates(predicates ...predicate.Artist)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*ArtistWhereInput) Filter

func (i *ArtistWhereInput) Filter(q *ArtistQuery) (*ArtistQuery, error)

Filter applies the ArtistWhereInput filter on the ArtistQuery builder.

func (*ArtistWhereInput) P

P returns a predicate for filtering artists. An error is returned if the input is empty or invalid.

type Artists

type Artists []*Artist

Artists is a parsable slice of Artist.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Artist is the client for interacting with the Artist builders.
	Artist *ArtistClient
	// Song is the client for interacting with the Song builders.
	Song *SongClient
	// 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().
	Artist.
	Query().
	Count(ctx)

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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

func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(typeResolver))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

func (*Client) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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 Cursor

type Cursor = entgql.Cursor[int]

Common entgql types.

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 NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, int) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	IsNode()
}

Noder wraps the basic Node method.

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 OrderDirection

type OrderDirection = entgql.OrderDirection

Common entgql types.

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 PageInfo

type PageInfo = entgql.PageInfo[int]

Common entgql types.

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 Song

type Song struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// ReleasedYear holds the value of the "released_year" field.
	ReleasedYear int `json:"released_year,omitempty"`
	// ArtistID holds the value of the "artist_id" field.
	ArtistID int `json:"artist_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SongQuery when eager-loading is set.
	Edges SongEdges `json:"edges"`
	// contains filtered or unexported fields
}

Song is the model entity for the Song schema.

func (*Song) Artist

func (s *Song) Artist(ctx context.Context) (*Artist, error)

func (*Song) ExecContext

func (c *Song) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Song) IsNode

func (n *Song) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Song) QueryArtist

func (s *Song) QueryArtist() *ArtistQuery

QueryArtist queries the "artist" edge of the Song entity.

func (*Song) QueryContext

func (c *Song) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Song) String

func (s *Song) String() string

String implements the fmt.Stringer.

func (*Song) ToEdge

func (s *Song) ToEdge(order *SongOrder) *SongEdge

ToEdge converts Song into SongEdge.

func (*Song) Unwrap

func (s *Song) Unwrap() *Song

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

func (s *Song) Update() *SongUpdateOne

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

func (*Song) Value

func (s *Song) Value(name string) (ent.Value, error)

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

type SongClient

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

SongClient is a client for the Song schema.

func NewSongClient

func NewSongClient(c config) *SongClient

NewSongClient returns a client for the Song from the given config.

func (*SongClient) Create

func (c *SongClient) Create() *SongCreate

Create returns a builder for creating a Song entity.

func (*SongClient) CreateBulk

func (c *SongClient) CreateBulk(builders ...*SongCreate) *SongCreateBulk

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

func (*SongClient) Delete

func (c *SongClient) Delete() *SongDelete

Delete returns a delete builder for Song.

func (*SongClient) DeleteOne

func (c *SongClient) DeleteOne(s *Song) *SongDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SongClient) DeleteOneID

func (c *SongClient) DeleteOneID(id int) *SongDeleteOne

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

func (*SongClient) ExecContext

func (c *SongClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongClient) Get

func (c *SongClient) Get(ctx context.Context, id int) (*Song, error)

Get returns a Song entity by its id.

func (*SongClient) GetX

func (c *SongClient) GetX(ctx context.Context, id int) *Song

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

func (*SongClient) Hooks

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

Hooks returns the client hooks.

func (*SongClient) Intercept

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

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

func (*SongClient) Interceptors

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

Interceptors returns the client interceptors.

func (*SongClient) Query

func (c *SongClient) Query() *SongQuery

Query returns a query builder for Song.

func (*SongClient) QueryArtist

func (c *SongClient) QueryArtist(s *Song) *ArtistQuery

QueryArtist queries the artist edge of a Song.

func (*SongClient) QueryContext

func (c *SongClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongClient) Update

func (c *SongClient) Update() *SongUpdate

Update returns an update builder for Song.

func (*SongClient) UpdateOne

func (c *SongClient) UpdateOne(s *Song) *SongUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SongClient) UpdateOneID

func (c *SongClient) UpdateOneID(id int) *SongUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SongClient) Use

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

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

type SongConnection

type SongConnection struct {
	Edges      []*SongEdge `json:"edges"`
	PageInfo   PageInfo    `json:"pageInfo"`
	TotalCount int         `json:"totalCount"`
}

SongConnection is the connection containing edges to Song.

type SongCreate

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

SongCreate is the builder for creating a Song entity.

func (*SongCreate) Exec

func (sc *SongCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SongCreate) ExecContext

func (c *SongCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongCreate) ExecX

func (sc *SongCreate) ExecX(ctx context.Context)

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

func (*SongCreate) Mutation

func (sc *SongCreate) Mutation() *SongMutation

Mutation returns the SongMutation object of the builder.

func (*SongCreate) QueryContext

func (c *SongCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongCreate) Save

func (sc *SongCreate) Save(ctx context.Context) (*Song, error)

Save creates the Song in the database.

func (*SongCreate) SaveX

func (sc *SongCreate) SaveX(ctx context.Context) *Song

SaveX calls Save and panics if Save returns an error.

func (*SongCreate) SetArtist

func (sc *SongCreate) SetArtist(a *Artist) *SongCreate

SetArtist sets the "artist" edge to the Artist entity.

func (*SongCreate) SetArtistID

func (sc *SongCreate) SetArtistID(i int) *SongCreate

SetArtistID sets the "artist_id" field.

func (*SongCreate) SetID

func (sc *SongCreate) SetID(i int) *SongCreate

SetID sets the "id" field.

func (*SongCreate) SetReleasedYear

func (sc *SongCreate) SetReleasedYear(i int) *SongCreate

SetReleasedYear sets the "released_year" field.

func (*SongCreate) SetTitle

func (sc *SongCreate) SetTitle(s string) *SongCreate

SetTitle sets the "title" field.

type SongCreateBulk

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

SongCreateBulk is the builder for creating many Song entities in bulk.

func (*SongCreateBulk) Exec

func (scb *SongCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SongCreateBulk) ExecContext

func (c *SongCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongCreateBulk) ExecX

func (scb *SongCreateBulk) ExecX(ctx context.Context)

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

func (*SongCreateBulk) QueryContext

func (c *SongCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongCreateBulk) Save

func (scb *SongCreateBulk) Save(ctx context.Context) ([]*Song, error)

Save creates the Song entities in the database.

func (*SongCreateBulk) SaveX

func (scb *SongCreateBulk) SaveX(ctx context.Context) []*Song

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

type SongDelete

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

SongDelete is the builder for deleting a Song entity.

func (*SongDelete) Exec

func (sd *SongDelete) Exec(ctx context.Context) (int, error)

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

func (*SongDelete) ExecContext

func (c *SongDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongDelete) ExecX

func (sd *SongDelete) ExecX(ctx context.Context) int

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

func (*SongDelete) QueryContext

func (c *SongDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongDelete) Where

func (sd *SongDelete) Where(ps ...predicate.Song) *SongDelete

Where appends a list predicates to the SongDelete builder.

type SongDeleteOne

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

SongDeleteOne is the builder for deleting a single Song entity.

func (*SongDeleteOne) Exec

func (sdo *SongDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SongDeleteOne) ExecX

func (sdo *SongDeleteOne) ExecX(ctx context.Context)

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

func (*SongDeleteOne) Where

func (sdo *SongDeleteOne) Where(ps ...predicate.Song) *SongDeleteOne

Where appends a list predicates to the SongDelete builder.

type SongEdge

type SongEdge struct {
	Node   *Song  `json:"node"`
	Cursor Cursor `json:"cursor"`
}

SongEdge is the edge representation of Song.

type SongEdges

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

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

func (SongEdges) ArtistOrErr

func (e SongEdges) ArtistOrErr() (*Artist, error)

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

type SongGroupBy

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

SongGroupBy is the group-by builder for Song entities.

func (*SongGroupBy) Aggregate

func (sgb *SongGroupBy) Aggregate(fns ...AggregateFunc) *SongGroupBy

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

func (*SongGroupBy) Bool

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

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

func (*SongGroupBy) BoolX

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

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

func (*SongGroupBy) Bools

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

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

func (*SongGroupBy) BoolsX

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

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

func (*SongGroupBy) Float64

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

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

func (*SongGroupBy) Float64X

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

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

func (*SongGroupBy) Float64s

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

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

func (*SongGroupBy) Float64sX

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

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

func (*SongGroupBy) Int

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

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

func (*SongGroupBy) IntX

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

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

func (*SongGroupBy) Ints

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

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

func (*SongGroupBy) IntsX

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

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

func (*SongGroupBy) Scan

func (sgb *SongGroupBy) Scan(ctx context.Context, v any) error

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

func (*SongGroupBy) ScanX

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

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

func (*SongGroupBy) String

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

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

func (*SongGroupBy) StringX

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

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

func (*SongGroupBy) Strings

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

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

func (*SongGroupBy) StringsX

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

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

type SongMutation

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

SongMutation represents an operation that mutates the Song nodes in the graph.

func (*SongMutation) AddField

func (m *SongMutation) 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 (*SongMutation) AddReleasedYear

func (m *SongMutation) AddReleasedYear(i int)

AddReleasedYear adds i to the "released_year" field.

func (*SongMutation) AddedEdges

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

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

func (*SongMutation) AddedField

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

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

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

func (*SongMutation) AddedIDs

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

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

func (*SongMutation) AddedReleasedYear

func (m *SongMutation) AddedReleasedYear() (r int, exists bool)

AddedReleasedYear returns the value that was added to the "released_year" field in this mutation.

func (*SongMutation) ArtistCleared

func (m *SongMutation) ArtistCleared() bool

ArtistCleared reports if the "artist" edge to the Artist entity was cleared.

func (*SongMutation) ArtistID

func (m *SongMutation) ArtistID() (r int, exists bool)

ArtistID returns the value of the "artist_id" field in the mutation.

func (*SongMutation) ArtistIDs

func (m *SongMutation) ArtistIDs() (ids []int)

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

func (*SongMutation) ClearArtist

func (m *SongMutation) ClearArtist()

ClearArtist clears the "artist" edge to the Artist entity.

func (*SongMutation) ClearEdge

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

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

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

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

func (*SongMutation) ClearedFields

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

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

func (SongMutation) Client

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

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

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

func (*SongMutation) ExecContext

func (c *SongMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongMutation) Field

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

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

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

func (*SongMutation) Fields

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

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

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

func (*SongMutation) IDs

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

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

func (*SongMutation) OldArtistID

func (m *SongMutation) OldArtistID(ctx context.Context) (v int, err error)

OldArtistID returns the old "artist_id" field's value of the Song entity. If the Song 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 (*SongMutation) OldField

func (m *SongMutation) 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 (*SongMutation) OldReleasedYear

func (m *SongMutation) OldReleasedYear(ctx context.Context) (v int, err error)

OldReleasedYear returns the old "released_year" field's value of the Song entity. If the Song 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 (*SongMutation) OldTitle

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

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

func (m *SongMutation) Op() Op

Op returns the operation name.

func (*SongMutation) QueryContext

func (c *SongMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongMutation) ReleasedYear

func (m *SongMutation) ReleasedYear() (r int, exists bool)

ReleasedYear returns the value of the "released_year" field in the mutation.

func (*SongMutation) RemovedEdges

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

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

func (*SongMutation) RemovedIDs

func (m *SongMutation) 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 (*SongMutation) ResetArtist

func (m *SongMutation) ResetArtist()

ResetArtist resets all changes to the "artist" edge.

func (*SongMutation) ResetArtistID

func (m *SongMutation) ResetArtistID()

ResetArtistID resets all changes to the "artist_id" field.

func (*SongMutation) ResetEdge

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

func (m *SongMutation) 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 (*SongMutation) ResetReleasedYear

func (m *SongMutation) ResetReleasedYear()

ResetReleasedYear resets all changes to the "released_year" field.

func (*SongMutation) ResetTitle

func (m *SongMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*SongMutation) SetArtistID

func (m *SongMutation) SetArtistID(i int)

SetArtistID sets the "artist_id" field.

func (*SongMutation) SetField

func (m *SongMutation) 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 (*SongMutation) SetID

func (m *SongMutation) SetID(id int)

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

func (*SongMutation) SetOp

func (m *SongMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SongMutation) SetReleasedYear

func (m *SongMutation) SetReleasedYear(i int)

SetReleasedYear sets the "released_year" field.

func (*SongMutation) SetTitle

func (m *SongMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*SongMutation) Title

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

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

func (SongMutation) Tx

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

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

func (*SongMutation) Type

func (m *SongMutation) Type() string

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

func (*SongMutation) Where

func (m *SongMutation) Where(ps ...predicate.Song)

Where appends a list predicates to the SongMutation builder.

func (*SongMutation) WhereP

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

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

type SongOrder

type SongOrder struct {
	Direction OrderDirection  `json:"direction"`
	Field     *SongOrderField `json:"field"`
}

SongOrder defines the ordering of Song.

type SongOrderField

type SongOrderField struct {
	// Value extracts the ordering value from the given Song.
	Value func(*Song) (ent.Value, error)
	// contains filtered or unexported fields
}

SongOrderField defines the ordering field of Song.

type SongPaginateOption

type SongPaginateOption func(*songPager) error

SongPaginateOption enables pagination customization.

func WithSongFilter

func WithSongFilter(filter func(*SongQuery) (*SongQuery, error)) SongPaginateOption

WithSongFilter configures pagination filter.

func WithSongOrder

func WithSongOrder(order *SongOrder) SongPaginateOption

WithSongOrder configures pagination ordering.

type SongQuery

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

SongQuery is the builder for querying Song entities.

func (*SongQuery) Aggregate

func (sq *SongQuery) Aggregate(fns ...AggregateFunc) *SongSelect

Aggregate returns a SongSelect configured with the given aggregations.

func (*SongQuery) All

func (sq *SongQuery) All(ctx context.Context) ([]*Song, error)

All executes the query and returns a list of Songs.

func (*SongQuery) AllX

func (sq *SongQuery) AllX(ctx context.Context) []*Song

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

func (*SongQuery) Clone

func (sq *SongQuery) Clone() *SongQuery

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

func (*SongQuery) CollectFields

func (s *SongQuery) CollectFields(ctx context.Context, satisfies ...string) (*SongQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*SongQuery) Count

func (sq *SongQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SongQuery) CountX

func (sq *SongQuery) CountX(ctx context.Context) int

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

func (*SongQuery) ExecContext

func (c *SongQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongQuery) Exist

func (sq *SongQuery) Exist(ctx context.Context) (bool, error)

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

func (*SongQuery) ExistX

func (sq *SongQuery) ExistX(ctx context.Context) bool

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

func (*SongQuery) First

func (sq *SongQuery) First(ctx context.Context) (*Song, error)

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

func (*SongQuery) FirstID

func (sq *SongQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SongQuery) FirstIDX

func (sq *SongQuery) FirstIDX(ctx context.Context) int

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

func (*SongQuery) FirstX

func (sq *SongQuery) FirstX(ctx context.Context) *Song

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

func (*SongQuery) GroupBy

func (sq *SongQuery) GroupBy(field string, fields ...string) *SongGroupBy

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.Song.Query().
	GroupBy(song.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SongQuery) IDs

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

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

func (*SongQuery) IDsX

func (sq *SongQuery) IDsX(ctx context.Context) []int

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

func (*SongQuery) Limit

func (sq *SongQuery) Limit(limit int) *SongQuery

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

func (*SongQuery) Offset

func (sq *SongQuery) Offset(offset int) *SongQuery

Offset to start from.

func (*SongQuery) Only

func (sq *SongQuery) Only(ctx context.Context) (*Song, error)

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

func (*SongQuery) OnlyID

func (sq *SongQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SongQuery) OnlyIDX

func (sq *SongQuery) OnlyIDX(ctx context.Context) int

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

func (*SongQuery) OnlyX

func (sq *SongQuery) OnlyX(ctx context.Context) *Song

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

func (*SongQuery) Order

func (sq *SongQuery) Order(o ...song.OrderOption) *SongQuery

Order specifies how the records should be ordered.

func (*SongQuery) Paginate

func (s *SongQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...SongPaginateOption,
) (*SongConnection, error)

Paginate executes the query and returns a relay based cursor connection to Song.

func (*SongQuery) QueryArtist

func (sq *SongQuery) QueryArtist() *ArtistQuery

QueryArtist chains the current query on the "artist" edge.

func (*SongQuery) QueryContext

func (c *SongQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongQuery) Select

func (sq *SongQuery) Select(fields ...string) *SongSelect

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.Song.Query().
	Select(song.FieldTitle).
	Scan(ctx, &v)

func (*SongQuery) Unique

func (sq *SongQuery) Unique(unique bool) *SongQuery

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

func (sq *SongQuery) Where(ps ...predicate.Song) *SongQuery

Where adds a new predicate for the SongQuery builder.

func (*SongQuery) WithArtist

func (sq *SongQuery) WithArtist(opts ...func(*ArtistQuery)) *SongQuery

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

type SongSelect

type SongSelect struct {
	*SongQuery
	// contains filtered or unexported fields
}

SongSelect is the builder for selecting fields of Song entities.

func (*SongSelect) Aggregate

func (ss *SongSelect) Aggregate(fns ...AggregateFunc) *SongSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SongSelect) Bool

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

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

func (*SongSelect) BoolX

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

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

func (*SongSelect) Bools

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

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

func (*SongSelect) BoolsX

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

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

func (SongSelect) ExecContext

func (c SongSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongSelect) Float64

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

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

func (*SongSelect) Float64X

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

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

func (*SongSelect) Float64s

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

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

func (*SongSelect) Float64sX

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

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

func (*SongSelect) Int

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

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

func (*SongSelect) IntX

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

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

func (*SongSelect) Ints

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

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

func (*SongSelect) IntsX

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

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

func (SongSelect) QueryContext

func (c SongSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongSelect) Scan

func (ss *SongSelect) Scan(ctx context.Context, v any) error

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

func (*SongSelect) ScanX

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

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

func (*SongSelect) String

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

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

func (*SongSelect) StringX

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

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

func (*SongSelect) Strings

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

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

func (*SongSelect) StringsX

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

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

type SongUpdate

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

SongUpdate is the builder for updating Song entities.

func (*SongUpdate) AddReleasedYear

func (su *SongUpdate) AddReleasedYear(i int) *SongUpdate

AddReleasedYear adds i to the "released_year" field.

func (*SongUpdate) ClearArtist

func (su *SongUpdate) ClearArtist() *SongUpdate

ClearArtist clears the "artist" edge to the Artist entity.

func (*SongUpdate) Exec

func (su *SongUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SongUpdate) ExecContext

func (c *SongUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongUpdate) ExecX

func (su *SongUpdate) ExecX(ctx context.Context)

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

func (*SongUpdate) Mutation

func (su *SongUpdate) Mutation() *SongMutation

Mutation returns the SongMutation object of the builder.

func (*SongUpdate) QueryContext

func (c *SongUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongUpdate) Save

func (su *SongUpdate) Save(ctx context.Context) (int, error)

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

func (*SongUpdate) SaveX

func (su *SongUpdate) SaveX(ctx context.Context) int

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

func (*SongUpdate) SetArtist

func (su *SongUpdate) SetArtist(a *Artist) *SongUpdate

SetArtist sets the "artist" edge to the Artist entity.

func (*SongUpdate) SetArtistID

func (su *SongUpdate) SetArtistID(i int) *SongUpdate

SetArtistID sets the "artist_id" field.

func (*SongUpdate) SetReleasedYear

func (su *SongUpdate) SetReleasedYear(i int) *SongUpdate

SetReleasedYear sets the "released_year" field.

func (*SongUpdate) SetTitle

func (su *SongUpdate) SetTitle(s string) *SongUpdate

SetTitle sets the "title" field.

func (*SongUpdate) Where

func (su *SongUpdate) Where(ps ...predicate.Song) *SongUpdate

Where appends a list predicates to the SongUpdate builder.

type SongUpdateOne

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

SongUpdateOne is the builder for updating a single Song entity.

func (*SongUpdateOne) AddReleasedYear

func (suo *SongUpdateOne) AddReleasedYear(i int) *SongUpdateOne

AddReleasedYear adds i to the "released_year" field.

func (*SongUpdateOne) ClearArtist

func (suo *SongUpdateOne) ClearArtist() *SongUpdateOne

ClearArtist clears the "artist" edge to the Artist entity.

func (*SongUpdateOne) Exec

func (suo *SongUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SongUpdateOne) ExecContext

func (c *SongUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*SongUpdateOne) ExecX

func (suo *SongUpdateOne) ExecX(ctx context.Context)

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

func (*SongUpdateOne) Mutation

func (suo *SongUpdateOne) Mutation() *SongMutation

Mutation returns the SongMutation object of the builder.

func (*SongUpdateOne) QueryContext

func (c *SongUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*SongUpdateOne) Save

func (suo *SongUpdateOne) Save(ctx context.Context) (*Song, error)

Save executes the query and returns the updated Song entity.

func (*SongUpdateOne) SaveX

func (suo *SongUpdateOne) SaveX(ctx context.Context) *Song

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

func (*SongUpdateOne) Select

func (suo *SongUpdateOne) Select(field string, fields ...string) *SongUpdateOne

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

func (*SongUpdateOne) SetArtist

func (suo *SongUpdateOne) SetArtist(a *Artist) *SongUpdateOne

SetArtist sets the "artist" edge to the Artist entity.

func (*SongUpdateOne) SetArtistID

func (suo *SongUpdateOne) SetArtistID(i int) *SongUpdateOne

SetArtistID sets the "artist_id" field.

func (*SongUpdateOne) SetReleasedYear

func (suo *SongUpdateOne) SetReleasedYear(i int) *SongUpdateOne

SetReleasedYear sets the "released_year" field.

func (*SongUpdateOne) SetTitle

func (suo *SongUpdateOne) SetTitle(s string) *SongUpdateOne

SetTitle sets the "title" field.

func (*SongUpdateOne) Where

func (suo *SongUpdateOne) Where(ps ...predicate.Song) *SongUpdateOne

Where appends a list predicates to the SongUpdate builder.

type SongWhereInput

type SongWhereInput struct {
	Predicates []predicate.Song  `json:"-"`
	Not        *SongWhereInput   `json:"not,omitempty"`
	Or         []*SongWhereInput `json:"or,omitempty"`
	And        []*SongWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID      *int  `json:"id,omitempty"`
	IDNEQ   *int  `json:"idNEQ,omitempty"`
	IDIn    []int `json:"idIn,omitempty"`
	IDNotIn []int `json:"idNotIn,omitempty"`
	IDGT    *int  `json:"idGT,omitempty"`
	IDGTE   *int  `json:"idGTE,omitempty"`
	IDLT    *int  `json:"idLT,omitempty"`
	IDLTE   *int  `json:"idLTE,omitempty"`

	// "title" field predicates.
	Title             *string  `json:"title,omitempty"`
	TitleNEQ          *string  `json:"titleNEQ,omitempty"`
	TitleIn           []string `json:"titleIn,omitempty"`
	TitleNotIn        []string `json:"titleNotIn,omitempty"`
	TitleGT           *string  `json:"titleGT,omitempty"`
	TitleGTE          *string  `json:"titleGTE,omitempty"`
	TitleLT           *string  `json:"titleLT,omitempty"`
	TitleLTE          *string  `json:"titleLTE,omitempty"`
	TitleContains     *string  `json:"titleContains,omitempty"`
	TitleHasPrefix    *string  `json:"titleHasPrefix,omitempty"`
	TitleHasSuffix    *string  `json:"titleHasSuffix,omitempty"`
	TitleEqualFold    *string  `json:"titleEqualFold,omitempty"`
	TitleContainsFold *string  `json:"titleContainsFold,omitempty"`

	// "released_year" field predicates.
	ReleasedYear      *int  `json:"releasedYear,omitempty"`
	ReleasedYearNEQ   *int  `json:"releasedYearNEQ,omitempty"`
	ReleasedYearIn    []int `json:"releasedYearIn,omitempty"`
	ReleasedYearNotIn []int `json:"releasedYearNotIn,omitempty"`
	ReleasedYearGT    *int  `json:"releasedYearGT,omitempty"`
	ReleasedYearGTE   *int  `json:"releasedYearGTE,omitempty"`
	ReleasedYearLT    *int  `json:"releasedYearLT,omitempty"`
	ReleasedYearLTE   *int  `json:"releasedYearLTE,omitempty"`

	// "artist_id" field predicates.
	ArtistID      *int  `json:"artistID,omitempty"`
	ArtistIDNEQ   *int  `json:"artistIDNEQ,omitempty"`
	ArtistIDIn    []int `json:"artistIDIn,omitempty"`
	ArtistIDNotIn []int `json:"artistIDNotIn,omitempty"`

	// "artist" edge predicates.
	HasArtist     *bool               `json:"hasArtist,omitempty"`
	HasArtistWith []*ArtistWhereInput `json:"hasArtistWith,omitempty"`
}

SongWhereInput represents a where input for filtering Song queries.

func (*SongWhereInput) AddPredicates

func (i *SongWhereInput) AddPredicates(predicates ...predicate.Song)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*SongWhereInput) Filter

func (i *SongWhereInput) Filter(q *SongQuery) (*SongQuery, error)

Filter applies the SongWhereInput filter on the SongQuery builder.

func (*SongWhereInput) P

func (i *SongWhereInput) P() (predicate.Song, error)

P returns a predicate for filtering songs. An error is returned if the input is empty or invalid.

type Songs

type Songs []*Song

Songs is a parsable slice of Song.

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 {

	// Artist is the client for interacting with the Artist builders.
	Artist *ArtistClient
	// Song is the client for interacting with the Song builders.
	Song *SongClient
	// 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) ExecContext

func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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

func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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