MCPcopy Index your code
hub / github.com/CaviraOSS/OpenMemory / storeVector

Method storeVector

backend/src/core/vector/postgres.ts:17–21  ·  view source on GitHub ↗
(id: string, sector: string, vector: number[], dim: number, user_id?: string)

Source from the content-addressed store, hash-verified

15 }
16
17 async storeVector(id: string, sector: string, vector: number[], dim: number, user_id?: string): Promise<void> {
18 const v = vectorToBuffer(vector);
19 const sql = `insert into ${this.table}(id,sector,user_id,v,dim) values($1,$2,$3,$4,$5) on conflict(id,sector) do update set user_id=excluded.user_id,v=excluded.v,dim=excluded.dim`;
20 await this.db.run_async(sql, [id, sector, user_id || "anonymous", v, dim]);
21 }
22
23 async deleteVector(id: string, sector: string): Promise<void> {
24 await this.db.run_async(`delete from ${this.table} where id=$1 and sector=$2`, [id, sector]);

Callers

nothing calls this directly

Calls 1

vectorToBufferFunction · 0.90

Tested by

no test coverage detected