Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonMarshal ¶
func JsonMarshal[T Recordable](t T) ([]byte, error)
JsonMarshal returns the Recordable message as json bytes. To decode the value you must Register(t) first.
func Register ¶
func Register[T Recordable](t T)
Types ¶
type Envelope ¶
type Envelope struct {
Type string
Payload json.RawMessage
}
type EnvelopeEncode ¶
type Recordable ¶
type Recordable interface {
// TypeName is used during encoding/decoding to determine what the payload
// of each messages concrete type is. You should NOT use the golang %T as
// that will change if you move the type to a different package.
TypeName() string
Ts() time.Time
SetId(int64) Recordable
}
func JsonUnmarshal ¶
func JsonUnmarshal(data []byte) (Recordable, error)
JsonUnmarshal will decode a Recordable message from json bytes. You must Register(t) any types at least once before attempting to decode them.
type SqliteRecorder ¶
type SqliteRecorder struct {
// contains filtered or unexported fields
}
func (*SqliteRecorder) Close ¶
func (r *SqliteRecorder) Close() error
func (*SqliteRecorder) Read ¶
func (r *SqliteRecorder) Read(n int) ([]Recordable, error)
func (*SqliteRecorder) Save ¶
func (r *SqliteRecorder) Save(msg Recordable) (Recordable, error)
Click to show internal directories.
Click to hide internal directories.