|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package types
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"errors"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -270,3 +271,17 @@ func (data Data) MustGetTimestamp(key string) Timestamp {
|
|
|
|
|
value, _ := data.GetTimestamp(key)
|
|
|
|
|
return value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (data Data) JSON() ([]byte, error) {
|
|
|
|
|
bs, err := json.Marshal(&data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bs, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (data Data) MustJSON() []byte {
|
|
|
|
|
bs, _ := data.JSON()
|
|
|
|
|
return bs
|
|
|
|
|
}
|
|
|
|
|