Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Playlist ¶
type Playlist struct {
Tracks []*Track
}
Playlist represents a collection of tracks
func (Playlist) OrderBy ¶
OrderBy sorts `Playlist.Tracks` into an ascending order (small to large, a-z...) specified by a slice of `Attribute`s such as `[]Attribute{Year, Album, Title}`.
For example, given the table: Title Artist Album Year Length ----- ------ ----- ---- ------ Go Chemical Brothers Born In The Echoes 2015 4m20s (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go blink-182 blink-182 2003 1m53s
Sorting by `playlist.OrderBy([]Attribute{Title})` will sort by titles, yielding: Title Artist Album Year Length (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go Chemical Brothers Born In The Echoes 2015 4m20s Go blink-182 blink-182 2003 1m53s
Sorting by `playlist.OrderBy([]Attribute{Year, Title})` will first sort by the year then the title, yielding: Title Artist Album Year Length ----- ------ ----- ---- ------ Go blink-182 blink-182 2003 1m53s (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go Chemical Brothers Born In The Echoes 2015 4m20s