pg.test.ts — drizzle-orm Source File
Architecture documentation for pg.test.ts, a typescript file in the drizzle-orm codebase. 12 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35["pg.test.ts"] ff684fca_1bf3_44b7_31ea_13a57f1e853d["index.ts"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> ff684fca_1bf3_44b7_31ea_13a57f1e853d a613cfae_0db3_657f_d051_120c70da7539["utils.ts"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> a613cfae_0db3_657f_d051_120c70da7539 70d5e558_f261_97fa_a887_7d6f05ebdc71["Expect"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 70d5e558_f261_97fa_a887_7d6f05ebdc71 23526c6b_bf74_57f6_8a18_11cf8e1abfd9["expectEnumValues"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 23526c6b_bf74_57f6_8a18_11cf8e1abfd9 13da7f47_c488_1c05_a7ef_a5bccb3b8a71["expectSchemaShape"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 13da7f47_c488_1c05_a7ef_a5bccb3b8a71 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 53497908_16e7_977d_e97d_7414884a88a6["pg-core"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 53497908_16e7_977d_e97d_7414884a88a6 e3330aa9_fee9_b340_1093_1c8a98953c05["json-rules-engine"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> e3330aa9_fee9_b340_1093_1c8a98953c05 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 2eba3e52_10ef_4b48_38fc_0e1540a5fc3e["v4"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 2eba3e52_10ef_4b48_38fc_0e1540a5fc3e 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 45e26f9d_6717_943d_0371_5d349b8c9472["constants.ts"] 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 --> 45e26f9d_6717_943d_0371_5d349b8c9472 style 1dc8c3c1_2e25_f6a3_446e_92fa0a594a35 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type Equal, sql } from 'drizzle-orm';
import {
customType,
integer,
json,
jsonb,
pgEnum,
pgMaterializedView,
pgSchema,
pgTable,
pgView,
serial,
text,
} from 'drizzle-orm/pg-core';
import type { TopLevelCondition } from 'json-rules-engine';
import { test } from 'vitest';
import { z } from 'zod/v4';
import { jsonSchema } from '~/column.ts';
import { CONSTANTS } from '~/constants.ts';
import { createInsertSchema, createSchemaFactory, createSelectSchema, createUpdateSchema } from '../src';
import { Expect, expectEnumValues, expectSchemaShape } from './utils.ts';
const integerSchema = z.int().gte(CONSTANTS.INT32_MIN).lte(CONSTANTS.INT32_MAX);
const textSchema = z.string();
test('table - select', (t) => {
const table = pgTable('test', {
id: integer().primaryKey(),
generated: integer().generatedAlwaysAsIdentity(),
name: text().notNull(),
});
const result = createSelectSchema(table);
const expected = z.object({ id: integerSchema, generated: integerSchema, name: textSchema });
expectSchemaShape(t, expected).from(result);
Expect<Equal<typeof result, typeof expected>>();
});
test('table in schema - select', (tc) => {
const schema = pgSchema('test');
const table = schema.table('test', {
id: serial().primaryKey(),
name: text().notNull(),
});
const result = createSelectSchema(table);
const expected = z.object({ id: integerSchema, name: textSchema });
expectSchemaShape(tc, expected).from(result);
Expect<Equal<typeof result, typeof expected>>();
});
test('table - insert', (t) => {
const table = pgTable('test', {
id: integer().generatedAlwaysAsIdentity().primaryKey(),
name: text().notNull(),
age: integer(),
});
const result = createInsertSchema(table);
const expected = z.object({ name: textSchema, age: integerSchema.nullable().optional() });
// ... (553 more lines)
Domain
Subdomains
Dependencies
- Expect
- column.ts
- constants.ts
- drizzle-orm
- expectEnumValues
- expectSchemaShape
- index.ts
- json-rules-engine
- pg-core
- utils.ts
- v4
- vitest
Source
Frequently Asked Questions
What does pg.test.ts do?
pg.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the ValidationAdapters domain, TypeMapping subdomain.
What functions are defined in pg.test.ts?
pg.test.ts defines 4 function(s): TopLevelCondition, mView, nestedSelect, view.
What does pg.test.ts depend on?
pg.test.ts imports 12 module(s): Expect, column.ts, constants.ts, drizzle-orm, expectEnumValues, expectSchemaShape, index.ts, json-rules-engine, and 4 more.
Where is pg.test.ts in the architecture?
pg.test.ts is located at drizzle-zod/tests/pg.test.ts (domain: ValidationAdapters, subdomain: TypeMapping, directory: drizzle-zod/tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free