Added a duration field to Song_ struct.
This commit is contained in:
parent
a741e3eb9a
commit
c054c3b32e
@ -11,6 +11,7 @@ import (
|
||||
type Song_ struct {
|
||||
Artist string
|
||||
Title string
|
||||
Duration time.Duration
|
||||
MaxListeners int
|
||||
StartAt time.Time
|
||||
}
|
||||
@ -23,11 +24,13 @@ func (s *Song_) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(&struct {
|
||||
Artist string `json:"artist"`
|
||||
Title string `json:"title"`
|
||||
Duration int64 `json:"duration_milliseconds"`
|
||||
MaxListeners int `json:"listeners"`
|
||||
StartAt string `json:"start_at"`
|
||||
}{
|
||||
Artist: s.Artist,
|
||||
Title: s.Title,
|
||||
Duration: s.Duration.Milliseconds(),
|
||||
MaxListeners: s.MaxListeners,
|
||||
StartAt: s.StartAt.UTC().Format(time.RFC3339)})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user