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

Function l2Distance

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

Source from the content-addressed store, hash-verified

29 * ```
30 */
31export function l2Distance(
32 column: SQLWrapper | AnyColumn,
33 value: number[] | string[] | TypedQueryBuilder<any> | string,
34): SQL {
35 if (Array.isArray(value)) {
36 return sql`${column} <-> ${toSql(value)}`;
37 }
38 return sql`${column} <-> ${value}`;
39}
40
41/**
42 * L1 distance is one of the possible distance measures between two probability distribution vectors and it is

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