models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetYouTubeLink(search string) (string, error)

GetYouTubeLink returns a link for the first video found

Types

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RadioStation

type RadioStation struct {
	Id           int       `json:"id"`
	Abbreviation string    `json:"abbreviation"`
	Name         string    `json:"name"`
	MinDate      time.Time `json:"min_date"`
	MaxDate      time.Time `json:"max_date"`
}

func GetRadioStations

func GetRadioStations(db *sql.DB) ([]RadioStation, error)

GetRadioStations fetches all radio stations from the db

func (*RadioStation) FindSongs

func (radioStation *RadioStation) FindSongs(db *sql.DB, search string, page int) ([]Song, error)

FindSong fetches all songs from the db containing the search string (using pagination)

func (*RadioStation) GetSongs

func (radioStation *RadioStation) GetSongs(db *sql.DB, page int) ([]Song, error)

GetSongs fetches all songs from the db (using pagination)

type Response

type Response struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
	Error   *Error      `json:"error,omitempty"`
}

type Song

type Song struct {
	Id     int    `json:"id"`
	Title  string `json:"title"`
	Artist string `json:"artist"`
	Count  int    `json:"count"`
}

type YouTubeResponse

type YouTubeResponse struct {
	Items []struct {
		ID struct {
			VideoID string `json:"videoId"`
		} `json:"id"`
	} `json:"items"`
}

Jump to

Keyboard shortcuts

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