Skip to content

Support base64 decoding fields of type long #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/connection.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/row.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions lib/scanner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/table.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/row.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ Insert and update a column value, insert and update multiple column values or in
cellsKeys = {}
data.forEach (d) =>
key = d.key or @key
key = utils.base64.encode key, @client.options.encoding
cellsKeys[key] = [] unless key of cellsKeys
cellsKeys[key].push d
for k of cellsKeys
cells = cellsKeys[k]
bodyRow =
key: utils.base64.encode k, @client.options.encoding
key: k
Cell: []
for k1 of cells
cell = cells[k1]
Expand Down
9 changes: 8 additions & 1 deletion src/scanner.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rows and columns from HBase. Internally, it implements the native
# @id = id or null
@options = table: @options if typeof @options is 'string'
@options.batch ?= 1000
@options.types ?= {}
throw Error 'Missing required option "table"' unless @options.table
@options.id = null
@callback = null
Expand Down Expand Up @@ -82,7 +83,13 @@ Internal method to retrieve a batch of records.
data.key = key
data.column = utils.base64.decode cell.column, @client.options.encoding
data.timestamp = cell.timestamp
data.$ = utils.base64.decode cell.$, @client.options.encoding
type = @options.types[data.column]
if @options.returnBuffer
data.$ = Buffer.from(cell.$, "base64")
else
switch type
when "long" then data.$ = parseInt(utils.base64.decode(cell.$, "hex"), 16);
else data.$ = utils.base64.decode cell.$, @client.options.encoding
cells.push data
callback null, cells

Expand Down