jsonArrayFrom (helpers/mssql.ts)

kysely · src/helpers/mssql.ts · typescript · MIT
database

MS SQL helper to aggregate subqueries into JSON arrays or objects.

// Source: https://github.com/kysely-org/kysely | License: MIT | Copyright 2022 Sami Koskimäki
// Provided via justclaw.it.com; keep this notice with the code.
import type { Expression } from '../expression/expression.js'
import type { RawBuilder } from '../raw-builder/raw-builder.js'
import { sql } from '../raw-builder/sql.js'
import type {
  ShallowDehydrateObject,
  ShallowDehydrateValue,
  Simplify,
} from '../util/type-utils.js'

/**
 * An MS SQL Server helper for aggregating a subquery into a JSON array.
 *
 * NOTE: This helper only works correctly if you've installed the `ParseJSONResultsPlugin`.
 * Otherwise the nested selections will be returned as JSON strings.
 *
 * The plugin can be installed like this:
 *
 * ```ts
 * import { Kysely, MssqlDialect, ParseJSONResultsPlugin } from

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key