Sha256: 0cae192a1d62907b8a2a701714e172714675cfb3b262ac143071ec877d85e78a
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true module PgEventstore module Web module Paginator class BaseCollection attr_reader :config_name, :starting_id, :per_page, :order, :options # @param config_name [Symbol] # @param starting_id [String, Integer, nil] # @param per_page [Integer] # @param order [Symbol] :asc or :desc # @param options [Hash] additional options to filter the collection def initialize(config_name, starting_id:, per_page:, order:, options: {}) @config_name = config_name @starting_id = starting_id @per_page = per_page @order = order @options = options end # @return [Array] def collection raise NotImplementedError end # @return [Integer] def count collection.size end # @return [String, Integer, nil] def next_page_starting_id raise NotImplementedError end # @return [String, Integer, nil] def prev_page_starting_id raise NotImplementedError end # @return [Integer] def total_count raise NotImplementedError end private # @return [PgEventstore::Connection] def connection PgEventstore.connection(config_name) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems