improve gdb; README update

This commit is contained in:
John
2019-10-13 23:05:48 +08:00
parent 1736e71e6b
commit 2dc2610621
3 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,7 @@ English | [简体中文](README_ZH.MD)
# Installation
```
go get -u github.com/gogf/gf
go get -u -v github.com/gogf/gf
```
suggested using `go.mod`:
```

View File

@ -15,6 +15,7 @@
# 特点
* 模块化、松耦合设计;
* 模块丰富,开箱即用;
* 简便及可维护性为宗旨;
* 详尽的开发文档及示例;
* 完善的本地中文化支持;
* 致力于项目的通用方案;

View File

@ -688,11 +688,12 @@ func (bs *dbBase) formatWhere(where interface{}, args []interface{}) (newWhere s
buffer.WriteString(key)
} else {
// 支持key带操作符号注意like也算是操作符号
key = gstr.Trim(key)
if gstr.Pos(key, "?") == -1 {
if gstr.Pos(key, "<") == -1 &&
gstr.Pos(key, ">") == -1 &&
gstr.Pos(key, "=") == -1 &&
gstr.PosI(key, " like") == -1 {
like := " like"
if len(key) > len(like) && gstr.Equal(key[len(key)-len(like):], like) {
buffer.WriteString(key + " ?")
} else if key[len(key)-1] != '<' && key[len(key)-1] != '>' && key[len(key)-1] != '=' {
buffer.WriteString(key + "=?")
} else {
buffer.WriteString(key + " ?")