db.ts — drizzle-orm Source File
Architecture documentation for db.ts, a typescript file in the drizzle-orm codebase. 23 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9b087225_652d_6b65_62a9_87af0bff69c9["db.ts"] a2e1e4f4_2b6e_c197_a707_793466cb421f["index.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> a2e1e4f4_2b6e_c197_a707_793466cb421f 4d703ec7_e74f_0420_0cd8_9b3940f02f76["count.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 4d703ec7_e74f_0420_0cd8_9b3940f02f76 d01b7d32_c197_dd65_acbf_7910bdd5edfa["GelCountBuilder"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> d01b7d32_c197_dd65_acbf_7910bdd5edfa 496562d4_b832_5877_db12_bfc126b68038["query.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 496562d4_b832_5877_db12_bfc126b68038 1a97327d_cbc2_077c_116b_c6d51371d482["RelationalQueryBuilder"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 1a97327d_cbc2_077c_116b_c6d51371d482 5575ff85_39ed_4d70_5dd6_d2ddebcb431e["raw.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 5575ff85_39ed_4d70_5dd6_d2ddebcb431e dc68f965_347e_d177_bd7f_a455b696a3b2["GelRaw"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> dc68f965_347e_d177_bd7f_a455b696a3b2 c849aaef_8005_81e6_2269_35e467787b2e["GelRaw"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> c849aaef_8005_81e6_2269_35e467787b2e 1802ae0d_e56f_7575_eb4a_b95e50f061c0["select.types.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 1802ae0d_e56f_7575_eb4a_b95e50f061c0 d9d2f5d1_df48_1a41_8a59_514a1d97197d["subquery.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> d9d2f5d1_df48_1a41_8a59_514a1d97197d be86042a_e0e2_e322_228e_e182ac8bd699["view-base.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> be86042a_e0e2_e322_228e_e182ac8bd699 4509cca4_7fd9_2ecd_1b7c_1ef1c0ee30c4["cache.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 4509cca4_7fd9_2ecd_1b7c_1ef1c0ee30c4 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 f86d3f7c_7b46_5b9f_94e2_ac0a5f48d903["dialect.ts"] 9b087225_652d_6b65_62a9_87af0bff69c9 --> f86d3f7c_7b46_5b9f_94e2_ac0a5f48d903 style 9b087225_652d_6b65_62a9_87af0bff69c9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Cache } from '~/cache/core/cache.ts';
import { entityKind } from '~/entity.ts';
import type { GelDialect } from '~/gel-core/dialect.ts';
import {
GelDeleteBase,
GelInsertBuilder,
GelSelectBuilder,
GelUpdateBuilder,
QueryBuilder,
} from '~/gel-core/query-builders/index.ts';
import type { GelQueryResultHKT, GelSession, GelTransaction, PreparedQueryConfig } from '~/gel-core/session.ts';
import type { GelTable } from '~/gel-core/table.ts';
import type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';
import type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';
import { SelectionProxyHandler } from '~/selection-proxy.ts';
import { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';
import { WithSubquery } from '~/subquery.ts';
import type { DrizzleTypeError } from '~/utils.ts';
import type { GelColumn } from './columns/index.ts';
import { GelCountBuilder } from './query-builders/count.ts';
import { RelationalQueryBuilder } from './query-builders/query.ts';
import { GelRaw } from './query-builders/raw.ts';
import type { SelectedFields } from './query-builders/select.types.ts';
import type { WithSubqueryWithSelection } from './subquery.ts';
import type { GelViewBase } from './view-base.ts';
export class GelDatabase<
TQueryResult extends GelQueryResultHKT,
TFullSchema extends Record<string, unknown> = Record<string, never>,
TSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>,
> {
static readonly [entityKind]: string = 'GelDatabase';
declare readonly _: {
readonly schema: TSchema | undefined;
readonly fullSchema: TFullSchema;
readonly tableNamesMap: Record<string, string>;
readonly session: GelSession<TQueryResult, TFullSchema, TSchema>;
};
query: TFullSchema extends Record<string, never>
? DrizzleTypeError<'Seems like the schema generic is missing - did you forget to add it to your DB type?'>
: {
[K in keyof TSchema]: RelationalQueryBuilder<TSchema, TSchema[K]>;
};
constructor(
/** @internal */
readonly dialect: GelDialect,
/** @internal */
readonly session: GelSession<any, any, any>,
schema: RelationalSchemaConfig<TSchema> | undefined,
) {
this._ = schema
? {
schema: schema.schema,
fullSchema: schema.fullSchema as TFullSchema,
tableNamesMap: schema.tableNamesMap,
session,
}
// ... (615 more lines)
Domain
Subdomains
Functions
Classes
Types
Dependencies
- GelCountBuilder
- GelRaw
- GelRaw
- RelationalQueryBuilder
- cache.ts
- count.ts
- dialect.ts
- entity.ts
- index.ts
- index.ts
- query-builder.ts
- query.ts
- raw.ts
- relations.ts
- select.types.ts
- selection-proxy.ts
- session.ts
- sql.ts
- subquery.ts
- subquery.ts
- table.ts
- utils.ts
- view-base.ts
Imported By
Source
Frequently Asked Questions
What does db.ts do?
db.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in db.ts?
db.ts defines 1 function(s): withReplicas.
What does db.ts depend on?
db.ts imports 23 module(s): GelCountBuilder, GelRaw, GelRaw, RelationalQueryBuilder, cache.ts, count.ts, dialect.ts, entity.ts, and 15 more.
What files import db.ts?
db.ts is imported by 1 file(s): session.ts.
Where is db.ts in the architecture?
db.ts is located at drizzle-orm/src/gel-core/db.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src/gel-core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free