granite-paginate

Version, currently 1.0.03 versions

github.com/Nicolab/granite-paginate

Crystal shard adding pagination support for Granite ORM.

3 stars
0 dependents
License: MIT

Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  granite-paginate:
    github: Nicolab/granite-paginate
    version: ~> 1.0.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 1.0.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

granite-paginate

CI Status GitHub release Docs

Crystal shard adding pagination support for Granite ORM.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      granite-paginate:
        github: nicolab/granite-paginate
  2. Run shards install

Usage

Add (require) granite-paginate shard after Granite initialization.

# TODO: Granite initialization here...

require "granite-paginate"

posts = Post.paginate.where(published: true)
posts = Post.where(published: true).paginate

posts = Post.order(:id).paginate
posts = Post.paginate.select

# Set the offset
posts = Post.order(:id).paginate(20)

# Custom limit
posts = Post.paginate(limit: 50)

# Custom offset and limit
posts = Post.paginate(3000, 100)

Development

One line:

./scripts/develop

or splitted:

Terminal 1:

docker-compose up

Terminal 2:

# host
docker-compose exec app bash

# container
just develop

When you are done, check and clean the code:

# container
just clean

Contributing

  1. Fork it (https://github.com/nicolab/granite-paginate/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

LICENSE

MIT (c) 2020, Nicolas Talle.

Author

Nicolas Tallefourtane - Nicolab.net
Nicolas Talle
Make a donation via Paypal