-
Notifications
You must be signed in to change notification settings - Fork 5
ColumnValue introduction #12
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
base: master
Are you sure you want to change the base?
Conversation
@MarkHerhold bummer, I have bumped into that |
Fixes #6 - @MarkHerhold your idea behind |
Fixes #7 - ColumnValue provides this and supports enum as denoted. |
src/ColumnValue.ts
Outdated
|
||
get buffer(): Buffer | null { | ||
if (this.isNull) return null; | ||
return Buffer.from((this.field.blobValue || '').toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should do we call .toString()
on a value that I'd presume to be a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think this logic is wrong for binary type.
The AWS docs say:
blobValue - A value of BLOB data type. Type: Base64-encoded binary data object
So I think we would need to do Buffer.from(this.field.blobValue, 'base64')
. I don't see a test that explicitly tests this logic and I haven't verified my assumption with the real RDS Data API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarkHerhold - looks like the blobValue can return as Buffer|Uint8Array|Blob|string
possible answer I am committing now:
return Buffer.isBuffer(this.field.blobValue) ? this.field.blobValue : Buffer.from(this.field.blobValue as Uint8Array);
TODO: I will update the test dB and add a binary column and create a test |
@cbschuld just taking a look at the new code and there will still be a problem with Decimal columns saving and reading. |
Overview
An introduction of ColumnValue which was initially conceived by @MarkHerhold
Adds
Updates