Home / Function/ constructor() — drizzle-orm Function Reference

constructor() — drizzle-orm Function Reference

Architecture documentation for the constructor() function in db.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  d12a6080_0a2b_c44d_b2e5_fd495a343fd9["constructor()"]
  2d57d0b7_4a77_af8e_8027_62a4fb11f803["GelDatabase"]
  d12a6080_0a2b_c44d_b2e5_fd495a343fd9 -->|defined in| 2d57d0b7_4a77_af8e_8027_62a4fb11f803
  30805203_a605_566e_0cfc_8e07b95a7364["constructor()"]
  d12a6080_0a2b_c44d_b2e5_fd495a343fd9 -->|calls| 30805203_a605_566e_0cfc_8e07b95a7364
  style d12a6080_0a2b_c44d_b2e5_fd495a343fd9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/gel-core/db.ts lines 47–83

	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,
			}
			: {
				schema: undefined,
				fullSchema: {} as TFullSchema,
				tableNamesMap: {},
				session,
			};
		this.query = {} as typeof this['query'];
		if (this._.schema) {
			for (const [tableName, columns] of Object.entries(this._.schema)) {
				(this.query as GelDatabase<TQueryResult, Record<string, any>>['query'])[tableName] = new RelationalQueryBuilder(
					schema!.fullSchema,
					this._.schema,
					this._.tableNamesMap,
					schema!.fullSchema[tableName] as GelTable,
					columns,
					dialect,
					session,
				);
			}
		}

		this.$cache = { invalidate: async (_params: any) => {} };
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/db.ts.
Where is constructor() defined?
constructor() is defined in drizzle-orm/src/gel-core/db.ts at line 47.
What does constructor() call?
constructor() calls 1 function(s): constructor.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free