Home / Function/ constructor() — drizzle-orm Function Reference

constructor() — drizzle-orm Function Reference

Architecture documentation for the constructor() function in session.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  ec0bb7b5_2f95_b9d6_3de6_5ebfc0bd1bb8["constructor()"]
  f6d5f366_5923_39eb_1585_cad431d4f3e9["MySql2PreparedQuery"]
  ec0bb7b5_2f95_b9d6_3de6_5ebfc0bd1bb8 -->|defined in| f6d5f366_5923_39eb_1585_cad431d4f3e9
  bc4c2868_99c1_fc77_3962_0ca96de82327["constructor()"]
  bc4c2868_99c1_fc77_3962_0ca96de82327 -->|calls| ec0bb7b5_2f95_b9d6_3de6_5ebfc0bd1bb8
  bc4c2868_99c1_fc77_3962_0ca96de82327["constructor()"]
  ec0bb7b5_2f95_b9d6_3de6_5ebfc0bd1bb8 -->|calls| bc4c2868_99c1_fc77_3962_0ca96de82327
  style ec0bb7b5_2f95_b9d6_3de6_5ebfc0bd1bb8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/mysql2/session.ts lines 51–90

	constructor(
		private client: MySql2Client,
		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);
		this.rawQuery = {
			sql: queryString,
			// rowsAsArray: true,
			typeCast: function(field: any, next: any) {
				if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
					return field.string();
				}
				return next();
			},
		};
		this.query = {
			sql: queryString,
			rowsAsArray: true,
			typeCast: function(field: any, next: any) {
				if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
					return field.string();
				}
				return next();
			},
		};
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/mysql2/session.ts.
Where is constructor() defined?
constructor() is defined in drizzle-orm/src/mysql2/session.ts at line 51.
What does constructor() call?
constructor() calls 1 function(s): constructor.
What calls constructor()?
constructor() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free