Class: Chicago::Schema::CalculatedColumn
Abstract
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from QueryColumn
column, #method_missing, #qualified_label
Constructor Details
#initialize(column, operation) ⇒ CalculatedColumn
139
140
141
142
143
144
|
# File 'lib/chicago/schema/query_column.rb', line 139
def initialize(column, operation)
super column
@operation = operation
@defined_operation = operation
normalize_operation
end
|
Class Method Details
.make(operation, column) ⇒ Object
131
132
133
134
135
136
137
|
# File 'lib/chicago/schema/query_column.rb', line 131
def self.make(operation, column)
if operation == :count
CountColumn.new(column)
else
AggregateColumn.new(column, operation)
end
end
|
Instance Method Details
#column_alias ⇒ Object
146
147
148
|
# File 'lib/chicago/schema/query_column.rb', line 146
def column_alias
"#{@column.column_alias}.count".to_sym
end
|
#filter_dataset(ds, filter) ⇒ Object
154
155
156
|
# File 'lib/chicago/schema/query_column.rb', line 154
def filter_dataset(ds, filter)
ds.having(filter)
end
|
#group_name ⇒ Object
150
151
152
|
# File 'lib/chicago/schema/query_column.rb', line 150
def group_name
nil
end
|