Class: ChConnect::NativeFormatParser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ch_connect/native_format_parser.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Parser for ClickHouse Native binary format.

Constant Summary collapse

DATE_EPOCH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Date.new(1970, 1, 1)

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ NativeFormatParser

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new parser.

Parameters:

  • body (#read)

    response body to parse



15
16
17
18
19
20
# File 'lib/ch_connect/native_format_parser.rb', line 15

def initialize(body)
  @reader = BodyReader.new(body)
  @columns = []
  @types = []
  @rows = []
end

Instance Method Details

#parseResponse

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parses the response body and returns a Response.

Returns:

  • (Response)

    parsed response with columns, types, and rows

Raises:



26
27
28
29
30
31
# File 'lib/ch_connect/native_format_parser.rb', line 26

def parse
  parse_block until @reader.eof?
  Response.new(columns: @columns, types: @types, rows: @rows)
ensure
  @reader.close
end