1
0
Fork 0
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:
Henrik Hautakoski 2023-05-09 15:04:21 +02:00
parent 12d2837218
commit df840da128
2 changed files with 9 additions and 5 deletions

View file

@ -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,
})
}