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 56154db1_5e3f_c59a_0fe1_49dee20b0f87["constructor()"] 7b170b6b_8109_4580_dc12_4da0d59d8d8d["PgDatabase"] 56154db1_5e3f_c59a_0fe1_49dee20b0f87 -->|defined in| 7b170b6b_8109_4580_dc12_4da0d59d8d8d style 56154db1_5e3f_c59a_0fe1_49dee20b0f87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/pg-core/db.ts lines 56–91
constructor(
/** @internal */
readonly dialect: PgDialect,
/** @internal */
readonly session: PgSession<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 PgDatabase<TQueryResult, Record<string, any>>['query'])[tableName] = new RelationalQueryBuilder(
schema!.fullSchema,
this._.schema,
this._.tableNamesMap,
schema!.fullSchema[tableName] as PgTable,
columns,
dialect,
session,
);
}
}
this.$cache = { invalidate: async (_params: any) => {} };
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/db.ts.
Where is constructor() defined?
constructor() is defined in drizzle-orm/src/pg-core/db.ts at line 56.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free