Open niveathika opened 3 years ago
Description: As of now, the raw template supports the 1:1 mapping of parameters to the variable. i.e
// usage int[] arr = [10, 20]; RawTemplate template = `Test ${arr} type`; //Desugurs RawTemplate template = { strings: ["Test", " type" ], insertions: [[10, 20]] };
The use case is to support 1:n mapping of the variable in case the variable consists of multiple elements like an array with a default divisor, for instance
// usage int[] arr = [10, 20]; RawTemplate template = `Test ${arr...} type`; //Desugurs RawTemplate template = { strings: ["Test", ",", " type" ], insertions: [10, 20] };
The use case comes through SQL to support IN operations such as, "SELECT * FROM testdb WHERE id IN(1,2,3);"
int[] ids = [1, 2, 3] sql:ParameterizedQuery query = `SELECT * FROM testdb WHERE id IN(${ids})`;
Interesting idea. ${...arr} would be the consistent syntax for this.
${...arr}
Description: As of now, the raw template supports the 1:1 mapping of parameters to the variable. i.e
The use case is to support 1:n mapping of the variable in case the variable consists of multiple elements like an array with a default divisor, for instance
The use case comes through SQL to support IN operations such as, "SELECT * FROM testdb WHERE id IN(1,2,3);"