PostgresJsTransaction Class — drizzle-orm Architecture
Architecture documentation for the PostgresJsTransaction class in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD df07f92c_5121_7fc0_a5fb_37eda76ba69c["PostgresJsTransaction"] 72a101a5_a087_5795_1ea2_26f9e19eeff9["session.ts"] df07f92c_5121_7fc0_a5fb_37eda76ba69c -->|defined in| 72a101a5_a087_5795_1ea2_26f9e19eeff9 4c66ec52_e221_f772_0f02_2fefbba6ab5f["constructor()"] df07f92c_5121_7fc0_a5fb_37eda76ba69c -->|method| 4c66ec52_e221_f772_0f02_2fefbba6ab5f 2e54fc70_c916_df62_543e_cf9509a3df9e["transaction()"] df07f92c_5121_7fc0_a5fb_37eda76ba69c -->|method| 2e54fc70_c916_df62_543e_cf9509a3df9e
Relationship Graph
Source Code
drizzle-orm/src/postgres-js/session.ts lines 187–217
export class PostgresJsTransaction<
TFullSchema extends Record<string, unknown>,
TSchema extends TablesRelationalConfig,
> extends PgTransaction<PostgresJsQueryResultHKT, TFullSchema, TSchema> {
static override readonly [entityKind]: string = 'PostgresJsTransaction';
constructor(
dialect: PgDialect,
/** @internal */
override readonly session: PostgresJsSession<TransactionSql, TFullSchema, TSchema>,
schema: RelationalSchemaConfig<TSchema> | undefined,
nestedIndex = 0,
) {
super(dialect, session, schema, nestedIndex);
}
override transaction<T>(
transaction: (tx: PostgresJsTransaction<TFullSchema, TSchema>) => Promise<T>,
): Promise<T> {
return this.session.client.savepoint((client) => {
const session = new PostgresJsSession<TransactionSql, TFullSchema, TSchema>(
client,
this.dialect,
this.schema,
this.session.options,
);
const tx = new PostgresJsTransaction<TFullSchema, TSchema>(this.dialect, session, this.schema);
return transaction(tx);
}) as Promise<T>;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the PostgresJsTransaction class?
PostgresJsTransaction is a class in the drizzle-orm codebase, defined in drizzle-orm/src/postgres-js/session.ts.
Where is PostgresJsTransaction defined?
PostgresJsTransaction is defined in drizzle-orm/src/postgres-js/session.ts at line 187.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free