v0.13.0 — Type-Safe Scalar Subqueries and Column Comparison
New Features
SelectSub — Type-Safe Scalar Subqueries in SELECT
No more raw SQL for correlated subqueries. Use the builder API:
// Before: raw SQL (not type-safe)
db.Select("id", "name").
SelectExpr("(SELECT COUNT(*) FROM orders WHERE orders.user_id = users.id) AS order_count").
From("users")
// After: type-safe builder API
sub := db.Select("COUNT(*)").From("orders").
Where(relica.EqCol("orders.user_id", "users.id"))
db.Select("id", "name").
SelectSub(sub.AsExpression(), "order_count").
From("users")EqCol — Column-to-Column Comparison
Proper identifier quoting for both sides:
relica.EqCol("o.user_id", "u.id")
// PostgreSQL: "o"."user_id" = "u"."id"
// MySQL: `o`.`user_id` = `u`.`id`Also: NotEqCol, GreaterThanCol, LessThanCol.
Testing
21 new test functions (488 lines) covering all dialects, correlated subqueries, parameter ordering, and the full pattern from issue #31.
Full Changelog: v0.12.1...v0.13.0