Sha256: 9e43bf08c918a7c54b67c65574d1467dfb47607d4a39e21adad1faf252c6eae5
Contents?: true
Size: 1.04 KB
Versions: 13
Compression:
Stored size: 1.04 KB
Contents
require_relative 'pagination_handler' module Praxis module Extensions module Pagination class SequelPaginationHandler < PaginationHandler def self.where_lt(query, attr, value) query.where("#{attr} < ?", value) end def self.where_gt(query, attr, value) query.where("#{attr} > ?", value) end def self.order(query, order) return query unless order order_clause = order.map do |spec_hash| direction, name = spec_hash.first case direction.to_sym when :desc Sequel.desc(name.to_sym) else Sequel.asc(name.to_sym) end end query = query.order(*order_clause) query end def self.count(query) query.count end def self.offset(query, offset) query.offset(offset) end def self.limit(query, limit) query.limit(limit) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems