repository

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package repository interacts with the databank and returns models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

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

func (*Album) Create

func (a *Album) Create(ctx context.Context, album *model.Album) error

func (*Album) CreateArtist

func (a *Album) CreateArtist(ctx context.Context, artist *model.AlbumArtist) error

func (*Album) CreateUser

func (a *Album) CreateUser(ctx context.Context, user *model.AlbumUser) error

func (*Album) DeleteArtistByArtistAlbum

func (a *Album) DeleteArtistByArtistAlbum(ctx context.Context, artist model.AlbumArtist) error

func (*Album) DeleteUserByUserAlbum

func (a *Album) DeleteUserByUserAlbum(ctx context.Context, user model.AlbumUser) error

func (*Album) GetAll

func (a *Album) GetAll(ctx context.Context) ([]*model.Album, error)

func (*Album) GetBySpotify

func (a *Album) GetBySpotify(ctx context.Context, spotifyID string) (*model.Album, error)

func (*Album) GetByUser

func (a *Album) GetByUser(ctx context.Context, userID int) ([]*model.Album, error)

func (*Album) Update

func (a *Album) Update(ctx context.Context, album model.Album) error

type Artist

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

func (*Artist) Create

func (a *Artist) Create(ctx context.Context, artist *model.Artist) error

func (*Artist) GetAll

func (a *Artist) GetAll(ctx context.Context) ([]*model.Artist, error)

func (*Artist) GetByAlbum

func (a *Artist) GetByAlbum(ctx context.Context, albumID int) ([]*model.Artist, error)

func (*Artist) GetBySpotify

func (a *Artist) GetBySpotify(ctx context.Context, spotifyID string) (*model.Artist, error)

func (*Artist) GetByTrack

func (a *Artist) GetByTrack(ctx context.Context, trackID int) ([]*model.Artist, error)

func (*Artist) Update

func (a *Artist) Update(ctx context.Context, artist model.Artist) error

type Directory

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

func (*Directory) Create

func (d *Directory) Create(ctx context.Context, directory *model.Directory) error

func (*Directory) CreatePlaylist

func (d *Directory) CreatePlaylist(ctx context.Context, directory *model.DirectoryPlaylist) error

func (*Directory) DeleteByUser

func (d *Directory) DeleteByUser(ctx context.Context, userID int) error

func (*Directory) GetByUserPopulated

func (d *Directory) GetByUserPopulated(ctx context.Context, userID int) ([]*model.Directory, error)

func (*Directory) Update

func (d *Directory) Update(ctx context.Context, directory model.Directory) error

type Generator added in v0.2.0

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

func (*Generator) Create added in v0.2.0

func (g *Generator) Create(ctx context.Context, gen *model.Generator) error

func (*Generator) CreateTrackBatch added in v0.2.0

func (g *Generator) CreateTrackBatch(ctx context.Context, tracks []model.GeneratorTrack) error

func (*Generator) Delete added in v0.2.0

func (g *Generator) Delete(ctx context.Context, genID int) error

func (*Generator) DeleteTrackByGenerator added in v0.2.0

func (g *Generator) DeleteTrackByGenerator(ctx context.Context, id int) error

func (*Generator) Get added in v0.2.0

func (g *Generator) Get(ctx context.Context, id int) (*model.Generator, error)

func (*Generator) GetAll added in v0.2.0

func (g *Generator) GetAll(ctx context.Context) ([]*model.Generator, error)

func (*Generator) GetByUserPopulated added in v0.2.0

func (g *Generator) GetByUserPopulated(ctx context.Context, userID int) ([]*model.Generator, error)

func (*Generator) Update added in v0.2.0

func (g *Generator) Update(ctx context.Context, gen model.Generator) error

type History

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

func (*History) Create

func (h *History) Create(ctx context.Context, history *model.History) error

func (*History) CreateBatch added in v0.2.0

func (h *History) CreateBatch(ctx context.Context, histories []model.History) error

CreateBatch let's you create a batch of history entries It will panic if the skipped field is nil!!!

func (*History) DeleteOlder added in v0.2.0

func (h *History) DeleteOlder(ctx context.Context, userID int, playedAt time.Time) error

func (*History) GetPopulatedFiltered

func (h *History) GetPopulatedFiltered(ctx context.Context, filter model.HistoryFilter) ([]*model.History, error)

