Skip to content

arrayField

const arrayField: (input) => PostgrestFieldSpec;

Defined in: filters/postgrest.ts:134

Allow-list a public field as an array filter over a Postgres array column (text[], int[]). arrayContains → cs (@>), arrayContained → cd (<@), arrayOverlaps → ov (&&), each with a Postgres array literal whose string elements are always quoted.

Parameter Type
input { column: string; }
input.column string

PostgrestFieldSpec

import { arrayField, buildParams } from "@xtandard/lib/filters/postgrest";
const { params } = buildParams({
spec: { tags: arrayField({ column: "tags" }) },
filters: [{ field: "tags", filter: { kind: "array", operator: "arrayContains", values: ["ts", "a,b"] } }],
});
// params → [["tags", 'cs.{"ts","a,b"}']]