;; elephant-query-view.lisp --- ;; Copyright (C) 2008 Clinton Ebadi ;; Author: Clinton Ebadi ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Lesser General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU Lesser General Public License ;; along with this program. If not, see . (in-package :org.unknownlamer.golgonooza.elephant) (ucw-core:defcomponent elephant-query-view-mixin () ((index-class :initarg :index-class :accessor index-class) (index-slot :initarg :index-slot :accessor index-slot))) (defmethod query-view-get-instances ((query-view elephant-query-view-mixin) lower upper &key limit skip from-end exclusive) (with-slots (index-class index-slot) query-view (get-instances-limit (index-class query-view) (index-slot query-view) (if (typep lower index-class) (slot-value lower index-slot) lower) (if (typep upper index-class) (slot-value upper index-slot) upper) :limit limit :skip skip :from-end from-end :exclusive exclusive))) (defmethod query-view-count-instances ((view elephant-query-view-mixin) min max) (count-instances-by (index-class view) (index-slot view) min max))