70 lines
839 B
Go
70 lines
839 B
Go
// generated by jsonenums -type=ShirtSize; DO NOT EDIT
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
func (r ShirtSize) String() string {
|
|
switch r {
|
|
|
|
case NA:
|
|
return "NA"
|
|
|
|
case XS:
|
|
return "XS"
|
|
|
|
case S:
|
|
return "S"
|
|
|
|
case M:
|
|
return "M"
|
|
|
|
case L:
|
|
return "L"
|
|
|
|
case XL:
|
|
return "XL"
|
|
|
|
default:
|
|
return "unknown ShirtSize"
|
|
}
|
|
}
|
|
|
|
func (r ShirtSize) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(r.String())
|
|
}
|
|
|
|
func (r *ShirtSize) UnmarshalJSON(data []byte) error {
|
|
var s string
|
|
if err := json.Unmarshal(data, &s); err != nil {
|
|
return fmt.Errorf("ShirtSize should be a string, got %s", data)
|
|
}
|
|
switch s {
|
|
|
|
case "NA":
|
|
*r = NA
|
|
|
|
case "XS":
|
|
*r = XS
|
|
|
|
case "S":
|
|
*r = S
|
|
|
|
case "M":
|
|
*r = M
|
|
|
|
case "L":
|
|
*r = L
|
|
|
|
case "XL":
|
|
*r = XL
|
|
|
|
default:
|
|
return fmt.Errorf("invalid ShirtSize %q", s)
|
|
}
|
|
return nil
|
|
}
|