This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
packageSqlKit
import(
"dsSzxy/Utils/ConfigUtil"
"dsSzxy/Utils/DbUtil"
"fmt"
"strings"
)
//操作数据库的变量
vardb=DbUtil.Engine
/**
功能:对于简单表提供分页的通用SQL组装方法,返回通用分页的SQL语句和获取查询总数的SQL语句
作者:黄海
时间:2020-02-21
*/
funcCount(baseSqlstring)(int32,error){
//转小写
baseSql=strings.ToLower(baseSql)
//截取去掉最后面的 limit ?
baseSql=strings.Split(baseSql," limit ")[0]
countSql:="select count(1) as count from ("+baseSql+") as t100"