mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
21 lines
520 B
Go
21 lines
520 B
Go
package tests
|
|
|
|
type KeyWithEncodingMarshaler int
|
|
|
|
func (f KeyWithEncodingMarshaler) MarshalText() (text []byte, err error) {
|
|
return []byte("hello"), nil
|
|
}
|
|
|
|
func (f *KeyWithEncodingMarshaler) UnmarshalText(text []byte) error {
|
|
if string(text) == "hello" {
|
|
*f = 5
|
|
}
|
|
return nil
|
|
}
|
|
|
|
//easyjson:json
|
|
type KeyWithEncodingMarshalers map[KeyWithEncodingMarshaler]string
|
|
|
|
var mapWithEncodingMarshaler KeyWithEncodingMarshalers = KeyWithEncodingMarshalers{5: "hello"}
|
|
var mapWithEncodingMarshalerString = `{"hello":"hello"}`
|