重构: base 包资源核心类型迁移到 req/resx,新增 res_watcher/res_api_param
base/resource.go、resource_hooks.go、resource_test.go、query_field.go 删除,ResField 等具体实现搬到 req/resx(见 res_field.go 里的类型别名)。res_listener.go 替换成 res_watcher.go,对应资源变更监听概念改名。新增 res_api_param.go 及配套测试(ResApi 参数建模,给 MCP tool 的 JSON Schema 生成用)。
This commit is contained in:
+5
-8
@@ -1,22 +1,17 @@
|
||||
package base
|
||||
|
||||
type ResApiParam struct {
|
||||
Code string `db:"code" json:"code"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Category string `db:"category" json:"category"`
|
||||
DataType string `db:"type" json:"type"`
|
||||
IsRequired bool `db:"isRequired" json:"isRequired"`
|
||||
}
|
||||
|
||||
type ResApi struct {
|
||||
Uuid string `db:"uuid"`
|
||||
PUuid string `db:"pUuid"`
|
||||
Code string `db:"code"`
|
||||
UriPrefix string `db:"uri_prefix"`
|
||||
Name string `db:"name"`
|
||||
Desc string `db:"desc"`
|
||||
PrimaryKey string `db:"primaryKey"`
|
||||
ResourceUuid string `db:"resource_uuid"`
|
||||
Method string `db:"method"`
|
||||
Action string `db:"action"`
|
||||
Version string `db:"version"`
|
||||
Params []ResApiParam `db:"params"`
|
||||
Roles []string `db:"roles"`
|
||||
IsAuthDB int `db:"is_auth_db"` // 启用权限过滤
|
||||
@@ -25,3 +20,5 @@ type ResApi struct {
|
||||
}
|
||||
|
||||
type GetResApi func(code string) (ResApi, bool)
|
||||
|
||||
type GetResApiChilds func(code string) []ResApi
|
||||
|
||||
Reference in New Issue
Block a user