File: key_marshaler_map.go

package info (click to toggle)
golang-github-mailru-easyjson 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 872 kB
  • sloc: makefile: 117; sh: 4
file content (20 lines) | stat: -rw-r--r-- 520 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"}`