Browse Source

Initial commit

emp
Luke Childs 7 years ago
committed by Jytesh
parent
commit
d4e110f671
  1. 75
      packages/keyv-mysql/.gitignore
  2. 14
      packages/keyv-mysql/.travis.yml
  3. 21
      packages/keyv-mysql/LICENSE
  4. 28
      packages/keyv-mysql/README.md
  5. 56
      packages/keyv-mysql/package.json
  6. 19
      packages/keyv-mysql/src/index.js
  7. 9
      packages/keyv-mysql/test/test.js

75
packages/keyv-mysql/.gitignore

@ -0,0 +1,75 @@
## Node
#npm5
package-lock.json
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
## OS X
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

14
packages/keyv-mysql/.travis.yml

@ -0,0 +1,14 @@
language: node_js
node_js:
- '8'
- '6'
- '4'
services:
- mysql
before_script:
- mysql -e 'CREATE DATABASE keyv_test;'
script: npm test
after_success: npm run coverage
notifications:
email:
on_success: never

21
packages/keyv-mysql/LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Luke Childs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28
packages/keyv-mysql/README.md

@ -0,0 +1,28 @@
# keyv-mysql
> MySQL storage adapter for Keyv
[![Build Status](https://travis-ci.org/lukechilds/keyv-mysql.svg?branch=master)](https://travis-ci.org/lukechilds/keyv-mysql)
[![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-mysql/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-mysql?branch=master)
[![npm](https://img.shields.io/npm/v/keyv-mysql.svg)](https://www.npmjs.com/package/keyv-mysql)
## Install
```shell
npm install --save keyv-mysql
```
## Usage
```js
const Keyv = require('keyv');
const KeyvMysql = require('keyv-mysql');
const mysql = new KeyvMysql('mysql://user:pass@host/db');
const keyv = new Keyv({ store: mysql });
```
## License
MIT © Luke Childs

56
packages/keyv-mysql/package.json

@ -0,0 +1,56 @@
{
"name": "keyv-mysql",
"version": "0.0.0",
"description": "MySQL storage adapter for Keyv",
"main": "src/index.js",
"scripts": {
"test": "xo && nyc ava",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"xo": {
"extends": "xo-lukechilds"
},
"ava": {
"require": [
"requireable"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/lukechilds/keyv-mysql.git"
},
"keywords": [
"mysql",
"mariadb",
"sql",
"keyv",
"storage",
"adapter",
"key",
"value",
"store",
"cache",
"ttl"
],
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
"license": "MIT",
"bugs": {
"url": "https://github.com/lukechilds/keyv-mysql/issues"
},
"homepage": "https://github.com/lukechilds/keyv-mysql",
"dependencies": {
"keyv-sequelize": "0.1.0",
"mysql2": "^1.3.6"
},
"devDependencies": {
"ava": "^0.21.0",
"coveralls": "^2.13.1",
"eslint-config-xo-lukechilds": "^1.0.0",
"keyv": "*",
"keyv-test-suite": "*",
"nyc": "^11.0.3",
"requireable": "^1.0.1",
"this": "^1.0.2",
"xo": "^0.19.0"
}
}

19
packages/keyv-mysql/src/index.js

@ -0,0 +1,19 @@
'use strict';
const KeyvSequelize = require('keyv-sequelize');
class KeyvMysql extends KeyvSequelize {
constructor(opts) {
if (typeof opts === 'string') {
opts = { uri: opts };
}
opts = Object.assign({
dialect: 'mysql',
uri: 'mysql://localhost'
}, opts);
super(opts);
}
}
module.exports = KeyvMysql;

9
packages/keyv-mysql/test/test.js

@ -0,0 +1,9 @@
import test from 'ava';
import keyvTestSuite, { keyvOfficialTests } from 'keyv-test-suite';
import Keyv from 'keyv';
import KeyvMysql from 'this';
keyvOfficialTests(test, Keyv, 'mysql://localhost/keyv_test', 'mysqlql://foo');
const store = () => new KeyvMysql('mysql://localhost/keyv_test');
keyvTestSuite(test, Keyv, store);
Loading…
Cancel
Save