Documentation
¶
Overview ¶
Package musicsrepo is generated by needle 0.4.3-d26692a, DO NOT CHANGE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateTableStmt = "" /* 403-byte string literal not displayed */
// SQL Statements Table Schema
View Source
var ErrEmptyListArg = errors.New("ErrEmptyListArg")
// dependency interfaces ErrEmptyListArg passing an empty list argument at runtime.
View Source
var GetMusicByAuthorAndNameStmt = "" /* 186-byte string literal not displayed */
View Source
var GetMusicsStmt = "" /* 146-byte string literal not displayed */
View Source
var InsertMusicStmt = "" /* 181-byte string literal not displayed */
View Source
var ListMusicsLTSpotifyIDStmt = "" /* 171-byte string literal not displayed */
View Source
var SearchStmt = "" /* 171-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get returns value of f(). The value will be saved into target and
// cached by key in redis and inmemcache for duration of expire, if configured.
Get(ctx context.Context, queryKey string, target interface{}, expire time.Duration, f PassThroughFunc, noCache bool) error
// Set explicitly set a cache key to a val
// Inputs:
// key - key to set
// val - val to set
// ttl - ttl of key
Set(ctx context.Context, key string, val interface{}, ttl time.Duration) error
// Invalidate explicitly invalidates a cache key
// Inputs:
// key - key to invalidate
Invalidate(ctx context.Context, key string) error
}
Cache is the interface that the cache layer must statisfy.
type DBExecuter ¶
type DBExecuter interface {
Invalidate(InvalidateFunc) error
Query(ctx context.Context, unprepared string, args ...interface{}) (*sql.Rows, error)
Exec(ctx context.Context, unprepared string, args ...interface{}) (sql.Result, error)
Prepare(ctx context.Context, query string) (*sql.Stmt, error)
}
DBExecuter wraps transaction and non-transaction db calls
type GetMusicByAuthorAndNameArgs ¶
GetMusicByAuthorAndNameArgs -
func (*GetMusicByAuthorAndNameArgs) Key ¶
func (r *GetMusicByAuthorAndNameArgs) Key() string
Key - cache key
type InsertMusicArgs ¶
type InsertMusicArgs struct {
Author string
Name string
Album string
SpotifyID int64
DownloadPath *string
ReleasedAt time.Time
}
InsertMusicArgs -
type InvalidateFunc ¶
type InvalidateFunc = func() error
InvalidateFunc is the type of function that invalidate cache.
type ListMusicsLTSpotifyIDArgs ¶
type ListMusicsLTSpotifyIDArgs struct {
SpotifyID int64
}
ListMusicsLTSpotifyIDArgs -
func (*ListMusicsLTSpotifyIDArgs) Key ¶
func (r *ListMusicsLTSpotifyIDArgs) Key() string
Key - cache key
type Music ¶
type Music struct {
Author string `json:"author,omitempty"`
Name string `json:"name,omitempty"`
Album string `json:"album,omitempty"`
SpotifyID int64 `json:"spotify_id,omitempty"`
DownloadPath *string `json:"download_path,omitempty"`
ReleasedAt time.Time `json:"released_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
Music - the main struct.
type Musics ¶
type Musics interface {
GetMusics(ctx context.Context, options ...Option) ([]Music, error)
Search(ctx context.Context, args *SearchArgs, options ...Option) ([]Music, error)
ListMusicsLTSpotifyID(ctx context.Context, args *ListMusicsLTSpotifyIDArgs, options ...Option) ([]Music, error)
GetMusicByAuthorAndName(ctx context.Context, args *GetMusicByAuthorAndNameArgs, options ...Option) (*Music, error)
InsertMusic(ctx context.Context, args *InsertMusicArgs, key0 *GetMusicsArgs, val0 []Music, key1 *ListMusicsLTSpotifyIDArgs, val1 []Music, options ...Option) (sql.Result, error)
Check(ctx context.Context) error
Load(ctx context.Context, data []byte) error
Dump(ctx context.Context, beforeDump ...BeforeDump) ([]byte, error)
}
Musics - main interface.
func NewMusics ¶
func NewMusics(c Cache, exec DBExecuter) Musics
NewMusics - nil cache indicates nocache.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
// Misc helpers
func CacheNoRead ¶
func CacheNoRead() Option
func TxExec ¶
func TxExec(exec DBExecuter) Option
type PassThroughFunc ¶
type PassThroughFunc = func() (interface{}, error)
PassThroughFunc is the function that hits the db.
Click to show internal directories.
Click to hide internal directories.