MCPcopy Create free account
hub / github.com/ZenSystemAI/Zengram / registerVectorType

Function registerVectorType

api/src/services/pgvector.js:179–191  ·  view source on GitHub ↗
(pool)

Source from the content-addressed store, hash-verified

177
178// Register the vector OID so parameter binding works with float[] input.
179async function registerVectorType(pool) {
180 try {
181 const { rows } = await pool.query("SELECT oid FROM pg_type WHERE typname = 'vector'");
182 if (rows.length > 0) {
183 const oid = rows[0].oid;
184 pg.types.setTypeParser(oid, (val) => val);
185 return oid;
186 }
187 } catch (e) {
188 // Extension not yet installed — will be created by initPgvector
189 }
190 return null;
191}
192
193// Format a JS number array into pgvector literal syntax: [1.2, 3.4, ...]
194function toVectorLiteral(arr) {

Callers 1

initPgvectorFunction · 0.85

Calls 1

queryMethod · 0.80

Tested by

no test coverage detected