model

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: 7 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 Generator added in v0.2.0

type Generator struct {
	ID              int
	UserID          int
	Name            string
	Description     string
	PlaylistID      int
	Interval        time.Duration
	SpotifyOutdated bool
	Params          GeneratorParams
	UpdatedAt       time.Time
	CreatedAt       time.Time

	// Non db fields
	User   User
	Tracks []Track
}

func GeneratorModel added in v0.2.0

func GeneratorModel(g sqlc.Generator) *Generator

type GeneratorParams added in v0.2.0

type GeneratorParams struct {
	TrackAmount         int   `json:"track_amount"`
	ExcludedPlaylistIDs []int `json:"excluded_playlist_ids"`
	ExcludedTrackIDs    []int `json:"excluded_track_ids"`

	Preset GeneratorPreset `json:"preset"`

	ParamsTop    *GeneratorPresetTopParams    `json:"params_top,omitzero"`
	ParamsOldTop *GeneratorPresetOldTopParams `json:"params_old_top,omitzero"`
}

type GeneratorPreset added in v0.2.0

type GeneratorPreset string
const (
	GeneratorPresetTop    GeneratorPreset = "top"
	GeneratorPresetOldTop GeneratorPreset = "old_top"
)

type GeneratorPresetOldTopParams added in v0.2.0

type GeneratorPresetOldTopParams struct {
	PeakWindow   GeneratorWindow `json:"peak_window"`
	RecentWindow GeneratorWindow `json:"recent_window"`
}

type GeneratorPresetTopParams added in v0.2.0

type GeneratorPresetTopParams struct {
	Window GeneratorWindow `json:"window"`
}

type GeneratorTrack added in v0.2.0

type GeneratorTrack struct {
	ID          int
	GeneratorID int
	TrackID     int
}

type GeneratorWindow added in v0.2.0

type GeneratorWindow struct {
	Start            time.Time     `json:"start"`
	End              time.Time     `json:"end"`
	MinPlays         int           `json:"min_plays"`
	BurstInterval    time.Duration `json:"burst_interval"`
	DynamicReference time.Time     `json:"dynamic_reference"`
}

type History

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

	// Non db fields
	Track     Track
	PlayCount int
}

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
	Skipped          *bool
	PlayCountSkipped *bool
}
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
}

func PlaylistTrackModel added in v0.2.0

func PlaylistTrackModel(p sqlc.PlaylistTrack) *PlaylistTrack

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
	Recurring bool
}

func TaskModel

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

type TaskFilter

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

type TaskResult

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

type Track

type Track struct {
	ID         int       `json:"id"`
	SpotifyID  string    `json:"spotify_id"`
	Name       string    `json:"name"`
	Popularity int       `json:"popularity"`
	DurationMs int       `json:"duration_ms"`
	UpdatedAt  time.Time `json:"updated_at"`

	// 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