[Add] xiang.table.Find query DSL support
This commit is contained in:
parent
486fd702c0
commit
8bd280bb6b
6 changed files with 120 additions and 3 deletions
|
|
@ -27,6 +27,6 @@ func check(t *testing.T) {
|
|||
wskeys = append(wskeys, key)
|
||||
}
|
||||
|
||||
assert.Equal(t, 4, len(keys))
|
||||
assert.Equal(t, 5, len(keys))
|
||||
assert.Equal(t, 1, len(wskeys))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ func check(t *testing.T) {
|
|||
for key := range gou.Flows {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
assert.Equal(t, 24, len(keys))
|
||||
assert.Equal(t, 26, len(keys))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,11 @@ func ProcessFind(process *gou.Process) interface{} {
|
|||
// 参数表
|
||||
process.ValidateArgNums(2)
|
||||
id := process.Args[1]
|
||||
param := api.MergeDefaultQueryParam(gou.QueryParam{}, 2, process.Sid)
|
||||
queryParam := gou.QueryParam{}
|
||||
if process.NumOfArgs() == 3 {
|
||||
queryParam = process.ArgsQueryParams(2)
|
||||
}
|
||||
param := api.MergeDefaultQueryParam(queryParam, 1, process.Sid)
|
||||
|
||||
// 查询数据
|
||||
response := gou.NewProcess(api.Process, id, param).
|
||||
|
|
|
|||
39
tests/apis/demo.http.json
Normal file
39
tests/apis/demo.http.json
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "Demo",
|
||||
"version": "1.0.0",
|
||||
"description": "demo",
|
||||
"group": "demo",
|
||||
"guard": "-",
|
||||
"paths": [
|
||||
{
|
||||
"path": "/user",
|
||||
"method": "GET",
|
||||
"process": "flows.demo.user",
|
||||
"in": ["$query.id"],
|
||||
"out": {
|
||||
"status": 200,
|
||||
"type": "application/json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/admin",
|
||||
"method": "GET",
|
||||
"process": "flows.demo.admin",
|
||||
"in": ["$query.id"],
|
||||
"out": {
|
||||
"status": 200,
|
||||
"type": "application/json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/token",
|
||||
"method": "GET",
|
||||
"process": "flows.demo.token",
|
||||
"in": ["$query.id"],
|
||||
"out": {
|
||||
"status": 200,
|
||||
"type": "application/json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
61
tests/flows/demo/admin.flow.json
Normal file
61
tests/flows/demo/admin.flow.json
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"label": "Auto Login",
|
||||
"version": "1.0.0",
|
||||
"description": "Auto Login for demo",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "User",
|
||||
"process": "models.xiang.user.Get",
|
||||
"args": [
|
||||
{
|
||||
"select": ["id", "email", "name", "type"],
|
||||
"wheres": [{ "column": "id", "value": 1 }],
|
||||
"limit": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Menu",
|
||||
"process": "flows.xiang.menu",
|
||||
"args": ["{{$res.User.0.id}}"]
|
||||
},
|
||||
{
|
||||
"name": "SID",
|
||||
"process": "session.start"
|
||||
},
|
||||
{
|
||||
"name": "JWT",
|
||||
"process": "xiang.helper.JWTMake",
|
||||
"args": [
|
||||
"{{$res.User.0.id}}",
|
||||
{},
|
||||
{
|
||||
"timeout": 3600,
|
||||
"sid": "{{$res.SID}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Set User",
|
||||
"process": "session.set",
|
||||
"args": ["user", "{{$res.User.0}}"]
|
||||
},
|
||||
{
|
||||
"name": "Set issuer",
|
||||
"process": "session.set",
|
||||
"args": ["issuer", "xiang"]
|
||||
},
|
||||
{
|
||||
"name": "Set User ID",
|
||||
"process": "session.set",
|
||||
"args": ["user_id", "{{$res.User.0.id}}"]
|
||||
}
|
||||
],
|
||||
"output": {
|
||||
"sid": "{{$res.SID}}",
|
||||
"user": "{{$res.User.0}}",
|
||||
"menus": "{{$res.Menu}}",
|
||||
"token": "{{$res.JWT.token}}",
|
||||
"expires_at": "{{$res.JWT.expires_at}}"
|
||||
}
|
||||
}
|
||||
13
tests/flows/demo/token.flow.json
Normal file
13
tests/flows/demo/token.flow.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"label": "Auto Login",
|
||||
"version": "1.0.0",
|
||||
"description": "Auto Login for demo",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "User",
|
||||
"process": "flows.demo.admin",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
"output": "{{$res.User.token}}"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue