Files
orbit/platform/model/event.go

31 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// Event 表示追加保存的状态事件,供外部订阅或内部流程接续。
// 对应表 orbit_events;这是服务端持久化模型,不直接作为 API 响应。
type Event struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// WorkflowID 是数据库从不可变事件派生的流程查询索引;不可写,非流程或无有效范围时为空,不能代替归属授权。
WorkflowID *core.ID `db:"workflow_id"`
// 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" }