Native support for PostgreSQL's advanced types. IPv4/IPv6, LTree hierarchies, DateRange with type-aware operators.
FraiseQL natively supports PostgreSQL's advanced data types with GraphQL-friendly operators. Network types (IPv4/IPv6), hierarchical data (LTree), date ranges, and moreβall with type-safe operations no other GraphQL framework provides.
| Type | PostgreSQL Type | Example Operators | Use Case |
|---|---|---|---|
| Network (IPv4/IPv6) | inet, cidr | inSubnet, isPrivate, isLoopback | Infrastructure, IoT |
| Hierarchical Data | ltree | ancestor_of, descendant_of, matches | Organizations, Taxonomies |
| Date/Time Ranges | daterange, tstzrange | overlaps, contains, adjacent | Scheduling, Availability |
| JSON/JSONB | jsonb | contains, has_key, path_exists | Flexible schemas |
from fraiseql import fraiseql
from fraiseql.types.scalars import IPv4Address, IPv6Address
@fraiseql.type
class Server:
id: int
hostname: str
ipv4: IPv4Address
ipv6: IPv6Address
location: str
# Find all servers in a subnet
{
servers(where: {
ipv4: { inSubnet: "10.0.0.0/8" }
}) {
hostname
ipv4
location
}
}
# Find private IP addresses
{
servers(where: {
ipv4: { isPrivate: true }
}) {
hostname
ipv4
}
}
# Find loopback addresses
{
servers(where: {
ipv4: { isLoopback: true }
}) {
hostname
ipv4
}
}
-- FraiseQL generates type-aware PostgreSQL
SELECT * FROM servers
WHERE ipv4::inet << '10.0.0.0/8'::inet;
SELECT * FROM servers
WHERE inet_is_private(ipv4::inet);
SELECT * FROM servers
WHERE host(ipv4::inet) = '127.0.0.1';
-- Native PostgreSQL type casting and functions β
from fraiseql import fraiseql
from fraiseql.types.scalars import LTree
@fraiseql.type
class Location:
id: int
name: str
path: LTree # e.g., "usa.california.san_francisco"
@fraiseql.type
class Machine:
id: str
name: str
location: Location
# Find all machines in California (any city)
{
machines(where: {
location: {
path: { ancestor_of: "usa.california.*" }
}
}) {
name
location { name path }
}
}
# Find all US locations
{
locations(where: {
path: { descendant_of: "usa" }
}) {
name
path
}
}
# Pattern matching
{
locations(where: {
path: { matches: "usa.*.san_*" }
}) {
name
path
}
}
-- FraiseQL generates ltree-aware queries
SELECT m.* FROM machines m
JOIN locations l ON m.location_id = l.id
WHERE l.path::ltree @> 'usa.california'::ltree;
SELECT * FROM locations
WHERE path::ltree <@ 'usa'::ltree;
SELECT * FROM locations
WHERE path::ltree ~ 'usa.*.san_*'::lquery;
-- Hierarchical queries with ltree operators β
DevOps, infrastructure, IoT. Filter by subnet, detect private IPs, manage network topologies.
Organizations, geographic locations, taxonomies. Ancestor/descendant queries with ltree.
Scheduling, availability, booking systems. Overlap detection, containment checks.
GraphQL validates types at query time. PostgreSQL enforces types at runtime.
PostgreSQL's specialized indexes (GiST, GIN) for ltree and network types.
Other frameworks use strings + custom logic. FraiseQL uses native PostgreSQL types.
# Network operators
ipv4: {
inSubnet: "10.0.0.0/8" # IP in subnet
isPrivate: true # RFC 1918 private address
isLoopback: true # 127.0.0.1
eq: "192.168.1.1" # Exact match
ne: "0.0.0.0" # Not equal
}
# Hierarchical operators
path: {
ancestor_of: "usa.california" # Parent of path
descendant_of: "usa" # Child of path
matches: "usa.*.san_*" # Pattern matching
eq: "usa.california.sf" # Exact match
}
# Range operators
availability: {
overlaps: ["2024-01-01", "2024-12-31"] # Overlaps range
contains: "2024-06-15" # Contains date
adjacent: ["2024-12-31", "2025-01-01"] # Adjacent to range
}
| Framework | Network Types | Hierarchical Data | Date Ranges |
|---|---|---|---|
| Hasura | β String fields | β Manual JSON logic | β Custom operators |
| PostGraphile | β οΈ Limited support | β οΈ Plugin required | β οΈ Basic only |
| Strawberry/Graphene | β No native support | β Manual implementation | β Custom resolvers |
| FraiseQL | β Full support + operators | β Native ltree with queries | β Range types + operators |
No other GraphQL framework has this level of PostgreSQL type support. FraiseQL exposes PostgreSQL's power directly to GraphQL with type-safe operators.
Specialized types are available in FraiseQL v0.9.5+