Handle default type for indexes and partitions
parent
98793adf63
commit
aca91a5961
|
@ -85,7 +85,8 @@
|
|||
(defun db/index/get-directory-path (database object-attribute)
|
||||
(let ((name (typecase object-attribute
|
||||
(string object-attribute)
|
||||
(symbol (symbol-name object-attribute))))
|
||||
(symbol (symbol-name object-attribute))
|
||||
(t (format nil "~A" object-attribute))))
|
||||
(dbpath (db-path database)))
|
||||
(concatenate 'string dbpath "/indexes/by_" name "/")))
|
||||
|
||||
|
@ -93,7 +94,8 @@
|
|||
(defun db/partition/get-directory-path (database name object-attribute)
|
||||
(let ((value (typecase object-attribute
|
||||
(string object-attribute)
|
||||
(symbol (symbol-name object-attribute))))
|
||||
(symbol (symbol-name object-attribute))
|
||||
(t (format nil "~A" object-attribute))))
|
||||
(dbpath (db-path database)))
|
||||
(concatenate 'string dbpath "/partitions/by_" name "/" value "/")))
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(load "./dodb.cl")
|
||||
(in-package :dodb)
|
||||
|
||||
;
|
||||
; TEST SCENARIO
|
||||
;
|
||||
|
||||
(defstruct vehicle name color)
|
||||
(defstruct vehicle name color (nb_of_lights 4))
|
||||
|
||||
;(defparameter cars (db/new "vehicle" "./storage/cars/"))
|
||||
; to launch the tests in RAM
|
||||
|
@ -14,10 +14,11 @@
|
|||
(db/add cars (make-vehicle :name "Ferrari" :color "Red"))
|
||||
(db/add cars (make-vehicle :name "Deudeuch" :color "Beige"))
|
||||
(db/add cars (make-vehicle :name "BMW" :color "Blue"))
|
||||
(db/add cars (make-vehicle :name "Suzuki Wagon" :color "Blue"))
|
||||
(db/add cars (make-vehicle :name "Suzuki Wagon" :color "Blue" :nb_of_lights 6))
|
||||
|
||||
(db/new-index cars "name")
|
||||
(db/new-partition cars "color")
|
||||
(db/new-partition cars "nb_of_lights")
|
||||
|
||||
|
||||
(format t "~&~S~&" cars)
|
||||
|
|
Loading…
Reference in New Issue