You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
754 B
Go
22 lines
754 B
Go
package data
|
|
|
|
import "time"
|
|
|
|
// MUST export fields to serialize them
|
|
|
|
type Movie struct {
|
|
ID int64 `json:"id"`
|
|
CreatedAt time.Time `json:"-"` // omits always
|
|
Title string `json:"title"`
|
|
Year int32 `json:"year,omitzero"`
|
|
// Runtime int32 `json:"runtime,omitzero"`
|
|
// Use the Runtime type instead of int32. Note that the omitzero directive will
|
|
// still work on this: if the Runtime field has the underlying value 0, then it will
|
|
// be considered zero and omitted -- and the MarshalJSON() method we just made
|
|
// won't be called at all.
|
|
// VSCode will complain though about reflection issue
|
|
Runtime Runtime `json:"runtime,omitzero`
|
|
Genres []string `json:"genres,omitzero"`
|
|
Version int32 `json:"version"`
|
|
}
|