database

package module
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 8 Imported by: 0

README

tune-bot core

Go module for interacting with tune-bot's various services.

Downloads songs as they are added using yt-dlp.

git commit -am "my update"
git tag vx.x.x
git push origin vx.x.x

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")
	ErrUserNotFound  = errors.New("This user does not exist")
)

Functions

func Connect

func Connect() error

func Disconnect

func Disconnect()

func FindUser added in v1.1.8

func FindUser(username string) (string, error)

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

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     string `json:"id"`
	Url    string `json:"url"`
	Title  string `json:"title"`
	Artist string `json:"artist"`
	Album  string `json:"album"`
	Year   uint16 `json:"year"`
}

func (*Song) AddToPlaylist

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

func (Song) FilePath added in v1.0.1

func (s Song) FilePath() string

func (Song) RemoveFromPlaylist

func (s Song) RemoveFromPlaylist(playlistId string) error

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