Updated generated code in example

This commit is contained in:
damnever 2017-05-13 18:35:02 +08:00
parent 78f796a291
commit 9275cb5b7e
2 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,7 @@ func init() {
}
}
// MarshalJSON is generated so ShirtSize satisfies json.Marshaler.
func (r ShirtSize) MarshalJSON() ([]byte, error) {
if s, ok := interface{}(r).(fmt.Stringer); ok {
return json.Marshal(s.String())
@ -52,6 +53,7 @@ func (r ShirtSize) MarshalJSON() ([]byte, error) {
return json.Marshal(s)
}
// UnmarshalJSON is generated so ShirtSize satisfies json.Unmarshaler.
func (r *ShirtSize) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {

View File

@ -44,6 +44,7 @@ func init() {
}
}
// MarshalJSON is generated so WeekDay satisfies json.Marshaler.
func (r WeekDay) MarshalJSON() ([]byte, error) {
if s, ok := interface{}(r).(fmt.Stringer); ok {
return json.Marshal(s.String())
@ -55,6 +56,7 @@ func (r WeekDay) MarshalJSON() ([]byte, error) {
return json.Marshal(s)
}
// UnmarshalJSON is generated so WeekDay satisfies json.Unmarshaler.
func (r *WeekDay) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {