Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRecordNotFound = errors.New("record not found") ErrEditConflict = errors.New("edit conflict") )
View Source
var ErrInvalidRuntimeFormat = errors.New("invalid runtime format")
Functions ¶
func ValidateFilters ¶
func ValidateMovie ¶
Types ¶
type Models ¶
type Movie ¶
type Movie struct { ID int64 `json:"id"` CreatedAt time.Time `json:"-"` Title string `json:"title"` Year int32 `json:"year,omitempty"` // if the Runtime field has the underlying value 0 then // the omitempty make it considered to be empty and the MarshalJSON // won't even be called at all. Runtime Runtime `json:"runtime,omitempty"` Genres []string `json:"genres,omitempty"` Version int32 `json:"version"` }
type MovieModel ¶
func (MovieModel) Delete ¶
func (m MovieModel) Delete(id int64) error
func (MovieModel) Insert ¶
func (m MovieModel) Insert(movie *Movie) error
func (MovieModel) Update ¶
func (m MovieModel) Update(movie *Movie) error
type Runtime ¶
type Runtime int32
Declare a custom runtime type with underlying type of int32.
func (Runtime) MarshalJSON ¶
Implement a MarshalJSON() method on the Runtime type so it satisfies the json.Marshaler interface. This should return the JSON-encoded value for the movie runtime it returns "<runtime> mins"
func (*Runtime) UnmarshalJSON ¶
This will change the Runtime and so we make it pointer receiver
Click to show internal directories.
Click to hide internal directories.