Documentation
¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Artist
- func (c *Artist) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (n *Artist) IsNode()
- func (a *Artist) NamedSongs(name string) ([]*Song, error)
- func (c *Artist) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (a *Artist) QuerySongs() *SongQuery
- func (a *Artist) Songs(ctx context.Context) (result []*Song, err error)
- func (a *Artist) String() string
- func (a *Artist) ToEdge(order *ArtistOrder) *ArtistEdge
- func (a *Artist) Unwrap() *Artist
- func (a *Artist) Update() *ArtistUpdateOne
- func (a *Artist) Value(name string) (ent.Value, error)
- type ArtistClient
- func (c *ArtistClient) Create() *ArtistCreate
- func (c *ArtistClient) CreateBulk(builders ...*ArtistCreate) *ArtistCreateBulk
- func (c *ArtistClient) Delete() *ArtistDelete
- func (c *ArtistClient) DeleteOne(a *Artist) *ArtistDeleteOne
- func (c *ArtistClient) DeleteOneID(id int) *ArtistDeleteOne
- func (c *ArtistClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *ArtistClient) Get(ctx context.Context, id int) (*Artist, error)
- func (c *ArtistClient) GetX(ctx context.Context, id int) *Artist
- func (c *ArtistClient) Hooks() []Hook
- func (c *ArtistClient) Intercept(interceptors ...Interceptor)
- func (c *ArtistClient) Interceptors() []Interceptor
- func (c *ArtistClient) Query() *ArtistQuery
- func (c *ArtistClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *ArtistClient) QuerySongs(a *Artist) *SongQuery
- func (c *ArtistClient) Update() *ArtistUpdate
- func (c *ArtistClient) UpdateOne(a *Artist) *ArtistUpdateOne
- func (c *ArtistClient) UpdateOneID(id int) *ArtistUpdateOne
- func (c *ArtistClient) Use(hooks ...Hook)
- type ArtistConnection
- type ArtistCreate
- func (ac *ArtistCreate) AddSongIDs(ids ...int) *ArtistCreate
- func (ac *ArtistCreate) AddSongs(s ...*Song) *ArtistCreate
- func (ac *ArtistCreate) Exec(ctx context.Context) error
- func (c *ArtistCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (ac *ArtistCreate) ExecX(ctx context.Context)
- func (ac *ArtistCreate) Mutation() *ArtistMutation
- func (c *ArtistCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ac *ArtistCreate) Save(ctx context.Context) (*Artist, error)
- func (ac *ArtistCreate) SaveX(ctx context.Context) *Artist
- func (ac *ArtistCreate) SetID(i int) *ArtistCreate
- func (ac *ArtistCreate) SetName(s string) *ArtistCreate
- type ArtistCreateBulk
- func (acb *ArtistCreateBulk) Exec(ctx context.Context) error
- func (c *ArtistCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (acb *ArtistCreateBulk) ExecX(ctx context.Context)
- func (c *ArtistCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (acb *ArtistCreateBulk) Save(ctx context.Context) ([]*Artist, error)
- func (acb *ArtistCreateBulk) SaveX(ctx context.Context) []*Artist
- type ArtistDelete
- func (ad *ArtistDelete) Exec(ctx context.Context) (int, error)
- func (c *ArtistDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (ad *ArtistDelete) ExecX(ctx context.Context) int
- func (c *ArtistDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ad *ArtistDelete) Where(ps ...predicate.Artist) *ArtistDelete
- type ArtistDeleteOne
- type ArtistEdge
- type ArtistEdges
- type ArtistGroupBy
- func (agb *ArtistGroupBy) Aggregate(fns ...AggregateFunc) *ArtistGroupBy
- func (s *ArtistGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArtistGroupBy) BoolX(ctx context.Context) bool
- func (s *ArtistGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *ArtistGroupBy) BoolsX(ctx context.Context) []bool
- func (s *ArtistGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArtistGroupBy) Float64X(ctx context.Context) float64
- func (s *ArtistGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArtistGroupBy) Float64sX(ctx context.Context) []float64
- func (s *ArtistGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *ArtistGroupBy) IntX(ctx context.Context) int
- func (s *ArtistGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *ArtistGroupBy) IntsX(ctx context.Context) []int
- func (agb *ArtistGroupBy) Scan(ctx context.Context, v any) error
- func (s *ArtistGroupBy) ScanX(ctx context.Context, v any)
- func (s *ArtistGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *ArtistGroupBy) StringX(ctx context.Context) string
- func (s *ArtistGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *ArtistGroupBy) StringsX(ctx context.Context) []string
- type ArtistMutation
- func (m *ArtistMutation) AddField(name string, value ent.Value) error
- func (m *ArtistMutation) AddSongIDs(ids ...int)
- func (m *ArtistMutation) AddedEdges() []string
- func (m *ArtistMutation) AddedField(name string) (ent.Value, bool)
- func (m *ArtistMutation) AddedFields() []string
- func (m *ArtistMutation) AddedIDs(name string) []ent.Value
- func (m *ArtistMutation) ClearEdge(name string) error
- func (m *ArtistMutation) ClearField(name string) error
- func (m *ArtistMutation) ClearSongs()
- func (m *ArtistMutation) ClearedEdges() []string
- func (m *ArtistMutation) ClearedFields() []string
- func (m ArtistMutation) Client() *Client
- func (m *ArtistMutation) EdgeCleared(name string) bool
- func (c *ArtistMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (m *ArtistMutation) Field(name string) (ent.Value, bool)
- func (m *ArtistMutation) FieldCleared(name string) bool
- func (m *ArtistMutation) Fields() []string
- func (m *ArtistMutation) ID() (id int, exists bool)
- func (m *ArtistMutation) IDs(ctx context.Context) ([]int, error)
- func (m *ArtistMutation) Name() (r string, exists bool)
- func (m *ArtistMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *ArtistMutation) OldName(ctx context.Context) (v string, err error)
- func (m *ArtistMutation) Op() Op
- func (c *ArtistMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (m *ArtistMutation) RemoveSongIDs(ids ...int)
- func (m *ArtistMutation) RemovedEdges() []string
- func (m *ArtistMutation) RemovedIDs(name string) []ent.Value
- func (m *ArtistMutation) RemovedSongsIDs() (ids []int)
- func (m *ArtistMutation) ResetEdge(name string) error
- func (m *ArtistMutation) ResetField(name string) error
- func (m *ArtistMutation) ResetName()
- func (m *ArtistMutation) ResetSongs()
- func (m *ArtistMutation) SetField(name string, value ent.Value) error
- func (m *ArtistMutation) SetID(id int)
- func (m *ArtistMutation) SetName(s string)
- func (m *ArtistMutation) SetOp(op Op)
- func (m *ArtistMutation) SongsCleared() bool
- func (m *ArtistMutation) SongsIDs() (ids []int)
- func (m ArtistMutation) Tx() (*Tx, error)
- func (m *ArtistMutation) Type() string
- func (m *ArtistMutation) Where(ps ...predicate.Artist)
- func (m *ArtistMutation) WhereP(ps ...func(*sql.Selector))
- type ArtistOrder
- type ArtistOrderField
- type ArtistPaginateOption
- type ArtistQuery
- func (aq *ArtistQuery) Aggregate(fns ...AggregateFunc) *ArtistSelect
- func (aq *ArtistQuery) All(ctx context.Context) ([]*Artist, error)
- func (aq *ArtistQuery) AllX(ctx context.Context) []*Artist
- func (aq *ArtistQuery) Clone() *ArtistQuery
- func (a *ArtistQuery) CollectFields(ctx context.Context, satisfies ...string) (*ArtistQuery, error)
- func (aq *ArtistQuery) Count(ctx context.Context) (int, error)
- func (aq *ArtistQuery) CountX(ctx context.Context) int
- func (c *ArtistQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (aq *ArtistQuery) Exist(ctx context.Context) (bool, error)
- func (aq *ArtistQuery) ExistX(ctx context.Context) bool
- func (aq *ArtistQuery) First(ctx context.Context) (*Artist, error)
- func (aq *ArtistQuery) FirstID(ctx context.Context) (id int, err error)
- func (aq *ArtistQuery) FirstIDX(ctx context.Context) int
- func (aq *ArtistQuery) FirstX(ctx context.Context) *Artist
- func (aq *ArtistQuery) GroupBy(field string, fields ...string) *ArtistGroupBy
- func (aq *ArtistQuery) IDs(ctx context.Context) (ids []int, err error)
- func (aq *ArtistQuery) IDsX(ctx context.Context) []int
- func (aq *ArtistQuery) Limit(limit int) *ArtistQuery
- func (aq *ArtistQuery) Offset(offset int) *ArtistQuery
- func (aq *ArtistQuery) Only(ctx context.Context) (*Artist, error)
- func (aq *ArtistQuery) OnlyID(ctx context.Context) (id int, err error)
- func (aq *ArtistQuery) OnlyIDX(ctx context.Context) int
- func (aq *ArtistQuery) OnlyX(ctx context.Context) *Artist
- func (aq *ArtistQuery) Order(o ...artist.OrderOption) *ArtistQuery
- func (a *ArtistQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*ArtistConnection, error)
- func (c *ArtistQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (aq *ArtistQuery) QuerySongs() *SongQuery
- func (aq *ArtistQuery) Select(fields ...string) *ArtistSelect
- func (aq *ArtistQuery) Unique(unique bool) *ArtistQuery
- func (aq *ArtistQuery) Where(ps ...predicate.Artist) *ArtistQuery
- func (aq *ArtistQuery) WithNamedSongs(name string, opts ...func(*SongQuery)) *ArtistQuery
- func (aq *ArtistQuery) WithSongs(opts ...func(*SongQuery)) *ArtistQuery
- type ArtistSelect
- func (as *ArtistSelect) Aggregate(fns ...AggregateFunc) *ArtistSelect
- func (s *ArtistSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *ArtistSelect) BoolX(ctx context.Context) bool
- func (s *ArtistSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *ArtistSelect) BoolsX(ctx context.Context) []bool
- func (c ArtistSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (s *ArtistSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *ArtistSelect) Float64X(ctx context.Context) float64
- func (s *ArtistSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *ArtistSelect) Float64sX(ctx context.Context) []float64
- func (s *ArtistSelect) Int(ctx context.Context) (_ int, err error)
- func (s *ArtistSelect) IntX(ctx context.Context) int
- func (s *ArtistSelect) Ints(ctx context.Context) ([]int, error)
- func (s *ArtistSelect) IntsX(ctx context.Context) []int
- func (c ArtistSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (as *ArtistSelect) Scan(ctx context.Context, v any) error
- func (s *ArtistSelect) ScanX(ctx context.Context, v any)
- func (s *ArtistSelect) String(ctx context.Context) (_ string, err error)
- func (s *ArtistSelect) StringX(ctx context.Context) string
- func (s *ArtistSelect) Strings(ctx context.Context) ([]string, error)
- func (s *ArtistSelect) StringsX(ctx context.Context) []string
- type ArtistUpdate
- func (au *ArtistUpdate) AddSongIDs(ids ...int) *ArtistUpdate
- func (au *ArtistUpdate) AddSongs(s ...*Song) *ArtistUpdate
- func (au *ArtistUpdate) ClearSongs() *ArtistUpdate
- func (au *ArtistUpdate) Exec(ctx context.Context) error
- func (c *ArtistUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (au *ArtistUpdate) ExecX(ctx context.Context)
- func (au *ArtistUpdate) Mutation() *ArtistMutation
- func (c *ArtistUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (au *ArtistUpdate) RemoveSongIDs(ids ...int) *ArtistUpdate
- func (au *ArtistUpdate) RemoveSongs(s ...*Song) *ArtistUpdate
- func (au *ArtistUpdate) Save(ctx context.Context) (int, error)
- func (au *ArtistUpdate) SaveX(ctx context.Context) int
- func (au *ArtistUpdate) SetName(s string) *ArtistUpdate
- func (au *ArtistUpdate) Where(ps ...predicate.Artist) *ArtistUpdate
- type ArtistUpdateOne
- func (auo *ArtistUpdateOne) AddSongIDs(ids ...int) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) AddSongs(s ...*Song) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) ClearSongs() *ArtistUpdateOne
- func (auo *ArtistUpdateOne) Exec(ctx context.Context) error
- func (c *ArtistUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (auo *ArtistUpdateOne) ExecX(ctx context.Context)
- func (auo *ArtistUpdateOne) Mutation() *ArtistMutation
- func (c *ArtistUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (auo *ArtistUpdateOne) RemoveSongIDs(ids ...int) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) RemoveSongs(s ...*Song) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) Save(ctx context.Context) (*Artist, error)
- func (auo *ArtistUpdateOne) SaveX(ctx context.Context) *Artist
- func (auo *ArtistUpdateOne) Select(field string, fields ...string) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) SetName(s string) *ArtistUpdateOne
- func (auo *ArtistUpdateOne) Where(ps ...predicate.Artist) *ArtistUpdateOne
- type ArtistWhereInput
- type Artists
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Cursor
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type PageInfo
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Song
- func (s *Song) Artist(ctx context.Context) (*Artist, error)
- func (c *Song) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (n *Song) IsNode()
- func (s *Song) QueryArtist() *ArtistQuery
- func (c *Song) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (s *Song) String() string
- func (s *Song) ToEdge(order *SongOrder) *SongEdge
- func (s *Song) Unwrap() *Song
- func (s *Song) Update() *SongUpdateOne
- func (s *Song) Value(name string) (ent.Value, error)
- type SongClient
- func (c *SongClient) Create() *SongCreate
- func (c *SongClient) CreateBulk(builders ...*SongCreate) *SongCreateBulk
- func (c *SongClient) Delete() *SongDelete
- func (c *SongClient) DeleteOne(s *Song) *SongDeleteOne
- func (c *SongClient) DeleteOneID(id int) *SongDeleteOne
- func (c *SongClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (c *SongClient) Get(ctx context.Context, id int) (*Song, error)
- func (c *SongClient) GetX(ctx context.Context, id int) *Song
- func (c *SongClient) Hooks() []Hook
- func (c *SongClient) Intercept(interceptors ...Interceptor)
- func (c *SongClient) Interceptors() []Interceptor
- func (c *SongClient) Query() *SongQuery
- func (c *SongClient) QueryArtist(s *Song) *ArtistQuery
- func (c *SongClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (c *SongClient) Update() *SongUpdate
- func (c *SongClient) UpdateOne(s *Song) *SongUpdateOne
- func (c *SongClient) UpdateOneID(id int) *SongUpdateOne
- func (c *SongClient) Use(hooks ...Hook)
- type SongConnection
- type SongCreate
- func (sc *SongCreate) Exec(ctx context.Context) error
- func (c *SongCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (sc *SongCreate) ExecX(ctx context.Context)
- func (sc *SongCreate) Mutation() *SongMutation
- func (c *SongCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (sc *SongCreate) Save(ctx context.Context) (*Song, error)
- func (sc *SongCreate) SaveX(ctx context.Context) *Song
- func (sc *SongCreate) SetArtist(a *Artist) *SongCreate
- func (sc *SongCreate) SetArtistID(i int) *SongCreate
- func (sc *SongCreate) SetID(i int) *SongCreate
- func (sc *SongCreate) SetReleasedYear(i int) *SongCreate
- func (sc *SongCreate) SetTitle(s string) *SongCreate
- type SongCreateBulk
- func (scb *SongCreateBulk) Exec(ctx context.Context) error
- func (c *SongCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (scb *SongCreateBulk) ExecX(ctx context.Context)
- func (c *SongCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (scb *SongCreateBulk) Save(ctx context.Context) ([]*Song, error)
- func (scb *SongCreateBulk) SaveX(ctx context.Context) []*Song
- type SongDelete
- func (sd *SongDelete) Exec(ctx context.Context) (int, error)
- func (c *SongDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (sd *SongDelete) ExecX(ctx context.Context) int
- func (c *SongDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (sd *SongDelete) Where(ps ...predicate.Song) *SongDelete
- type SongDeleteOne
- type SongEdge
- type SongEdges
- type SongGroupBy
- func (sgb *SongGroupBy) Aggregate(fns ...AggregateFunc) *SongGroupBy
- func (s *SongGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *SongGroupBy) BoolX(ctx context.Context) bool
- func (s *SongGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *SongGroupBy) BoolsX(ctx context.Context) []bool
- func (s *SongGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *SongGroupBy) Float64X(ctx context.Context) float64
- func (s *SongGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *SongGroupBy) Float64sX(ctx context.Context) []float64
- func (s *SongGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *SongGroupBy) IntX(ctx context.Context) int
- func (s *SongGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *SongGroupBy) IntsX(ctx context.Context) []int
- func (sgb *SongGroupBy) Scan(ctx context.Context, v any) error
- func (s *SongGroupBy) ScanX(ctx context.Context, v any)
- func (s *SongGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *SongGroupBy) StringX(ctx context.Context) string
- func (s *SongGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *SongGroupBy) StringsX(ctx context.Context) []string
- type SongMutation
- func (m *SongMutation) AddField(name string, value ent.Value) error
- func (m *SongMutation) AddReleasedYear(i int)
- func (m *SongMutation) AddedEdges() []string
- func (m *SongMutation) AddedField(name string) (ent.Value, bool)
- func (m *SongMutation) AddedFields() []string
- func (m *SongMutation) AddedIDs(name string) []ent.Value
- func (m *SongMutation) AddedReleasedYear() (r int, exists bool)
- func (m *SongMutation) ArtistCleared() bool
- func (m *SongMutation) ArtistID() (r int, exists bool)
- func (m *SongMutation) ArtistIDs() (ids []int)
- func (m *SongMutation) ClearArtist()
- func (m *SongMutation) ClearEdge(name string) error
- func (m *SongMutation) ClearField(name string) error
- func (m *SongMutation) ClearedEdges() []string
- func (m *SongMutation) ClearedFields() []string
- func (m SongMutation) Client() *Client
- func (m *SongMutation) EdgeCleared(name string) bool
- func (c *SongMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (m *SongMutation) Field(name string) (ent.Value, bool)
- func (m *SongMutation) FieldCleared(name string) bool
- func (m *SongMutation) Fields() []string
- func (m *SongMutation) ID() (id int, exists bool)
- func (m *SongMutation) IDs(ctx context.Context) ([]int, error)
- func (m *SongMutation) OldArtistID(ctx context.Context) (v int, err error)
- func (m *SongMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *SongMutation) OldReleasedYear(ctx context.Context) (v int, err error)
- func (m *SongMutation) OldTitle(ctx context.Context) (v string, err error)
- func (m *SongMutation) Op() Op
- func (c *SongMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (m *SongMutation) ReleasedYear() (r int, exists bool)
- func (m *SongMutation) RemovedEdges() []string
- func (m *SongMutation) RemovedIDs(name string) []ent.Value
- func (m *SongMutation) ResetArtist()
- func (m *SongMutation) ResetArtistID()
- func (m *SongMutation) ResetEdge(name string) error
- func (m *SongMutation) ResetField(name string) error
- func (m *SongMutation) ResetReleasedYear()
- func (m *SongMutation) ResetTitle()
- func (m *SongMutation) SetArtistID(i int)
- func (m *SongMutation) SetField(name string, value ent.Value) error
- func (m *SongMutation) SetID(id int)
- func (m *SongMutation) SetOp(op Op)
- func (m *SongMutation) SetReleasedYear(i int)
- func (m *SongMutation) SetTitle(s string)
- func (m *SongMutation) Title() (r string, exists bool)
- func (m SongMutation) Tx() (*Tx, error)
- func (m *SongMutation) Type() string
- func (m *SongMutation) Where(ps ...predicate.Song)
- func (m *SongMutation) WhereP(ps ...func(*sql.Selector))
- type SongOrder
- type SongOrderField
- type SongPaginateOption
- type SongQuery
- func (sq *SongQuery) Aggregate(fns ...AggregateFunc) *SongSelect
- func (sq *SongQuery) All(ctx context.Context) ([]*Song, error)
- func (sq *SongQuery) AllX(ctx context.Context) []*Song
- func (sq *SongQuery) Clone() *SongQuery
- func (s *SongQuery) CollectFields(ctx context.Context, satisfies ...string) (*SongQuery, error)
- func (sq *SongQuery) Count(ctx context.Context) (int, error)
- func (sq *SongQuery) CountX(ctx context.Context) int
- func (c *SongQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (sq *SongQuery) Exist(ctx context.Context) (bool, error)
- func (sq *SongQuery) ExistX(ctx context.Context) bool
- func (sq *SongQuery) First(ctx context.Context) (*Song, error)
- func (sq *SongQuery) FirstID(ctx context.Context) (id int, err error)
- func (sq *SongQuery) FirstIDX(ctx context.Context) int
- func (sq *SongQuery) FirstX(ctx context.Context) *Song
- func (sq *SongQuery) GroupBy(field string, fields ...string) *SongGroupBy
- func (sq *SongQuery) IDs(ctx context.Context) (ids []int, err error)
- func (sq *SongQuery) IDsX(ctx context.Context) []int
- func (sq *SongQuery) Limit(limit int) *SongQuery
- func (sq *SongQuery) Offset(offset int) *SongQuery
- func (sq *SongQuery) Only(ctx context.Context) (*Song, error)
- func (sq *SongQuery) OnlyID(ctx context.Context) (id int, err error)
- func (sq *SongQuery) OnlyIDX(ctx context.Context) int
- func (sq *SongQuery) OnlyX(ctx context.Context) *Song
- func (sq *SongQuery) Order(o ...song.OrderOption) *SongQuery
- func (s *SongQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*SongConnection, error)
- func (sq *SongQuery) QueryArtist() *ArtistQuery
- func (c *SongQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (sq *SongQuery) Select(fields ...string) *SongSelect
- func (sq *SongQuery) Unique(unique bool) *SongQuery
- func (sq *SongQuery) Where(ps ...predicate.Song) *SongQuery
- func (sq *SongQuery) WithArtist(opts ...func(*ArtistQuery)) *SongQuery
- type SongSelect
- func (ss *SongSelect) Aggregate(fns ...AggregateFunc) *SongSelect
- func (s *SongSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *SongSelect) BoolX(ctx context.Context) bool
- func (s *SongSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *SongSelect) BoolsX(ctx context.Context) []bool
- func (c SongSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (s *SongSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *SongSelect) Float64X(ctx context.Context) float64
- func (s *SongSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *SongSelect) Float64sX(ctx context.Context) []float64
- func (s *SongSelect) Int(ctx context.Context) (_ int, err error)
- func (s *SongSelect) IntX(ctx context.Context) int
- func (s *SongSelect) Ints(ctx context.Context) ([]int, error)
- func (s *SongSelect) IntsX(ctx context.Context) []int
- func (c SongSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (ss *SongSelect) Scan(ctx context.Context, v any) error
- func (s *SongSelect) ScanX(ctx context.Context, v any)
- func (s *SongSelect) String(ctx context.Context) (_ string, err error)
- func (s *SongSelect) StringX(ctx context.Context) string
- func (s *SongSelect) Strings(ctx context.Context) ([]string, error)
- func (s *SongSelect) StringsX(ctx context.Context) []string
- type SongUpdate
- func (su *SongUpdate) AddReleasedYear(i int) *SongUpdate
- func (su *SongUpdate) ClearArtist() *SongUpdate
- func (su *SongUpdate) Exec(ctx context.Context) error
- func (c *SongUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (su *SongUpdate) ExecX(ctx context.Context)
- func (su *SongUpdate) Mutation() *SongMutation
- func (c *SongUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (su *SongUpdate) Save(ctx context.Context) (int, error)
- func (su *SongUpdate) SaveX(ctx context.Context) int
- func (su *SongUpdate) SetArtist(a *Artist) *SongUpdate
- func (su *SongUpdate) SetArtistID(i int) *SongUpdate
- func (su *SongUpdate) SetReleasedYear(i int) *SongUpdate
- func (su *SongUpdate) SetTitle(s string) *SongUpdate
- func (su *SongUpdate) Where(ps ...predicate.Song) *SongUpdate
- type SongUpdateOne
- func (suo *SongUpdateOne) AddReleasedYear(i int) *SongUpdateOne
- func (suo *SongUpdateOne) ClearArtist() *SongUpdateOne
- func (suo *SongUpdateOne) Exec(ctx context.Context) error
- func (c *SongUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (suo *SongUpdateOne) ExecX(ctx context.Context)
- func (suo *SongUpdateOne) Mutation() *SongMutation
- func (c *SongUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (suo *SongUpdateOne) Save(ctx context.Context) (*Song, error)
- func (suo *SongUpdateOne) SaveX(ctx context.Context) *Song
- func (suo *SongUpdateOne) Select(field string, fields ...string) *SongUpdateOne
- func (suo *SongUpdateOne) SetArtist(a *Artist) *SongUpdateOne
- func (suo *SongUpdateOne) SetArtistID(i int) *SongUpdateOne
- func (suo *SongUpdateOne) SetReleasedYear(i int) *SongUpdateOne
- func (suo *SongUpdateOne) SetTitle(s string) *SongUpdateOne
- func (suo *SongUpdateOne) Where(ps ...predicate.Song) *SongUpdateOne
- type SongWhereInput
- type Songs
- type TraverseFunc
- type Traverser
- type Tx
- func (tx *Tx) Client() *Client
- func (tx *Tx) Commit() error
- func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (tx *Tx) OnCommit(f CommitHook)
- func (tx *Tx) OnRollback(f RollbackHook)
- func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)
- func (tx *Tx) Rollback() error
- type ValidationError
- type Value
Constants ¶
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 ¶
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.
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.
var ErrEmptyArtistWhereInput = errors.New("ent: empty predicate ArtistWhereInput")
ErrEmptyArtistWhereInput is returned in case the ArtistWhereInput is empty.
var ErrEmptySongWhereInput = errors.New("ent: empty predicate SongWhereInput")
ErrEmptySongWhereInput is returned in case the SongWhereInput is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
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 ¶
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 ¶
NamedSongs returns the Songs named value or an error if the edge was not loaded in eager-loading with this name.
func (*Artist) QueryContext ¶
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 ¶
QuerySongs queries the "songs" edge of the Artist entity.
func (*Artist) ToEdge ¶
func (a *Artist) ToEdge(order *ArtistOrder) *ArtistEdge
ToEdge converts Artist into ArtistEdge.
func (*Artist) Unwrap ¶
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.
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) GetX ¶
func (c *ArtistClient) GetX(ctx context.Context, id int) *Artist
GetX is like Get, but panics if an error occurs.
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.
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 ¶
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArtistGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*ArtistGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArtistGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArtistGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArtistGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*ArtistSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
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 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*ArtistSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*ArtistSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*ArtistSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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.
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 ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
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) Debug ¶
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 ¶
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) Noder ¶
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) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
func (*Client) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
type CommitFunc ¶
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.
type CommitHook ¶
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 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 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 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 ¶
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 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 OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
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 ¶
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.
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 ¶
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) ExecContext ¶
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 ¶
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) Unwrap ¶
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.
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) GetX ¶
func (c *SongClient) GetX(ctx context.Context, id int) *Song
GetX is like Get, but panics if an error occurs.
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.
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 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 ¶
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SongGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SongGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SongGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SongGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SongGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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) Clone ¶
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 ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
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) First ¶
First returns the first Song entity from the query. Returns a *NotFoundError when no Song was found.
func (*SongQuery) FirstID ¶
FirstID returns the first Song ID from the query. Returns a *NotFoundError when no Song ID was found.
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) Only ¶
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 ¶
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) 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 ¶
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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SongSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
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 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SongSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SongSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SongSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
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 ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) ExecContext ¶
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) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
func (*Tx) QueryContext ¶
QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.
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.