Ok, here it is:

https://github.com/ChicagoBoss/boss_db/pull/153

On Thu, Jan 23, 2014 at 12:47 AM, Tim McNamara <[email protected]> wrote:
> +1
>
> Easy pagination in core seems very useful.
>
>
> On 23 January 2014 11:00, kotedo <[email protected]> wrote:
>>
>> +1
>>
>> On Jan 22, 2014, at 10:17, David Welton <[email protected]> wrote:
>>
>> > Would it be worth including something like this directly in boss_db ?
>> >
>> > paginate(Model, Conditions, Args) ->
>> >    Page = proplists:get_value(page, Args, 1),
>> >    PageSize = proplists:get_value(page_size, Args, ?DEFAULT_PAGE_SIZE),
>> >    ArgList = proplists:delete(page_size, proplists:delete(page, Args))
>> > ++
>> >        [{offset, PageSize * (Page - 1)}, {limit, PageSize}],
>> >    Total = boss_db:count(Model, Conditions),
>> >    TotalPages = (Total div PageSize) + (case Total rem PageSize of
>> >                                             0 -> 0;
>> >                                             _ -> 1
>> >                                         end),
>> >    {Page, TotalPages, boss_db:find(Model, Conditions, ArgList)}.
>> >
>> > --
>> > David N. Welton
>> >
>> > http://www.welton.it/davidw/
>> >
>> > http://www.dedasys.com/
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "ChicagoBoss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to [email protected].
>> > Visit this group at http://groups.google.com/group/chicagoboss.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/chicagoboss/CA%2Bb9R_vQ9me_eTTwad7-fNqhyoqHD5N0xd8dLqAq8CUtwHECKg%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ChicagoBoss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> Visit this group at http://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/chicagoboss/80ED8459-BE68-49A9-8EA1-02D43E7D6731%40gmail.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/CAMUs9-N7%3DZS%3DChSKJ8sV5RfHB%2BkjSs6%2Be7W4_pW%3DZk4KCHjBxQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CA%2Bb9R_s5hcLdFDTuN6XH1zY23-kvitPFEaWLDToowQW%3Dp_WV%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to