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
  9ba047f0_4075_24d8_492e_4da8de88ce1c["sqlite.test.ts"]
  9a709b88_1975_ab69_2cd7_cd36e1afa9d0["index.ts"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 9a709b88_1975_ab69_2cd7_cd36e1afa9d0
  220ae495_e2e6_9482_daa5_19553ac47578["utils.ts"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 220ae495_e2e6_9482_daa5_19553ac47578
  fd9e9430_de0a_4c07_8df0_2953155177d5["Expect"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> fd9e9430_de0a_4c07_8df0_2953155177d5
  f3b1a23b_bcee_46b1_e5f7_5df6441a824e["expectSchemaShape"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> f3b1a23b_bcee_46b1_e5f7_5df6441a824e
  26760edf_9a0c_0204_77e6_f8bffa96e354["typebox"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 26760edf_9a0c_0204_77e6_f8bffa96e354
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  e3330aa9_fee9_b340_1093_1c8a98953c05["json-rules-engine"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> e3330aa9_fee9_b340_1093_1c8a98953c05
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  45e26f9d_6717_943d_0371_5d349b8c9472["constants.ts"]
  9ba047f0_4075_24d8_492e_4da8de88ce1c --> 45e26f9d_6717_943d_0371_5d349b8c9472
  style 9ba047f0_4075_24d8_492e_4da8de88ce1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { type Static, Type as t } from '@sinclair/typebox';
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 { test } from 'vitest';
import { bufferSchema, jsonSchema } from '~/column.ts';
import { CONSTANTS } from '~/constants.ts';
import { createInsertSchema, createSelectSchema, createUpdateSchema, type GenericSchema } from '../src';
import { Expect, expectSchemaShape } from './utils.ts';

const intSchema = t.Integer({ minimum: Number.MIN_SAFE_INTEGER, maximum: Number.MAX_SAFE_INTEGER });
const textSchema = t.String();

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

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

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

	const result = createInsertSchema(table);
	const expected = t.Object({
		id: t.Optional(intSchema),
		name: textSchema,
		age: t.Optional(t.Union([intSchema, t.Null()])),
	});
	expectSchemaShape(tc, expected).from(result);
	Expect<Equal<typeof result, typeof expected>>();
});

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

	const result = createUpdateSchema(table);
	const expected = t.Object({
		id: t.Optional(intSchema),
		name: t.Optional(textSchema),
		age: t.Optional(t.Union([intSchema, t.Null()])),
	});
	expectSchemaShape(tc, expected).from(result);
	Expect<Equal<typeof result, typeof expected>>();
});

test('view qb - select', (tc) => {
// ... (345 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 2 function(s): 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-typebox/tests/sqlite.test.ts (domain: ValidationAdapters, subdomain: TypeMapping, directory: drizzle-typebox/tests).

Analyze Your Own Codebase

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

Try Supermodel Free