mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
22 lines
408 B
Go
22 lines
408 B
Go
package json
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/eosswedenorg/thalos/api/message"
|
|
"github.com/shufflingpixels/jsontime-go"
|
|
)
|
|
|
|
func createCodec() message.Codec {
|
|
json_codec := jsontime.New("2006-01-02T15:04:05.000", time.UTC)
|
|
|
|
return message.Codec{
|
|
Encoder: json_codec.Marshal,
|
|
Decoder: json_codec.Unmarshal,
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
// Register the json codec.
|
|
message.RegisterCodec("json", createCodec())
|
|
}
|