MCPcopy
hub / github.com/drizzle-team/drizzle-orm / hammingDistance

Function hammingDistance

drizzle-orm/src/sql/functions/vector.ts:150–158  ·  view source on GitHub ↗
(
	column: SQLWrapper | AnyColumn,
	value: number[] | string[] | TypedQueryBuilder<any> | string,
)

Source from the content-addressed store, hash-verified

148 * ```
149 */
150export function hammingDistance(
151 column: SQLWrapper | AnyColumn,
152 value: number[] | string[] | TypedQueryBuilder<any> | string,
153): SQL {
154 if (Array.isArray(value)) {
155 return sql`${column} <~> ${toSql(value)}`;
156 }
157 return sql`${column} <~> ${value}`;
158}
159
160/**
161 * ## Examples

Callers 2

pg.test.tsFile · 0.90
postgres.test.tsFile · 0.90

Calls 2

sqlFunction · 0.90
toSqlFunction · 0.85

Tested by

no test coverage detected