Use Runtime type instead of int32 in our Movie struct.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 54s
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 54s
This commit is contained in:
@@ -12,7 +12,10 @@ type Movie struct {
|
||||
CreatedAt time.Time `json:"-"`
|
||||
Title string `json:"title"`
|
||||
Year int32 `json:"year,omitempty"`
|
||||
Runtime int32 `json:"runtime,omitempty,string"`
|
||||
Genres []string `json:"genres,omitempty"`
|
||||
Version int32 `json:"version"`
|
||||
/*
|
||||
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,string"`
|
||||
Genres []string `json:"genres,omitempty"`
|
||||
Version int32 `json:"version"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user