Home / Class/ AwsDataApiSession Class — drizzle-orm Architecture

AwsDataApiSession Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  96e11865_03f5_599b_419a_05dba059c0a5["AwsDataApiSession"]
  e8d52f5f_2316_1b4f_9799_7155b57c23ff["session.ts"]
  96e11865_03f5_599b_419a_05dba059c0a5 -->|defined in| e8d52f5f_2316_1b4f_9799_7155b57c23ff
  3e2f1f77_62f8_33b1_d599_c97603eafdc9["constructor()"]
  96e11865_03f5_599b_419a_05dba059c0a5 -->|method| 3e2f1f77_62f8_33b1_d599_c97603eafdc9
  d708b5e5_77e0_cb7b_2b00_dd9bdcd21453["prepareQuery()"]
  96e11865_03f5_599b_419a_05dba059c0a5 -->|method| d708b5e5_77e0_cb7b_2b00_dd9bdcd21453
  dc12a9ca_6df0_a24f_375b_accb4041dc98["execute()"]
  96e11865_03f5_599b_419a_05dba059c0a5 -->|method| dc12a9ca_6df0_a24f_375b_accb4041dc98
  9a2e43e2_718c_8f28_8c34_554851e1626b["transaction()"]
  96e11865_03f5_599b_419a_05dba059c0a5 -->|method| 9a2e43e2_718c_8f28_8c34_554851e1626b

Relationship Graph

Source Code

drizzle-orm/src/aws-data-api/pg/session.ts lines 165–257

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

	/** @internal */
	readonly rawQuery: AwsDataApiQueryBase;
	private cache: Cache;

	constructor(
		/** @internal */
		readonly client: AwsDataApiClient,
		dialect: PgDialect,
		private schema: RelationalSchemaConfig<TSchema> | undefined,
		private options: AwsDataApiSessionOptions,
		/** @internal */
		readonly transactionId: string | undefined,
	) {
		super(dialect);
		this.rawQuery = {
			secretArn: options.secretArn,
			resourceArn: options.resourceArn,
			database: options.database,
		};
		this.cache = options.cache ?? new NoopCache();
	}

	prepareQuery<
		T extends PreparedQueryConfig & {
			values: AwsDataApiPgQueryResult<unknown[]>;
		} = PreparedQueryConfig & {
			values: AwsDataApiPgQueryResult<unknown[]>;
		},
	>(
		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,
		transactionId?: string,
	): AwsDataApiPreparedQuery<T> {
		return new AwsDataApiPreparedQuery(
			this.client,
			query.sql,
			query.params,
			query.typings ?? [],
			this.options,
			this.cache,
			queryMetadata,
			cacheConfig,
			fields,
			transactionId ?? this.transactionId,
			isResponseInArrayMode,
			customResultMapper,
		);
	}

	override execute<T>(query: SQL): Promise<T> {
		return this.prepareQuery<PreparedQueryConfig & { execute: T; values: AwsDataApiPgQueryResult<unknown[]> }>(
			this.dialect.sqlToQuery(query),
			undefined,
			undefined,
			false,
			undefined,
			undefined,
			undefined,
			this.transactionId,
		).execute();
	}

	override async transaction<T>(
		transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>,
		config?: PgTransactionConfig | undefined,
	): Promise<T> {
		const { transactionId } = await this.client.send(new BeginTransactionCommand(this.rawQuery));
		const session = new AwsDataApiSession(this.client, this.dialect, this.schema, this.options, transactionId);
		const tx = new AwsDataApiTransaction<TFullSchema, TSchema>(this.dialect, session, this.schema);
		if (config) {

Domain

Frequently Asked Questions

What is the AwsDataApiSession class?
AwsDataApiSession is a class in the drizzle-orm codebase, defined in drizzle-orm/src/aws-data-api/pg/session.ts.
Where is AwsDataApiSession defined?
AwsDataApiSession is defined in drizzle-orm/src/aws-data-api/pg/session.ts at line 165.

Analyze Your Own Codebase

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

Try Supermodel Free