1234567891011121314151617181920212223242526272829 |
- package borealis
- import (
- "encoding/json"
- "reflect"
- "time"
- "github.com/segmentio/ksuid"
- )
- type Event struct {
- Type EventType `json:"type,string"`
- SequentialID uint64 `json:"sequential_id"`
- Timestamp time.Time `json:"timestamp"`
- UniqueID ksuid.KSUID `json:"unique_id"`
- Payload interface{} `json:"payload"`
- }
- func (event Event) Equal(other Event) bool {
- return reflect.DeepEqual(event, other)
- }
- func (event Event) JSON() string {
- output, err := json.Marshal(event)
- if err != nil {
- panic(err)
- }
- return string(output)
- }
|