From 21f150474d19aa3707f4a10cd1213fc2ba484d22 Mon Sep 17 00:00:00 2001 From: nick-w-nick <43578531+nick-w-nick@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:19:51 -0500 Subject: [PATCH] added supabase boolean column functionality --- .../langchain-community/src/structured_query/supabase.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/langchain-community/src/structured_query/supabase.ts b/libs/langchain-community/src/structured_query/supabase.ts index 602f46bfebfa..f799e8640215 100644 --- a/libs/langchain-community/src/structured_query/supabase.ts +++ b/libs/langchain-community/src/structured_query/supabase.ts @@ -1,5 +1,6 @@ import { isFilterEmpty, + isBoolean, isFloat, isInt, isObject, @@ -28,8 +29,8 @@ import { * structured query. It can be a string or a number. */ type ValueType = { - eq: string | number; - ne: string | number; + eq: string | number | boolean; + ne: string | number | boolean; lt: string | number; lte: string | number; gt: string | number; @@ -126,7 +127,7 @@ export class SupabaseTranslator< * @param includeType Whether to include the data type in the column name. * @returns The built column name. */ - buildColumnName(attr: string, value: string | number, includeType = true) { + buildColumnName(attr: string, value: string | number | boolean, includeType = true) { let column = ""; if (isString(value)) { column = `metadata->>${attr}`; @@ -134,6 +135,8 @@ export class SupabaseTranslator< column = `metadata->${attr}${includeType ? "::int" : ""}`; } else if (isFloat(value)) { column = `metadata->${attr}${includeType ? "::float" : ""}`; + } else if(isBoolean(value)) { + column = `metadata->${attr}${includeType ? "::bool" : ""}`; } else { throw new Error("Data type not supported"); }