Skip to content

Commit

Permalink
docs: improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Jan 2, 2024
1 parent 1b013d1 commit d5de9e7
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 47 deletions.
34 changes: 19 additions & 15 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
[node-mysql]: https://github.com/mysqljs/mysql
[docs-contributing]: https://sidorares.github.io/node-mysql2/docs/contributing/website

# Contributing Guidelines

## Introduction

Contributions are always welcomed. You can help `node-mysql2` community in various ways. Here are our major priorities, listed in order of importance.
Contributions are always welcomed. You can help **MySQL2** community in various ways. Here are our major priorities, listed in order of importance:

- `node-mysql` API incompatibility fixes
- Documentation
- Adding tests or improving existing ones
- Improving benchmarks
- Bug Fixes
- TODO from source
- Performance improvements
- Add Features
- [Node MySQL][node-mysql] API incompatibility fixes
- [Documentation][docs-contributing]
- Adding tests or improving existing ones
- Improving benchmarks
- Bug Fixes
- TODO from source
- Performance improvements
- Add Features

## Security Issues

Please contact project maintainers privately before opening a security issue on Github. It will allow us to fix the issue before attackers know about it.

**Contact**
### Contact

- Andrey Sidorov, [email protected]

## New Features

Its better to discuss an API before actually start implementing it. You can open an issue on Github. We can discuss design of API and implementation ideas.
It's better to discuss an API before actually start implementing it. You can open an issue on Github. We can discuss design of API and implementation ideas.

## Development

We assume you already have these tools installed on your system
- MySQL Server
- Node.JS
We assume you already have these tools installed on your system:

- MySQL Server
- Node.JS

As `node-mysql2` is purely JS based you can develop it on Linux, Mac or Windows. Please follow these steps
As **MySQL2** is purely JS based you can develop it on Linux, Mac or Windows. Please follow these steps

