The CommonGrants.Filters
namespace contains a series of basic filters that can be used to define both standard and custom filtering within
Filters
Learn more about the default filters supported by the CommonGrants protocol:
Base filter and operators
String
Numeric
Money
Date and time
Filter | Description |
---|
DateComparisonFilter | Filters by comparing a field to a date value |
DateRangeFilter | Filters by comparing a field to a range of date values |
isoTime | Time without timezone in ISO 8601 format (HH:mm:ss) |
isoDate | Calendar date in ISO 8601 format (YYYY-MM-DD) |
utcDateTime | Datetime with UTC timezone in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ) |
offsetDateTime | Datetime with timezone in ISO 8601 format (YYYY-MM-DDThh:mm:ss±hh:mm) |
Other types
Filter | Description |
---|
boolean | A true or false value |
array | An ordered list of values |
record | A collection of key-value pairs |
null | A null value |
unknown | A value of with any type |
Usage
You can use the types listed above to define custom models in your TypeSpec project.
import "@common-grants/core"
// Exposes the `Types` namespace so that it can be accessed
// without a `CommonGrants` prefix
id: Types.uuid; // CommonGrants-defined type
description: string; // Standard TypeSpec type
tags: Array<string>; // A templated type