MCPcopy Create free account
hub / github.com/Seb-C/kiss-orm / createFromTemplateString

Method createFromTemplateString

src/Queries/SqlQuery.ts:10–31  ·  view source on GitHub ↗
(
		strings: TemplateStringsArray,
		...params: ReadonlyArray<any>
	)

Source from the content-addressed store, hash-verified

8 public readonly parts: ReadonlyArray<QueryPart>;
9
10 static createFromTemplateString (
11 strings: TemplateStringsArray,
12 ...params: ReadonlyArray<any>
13 ): SqlQuery {
14 const parts: QueryPart[] = [strings[0]];
15
16 for (let i = 1; i < strings.length; i++) {
17 if (
18 params[i - 1] instanceof SqlQuery
19 || params[i - 1] instanceof QueryParam
20 || params[i - 1] instanceof QueryIdentifier
21 ) {
22 parts.push(params[i - 1]);
23 } else {
24 parts.push(new QueryParam(params[i - 1]));
25 }
26
27 parts.push(strings[i]);
28 }
29
30 return new SqlQuery(parts);
31 };
32
33 /**
34 * The delimiter is an SqlQuery rather than a string

Callers 2

joinMethod · 0.80
SqlQuery.test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected