Browse Source

'fix'

master
u 2 years ago
parent
commit
7721e700b2
  1. 10
      builder2.go

10
builder2.go

@ -67,6 +67,9 @@ func (b *Builder2) Sql() (string, error) {
}
filterSql, err := toWhereSql(b.Filter)
if err != nil {
return "", err
}
sql := fmt.Sprintf("select %s from %s ", selectSql, fromSql)
if joinSql != "" {
@ -226,6 +229,9 @@ func toWhereSql(where interface{}) (string, error) {
//[ "a=","1","and",[["c=","3"],"and",["d=","4"]],"or",["b=","2"]]
if whereGjson.IsArray() {
if len(whereGjson.Array()) == 0 {
return "", nil
}
ws := []string{}
expression := whereGjson.Array()
@ -277,6 +283,10 @@ func toWhereSql(where interface{}) (string, error) {
// }
}
} else if whereGjson.IsObject() {
if len(whereGjson.Map()) == 0 {
return "", nil
}
newValue := []interface{}{
"and",
}

Loading…
Cancel
Save