tracking: rename time-stamp to timestamp

This commit is contained in:
Helmut Merz 2024-08-02 08:44:03 +02:00
parent dafce6f2d2
commit 5930e8a594

View file

@ -9,7 +9,7 @@
(:util :scopes/util)
(:alx :alexandria)
(:jzon :com.inuoe.jzon))
(:export #:track #:trackid #:time-stamp
(:export #:track #:trackid #:timestamp
#:container #:table-name #:storage #:make-item
#:get-track #:query-last #:query-one #:query
#:save #:insert #:update
@ -21,7 +21,7 @@
(defclass track (shape:record)
((trackid :accessor trackid :initform nil)
(time-stamp :accessor time-stamp :initform nil)
(timestamp :accessor timestamp :initform nil)
(container :reader container :initarg :container)))
(defun timestamp-to-sql (tr ts)
@ -112,8 +112,6 @@
(destructuring-bind (f v &optional op) spec
(unless v
(setf v ""))
(when (eql f :time-stamp)
(setf f :timestamp))
(unless op
(setf op (if (eql f :timestamp) :>= :=)))
(when (symbolp v)
@ -130,20 +128,20 @@
(shape:head-fields tr))))
(setf (shape:head tr) hv)
(setf (trackid tr) (getf row :trackid))
(setf (time-stamp tr) (getf row :timestamp))
(setf (timestamp tr) (getf row :timestamp))
(setf (shape:data tr)
(funcall *build-track-data*
(jzon:parse (getf row :data) :key-fn #'util:to-keyword)))
tr)))
(defun ensure-timestamp (track)
(if (not (time-stamp track))
(setf (time-stamp track) (get-universal-time))))
(if (not (timestamp track))
(setf (timestamp track) (get-universal-time))))
(defun plist (track &optional data)
(let ((vl (shape:head-plist track))
(data (or data (shape:data track))))
(with-slots ((trid trackid) (ts time-stamp)) track
(with-slots ((trid trackid) (ts timestamp)) track
(when trid (setf (getf vl :trackid) trid))
(when ts (setf (getf vl :timestamp) (timestamp-to-sql track ts)))
(when data