db-rel.ts — drizzle-orm Source File
Architecture documentation for db-rel.ts, a typescript file in the drizzle-orm codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7["db-rel.ts"] c6902f51_cbac_a2a7_c355_214086edee81["tables-rel.ts"] 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 --> c6902f51_cbac_a2a7_c355_214086edee81 0d277acf_0d68_9daf_8724_642232a89719["pg"] 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 --> 0d277acf_0d68_9daf_8724_642232a89719 25b05299_f48f_bceb_01ca_1343d330a8f7["utils.ts"] 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 --> 25b05299_f48f_bceb_01ca_1343d330a8f7 b5ed0e87_40a4_1643_f027_4ff3496c71c0["index.ts"] 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 --> b5ed0e87_40a4_1643_f027_4ff3496c71c0 be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"] 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd style 8bd43940_8da9_ba3a_de4d_b6d7b7d1b9a7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pg from 'pg';
import { type Equal, Expect } from 'type-tests/utils.ts';
import { drizzle } from '~/node-postgres/index.ts';
import { sql } from '~/sql/sql.ts';
import * as schema from './tables-rel.ts';
const { Pool } = pg;
const pdb = new Pool({ connectionString: process.env['PG_CONNECTION_STRING'] });
const db = drizzle(pdb, { schema });
{
const result = await db.query.users.findMany({
where: (users, { sql }) => sql`char_length(${users.name} > 1)`,
limit: sql.placeholder('l'),
orderBy: (users, { asc, desc }) => [asc(users.name), desc(users.id)],
with: {
posts: {
where: (posts, { sql }) => sql`char_length(${posts.title} > 1)`,
limit: sql.placeholder('l'),
columns: {
id: false,
title: undefined,
},
with: {
author: true,
comments: {
where: (comments, { sql }) => sql`char_length(${comments.text} > 1)`,
limit: sql.placeholder('l'),
columns: {
text: true,
},
with: {
author: {
columns: {
id: undefined,
},
with: {
city: {
with: {
users: true,
},
},
},
},
},
},
},
},
},
});
Expect<
Equal<{
id: number;
name: string;
cityId: number;
homeCityId: number | null;
createdAt: Date;
posts: {
// ... (63 more lines)
Domain
Subdomains
Functions
Dependencies
- index.ts
- pg
- sql.ts
- tables-rel.ts
- utils.ts
Source
Frequently Asked Questions
What does db-rel.ts do?
db-rel.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in db-rel.ts?
db-rel.ts defines 2 function(s): result.orderBy, result.where.
What does db-rel.ts depend on?
db-rel.ts imports 5 module(s): index.ts, pg, sql.ts, tables-rel.ts, utils.ts.
Where is db-rel.ts in the architecture?
db-rel.ts is located at drizzle-orm/type-tests/pg/db-rel.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, 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