-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support template interceptor #63
Conversation
@@ -19,3 +19,26 @@ SELECT 1; | |||
|
|||
03/14/2012, 01/01/2013 and 07/05/2014; | |||
|
|||
-- SQLNESS TEMPLATE {"name": "test"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse this old example to add test, also I plan to combine interceptor demos into one since their logic are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
81ca4fd
to
f2e08a8
Compare
/// In order to generate multiple queries, you can use the builtin function | ||
/// `sql_delimiter()` to insert a delimiter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need a special function to insert delimiter, but not write it in literal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- SQLNESS TEMPLATE {"aggr": ["sum", "avg", "count"]}
{% for item in aggr %}
SELECT {{item}}(c) from t {%if not loop.last %} {{sql_delimiter()}} {% endif %}
{% endfor %}
;
See this demo, ;
is used to separate different SQL, so we can't write it directly in our template.
@waynexia Any more problems? I plan to merge this PR this week, and do some work to polish documentation, it's missing lots of new features. |
Great 👍 I leave for a few days, it looks good to me |
@jiacai2050 Let's release a 0.6.0 for this feature? |
Released. |
Closes #51