Skip to content

numberField

const numberField: (input) => PrismaFieldSpec;

Defined in: filters/prisma.ts:70

Allow-list a public field as a number filter over a Prisma Int/Float model field, named by its model field name ("total"). between becomes gte + lte.

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

PrismaFieldSpec

import { buildWhere, numberField } from "@xtandard/lib/filters/prisma";
const { where } = buildWhere({
spec: { total: numberField({ field: "total" }) },
filters: [{ field: "total", filter: { kind: "number", operator: "between", from: 10, to: 20 } }],
});
// where → { AND: [{ total: { gte: 10 } }, { total: { lte: 20 } }] }