MCPcopy
hub / github.com/OneUptime/oneuptime / query

Method query

Common/Server/Utils/AnalyticsDatabase/Statement.ts:34–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 ) {}
33
34 public get query(): string {
35 let query: string = this.strings.reduce(
36 (prev: string, curr: string, i: integer) => {
37 const param: StatementParameter | string = this.values[i - 1]!;
38
39 const dataType: string =
40 typeof param === "string"
41 ? "Identifier"
42 : Statement.toColumnType(param);
43
44 return prev + `{p${i - 1}:${dataType}}` + curr;
45 },
46 );
47
48 // dedent lines
49 query = query.trimEnd();
50 const minIndent: number =
51 query.match(/\n( *)/g)?.reduce((minIndent: number, indent: string) => {
52 return Math.min(minIndent, indent.length - 1);
53 }, Infinity) ?? 0;
54 query = query.replace(new RegExp(`\n {${minIndent}}`, "g"), "\n");
55 query = query.trimStart();
56
57 return query;
58 }
59
60 public get query_params(): Record<string, unknown> {
61 let index: number = 0;

Callers 15

getPostgresStatsFunction · 0.45
getClickhouseStatsFunction · 0.45
getDataMigrationStatusFunction · 0.45
getPostgresSchemaFunction · 0.45
getClickhouseSchemaFunction · 0.45
getPostgresDiagnosticsFunction · 0.45
getPostgresClusterHealthFunction · 0.45
getClickhouseDiagnosticsFunction · 0.45
getPostgresLogsFunction · 0.45
getClickhouseLogsFunction · 0.45

Calls 3

minMethod · 0.80
toColumnTypeMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected