From d9f5ae59518847515787734e800d24c00a6e7b51 Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Tue, 15 Nov 2011 03:48:31 +0400 Subject: [PATCH] Move pagination helper to monger.internal.pagination --- src/monger/{ => internal}/pagination.clj | 2 +- src/monger/query.clj | 5 +++-- test/monger/test/{ => internal}/pagination.clj | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) rename src/monger/{ => internal}/pagination.clj (73%) rename test/monger/test/{ => internal}/pagination.clj (80%) diff --git a/src/monger/pagination.clj b/src/monger/internal/pagination.clj similarity index 73% rename from src/monger/pagination.clj rename to src/monger/internal/pagination.clj index a792373..ffc1493 100644 --- a/src/monger/pagination.clj +++ b/src/monger/internal/pagination.clj @@ -1,4 +1,4 @@ -(ns monger.pagination) +(ns monger.internal.pagination) (defn offset-for [^long page ^long per-page] diff --git a/src/monger/query.clj b/src/monger/query.clj index 5812722..005b911 100644 --- a/src/monger/query.clj +++ b/src/monger/query.clj @@ -1,6 +1,7 @@ (ns monger.query (:refer-clojure :exclude [select find sort]) - (:require monger.core) + (:require [monger.core] + [monger.internal pagination]) (:import [com.mongodb DB DBCollection DBObject DBCursor] [java.util List]) (:use [monger conversion operators])) @@ -82,7 +83,7 @@ (defn paginate [m & { :keys [page per-page] :or { page 1 per-page 10 } }] - (merge m { :limit per-page :skip (monger.pagination/offset-for page per-page) })) + (merge m { :limit per-page :skip (monger.internal.pagination/offset-for page per-page) })) (defmacro with-collection [^String coll & body] diff --git a/test/monger/test/pagination.clj b/test/monger/test/internal/pagination.clj similarity index 80% rename from test/monger/test/pagination.clj rename to test/monger/test/internal/pagination.clj index b8ba8ae..d687516 100644 --- a/test/monger/test/pagination.clj +++ b/test/monger/test/internal/pagination.clj @@ -1,6 +1,6 @@ -(ns monger.test.pagination +(ns monger.test.internal.pagination (:use [clojure.test] - [monger.pagination])) + [monger.internal.pagination])) (deftest test-pagination-offset (are [a b] (= a b)