Class: GraphQL::Connections::Base
- Inherits:
-
Pagination::Connection
- Object
- Pagination::Connection
- GraphQL::Connections::Base
- Defined in:
- lib/graphql/connections/base.rb
Overview
Base class for pagination implementations
Direct Known Subclasses
Instance Attribute Summary collapse
-
#opaque_cursor ⇒ Object
readonly
Returns the value of attribute opaque_cursor.
Instance Method Summary collapse
- #cursor_for(item) ⇒ Object
- #has_next_page ⇒ Object
- #has_previous_page ⇒ Object
-
#initialize(*args, opaque_cursor: true, **kwargs) ⇒ Base
constructor
A new instance of Base.
- #nodes ⇒ Object
- #primary_key ⇒ Object
Constructor Details
#initialize(*args, opaque_cursor: true, **kwargs) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 |
# File 'lib/graphql/connections/base.rb', line 11 def initialize(*args, opaque_cursor: true, **kwargs) @opaque_cursor = opaque_cursor super(*args, **kwargs) end |
Instance Attribute Details
#opaque_cursor ⇒ Object (readonly)
Returns the value of attribute opaque_cursor.
7 8 9 |
# File 'lib/graphql/connections/base.rb', line 7 def opaque_cursor @opaque_cursor end |
Instance Method Details
#cursor_for(item) ⇒ Object
33 34 35 |
# File 'lib/graphql/connections/base.rb', line 33 def cursor_for(item) raise NotImplementedError end |
#has_next_page ⇒ Object
29 30 31 |
# File 'lib/graphql/connections/base.rb', line 29 def has_next_page raise NotImplementedError end |
#has_previous_page ⇒ Object
25 26 27 |
# File 'lib/graphql/connections/base.rb', line 25 def has_previous_page raise NotImplementedError end |
#nodes ⇒ Object
21 22 23 |
# File 'lib/graphql/connections/base.rb', line 21 def nodes @nodes ||= limited_relation end |
#primary_key ⇒ Object
17 18 19 |
# File 'lib/graphql/connections/base.rb', line 17 def primary_key @primary_key ||= items.model.primary_key end |