feat: establish Orbit models, migrations and development baseline
This commit is contained in:
28
platform/model/event.go
Normal file
28
platform/model/event.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
// Event 表示追加保存的状态事件,供外部订阅或内部流程接续。
|
||||
// 对应表 orbit_events;这是服务端持久化模型,不直接作为 API 响应。
|
||||
type Event struct {
|
||||
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
|
||||
core.Record
|
||||
// AggregateKind 产生事件的聚合类型,例如任务或流程。
|
||||
AggregateKind string `db:"aggregate_kind"`
|
||||
// AggregateID 产生事件的聚合标识。
|
||||
AggregateID core.ID `db:"aggregate_id"`
|
||||
// AggregateRevision 来源聚合的状态版本,用于去重与迟到事件判断。
|
||||
AggregateRevision uint64 `db:"aggregate_revision"`
|
||||
// Type 事件或信号的稳定类型标识。
|
||||
Type string `db:"type"`
|
||||
// Payload 版本化输入或事件内容;仅承载通用 JSON,不解释行业规则。
|
||||
Payload core.JSON `db:"payload"`
|
||||
// OccurredAt 事件发生时间,统一 UTC。
|
||||
OccurredAt time.Time `db:"occurred_at"`
|
||||
}
|
||||
|
||||
func (Event) TableName() string { return "orbit_events" }
|
||||
Reference in New Issue
Block a user