summaryrefslogtreecommitdiff
path: root/db/conn.rkt
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-11-17 17:47:17 +0100
committerMarius Peter <dev@marius-peter.com>2025-11-17 17:47:17 +0100
commitc0f93e8d41188fc4138a350430ee349b61ea0535 (patch)
tree5d88fd1195d65521c5e1a787cd773047605b7e72 /db/conn.rkt
parent02ef60dd46676b5069aeae666b544b62f270ffd1 (diff)
raco fmt.
Diffstat (limited to 'db/conn.rkt')
-rw-r--r--db/conn.rkt17
1 files changed, 9 insertions, 8 deletions
diff --git a/db/conn.rkt b/db/conn.rkt
index e083d94..793cf03 100644
--- a/db/conn.rkt
+++ b/db/conn.rkt
@@ -12,11 +12,9 @@
(define (connect! #:path [path 'memory])
(cond
- [(connection? (current-conn))
- (printf "Database connection already exists: ~e\n" (current-conn))]
+ [(connection? (current-conn)) (printf "Database connection already exists: ~e\n" (current-conn))]
[else
- (current-conn (sqlite3-connect #:database path
- #:mode 'create))
+ (current-conn (sqlite3-connect #:database path #:mode 'create))
(printf "Created database connection at path: ~a\n" path)]))
(define (disconnect!)
@@ -25,10 +23,14 @@
(current-conn #f))
(define-syntax-rule (with-db body ...)
- (begin (connect!) body ...))
+ (begin
+ (connect!)
+ body ...))
(define-syntax-rule (with-tx body ...)
- (call-with-transaction (current-conn) (λ () body ...)))
+ (call-with-transaction (current-conn)
+ (λ ()
+ body ...)))
(module+ test
(require rackunit)
@@ -37,5 +39,4 @@
(check-true (connection? (current-conn)))
(disconnect!)
(check-equal? (current-conn) #f)
- (with-db
- (check-true (connection? (current-conn)))))
+ (with-db (check-true (connection? (current-conn)))))
Copyright 2019--2026 Marius PETER