module
CQL::ActiveRecord::Queryable
Overview
The Queryable module provides Active Record-style chainable query methods that integrate with the CQL::Query system. It implements the Active Record query interface while maintaining type safety and performance.
Features
- Type-safe query building with compile-time checks
- Chainable query methods that return QueryBuilder instances
- Integration with existing CQL::Query functionality
- Support for eager loading and relationship queries
- Query caching and optimization
- Lazy evaluation for better performance
Examples
# Basic queries
User.where(active: true).all
User.select(:name, :email).where(age: 18).all
User.order(:created_at).limit(10).all
# Joins through associations
User.query.joins(:posts) { posts.published == true }.all
# Aggregations
User.count
User.where(active: true).count
# Method chaining
User.where(active: true)
.order(:created_at)
.limit(20)
.offset(10)
.all
Defined in:
active_record/query_builder.cractive_record/queryable.cr