From 43588655efa524e1dbf025dc594cdbfe6fb2db19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sun, 15 May 2022 17:58:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0notlike=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- option.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/option.go b/option.go index ff682c6..27b6b21 100644 --- a/option.go +++ b/option.go @@ -28,6 +28,7 @@ type Option struct { Start map[string]interface{} `json:"start"` // >= 条件 End map[string]interface{} `json:"end"` // < 条件 Like map[string]string `json:"like"` // like 语句 + NotLike map[string]string `json:"not_like"` // not like 语句 NotEqual map[string]interface{} `json:"not_equal"` // != 语句 } @@ -209,6 +210,36 @@ func WithBatchLike(data map[string]string) SetOption { } } +// WithNotLike NOT LIKE 语句 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 17:50 2022/5/15 +func WithNotLike(field string, value string) SetOption { + return func(o *Option) { + if nil == o.NotLike { + o.NotLike = make(map[string]string) + } + o.NotLike[field] = value + } +} + +// WithBatchNotLike ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 17:52 2022/5/15 +func WithBatchNotLike(data map[string]string) SetOption { + return func(o *Option) { + if nil == o.NotLike { + o.NotLike = make(map[string]string) + } + for field, value := range data { + o.NotLike[field] = value + } + } +} + // WithNotEqual 设置不等于语句 // // Author : go_developer@163.com<白茶清欢>