func (*History) GetPopulatedFilteredPaginated added in v0.2.0

func (h *History) GetPopulatedFilteredPaginated(ctx context.Context, filter model.HistoryFilter) ([]*model.History, error)

func (*History) GetPreviousPopulated added in v0.2.0

func (h *History) GetPreviousPopulated(ctx context.Context, userID int, playedAt time.Time) (*model.History, error)

func (*History) GetSkippedUnknownPopulated added in v0.2.0

func (h *History) GetSkippedUnknownPopulated(ctx context.Context, userID int) ([]*model.History, error)

func (*History) Update added in v0.2.0

func (h *History) Update(ctx context.Context, history model.History) error
type Link struct {
	// contains filtered or unexported fields
}

func (*Link) Create

func (l *Link) Create(ctx context.Context, link *model.Link) error

func (*Link) Delete

func (l *Link) Delete(ctx context.Context, linkID int) error

func (*Link) GetAllByUser

func (l *Link) GetAllByUser(ctx context.Context, userID int) ([]*model.Link, error)

func (*Link) Update

func (l *Link) Update(ctx context.Context, link model.Link) error

type Playlist

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

func (*Playlist) Create

func (p *Playlist) Create(ctx context.Context, playlist *model.Playlist) error

func (*Playlist) CreateTrack

func (p *Playlist) CreateTrack(ctx context.Context, track *model.PlaylistTrack) error

func (*Playlist) CreateUser

func (p *Playlist) CreateUser(ctx context.Context, user *model.PlaylistUser) error

func (*Playlist) DeleteTrackByPlaylistTrack

func (p *Playlist) DeleteTrackByPlaylistTrack(ctx context.Context, track model.PlaylistTrack) error

func (*Playlist) DeleteUserByUserPlaylist

func (p *Playlist) DeleteUserByUserPlaylist(ctx context.Context, user model.PlaylistUser) error

func (*Playlist) Get

func (p *Playlist) Get(ctx context.Context, playlistID int) (*model.Playlist, error)

func (*Playlist) GetBySpotify

func (p *Playlist) GetBySpotify(ctx context.Context, spotifyID string) (*model.Playlist, error)

func (*Playlist) GetByUser

func (p *Playlist) GetByUser(ctx context.Context, userID int) ([]*model.Playlist, error)

func (*Playlist) GetByUserPopulated

func (p *Playlist) GetByUserPopulated(ctx context.Context, userID int) ([]*model.Playlist, error)

func (*Playlist) GetDuplicateTracksByUser

func (p *Playlist) GetDuplicateTracksByUser(ctx context.Context, userID int) ([]*model.Playlist, error)

func (*Playlist) GetTrackByPlaylistIDs added in v0.2.0

func (p *Playlist) GetTrackByPlaylistIDs(ctx context.Context, playlistIDs []int) ([]*model.PlaylistTrack, error)

func (*Playlist) GetUnplayableTracksByUser

func (p *Playlist) GetUnplayableTracksByUser(ctx context.Context, userID int) ([]*model.Playlist, error)

func (*Playlist) Update

func (p *Playlist) Update(ctx context.Context, playlist model.Playlist) error

type Repository

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

func New

func New(db db.DB) *Repository

func (*Repository) NewAlbum

func (r *Repository) NewAlbum() *Album

func (*Repository) NewArtist

func (r *Repository) NewArtist() *Artist

func (*Repository) NewDirectory

func (r *Repository) NewDirectory() *Directory

func (*Repository) NewGenerator added in v0.2.0

func (r *Repository) NewGenerator() *Generator

func (*Repository) NewHistory

func (r *Repository) NewHistory() *History
func (r *Repository) NewLink() *Link

func (*Repository) NewPlaylist

func (r *Repository) NewPlaylist() *Playlist

func (*Repository) NewShow

func (r *Repository) NewShow() *Show

func (*Repository) NewTask

func (r *Repository) NewTask() *Task

func (*Repository) NewTrack

func (r *Repository) NewTrack() *Track

func (*Repository) NewUser

func (r *Repository) NewUser() *User

func (*Repository) WithRollback

func (r *Repository) WithRollback(ctx context.Context, fn func(ctx context.Context) error) error

type Show

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

