CQL Overview

CQL (Crystal Query Language) is a type-safe ORM for Crystal applications that provides compile-time query validation and high-performance database operations.

Why CQL with Azu?

  • Type Safety: Queries are validated at compile time, catching errors before runtime

  • Performance: Zero-allocation queries with Crystal's compile-time optimizations

  • Integration: Works seamlessly with Azu's request/response contracts

  • Monitoring: Built-in N+1 detection integrated with Azu's development dashboard

Installation

Add CQL and a database driver to your shard.yml:

dependencies:
  azu:
    github: azutoolkit/azu
    version: ~> 0.5.28
  cql:
    github: azutoolkit/cql
    version: ~> 0.1.0

Add your database driver:

Run shards install to fetch dependencies.

Quick Start

1. Define Schema

2. Define Models

3. Use in Endpoints

Supported Databases

Database
Adapter
Features

PostgreSQL

CQL::Adapter::Postgres

Full support, JSONB, arrays

MySQL

CQL::Adapter::MySQL

Full support

SQLite

CQL::Adapter::SQLite

Development and testing

Next Steps

Last updated

Was this helpful?