CQL is a powerful library designed to simplify and enhance the management and execution of SQL queries in the Crystal programming language. It provides utilities for building, validating, and executing SQL statements, ensuring better performance and code maintainability.
Query Builder: Programmatically create complex SQL queries.
Insert, Update, Delete Operations: Perform CRUD operations with ease.
Repository Pattern: Manage your data more effectively using Cql::Repository(T)
.
Active Record Pattern: Work with your data models using Cql::Record(T)
.
Add this to your application's shard.yml
:
Then, run the following command to install the dependencies:
Define the schema for your database tables:
With the schema in place, you can start executing queries:
Insert new records into the database:
Update existing records:
Delete records from the database:
Utilize the repository pattern for organized data management:
Work with your data using the Active Record pattern: