class Sequel::SQL::StringAgg
The StringAgg class represents an aggregate string concatentation.
Attributes
expr[R]
The string expression for each row that will concatenated to the output.
order_expr[R]
The expression that the aggregation is ordered by.
separator[R]
The separator between each string expression.
Public Class Methods
new(expr, separator=nil)
click to toggle source
Set the expression and separator
# File lib/sequel/extensions/string_agg.rb, line 149 def initialize(expr, separator=nil) @expr = expr @separator = separator end
Public Instance Methods
distinct()
click to toggle source
Return a modified StringAgg that uses distinct expressions
# File lib/sequel/extensions/string_agg.rb, line 160 def distinct sa = dup sa.instance_variable_set(:@distinct, true) sa end
is_distinct?()
click to toggle source
Whether the current expression uses distinct expressions
# File lib/sequel/extensions/string_agg.rb, line 155 def is_distinct? @distinct == true end
order(*o)
click to toggle source
Return a modified StringAgg with the given order
# File lib/sequel/extensions/string_agg.rb, line 167 def order(*o) sa = dup sa.instance_variable_set(:@order_expr, o.empty? ? nil : o) sa end