From 244803880e27d6940ec38bc3239de4c89311aa75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 15 Apr 2023 20:26:32 +0800 Subject: [PATCH] =?UTF-8?q?limit=E6=96=B9=E6=B3=95=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=B3=9B=E5=9E=8B=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 1 + go.sum | 2 ++ option.go | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 388ac91..a5bac7b 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 0a84c81..129c1b1 100644 --- a/go.sum +++ b/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= diff --git a/option.go b/option.go index 24ac2f9..ea5e5bf 100644 --- a/option.go +++ b/option.go @@ -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) } }