Multi-Stack Code Generation
· One min read
TeaQL Code Gen learned Rust. One model definition now produces both Java and Rust artifacts.
Separate Stack Templates
templates/
java/
entity.java.vm
repository.java.vm
rust/
entity.rs.vm
query.rs.vm
Each stack has isolated templates. No cross-language leakage.
Rust Lib Generators
// Generated from the same .teaql model
pub struct User {
pub id: u64,
pub name: String,
}
impl TeaQLEntity for User {
const TABLE: &str = "user_t";
}
Typed Query Return Types
let names: Vec<String> = db.query(User::name())
.filter(User::active().eq(true))
.list()
.await?;
The generator produces typed projections. User::name() returns String, User::class() returns User.
Explicit Aggregation APIs
let stats = db.query(Order::class())
.group_by(Order::status())
.agg(Order::total().sum())
.agg(Order::id().count())
.list()
.await?;
Group-by and rollup DSLs are fully typed. The macro validates aggregation compatibility at compile time.
Relation Generation
let user = db.load(User::class(), id)
.with(User::orders())
.await?;
User::orders() is generated from the model's relation definition. No hand-written joins.
