sql

🏗 Build sql queries programmatically.

🏗 sql

Build sql queries programmatically.

stability

Usage

Crystal code

require "sql"

users = SQL::Table.new("users")
articles = SQL::Table.new("articles")

query = users
  .where(users["name"].qualify.eq("Tom"))
  .join(articles, users["id"].qualify.eq(articles["user_id"].qualify))

query.to_sql

Generated SQL

SELECT * FROM `users` INNER JOIN `articles` ON `users`.`id` = `articles`.`user_id` WHERE `users`.`name` = 'Tom'

Installation

Add this to your application's shard.yml:

dependencies:
  sql:
    github: f-mer/sql
Repository

sql

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • almost 7 years ago
  • December 27, 2017
License

MIT License

Links
Synced at

Mon, 18 Nov 2024 02:04:25 GMT

Languages