Class: PgEventstore::Web::Paginator::BaseCollection
- Inherits:
-
Object
- Object
- PgEventstore::Web::Paginator::BaseCollection
- Defined in:
- lib/pg_eventstore/web/paginator/base_collection.rb,
sig/pg_eventstore/web/paginator/base_collection.rbs
Direct Known Subclasses
EventTypesCollection, EventsCollection, MarkersCollection, StreamContextsCollection, StreamIdsCollection, StreamNamesCollection, StreamsCollection
Constant Summary collapse
- MIN_QUERY_SIZE_FOR_ADVANCE_SEARCH =
This is the minimum amount of symbols requeried to perform search using trigrams gin index
3
Instance Attribute Summary collapse
-
#config_name ⇒ Symbol
Returns the value of attribute config_name.
-
#options ⇒ ::Hash[untyped, untyped]
Returns the value of attribute options.
-
#order ⇒ Symbol
Returns the value of attribute order.
-
#per_page ⇒ Integer
Returns the value of attribute per_page.
-
#starting_id ⇒ String, ...
Returns the value of attribute starting_id.
Instance Method Summary collapse
- #collection ⇒ Array
- #connection ⇒ PgEventstore::Connection
- #count ⇒ Integer
-
#initialize(config_name, starting_id:, per_page:, order:, options: {}) ⇒ BaseCollection
constructor
A new instance of BaseCollection.
- #next_page_starting_id ⇒ String, ...
- #prev_page_starting_id ⇒ String, ...
- #total_count ⇒ Integer
Constructor Details
#initialize(config_name, starting_id:, per_page:, order:, options: {}) ⇒ BaseCollection
Returns a new instance of BaseCollection.
31 32 33 34 35 36 37 38 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 31 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 = .is_a?(Sinatra::IndifferentHash) ? Utils.deep_transform_keys(Hash[], &:to_sym) : end |
Instance Attribute Details
#config_name ⇒ Symbol
Returns the value of attribute config_name.
12 13 14 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 12 def config_name @config_name end |
#options ⇒ ::Hash[untyped, untyped]
Returns the value of attribute options.
24 25 26 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 24 def @options end |
#order ⇒ Symbol
Returns the value of attribute order.
21 22 23 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 21 def order @order end |
#per_page ⇒ Integer
Returns the value of attribute per_page.
18 19 20 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 18 def per_page @per_page end |
#starting_id ⇒ String, ...
Returns the value of attribute starting_id.
15 16 17 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 15 def starting_id @starting_id end |
Instance Method Details
#collection ⇒ Array
41 42 43 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 41 def collection raise NotImplementedError end |
#connection ⇒ PgEventstore::Connection
68 69 70 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 68 def connection PgEventstore.connection(config_name) end |
#count ⇒ Integer
46 47 48 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 46 def count collection.size end |
#next_page_starting_id ⇒ String, ...
51 52 53 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 51 def next_page_starting_id raise NotImplementedError end |
#prev_page_starting_id ⇒ String, ...
56 57 58 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 56 def prev_page_starting_id raise NotImplementedError end |
#total_count ⇒ Integer
61 62 63 |
# File 'lib/pg_eventstore/web/paginator/base_collection.rb', line 61 def total_count raise NotImplementedError end |