Skip to main content

Auto Indexing and Context Injection

· One min read
TeaQL Code Gen
Core Contributor

Auto-indexing, context injection, and query optimization improvements.

Auto Index Creation

+ Auto-create indexes for commonly filtered fields
+ Configurable index strategies per entity

ensureTables now generates CREATE INDEX statements automatically.

UserContext Re-Injection

// Reinject a new resolver at runtime
ctx.reinjectResolver(newTenantResolver);

Useful for multi-tenancy, data source switching, and testing.

Checker Type Validation

The validation framework now validates field type matching, catching type mismatch errors at the application layer.

Sub-Query Mixing

SQLRepository supports canMixinSubQuery, allowing sub-queries to be mixed into the main query as JOINs:

+ Sub-queries mixed into main query as JOINs
+ Reduced database round-trips

Minimal Field Merge

When generating update requests, only the minimal set of changed fields is merged, producing more efficient SQL.