代码初始化
This commit is contained in:
94
model/entity/dict/api_datasource_platform.go
Normal file
94
model/entity/dict/api_datasource_platform.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// DatasourcePlatform 数据源平台配置实体
|
||||
type DatasourcePlatform struct {
|
||||
// 主键和标识字段
|
||||
ID int64 `orm:"id" json:"id" description:"主键ID,自增长"`
|
||||
PlatformCode string `orm:"platform_code" json:"platformCode" description:"平台编码,唯一标识"`
|
||||
PlatformName string `orm:"platform_name" json:"platformName" description:"平台名称"`
|
||||
Description string `orm:"description" json:"description" description:"平台描述"`
|
||||
|
||||
// 状态和基础配置
|
||||
Status string `orm:"status" json:"status" description:"状态: ACTIVE启用, INACTIVE停用"`
|
||||
ApiBaseUrl string `orm:"api_base_url" json:"apiBaseUrl" description:"API基础地址"`
|
||||
|
||||
// 认证配置
|
||||
AuthType string `orm:"auth_type" json:"authType" description:"认证类型: TOKEN/API_KEY/OAUTH2/BASIC"`
|
||||
Token string `orm:"token" json:"token" description:"认证token/密钥"`
|
||||
ApiKey string `orm:"api_key" json:"apiKey" description:"API Key"`
|
||||
ClientId string `orm:"client_id" json:"clientId" description:"OAuth2 Client ID"`
|
||||
ClientSecret string `orm:"client_secret" json:"clientSecret" description:"OAuth2 Client Secret"`
|
||||
|
||||
// 限流配置
|
||||
RateLimitPerMinute int `orm:"rate_limit_per_minute" json:"rateLimitPerMinute" description:"每分钟请求限制"`
|
||||
RateLimitPerHour int `orm:"rate_limit_per_hour" json:"rateLimitPerHour" description:"每小时请求限制"`
|
||||
ConcurrencyLimit int `orm:"concurrency_limit" json:"concurrencyLimit" description:"并发连接限制"`
|
||||
RequestTimeoutMs int `orm:"request_timeout_ms" json:"requestTimeoutMs" description:"请求超时时间(毫秒)"`
|
||||
|
||||
// 重试策略
|
||||
MaxRetries int `orm:"max_retries" json:"maxRetries" description:"最大重试次数"`
|
||||
RetryDelayMs int `orm:"retry_delay_ms" json:"retryDelayMs" description:"重试延迟(毫秒)"`
|
||||
|
||||
// 元数据
|
||||
CreatedBy string `orm:"created_by" json:"createdBy" description:"创建人"`
|
||||
CreatedAt *time.Time `orm:"created_at" json:"createdAt" description:"创建时间"`
|
||||
UpdatedBy string `orm:"updated_by" json:"updatedBy" description:"更新人"`
|
||||
UpdatedAt *time.Time `orm:"updated_at" json:"updatedAt" description:"更新时间"`
|
||||
Version int `orm:"version" json:"version" description:"版本号(乐观锁)"`
|
||||
}
|
||||
|
||||
// DatasourcePlatformCol 数据源平台配置表字段定义
|
||||
type DatasourcePlatformCol struct {
|
||||
ID string
|
||||
PlatformCode string
|
||||
PlatformName string
|
||||
Description string
|
||||
Status string
|
||||
ApiBaseUrl string
|
||||
AuthType string
|
||||
Token string
|
||||
ApiKey string
|
||||
ClientId string
|
||||
ClientSecret string
|
||||
RateLimitPerMinute string
|
||||
RateLimitPerHour string
|
||||
ConcurrencyLimit string
|
||||
RequestTimeoutMs string
|
||||
MaxRetries string
|
||||
RetryDelayMs string
|
||||
CreatedBy string
|
||||
CreatedAt string
|
||||
UpdatedBy string
|
||||
UpdatedAt string
|
||||
Version string
|
||||
}
|
||||
|
||||
// DatasourcePlatformCols 数据源平台配置表字段常量
|
||||
var DatasourcePlatformCols = DatasourcePlatformCol{
|
||||
ID: "id",
|
||||
PlatformCode: "platform_code",
|
||||
PlatformName: "platform_name",
|
||||
Description: "description",
|
||||
Status: "status",
|
||||
ApiBaseUrl: "api_base_url",
|
||||
AuthType: "auth_type",
|
||||
Token: "token",
|
||||
ApiKey: "api_key",
|
||||
ClientId: "client_id",
|
||||
ClientSecret: "client_secret",
|
||||
RateLimitPerMinute: "rate_limit_per_minute",
|
||||
RateLimitPerHour: "rate_limit_per_hour",
|
||||
ConcurrencyLimit: "concurrency_limit",
|
||||
RequestTimeoutMs: "request_timeout_ms",
|
||||
MaxRetries: "max_retries",
|
||||
RetryDelayMs: "retry_delay_ms",
|
||||
CreatedBy: "created_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedAt: "updated_at",
|
||||
Version: "version",
|
||||
}
|
||||
98
model/entity/dict/api_field_mapping_config.go
Normal file
98
model/entity/dict/api_field_mapping_config.go
Normal file
@@ -0,0 +1,98 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// FieldMappingConfig 字段映射配置实体
|
||||
type FieldMappingConfig struct {
|
||||
Id int64 `json:"id,string" dc:"配置ID"`
|
||||
ConfigName string `json:"configName" dc:"配置名称"`
|
||||
VendorName string `json:"vendorName" dc:"厂商名称"`
|
||||
ApiName string `json:"apiName" dc:"接口名称"`
|
||||
ApiVersion string `json:"apiVersion" dc:"接口版本"`
|
||||
SourceField string `json:"sourceField" dc:"源字段名"`
|
||||
SourceFieldType string `json:"sourceFieldType" dc:"源字段数据类型"`
|
||||
SourceFieldDesc string `json:"sourceFieldDesc" dc:"源字段描述"`
|
||||
TargetField string `json:"targetField" dc:"目标字段名"`
|
||||
TargetFieldType string `json:"targetFieldType" dc:"目标数据类型"`
|
||||
TargetFieldDesc string `json:"targetFieldDesc" dc:"字段描述"`
|
||||
TransformType string `json:"transformType" dc:"转换类型"`
|
||||
TransformParams map[string]interface{} `json:"transformParams" dc:"转换参数"`
|
||||
ValidationRules map[string]interface{} `json:"validationRules" dc:"验证规则"`
|
||||
DefaultValue string `json:"defaultValue" dc:"默认值"`
|
||||
IsRequired bool `json:"isRequired" dc:"是否必填"`
|
||||
IsActive bool `json:"isActive" dc:"是否启用"`
|
||||
Priority int `json:"priority" dc:"优先级"`
|
||||
BusinessDomain string `json:"businessDomain" dc:"业务域"`
|
||||
FieldGroup string `json:"fieldGroup" dc:"字段分组"`
|
||||
ConfigVersion int `json:"configVersion" dc:"配置版本号"`
|
||||
EffectiveDate *time.Time `json:"effectiveDate" dc:"生效时间"`
|
||||
ExpiryDate *time.Time `json:"expiryDate" dc:"失效时间"`
|
||||
CreatedBy string `json:"createdBy" dc:"创建人"`
|
||||
CreatedTime time.Time `json:"createdTime" dc:"创建时间"`
|
||||
UpdatedBy string `json:"updatedBy" dc:"更新人"`
|
||||
UpdatedTime time.Time `json:"updatedTime" dc:"更新时间"`
|
||||
}
|
||||
|
||||
// FieldMappingConfigCols 字段映射配置表列名
|
||||
type FieldMappingConfigCols struct {
|
||||
Id string
|
||||
ConfigName string
|
||||
VendorName string
|
||||
ApiName string
|
||||
ApiVersion string
|
||||
SourceField string
|
||||
SourceFieldType string
|
||||
SourceFieldDesc string
|
||||
TargetField string
|
||||
TargetFieldType string
|
||||
TargetFieldDesc string
|
||||
TransformType string
|
||||
TransformParams string
|
||||
ValidationRules string
|
||||
DefaultValue string
|
||||
IsRequired string
|
||||
IsActive string
|
||||
Priority string
|
||||
BusinessDomain string
|
||||
FieldGroup string
|
||||
ConfigVersion string
|
||||
EffectiveDate string
|
||||
ExpiryDate string
|
||||
CreatedBy string
|
||||
CreatedTime string
|
||||
UpdatedBy string
|
||||
UpdatedTime string
|
||||
}
|
||||
|
||||
// FieldMappingConfigCol 字段映射配置表列名常量
|
||||
var FieldMappingConfigCol = FieldMappingConfigCols{
|
||||
Id: "id",
|
||||
ConfigName: "config_name",
|
||||
VendorName: "vendor_name",
|
||||
ApiName: "api_name",
|
||||
ApiVersion: "api_version",
|
||||
SourceField: "source_field",
|
||||
SourceFieldType: "source_field_type",
|
||||
SourceFieldDesc: "source_field_desc",
|
||||
TargetField: "target_field",
|
||||
TargetFieldType: "target_field_type",
|
||||
TargetFieldDesc: "target_field_desc",
|
||||
TransformType: "transform_type",
|
||||
TransformParams: "transform_params",
|
||||
ValidationRules: "validation_rules",
|
||||
DefaultValue: "default_value",
|
||||
IsRequired: "is_required",
|
||||
IsActive: "is_active",
|
||||
Priority: "priority",
|
||||
BusinessDomain: "business_domain",
|
||||
FieldGroup: "field_group",
|
||||
ConfigVersion: "config_version",
|
||||
EffectiveDate: "effective_date",
|
||||
ExpiryDate: "expiry_date",
|
||||
CreatedBy: "created_by",
|
||||
CreatedTime: "created_time",
|
||||
UpdatedBy: "updated_by",
|
||||
UpdatedTime: "updated_time",
|
||||
}
|
||||
57
model/entity/dict/api_interface.go
Normal file
57
model/entity/dict/api_interface.go
Normal file
@@ -0,0 +1,57 @@
|
||||
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",
|
||||
}
|
||||
Reference in New Issue
Block a user