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.
29 lines
564 B
29 lines
564 B
package vql
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"testing"
|
|
|
|
"git.ouxuan.net/3136352472/vql/apijson"
|
|
)
|
|
|
|
func TestNewQueryNode(t *testing.T) {
|
|
apijson.SetQueryAll(func(sql string, args ...interface{}) ([]map[string]interface{}, error) {
|
|
log.Println(sql, args)
|
|
sqlx, err := Analyze(sql)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
log.Println(sqlx.ToSql())
|
|
return nil, nil
|
|
})
|
|
|
|
reqStr := `{ "Moment": { "id":12 } }`
|
|
req := make(map[string]interface{})
|
|
json.Unmarshal([]byte(reqStr), &req)
|
|
|
|
ctx := apijson.NewQueryContext(req)
|
|
|
|
log.Println(ctx.Response())
|
|
}
|