collectype / factory/bigints/bigIntComparison / bigIntComparisonFactory
bigIntComparisonFactory<
T,C>(ctx,oper): <K>(field,target) =>C
Defined in: factory/bigints/bigIntComparison.ts:40
Creates a predicate filter for bigint comparison using PredicType.bigint.comparison.
T
The item type in the collection.
C extends Wherable<T, C>
The Wherable context type (must extend Wherable<T, C>).
C
The context (usually a collection) supporting the where method.
BigIntComparisonOper
The bigint comparison operation (e.g., ‘equals’, ‘greaterThan’, etc.).
Returns a function that takes a field (of type bigint on T) and a target value, and applies the bigint comparison predicate to filter the context.
<
K>(field,target):C
K extends string | number | symbol
K
bigint
C
// Example: Composing a bigint comparison filter as a property, homogeneous model
import { BaseFunctions } from 'collectype';
import { bigIntComparisonFactory } from 'collectype';
type Person = { name: string; balance: bigint };
class PersonFunctions extends BaseFunctions<Person> {
bigIntEquals = bigIntComparisonFactory<Person, this>(this, 'equals');
}
// Usage:
const people: Person[] = [
{ name: 'Alice', balance: 1000n },
{ name: 'Bob', balance: 2000n }
];
const fn = new PersonFunctions(people);
const filtered = fn.bigIntEquals('balance', 1000n);
// filtered contains the items where 'balance' equals 1000n