package public import ( "context" dto "dataengine/model/dto/public" svc "dataengine/service/public" "github.com/gogf/gf/v2/frame/g" ) type publicQueryController struct{} // PublicQuery 公共查询控制器 var PublicQuery = new(publicQueryController) // QueryReq 查询请求(包含空结构用于路径) type ClearCacheReq struct { g.Meta `path:"/public/cache/clear" method:"delete" tags:"公共查询" summary:"清除查询缓存"` } // Query 执行公共查询 func (c *publicQueryController) Query(ctx context.Context, req *dto.QueryReq) (res *dto.QueryRes, err error) { return svc.PublicQuery.Query(ctx, req) } // GetTableList 获取可查询表列表 func (c *publicQueryController) GetTableList(ctx context.Context, req *dto.TableListReq) (res *dto.TableListRes, err error) { return svc.PublicQuery.GetTableList(ctx) } // GetColumnList 获取表字段列表 func (c *publicQueryController) GetColumnList(ctx context.Context, req *dto.ColumnListReq) (res *dto.ColumnListRes, err error) { return svc.PublicQuery.GetColumnList(ctx, req.Table) } // ClearCache 清除查询缓存(管理接口) func (c *publicQueryController) ClearCache(ctx context.Context, req *ClearCacheReq) (res *dto.TableListRes, err error) { svc.PublicQuery.ClearTableCache() return &dto.TableListRes{List: []dto.TableInfo{}}, nil }