limit方法改用泛型实现
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user