expressions.ts — drizzle-orm Source File
Architecture documentation for expressions.ts, a typescript file in the drizzle-orm codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0f864dcb_a94f_1bd2_b447_ddbf65f6c66c["expressions.ts"] c2ee5a75_b49e_5e5a_3712_97b1b67b4a7b["index.ts"] 0f864dcb_a94f_1bd2_b447_ddbf65f6c66c --> c2ee5a75_b49e_5e5a_3712_97b1b67b4a7b 5c46beaf_8b59_d2e3_def3_8af6daf1fccd["index.ts"] 0f864dcb_a94f_1bd2_b447_ddbf65f6c66c --> 5c46beaf_8b59_d2e3_def3_8af6daf1fccd be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"] 0f864dcb_a94f_1bd2_b447_ddbf65f6c66c --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd style 0f864dcb_a94f_1bd2_b447_ddbf65f6c66c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { bindIfParam } from '~/sql/expressions/index.ts';
import type { Placeholder, SQL, SQLChunk, SQLWrapper } from '~/sql/sql.ts';
import { sql } from '~/sql/sql.ts';
import type { SingleStoreColumn } from './columns/index.ts';
export * from '~/sql/expressions/index.ts';
export function concat(column: SingleStoreColumn | SQL.Aliased, value: string | Placeholder | SQLWrapper): SQL {
return sql`${column} || ${bindIfParam(value, column)}`;
}
export function substring(
column: SingleStoreColumn | SQL.Aliased,
{ from, for: _for }: { from?: number | Placeholder | SQLWrapper; for?: number | Placeholder | SQLWrapper },
): SQL {
const chunks: SQLChunk[] = [sql`substring(`, column];
if (from !== undefined) {
chunks.push(sql` from `, bindIfParam(from, column));
}
if (_for !== undefined) {
chunks.push(sql` for `, bindIfParam(_for, column));
}
chunks.push(sql`)`);
return sql.join(chunks);
}
// Vectors
export function dotProduct(column: SingleStoreColumn | SQL.Aliased, value: Array<number>): SQL {
return sql`${column} <*> ${JSON.stringify(value)}`;
}
export function euclideanDistance(column: SingleStoreColumn | SQL.Aliased, value: Array<number>): SQL {
return sql`${column} <-> ${JSON.stringify(value)}`;
}
Domain
Subdomains
Dependencies
- index.ts
- index.ts
- sql.ts
Source
Frequently Asked Questions
What does expressions.ts do?
expressions.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in expressions.ts?
expressions.ts defines 4 function(s): concat, dotProduct, euclideanDistance, substring.
What does expressions.ts depend on?
expressions.ts imports 3 module(s): index.ts, index.ts, sql.ts.
Where is expressions.ts in the architecture?
expressions.ts is located at drizzle-orm/src/singlestore-core/expressions.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: drizzle-orm/src/singlestore-core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free