mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
api/message/json/codec.go: alias json_codec.Marshal/Unmarshal as encoder/decoder. so that implementation can change and tests uses the correct functions automatically.
This commit is contained in:
parent
12d2837218
commit
df840da128
2 changed files with 9 additions and 5 deletions
|
|
@ -7,13 +7,17 @@ import (
|
|||
"github.com/eosswedenorg/thalos/api/message"
|
||||
)
|
||||
|
||||
var json_codec = jsontime.ConfigWithCustomTimeFormat
|
||||
var (
|
||||
json_codec = jsontime.ConfigWithCustomTimeFormat
|
||||
encoder = json_codec.Marshal
|
||||
decoder = json_codec.Unmarshal
|
||||
)
|
||||
|
||||
func init() {
|
||||
jsontime.SetDefaultTimeFormat("2006-01-02T15:04:05.000", time.UTC)
|
||||
|
||||
message.RegisterCodec("json", message.Codec{
|
||||
Encoder: json_codec.Marshal,
|
||||
Decoder: json_codec.Unmarshal,
|
||||
Encoder: encoder,
|
||||
Decoder: decoder,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue