write track data to database, JSON-encoded
This commit is contained in:
parent
56467cd4c1
commit
c188ed2baf
3 changed files with 7 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
||||||
:version "0.0.1"
|
:version "0.0.1"
|
||||||
:homepage "https://www.cyberconcepts.org"
|
:homepage "https://www.cyberconcepts.org"
|
||||||
:description ""
|
:description ""
|
||||||
:depends-on (:dbi :local-time :str :sxql)
|
:depends-on (:com.inuoe.jzon :dbi :local-time :str :sxql)
|
||||||
:components ((:file "forge/forge")
|
:components ((:file "forge/forge")
|
||||||
(:file "storage/storage")
|
(:file "storage/storage")
|
||||||
(:file "storage/tracking" :depends-on ("storage/storage"))
|
(:file "storage/tracking" :depends-on ("storage/storage"))
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
(defpackage :scopes/storage/tracking
|
(defpackage :scopes/storage/tracking
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:storage :scopes/storage))
|
(:local-nicknames (:jzon :com.inuoe.jzon)
|
||||||
|
(:storage :scopes/storage))
|
||||||
(:export #:track #:trackid #:head #:head-proplist #:time-stamp #:data
|
(:export #:track #:trackid #:head #:head-proplist #:time-stamp #:data
|
||||||
#:container
|
#:container
|
||||||
#:make-item
|
#:make-item
|
||||||
|
@ -51,7 +52,7 @@
|
||||||
(if trid (setf (getf vl :trackid) trid))
|
(if trid (setf (getf vl :trackid) trid))
|
||||||
(if ts (setf (getf vl :timestamp)
|
(if ts (setf (getf vl :timestamp)
|
||||||
(storage:timestamp-to-sql (engine track) ts)))
|
(storage:timestamp-to-sql (engine track) ts)))
|
||||||
(if data (setf (getf vl :data) data)))
|
(if data (setf (getf vl :data) (jzon:stringify data))))
|
||||||
vl))
|
vl))
|
||||||
|
|
||||||
(defun insert (track)
|
(defun insert (track)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
(t:show-result)))
|
(t:show-result)))
|
||||||
|
|
||||||
(defun test-track (st)
|
(defun test-track (st)
|
||||||
(let (cont tr)
|
(let (cont tr (data (make-hash-table :test 'equalp)))
|
||||||
(setf cont (make-instance 'tracking:container :storage st))
|
(setf cont (make-instance 'tracking:container :storage st))
|
||||||
(storage:drop-table st :tracks)
|
(storage:drop-table st :tracks)
|
||||||
(tracking:create-table cont)
|
(tracking:create-table cont)
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
(== (tracking:head tr) '("t01" "john"))
|
(== (tracking:head tr) '("t01" "john"))
|
||||||
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
||||||
(== (tracking:data tr) nil)
|
(== (tracking:data tr) nil)
|
||||||
|
(setf (gethash :desc data) "scopes/storage: queries")
|
||||||
|
(setf (tracking:data tr) data)
|
||||||
(tracking:insert tr)
|
(tracking:insert tr)
|
||||||
(== (tracking:trackid tr) 1)
|
(== (tracking:trackid tr) 1)
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue