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