Files
cid/model/entity/data/api_interface.go
2026-03-23 14:08:11 +08:00

57 lines
2.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package data
import (
consts "cid/consts/data"
"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",
}