feat: Go 重写后端,替换 Python FastAPI
用 Go (Gin + GORM + SQLite) 重写整个后端: - 单二进制部署,不依赖 Python/pip/SDK - net/http 原生客户端,无 Cloudflare TLS 指纹问题 - 多阶段 Dockerfile:Node 构建前端 + Go 构建后端 + Alpine 运行 - 内存占用从 ~95MB 降至 ~3MB - 完整保留所有 API 路由、JWT 认证、API Key 权限、审计日志
This commit is contained in:
14
models/api_token.go
Normal file
14
models/api_token.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type ApiToken struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
Name string `json:"name" gorm:"type:varchar(255);not null"`
|
||||
Token string `json:"-" gorm:"type:varchar(512);uniqueIndex:ix_api_tokens_token;not null"`
|
||||
Permissions string `json:"permissions" gorm:"type:text;not null"`
|
||||
IsActive bool `json:"is_active" gorm:"not null"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"not null;autoCreateTime"`
|
||||
ExpiresAt *time.Time `json:"expires_at"`
|
||||
LastUsedAt *time.Time `json:"last_used_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user