limit方法改用泛型实现
This commit is contained in:
parent
860fe73996
commit
244803880e
1
go.mod
1
go.mod
@ -14,6 +14,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20230415122042-4c7d35da1715 // indirect
|
||||
github.com/Jeffail/gabs v1.4.0 // indirect
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
|
||||
github.com/bytedance/sonic v1.8.7 // indirect
|
||||
|
2
go.sum
2
go.sum
@ -1,5 +1,7 @@
|
||||
git.zhangdeman.cn/zhangdeman/logger v0.0.0-20230212080829-b9bb99b256ae h1:W+1px+Eq67KlsvLxVcO6rhCCl1qBeiRcqP0vfajx+nw=
|
||||
git.zhangdeman.cn/zhangdeman/logger v0.0.0-20230212080829-b9bb99b256ae/go.mod h1:maPH+eH8+PHplzyJMdXFe1xg1cVq2Ryzo2h/57lwiDs=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20230415122042-4c7d35da1715 h1:GvwI5KZpZHjcXijCAfqFAeRimEfcK6p+gE6y2LPj8NM=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20230415122042-4c7d35da1715/go.mod h1:tRHc2Dr8B7XqUb0kE76anWaN/9RpwWbeIe5alI8/mJE=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230211164227-256094968151 h1:j537bRLQL1FlkdXTIaT9Ecjx5eogkPsGiTOWIEFQlc8=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230211164227-256094968151/go.mod h1:SyRTkOz6gxUVn3S/Qtkf+rhKV0I1ym8lwsT8YjggYFs=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230408183742-5cfbbbb8328c h1:qot3eyP+ICHDMdFDHTP2uv9Qng3jkO7ro95LkV2GXpw=
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user