Created
January 14, 2019 12:06
-
-
Save jmercouris/fea3a94aacae922a7977f9660eff204b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-products () | |
(with-connection (db) | |
(let ((products (retrieve-all | |
(select (:id :name :short-description :price) | |
(from :product))))) | |
(loop for product in products | |
do (let* ((product-id (getf product :id)) | |
(product-features (retrieve-all | |
(select (:feature :description) | |
(from :product-features) | |
(where (:= :product-id product-id)))))) | |
(push product-features product) | |
(push :features product))) | |
products))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment