Version: v0.11.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 8 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Song

type Song struct {

	Title      string `json:"title"`
	Artist     string `json:"artist"`
	Rating     int    `json:"rating"`
	Opinion    string `json:"opinion"`
	SpotifyURL string `json:"spotify_url"`

func (*Song) AfterAPIUpdate

func (s *Song) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error

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

func (s *Song) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error

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

func (s *Song) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Song) String

func (s *Song) String() string

String defines the display name of a Song in the CMS list-view

func (*Song) Update

func (s *Song) Update(res http.ResponseWriter, req *http.Request) error

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL