- 新增 domain 层:model、provider、route、stats 实体 - 新增 service 层:models、providers、routing、stats 业务逻辑 - 新增 repository 层:models、providers、stats 数据访问 - 新增 pkg 工具包:errors、logger、validator - 新增中间件:CORS、logging、recovery、request ID - 新增数据库迁移:初始 schema 和索引 - 新增单元测试和集成测试 - 新增规范文档:config-management、database-migration、error-handling、layered-architecture、middleware-system、request-validation、structured-logging、test-coverage - 移除 config 子包和 model_router(已迁移至分层架构)
24 lines
558 B
Go
24 lines
558 B
Go
package domain
|
||
|
||
import "time"
|
||
|
||
// Provider 供应商领域模型
|
||
type Provider struct {
|
||
ID string `json:"id"`
|
||
Name string `json:"name"`
|
||
APIKey string `json:"api_key"`
|
||
BaseURL string `json:"base_url"`
|
||
Enabled bool `json:"enabled"`
|
||
CreatedAt time.Time `json:"created_at"`
|
||
UpdatedAt time.Time `json:"updated_at"`
|
||
}
|
||
|
||
// MaskAPIKey 掩码 API Key(仅显示最后 4 个字符)
|
||
func (p *Provider) MaskAPIKey() {
|
||
if len(p.APIKey) > 4 {
|
||
p.APIKey = "***" + p.APIKey[len(p.APIKey)-4:]
|
||
} else {
|
||
p.APIKey = "***"
|
||
}
|
||
}
|