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

query() — drizzle-orm Function Reference

Architecture documentation for the query() function in singlestore-proxy.test.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  cee34a27_f17c_f427_2fed_60c0bc296bb5["query()"]
  02c4908a_3c23_944b_3035_d4ab28bc0f69["ServerSimulator"]
  cee34a27_f17c_f427_2fed_60c0bc296bb5 -->|defined in| 02c4908a_3c23_944b_3035_d4ab28bc0f69
  a249f835_c17c_f8f5_2468_bb3fe7b24b6d["migrations()"]
  a249f835_c17c_f8f5_2468_bb3fe7b24b6d -->|calls| cee34a27_f17c_f427_2fed_60c0bc296bb5
  style cee34a27_f17c_f427_2fed_60c0bc296bb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integration-tests/tests/singlestore/singlestore-proxy.test.ts lines 15–54

	async query(sql: string, params: any[], method: 'all' | 'execute') {
		if (method === 'all') {
			try {
				const result = await this.db.query({
					sql,
					values: params,
					rowsAsArray: true,
					typeCast: function(field: any, next: any) {
						if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
							return field.string();
						}
						return next();
					},
				});

				return { data: result[0] as any };
			} catch (e: any) {
				return { error: e };
			}
		} else if (method === 'execute') {
			try {
				const result = await this.db.query({
					sql,
					values: params,
					typeCast: function(field: any, next: any) {
						if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
							return field.string();
						}
						return next();
					},
				});

				return { data: result as any };
			} catch (e: any) {
				return { error: e };
			}
		} else {
			return { error: 'Unknown method value' };
		}
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does query() do?
query() is a function in the drizzle-orm codebase, defined in integration-tests/tests/singlestore/singlestore-proxy.test.ts.
Where is query() defined?
query() is defined in integration-tests/tests/singlestore/singlestore-proxy.test.ts at line 15.
What calls query()?
query() is called by 1 function(s): migrations.

Analyze Your Own Codebase

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

Try Supermodel Free