Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.AggregateFunctionBuilder#distinct

Kysely dialect for PostgreSQL using the Postgres.js client.
Latest
method kysely.AggregateFunctionBuilder.prototype.distinct
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/mod.ts";
const { AggregateFunctionBuilder } = kysely;

Adds a distinct clause inside the function.

Examples

const result = await db
  .selectFrom('person')
  .select((eb) =>
    eb.fn.count<number>('first_name').distinct().as('first_name_count')
  )
  .executeTakeFirstOrThrow()

The generated SQL (PostgreSQL):

select count(distinct "first_name") as "first_name_count"
from "person"