A website for producing interactive charts without writing a single line of code. Built with Common Lisp and Python.
https://charts.craigoates.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
774 B
26 lines
774 B
;; (in-package :cl-user) |
|
(defpackage hot-line.db |
|
(:use :cl) |
|
(:import-from :hot-line.config |
|
:config) |
|
(:import-from :datafly |
|
:*connection*) |
|
(:import-from :cl-dbi |
|
:connect-cached) |
|
(:export :connection-settings |
|
:db |
|
:with-connection)) |
|
(in-package :hot-line.db) |
|
|
|
(defun connection-settings (&optional (db :maindb)) |
|
(cdr (assoc db (config :databases)))) |
|
|
|
(defun db (&optional (db :maindb)) |
|
(apply #'connect-cached (connection-settings db))) |
|
|
|
(defmacro with-connection (conn &body body) |
|
;; Added 'mito.connection:' to 'let' binding. To return to default, |
|
;; just remove it so it just says '*connection*'. mito replaces |
|
;; datafly. |
|
`(let ((mito.connection:*connection* ,conn)) |
|
,@body))
|
|
|