Skip to content

Instantly share code, notes, and snippets.

View arisrayelyan's full-sized avatar

Aram arisrayelyan

View GitHub Profile
{"message":"Connection: IllegalOperationError: Connection closed (Error: Connection closed: 320 (CONNECTION-FORCED) with message \"CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'\")","level":"error"}
@arisrayelyan
arisrayelyan / VectorType.ts
Last active July 2, 2024 21:47
This gist contains a custom MikroORM type designed for working with pgVector embedding in PostgreSQL. With this custom type, you can seamlessly integrate pgVector embeddings into your MikroORM-based projects, enabling efficient handling of vector data within your PostgreSQL database.
import { Type, EntityProperty, ValidationError } from "@mikro-orm/core";
export class VectorType extends Type<
number[] | null,
string | null | undefined
> {
convertToDatabaseValue(value: number[] | string | undefined): string | null {
if (!value) {
return null;
}