start work on database support
This commit is contained in:
parent
74ab417191
commit
cc8000a48b
39
src/server/picture_processor/db.cljs
Normal file
39
src/server/picture_processor/db.cljs
Normal file
@ -0,0 +1,39 @@
|
||||
(ns picture-processor.db)
|
||||
|
||||
(def sqlite3 (js/require "sqlite3"))
|
||||
(def database (aget sqlite3 "Database"))
|
||||
|
||||
(def -db (atom nil))
|
||||
|
||||
(defn connection
|
||||
"Get the current database connection"
|
||||
[]
|
||||
@-db)
|
||||
|
||||
(defn open
|
||||
"Open the database connection"
|
||||
[]
|
||||
(reset! -db (database. "db/dev.db")))
|
||||
|
||||
(defn close
|
||||
"Close the database connection"
|
||||
[]
|
||||
(.close @-db)
|
||||
(reset! -db nil))
|
||||
|
||||
(defn in-series
|
||||
"Run SQL commands in series"
|
||||
[code]
|
||||
(.serialize @-db (code @-db)))
|
||||
|
||||
(defn run
|
||||
"Run SQL command"
|
||||
[cmd & args]
|
||||
(let [statement (.prepare @-db cmd)]
|
||||
(apply (.run statement & )
|
||||
)
|
||||
)
|
||||
|
||||
(in-series (fn [db]
|
||||
(.log js/console (.run db))
|
||||
))
|
6
src/server/picture_processor/images/data.cljs
Normal file
6
src/server/picture_processor/images/data.cljs
Normal file
@ -0,0 +1,6 @@
|
||||
(ns picture-processor.images.data)
|
||||
|
||||
(defn create
|
||||
[data]
|
||||
"Store an image's info in the database"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
(ns picture-processor.images)
|
||||
(ns picture-processor.images.process)
|
||||
|
||||
(def fs (js/require "fs"))
|
||||
(def imagemagick (js/require "imagemagick-native"))
|
Loading…
Reference in New Issue
Block a user