generated-columns.ts — drizzle-orm Source File
Architecture documentation for generated-columns.ts, a typescript file in the drizzle-orm codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d773d7b2_5be0_bd52_0651_e26348aa2329["generated-columns.ts"] 9a56da77_7540_380c_f8b9_d8bde4914940["db.ts"] d773d7b2_5be0_bd52_0651_e26348aa2329 --> 9a56da77_7540_380c_f8b9_d8bde4914940 7f1d57a5_8769_e884_7eaa_b42671c9ad52["utils"] d773d7b2_5be0_bd52_0651_e26348aa2329 --> 7f1d57a5_8769_e884_7eaa_b42671c9ad52 cab723dc_a166_a0df_470b_60287623b270["index"] d773d7b2_5be0_bd52_0651_e26348aa2329 --> cab723dc_a166_a0df_470b_60287623b270 0d99c69d_6f28_46ff_a007_e31d362c4646["libsql"] d773d7b2_5be0_bd52_0651_e26348aa2329 --> 0d99c69d_6f28_46ff_a007_e31d362c4646 714a7461_7355_1cd1_4359_940b5245b2d0["sqlite-core"] d773d7b2_5be0_bd52_0651_e26348aa2329 --> 714a7461_7355_1cd1_4359_940b5245b2d0 style d773d7b2_5be0_bd52_0651_e26348aa2329 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type Equal, Expect } from 'type-tests/utils';
import { type InferInsertModel, type InferSelectModel, sql } from '~/index';
import { drizzle } from '~/libsql';
import { int, sqliteTable, text } from '~/sqlite-core';
import { db } from './db';
const users = sqliteTable(
'users',
{
id: int('id').primaryKey(),
firstName: text('first_name', { length: 255 }),
lastName: text('last_name', { length: 255 }),
email: text('email').notNull(),
fullName: text('full_name')
.generatedAlwaysAs(sql`concat_ws(first_name, ' ', last_name)`),
upperName: text('upper_name').generatedAlwaysAs(
sql` case when first_name is null then null else upper(first_name) end `,
).$type<string | null>(), // There is no way for drizzle to detect nullability in these cases. This is how the user can work around it
},
);
{
type User = typeof users.$inferSelect;
type NewUser = typeof users.$inferInsert;
Expect<
Equal<
{
id: number;
firstName: string | null;
lastName: string | null;
email: string;
fullName: string | null;
upperName: string | null;
},
User
>
>();
Expect<
Equal<
{
email: string;
id?: number | undefined;
firstName?: string | null | undefined;
lastName?: string | null | undefined;
},
NewUser
>
>();
}
{
type User = InferSelectModel<typeof users>;
type NewUser = InferInsertModel<typeof users>;
Expect<
Equal<
{
id: number;
// ... (101 more lines)
Domain
Dependencies
- db.ts
- index
- libsql
- sqlite-core
- utils
Source
Frequently Asked Questions
What does generated-columns.ts do?
generated-columns.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does generated-columns.ts depend on?
generated-columns.ts imports 5 module(s): db.ts, index, libsql, sqlite-core, utils.
Where is generated-columns.ts in the architecture?
generated-columns.ts is located at drizzle-orm/type-tests/sqlite/generated-columns.ts (domain: DrizzleORM, directory: drizzle-orm/type-tests/sqlite).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free