Introduction
HugSQL is a Clojure library for embracing SQL.
- SQL is the right tool for the job when working with a relational database!
- HugSQL uses simple conventions in your SQL files to define database functions in your Clojure namespace, creating a clean separation of Clojure and SQL code.
- HugSQL supports runtime replacement of:
- SQL Values
where id = :id
- SQL Value Lists
where id in (:v*:ids)
- SQL Identifiers
from :i:table-name
- SQL Identifier Lists
select :i*:column-names
- SQL Tuples
where (a.id, b.id) = (:t:ids)
- SQL Tuple Lists
insert into emp (id, name) values (:t*:people)
- Raw SQL
- Custom Parameter Types (implement your own)
- SQL Values
- HugSQL features Clojure Expressions and Snippets providing the full expressiveness of Clojure and the composability of partial SQL statements when constructing complex SQL queries.
- HugSQL has protocol-based adapters supporting multiple database libraries and ships with adapters for
clojure.java.jdbc
(default),next.jdbc
, andclojure.jdbc
.