⚠️ DEPRECATED⚠️ The official MySQL Connector for NodeJS has already been written in TypeScript for a while now, so this wrapper is not required anymore.
Typed MySQL X Dev API (mysqlx)
Typed MySQL X Dev API (mysqlx) is a staticly typed wrapper for the official MySQL Connector for NodeJS using the X Protocol.
List of Contents
Getting Started
This library is available through package manager (npm and yarn). Use package manager to add this library to your project.
# If you're using NPM
npm install --save mysqlx
# If you're using Yarn
yarn add mysqlx
Then, imports mysqlx in your project.
var mysqlx = require("mysqlx");
// Or using ES6 imports
import mysqlx from "mysqlx";
Documentation
Because mysqlx is static type wrapper over the official MySQL Connector/Node.js library, the documentation follows the official documentation of MySQL NodeJS Connector, with some exception listed below.
- DataCursor is removed, replaced by getDocuments() function in the returned response object.
- RowCursor is removed, replaced by getRows() and getObjects() function in the returned response object.
- MetadataCursor is removed, replaced by getMetadata() function in the returned response object.
These changes implements new way to expose execution results. As for example how the new way works, see this example.
const docs = [];
await collection.find()
.execute(doc => docs.push(doc));
console.log(docs);
Code above is using data cursors to collect execution results, as stated in the official documentation. With this library, you should instead using this code below.
const result = await collection.find()
.execute();
const docs = result.getDocuments();
console.log(docs);
Built With
Written in TypeScript, built into ECMAScript 3 using the TypeScript compiler.
Contribution
To contribute, fork this project, and issue a pull request. Always follows the documentation for implementation guidelines.
Version Management
We use SemVer for version management. For the versions available, see the tags on this repository.
Authors
- Danang Galuh Tegar Prasetyo - Initial work - danang-id
See also the list of contributors who participated in this project.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Acknowledgments
- Static wrapper of MySQL Connector/Node.js library.