@@ -12,6 +12,7 @@ type FilterOperator =
1212 | 'like'
1313 | 'ilike'
1414 | 'is'
15+ | 'isdistinct'
1516 | 'in'
1617 | 'cs'
1718 | 'cd'
@@ -25,6 +26,8 @@ type FilterOperator =
2526 | 'plfts'
2627 | 'phfts'
2728 | 'wfts'
29+ | 'match'
30+ | 'imatch'
2831
2932export type IsStringOperator < Path extends string > = Path extends `${string } ->>${string } `
3033 ? true
@@ -273,6 +276,34 @@ export default class PostgrestFilterBuilder<
273276 return this
274277 }
275278
279+ regexMatch < ColumnName extends string & keyof Row > ( column : ColumnName , pattern : string ) : this
280+ regexMatch ( column : string , pattern : string ) : this
281+ /**
282+ * Match only rows where `column` matches the PostgreSQL regex `pattern`
283+ * case-sensitively (using the `~` operator).
284+ *
285+ * @param column - The column to filter on
286+ * @param pattern - The PostgreSQL regular expression pattern to match with
287+ */
288+ regexMatch ( column : string , pattern : string ) : this {
289+ this . url . searchParams . append ( column , `match.${ pattern } ` )
290+ return this
291+ }
292+
293+ regexIMatch < ColumnName extends string & keyof Row > ( column : ColumnName , pattern : string ) : this
294+ regexIMatch ( column : string , pattern : string ) : this
295+ /**
296+ * Match only rows where `column` matches the PostgreSQL regex `pattern`
297+ * case-insensitively (using the `~*` operator).
298+ *
299+ * @param column - The column to filter on
300+ * @param pattern - The PostgreSQL regular expression pattern to match with
301+ */
302+ regexIMatch ( column : string , pattern : string ) : this {
303+ this . url . searchParams . append ( column , `imatch.${ pattern } ` )
304+ return this
305+ }
306+
276307 is < ColumnName extends string & keyof Row > (
277308 column : ColumnName ,
278309 value : Row [ ColumnName ] & ( boolean | null )
@@ -295,6 +326,28 @@ export default class PostgrestFilterBuilder<
295326 return this
296327 }
297328
329+ /**
330+ * Match only rows where `column` IS DISTINCT FROM `value`.
331+ *
332+ * Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
333+ * are considered equal (not distinct), and comparing `NULL` with any non-NULL
334+ * value returns true (distinct).
335+ *
336+ * @param column - The column to filter on
337+ * @param value - The value to filter with
338+ */
339+ isDistinct < ColumnName extends string > (
340+ column : ColumnName ,
341+ value : ResolveFilterValue < Schema , Row , ColumnName > extends never
342+ ? unknown
343+ : ResolveFilterValue < Schema , Row , ColumnName > extends infer ResolvedFilterValue
344+ ? ResolvedFilterValue
345+ : never
346+ ) : this {
347+ this . url . searchParams . append ( column , `isdistinct.${ value } ` )
348+ return this
349+ }
350+
298351 /**
299352 * Match only rows where `column` is included in the `values` array.
300353 *
0 commit comments