driver.ts — drizzle-orm Source File
Architecture documentation for driver.ts, a typescript file in the drizzle-orm codebase. 11 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR a31a3294_138f_5fe3_66a6_78efb3064274["driver.ts"] 8c075175_ed31_3ec7_952e_c0a6558abc34["session.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 8c075175_ed31_3ec7_952e_c0a6558abc34 b5f39cbd_0992_c93c_e18e_1884481a37ac["NeonHttpSession"] a31a3294_138f_5fe3_66a6_78efb3064274 --> b5f39cbd_0992_c93c_e18e_1884481a37ac e9867962_df5d_03c5_8e49_973b2b1a930a["serverless"] a31a3294_138f_5fe3_66a6_78efb3064274 --> e9867962_df5d_03c5_8e49_973b2b1a930a 4dc3ba08_25aa_13fd_82c6_8802d5991d05["batch.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 4dc3ba08_25aa_13fd_82c6_8802d5991d05 4509cca4_7fd9_2ecd_1b7c_1ef1c0ee30c4["cache.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 4509cca4_7fd9_2ecd_1b7c_1ef1c0ee30c4 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 220c512d_350b_24bf_2142_53ec35a980ac["logger.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 220c512d_350b_24bf_2142_53ec35a980ac 84b656ff_244f_df0f_a4a0_653292f28349["db.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 84b656ff_244f_df0f_a4a0_653292f28349 65dc222f_bc11_439f_d65b_20d7052b24ec["dialect.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> 65dc222f_bc11_439f_d65b_20d7052b24ec e4d6a0ab_9aa2_13a6_a2f1_58d94314c3f2["relations.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> e4d6a0ab_9aa2_13a6_a2f1_58d94314c3f2 ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] a31a3294_138f_5fe3_66a6_78efb3064274 --> ecce3253_1e75_a87f_27b3_ca87e81a3024 4ebd26a8_695e_2fdb_c669_8356e302a4ce["migrator.ts"] 4ebd26a8_695e_2fdb_c669_8356e302a4ce --> a31a3294_138f_5fe3_66a6_78efb3064274 style a31a3294_138f_5fe3_66a6_78efb3064274 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { HTTPQueryOptions, HTTPTransactionOptions, NeonQueryFunction } from '@neondatabase/serverless';
import { neon, types } from '@neondatabase/serverless';
import type { BatchItem, BatchResponse } from '~/batch.ts';
import type { Cache } from '~/cache/core/cache.ts';
import { entityKind } from '~/entity.ts';
import type { Logger } from '~/logger.ts';
import { DefaultLogger } from '~/logger.ts';
import { PgDatabase } from '~/pg-core/db.ts';
import { PgDialect } from '~/pg-core/dialect.ts';
import { createTableRelationsHelpers, extractTablesRelationalConfig } from '~/relations.ts';
import type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';
import { type DrizzleConfig, isConfig } from '~/utils.ts';
import { type NeonHttpClient, type NeonHttpQueryResultHKT, NeonHttpSession } from './session.ts';
export interface NeonDriverOptions {
logger?: Logger;
cache?: Cache;
}
export class NeonHttpDriver {
static readonly [entityKind]: string = 'NeonHttpDriver';
constructor(
private client: NeonHttpClient,
private dialect: PgDialect,
private options: NeonDriverOptions = {},
) {
this.initMappers();
}
createSession(
schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined,
): NeonHttpSession<Record<string, unknown>, TablesRelationalConfig> {
return new NeonHttpSession(this.client, this.dialect, schema, {
logger: this.options.logger,
cache: this.options.cache,
});
}
initMappers() {
types.setTypeParser(types.builtins.TIMESTAMPTZ, (val) => val);
types.setTypeParser(types.builtins.TIMESTAMP, (val) => val);
types.setTypeParser(types.builtins.DATE, (val) => val);
types.setTypeParser(types.builtins.INTERVAL, (val) => val);
types.setTypeParser(1231, (val) => val);
types.setTypeParser(1115, (val) => val);
types.setTypeParser(1185, (val) => val);
types.setTypeParser(1187, (val) => val);
types.setTypeParser(1182, (val) => val);
}
}
function wrap<T extends object>(
target: T,
token: Exclude<HTTPQueryOptions<true, true>['authToken'], undefined>,
cb: (target: any, p: string | symbol, res: any) => any,
deep?: boolean,
) {
return new Proxy(target, {
get(target, p) {
// ... (177 more lines)
Domain
Subdomains
Functions
Classes
Types
Dependencies
- NeonHttpSession
- batch.ts
- cache.ts
- db.ts
- dialect.ts
- entity.ts
- logger.ts
- relations.ts
- serverless
- session.ts
- utils.ts
Imported By
Source
Frequently Asked Questions
What does driver.ts do?
driver.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, QueryBuilders subdomain.
What functions are defined in driver.ts?
driver.ts defines 4 function(s): construct, drizzle, mock, wrap.
What does driver.ts depend on?
driver.ts imports 11 module(s): NeonHttpSession, batch.ts, cache.ts, db.ts, dialect.ts, entity.ts, logger.ts, relations.ts, and 3 more.
What files import driver.ts?
driver.ts is imported by 1 file(s): migrator.ts.
Where is driver.ts in the architecture?
driver.ts is located at drizzle-orm/src/neon-http/driver.ts (domain: DrizzleORM, subdomain: QueryBuilders, directory: drizzle-orm/src/neon-http).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free