Uh oh!
There was an error while loading. Please reload this page.
feat: Add data type wrappers - #321
Conversation
kadler
left a comment
There was a problem hiding this comment.
Looks OK to me. I'd probably group them by type instead of alphabetically. Might want to add aliases to the Signed* functions without the "Signed" (ie. Int, BigInt, etc).
Does the spread operator work when the value is a string instead of an object? If not, I think the functions should all return objects.
| return '8F4'; | ||
| } | ||
| /** | ||
| * @returns {string} - The float data type format expected by xml service. | ||
| */ | ||
| function Float() { | ||
| return '4F2'; |
There was a problem hiding this comment.
Not that it's case sensitive, but for consistency I think we should use lowercase f in the types returned here.
| * @param {number} decimalDigits - The number of decimal digits. | ||
| * @returns {string} - The packed data type format expected by xml service. | ||
| */ | ||
| function Packed(totalDigits, decimalDigits) { |
There was a problem hiding this comment.
Seems more clear as PackedDecimal. Same goes for Zoned later.
abmusse
commented
Jan 21, 2021
Spread operator does work on strings but not in the way we want. It essentially will split each character in the string with a space: functionSignedBigInt(){return'20i0';}console.log('Signed Big Int:', ...SignedBigInt())// Signed Big Int: 2 0 i 0I agree we should return an object with |
abmusse
commented
Jan 21, 2021
I think we also should we add checks to enforce length parameter was passed for
As is if no length is provided to these functions we end up something like this: Check could be something like ... functionVarchar(length){if(!length){throwTypeError('Must provide valid length for Varchar');}return{type: `${length}a`,varying: '2'};}Alternatively we could have a default length or no-op when no length is passed. |
👋 Hi! This pull request has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed. |
| * data - data value name (tag) | ||
| * values - value, | ||
| * type | ||
| * 3i0 int8/byte D myint8 3i 0 |
There was a problem hiding this comment.
| *3i0int8/byteDmyint83i0 | |
| *xmlserviceC/SQLFixed-formatRPG | |
| *3i0int8/byteDmyint83i0 |
Maybe add a header?
I think it would also be nicer to space out the columns a bit and maybe put in some separator bars. The RPG example is a bit close to the "C" example.
| * 32a {varying2} varchar D mychar 32a varying | ||
| * 32a {varying4} varchar4 D mychar 32a varying(4) |
There was a problem hiding this comment.
| *32a{varying2}varcharDmychar32avarying | |
| *32a{varying4}varchar4Dmychar32avarying(4) | |
| *32a(varying=2)varcharDmychar32avarying | |
| *32a(varying=4)varchar4Dmychar32avarying(4) |
| * 5u0 uint16/ushort D myint16 5u 0 | ||
| * 10u0 uint32/uint D myint32 10u 0 | ||
| * 20u0 uint64/uint64 D myint64 20u 0 | ||
| * 32a char D mychar 32a |
There was a problem hiding this comment.
| *32acharDmychar32a | |
| *32achar[32]Dmychar32a |
| const Short = SignedShort; | ||
| /** | ||
| * @returns {string} The unsigned big int (int64) data type format expected by |
There was a problem hiding this comment.
Should these @returns be adjusted? They don't actually return a string.
There was a problem hiding this comment.
Yup these need to updated to return objects instead.
Resolves#75
Resolves#77