func (*Show) Create

func (s *Show) Create(ctx context.Context, show *model.Show) error

func (*Show) CreateUser

func (s *Show) CreateUser(ctx context.Context, user *model.ShowUser) error

func (*Show) DeleteUserByUserShow

func (s *Show) DeleteUserByUserShow(ctx context.Context, user model.ShowUser) error

func (*Show) GetAll

func (s *Show) GetAll(ctx context.Context) ([]*model.Show, error)

func (*Show) GetBySpotify

func (s *Show) GetBySpotify(ctx context.Context, spotifyID string) (*model.Show, error)

func (*Show) GetByUser

func (s *Show) GetByUser(ctx context.Context, userID int) ([]*model.Show, error)

func (*Show) Update

func (s *Show) Update(ctx context.Context, show model.Show) error

type Task

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

func (*Task) Create

func (t *Task) Create(ctx context.Context, task model.Task) error

func (*Task) CreateRun

func (t *Task) CreateRun(ctx context.Context, task *model.Task) error

func (*Task) GetByRunID

func (t *Task) GetByRunID(ctx context.Context, runID int) (*model.Task, error)

func (*Task) GetByUID

func (t *Task) GetByUID(ctx context.Context, taskUID string) (*model.Task, error)

GetByUID returns the task given an uid without any runs

func (*Task) GetRunFiltered

func (t *Task) GetRunFiltered(ctx context.Context, filter model.TaskFilter) ([]*model.Task, error)

func (*Task) GetRunLastAllByUser

func (t *Task) GetRunLastAllByUser(ctx context.Context, userID int) ([]*model.Task, error)

func (*Task) SetInactiveAll

func (t *Task) SetInactiveAll(ctx context.Context) error

func (*Task) Update

func (t *Task) Update(ctx context.Context, task model.Task) error

type Track

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

func (*Track) Create

func (t *Track) Create(ctx context.Context, track *model.Track) error

func (*Track) CreateArtist

func (t *Track) CreateArtist(ctx context.Context, artist *model.TrackArtist) error

func (*Track) DeleteArtistByArtistTrack

func (t *Track) DeleteArtistByArtistTrack(ctx context.Context, artist model.TrackArtist) error

func (*Track) GetAll

func (t *Track) GetAll(ctx context.Context) ([]*model.Track, error)

func (*Track) GetAllByID added in v0.2.0

func (t *Track) GetAllByID(ctx context.Context, trackIDs []int) ([]*model.Track, error)

func (*Track) GetAllBySpotify added in v0.2.0

func (t *Track) GetAllBySpotify(ctx context.Context, spotifyIDs []string) ([]*model.Track, error)

func (*Track) GetByGenerator added in v0.2.0

func (t *Track) GetByGenerator(ctx context.Context, generatorID int) ([]*model.Track, error)

func (*Track) GetByName

func (t *Track) GetByName(ctx context.Context, name string) ([]*model.Track, error)

func (*Track) GetByPlaylist

func (t *Track) GetByPlaylist(ctx context.Context, playlistID int) ([]*model.Track, error)

func (*Track) GetBySpotify

func (t *Track) GetBySpotify(ctx context.Context, spotifyID string) (*model.Track, error)

func (*Track) GetCreatedFiltered

func (t *Track) GetCreatedFiltered(ctx context.Context, filter model.TrackFilter) ([]*model.Track, error)

func (*Track) GetDeletedFiltered

func (t *Track) GetDeletedFiltered(ctx context.Context, filter model.TrackFilter) ([]*model.Track, error)

func (*Track) Update

func (t *Track) Update(ctx context.Context, track model.Track) error

type User

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

func (*User) Create

func (u *User) Create(ctx context.Context, user *model.User) error

func (*User) GetActualAll

func (u *User) GetActualAll(ctx context.Context) ([]*model.User, error)

func (*User) GetAllByID

func (u *User) GetAllByID(ctx context.Context, ids []int) ([]*model.User, error)

func (*User) GetByID

func (u *User) GetByID(ctx context.Context, id int) (*model.User, error)

func (*User) GetByUID

func (u *User) GetByUID(ctx context.Context, uid string) (*model.User, error)

func (*User) Update

func (u *User) Update(ctx context.Context, user model.User) error

Jump to

Keyboard shortcuts

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