subquery.ts — drizzle-orm Source File
Architecture documentation for subquery.ts, a typescript file in the drizzle-orm codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 615d88da_a7c7_30a4_1dfb_cd766132017a["subquery.ts"] 5c0d451c_2b91_b8fd_b7c7_ac294c7031fc["db.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> 5c0d451c_2b91_b8fd_b7c7_ac294c7031fc 1e7a5c85_1089_54b0_1272_5c88a1cec3c9["utils.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> 1e7a5c85_1089_54b0_1272_5c88a1cec3c9 d2121c85_50ae_8a8e_c0b6_0f0dbcf2c232["index.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> d2121c85_50ae_8a8e_c0b6_0f0dbcf2c232 f443a8b9_298c_9b0c_91fd_6d2400884750["index.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> f443a8b9_298c_9b0c_91fd_6d2400884750 7db3604f_c277_5b31_50d7_91a74caefbfa["aggregate.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> 7db3604f_c277_5b31_50d7_91a74caefbfa 163f3669_76fd_05ca_2197_16086705de4a["sql.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> 163f3669_76fd_05ca_2197_16086705de4a 75901f99_b0fe_057b_6268_cf00202bd6f8["utils.ts"] 615d88da_a7c7_30a4_1dfb_cd766132017a --> 75901f99_b0fe_057b_6268_cf00202bd6f8 style 615d88da_a7c7_30a4_1dfb_cd766132017a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Expect } from 'type-tests/utils.ts';
import { alias, integer, pgTable, serial, text } from '~/pg-core/index.ts';
import { and, eq } from '~/sql/expressions/index.ts';
import { count } from '~/sql/functions/aggregate.ts';
import { sql } from '~/sql/sql.ts';
import type { DrizzleTypeError, Equal } from '~/utils.ts';
import { db } from './db.ts';
const users = pgTable('names', {
id: serial('id').primaryKey(),
name: text('name'),
managerId: integer('author_id'),
});
const posts = pgTable('posts', {
id: serial('id').primaryKey(),
authorId: integer('author_id'),
title: text('title'),
});
const n1 = db
.select({
id: users.id,
name: users.name,
authorId: users.managerId,
count1: sql<number>`count(1)::int`.as('count1'),
})
.from(users)
.groupBy(users.id, users.name, users.managerId)
.as('n1');
const n2 = db
.select({
id: users.id,
authorId: users.managerId,
totalCount: sql<number>`count(1)::int`.as('totalCount'),
})
.from(users)
.groupBy(users.id, users.managerId)
.as('n2');
const result = await db
.select({
name: n1.name,
authorId: n1.authorId,
count1: n1.count1,
totalCount: n2.totalCount,
})
.from(n1)
.innerJoin(n2, and(eq(n2.id, n1.id), eq(n2.authorId, n1.authorId)));
Expect<
Equal<
{
name: string | null;
authorId: number | null;
count1: number;
totalCount: number;
}[],
typeof result
// ... (65 more lines)
Domain
Dependencies
- aggregate.ts
- db.ts
- index.ts
- index.ts
- sql.ts
- utils.ts
- utils.ts
Source
Frequently Asked Questions
What does subquery.ts do?
subquery.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does subquery.ts depend on?
subquery.ts imports 7 module(s): aggregate.ts, db.ts, index.ts, index.ts, sql.ts, utils.ts, utils.ts.
Where is subquery.ts in the architecture?
subquery.ts is located at drizzle-orm/type-tests/pg/subquery.ts (domain: DrizzleORM, directory: drizzle-orm/type-tests/pg).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free