MCPcopy Create free account
hub / github.com/denodrivers/postgres / queryArray

Function queryArray

client.ts:335–365  ·  view source on GitHub ↗
(
    query_template_or_config: TemplateStringsArray | string | QueryOptions,
    ...args: unknown[] | [QueryArguments | undefined]
  )

Source from the content-addressed store, hash-verified

333 ...args: unknown[]
334 ): Promise<QueryArrayResult<T>>;
335 async queryArray<T extends Array<unknown> = Array<unknown>>(
336 query_template_or_config: TemplateStringsArray | string | QueryOptions,
337 ...args: unknown[] | [QueryArguments | undefined]
338 ): Promise<QueryArrayResult<T>> {
339 this.#assertOpenConnection();
340
341 if (this.#transaction !== null) {
342 throw new Error(
343 `This connection is currently locked by the "${this.#transaction}" transaction`,
344 );
345 }
346
347 let query: Query<ResultType.ARRAY>;
348 if (typeof query_template_or_config === "string") {
349 query = new Query(
350 query_template_or_config,
351 ResultType.ARRAY,
352 args[0] as QueryArguments | undefined,
353 );
354 } else if (isTemplateString(query_template_or_config)) {
355 query = templateStringToQuery(
356 query_template_or_config,
357 args,
358 ResultType.ARRAY,
359 );
360 } else {
361 query = new Query(query_template_or_config, ResultType.ARRAY);
362 }
363
364 return await this.#executeQuery(query);
365 }
366
367 /**
368 * Executed queries and retrieve the data as object entries. It supports a generic in order to type the entries retrieved by the query

Callers

nothing calls this directly

Calls 2

isTemplateStringFunction · 0.90
templateStringToQueryFunction · 0.90

Tested by

no test coverage detected