feat: establish Orbit models, migrations and development baseline

This commit is contained in:
2026-09-17 07:04:21 +08:00
commit 4f2935e36f
84 changed files with 4915 additions and 0 deletions

24
pulse/model/permit.go Normal file
View File

@@ -0,0 +1,24 @@
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// Permit 表示一次执行尝试占用的并发许可及释放历史。
// 对应表 pulse_permits;这是服务端持久化模型,不直接作为 API 响应。
type Permit struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// LimitID 关联的并发限制记录标识。
LimitID core.ID `db:"limit_id"`
// AttemptID 关联的独立执行尝试标识。
AttemptID core.ID `db:"attempt_id"`
// LeaseUntil 已确认的租约截止时间,必须用数据库时间核验。
LeaseUntil time.Time `db:"lease_until"`
// ReleasedAt 许可释放时间;为空表示尚未记录释放。
ReleasedAt *time.Time `db:"released_at"`
}
func (Permit) TableName() string { return "pulse_permits" }