MCPcopy
hub / github.com/drizzle-team/drizzle-orm / count

Function count

integration-tests/tests/pg/pg-common.ts:2154–2160  ·  view source on GitHub ↗
(value: PgColumn | SQLWrapper, alias?: string)

Source from the content-addressed store, hash-verified

2152 function count(value: PgColumn | SQLWrapper): SQL<number>;
2153 function count(value: PgColumn | SQLWrapper, alias: string): SQL.Aliased<number>;
2154 function count(value: PgColumn | SQLWrapper, alias?: string): SQL<number> | SQL.Aliased<number> {
2155 const result = sql`count(${value})`.mapWith(Number);
2156 if (!alias) {
2157 return result;
2158 }
2159 return result.as(alias);
2160 }
2161
2162 await db.insert(usersTable).values([{ name: 'John' }, { name: 'Jane' }]);
2163

Callers

nothing calls this directly

Calls 3

sqlFunction · 0.90
mapWithMethod · 0.80
asMethod · 0.45

Tested by

no test coverage detected