常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

48 lines
774 B

package helper
import (
"strings"
)
/**
* 处理传递的参数
* @param param
* @return
* 2020/05/15
* gz
*/
func ParamsString(param string) string {
if strings.Contains(param, " ") {
return ""
}
return param
}
/**
* 根据第几页计算从第几行开始
* @param pageNum 第几页
* @param pageSize 每页几行
* @return from,offset 开始行数,偏移量
* 2020/05/15
* gz
*/
func GetPage(pageNum, pageSize interface{}) (string, string) {
var from string
var offset int = ToInt(pageSize)
var pageNumInt, pageSizeInt int = ToInt(pageNum), ToInt(pageSize)
if pageNumInt < 1 {
pageNumInt = 1
}
if pageSizeInt < 1 {
offset = 10
pageSizeInt = 10
}
from = ToString((pageNumInt - 1) * pageSizeInt)
return from, ToString(offset)
}