Home / Function/ countDistinct() — drizzle-orm Function Reference

countDistinct() — drizzle-orm Function Reference

Architecture documentation for the countDistinct() function in aggregate.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  e4abb7b5_3222_459d_a97f_5b7ad99dda61["countDistinct()"]
  ddea600c_c886_0da9_1354_46365d17b567["aggregate.ts"]
  e4abb7b5_3222_459d_a97f_5b7ad99dda61 -->|defined in| ddea600c_c886_0da9_1354_46365d17b567
  d895d7d4_2394_4307_94eb_389073534806["count()"]
  e4abb7b5_3222_459d_a97f_5b7ad99dda61 -->|calls| d895d7d4_2394_4307_94eb_389073534806
  932d6924_b2b0_6352_42f7_220855d521b7["mapWith()"]
  e4abb7b5_3222_459d_a97f_5b7ad99dda61 -->|calls| 932d6924_b2b0_6352_42f7_220855d521b7
  style e4abb7b5_3222_459d_a97f_5b7ad99dda61 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/sql/functions/aggregate.ts lines 35–37

export function countDistinct(expression: SQLWrapper): SQL<number> {
	return sql`count(distinct ${expression})`.mapWith(Number);
}

Domain

Subdomains

Frequently Asked Questions

What does countDistinct() do?
countDistinct() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sql/functions/aggregate.ts.
Where is countDistinct() defined?
countDistinct() is defined in drizzle-orm/src/sql/functions/aggregate.ts at line 35.
What does countDistinct() call?
countDistinct() calls 2 function(s): count, mapWith.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free