index.ts — drizzle-orm Source File
Architecture documentation for index.ts, a typescript file in the drizzle-orm codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d98a6918_3b17_ff84_de27_7a294902ee41["index.ts"] 7a8ecd08_0737_7d51_af1e_c8038318b49f["kysely"] d98a6918_3b17_ff84_de27_7a294902ee41 --> 7a8ecd08_0737_7d51_af1e_c8038318b49f 0d277acf_0d68_9daf_8724_642232a89719["pg"] d98a6918_3b17_ff84_de27_7a294902ee41 --> 0d277acf_0d68_9daf_8724_642232a89719 25b05299_f48f_bceb_01ca_1343d330a8f7["utils.ts"] d98a6918_3b17_ff84_de27_7a294902ee41 --> 25b05299_f48f_bceb_01ca_1343d330a8f7 ff952b0e_173f_067e_5e4f_abb094f1dfcc["index.ts"] d98a6918_3b17_ff84_de27_7a294902ee41 --> ff952b0e_173f_067e_5e4f_abb094f1dfcc 1da0a48e_f7fe_5ea4_cee2_3ed7d3f39f31["index.ts"] d98a6918_3b17_ff84_de27_7a294902ee41 --> 1da0a48e_f7fe_5ea4_cee2_3ed7d3f39f31 fa14e9c0_b73d_4bcb_463b_adf18df8a285["index.ts"] d98a6918_3b17_ff84_de27_7a294902ee41 --> fa14e9c0_b73d_4bcb_463b_adf18df8a285 ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] d98a6918_3b17_ff84_de27_7a294902ee41 --> ecce3253_1e75_a87f_27b3_ca87e81a3024 style d98a6918_3b17_ff84_de27_7a294902ee41 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Kysely, PostgresDialect } from 'kysely';
import pg from 'pg';
import { type Equal, Expect } from 'type-tests/utils.ts';
import type { Kyselify } from '~/kysely/index.ts';
import { char, mysqlTable, timestamp as mysqlTimestamp, varchar as mysqlVarchar } from '~/mysql-core/index.ts';
import { integer, pgEnum, pgTable, serial, text, timestamp, varchar } from '~/pg-core/index.ts';
import type { PromiseOf } from '~/utils.ts';
const { Pool } = pg;
const test = pgTable('test', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
interface Database {
test: Kyselify<typeof test>;
}
const db = new Kysely<Database>({
dialect: new PostgresDialect({
pool: new Pool(),
}),
});
const result = db.selectFrom('test').selectAll().execute();
Expect<Equal<PromiseOf<typeof result>, typeof test.$inferSelect[]>>();
{
const units = mysqlTable('units', {
id: char('id', { length: 16 }).primaryKey(),
name: mysqlVarchar('name', { length: 255 }).notNull(),
abbreviation: mysqlVarchar('abbreviation', { length: 10 }).notNull(),
created_at: mysqlTimestamp('created_at').defaultNow().notNull(),
updated_at: mysqlTimestamp('updated_at').defaultNow().notNull().onUpdateNow(),
});
type UnitModel = typeof units;
interface Database {
units: Kyselify<UnitModel>;
}
const db = new Kysely<Database>({
dialect: new PostgresDialect({
pool: new Pool(),
}),
});
await db
.insertInto('units')
.values({
id: 'my-unique-id',
abbreviation: 'foo',
name: 'bar',
})
.execute();
}
{
const uploadStateEnum = pgEnum('upload_state', ['uploading', 'uploaded', 'failed']);
const uploadTypeEnum = pgEnum('upload_type', ['image', 'video']);
const uploads = pgTable('uploads', {
id: varchar('id', { length: 100 }).primaryKey(),
state: uploadStateEnum('state').notNull().default('uploading'),
type: uploadTypeEnum('type').notNull(),
fileName: varchar('file_name', { length: 100 }).notNull(),
fileType: varchar('file_type', { length: 100 }).notNull(),
fileSize: integer('file_size').notNull(),
createdAt: timestamp('created_at').notNull().defaultNow(),
uploadedAt: timestamp('uploaded_at'),
});
interface Database {
uploads: Kyselify<typeof uploads>;
}
const db = new Kysely<Database>({
dialect: new PostgresDialect({
pool: new Pool(),
}),
});
await db
.insertInto('uploads')
.values({
id: '1',
file_name: 'fileName',
file_type: 'contentType',
type: 'image',
file_size: 1,
})
.returning('id')
.executeTakeFirst();
}
Dependencies
- index.ts
- index.ts
- index.ts
- kysely
- pg
- utils.ts
- utils.ts
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the drizzle-orm codebase, written in typescript.
What does index.ts depend on?
index.ts imports 7 module(s): index.ts, index.ts, index.ts, kysely, pg, utils.ts, utils.ts.
Where is index.ts in the architecture?
index.ts is located at drizzle-orm/type-tests/kysely/index.ts (directory: drizzle-orm/type-tests/kysely).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free