Class: GraphQL::Relay::ArrayConnection

Inherits:
BaseConnection show all
Defined in:
lib/graphql/relay/array_connection.rb

Constant Summary collapse

CURSOR_SEPARATOR =

Just to encode data in the cursor, use something that won’t conflict

"---"

Constants inherited from BaseConnection

BaseConnection::CONNECTION_IMPLEMENTATIONS, BaseConnection::METHODS_FROM_ARGUMENTS

Instance Attribute Summary

Attributes inherited from BaseConnection

#arguments, #object

Instance Method Summary collapse

Methods inherited from BaseConnection

connection_for_items, create_type, #edges, #has_next_page, #has_previous_page, #initialize, #page_info, register_connection_implementation

Constructor Details

This class inherits a constructor from GraphQL::Relay::BaseConnection

Instance Method Details

#cursor_from_node(item) ⇒ Object



7
8
9
10
11
# File 'lib/graphql/relay/array_connection.rb', line 7

def cursor_from_node(item)
  idx = sliced_nodes.find_index(item)
  cursor_parts = [(order || "none"), idx]
  Base64.strict_encode64(cursor_parts.join(CURSOR_SEPARATOR))
end