limit方法改用泛型实现

This commit is contained in:
2023-04-15 20:26:32 +08:00
parent 860fe73996
commit 244803880e
3 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,8 @@
// Date : 2022-05-15 11:43
package mysql
import "git.zhangdeman.cn/zhangdeman/op_type"
// SetOption 设置选项
//
// Author : go_developer@163.com<白茶清欢>
@ -77,10 +79,10 @@ func WithWhere(where map[string]interface{}) SetOption {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 12:00 2022/5/15
func WithLimit(limit int, offset int) SetOption {
func WithLimit[T op_type.Int](limit T, offset T) SetOption {
return func(o *Option) {
o.Limit = limit
o.Offset = offset
o.Limit = int(limit)
o.Offset = int(offset)
}
}