You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
584 B

package vql
import (
"encoding/json"
"log"
"testing"
)
func Test_toOrderSql(t *testing.T) {
text := `{
"as": "test",
"select": [
"col1",
"col2"
],
"from": {
"as": "test",
"select": [
"col1",
"col2"
],
"from": "table1"
},
"join": "left join table2 on table1.id = table2.id",
"where": {
"col1": "value1",
"col2": "value2",
"col3": 12
}
}`
var builder Builder2
err := json.Unmarshal([]byte(text), &builder)
if err != nil {
t.Error(err)
}
sql, err := builder.Sql()
if err != nil {
t.Error(err)
}
log.Println(sql)
}