feat: establish Orbit models, migrations and development baseline
This commit is contained in:
26
platform/model/application.go
Normal file
26
platform/model/application.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
// Application 表示接入应用,承载通用应用身份与启停配置。
|
||||
// 对应表 orbit_applications;这是服务端持久化模型,不直接作为 API 响应。
|
||||
type Application 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"`
|
||||
// Name 可读名称,唯一性范围由对应数据表约束。
|
||||
Name string `db:"name"`
|
||||
// Enabled 是否启用;关闭后拒绝相应的新接入或新操作。
|
||||
Enabled bool `db:"enabled"`
|
||||
}
|
||||
|
||||
func (Application) TableName() string { return "orbit_applications" }
|
||||
Reference in New Issue
Block a user