-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
Documentation missing simple examples. How to insert using variables etc ... #2263
Comments
When you say "insert using variables", are you asking for an example like this, but with node-mysql2/examples/simple-select.js Lines 23 to 29 in fa47d0b
From mysql2 documentation: "MySQL2 is mostly API compatible with mysqljs and supports majority of features.". Following this approach, mysqljs has this example: var post = {id: 1, title: 'Hello MySQL'};
var query = connection.query('INSERT INTO posts SET ?', post, function (error, results, fields) {
if (error) throw error;
// Neat!
});
console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL' This example will work for both mysqljs and mysql2 🧙🏻
I think we can improve it, especially for You can also compare some of the differences between them: |
When this line was added years ago mysqljs/mysql was way more popular than mysql2, and it made sense to "delegate" documentation in that way. Maybe it's time now to have full api docs in the readme. Good example: https://github.com/mscdex/ssh2 Also would be great to add nextra or docusaurus based documentation site (main api, same as in readme + examples / gotchas / common mistakes / best practices / FAQ etc ) |
Hey @sidorares, how would it be to set up a website (MDX) in practice (same repository using a " Personally, I love the way how docusaurus does it and it naturally comes with a beautiful layout.
|
Yes, in the subfolder of the same repo, so that the docs are in sync with the code |
If you're okay with that, we can dedicate a separate branch to work on it. |
Sure, I'm OK with that |
One approach I've considered interesting is using tabs to show the variations of a same section, for example:
The same idea for sidebar, for example in "
Also, on the main page, keep it focused on documentation. Here's a test using docusaurus: 480.movNotes:
What do you think? 🌞✨ |
😍 |
#2279 fixes this |
Just complementing:
For now (#2337), there are examples of |
Documentation is missing simple examples.
How to insert using variables etc ...
The mysql has much more documentation. If it was up to me I would stickwith npm mysql but for this specific project I have to use mysql2 and it is a real pain to implement!
The text was updated successfully, but these errors were encountered: