| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package functions
-
- import (
- "git.x2erp.com/qdy/go-base/ctx"
- "git.x2erp.com/qdy/go-base/model/request"
-
- "git.x2erp.com/qdy/go-db/factory/database"
- )
-
- // 执行查询,返回CSV数据格式。无参数查询
- func QueryToCSV(dbname string, dbsFactory *database.DBSFactory, req request.QueryRequest, reqCtx *ctx.RequestContext) ([]byte, error) {
-
- if dbFactory, err := dbsFactory.CreateDBFactory(dbname); err != nil {
- return nil, err
- } else {
- return dbFactory.QueryToCSV(req.SQL, req.WriterHeader, reqCtx)
- }
-
- }
-
- // 执行查询,返回CSV数据格式。带参数名称进行查询
- func QueryParamNameToCSV(dbname string, dbsFactory *database.DBSFactory, req request.QueryRequest, reqCtx *ctx.RequestContext) ([]byte, error) {
-
- if dbFactory, err := dbsFactory.CreateDBFactory(dbname); err != nil {
- return nil, err
- } else {
- return dbFactory.QueryParamsNameToCSV(req.SQL, req.WriterHeader, req.Params, reqCtx)
- }
-
- }
-
- // 执行查询,返回CSV数据格式。带占位参数进行查询
- func QueryPositionalToCSV(dbname string, dbsFactory *database.DBSFactory, req request.QueryRequest, reqCtx *ctx.RequestContext) ([]byte, error) {
-
- if dbFactory, err := dbsFactory.CreateDBFactory(dbname); err != nil {
- return nil, err
- } else {
- return dbFactory.QueryPositionalToCSV(req.SQL, req.WriterHeader, req.PositionalParams, reqCtx)
- }
-
- }
|