From 98793adf63d6e0d8bbec1ec4d63001182cb1c620 Mon Sep 17 00:00:00 2001 From: kimory Date: Mon, 17 Oct 2022 14:12:15 +0200 Subject: [PATCH] An object attribute can now be a symbol. --- src/dodb.cl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dodb.cl b/src/dodb.cl index a09f2f0..5b60b12 100644 --- a/src/dodb.cl +++ b/src/dodb.cl @@ -82,12 +82,20 @@ (concatenate 'string dbpath "/data/" (number->filename number))) ; Example: returns "./storage/cars/indexes/by_name/". -(defun db/index/get-directory-path (database name) - (concatenate 'string (db-path database) "/indexes/by_" name "/" )) +(defun db/index/get-directory-path (database object-attribute) + (let ((name (typecase object-attribute + (string object-attribute) + (symbol (symbol-name object-attribute)))) + (dbpath (db-path database))) + (concatenate 'string dbpath "/indexes/by_" name "/"))) ; Example: returns "./storage/cars/partitions/by_color/Red/". -(defun db/partition/get-directory-path (database name value) - (concatenate 'string (db-path database) "/partitions/by_" name "/" value "/")) +(defun db/partition/get-directory-path (database name object-attribute) + (let ((value (typecase object-attribute + (string object-attribute) + (symbol (symbol-name object-attribute)))) + (dbpath (db-path database))) + (concatenate 'string dbpath "/partitions/by_" name "/" value "/"))) ; Example: returns "Corvet". (defun db/index/get-filename (database index-name object)