Home / File/ expressions.ts — drizzle-orm Source File

expressions.ts — drizzle-orm Source File

Architecture documentation for expressions.ts, a typescript file in the drizzle-orm codebase. 3 imports, 0 dependents.

File typescript DrizzleORM SQLDialects 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  49fe36d6_857d_2165_e992_502c24649a51["expressions.ts"]
  e383fa18_3db6_3f2c_0ac0_30b5ced54ad6["index.ts"]
  49fe36d6_857d_2165_e992_502c24649a51 --> e383fa18_3db6_3f2c_0ac0_30b5ced54ad6
  5c46beaf_8b59_d2e3_def3_8af6daf1fccd["index.ts"]
  49fe36d6_857d_2165_e992_502c24649a51 --> 5c46beaf_8b59_d2e3_def3_8af6daf1fccd
  be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"]
  49fe36d6_857d_2165_e992_502c24649a51 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd
  style 49fe36d6_857d_2165_e992_502c24649a51 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 { MySqlColumn } from './columns/index.ts';

export * from '~/sql/expressions/index.ts';

export function concat(column: MySqlColumn | SQL.Aliased, value: string | Placeholder | SQLWrapper): SQL {
	return sql`${column} || ${bindIfParam(value, column)}`;
}

export function substring(
	column: MySqlColumn | 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);
}

Domain

Subdomains

Dependencies

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, SQLDialects subdomain.
What functions are defined in expressions.ts?
expressions.ts defines 2 function(s): concat, 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/mysql-core/expressions.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/mysql-core).

Analyze Your Own Codebase

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

Try Supermodel Free