Class: Gitlab::Database::Aggregation::ClickHouse::Column
- Inherits:
-
PartDefinition
- Object
- PartDefinition
- Gitlab::Database::Aggregation::ClickHouse::Column
- Defined in:
- lib/gitlab/database/aggregation/click_house/column.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#secondary_expression ⇒ Object
readonly
Returns the value of attribute secondary_expression.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from PartDefinition
Instance Method Summary collapse
-
#initialize(*args, **kwargs) ⇒ Column
constructor
A new instance of Column.
- #secondary_arel(_context) ⇒ Object
- #to_inner_arel(context) ⇒ Object
- #to_outer_arel(context) ⇒ Object
Methods inherited from PartDefinition
#format_value, #identifier, #instance_key, #validate_part
Constructor Details
#initialize(*args, **kwargs) ⇒ Column
Returns a new instance of Column.
10 11 12 13 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 10 def initialize(*args, **kwargs) super @secondary_expression = kwargs[:if] end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
8 9 10 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 8 def expression @expression end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 8 def name @name end |
#secondary_expression ⇒ Object (readonly)
Returns the value of attribute secondary_expression.
8 9 10 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 8 def secondary_expression @secondary_expression end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 8 def type @type end |
Instance Method Details
#secondary_arel(_context) ⇒ Object
15 16 17 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 15 def secondary_arel(_context) secondary_expression&.call end |
#to_inner_arel(context) ⇒ Object
19 20 21 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 19 def to_inner_arel(context) expression ? expression.call : context[:scope][name] end |
#to_outer_arel(context) ⇒ Object
23 24 25 |
# File 'lib/gitlab/database/aggregation/click_house/column.rb', line 23 def to_outer_arel(context) Arel::Table.new(context[:inner_query_name])[context.fetch(:local_alias, name)] end |