Documentation
¶
Index ¶
- func StartDB() (conn *pgx.Conn)
- type Album
- type AlbumStore
- type Artist
- type ArtistStore
- func (as *ArtistStore) AddArtist(artist Artist) (artistID int, err error)
- func (as *ArtistStore) GetArtistByID(artistID int) (artist Artist, err error)
- func (as *ArtistStore) GetArtistBySpotifyID(spotifyID string) (artist Artist, err error)
- func (as *ArtistStore) GetArtistsByName(artistName string) (artists []Artist, err error)
- func (as *ArtistStore) UpdateArtist(artist Artist) (artistId int, err error)
- type Location
- type LocationStore
- func (ls *LocationStore) AddLocation(location Location) (locationID int, err error)
- func (ls *LocationStore) CheckForExistingLocation(locationToCheck Location) (bool, Location)
- func (ls *LocationStore) GetArtistsByLocationID(locationID int) (artists []Artist, err error)
- func (ls *LocationStore) GetLocationByGoogleID(locationID string) (location Location, err error)
- func (ls *LocationStore) GetLocationByID(locationID int) (location Location, err error)
- func (ls *LocationStore) UpdateLocation(location Location) (locationID int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Album ¶
type Album struct {
ID int `json:"id"`
Title string `json:"title"`
ArtistID int `json:"artist_id"`
ReleaseDate time.Time `json:"date"`
}
Album of an artist.
type AlbumStore ¶
AlbumStore database access.
func NewAlbumStore ¶
func NewAlbumStore(db *pgx.Conn) AlbumStore
NewAlbumStore returns a new connection to an album store
func (*AlbumStore) GetAlbumsByArtistID ¶
func (as *AlbumStore) GetAlbumsByArtistID(artistID int) (a []Album, err error)
GetAlbumsByArtistID returns all the albums that are linked to an artist.
type Artist ¶
type Artist struct {
ID int `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Location ` db:"hometown" json:"location"`
Genre string `db:"genre" json:"genre"`
SpotifyID string `db:"spotify_id" json:"spotify_id"`
WikipediaURL string `db:"wikipedia_url" json:"wikipedia_url"`
}
Artist data type including some basic information and location.
type ArtistStore ¶
ArtistStore database access.
func NewArtistStore ¶
func NewArtistStore(db *pgx.Conn) ArtistStore
NewArtistStore returns a new connection to an Artist store
func (*ArtistStore) AddArtist ¶
func (as *ArtistStore) AddArtist(artist Artist) (artistID int, err error)
AddArtist saves an artist to the database.
func (*ArtistStore) GetArtistByID ¶
func (as *ArtistStore) GetArtistByID(artistID int) (artist Artist, err error)
GetArtistByID returns the artist with a matching id.
func (*ArtistStore) GetArtistBySpotifyID ¶
func (as *ArtistStore) GetArtistBySpotifyID(spotifyID string) (artist Artist, err error)
GetArtistBySpotifyID returns the artist with a matching spotify id.
func (*ArtistStore) GetArtistsByName ¶
func (as *ArtistStore) GetArtistsByName(artistName string) (artists []Artist, err error)
GetArtistsByName returns the artist with a matching name.
func (*ArtistStore) UpdateArtist ¶
func (as *ArtistStore) UpdateArtist(artist Artist) (artistId int, err error)
UpdateArtist updates an existing artist.
type Location ¶
type Location struct {
ID int `json:"id"`
City string `json:"city"`
State string `json:"state"`
Country string `json:"country"`
FullLocation string `json:"location_string"`
GooglePlaceID string `json:"google_place_id"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
Location of an artist or band.
type LocationStore ¶
LocationStore database access.
func NewLocationStore ¶
func NewLocationStore(db *pgx.Conn) LocationStore
NewLocationStore returns a new connection to an Location store
func (*LocationStore) AddLocation ¶
func (ls *LocationStore) AddLocation(location Location) (locationID int, err error)
func (*LocationStore) CheckForExistingLocation ¶
func (ls *LocationStore) CheckForExistingLocation(locationToCheck Location) (bool, Location)
func (*LocationStore) GetArtistsByLocationID ¶
func (ls *LocationStore) GetArtistsByLocationID(locationID int) (artists []Artist, err error)
func (*LocationStore) GetLocationByGoogleID ¶
func (ls *LocationStore) GetLocationByGoogleID(locationID string) (location Location, err error)
func (*LocationStore) GetLocationByID ¶
func (ls *LocationStore) GetLocationByID(locationID int) (location Location, err error)
func (*LocationStore) UpdateLocation ¶
func (ls *LocationStore) UpdateLocation(location Location) (locationID int, err error)