Skip to content

TextFilterSchema

const TextFilterSchema: Union<[mutable<Struct<{
kind: Literal<["text"]>;
operator: SchemaClass<
| "endsWith"
| "startsWith"
| "eq"
| "ne"
| "contains"
| "like"
| "ilike"
| "notIlike",
| "endsWith"
| "startsWith"
| "eq"
| "ne"
| "contains"
| "like"
| "ilike"
| "notIlike", never>;
value: typeof String$;
}>>, mutable<Struct<{
kind: Literal<["text"]>;
operator: SchemaClass<"inArray" | "notInArray", "inArray" | "notInArray", never>;
values: mutable<Array$<typeof String$>>;
}>>, mutable<Struct<{
kind: Literal<["text"]>;
operator: SchemaClass<"isNull" | "isNotNull", "isNull" | "isNotNull", never>;
}>>]>;

Defined in: filters/schemas-effect.ts:70

Validates a text-kind field filter (the model’s TextFilter): a single value with a text operator (TEXT_SCALAR_OPERATORS), a values[] list with inArray/notInArray, or a unary isNull/isNotNull.

import { Schema } from "effect";
import { TextFilterSchema } from "@xtandard/lib/filters/effect";
const input = { kind: "text", operator: "contains", value: "ada" };
Schema.decodeUnknownSync(TextFilterSchema)(input);
// → `input`, typed as `TextFilter`
Schema.is(TextFilterSchema)({ kind: "text", operator: "lt", value: "a" });
// → false (`lt` isn't a text operator)