core

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceNoUsers = errors.New("There are no users associated with this device")
	ErrInvalidLogin  = errors.New("Invalid login credentials")
	ErrNoDiscordUser = errors.New("There are no users associated with this Discord account")
	ErrNoUser        = errors.New("This user does not exist")
)

Functions

func Connect

func Connect() error

func Disconnect

func Disconnect()

func FindUser

func FindUser(username string) (string, error)

Attempt to find a User from a given username, return its ID if it exists

func PrintDebug

func PrintDebug(msg string)

func PrintError

func PrintError(msg string)

func PrintLnColor

func PrintLnColor(msg string, colour color)

func PrintSuccess

func PrintSuccess(msg string)

Types

type Device

type Device struct {
	Id     string `json:"id"`
	UserId string `json:"userId"`
	Mac    string `json:"mac"`
}

func (*Device) GetUser

func (d *Device) GetUser() (User, error)
func (d *Device) Link() error

type Discord

type Discord struct {
	Id     string `json:"id"`
	UserId string `json:"userId"`
	Name   string `json:"name"`
}

func (*Discord) GetUser

func (d *Discord) GetUser() (User, error)
func (d *Discord) Link() error

type Playlist

type Playlist struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Songs   []Song `json:"songs"`
}

func (*Playlist) Create

func (p *Playlist) Create(userId string) error

func (*Playlist) Delete

func (p *Playlist) Delete() error

func (*Playlist) Update

func (p *Playlist) Update() error

type Song

type Song struct {
	Id     sql.NullString `json:"id"`
	Code   sql.NullString `json:"code"`
	Title  sql.NullString `json:"title"`
	Artist sql.NullString `json:"artist"`
	Album  sql.NullString `json:"album"`
	Year   sql.NullInt16  `json:"year"`
}
func Search(query string, numResults int) []Song

func (*Song) AddToPlaylist

func (s *Song) AddToPlaylist(playlistId string) error

func (Song) FilePath

func (s Song) FilePath() string

func (Song) RemoveFromPlaylist

func (s Song) RemoveFromPlaylist(playlistId string) error

func (Song) String

func (s Song) String() string

type User

type User struct {
	Id        string     `json:"id"`
	Username  string     `json:"username"`
	Password  string     `json:"password,omitempty"` // remember to ALWAYS set this to = "" before writing out data!
	Playlists []Playlist `json:"playlists"`
	Blacklist Playlist   `json:"blacklist"`
}

func (*User) Create

func (u *User) Create() error

func (*User) Read

func (u *User) Read() error

Jump to

Keyboard shortcuts

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