|
@@ -5,11 +5,23 @@ import (
|
|
|
)
|
|
|
|
|
|
type Event struct {
|
|
|
- Type uint16
|
|
|
+ Type uint16
|
|
|
+ TimestampS uint32
|
|
|
+ TimestampMS uint16
|
|
|
+ SequentialID uint64
|
|
|
+ UniqueID []byte
|
|
|
+ Payload interface{}
|
|
|
}
|
|
|
|
|
|
func (event Event) MarshalJSON() ([]byte, error) {
|
|
|
- array := []interface{}{event.Type}
|
|
|
+ array := []interface{}{
|
|
|
+ event.Type,
|
|
|
+ event.TimestampS,
|
|
|
+ event.TimestampMS,
|
|
|
+ event.SequentialID,
|
|
|
+ event.UniqueID,
|
|
|
+ event.Payload,
|
|
|
+ }
|
|
|
return json.Marshal(array)
|
|
|
}
|
|
|
|
|
@@ -19,5 +31,10 @@ func (event *Event) UnmarshalJSON(input []byte) error {
|
|
|
return err
|
|
|
}
|
|
|
event.Type = uint16(array[0].(float64))
|
|
|
+ event.TimestampS = uint32(array[1].(float64))
|
|
|
+ event.TimestampMS = uint16(array[2].(float64))
|
|
|
+ event.SequentialID = uint64(array[3].(float64))
|
|
|
+ event.UniqueID = array[4].([]byte)
|
|
|
+ event.Payload = array[5]
|
|
|
return nil
|
|
|
}
|