Files
data-engine/model/entity/dict/api_interface.go

58 lines
2.1 KiB
Go
Raw Normal View History

2026-04-02 11:51:44 +08:00
package dict
import (
consts "cid/consts/api-feature"
"gitea.com/red-future/common/beans"
)
// ApiInterface 接口管理实体
type ApiInterface struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"所属平台ID"`
Name string `orm:"name" json:"name" description:"接口名称"`
Code string `orm:"code" json:"code" description:"接口编码"`
Url string `orm:"url" json:"url" description:"接口地址"`
Method consts.ApiMethod `orm:"method" json:"method" description:"请求方法GET/POST/PUT/DELETE等"`
Status consts.PlatformStatus `orm:"status" json:"status" description:"接口状态active启用/inactive停用"`
// 认证类型
AuthType string `orm:"auth_type" json:"authType" description:"认证类型oauth2/apikey/basic等"`
// 请求配置 (JSONB)
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置"`
// 响应配置 (JSONB)
ResponseConfig map[string]interface{} `orm:"response_config" json:"responseConfig" description:"响应配置"`
// 独立限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"接口独立限流配置(可选,覆盖平台配置)"`
}
// ApiInterfaceCol 接口表字段定义
type ApiInterfaceCol struct {
beans.SQLBaseCol
PlatformId string
Name string
Code string
Url string
Method string
Status string
AuthType string
RequestConfig string
ResponseConfig string
LimitConfig string
}
// ApiInterfaceCols 接口表字段常量
var ApiInterfaceCols = ApiInterfaceCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
Name: "name",
Code: "code",
Url: "url",
Method: "method",
Status: "status",
AuthType: "auth_type",
RequestConfig: "request_config",
ResponseConfig: "response_config",
LimitConfig: "limit_config",
}