Home / Class/ PgRemoteSession Class — drizzle-orm Architecture

PgRemoteSession Class — drizzle-orm Architecture

Architecture documentation for the PgRemoteSession class in session.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  60b52bae_f4fa_9a37_62a0_75cca0daeace["PgRemoteSession"]
  271f5ca2_4cd0_ab39_be04_a2370f5c940c["session.ts"]
  60b52bae_f4fa_9a37_62a0_75cca0daeace -->|defined in| 271f5ca2_4cd0_ab39_be04_a2370f5c940c
  1ea8908a_d2e7_96c8_94e9_5aa4d4c776ef["constructor()"]
  60b52bae_f4fa_9a37_62a0_75cca0daeace -->|method| 1ea8908a_d2e7_96c8_94e9_5aa4d4c776ef
  58bf0ee3_1314_96da_0ba3_51a7254110e2["prepareQuery()"]
  60b52bae_f4fa_9a37_62a0_75cca0daeace -->|method| 58bf0ee3_1314_96da_0ba3_51a7254110e2
  84d92e44_4d8a_3436_fcdc_325a0664a050["transaction()"]
  60b52bae_f4fa_9a37_62a0_75cca0daeace -->|method| 84d92e44_4d8a_3436_fcdc_325a0664a050

Relationship Graph

Source Code

drizzle-orm/src/pg-proxy/session.ts lines 23–76

export class PgRemoteSession<
	TFullSchema extends Record<string, unknown>,
	TSchema extends TablesRelationalConfig,
> extends PgSession<PgRemoteQueryResultHKT, TFullSchema, TSchema> {
	static override readonly [entityKind]: string = 'PgRemoteSession';

	private logger: Logger;
	private cache: Cache;

	constructor(
		private client: RemoteCallback,
		dialect: PgDialect,
		private schema: RelationalSchemaConfig<TSchema> | undefined,
		options: PgRemoteSessionOptions = {},
	) {
		super(dialect);
		this.logger = options.logger ?? new NoopLogger();
		this.cache = options.cache ?? new NoopCache();
	}

	prepareQuery<T extends PreparedQueryConfig>(
		query: QueryWithTypings,
		fields: SelectedFieldsOrdered | undefined,
		name: string | undefined,
		isResponseInArrayMode: boolean,
		customResultMapper?: (rows: unknown[][]) => T['execute'],
		queryMetadata?: {
			type: 'select' | 'update' | 'delete' | 'insert';
			tables: string[];
		},
		cacheConfig?: WithCacheConfig,
	): PreparedQuery<T> {
		return new PreparedQuery(
			this.client,
			query.sql,
			query.params,
			query.typings,
			this.logger,
			this.cache,
			queryMetadata,
			cacheConfig,
			fields,
			isResponseInArrayMode,
			customResultMapper,
		);
	}

	override async transaction<T>(
		_transaction: (tx: PgProxyTransaction<TFullSchema, TSchema>) => Promise<T>,
		_config?: PgTransactionConfig,
	): Promise<T> {
		throw new Error('Transactions are not supported by the Postgres Proxy driver');
	}
}

Domain

Frequently Asked Questions

What is the PgRemoteSession class?
PgRemoteSession is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-proxy/session.ts.
Where is PgRemoteSession defined?
PgRemoteSession is defined in drizzle-orm/src/pg-proxy/session.ts at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free