@@ -56,3 +56,55 @@ the query's name. You can put quotes around arguments that include spaces.
5656```
5757\n user_by_name "Skelly McDermott"
5858```
59+
60+ ## Parameters Aggregation
61+
62+ Named queries also supports parameters aggregation via two placeholders.
63+ ` $* ` for raw aggregation and ` $@ ` for string aggregation.
64+ The former use the raw value of aggregated parameters, the later will quote
65+ each aggregated value.
66+
67+ ### Raw Aggregation
68+ ```
69+ \ns users_by_age select * from users where id in ($*)
70+ ```
71+
72+ When you call a named query with parameters, just add any (at least one)
73+ parameters after the query's name.
74+
75+ ```
76+ \n users_by_age 42 1337
77+ ```
78+
79+ ### String Aggregation
80+ ```
81+ \ns users_by_categories select * from users where category in ($@)
82+ ```
83+
84+ When you call a named query with parameters, just add any (at least one)
85+ the parameters after the query's name.
86+ You can put quotes around arguments that include spaces.
87+
88+ ```
89+ \n users_by_categories "home user" "mobile user" superuser
90+ ```
91+
92+ ## Combining Positional Parameters and Parameters Aggregation
93+ It is possible to combine both positional parameters and parameters aggregation.
94+ The positional parameters substitution takes place before the aggregation.
95+ Which means positional parameters can be placed after parameters aggregation
96+ in the query ; see example bellow.
97+ Please note that the positional parameters will not be part of the aggregation taking place afterwards!
98+
99+ ```
100+ \ns users_by_categories_and_age select * from users where name in ($@) and age = $1
101+ ```
102+
103+ ```
104+ \n users_by_categories_and_age 42 "Skelly McDermott" "François Pignon"
105+ ```
106+
107+ The query after substitution would be:
108+ ```
109+ select * from users where name in ('Skelly McDermott', 'François Pignon') and age = 42
110+ ```
0 commit comments