Skip to content

simple-orm/mysql-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple ORM MySQL Adapter

Mysql (and MariaDB) adapter for simple orm.

Tests

There are no tests in this repository, tests are handled with the core repository.

Feature Support

  • Transactions - Supported
  • Joins - Supported

Quick Start

You can install this data adapter with:

npm install simple-orm-data-adapter

The data adapter does not assume anything with the creation of the database connection, you are free to create the connection however you want. To create an instance of the data adapter, you need to pass the require an object with a property called connection. you could do something like this:

//mysql-connection.js
var mysql = require('mysql');
var configuration = require('../configurations/data.json');

module.exports = {
  connection: mysql.createConnection({
    host: configuration.host,
    user: configuration.username,
    password: configuration.password,
    port: configuration.port,
    database: configuration.database
  })
};
var mysqlAdapter = require('simple-orm-mysql-adapter').create();
mysqlAdapter.setConnection(require('./mysql-connection'));

LICENSE

MIT