Files
greenlight/internal/data/movies.go
2025-10-21 18:55:45 +02:00

22 lines
711 B
Go

package data
import "time"
// Movie
/*
Annotate the Movie struct with struct tags to control how the keys
appear in the JSON-encoded output.
*/
type Movie struct {
ID int64 `json:"id"`
CreatedAt time.Time `json:"-"`
Title string `json:"title"`
Year int32 `json:"year,omitempty"`
/*
Use the Runtime type instead of int32. Note that the omitempty directive will still work on this: if the Runtime field has the underlying value 0, then it will be considered empty and omitted -- and the MarshalJSON() method we just made won't be called at all.
*/
Runtime Runtime `json:"runtime,omitempty"`
Genres []string `json:"genres,omitempty"`
Version int32 `json:"version"`
}