Documentation ¶
Index ¶
- type Song
- func (s *Song) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error
- func (s *Song) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error
- func (s *Song) MarshalEditor() ([]byte, error)
- func (s *Song) String() string
- func (s *Song) Update(res http.ResponseWriter, req *http.Request) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Song ¶
type Song struct { item.Item Title string `json:"title"` Artist string `json:"artist"` Rating int `json:"rating"` Opinion string `json:"opinion"` SpotifyURL string `json:"spotify_url"` }
func (*Song) AfterAPIUpdate ¶
AfterAPIUpdate is called after Update, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request.
func (*Song) BeforeAPIUpdate ¶
BeforeAPIUpdate is only called if the Song type implements api.Updateable It is called before Update, and returning an error will cancel the request causing the system to reject the data sent in the POST
func (*Song) MarshalEditor ¶
MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable
func (*Song) Update ¶
Update is called after BeforeAPIUpdate and is where you may influence the merge process. For example, maybe you don't want an empty string for the Title or Artist field to be accepted by the update request. Updates will always merge with existing values, but by default will accept zero value as an update if sent.