Documentation ¶
Index ¶
Constants ¶
const ( DefaultOffset uint64 = 0 DefaultLimit uint64 = 20 )
Pagination defaults for controlling the query result set.
Variables ¶
var ErrSongNotFound = errors.New("song not found")
ErrSongNotFound is returned when a requested song is not found in the database.
Functions ¶
This section is empty.
Types ¶
type Pagination ¶
type Pagination struct { Offset uint64 // Current page number (1-based) Limit uint64 // Maximum number of items per page Items uint64 // The number of items in the current page Total uint64 // The total number of items across all pages }
Pagination is used to control the pagination of query results by specifying the page number and the number of items per page (limit).
func (*Pagination) IsEmpty ¶
func (p *Pagination) IsEmpty() bool
IsEmpty checks if the pagination values are not set.
func (*Pagination) SetDefault ¶
func (p *Pagination) SetDefault()
SetDefault sets the default offset and limit values for pagination.
type Song ¶
type Song struct { ID uuid.UUID // Unique identifier for the song GroupName string // Name of the musical group or artist Name string // Title of the song SongDetail // Contains additional details about the song CreatedAt time.Time // Timestamp when the song was created UpdatedAt time.Time // Timestamp when the song was last updated }
Song represents a musical composition with associated details.
type SongDetail ¶
type SongDetail struct { ReleaseDate time.Time // Release date of the song Text string // Lyrics or text of the song Link string // Link to the song (e.g., streaming link) }
SongDetail holds detailed information about a song.
type SongFilter ¶
type SongFilter struct { Field SongFilterField // The field to filter by (e.g., name, group, release date) Value any // The value to match against the specified field }
SongFilter defines the structure for filtering songs based on specific fields and values.
type SongFilterField ¶
type SongFilterField int
SongFilterField represents the type for specifying different song filter fields.
const ( SongGroupNameFilterField SongFilterField = iota SongNameFilterField SongReleaseYearFilterField SongReleaseDateFilterField SongReleaseDateAfterFilterField SongReleaseDateBeforeFilterField SongTextFilterField )
SongFilterField defines the various fields that can be used to filter song queries.
type SongWithVerses ¶
type SongWithVerses struct { ID uuid.UUID // Unique identifier for the song GroupName string // Name of the musical group or artist Name string // Title of the song Verses []string // Lyrics of the song, divided into verses CreatedAt time.Time // Timestamp when the song was created UpdatedAt time.Time // Timestamp when the song was last updated }
SongWithVerses represents a song with its lyrics broken down into verses.