Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions src/appengine_magic/services/datastore.clj
Original file line number Diff line number Diff line change
Expand Up @@ -505,23 +505,22 @@
(.prepare (get-datastore-service) query-object))
result-type (if (and (instance? Class kind) (extends? EntityProtocol kind))
kind
entity-record-type)
result-count (.countEntities prepared-query fetch-options-object)]
(cond count-only? result-count
(zero? result-count) (list)
:else (let [results (seq (.asIterable prepared-query fetch-options-object))
model-record (if result-type
;; we know this type; good
(record result-type)
;; unknown type; just use a basic EntityProtocol
(EntityBase.))]
(map #(with-meta
(run-after-load
(merge model-record
(entity->properties (.getProperties %)
(get-clj-properties model-record))))
{:key (.getKey %)})
results)))))
entity-record-type)]
(if count-only?
(.countEntities prepared-query fetch-options-object)
(let [results (seq (.asIterable prepared-query fetch-options-object))
model-record (if result-type
;; we know this type; good
(record result-type)
;; unknown type; just use a basic EntityProtocol
(EntityBase.))]
(map #(with-meta
(run-after-load
(merge model-record
(entity->properties (.getProperties %)
(get-clj-properties model-record))))
{:key (.getKey %)})
results)))))


(defmacro query
Expand Down