refactor: shorten model and table prefixes
This commit is contained in:
@@ -2,18 +2,18 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// SenlinAgentAIRateBucket 保存用户在固定窗口内已占用的 AI 请求配额。
|
||||
// SaAIRateBucket 保存用户在固定窗口内已占用的 AI 请求配额。
|
||||
// 复合唯一键让单条 UPSERT 在数据库层完成跨进程并发仲裁。
|
||||
type SenlinAgentAIRateBucket struct {
|
||||
type SaAIRateBucket struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
UserID uint `gorm:"not null;uniqueIndex:uidx_senlin_agent_ai_rate_bucket,priority:1"`
|
||||
Action string `gorm:"size:100;not null;uniqueIndex:uidx_senlin_agent_ai_rate_bucket,priority:2"`
|
||||
WindowStart time.Time `gorm:"not null;uniqueIndex:uidx_senlin_agent_ai_rate_bucket,priority:3"`
|
||||
UserID uint `gorm:"not null;uniqueIndex:uidx_sa_ai_rate_bucket,priority:1"`
|
||||
Action string `gorm:"size:100;not null;uniqueIndex:uidx_sa_ai_rate_bucket,priority:2"`
|
||||
WindowStart time.Time `gorm:"not null;uniqueIndex:uidx_sa_ai_rate_bucket,priority:3"`
|
||||
Count int `gorm:"not null"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (SenlinAgentAIRateBucket) TableName() string {
|
||||
return "senlin_agent_ai_rate_buckets"
|
||||
func (SaAIRateBucket) TableName() string {
|
||||
return "sa_ai_rate_buckets"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user