Skip to content

Commit 8990785

Browse files
authored
Psharma/update readme (#8)
* README.md update * gh_pages * testing workflow * changed history page * fix api page * comments * removed feature branch from gh-pages ci * docs update
1 parent 965ec90 commit 8990785

File tree

9 files changed

+230
-145
lines changed

9 files changed

+230
-145
lines changed

.github/workflows/gh-pages.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
run: cd website && npm run build
4040

4141
- name: Deploy
42-
uses: peaceiris/actions-gh-pages@v3
43-
with:
44-
github_token: ${{ secrets.GITHUB_TOKEN }}
45-
publish_dir: ./website/build
42+
uses: peaceiris/actions-gh-pages@v2
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
PUBLISH_BRANCH: gh-pages
46+
PUBLISH_DIR: ./website/build

README.md

Lines changed: 99 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,57 @@
77
[license-url]: https://github.com/sidorares/node-mysql2/blob/master/License
88
[license-image]: https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000
99
[node-mysql]: https://github.com/mysqljs/mysql
10+
[node-mysql2]: https://github.com/sidorares/node-mysql2
1011
[mysqljs]: https://github.com/mysqljs
1112
[mysql-native]: https://github.com/sidorares/nodejs-mysql-native
1213
[sidorares]: https://github.com/sidorares
1314
[TooTallNate]: https://gist.github.com/TooTallNate
1415
[starttls.js]: https://gist.github.com/TooTallNate/848444
1516
[node-mariasql]: https://github.com/mscdex/node-mariasql
1617
[contributors]: https://github.com/sidorares/node-mysql2/graphs/contributors
17-
[contributing]: https://github.com/sidorares/node-mysql2/blob/master/Contributing.md
18-
[docs-base]: https://sidorares.github.io/node-mysql2/docs
19-
[docs-base-zh-CN]: https://sidorares.github.io/node-mysql2/zh-CN/docs
20-
[docs-base-pt-BR]: https://sidorares.github.io/node-mysql2/pt-BR/docs
21-
[docs-prepared-statements]: https://sidorares.github.io/node-mysql2/docs/documentation/prepared-statements
22-
[docs-mysql-server]: https://sidorares.github.io/node-mysql2/docs/documentation/mysql-server
23-
[docs-promise-wrapper]: https://sidorares.github.io/node-mysql2/docs/documentation/promise-wrapper
24-
[docs-authentication-switch]: https://sidorares.github.io/node-mysql2/docs/documentation/authentication-switch
18+
[contributing]: https://github.com/singlestore-labs/singlestore-nodejs/blob/master/Contributing.md
19+
[docs-base]: https://singlestore-labs.github.io/singlestore-nodejs/docs
20+
[docs-api]: https://singlestore-labs.github.io/singlestore-nodejs/docs/api-and-configurations
21+
[docs-prepared-statements]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/prepared-statements
22+
[docs-mysql-server]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/mysql-server
23+
[docs-promise-wrapper]: https://singlestore-labs.github.io/singlestore-nodejs/documentation/promise-wrapper
24+
[docs-authentication-switch]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/authentication-switch
2525
[docs-streams]: https://sidorares.github.io/node-mysql2/docs/documentation/extras
2626
[docs-typescript-docs]: https://sidorares.github.io/node-mysql2/docs/documentation/typescript-examples
27-
[docs-qs-pooling]: https://sidorares.github.io/node-mysql2/docs#using-connection-pools
28-
[docs-qs-first-query]: https://sidorares.github.io/node-mysql2/docs#first-query
29-
[docs-qs-using-prepared-statements]: https://sidorares.github.io/node-mysql2/docs#using-prepared-statements
30-
[docs-examples]: https://sidorares.github.io/node-mysql2/docs/examples
31-
[docs-faq]: https://sidorares.github.io/node-mysql2/docs/faq
32-
[docs-documentation]: https://sidorares.github.io/node-mysql2/docs/documentation
33-
[docs-contributing]: https://sidorares.github.io/node-mysql2/docs/contributing/website
34-
[coverage]: https://img.shields.io/codecov/c/github/sidorares/node-mysql2
35-
[coverage-url]: https://app.codecov.io/github/sidorares/node-mysql2
36-
[ci-url]: https://github.com/sidorares/node-mysql2/actions/workflows/ci-coverage.yml?query=branch%3Amaster
37-
[ci-image]: https://img.shields.io/github/actions/workflow/status/sidorares/node-mysql2/ci-coverage.yml?event=push&style=flat&label=CI&branch=master
38-
39-
# MySQL2
27+
[docs-qs-pooling]: https://singlestore-labs.github.io/singlestore-nodejs/docs#using-connection-pools
28+
[docs-qs-first-query]: https://singlestore-labs.github.io/singlestore-nodejs/docs#first-query
29+
[docs-qs-using-prepared-statements]: https://singlestore-labs.github.io/singlestore-nodejs/docs#using-prepared-statements
30+
[docs-examples]: https://singlestore-labs.github.io/singlestore-nodejs/docs/examples
31+
[docs-faq]: https://singlestore-labs.github.io/singlestore-nodejs/docs/faq
32+
[docs-documentation]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation
33+
[docs-contributing]: https://singlestore-labs.github.io/singlestore-nodejs/docs/contributing
34+
[tests-image]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/tests.yml/badge.svg?branch=master
35+
[tests-url]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/tests.yml
36+
[gh-pages-image]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/gh-pages.yml/badge.svg?branch=master
37+
[gh-pages-url]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/gh-pages.yml
38+
[singlestore-docs]: https://docs.singlestore.com/
39+
40+
# SingleStore Node.js Driver
41+
42+
> SingleStore client for Node.js with focus on performance. Supports configurable connection behavior, prepared statements, compression, ssl and much more.
4043
4144
[![NPM Version][npm-image]][npm-url]
4245
[![NPM Downloads][downloads-image]][downloads-url]
4346
[![Node.js Version][node-version-image]][node-version-url]
44-
[![GitHub Workflow Status (with event)][ci-image]][ci-url]
45-
[![Codecov][coverage]][coverage-url]
47+
[![Tests][tests-image]][tests-url]
48+
[![GitHub Pages][gh-pages-image]][gh-pages-url]
4649
[![License][license-image]][license-url]
4750

48-
[English][docs-base] | [简体中文][docs-base-zh-CN] | [Português (BR)][docs-base-pt-BR]
49-
50-
> MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl [much more][docs-documentation].
51-
52-
**Table of Contents**
51+
## Table of Contents
5352

5453
- [History and Why MySQL2](#history-and-why-mysql2)
54+
- [Why SingleStore Node.js Driver](#why-singlestore-nodejs-driver)
5555
- [Installation](#installation)
56+
- [Quick Start](#quick-start)
57+
- [Migration from MySQL2](#migration-from-mysql2)
5658
- [Documentation](#documentation)
57-
- [Acknowledgements](#acknowledgements)
5859
- [Contributing](#contributing)
60+
- [Acknowledgments](#acknowledgments)
5961

6062
## History and Why MySQL2
6163

@@ -74,41 +76,89 @@ MySQL2 is mostly API compatible with [Node MySQL][node-mysql] and supports major
7476
- [Custom Streams][docs-streams]
7577
- [Pooling][docs-qs-pooling]
7678

77-
## Installation
79+
## Why SingleStore Node.js Driver
80+
81+
The SingleStore Node.js Driver is a fork of [mysql2][node-mysql2], adapted specifically for SingleStore database. Since SingleStore is MySQL wire-protocol compatible, most mysql2 features work seamlessly.
82+
83+
SingleStore Node.js Driver is mostly API compatible with [node-mysql][node-mysql] and [node-mysql2][node-mysql2] and supports majority of features.
7884

79-
MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues.
85+
- **Official SingleStore Support**: Officially supported by SingleStore for guaranteed compatibility and reliability
86+
- **Consistent Data Type Handling**: Handles SingleStore data types more consistently than generic MySQL drivers
87+
- **Configurable Connection Behavior**: Allows you to configure connection behavior by setting session variables
88+
- **MySQL Compatibility**: Maintains full compatibility with MySQL wire protocol
89+
90+
For more information about SingleStore, visit the [official documentation][singlestore-docs].
91+
92+
## Installation
8093

8194
```bash
82-
npm install --save mysql2
95+
npm install singlestore-nodejs
8396
```
8497

8598
If you are using TypeScript, you will need to install `@types/node`.
8699

87-
```bash
88-
npm install --save-dev @types/node
100+
## Quick Start
101+
102+
```javascript
103+
const singlestore = require('singlestore_nodejs');
104+
105+
// Create connection
106+
const connection = singlestore.createConnection({
107+
host: 'localhost',
108+
user: 'root',
109+
password: 'password',
110+
database: 'mydb',
111+
port: 3306,
112+
});
113+
114+
// Simple query
115+
connection.query('SELECT * FROM users', (err, results, fields) => {
116+
if (err) throw err;
117+
console.log(results);
118+
});
119+
120+
// Using promises
121+
connection
122+
.promise()
123+
.query('SELECT * FROM products')
124+
.then(([rows, fields]) => {
125+
console.log(rows);
126+
})
127+
.catch(console.error);
128+
129+
// Close connection
130+
connection.end();
89131
```
90132

91-
> For TypeScript documentation and examples, see [here][docs-typescript-docs].
133+
## Migration from MySQL2
134+
135+
SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward:
136+
137+
```javascript
138+
// Before (MySQL2)
139+
const mysql = require('mysql2');
140+
const connection = mysql.createConnection({...});
141+
142+
// After (SingleStore Node.js Driver)
143+
const singlestore = require('singlestore_nodejs');
144+
const connection = singlestore.createConnection({...});
145+
146+
// All existing queries work as-is!
147+
```
92148

93149
## Documentation
94150

95-
- [Quickstart][docs-base]
96-
- [First Query][docs-qs-first-query], [Using Prepared Statements][docs-qs-using-prepared-statements], [Using Connection Pools][docs-qs-pooling] and more.
97-
- [Documentation][docs-documentation]
151+
📚 **Full documentation:** [SingleStore Nodejs Driver][docs-base]
152+
153+
- [Getting Started][docs-documentation]
98154
- [Examples][docs-examples]
99155
- [FAQ][docs-faq]
100-
101-
## Acknowledgements
102-
103-
- Internal protocol is written by [@sidorares][sidorares] [MySQL-Native][mysql-native].
104-
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [Node MySQL][node-mysql].
105-
- SSL upgrade code based on [@TooTallNate][TooTallNate] [code][starttls.js].
106-
- Secure connection / compressed connection api flags compatible to [MariaSQL][node-mariasql] client.
107-
- [Contributors][contributors].
156+
- [API Reference][docs-api]
108157

109158
## Contributing
110159

111-
Want to improve something in **MySQL2**?
112-
Please check [Contributing.md][contributing] for detailed instruction on how to get started.
160+
Contributions are welcome! Please see [Contributing.md](Contributing.md) for details.
161+
162+
## Acknowledgments
113163

114-
To contribute in **MySQL2 Documentation**, please visit the [Website Contributing Guidelines][docs-contributing] for detailed instruction on how to get started.
164+
This project is a fork of [mysql2](https://github.com/sidorares/node-mysql2) by @sidorares. We are grateful for the excellent foundation provided by the MySQL2 project.
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
# API and Configuration
22

33
[node-mysql]: https://github.com/mysqljs/mysql
4+
[node-mysql2]: https://github.com/sidorares/node-mysql2
5+
[singlestore-docs]: https://docs.singlestore.com/
46

5-
MySQL2 is mostly API compatible with [Node MySQL][node-mysql].
7+
SingleStore Node.js Driver is mostly API compatible with [node-mysql2][node-mysql2] and [Node MySQL][node-mysql]. Since SingleStore is MySQL wire-protocol compatible, most existing MySQL client code works seamlessly.
8+
9+
## Known Incompatibilities
610

711
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.
812

13+
## Migration from MySQL2
14+
15+
SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward:
16+
17+
```javascript
18+
// Before (MySQL2)
19+
const mysql = require('mysql2');
20+
const connection = mysql.createConnection({...});
21+
22+
// After (SingleStore Node.js Driver)
23+
const singlestore = require('singlestore_nodejs');
24+
const connection = singlestore.createConnection({...});
25+
26+
// All existing queries work as-is!
27+
```
28+
929
:::info
10-
If you find any other incompatibility with [Node MySQL][node-mysql], Please report via Issue tracker. We will fix reported incompatibility on priority basis.
30+
If you find any incompatibility with [node-mysql2][node-mysql2] or issues specific to SingleStoreDB, please report via GitHub issue. We will address reported issues on priority basis.
1131
:::
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
slug: /contributing
3-
title: MySQL2
3+
title: SingleStore-Nodejs
44
---
55

66
import { PageTitle } from '@site/src/components/PageTitle';
@@ -9,5 +9,5 @@ import { PageTitle } from '@site/src/components/PageTitle';
99

1010
# Contributing
1111

12-
Want to improve something in **MySQL2**?
13-
Please check [Contributing.md](https://github.com/sidorares/node-mysql2/blob/master/Contributing.md) for detailed instruction on how to get started.
12+
Want to improve something in **singlestore-nodejs**?
13+
Please check [Contributing.md](https://github.com/singlestore-labs/singlestore-nodejs/blob/master/Contributing.md) for detailed instruction on how to get started.

website/docs/contributing/website.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ You will need these tools installed on your system:
2323

2424
## Development
2525

26-
1. Fork the [MySQL2](https://github.com/sidorares/node-mysql2) repository.
27-
2. Download your forked repository locally. The website's workspace is the "_website_" directory in **node-mysql2** root.
26+
1. Fork the [SingleStore Node.js Driver](https://github.com/singlestore-labs/singlestore-nodejs) repository.
27+
2. Download your forked repository locally. The website's workspace is the "_website_" directory in **singlestore-nodejs** root.
2828
3. Create a new branch from `master` (optional).
2929
4. Run `cd website` to enter the website workspace.
30-
5. Run `npm ci` to install the dependecies from _package-lock.json_.
31-
6. Run `npm start` to starting the local development.
30+
5. Run `npm ci` to install the dependencies from _package-lock.json_.
31+
6. Run `npm start` to start the local development.
3232

3333
> It will start a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
3434
@@ -37,9 +37,9 @@ For **Docusaurus** complete documentation, please [see here](https://docusaurus.
3737
<FAQ title='CLI example'>
3838

3939
```bash
40-
git clone https://github.com/sidorares/node-mysql2.git
40+
git clone https://github.com/singlestore-labs/singlestore-nodejs.git
4141
git checkout -b website # optional
42-
cd /path-to/node-mysql2/website
42+
cd /path-to/singlestore-nodejs/website
4343
npm ci
4444
npm start
4545
```
@@ -55,7 +55,7 @@ Documentation is auto-generated from **MDX** files placed in these directories:
5555
:::danger Caution
5656
Note that the website has its own _package.json_.
5757

58-
Please, do not install dependencies for the website in **node-mysql2** root.
58+
Please, do not install dependencies for the website in **singlestore-nodejs** root.
5959
:::
6060

6161
<hr />
@@ -181,12 +181,12 @@ import { ExternalCodeEmbed } from '@site/src/components/ExternalCodeEmbed';
181181

182182
<FAQ title='Example'>
183183
<ExternalCodeEmbed
184-
url='https://raw.githubusercontent.com/sidorares/node-mysql2/master/.prettierrc'
184+
url='https://raw.githubusercontent.com/singlestore-labs/singlestore-nodejs/master/.prettierrc'
185185
language='json'
186186
/>
187187

188188
<ExternalCodeEmbed
189-
url='https://raw.githubusercontent.com/sidorares/node-mysql2/master/tools/parse-row.js'
189+
url='https://raw.githubusercontent.com/singlestore-labs/singlestore-nodejs/master/tools/parse-row.js'
190190
language='js'
191191
extractMethod='parseC'
192192
methodType='function'

website/docs/documentation/00-index.mdx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,31 @@ import { PageTitle } from '@site/src/components/PageTitle';
1010
# Documentation
1111

1212
[node-mysql]: https://github.com/mysqljs/mysql
13+
[node-mysql2]: https://github.com/sidorares/node-mysql2
14+
[singlestore-docs]: https://docs.singlestore.com/
1315

14-
MySQL2 aims to be a drop in replacement for [Node MySQL][node-mysql].
16+
**singlestore-nodejs** is a Node.js driver for SingleStoreDB, forked from [node-mysql2][node-mysql2]. It maintains compatibility with [Node MySQL][node-mysql] while providing optimized support for SingleStoreDB features.
1517

1618
:::note
17-
_If you see any API incompatibilities with [Node MySQL][node-mysql], please report via github issue._
19+
_This driver is based on [node-mysql2][node-mysql2] and maintains API compatibility. If you encounter any problems, please report via GitHub issues._
1820
:::
1921

20-
Not only **MySQL2** offers better performance over [Node MySQL][node-mysql], we also support these additional features:
22+
**singlestore-nodejs** offers:
2123

2224
- [Prepared Statements](/docs/documentation/prepared-statements)
2325
- [Promise Wrapper](/docs/documentation/promise-wrapper)
2426
- [Authentication Switch](/docs/documentation/authentication-switch)
2527
- [More Features](/docs/documentation/extras)
26-
- [MySQL Server](/docs/documentation/mysql-server)
28+
- [SingleStore Server][singlestore-docs]
2729
- Pooling
2830
- [SSL](/docs/documentation/ssl)
29-
- MySQL Compression
30-
- Binary Log Protocol Client
31+
- Compression
3132

3233
<hr />
3334

3435
## Examples
3536

36-
Please check these [examples](/docs/examples) for **MySQL2**.
37+
Please check these [examples](/docs/examples) for **singlestore-nodejs**.
3738

3839
<hr />
3940

@@ -66,17 +67,13 @@ This option could lose precision on the number as Javascript Number is a Float!
6667

6768
## Other Resources
6869

69-
- [Wire protocol documentation](https://dev.mysql.com/doc/internals/en/client-server-protocol.html)
70-
- [Node MySQL][node-mysql] - Most popular node.js mysql client library
71-
- [node-mariasql](https://github.com/mscdex/node-mariasql/) - Bindings to libmariasql. One of the fastest clients
72-
- [node-libmysqlclient](https://github.com/Sannis/node-mysql-libmysqlclient) - Bindings to libmysqlclient
73-
- [go-mysql](https://github.com/siddontang/go-mysql) - MySQL Go client (prepared statements, binlog protocol, server)
70+
- [SingleStoreDB Documentation][singlestore-docs]
71+
- [MySQL Wire Protocol Documentation](https://dev.mysql.com/doc/internals/en/client-server-protocol.html)
72+
- [node-mysql2][node-mysql2] - The upstream MySQL client library this driver is based on
7473

7574
<hr />
7675

7776
## Benchmarks
7877

79-
- https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b
8078
- `npm run benchmarks`
81-
- [node-mysql-benchmarks](https://github.com/mscdex/node-mysql-benchmarks)
82-
- try to run example [benchmarks](https://github.com/sidorares/node-mysql2/tree/master/benchmarks) on your system
79+
- try to run example [benchmarks](https://github.com/singlestore-labs/singlestore-nodejs/tree/master/benchmarks) on your system

0 commit comments

Comments
 (0)