|
|
|
// generated by gencodec, do not edit.
|
|
|
|
|
|
|
|
package mapconv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (x *X) MarshalJSON() ([]byte, error) {
|
|
|
|
type XJSON struct {
|
|
|
|
M map[replacedString]replacedInt
|
|
|
|
}
|
|
|
|
var enc XJSON
|
|
|
|
enc.M = make(map[replacedString]replacedInt, len(x.M))
|
|
|
|
for k, v := range x.M {
|
|
|
|
enc.M[replacedString(k)] = replacedInt(v)
|
|
|
|
}
|
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *X) UnmarshalJSON(input []byte) error {
|
|
|
|
type XJSON struct {
|
|
|
|
M map[replacedString]replacedInt
|
|
|
|
}
|
|
|
|
var dec XJSON
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
var x0 X
|
|
|
|
if dec.M == nil {
|
|
|
|
return errors.New("missing required field m for X")
|
|
|
|
}
|
|
|
|
x0.M = make(map[string]int, len(dec.M))
|
|
|
|
for k, v := range dec.M {
|
|
|
|
x0.M[string(k)] = int(v)
|
|
|
|
}
|
|
|
|
*x = x0
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *X) MarshalYAML() (interface{}, error) {
|
|
|
|
type XYAML struct {
|
|
|
|
M map[replacedString]replacedInt
|
|
|
|
}
|
|
|
|
var enc XYAML
|
|
|
|
enc.M = make(map[replacedString]replacedInt, len(x.M))
|
|
|
|
for k, v := range x.M {
|
|
|
|
enc.M[replacedString(k)] = replacedInt(v)
|
|
|
|
}
|
|
|
|
return &enc, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *X) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
|
|
type XYAML struct {
|
|
|
|
M map[replacedString]replacedInt
|
|
|
|
}
|
|
|
|
var dec XYAML
|
|
|
|
if err := unmarshal(&dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
var x0 X
|
|
|
|
if dec.M == nil {
|
|
|
|
return errors.New("missing required field m for X")
|
|
|
|
}
|
|
|
|
x0.M = make(map[string]int, len(dec.M))
|
|
|
|
for k, v := range dec.M {
|
|
|
|
x0.M[string(k)] = int(v)
|
|
|
|
}
|
|
|
|
*x = x0
|
|
|
|
return nil
|
|
|
|
}
|