```bash
# clone node-mysql2
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[license-url]: https://github.com/sidorares/node-mysql2/blob/master/License
[license-image]: https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000
[node-mysql]: https://github.com/mysqljs/mysql
[mysqljs]: https://github.com/mysqljs
[mysql-native]: https://github.com/sidorares/nodejs-mysql-native
[sidorares]: https://github.com/sidorares
[TooTallNate]: https://gist.github.com/TooTallNate
Expand Down Expand Up @@ -40,7 +41,7 @@

[English][docs-base] | [简体中文][docs-base-zh-CN] | [Português (BR)][docs-base-pt-BR]

> MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl [much more][docs-base].
> MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl [much more][docs-documentation].
**Table of Contents**

Expand All @@ -52,9 +53,9 @@

## History and Why MySQL2

MySQL2 project is a continuation of [MySQL-Native][mysql-native]. Protocol parser code was rewritten from scratch and api changed to match popular [mysqljs/mysql][node-mysql]. MySQL2 team is working together with [mysqljs/mysql][node-mysql] team to factor out shared code and move it under [mysqljs][node-mysql] organization.
MySQL2 project is a continuation of [MySQL-Native][mysql-native]. Protocol parser code was rewritten from scratch and api changed to match popular [Node MySQL][node-mysql]. MySQL2 team is working together with [Node MySQL][node-mysql] team to factor out shared code and move it under [mysqljs][mysqljs] organization.

MySQL2 is mostly API compatible with [mysqljs][node-mysql] and supports majority of features. MySQL2 also offers these additional features:
MySQL2 is mostly API compatible with [Node MySQL][node-mysql] and supports majority of features. MySQL2 also offers these additional features:

- Faster / Better Performance
- [Prepared Statements][docs-prepared-statements]
Expand Down Expand Up @@ -94,7 +95,7 @@ npm install --save-dev @types/node
## Acknowledgements

- Internal protocol is written by [@sidorares][sidorares] [MySQL-Native][mysql-native].
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [node-mysql][node-mysql].
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [Node MySQL][node-mysql].
- SSL upgrade code based on [@TooTallNate][TooTallNate] [code][starttls.js].
- Secure connection / compressed connection api flags compatible to [MariaSQL][node-mariasql] client.
- [Contributors][contributors].
Expand Down
18 changes: 13 additions & 5 deletions website/docs/acknowledgements.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Acknowledgements

- Internal protocol is written by @sidorares [MySQL-Native](https://github.com/sidorares/nodejs-mysql-native)
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [node-mysql](https://github.com/mysqljs/mysql)
- SSL upgrade code based on @TooTallNate [code](https://gist.github.com/TooTallNate/848444)
- Secure connection / compressed connection api flags compatible to [MariaSQL](https://github.com/mscdex/node-mariasql/) client.
- [Contributors](https://github.com/sidorares/node-mysql2/graphs/contributors)
[mysql-native]: https://github.com/sidorares/nodejs-mysql-native
[sidorares]: https://github.com/sidorares
[node-mysql]: https://github.com/mysqljs/mysql
[TooTallNate]: https://gist.github.com/TooTallNate
[starttls.js]: https://gist.github.com/TooTallNate/848444
[node-mariasql]: https://github.com/mscdex/node-mariasql
[contributors]: https://github.com/sidorares/node-mysql2/graphs/contributors

- Internal protocol is written by [@sidorares][sidorares] [MySQL-Native][mysql-native].
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [Node MySQL][node-mysql].
- SSL upgrade code based on [@TooTallNate][TooTallNate] [code][starttls.js].
- Secure connection / compressed connection api flags compatible to [MariaSQL][node-mariasql] client.
- [Contributors][contributors].
4 changes: 2 additions & 2 deletions website/docs/api-and-configurations.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# API and Configuration

[node-mysql]: https://github.com/mysqljs/mysql

MySQL2 is mostly API compatible with [Node MySQL][node-mysql].

One known incompatibility is that `DECIMAL` values are returned as strings whereas in [Node MySQL][node-mysql] they are returned as numbers. This includes the result of `SUM()` and `AVG()` functions when applied to `INTEGER` arguments. This is done deliberately to avoid loss of precision - see https://github.com/sidorares/node-mysql2/issues/935.

:::info
If you find any other incompatibility with [Node MySQL][node-mysql], Please report via Issue tracker. We will fix reported incompatibility on priority basis.
:::

[node-mysql]: https://github.com/mysqljs/mysql
12 changes: 7 additions & 5 deletions website/docs/documentation/00-index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import { PageTitle } from '@site/src/components/PageTitle';

# Documentation

MySQL2 aims to be a drop in replacement for [node-mysql](https://github.com/mysqljs/mysql).
[node-mysql]: https://github.com/mysqljs/mysql

MySQL2 aims to be a drop in replacement for [Node MySQL][node-mysql].

:::note
_If you see any API incompatibilities with `node-mysql`, please report via github issue._
_If you see any API incompatibilities with [Node MySQL][node-mysql], please report via github issue._
:::

Not only `Node-MySQL2` offers better performance over `node-mysql`, we also support these additional features.
Not only **MySQL2** offers better performance over [Node MySQL][node-mysql], we also support these additional features:

- [Prepared Statements](/docs/documentation/prepared-statements)
- [Promise Wrapper](/docs/documentation/promise-wrapper)
Expand All @@ -35,7 +37,7 @@ Please check these [examples](/docs/examples) for **MySQL2**.

---

## Known incompatibilities with `node-mysql`
## Known incompatibilities with [Node MySQL][node-mysql]

- `zeroFill` flag is ignored in type conversion.
You need to check corresponding field's zeroFill flag and convert to string manually if this is of importance to you.
Expand All @@ -57,7 +59,7 @@ This option could lose precision on the number as Javascript Number is a Float!
## Other Resources

- [Wire protocol documentation](https://dev.mysql.com/doc/internals/en/client-server-protocol.html)
- [node-mysql](https://github.com/mysqljs/mysql) - Most popular node.js mysql client library
- [Node MySQL][node-mysql] - Most popular node.js mysql client library
- [node-mariasql](https://github.com/mscdex/node-mariasql/) - Bindings to libmariasql. One of the fastest clients
- [node-libmysqlclient](https://github.com/Sannis/node-mysql-libmysqlclient) - Bindings to libmysqlclient
- [go-mysql](https://github.com/siddontang/go-mysql) - MySQL Go client (prepared statements, binlog protocol, server)
Expand Down
11 changes: 6 additions & 5 deletions website/docs/history-and-why-mysq2.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# History and Why MySQL2

MySQL2 project is a continuation of [MySQL-Native][mysql-native]. Protocol parser code was rewritten from scratch and api changed to match popular [mysqljs/mysql][node-mysql]. MySQL2 team is working together with [mysqljs/mysql][node-mysql] team to factor out shared code and move it under [mysqljs][node-mysql] organization.
[node-mysql]: https://github.com/mysqljs/mysql
[mysql-native]: https://github.com/sidorares/nodejs-mysql-native
[mysqljs]: https://github.com/mysqljs

MySQL2 project is a continuation of [MySQL-Native][mysql-native]. Protocol parser code was rewritten from scratch and api changed to match popular [Node MySQL][node-mysql]. MySQL2 team is working together with [Node MySQL][node-mysql] team to factor out shared code and move it under [mysqljs][mysqljs] organization.

MySQL2 is mostly API compatible with [mysqljs][node-mysql] and supports majority of features. MySQL2 also offers these additional features:
MySQL2 is mostly API compatible with [Node MySQL][node-mysql] and supports majority of features. MySQL2 also offers these additional features:

- Faster / Better Performance
- [Prepared Statements](/docs/documentation/prepared-statements)
Expand All @@ -14,6 +18,3 @@ MySQL2 is mostly API compatible with [mysqljs][node-mysql] and supports majority
- SSL and [Authentication Switch](/docs/documentation/authentication-switch)
- [Custom Streams](/docs/documentation/extras#connecting-using-custom-stream)
- [Pooling](/docs/#using-connection-pools)

[node-mysql]: https://github.com/mysqljs/mysql
[mysql-native]: https://github.com/sidorares/nodejs-mysql-native
22 changes: 11 additions & 11 deletions website/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ import { PageTitle } from '@site/src/components/PageTitle';

<PageTitle title='MySQL2 | Quickstart' />

[npm-image]: https://img.shields.io/npm/v/mysql2.svg
[npm-url]: https://npmjs.org/package/mysql2
[node-version-image]: https://img.shields.io/node/v/mysql2.svg
[node-version-url]: https://nodejs.org/download/
[downloads-image]: https://img.shields.io/npm/dm/mysql2.svg
[downloads-url]: https://npmjs.org/package/mysql2
[license-url]: https://github.com/sidorares/node-mysql2/blob/master/License
[license-image]: https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000
[node-mysql]: https://github.com/mysqljs/mysql

# MySQL2

{/* <Logo className='logo' width={150} height={150} /> */}
Expand Down Expand Up @@ -195,7 +205,7 @@ If you execute same statement again, it will be picked from a LRU cache which wi

---

### Using connection pools
### Using Connection Pools

Connection pools help reduce the time spent connecting to the MySQL server by reusing a previous connection, leaving them open instead of closing when you are done with them.

Expand Down Expand Up @@ -494,13 +504,3 @@ conn.query(
Need help? Ask your question on [Stack Overflow](https://stackoverflow.com/questions/tagged/mysql2) or [GitHub](https://github.com/sidorares/node-mysql2/discussions).
If you've encountered an issue, please [file it on GitHub](https://github.com/sidorares/node-mysql2/issues).
:::

[npm-image]: https://img.shields.io/npm/v/mysql2.svg
[npm-url]: https://npmjs.org/package/mysql2
[node-version-image]: https://img.shields.io/node/v/mysql2.svg
[node-version-url]: https://nodejs.org/download/
[downloads-image]: https://img.shields.io/npm/dm/mysql2.svg
[downloads-url]: https://npmjs.org/package/mysql2
[license-url]: https://github.com/sidorares/node-mysql2/blob/master/License
[license-image]: https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000
[node-mysql]: https://github.com/mysqljs/mysql

0 comments on commit d5de9e7

Please sign in to comment.