turns out rewriting all of your database code takes a while
This commit is contained in:
parent
1998a36d6d
commit
965d6f5c3e
30 changed files with 947 additions and 1036 deletions
|
@ -1,10 +1,30 @@
|
|||
package model
|
||||
|
||||
type Track struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Lyrics string `json:"lyrics"`
|
||||
PreviewURL string `json:"previewURL" db:"preview_url"`
|
||||
Release *Release `json:"-" db:"-"`
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type (
|
||||
Track struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Lyrics string `json:"lyrics"`
|
||||
PreviewURL string `json:"previewURL" db:"preview_url"`
|
||||
}
|
||||
|
||||
DisplayTrack struct {
|
||||
*Track
|
||||
Lyrics template.HTML
|
||||
Number int
|
||||
}
|
||||
)
|
||||
|
||||
func (track Track) MakeDisplay(number int) DisplayTrack {
|
||||
return DisplayTrack{
|
||||
Track: &track,
|
||||
Lyrics: template.HTML(strings.Replace(track.Lyrics, "\n", "<br>", -1)),
|
||||
Number: number,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue