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

singlestore.test.ts — drizzle-orm Source File

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import { type Equal } from 'drizzle-orm';
import { customType, int, json, serial, singlestoreSchema, singlestoreTable, text } from 'drizzle-orm/singlestore-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 = singlestoreTable('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 = singlestoreSchema('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 = singlestoreTable('test', {
		id: serial().primaryKey(),
		name: text().notNull(),
		age: int(),
	});

	const result = createInsertSchema(table);
	const expected = v.object({
		id: v.optional(serialNumberModeSchema),
		name: textSchema,
// ... (454 more lines)

Subdomains

Dependencies

Frequently Asked Questions

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