mypower
v0.9.2
Published
A set of database common operations functions for MySQL. In particular, you can operate the database on the specific server, the operations include create, delete, drop, use, backup, restore, clone.
Downloads
31
Readme
MyPower
A set of database common operations functions for MySQL. In particular, you can operate the database on the specific server, the operations include create, delete, drop, use, backup, restore, clone.
Install
npm i mypower --save
Usage
Initialize
Initialize MyPower first:
// Your mysql configuration
const config = {
database: 'sys',
username: 'root',
password: 'playboy',
host: '127.0.0.1',
port: 3306,
};
const my = require('mypower');
my.init(config);
Click below links to see usages (from test cases).
The * indicates that databases on other servers can be operated remotely.
Server
- my.connectServer() *
- my.isServerOnline() *
- my.switchToServer() *
Manager
- my.backupAllDatabases() *
- my.backupDatabase() *
- my.cloneDatabase() *
- my.cloneDatabaseStructure() *
- my.renameDatabase()
- my.restoreAllDatabases() *
- my.restoreDatabase() *
Database
- my.createDatabase() *
- my.deleteDatabase() *
- my.dropDatabase() *
- my.getDatabasesName() *
- my.getSelectedDatabase() *
- my.isDatabaseExists() *
- my.showDatabases() *
- my.useDatabase() *
Field
- my.addField()
- my.addFields()
- my.changeField()
- my.changeFieldName()
- my.changeFieldType()
- my.changeFields()
- my.convertFieldTypeDefToStr()
- my.deleteField()
- my.deleteFields()
- my.fieldTypes
- my.getAutoIdName()
- my.getFieldNames()
- my.getFieldNamesWithoutAutoId()
- my.getFieldType()
- my.getFieldTypeStr()
- my.getFieldsInfo()
- my.isFieldExists()
- my.updateField()
- my.updateFields()
PrimaryKey
- my.addPrimaryKey()
- my.addPrimaryKeys()
- my.getPrimaryKey()
- my.getPrimaryKeys()
Record
- my.getMaxFieldValue()
- my.getMaxId()
- my.getMaxPrimaryKeyValue()
- my.getMaxRecord()
- my.getMinFieldValue()
- my.getMinId()
- my.getMinRecord()
- my.isRecordExists()
- my.recordsCount()
System
- my.getSystemVariable()
- my.getSystemVariables()
- my.getVersion()
- my.getWarningCount()
- my.isSuccessful()
Table
- my.cloneTable()
- my.cloneTableStructure()
- my.copyTableData()
- my.createTable()
- my.deleteTable()
- my.deleteTables()
- my.descTable()
- my.dropTable()
- my.dropTables()
- my.isEmptyTable()
- my.isTableExists()
- my.moveTable()
- my.renameTable()
- my.showTables()
- my.truncateTable()
Query
- my.exec()
- my.execSp()
- my.count()
Crud
Goto
- my.next()
- my.previous()
Paging
Test
git clone https://github.com/hiowenluke/mypower
cd mypower
npm install
npm test
License
Copyright (c) 2019, Owen Luke