-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
klarysz
committed
Jul 29, 2023
1 parent
dfbe7c6
commit 64f5486
Showing
20 changed files
with
279 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ type ( | |
Parent string | ||
Name string | ||
Context int | ||
Ensure bool | ||
Args []string | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{"@indexBy@": "id"}, | ||
{ | ||
"id": 1, | ||
"name": "BAR - 1", | ||
"price": 1.1234567801234567, | ||
"tax": 0.0112345675 | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "BAR - 2", | ||
"price": 2.2345678012345678, | ||
"tax": 0.022345679 | ||
}, | ||
{ | ||
"id": 3, | ||
"name": "BAR - 3", | ||
"price": 3.345678012345678, | ||
"tax": 0.03345678 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"id": 3, | ||
"name": "BAR - 3", | ||
"price": 3.345678012345678, | ||
"tax": 0.03345678 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"Name": "$tagId", | ||
"URL": "$path/params_group.sql", | ||
"Args": "" | ||
} |
22 changes: 22 additions & 0 deletions
22
e2e/local/regression/cases/065_params_group/params_group.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* { | ||
"URI":"params-group", | ||
"Method": "GET", | ||
"Include": ["./templates.yaml"] | ||
} */ | ||
|
||
|
||
#set($_ = $PriceMin<int>(query/priceMin).WithTag('velty:"names=PriceMin|ValueMin"').Optional()) | ||
#set($_ = $PriceMax<int>(query/priceMax).WithTag('velty:"names=PriceMax|ValueMax"').Optional()) | ||
#set($_ = $IDMin<int>(query/idMin).WithTag('velty:"names=IDMin|ValueMin"').Optional()) | ||
#set($_ = $IDMax<int>(query/idMax).WithTag('velty:"names=IDMax|ValueMax"').Optional()) | ||
#set($_ = $PriceRange<?>(group/PriceMin,PriceMax).WithPredicate(0, "custom_range", "t", "PRICE").Optional()) | ||
#set($_ = $IDRange<?>(group/IDMin,IDMax).WithPredicate(0, "custom_range", "t", "ID").Optional()) | ||
|
||
SELECT bar.* | ||
FROM (SELECT * | ||
FROM BAR t | ||
WHERE 1 = 1 ${predicate.Builder().CombineOr( | ||
$predicate.Ctx(0, "AND"), | ||
$predicate.Ctx(1, "OR" ) | ||
).Build("AND")} | ||
) bar |
22 changes: 22 additions & 0 deletions
22
e2e/local/regression/cases/065_params_group/templates.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Templates: | ||
- Name: "custom_range" | ||
Args: | ||
- Name: "Alias" | ||
Position: 0 | ||
- Name: "ColumnName" | ||
Position: 1 | ||
Source: | | ||
${Alias}.${ColumnName} BETWEEN | ||
#if($FilterValue.Has.ValueMin) | ||
$criteria.AppendBinding($FilterValue.ValueMin) | ||
#else | ||
0 | ||
#end | ||
AND | ||
#if($FilterValue.Has.ValueMax) | ||
$criteria.AppendBinding($FilterValue.ValueMax) | ||
#else | ||
10000 | ||
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
init: | ||
parentPath: $parent.path | ||
pipeline: | ||
|
||
test: | ||
action: http/runner:send | ||
requests: | ||
- Method: GET | ||
URL: http://127.0.0.1:8080/v1/api/dev/params-group | ||
Expect: | ||
Code: 200 | ||
JSONBody: $LoadJSON('${parentPath}/expect1.json') | ||
|
||
- Method: GET | ||
URL: http://127.0.0.1:8080/v1/api/dev/params-group?priceMin=3&priceMax=4 | ||
Expect: | ||
Code: 200 | ||
JSONBody: $LoadJSON('${parentPath}/expect2.json') | ||
|
||
- Method: GET | ||
URL: http://127.0.0.1:8080/v1/api/dev/params-group?priceMin=3&priceMax=4&idMin=4&idMax=5 | ||
Expect: | ||
Code: 200 | ||
JSONBody: $LoadJSON('${parentPath}/expect3.json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.