-
Notifications
You must be signed in to change notification settings - Fork 0
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
SQL Generation #31
SQL Generation #31
Conversation
…the DB outside the request lifecycle: issue #33
+ mapper that takes name, type and extra config options and produces sql string to create a column for setting up table + works for both pqsl and sql
…able with the correct fields and types; issue #11
…numbers of columns.
…s). Write and test an update method; issue #11
+ use joi to validate the config for creating a table Related: #39
@Looks promising. assign when ready. 👍 |
Conflicts: lib/index.js test/index.test.js
Have now:
@nelsonic please have a look! |
WoW! |
.unknown() | ||
; | ||
var configSchema = Joi.object().keys({ | ||
table_name: Joi.string().regex(dbNameRegEx).required(), // eslint-disable-line |
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.
purely out of curiosity, why do these lines need to be disabled for eslint?
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.
@nelsonic because there's a rule that says max of 2 chained method calls per line. Bit annoying in this case.
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.
Ah, lame. although for git diff
purposes splitting over more lines is more review-able... (fine for now)
configValidator(config); | ||
|
||
return client.query(sqlGen.init(config), cb); | ||
} }; |
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.
does this pass the linter?
(thought it would require the init
to be on a new line and these closing brackets too... if not. fair enough...)
@@ -0,0 +1,18 @@ | |||
'use strict'; |
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.
does goodparts
enforce having the 'use strict';
at the top of our files...?
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.
yes, we have added this rule in the goodparts config:
dwyl/goodparts#128
I'm not sure if we should use it, maybe we can reopen this issue on goodparts
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.
Thanks @SimonLab. yes, I agree we need to understand the benefits of the 'use strict';
directive.
@@ -0,0 +1,18 @@ | |||
'use strict'; | |||
|
|||
exports.values = function (obj, keys) { |
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.
are these utils
independently unit-tested somewhere?
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 are unit tests here for everyone except except
! @eliasCodes i'll write it?
Code looks good. merging. 👍 |
THIS PR
Main issue: #11
In this PR we create handlers for db interactions:
{ fields }
{ fields, where }
{ where }
{ select, where }
Check update to README.md to see necessary steps to run db tests. #34