Commit 1d8c818d authored by ryszard.szopa's avatar ryszard.szopa
Browse files


parent c01c9628
......@@ -85,6 +85,19 @@ with the database."
(assert (equal value-from-init value-from-db))))
(setf (slot-value dao (slot-definition-name slot)) value-from-db)))))
(defun select-dao-fun (type test)
"Functional interface for SELECT-DAO."
(with-class-connection ((find-class type))
(mapcar (lambda (x) (make-instance type :id (car x)))
(postmodern:query (:select 'id :from type :where (:raw (if (stringp test)
(sql-compile test))))))))
(defmacro select-dao (type &optional (test t))
"Select daos for the rows in its table for which the given test
`(select-dao-fun ,type ',test))
(defgeneric delete-dao (dao)
(:documentation "Delete the given dao from the database."))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment