Rich Filters
Rich Filters — Learn how to use semantic scalars for filtering
Semantic scalar types extend basic scalars (String, Int, Boolean) with domain-specific operators and automatic validation. This reference documents all 49 available types, their operators, and validation rules.
Semantic scalars are strongly-typed field values that understand their domain:
email: String — just text, no validationemail: EmailAddress — validates format, enables domain filteringWhen you use a semantic scalar, FraiseQL automatically generates:
| Type | Category | Use Case | Key Operators |
|---|---|---|---|
| EmailAddress | Contact | User emails | domainEq, domainIn, domainEndswith |
| PhoneNumber | Contact | Phone numbers | countryCodeEq, typeEq |
| URL | Contact | Web URLs | protocolEq, domainEq |
| DomainName | Contact | Domain names | suffixEq, level |
| Hostname | Contact | Server hostnames | suffixEq |
| IBAN | Financial | Bank accounts | countryEq, checksum |
| CUSIP | Financial | US securities | issuerEq |
| ISIN | Financial | Int’l securities | countryEq, typeEq |
| SEDOL | Financial | UK securities | issuerEq |
| LEI | Financial | Legal entities | countryEq |
| MIC | Financial | Exchanges | typeEq |
| CurrencyCode | Financial | ISO currencies | symbolEq, decimalPlacesEq |
| Money | Financial | Amounts | currencyEq, amountRange |
| ExchangeCode | Financial | Stock symbols | typeEq |
| ExchangeRate | Financial | Currency rates | baseCurrencyEq |
| StockSymbol | Financial | Ticker symbols | exchangeEq |
| PostalCode | Location | Zip codes | countryEq, formatEq |
| Latitude | Location | Latitude coord | rangeEq, hemisphereEq |
| Longitude | Location | Longitude coord | rangeEq |
| Coordinates | Location | Lat/lng pairs | distanceWithin, withinBoundingBox |
| Timezone | Location | IANA timezones | offsetEq, dstAwareEq |
| LocaleCode | Location | BCP47 locales | languageEq, regionEq |
| LanguageCode | Location | ISO639 codes | scriptEq |
| CountryCode | Location | ISO3166 codes | continentEq, inEUEq |
| Slug | Identifier | URL slugs | formatEq |
| SemanticVersion | Identifier | SemVer (v1.2.3) | majorEq, minorEq |
| HashSHA256 | Identifier | SHA256 hashes | formatEq |
| APIKey | Identifier | API credentials | prefixEq, lengthEq |
| LicensePlate | Identifier | Vehicle plates | countryEq, typeEq |
| VIN | Identifier | Vehicle numbers | wmiEq, yearEq |
| TrackingNumber | Identifier | Shipment tracking | carrierEq, typeEq |
| ContainerNumber | Identifier | Container IDs | ownersCodeEq |
| IPAddress | Network | IPv4/IPv6 | versionEq, cidrContains |
| IPv4 | Network | IPv4 only | classEq, cidrContains |
| IPv6 | Network | IPv6 only | scopeEq, cidrContains |
| MACAddress | Network | MAC addresses | manufacturerEq |
| CIDR | Network | IP ranges | containsAddress, overlaps |
| Port | Network | Port numbers | serviceEq, isReservedEq |
| AirportCode | Transportation | Airport codes | countryEq, typeEq |
| PortCode | Transportation | Port codes | countryEq |
| FlightNumber | Transportation | Flight numbers | carrierEq, routeEq |
| Markdown | Content | Markdown text | headingCountEq, linkCountEq |
| HTML | Content | HTML markup | tagEq, validEq |
| MimeType | Content | Content types | typeEq, subtypeEq |
| Color | Content | Hex colors | formatEq, brightnessEq |
| Image | Content | Image files | formatEq, sizeEq |
| File | Content | Attachments | mimetypeEq, sizeRange |
| DateRange | Ranges | Date intervals | durationGte, overlaps |
| Duration | Ranges | ISO8601 durations | unitEq, amountRange |
| Percentage | Ranges | 0-100 values | rangeEq |
Email addresses with domain-specific operators.
GraphQL Type:
type User { email: EmailAddress!}
input EmailAddressFilter { eq: String neq: String contains: String domainEq: String domainIn: [String!] domainEndswith: String}Python Decorator:
import fraiseql
@fraiseql.typeclass User: email: fraiseql.EmailAddressOperators:
eq — Exact email matchneq — Not equalcontains — Partial match (substring)domainEq — Extract and match domain (e.g., “example.com”)domainIn — Domain matches one of listdomainEndswith — Domain ends with (e.g., “*.company.com”)Validation:
Example Query:
query { users(where: { email: { domainEq: "company.com" } }) { id email name }}Database Support: ✅ PostgreSQL · ✅ MySQL · ✅ SQLite · ✅ SQL Server
International phone numbers with country code extraction.
Operators:
eq — Exact number matchcountryCodeEq — Country code match (e.g., “+1” for US)typeEq — Type match (mobile, fixed, voip, etc.)Validation:
Example Query:
query { contacts(where: { phone: { countryCodeEq: "+1" } }) { id phone }}Web URLs with protocol and domain matching.
Operators:
eq — Exact URL matchprotocolEq — Protocol match (http, https, ftp)domainEq — Domain extraction and matchpathContains — URL path substringValidation:
Example Query:
query { websites(where: { homepage: { protocolEq: "https" } }) { id homepage }}Domain names (DNS).
Operators:
eq — Exact matchsuffixEq — TLD match (e.g., “.com”)level — Domain level depth (example.co.uk = level 3)Validation:
Server/network hostnames.
Operators:
eq — Exact hostname matchsuffixEq — Suffix match (e.g., “.local”)Validation:
International Bank Account Numbers.
Operators:
eq — Exact IBAN matchcountryEq — Country code extractionchecksumValid — IBAN MOD-97 validationValidation:
Example Query:
query { accounts(where: { iban: { countryEq: "DE" } }) { id iban currency }}Committee on Uniform Securities Identification Procedures (US securities).
Operators:
eq — Exact CUSIPissuerEq — Issuer code extractiontypeEq — Security typeValidation:
International Securities Identification Number.
Operators:
eq — Exact ISINcountryEq — Country code extractiontypeEq — Security typeValidation:
Stock Exchange Daily Official List (UK/Irish securities).
Operators:
eq — Exact SEDOLissuerEq — Issuer sectorValidation:
Legal Entity Identifier.
Operators:
eq — Exact LEIcountryEq — Jurisdiction extractionValidation:
Market Identifier Code (ISO 10383).
Operators:
eq — Exact MICtypeEq — Market type (XETR, XETRA, etc.)Validation:
ISO 4217 currency codes.
Operators:
eq — Exact code match (e.g., “USD”)symbolEq — Currency symbol ($, €, etc.)decimalPlacesEq — Decimal places (usually 2)Validation:
Example Query:
query { transactions(where: { currency: { symbolEq: "$" } }) { id amount currency }}Monetary amounts with currency.
Operators:
eq — Exact amountcurrencyEq — Currency matchamountGte / amountLte — Range queriesValidation:
Stock exchange codes.
Operators:
eq — Exact exchange codetypeEq — Exchange typeValidation:
Foreign exchange rates.
Operators:
eq — Exact ratebaseCurrencyEq — Base currency codequoteCurrencyEq — Quote currency codeValidation:
Stock ticker symbols.
Operators:
eq — Exact tickerexchangeEq — Exchange code matchValidation:
Postal codes, ZIP codes, etc.
Operators:
eq — Exact codecountryEq — Country codeformatEq — Format type (US=5 digits, UK=varied, etc.)Validation:
Example Query:
query { addresses(where: { zipCode: { countryEq: "US" } }) { id street zipCode }}Geographic latitude (-90 to +90).
Operators:
eq — Exact latituderangeEq — In latitude rangehemisphereEq — North/South hemisphereValidation:
Geographic longitude (-180 to +180).
Operators:
eq — Exact longituderangeEq — In longitude rangeValidation:
Latitude/longitude pairs for geospatial queries.
Operators:
eq — Exact locationdistanceWithin — Distance from point in kilometerswithinBoundingBox — Rectangular regionwithinPolygon — Custom polygon (PostgreSQL only)Validation:
Example Query:
query { restaurants(where: { location: { distanceWithin: { latitude: 40.7128 longitude: -74.0060 radiusKm: 5 } } }) { id name location { latitude longitude } }}Database Support:
ST_DWithinST_DistanceIANA timezone identifiers.
Operators:
eq — Exact timezoneoffsetEq — UTC offset (e.g., “UTC-5”)dstAwareEq — Has daylight saving timeValidation:
Example Query:
query { users(where: { timezone: { offsetEq: "UTC-5" } }) { id name timezone }}BCP 47 language locale codes (e.g., “en-US”, “fr-CA”).
Operators:
eq — Exact localelanguageEq — Language code (en, fr, de)regionEq — Region code (US, CA, DE)Validation:
ISO 639 language codes (en, fr, de, etc.).
Operators:
eq — Exact codescriptEq — Script type (Latin, Cyrillic, etc.)Validation:
ISO 3166-1 alpha-2 country codes (US, UK, FR, etc.).
Operators:
eq — Exact codecontinentEq — Continental locationinEUEq — EU membershipinUNEq — UN membershipValidation:
Example Query:
query { users(where: { country: { continentEq: "EU" } }) { id name country }}URL-friendly slugs (lowercase, hyphens, no spaces).
Operators:
eq — Exact slugcontains — Partial matchValidation:
[a-z0-9-]+Example Query:
query { articles(where: { slug: { eq: "getting-started" } }) { id title slug }}Semantic versioning (v1.2.3, 1.2.3-alpha, etc.).
Operators:
eq — Exact versionmajorEq — Major version match (1.x.x)minorEq — Minor version match (1.2.x)isPrerelease — Pre-release versionsValidation:
SHA-256 hashes (64 hex characters).
Operators:
eq — Exact hashformatEq — Format (hex, base64)Validation:
API authentication keys.
Operators:
eq — Exact keyprefixEq — Key prefix matchlengthEq — Length validationValidation:
Vehicle license plates.
Operators:
eq — Exact platecountryEq — Country/regiontypeEq — Plate type (standard, vanity, etc.)Validation:
Vehicle Identification Numbers.
Operators:
eq — Exact VINwmiEq — World Manufacturer ID (first 3 characters)yearEq — Manufacturing year extractionValidation:
Example Query:
query { vehicles(where: { vin: { wmiEq: "1G1" } }) { id brand vin }}Shipment tracking numbers.
Operators:
eq — Exact numbercarrierEq — Carrier (UPS, FedEx, DHL, etc.)typeEq — Type (standard, express, etc.)Validation:
ISO 6346 shipping container numbers.
Operators:
eq — Exact container IDownersCodeEq — Owner company codechecksumValid — Check digit validationValidation:
IPv4 or IPv6 addresses.
Operators:
eq — Exact IPversionEq — IP version (4 or 6)cidrContains — In CIDR rangeValidation:
Example Query:
query { devices(where: { ipAddress: { versionEq: 4 } }) { id hostname ipAddress }}IPv4 addresses only.
Operators:
eq — Exact IPclassEq — IP class (A, B, C, D, E)isPrivateEq — Private IP rangecidrContains — In CIDR rangeValidation:
IPv6 addresses only.
Operators:
eq — Exact IPscopeEq — Scope (link-local, global, etc.)Validation:
Media Access Control addresses.
Operators:
eq — Exact MACmanufacturerEq — OUI manufacturer codeValidation:
Classless Inter-Domain Routing blocks.
Operators:
eq — Exact CIDRcontainsAddress — IP in rangeoverlaps — CIDR overlapValidation:
Example Query:
query { networks(where: { subnet: { containsAddress: "192.168.1.100" } }) { id subnet }}Network port numbers (0-65535).
Operators:
eq — Exact portserviceEq — Service name (HTTP, SSH, etc.)isReservedEq — Well-known port (0-1023)Validation:
IATA airport codes.
Operators:
eq — Exact codecountryEq — Country codetypeEq — Airport typeValidation:
ISO 4217 port codes.
Operators:
eq — Exact codecountryEq — Country coderegionEq — Region/stateValidation:
Airline flight numbers.
Operators:
eq — Exact numbercarrierEq — Airline coderouteEq — Route (origin-destination)Validation:
Markdown-formatted text content.
Operators:
eq — Exact contentcontains — Substring matchheadingCountEq — Number of headingslinkCountEq — Number of linksValidation:
HTML markup content.
Operators:
eq — Exact contentcontains — Substring matchtagEq — Contains specific tagvalidEq — Well-formed HTMLValidation:
MIME types (e.g., “application/json”).
Operators:
eq — Exact typetypeEq — Main type (application, text, image)subtypeEq — Subtype (json, html, png)Validation:
Example Query:
query { files(where: { mimeType: { typeEq: "image" } }) { id filename mimeType }}Hex color codes (#RRGGBB or #RGB).
Operators:
eq — Exact colorformatEq — Format (hex, rgb, hsl)brightnessEq — Brightness levelValidation:
Image file content with metadata.
Operators:
eq — Exact imageformatEq — Image format (JPEG, PNG, WebP)sizeEq — Dimensions (width×height)sizeRange — File size in bytesValidation:
File attachments and binary content.
Operators:
eq — Exact filemimetypeEq — MIME type matchsizeRange — File size limitsValidation:
Date intervals with start and end dates.
Operators:
eq — Exact rangedurationGte — Minimum duration in daysdurationLte — Maximum duration in daysstartsAfter — Range starts after dateendsBefore — Range ends before dateoverlaps — Overlaps with date rangeValidation:
Example Query:
query { projects(where: { timeline: { durationGte: 90 overlaps: { start: "2024-06-01T00:00:00Z" end: "2024-08-31T23:59:59Z" } } }) { id name }}ISO 8601 durations (e.g., “P1Y2M3DT4H5M6S”).
Operators:
eq — Exact durationunitEq — Unit (days, hours, minutes)amountRange — Duration amount rangeValidation:
Percentage values (0-100).
Operators:
eq — Exact percentagerangeEq — In rangegte / lte — Greater/less thanValidation:
Example Query:
query { products(where: { discount: { gte: 10, lte: 50 } }) { id name price discount }}All semantic scalar types work seamlessly with FraiseQL’s Rich Filters feature:
query { # Query using rich filter operators users(where: { email: { domainEq: "example.com" } location: { distanceWithin: { latitude: 40.7, longitude: -74.0, radiusKm: 5 } } country: { inEUEq: true } }) { id email location { latitude longitude } country }}Validation rules for semantic scalars are configured in TOML:
[fraiseql.validation]# Email domain must be validemail_domain_eq = { pattern = "^[a-z0-9]([a-z0-9-]*\\.)*[a-z0-9]([a-z0-9-]*[a-z0-9])?$" }
# Distance must be positivedistance_within_radius_km = { numeric_range = { min: 0, max: 40075 } }
# Country code must be valid ISO 3166-1country_eq = { enum = ["US", "CA", "UK", "FR", "DE", ...] }See TOML Configuration - Validation for complete validation documentation.
Rich Filters
Rich Filters — Learn how to use semantic scalars for filtering
TOML Configuration
TOML Configuration — Configure validation rules
Query Operators
Query Operators — Standard operators for all scalars