package model import "github.com/lib/pq" //pq.StringArray type ApiKey_PG struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement"` Name string `gorm:"column:name;not null;unique;index:idx_apikey_name"` ApiType string `gorm:"column:apitype;not null;unique;index:idx_apikey_apitype"` ApiKey string `gorm:"column:apikey;not null;unique;uniqueIndex:idx_apikey"` Status int `gorm:"type:int;default:1"` // enabled 1, disabled 0 Endpoint string `gorm:"column:endpoint;comment:接入点"` ResourceNmae string `gorm:"column:resource_name;comment:azure资源名称"` DeploymentName string `gorm:"column:deployment_name;comment:azure部署名称"` ApiSecret string `gorm:"column:api_secret"` ModelPrefix string `gorm:"column:model_prefix;comment:模型前缀"` ModelAlias string `gorm:"column:model_alias;comment:模型别名"` SupportModels pq.StringArray `gorm:"column:support_models;type:text[]"` CreatedAt int64 `gorm:"column:created_at;autoUpdateTime" json:"created_at,omitempty"` UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime" json:"updated_at,omitempty"` } func (ApiKey_PG) TableName() string { return "apikeys" } type ApiKey struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement"` Name string `gorm:"column:name;not null;unique;index:idx_apikey_name"` ApiType string `gorm:"column:apitype;not null;unique;index:idx_apikey_apitype"` ApiKey string `gorm:"column:apikey;not null;unique;index:idx_apikey_apikey"` Status int `gorm:"type:int;default:1"` // enabled 1, disabled 0 Endpoint string `gorm:"column:endpoint"` ResourceNmae string `gorm:"column:resource_name"` DeploymentName string `gorm:"column:deployment_name"` ApiSecret string `gorm:"column:api_secret"` ModelPrefix string `gorm:"column:model_prefix"` ModelAlias string `gorm:"column:model_alias"` SupportModels []string `gorm:"column:support_models;type:json"` CreatedAt int64 `gorm:"column:created_at;autoUpdateTime" json:"created_at,omitempty"` UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime" json:"updated_at,omitempty"` } func (ApiKey) TableName() string { return "apikeys" }