mysql.test.ts — drizzle-orm Source File
Architecture documentation for mysql.test.ts, a typescript file in the drizzle-orm codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1bf01e0d_32f6_c53c_135f_427fc06b2360["mysql.test.ts"] d598d354_5597_b2a3_e5c1_d26e5e904917["index.ts"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> d598d354_5597_b2a3_e5c1_d26e5e904917 b6483f8f_39d9_6c02_34b8_9a3df7d428eb["utils.ts"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> b6483f8f_39d9_6c02_34b8_9a3df7d428eb 351303ed_bdd3_50f4_eb38_e21ac19bc263["Expect"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 351303ed_bdd3_50f4_eb38_e21ac19bc263 2a85cab2_0338_353c_a5f7_46964a1b85f9["expectSchemaShape"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 2a85cab2_0338_353c_a5f7_46964a1b85f9 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf["mysql-core"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf e3330aa9_fee9_b340_1093_1c8a98953c05["json-rules-engine"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> e3330aa9_fee9_b340_1093_1c8a98953c05 a9e31838_d52b_02c1_2b9d_c4354b2ad2fa["valibot"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> a9e31838_d52b_02c1_2b9d_c4354b2ad2fa 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 45e26f9d_6717_943d_0371_5d349b8c9472["constants.ts"] 1bf01e0d_32f6_c53c_135f_427fc06b2360 --> 45e26f9d_6717_943d_0371_5d349b8c9472 style 1bf01e0d_32f6_c53c_135f_427fc06b2360 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type Equal, sql } from 'drizzle-orm';
import { customType, int, json, mysqlSchema, mysqlTable, mysqlView, serial, text } from 'drizzle-orm/mysql-core';
import type { TopLevelCondition } from 'json-rules-engine';
import * as v from 'valibot';
import { test } from 'vitest';
import { jsonSchema } from '~/column.ts';
import { CONSTANTS } from '~/constants.ts';
import { createInsertSchema, createSelectSchema, createUpdateSchema } from '../src';
import { Expect, expectSchemaShape } from './utils.ts';
const intSchema = v.pipe(
v.number(),
v.minValue(CONSTANTS.INT32_MIN as number),
v.maxValue(CONSTANTS.INT32_MAX as number),
v.integer(),
);
const serialNumberModeSchema = v.pipe(
v.number(),
v.minValue(0 as number),
v.maxValue(Number.MAX_SAFE_INTEGER as number),
v.integer(),
);
const textSchema = v.pipe(v.string(), v.maxLength(CONSTANTS.INT16_UNSIGNED_MAX as number));
test('table - select', (t) => {
const table = mysqlTable('test', {
id: serial().primaryKey(),
name: text().notNull(),
});
const result = createSelectSchema(table);
const expected = v.object({ id: serialNumberModeSchema, name: textSchema });
expectSchemaShape(t, expected).from(result);
Expect<Equal<typeof result, typeof expected>>();
});
test('table in schema - select', (tc) => {
const schema = mysqlSchema('test');
const table = schema.table('test', {
id: serial().primaryKey(),
name: text().notNull(),
});
const result = createSelectSchema(table);
const expected = v.object({ id: serialNumberModeSchema, name: textSchema });
expectSchemaShape(tc, expected).from(result);
Expect<Equal<typeof result, typeof expected>>();
});
test('table - insert', (t) => {
const table = mysqlTable('test', {
id: serial().primaryKey(),
name: text().notNull(),
age: int(),
});
const result = createInsertSchema(table);
const expected = v.object({
id: v.optional(serialNumberModeSchema),
name: textSchema,
// ... (452 more lines)
Domain
Subdomains
Functions
Dependencies
- Expect
- column.ts
- constants.ts
- drizzle-orm
- expectSchemaShape
- index.ts
- json-rules-engine
- mysql-core
- utils.ts
- valibot
- vitest
Source
Frequently Asked Questions
What does mysql.test.ts do?
mysql.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 mysql.test.ts?
mysql.test.ts defines 3 function(s): TopLevelCondition, nestedSelect, view.
What does mysql.test.ts depend on?
mysql.test.ts imports 11 module(s): Expect, column.ts, constants.ts, drizzle-orm, expectSchemaShape, index.ts, json-rules-engine, mysql-core, and 3 more.
Where is mysql.test.ts in the architecture?
mysql.test.ts is located at drizzle-valibot/tests/mysql.test.ts (domain: ValidationAdapters, subdomain: TypeMapping, directory: drizzle-valibot/tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free