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
Make result set's meta property non-enumerable #217
Comments
|
I tend to agree with that.
example : with current implementation: const res = await connection.query('select * from animals');
console.log(res):
// [
// { id: 1, name: 'sea lions' },
// { id: 2, name: 'bird' },
// meta: [ ... ]
// ]A better solution would be to still have meta property, but nonenumerable: const res = await connection.query('select * from animals');
console.log(res):
// res : [
// { id: 1, name: 'sea lions' },
// { id: 2, name: 'bird' }
// ]
const meta = res.meta;
// meta: [ ... ] |
|
Didn't know about I would vote for |
|
exactly my point. Documentation is always a work in progress. thanks for pointing that out. I've just added it in develop branch: https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/develop/documentation/promise-api.md#metaasarray |
|
@rusher I think the docs could be wrong, or I missunderstood it. current docs say: shouldn't it be like: because in my test the "root" result object now is correctly sepperated in an array, but the data is still json (which i love). When reading the docs I thought its all arrays now. |
|
@MR4online Yes, looks like a copy-paste mistake (copied from rowsAsArray) |
|
yes, that is now corrected ( in commit ba70356 ) |
|
precision, metaEnumerable is not handled in batch command, this will be corrected in 3.1.1 |
|
closing since 3.1.1 is released |
The result set's meta info is rarely needed, therefore I appreciate it's exposed to the user in a way that doesn't complicate the API for majority of use cases. Likewise I think it shouldn't make day-to-day debugging and testing more complicated. As it is now:
jest)As a result a user is forced to create copy or redefine the prop every time, which is inconvinient and may have some perf implications.
For these reasons, I propose to make
metaproperty non-enumerable, solving both of the stated problems.The text was updated successfully, but these errors were encountered: