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
  0a722b68_488a_f768_1c0b_6058f0b0f772["constructor()"]
  b1ecfc7b_8f56_6df4_7a24_c6d1f8b2d849["NodePgPreparedQuery"]
  0a722b68_488a_f768_1c0b_6058f0b0f772 -->|defined in| b1ecfc7b_8f56_6df4_7a24_c6d1f8b2d849
  892458e5_c727_756d_48cf_9ce867f8280a["constructor()"]
  892458e5_c727_756d_48cf_9ce867f8280a -->|calls| 0a722b68_488a_f768_1c0b_6058f0b0f772
  892458e5_c727_756d_48cf_9ce867f8280a["constructor()"]
  0a722b68_488a_f768_1c0b_6058f0b0f772 -->|calls| 892458e5_c727_756d_48cf_9ce867f8280a
  style 0a722b68_488a_f768_1c0b_6058f0b0f772 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/node-postgres/session.ts lines 27–131

	constructor(
		private client: NodePgClient,
		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,
		name: string | undefined,
		private _isResponseInArrayMode: boolean,
		private customResultMapper?: (rows: unknown[][]) => T['execute'],
	) {
		super({ sql: queryString, params }, cache, queryMetadata, cacheConfig);
		this.rawQueryConfig = {
			name,
			text: queryString,
			types: {
				// @ts-ignore
				getTypeParser: (typeId, format) => {
					if (typeId === types.builtins.TIMESTAMPTZ) {
						return (val) => val;
					}
					if (typeId === types.builtins.TIMESTAMP) {
						return (val) => val;
					}
					if (typeId === types.builtins.DATE) {
						return (val) => val;
					}
					if (typeId === types.builtins.INTERVAL) {
						return (val) => val;
					}
					// numeric[]
					if (typeId === 1231) {
						return (val) => val;
					}
					// timestamp[]
					if (typeId === 1115) {
						return (val) => val;
					}
					// timestamp with timezone[]
					if (typeId === 1185) {
						return (val) => val;
					}
					// interval[]
					if (typeId === 1187) {
						return (val) => val;
					}
					// date[]
					if (typeId === 1182) {
						return (val) => val;
					}
					// @ts-ignore
					return types.getTypeParser(typeId, format);
				},
			},
		};
		this.queryConfig = {
			name,
			text: queryString,
			rowMode: 'array',
			types: {
				// @ts-ignore
				getTypeParser: (typeId, format) => {
					if (typeId === types.builtins.TIMESTAMPTZ) {
						return (val) => val;
					}
					if (typeId === types.builtins.TIMESTAMP) {
						return (val) => val;
					}
					if (typeId === types.builtins.DATE) {
						return (val) => val;
					}
					if (typeId === types.builtins.INTERVAL) {
						return (val) => val;
					}
					// numeric[]
					if (typeId === 1231) {

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/node-postgres/session.ts.
Where is constructor() defined?
constructor() is defined in drizzle-orm/src/node-postgres/session.ts at line 27.
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