Skip to content

TextFilterSchema

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

Defined in: filters/schemas-effect-v4.ts:73

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/v4";
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)