Module: GraphQL::Schema::UniqueWithinType Private
- Defined in:
- lib/graphql/schema/unique_within_type.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Attribute Summary collapse
-
.default_id_separator ⇒ Object
private
Class Method Summary collapse
-
.decode(node_id, separator: self.default_id_separator) ⇒ Array<(String, String)>
private
The type name & value passed to UniqueWithinType.encode.
-
.encode(type_name, object_value, separator: self.default_id_separator) ⇒ String
private
A unique, opaque ID generated as a function of the two inputs.
Class Attribute Details
.default_id_separator ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/graphql/schema/unique_within_type.rb', line 6 def default_id_separator @default_id_separator end |
Class Method Details
.decode(node_id, separator: self.default_id_separator) ⇒ Array<(String, String)>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The type name & value passed to encode
27 28 29 |
# File 'lib/graphql/schema/unique_within_type.rb', line 27 def decode(node_id, separator: self.default_id_separator) Base64.decode64(node_id).split(separator, 2) end |
.encode(type_name, object_value, separator: self.default_id_separator) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a unique, opaque ID generated as a function of the two inputs
15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql/schema/unique_within_type.rb', line 15 def encode(type_name, object_value, separator: self.default_id_separator) object_value_str = object_value.to_s if type_name.include?(separator) raise "encode(#{type_name}, #{object_value_str}) contains reserved characters `#{separator}` in the type name" end Base64.strict_encode64([type_name, object_value_str].join(separator)) end |