use keywords for head field names; re-order variable definitions and other statements in test
This commit is contained in:
parent
ed457efd53
commit
6c36fdc72d
2 changed files with 9 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
||||||
(defpackage :scopes/storage/tracking
|
(defpackage :scopes/storage/tracking
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:storage :scopes/storage))
|
(:local-nicknames (:storage :scopes/storage))
|
||||||
(:export #:track #:head #:time-stamp #:data #:proplist
|
(:export #:track #:head #:head-proplist #:time-stamp #:data
|
||||||
#:container
|
#:container
|
||||||
#:make-item
|
#:make-item
|
||||||
#:insert
|
#:insert
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
(defclass container ()
|
(defclass container ()
|
||||||
((item-factory :initform #'(lambda (cont head)
|
((item-factory :initform #'(lambda (cont head)
|
||||||
(make-instance 'track :container cont :head head)))
|
(make-instance 'track :container cont :head head)))
|
||||||
(head-fields :reader head-fields :initform '(taskid username))
|
(head-fields :reader head-fields :initform '(:taskid :username))
|
||||||
(table-name :reader table-name :initform :tracks)
|
(table-name :reader table-name :initform :tracks)
|
||||||
(indexes :reader indexes :initform '((taskid username) (username)))
|
(indexes :reader indexes :initform '((taskid username) (username)))
|
||||||
(storage :reader storage :initarg :storage)))
|
(storage :reader storage :initarg :storage)))
|
||||||
|
|
|
@ -38,10 +38,13 @@
|
||||||
(t:show-result)))
|
(t:show-result)))
|
||||||
|
|
||||||
(defun test-track (st)
|
(defun test-track (st)
|
||||||
(let* ((cont (make-instance 'tracking:container :storage st))
|
(let (cont tr)
|
||||||
(tr (tracking:make-item cont "t01" "john")))
|
(setf cont (make-instance 'tracking:container :storage st))
|
||||||
(storage:drop-table st :testing.tracks)
|
(storage:drop-table st :testing.tracks)
|
||||||
(tracking:create-table cont)
|
(tracking:create-table cont)
|
||||||
(tracking:insert tr)
|
(setf tr (tracking:make-item cont "t01" "john"))
|
||||||
(== (tracking:head tr) '("t01" "john"))
|
(== (tracking:head tr) '("t01" "john"))
|
||||||
(== (tracking:data tr) nil)))
|
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
||||||
|
(== (tracking:data tr) nil)
|
||||||
|
(tracking:insert tr)
|
||||||
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue