session.ts — drizzle-orm Source File
Architecture documentation for session.ts, a typescript file in the drizzle-orm codebase. 12 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR baed709d_8779_aa82_55d7_015a29a37065["session.ts"] b02a037b_0c99_6322_ae9e_c7e11ee45713["serverless"] baed709d_8779_aa82_55d7_015a29a37065 --> b02a037b_0c99_6322_ae9e_c7e11ee45713 363fdd67_2503_7ef7_e1f3_a1ef31694431["index.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 363fdd67_2503_7ef7_e1f3_a1ef31694431 47a9c453_10f1_a759_6246_695fcce2b20a["types.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 47a9c453_10f1_a759_6246_695fcce2b20a 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 220c512d_350b_24bf_2142_53ec35a980ac["logger.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 220c512d_350b_24bf_2142_53ec35a980ac 8e1e9852_05bf_563a_0455_d59c9d25a84e["dialect.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 8e1e9852_05bf_563a_0455_d59c9d25a84e 8d6c2a88_02dc_58ca_3b5b_21d95d5cbfee["select.types.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 8d6c2a88_02dc_58ca_3b5b_21d95d5cbfee 41e092f8_b812_732d_b00f_7596b41fc839["session.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> 41e092f8_b812_732d_b00f_7596b41fc839 e4d6a0ab_9aa2_13a6_a2f1_58d94314c3f2["relations.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> e4d6a0ab_9aa2_13a6_a2f1_58d94314c3f2 be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] baed709d_8779_aa82_55d7_015a29a37065 --> ecce3253_1e75_a87f_27b3_ca87e81a3024 3ae74e9d_9ef5_2553_ca81_fae936d635ca["driver.ts"] 3ae74e9d_9ef5_2553_ca81_fae936d635ca --> baed709d_8779_aa82_55d7_015a29a37065 style baed709d_8779_aa82_55d7_015a29a37065 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Connection, ExecuteOptions, FullResult, Tx } from '@tidbcloud/serverless';
import { type Cache, NoopCache } from '~/cache/core/index.ts';
import type { WithCacheConfig } from '~/cache/core/types.ts';
import { Column } from '~/column.ts';
import { entityKind, is } from '~/entity.ts';
import type { Logger } from '~/logger.ts';
import { NoopLogger } from '~/logger.ts';
import type { MySqlDialect } from '~/mysql-core/dialect.ts';
import type { SelectedFieldsOrdered } from '~/mysql-core/query-builders/select.types.ts';
import {
MySqlPreparedQuery,
type MySqlPreparedQueryConfig,
type MySqlPreparedQueryHKT,
type MySqlQueryResultHKT,
MySqlSession,
MySqlTransaction,
} from '~/mysql-core/session.ts';
import type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';
import { fillPlaceholders, type Query, type SQL, sql } from '~/sql/sql.ts';
import { type Assume, mapResultRow } from '~/utils.ts';
const executeRawConfig = { fullResult: true } satisfies ExecuteOptions;
const queryConfig = { arrayMode: true } satisfies ExecuteOptions;
export class TiDBServerlessPreparedQuery<T extends MySqlPreparedQueryConfig> extends MySqlPreparedQuery<T> {
static override readonly [entityKind]: string = 'TiDBPreparedQuery';
constructor(
private client: Tx | Connection,
private queryString: string,
private params: unknown[],
private logger: Logger,
cache: Cache,
queryMetadata: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined,
cacheConfig: WithCacheConfig | undefined,
private fields: SelectedFieldsOrdered | undefined,
private customResultMapper?: (rows: unknown[][]) => T['execute'],
// Keys that were used in $default and the value that was generated for them
private generatedIds?: Record<string, unknown>[],
// Keys that should be returned, it has the column with all properries + key from object
private returningIds?: SelectedFieldsOrdered,
) {
super(cache, queryMetadata, cacheConfig);
}
async execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {
const params = fillPlaceholders(this.params, placeholderValues);
this.logger.logQuery(this.queryString, params);
const { fields, client, queryString, joinsNotNullableMap, customResultMapper, returningIds, generatedIds } = this;
if (!fields && !customResultMapper) {
const res = await this.queryWithCache(queryString, params, async () => {
return await client.execute(queryString, params, executeRawConfig) as FullResult;
});
const insertId = res.lastInsertId ?? 0;
// ... (178 more lines)
Domain
Subdomains
Dependencies
- column.ts
- dialect.ts
- entity.ts
- index.ts
- logger.ts
- relations.ts
- select.types.ts
- serverless
- session.ts
- sql.ts
- types.ts
- utils.ts
Imported By
Source
Frequently Asked Questions
What does session.ts do?
session.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, QueryBuilders subdomain.
What does session.ts depend on?
session.ts imports 12 module(s): column.ts, dialect.ts, entity.ts, index.ts, logger.ts, relations.ts, select.types.ts, serverless, and 4 more.
What files import session.ts?
session.ts is imported by 1 file(s): driver.ts.
Where is session.ts in the architecture?
session.ts is located at drizzle-orm/src/tidb-serverless/session.ts (domain: DrizzleORM, subdomain: QueryBuilders, directory: drizzle-orm/src/tidb-serverless).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free