Home / File/ sqlite.test.ts — drizzle-orm Source File

sqlite.test.ts — drizzle-orm Source File

Architecture documentation for sqlite.test.ts, a typescript file in the drizzle-orm codebase. 11 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  fb71c760_c401_e9c7_5556_1ea015bc362f["sqlite.test.ts"]
  d598d354_5597_b2a3_e5c1_d26e5e904917["index.ts"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> d598d354_5597_b2a3_e5c1_d26e5e904917
  b6483f8f_39d9_6c02_34b8_9a3df7d428eb["utils.ts"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> b6483f8f_39d9_6c02_34b8_9a3df7d428eb
  351303ed_bdd3_50f4_eb38_e21ac19bc263["Expect"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 351303ed_bdd3_50f4_eb38_e21ac19bc263
  2a85cab2_0338_353c_a5f7_46964a1b85f9["expectSchemaShape"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 2a85cab2_0338_353c_a5f7_46964a1b85f9
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  e3330aa9_fee9_b340_1093_1c8a98953c05["json-rules-engine"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> e3330aa9_fee9_b340_1093_1c8a98953c05
  a9e31838_d52b_02c1_2b9d_c4354b2ad2fa["valibot"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> a9e31838_d52b_02c1_2b9d_c4354b2ad2fa
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  45e26f9d_6717_943d_0371_5d349b8c9472["constants.ts"]
  fb71c760_c401_e9c7_5556_1ea015bc362f --> 45e26f9d_6717_943d_0371_5d349b8c9472
  style fb71c760_c401_e9c7_5556_1ea015bc362f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { type Equal, sql } from 'drizzle-orm';
import { blob, customType, int, sqliteTable, sqliteView, text } from 'drizzle-orm/sqlite-core';
import type { TopLevelCondition } from 'json-rules-engine';
import * as v from 'valibot';
import { test } from 'vitest';
import { bufferSchema, 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(Number.MIN_SAFE_INTEGER),
	v.maxValue(Number.MAX_SAFE_INTEGER),
	v.integer(),
);
const textSchema = v.string();

test('table - select', (t) => {
	const table = sqliteTable('test', {
		id: int().primaryKey({ autoIncrement: true }),
		name: text().notNull(),
	});

	const result = createSelectSchema(table);
	const expected = v.object({ id: intSchema, name: textSchema });
	expectSchemaShape(t, expected).from(result);
	Expect<Equal<typeof result, typeof expected>>();
});

test('table - insert', (t) => {
	const table = sqliteTable('test', {
		id: int().primaryKey({ autoIncrement: true }),
		name: text().notNull(),
		age: int(),
	});

	const result = createInsertSchema(table);
	const expected = v.object({ id: v.optional(intSchema), name: textSchema, age: v.optional(v.nullable(intSchema)) });
	expectSchemaShape(t, expected).from(result);
	Expect<Equal<typeof result, typeof expected>>();
});

test('table - update', (t) => {
	const table = sqliteTable('test', {
		id: int().primaryKey({ autoIncrement: true }),
		name: text().notNull(),
		age: int(),
	});

	const result = createUpdateSchema(table);
	const expected = v.object({
		id: v.optional(intSchema),
		name: v.optional(textSchema),
		age: v.optional(v.nullable(intSchema)),
	});
	expectSchemaShape(t, expected).from(result);
	Expect<Equal<typeof result, typeof expected>>();
});

// ... (346 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does sqlite.test.ts do?
sqlite.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 sqlite.test.ts?
sqlite.test.ts defines 3 function(s): TopLevelCondition, nestedSelect, view.
What does sqlite.test.ts depend on?
sqlite.test.ts imports 11 module(s): Expect, column.ts, constants.ts, drizzle-orm, expectSchemaShape, index.ts, json-rules-engine, sqlite-core, and 3 more.
Where is sqlite.test.ts in the architecture?
sqlite.test.ts is located at drizzle-valibot/tests/sqlite.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