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

pg.ts — drizzle-orm Source File

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

File typescript 4 imports

Entity Profile

Dependency Diagram

graph LR
  2b17963b_a6e0_9cbf_7047_879d8ae6d4f3["pg.ts"]
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  2b17963b_a6e0_9cbf_7047_879d8ae6d4f3 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  2b17963b_a6e0_9cbf_7047_879d8ae6d4f3 --> 53497908_16e7_977d_e97d_7414884a88a6
  7a81538d_84ea_28df_3d10_5306fd885d26["pglite"]
  2b17963b_a6e0_9cbf_7047_879d8ae6d4f3 --> 7a81538d_84ea_28df_3d10_5306fd885d26
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  2b17963b_a6e0_9cbf_7047_879d8ae6d4f3 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 2b17963b_a6e0_9cbf_7047_879d8ae6d4f3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { eq } from 'drizzle-orm';
import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/pglite';
import { expectTypeOf } from 'vitest';

const account = pgTable('accounts', {
	id: uuid('id').primaryKey().notNull(),
	userId: uuid('user_id')
		.notNull()
		.references(() => users.id),
	meta: text().notNull(),
});

const users = pgTable('users', {
	id: uuid('id').primaryKey(),
	name: text('name').notNull(),
	username: text('username').notNull().unique(),
});

const db = drizzle.mock();

(async () => {
	const res = await db.select()
		.from(users)
		.innerJoin(account, eq(users.id, account.id));

	expectTypeOf(res).toEqualTypeOf<{
		accounts: {
			id: string;
			userId: string;
			meta: string;
		};
		users: {
			id: string;
			name: string;
			username: string;
		};
	}[]>();
});

Dependencies

  • drizzle-orm
  • pg-core
  • pglite
  • vitest

Frequently Asked Questions

What does pg.ts do?
pg.ts is a source file in the drizzle-orm codebase, written in typescript.
What does pg.ts depend on?
pg.ts imports 4 module(s): drizzle-orm, pg-core, pglite, vitest.
Where is pg.ts in the architecture?
pg.ts is located at integration-tests/type-tests/join-nodenext/pg.ts (directory: integration-tests/type-tests/join-nodenext).

Analyze Your Own Codebase

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

Try Supermodel Free