model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package model contains all databank models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID          int
	SpotifyID   string
	Name        string
	TrackAmount int
	Popularity  int
	CoverID     string
	CoverURL    string
	UpdatedAt   time.Time

	// Non db fields
	Artists []Artist
}

func AlbumModel

func AlbumModel(a sqlc.Album) *Album

func (*Album) Equal

func (a *Album) Equal(a2 Album) bool

func (*Album) EqualEntry

func (a *Album) EqualEntry(a2 Album) bool

type AlbumArtist

type AlbumArtist struct {
	ID       int
	AlbumID  int
	ArtistID int
}

type AlbumUser

type AlbumUser struct {
	ID        int
	UserID    int
	AlbumID   int
	DeletedAt time.Time
}

type Artist

type Artist struct {
	ID         int
	SpotifyID  string
	Name       string
	Followers  int
	Popularity int
	CoverID    string
	CoverURL   string
	UpdatedAt  time.Time
}

func ArtistModel

func ArtistModel(a sqlc.Artist) *Artist

func (*Artist) Equal

func (a *Artist) Equal(a2 Artist) bool

func (*Artist) EqualEntry

func (a *Artist) EqualEntry(a2 Artist) bool

type Directory

type Directory struct {
	ID       int
	UserID   int
	Name     string
	ParentID int

	// Non db fields
	Playlists []Playlist
}

func DirectoryModel

func DirectoryModel(d sqlc.Directory) *Directory

func (*Directory) Equal

func (d *Directory) Equal(d2 Directory) bool

type DirectoryPlaylist

type DirectoryPlaylist struct {
	ID          int
	DirectoryID int
	PlaylistID  int
}

type History

type History struct {
	ID         int
	UserID     int
	TrackID    int
	PlayedAt   time.Time
	AlbumID    int
	ArtistID   int
	PlaylistID int
	ShowID     int

	// Non db fields
	Track Track
}

func HistoryModel

func HistoryModel(h sqlc.History) *History

type HistoryFilter

type HistoryFilter struct {
	UserID int
	Limit  int
	Offset int
	Start  time.Time
	End    time.Time
}
type Link struct {
	ID                int
	SourceDirectoryID int
	SourcePlaylistID  int
	TargetDirectoryID int
	TargetPlaylistID  int
}

func LinkModel

func LinkModel(l sqlc.Link) *Link

func (*Link) Equal

func (l *Link) Equal(l2 Link) bool

type Playlist

type Playlist struct {
	ID            int
	SpotifyID     string
	OwnerID       int
	Name          string
	Description   string
	Public        bool
	TrackAmount   int
	Collaborative bool
	CoverID       string
	CoverURL      string
	SnapshotID    string
	UpdatedAt     time.Time

	// Non db fields
	Owner       User
	Duplicates  []Track
	Unplayables []Track
}

func PlaylistModel

func PlaylistModel(p sqlc.Playlist) *Playlist

func PlaylistModelPopulated

func PlaylistModelPopulated(p sqlc.Playlist, u sqlc.User) *Playlist

func (*Playlist) Equal

func (p *Playlist) Equal(p2 Playlist) bool

func (*Playlist) EqualEntry

func (p *Playlist) EqualEntry(p2 Playlist) bool

type PlaylistTrack

type PlaylistTrack struct {
	ID         int
	PlaylistID int
	TrackID    int
	CreatedAt  time.Time
	DeletedAt  time.Time
}

type PlaylistUser

type PlaylistUser struct {
	ID         int
	UserID     int
	PlaylistID int
	DeletedAt  time.Time
}

type Show

type Show struct {
	ID            int
	SpotifyID     string
	Name          string
	EpisodeAmount int
	CoverID       string
	CoverURL      string
	UpdatedAt     time.Time
}

func ShowModel

func ShowModel(s sqlc.Show) *Show

func (*Show) Equal

func (s *Show) Equal(s2 Show) bool

func (*Show) EqualEntry

func (s *Show) EqualEntry(s2 Show) bool

type ShowUser

type ShowUser struct {
	ID        int
	UserID    int
	ShowID    int
	DeletedAt time.Time
}

type Task

type Task struct {
	// Task result
	ID       int // ID of the task result
	UserID   int // ID of the user that started the task
	RunAt    time.Time
	Result   TaskResult
	Message  string
	Error    error
	Duration time.Duration

	// Task fields
	UID    string // Identifier of the task
	Name   string
	Active bool
}

func TaskModel

func TaskModel(task sqlc.Task, taskRun sqlc.TaskRun) *Task

type TaskFilter

type TaskFilter struct {
	UserID  int
	TaskUID string
	Result  *TaskResult
	Limit   int
	Offset  int
}

type TaskResult

type TaskResult string
const (
	TaskSuccess TaskResult = "success"
	TaskFailed  TaskResult = "failed"
)

type Track

type Track struct {
	ID         int
	SpotifyID  string
	Name       string
	Popularity int
	UpdatedAt  time.Time

	// Non db fields
	Artists   []Artist
	Playlist  Playlist
	CreatedAt time.Time
	DeletedAt time.Time
}

func TrackModel

func TrackModel(t sqlc.Track) *Track

func (*Track) Equal

func (t *Track) Equal(t2 Track) bool

func (*Track) EqualEntry

func (t *Track) EqualEntry(t2 Track) bool

type TrackArtist

type TrackArtist struct {
	ID       int
	TrackID  int
	ArtistID int
}

type TrackFilter

type TrackFilter struct {
	UserID     int
	PlaylistID int
	Limit      int
	Offset     int
}

type User

type User struct {
	ID          int
	UID         string
	Name        string
	DisplayName string
	Email       string
}

func UserModel

func UserModel(user sqlc.User) *User

func (*User) Equal

func (u *User) Equal(u2 User) bool

Equal returns true if all non unique values are equal

Jump to

Keyboard shortcuts

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