feat: establish Orbit models, migrations and development baseline
This commit is contained in:
30
platform/model/namespace.go
Normal file
30
platform/model/namespace.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
// Namespace 表示应用在指定环境中的资源隔离边界。
|
||||
// 对应表 orbit_namespaces;这是服务端持久化模型,不直接作为 API 响应。
|
||||
type Namespace struct {
|
||||
// ID 命名空间标识,全局唯一。
|
||||
ID core.ID `db:"id"`
|
||||
// Revision 乐观并发版本,从 1 开始;更新时必须核对预期版本。
|
||||
Revision uint64 `db:"revision"`
|
||||
// CreatedAt 创建时间,统一 UTC,数据库精度为微秒。
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
// UpdatedAt 最后写入时间,统一 UTC;不能代替并发版本。
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
// ApplicationID 所属应用标识。
|
||||
ApplicationID core.ID `db:"application_id"`
|
||||
// Name 可读名称,唯一性范围由对应数据表约束。
|
||||
Name string `db:"name"`
|
||||
// Environment 环境标识,用于区分开发、测试和生产等隔离范围。
|
||||
Environment string `db:"environment"`
|
||||
// Enabled 是否启用;关闭后拒绝相应的新接入或新操作。
|
||||
Enabled bool `db:"enabled"`
|
||||
}
|
||||
|
||||
func (Namespace) TableName() string { return "orbit_namespaces" }
|
||||
Reference in New Issue
Block a user