pg.test.ts — drizzle-orm Source File
Architecture documentation for pg.test.ts, a typescript file in the drizzle-orm codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8ac1f151_3933_3e28_78d3_c96ee5b82ccc["pg.test.ts"] 98f24684_7026_c838_c58f_d0555f9affa9["index.ts"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 98f24684_7026_c838_c58f_d0555f9affa9 3594c1f8_e289_c87e_9f92_6f1cf7eb00b7["utils.ts"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 3594c1f8_e289_c87e_9f92_6f1cf7eb00b7 6c645383_bc9e_0c4e_1d50_f7a3865c1d28["Expect"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 6c645383_bc9e_0c4e_1d50_f7a3865c1d28 96d30bdb_daf2_c71a_e75b_71042e300cf7["expectSchemaShape"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 96d30bdb_daf2_c71a_e75b_71042e300cf7 4859a2e0_4bd3_506a_e7e6_bf4316983bb5["arktype"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 4859a2e0_4bd3_506a_e7e6_bf4316983bb5 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 53497908_16e7_977d_e97d_7414884a88a6["pg-core"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 53497908_16e7_977d_e97d_7414884a88a6 e3330aa9_fee9_b340_1093_1c8a98953c05["json-rules-engine"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> e3330aa9_fee9_b340_1093_1c8a98953c05 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 45e26f9d_6717_943d_0371_5d349b8c9472["constants.ts"] 8ac1f151_3933_3e28_78d3_c96ee5b82ccc --> 45e26f9d_6717_943d_0371_5d349b8c9472 style 8ac1f151_3933_3e28_78d3_c96ee5b82ccc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Type, type } from 'arktype';
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 { bigintNarrow, jsonSchema } from '~/column.ts';
import { CONSTANTS } from '~/constants.ts';
import { createInsertSchema, createSelectSchema, createUpdateSchema } from '../src';
import { Expect, expectEnumValues, expectSchemaShape } from './utils.ts';
const integerSchema = type.keywords.number.integer.atLeast(CONSTANTS.INT32_MIN).atMost(CONSTANTS.INT32_MAX);
const textSchema = type.string;
test('table - select', (t) => {
const table = pgTable('test', {
id: serial().primaryKey(),
name: text().notNull(),
});
const result = createSelectSchema(table);
const expected = type({ id: 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 = type({ 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 = type({ name: textSchema, age: integerSchema.or(type.null).optional() });
expectSchemaShape(t, expected).from(result);
// ... (498 more lines)
Domain
Subdomains
Functions
Dependencies
- Expect
- arktype
- column.ts
- constants.ts
- drizzle-orm
- expectSchemaShape
- index.ts
- json-rules-engine
- pg-core
- utils.ts
- 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 3 function(s): mView, nestedSelect, view.
What does pg.test.ts depend on?
pg.test.ts imports 11 module(s): Expect, arktype, column.ts, constants.ts, drizzle-orm, expectSchemaShape, index.ts, json-rules-engine, and 3 more.
Where is pg.test.ts in the architecture?
pg.test.ts is located at drizzle-arktype/tests/pg.test.ts (domain: ValidationAdapters, subdomain: TypeMapping, directory: drizzle-arktype/tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free