Class: Sequel::Funky::FunkyDuckDB
Instance Method Summary
collapse
Methods inherited from FunkyBase
#from_strptime, #initialize, #to_strptime
Instance Method Details
#collect_list(column) ⇒ Object
105
106
107
|
# File 'lib/sequel/extensions/funky.rb', line 105
def collect_list(column)
Sequel.function(:list, column)
end
|
#concat ⇒ Object
85
86
87
|
# File 'lib/sequel/extensions/funky.rb', line 85
def concat(*)
Sequel.function(:concat, *)
end
|
#hash ⇒ Object
76
77
78
79
80
81
82
83
|
# File 'lib/sequel/extensions/funky.rb', line 76
def hash(*)
Sequel.function(:hash, concat(*)).then do |hash_val|
Sequel.case(
{ hash_val <= 9_223_372_036_854_775_807 => hash_val },
hash_val - 18_446_744_073_709_551_616,
).cast(:bigint)
end
end
|
#make_json_column(ds, key_column, value_column) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/sequel/extensions/funky.rb', line 89
def make_json_column(ds, key_column, value_column)
json_object_col = Sequel.function(
:json_object,
key_column,
value_column,
).then do |json_object_col|
Sequel.function(
:list,
json_object_col,
)
end
ds.from_self
.select(json_object_col)
.limit(1)
end
|
#str_to_date(value, format, try: false) ⇒ Object
71
72
73
74
|
# File 'lib/sequel/extensions/funky.rb', line 71
def str_to_date(value, format, try: false)
strptime_func = try ? :try_strptime : :strptime
Sequel.function(strptime_func, Sequel.cast_string(value), to_strptime(format))
end
|