Home / File/ db.ts — drizzle-orm Source File

db.ts — drizzle-orm Source File

Architecture documentation for db.ts, a typescript file in the drizzle-orm codebase. 6 imports, 0 dependents.

File typescript DrizzleORM RelationalQuery 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  39b12012_73ee_50de_e31a_969162d619ed["db.ts"]
  931dc543_40fe_480a_552e_6df25afd3185["tables.ts"]
  39b12012_73ee_50de_e31a_969162d619ed --> 931dc543_40fe_480a_552e_6df25afd3185
  c440e00a_e318_94ac_100c_9843a182c7a4["config"]
  39b12012_73ee_50de_e31a_969162d619ed --> c440e00a_e318_94ac_100c_9843a182c7a4
  ccd8f141_31dd_df9e_0535_43efaea4d6db["better-sqlite3"]
  39b12012_73ee_50de_e31a_969162d619ed --> ccd8f141_31dd_df9e_0535_43efaea4d6db
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  39b12012_73ee_50de_e31a_969162d619ed --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  5fb205ef_438e_58ed_ca43_2d0e3ec9cd7b["better-sqlite3"]
  39b12012_73ee_50de_e31a_969162d619ed --> 5fb205ef_438e_58ed_ca43_2d0e3ec9cd7b
  db3becad_8fc4_5cfe_05a5_d455b85a8ab4["node:util"]
  39b12012_73ee_50de_e31a_969162d619ed --> db3becad_8fc4_5cfe_05a5_d455b85a8ab4
  style 39b12012_73ee_50de_e31a_969162d619ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import 'dotenv/config';
import Database from 'better-sqlite3';
import { sql } from 'drizzle-orm';
import { drizzle } from 'drizzle-orm/better-sqlite3';
import util from 'node:util';
import * as schema from './tables.ts';

async function main() {
	const bdb = new Database(process.env['SQLITE_DB_PATH']!);
	const db = drizzle(bdb, { schema, logger: true });

	const result = db.query.users.findMany({
		columns: {
			id: true,
			name: true,
		},
		with: {
			posts: {
				columns: {
					authorId: true,
				},
				with: {
					comments: true,
				},
				extras: {
					lower: sql<string>`lower(${schema.posts.title})`.as('lower_name'),
				},
			},
		},
	});

	console.log(util.inspect(result, false, null, true));
	bdb.close();
}

main();

Domain

Subdomains

Functions

Dependencies

  • better-sqlite3
  • better-sqlite3
  • config
  • drizzle-orm
  • node:util
  • tables.ts

Frequently Asked Questions

What does db.ts do?
db.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in db.ts?
db.ts defines 1 function(s): main.
What does db.ts depend on?
db.ts imports 6 module(s): better-sqlite3, better-sqlite3, config, drizzle-orm, node:util, tables.ts.
Where is db.ts in the architecture?
db.ts is located at integration-tests/tests/relational/db.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: integration-tests/tests/relational).

Analyze Your Own Codebase

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

Try Supermodel Free