fork
Configure Feed
Select the types of activity you want to include in your feed.
Live video on the AT Protocol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package statedb
2
3import (
4 "time"
5
6 "github.com/google/uuid"
7)
8
9type MultistreamEvent struct {
10 ID string `gorm:"column:id;primarykey"`
11 TargetURI string `gorm:"column:target_uri;primarykey;index:idx_target_created,priority:1"`
12 Message string `gorm:"column:message"`
13 Status string `gorm:"column:status"`
14 CreatedAt time.Time `gorm:"column:created_at;index:idx_target_created,priority:2"`
15}
16
17func (m *MultistreamEvent) TableName() string {
18 return "multistream_events"
19}
20
21func (state *StatefulDB) CreateMultistreamEvent(targetURI, message, status string) error {
22 uu, err := uuid.NewV7()
23 if err != nil {
24 return err
25 }
26 event := &MultistreamEvent{
27 ID: uu.String(),
28 TargetURI: targetURI,
29 Message: message,
30 Status: status,
31 CreatedAt: time.Now().UTC(),
32 }
33 return state.DB.Create(event).Error
34}