Class: ElasticGraph::GraphQL::Aggregation::Key::AggregatedValue
- Inherits:
-
Object
- Object
- ElasticGraph::GraphQL::Aggregation::Key::AggregatedValue
- Defined in:
- lib/elastic_graph/graphql/aggregation/key.rb
Overview
Aggregation key implementation used when we’re dealing with ‘aggregated_values`.
Instance Method Summary collapse
- #encode ⇒ Object
- #field_path ⇒ Object
-
#initialize(aggregation_name:, function_name:, field_path: [], encoded_field_path: FieldPathEncoder.encode(field_path)) ⇒ AggregatedValue
constructor
We encode the field path as part of initialization to enforce an invariant that all ‘AggregatedValue` instances have valid values for all attributes.
Constructor Details
#initialize(aggregation_name:, function_name:, field_path: [], encoded_field_path: FieldPathEncoder.encode(field_path)) ⇒ AggregatedValue
We encode the field path as part of initialization to enforce an invariant that all ‘AggregatedValue` instances have valid values for all attributes. `FieldPathEncoder.encode` will raise an exception if the field path is invalid.
32 33 34 35 36 37 38 39 40 |
# File 'lib/elastic_graph/graphql/aggregation/key.rb', line 32 def initialize(aggregation_name:, function_name:, field_path: [], encoded_field_path: FieldPathEncoder.encode(field_path)) Key.verify_no_delimiter_in(aggregation_name, function_name, *field_path) super( aggregation_name: aggregation_name, encoded_field_path: encoded_field_path, function_name: function_name ) end |
Instance Method Details
#encode ⇒ Object
42 43 44 |
# File 'lib/elastic_graph/graphql/aggregation/key.rb', line 42 def encode Key.encode([aggregation_name, encoded_field_path, function_name]) end |
#field_path ⇒ Object
46 47 48 |
# File 'lib/elastic_graph/graphql/aggregation/key.rb', line 46 def field_path FieldPathEncoder.decode(encoded_field_path) end |