TeaQL is Born: Type-Safe Query Expressions
· One min read
This is where TeaQL began. In November 2022, the core runtime shipped with 95 files and 4,636 lines of code.
Core Capabilities
SQL Expression Parser
SQLExpressionParser, PropertyParser, and RawSqlParser form the foundation of type-safe query expressions:
Q.orders().filter(
Q.orders().comment("Query orders").purpose("Load data").customer().city().eq("Shanghai")
).comment("Query orders").purpose("Load data").executeForList(ctx);
Sub-Query Support
SubQueryParser (62 lines) enables nested queries expressed naturally in Java:
Q.orders().filter(
Q.orders().comment("Query orders").purpose("Load data").customer().city().eq("Shanghai")
).comment("Query orders").purpose("Load data").executeForList(ctx);
Dynamic Aggregation Framework
SimpleAggregation supports count, sum, avg, and more directly from the domain model.
Architecture at a Glance
- Expression-based queries: Type-safe Java expressions compiled to SQL
- Repository pattern:
SQLRepositoryas the base with database-specific extensions - Sub-query composition: Nest queries naturally in Java
- Aggregation framework: First-class aggregate function support
These patterns remain the foundation of TeaQL today.
