GelDbSession Class — drizzle-orm Architecture
Architecture documentation for the GelDbSession class in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 7a5a243a_5865_a6b8_4241_75b36641bad7["GelDbSession"] 40439e01_0b0d_d1ca_8a6c_cc21c23b9ce0["session.ts"] 7a5a243a_5865_a6b8_4241_75b36641bad7 -->|defined in| 40439e01_0b0d_d1ca_8a6c_cc21c23b9ce0 02840ffb_5bdf_bed2_f151_5eacaf27b039["constructor()"] 7a5a243a_5865_a6b8_4241_75b36641bad7 -->|method| 02840ffb_5bdf_bed2_f151_5eacaf27b039 c1064174_421c_3456_7f29_fa95192bfe78["prepareQuery()"] 7a5a243a_5865_a6b8_4241_75b36641bad7 -->|method| c1064174_421c_3456_7f29_fa95192bfe78 731efcce_91b3_f2d8_b038_268ef8f3a226["transaction()"] 7a5a243a_5865_a6b8_4241_75b36641bad7 -->|method| 731efcce_91b3_f2d8_b038_268ef8f3a226 177b695a_240d_1165_6610_204268974475["count()"] 7a5a243a_5865_a6b8_4241_75b36641bad7 -->|method| 177b695a_240d_1165_6610_204268974475
Relationship Graph
Source Code
drizzle-orm/src/gel/session.ts lines 109–168
export class GelDbSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig>
extends GelSession<GelQueryResultHKT, TFullSchema, TSchema>
{
static override readonly [entityKind]: string = 'GelDbSession';
private logger: Logger;
private cache: Cache;
constructor(
private client: GelClient,
dialect: GelDialect,
private schema: RelationalSchemaConfig<TSchema> | undefined,
private options: GelSessionOptions = {},
) {
super(dialect);
this.logger = options.logger ?? new NoopLogger();
this.cache = options.cache ?? new NoopCache();
}
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(
query: Query,
fields: SelectedFieldsOrdered | undefined,
name: string | undefined,
isResponseInArrayMode: boolean,
customResultMapper?: (rows: unknown[][]) => T['execute'],
queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
},
cacheConfig?: WithCacheConfig,
): GelDbPreparedQuery<T> {
return new GelDbPreparedQuery(
this.client,
query.sql,
query.params,
this.logger,
this.cache,
queryMetadata,
cacheConfig,
fields,
isResponseInArrayMode,
customResultMapper,
);
}
override async transaction<T>(
transaction: (tx: GelTransaction<GelQueryResultHKT, TFullSchema, TSchema>) => Promise<T>,
): Promise<T> {
return await (this.client as Client).transaction(async (clientTx) => {
const session = new GelDbSession(clientTx, this.dialect, this.schema, this.options);
const tx = new GelDbTransaction<TFullSchema, TSchema>(this.dialect, session, this.schema);
return await transaction(tx);
});
}
override async count(sql: SQL): Promise<number> {
const res = await this.execute<[{ count: string }]>(sql);
return Number(res[0]['count']);
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the GelDbSession class?
GelDbSession is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel/session.ts.
Where is GelDbSession defined?
GelDbSession is defined in drizzle-orm/src/gel/session.ts at line 109.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free