File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,16 @@ You also have the option (but are not required) to pass in `stringifyObject` and
181
181
allowing you provide a custom means of turning objects into strings, as well as a
182
182
location-specific/timezone-aware ` Date ` .
183
183
184
+ This can be further combined with the ` SqlString.raw() ` helper to generate SQL
185
+ that includes MySQL functions as dynamic vales:
186
+
187
+ ``` js
188
+ var userId = 1 ;
189
+ var data = { email: ' foobar@example.com' , modified: SqlString .raw (' NOW()' ) };
190
+ var sql = SqlString .format (' UPDATE ?? SET ? WHERE `id` = ?' , [' users' , data, userId]);
191
+ console .log (sql); // UPDATE `users` SET `email` = 'foobar@example.com', `modified` = NOW() WHERE `id` = 1
192
+ ```
193
+
184
194
## License
185
195
186
196
[ MIT] ( LICENSE )
You can’t perform that action at this time.
0 commit comments