egg-mariadb
v1.2.5
Published
egg Plugin for mariadb
Downloads
32
Readme
egg-mariadb
Install
$ npm i egg-mariadb --save
Usage
// {app_root}/config/plugin.js
exports.mariadb = {
enable: true,
package: 'egg-mariadb',
};
Configuration
// {app_root}/config/config.default.js
exports.mariadb = {
};
see config/config.default.js for more detail.
Example
const where = [
{ password: 'xxxxxxxxxxxxxxxx' }, sql: `password` = 'xxxx'
[{ account: 'xxxx' }, { $OR: 'OR' }, { account: 'hongyang' }], sql: (`account` = 'xxxx' OR account = 'hongyang')
{ id: { $in: ['1', '2'] } }, sql: `id` IN ('1', '2')
{ id: { $notIn: ['1', '2'] } }, sql: `id` NOT IN ('1', '2')
{ $concatLike: [['nickName', 'gender'], '%章%'] }, sql: CONCAT(`nickName`, `gender`) LIKE '%章%'
{ id: {$uneq: '1'}}, sql: `id` <> '1'
{ id: {$great: 2}}, sql: `id` > 2
{ id: {$lengGreat: 3}}, sql: LENGTH(`id`) > 3
{ id: {$less: 4}}, sql: `id` < 4
{ id: {$lengLess: '5'}}, sql: LENGTH(`id`) < 5
{ channel: { $between: [0, 3] } }, sql: channel BETWEEN 0 AND 3
{ $unNull: 'gender' }, sql: `gender` IS NOT NULL
{ $null: 'gender' }, sql: `gender` IS NULL
{ nickName: { $like: '%章%' } } sql: `nickName` LIKE '%章%'
{ name: { $column: 'nickName' } } sql: `name` = `nickName`
]
// 连接符为AND
Questions & Suggestions
Please open an issue here.