Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
Laravel
Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Para processá-la de fato, é necessário chamar a função jdbc/with-db-connection da biblioteca clojure.java.jdbc, passando a query que deseja executar como parâmetro. Antes disso, claro, precisa configurar usuário, senha e endereço do banco, além do pool de conexões. Mas isso já foge do escopo deste artigo.
As duas bibliotecas que citei acima são suficientes para conectar e executar queries no banco mas, por questões de performance, é importante utilizar um pool de conexões. Para isso utilizei e recomendo a hikari-cp. Já utilizava ela quando programava em Java e sempre me atendeu muito bem.
Para isso, utilizei a biblioteca clojure.core.cache.
Mas para poder executá-lo é necessário configurar o plugin lein-ancient.