Module: ClickHouse::Extend::ConnectionSelective

Included in:
Connection
Defined in:
lib/click_house/extend/connection_selective.rb

Instance Method Summary collapse

Instance Method Details

#select_all(sql) ⇒ ResultSet

Returns:

  • (ResultSet)

7
8
9
10
# File 'lib/click_house/extend/connection_selective.rb', line 7

def select_all(sql)
  response = get(body: Util::Statement.format(sql, 'JSON'))
  Response::Factory[response]
end

#select_one(sql) ⇒ Object


17
18
19
20
# File 'lib/click_house/extend/connection_selective.rb', line 17

def select_one(sql)
  response = get(body: Util::Statement.format(sql, 'JSON'))
  Response::Factory[response].first
end

#select_value(sql) ⇒ Object


12
13
14
15
# File 'lib/click_house/extend/connection_selective.rb', line 12

def select_value(sql)
  response = get(body: Util::Statement.format(sql, 'JSON'))
  Array(Response::Factory[response].first).dig(0, -1)
end