This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const getLastPlayedGames = `-- name: GetLastPlayedGames :many
|
||||
const getLastPlayedSoundtracks = `-- name: GetLastPlayedSoundtracks :many
|
||||
SELECT
|
||||
g.id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -31,7 +31,7 @@ ORDER BY g.last_played DESC
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetLastPlayedGamesRow struct {
|
||||
type GetLastPlayedSoundtracksRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SoundtrackPlayed int32 `json:"soundtrack_played"`
|
||||
@@ -40,15 +40,15 @@ type GetLastPlayedGamesRow struct {
|
||||
}
|
||||
|
||||
// Last played soundtracks (most recently played)
|
||||
func (q *Queries) GetLastPlayedGames(ctx context.Context, limit int32) ([]GetLastPlayedGamesRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLastPlayedGames, limit)
|
||||
func (q *Queries) GetLastPlayedSoundtracks(ctx context.Context, limit int32) ([]GetLastPlayedSoundtracksRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLastPlayedSoundtracks, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetLastPlayedGamesRow
|
||||
var items []GetLastPlayedSoundtracksRow
|
||||
for rows.Next() {
|
||||
var i GetLastPlayedGamesRow
|
||||
var i GetLastPlayedSoundtracksRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -66,7 +66,7 @@ func (q *Queries) GetLastPlayedGames(ctx context.Context, limit int32) ([]GetLas
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getLeastPlayedGamesWithSongs = `-- name: GetLeastPlayedGamesWithSongs :many
|
||||
const getLeastPlayedSoundtracksWithSongs = `-- name: GetLeastPlayedSoundtracksWithSongs :many
|
||||
SELECT
|
||||
g.id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -88,7 +88,7 @@ ORDER BY g.times_played ASC, g.soundtrack_name
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetLeastPlayedGamesWithSongsRow struct {
|
||||
type GetLeastPlayedSoundtracksWithSongsRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SoundtrackPlayed int32 `json:"soundtrack_played"`
|
||||
@@ -97,15 +97,15 @@ type GetLeastPlayedGamesWithSongsRow struct {
|
||||
}
|
||||
|
||||
// Least played soundtracks with their songs
|
||||
func (q *Queries) GetLeastPlayedGamesWithSongs(ctx context.Context, limit int32) ([]GetLeastPlayedGamesWithSongsRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLeastPlayedGamesWithSongs, limit)
|
||||
func (q *Queries) GetLeastPlayedSoundtracksWithSongs(ctx context.Context, limit int32) ([]GetLeastPlayedSoundtracksWithSongsRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLeastPlayedSoundtracksWithSongs, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetLeastPlayedGamesWithSongsRow
|
||||
var items []GetLeastPlayedSoundtracksWithSongsRow
|
||||
for rows.Next() {
|
||||
var i GetLeastPlayedGamesWithSongsRow
|
||||
var i GetLeastPlayedSoundtracksWithSongsRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -123,7 +123,7 @@ func (q *Queries) GetLeastPlayedGamesWithSongs(ctx context.Context, limit int32)
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getLeastPlayedSongsWithGame = `-- name: GetLeastPlayedSongsWithGame :many
|
||||
const getLeastPlayedSongsWithSoundtrack = `-- name: GetLeastPlayedSongsWithSoundtrack :many
|
||||
SELECT
|
||||
s.soundtrack_id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -138,7 +138,7 @@ ORDER BY s.times_played ASC, s.song_name
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetLeastPlayedSongsWithGameRow struct {
|
||||
type GetLeastPlayedSongsWithSoundtrackRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SongName string `json:"song_name"`
|
||||
@@ -148,15 +148,15 @@ type GetLeastPlayedSongsWithGameRow struct {
|
||||
}
|
||||
|
||||
// Least played songs with their soundtrack info
|
||||
func (q *Queries) GetLeastPlayedSongsWithGame(ctx context.Context, limit int32) ([]GetLeastPlayedSongsWithGameRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLeastPlayedSongsWithGame, limit)
|
||||
func (q *Queries) GetLeastPlayedSongsWithSoundtrack(ctx context.Context, limit int32) ([]GetLeastPlayedSongsWithSoundtrackRow, error) {
|
||||
rows, err := q.db.Query(ctx, getLeastPlayedSongsWithSoundtrack, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetLeastPlayedSongsWithGameRow
|
||||
var items []GetLeastPlayedSongsWithSoundtrackRow
|
||||
for rows.Next() {
|
||||
var i GetLeastPlayedSongsWithGameRow
|
||||
var i GetLeastPlayedSongsWithSoundtrackRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -175,7 +175,7 @@ func (q *Queries) GetLeastPlayedSongsWithGame(ctx context.Context, limit int32)
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getMostPlayedGamesWithSongs = `-- name: GetMostPlayedGamesWithSongs :many
|
||||
const getMostPlayedSoundtracksWithSongs = `-- name: GetMostPlayedSoundtracksWithSongs :many
|
||||
SELECT
|
||||
g.id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -197,7 +197,7 @@ ORDER BY g.times_played DESC, g.soundtrack_name
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetMostPlayedGamesWithSongsRow struct {
|
||||
type GetMostPlayedSoundtracksWithSongsRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SoundtrackPlayed int32 `json:"soundtrack_played"`
|
||||
@@ -206,15 +206,15 @@ type GetMostPlayedGamesWithSongsRow struct {
|
||||
}
|
||||
|
||||
// Most played soundtracks with their songs
|
||||
func (q *Queries) GetMostPlayedGamesWithSongs(ctx context.Context, limit int32) ([]GetMostPlayedGamesWithSongsRow, error) {
|
||||
rows, err := q.db.Query(ctx, getMostPlayedGamesWithSongs, limit)
|
||||
func (q *Queries) GetMostPlayedSoundtracksWithSongs(ctx context.Context, limit int32) ([]GetMostPlayedSoundtracksWithSongsRow, error) {
|
||||
rows, err := q.db.Query(ctx, getMostPlayedSoundtracksWithSongs, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetMostPlayedGamesWithSongsRow
|
||||
var items []GetMostPlayedSoundtracksWithSongsRow
|
||||
for rows.Next() {
|
||||
var i GetMostPlayedGamesWithSongsRow
|
||||
var i GetMostPlayedSoundtracksWithSongsRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -232,7 +232,7 @@ func (q *Queries) GetMostPlayedGamesWithSongs(ctx context.Context, limit int32)
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getMostPlayedSongsWithGame = `-- name: GetMostPlayedSongsWithGame :many
|
||||
const getMostPlayedSongsWithSoundtrack = `-- name: GetMostPlayedSongsWithSoundtrack :many
|
||||
SELECT
|
||||
s.soundtrack_id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -247,7 +247,7 @@ ORDER BY s.times_played DESC, s.song_name
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetMostPlayedSongsWithGameRow struct {
|
||||
type GetMostPlayedSongsWithSoundtrackRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SongName string `json:"song_name"`
|
||||
@@ -257,15 +257,15 @@ type GetMostPlayedSongsWithGameRow struct {
|
||||
}
|
||||
|
||||
// Most played songs with their soundtrack info
|
||||
func (q *Queries) GetMostPlayedSongsWithGame(ctx context.Context, limit int32) ([]GetMostPlayedSongsWithGameRow, error) {
|
||||
rows, err := q.db.Query(ctx, getMostPlayedSongsWithGame, limit)
|
||||
func (q *Queries) GetMostPlayedSongsWithSoundtrack(ctx context.Context, limit int32) ([]GetMostPlayedSongsWithSoundtrackRow, error) {
|
||||
rows, err := q.db.Query(ctx, getMostPlayedSongsWithSoundtrack, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetMostPlayedSongsWithGameRow
|
||||
var items []GetMostPlayedSongsWithSoundtrackRow
|
||||
for rows.Next() {
|
||||
var i GetMostPlayedSongsWithGameRow
|
||||
var i GetMostPlayedSongsWithSoundtrackRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -284,7 +284,7 @@ func (q *Queries) GetMostPlayedSongsWithGame(ctx context.Context, limit int32) (
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getNeverPlayedGames = `-- name: GetNeverPlayedGames :many
|
||||
const getNeverPlayedSoundtracks = `-- name: GetNeverPlayedSoundtracks :many
|
||||
SELECT
|
||||
g.id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -304,7 +304,7 @@ GROUP BY g.id, g.soundtrack_name, g.times_played, g.added
|
||||
ORDER BY g.soundtrack_name
|
||||
`
|
||||
|
||||
type GetNeverPlayedGamesRow struct {
|
||||
type GetNeverPlayedSoundtracksRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SoundtrackPlayed int32 `json:"soundtrack_played"`
|
||||
@@ -312,16 +312,16 @@ type GetNeverPlayedGamesRow struct {
|
||||
Songs []byte `json:"songs"`
|
||||
}
|
||||
|
||||
// Games that have never been played (times_played = 0)
|
||||
func (q *Queries) GetNeverPlayedGames(ctx context.Context) ([]GetNeverPlayedGamesRow, error) {
|
||||
rows, err := q.db.Query(ctx, getNeverPlayedGames)
|
||||
// Soundtracks that have never been played (times_played = 0)
|
||||
func (q *Queries) GetNeverPlayedSoundtracks(ctx context.Context) ([]GetNeverPlayedSoundtracksRow, error) {
|
||||
rows, err := q.db.Query(ctx, getNeverPlayedSoundtracks)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetNeverPlayedGamesRow
|
||||
var items []GetNeverPlayedSoundtracksRow
|
||||
for rows.Next() {
|
||||
var i GetNeverPlayedGamesRow
|
||||
var i GetNeverPlayedSoundtracksRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
@@ -339,7 +339,7 @@ func (q *Queries) GetNeverPlayedGames(ctx context.Context) ([]GetNeverPlayedGame
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getOldestPlayedGames = `-- name: GetOldestPlayedGames :many
|
||||
const getOldestPlayedSoundtracks = `-- name: GetOldestPlayedSoundtracks :many
|
||||
SELECT
|
||||
g.id as soundtrack_id,
|
||||
g.soundtrack_name,
|
||||
@@ -360,7 +360,7 @@ ORDER BY g.last_played ASC
|
||||
LIMIT $1
|
||||
`
|
||||
|
||||
type GetOldestPlayedGamesRow struct {
|
||||
type GetOldestPlayedSoundtracksRow struct {
|
||||
SoundtrackID int32 `json:"soundtrack_id"`
|
||||
SoundtrackName string `json:"soundtrack_name"`
|
||||
SoundtrackPlayed int32 `json:"soundtrack_played"`
|
||||
@@ -369,15 +369,15 @@ type GetOldestPlayedGamesRow struct {
|
||||
}
|
||||
|
||||
// Oldest played soundtracks (least recently played, but has been played at least once)
|
||||
func (q *Queries) GetOldestPlayedGames(ctx context.Context, limit int32) ([]GetOldestPlayedGamesRow, error) {
|
||||
rows, err := q.db.Query(ctx, getOldestPlayedGames, limit)
|
||||
func (q *Queries) GetOldestPlayedSoundtracks(ctx context.Context, limit int32) ([]GetOldestPlayedSoundtracksRow, error) {
|
||||
rows, err := q.db.Query(ctx, getOldestPlayedSoundtracks, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetOldestPlayedGamesRow
|
||||
var items []GetOldestPlayedSoundtracksRow
|
||||
for rows.Next() {
|
||||
var i GetOldestPlayedGamesRow
|
||||
var i GetOldestPlayedSoundtracksRow
|
||||
if err := rows.Scan(
|
||||
&i.SoundtrackID,
|
||||
&i.SoundtrackName,
|
||||
|
||||
Reference in New Issue
Block a user