Skip to content

numberField

const numberField: (input) => PostgrestFieldSpec;

Defined in: filters/postgrest.ts:84

Allow-list a public field as a number filter over a PostgREST column. between becomes gte + lte (two params on the same column, which PostgREST ANDs).

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

PostgrestFieldSpec

import { buildParams, numberField } from "@xtandard/lib/filters/postgrest";
const { params } = buildParams({
spec: { total: numberField({ column: "total" }) },
filters: [{ field: "total", filter: { kind: "number", operator: "between", from: 10, to: 20 } }],
});
// params → [["total", "gte.10"], ["total", "lte.20"]]