Skip to content

A set of database common operations functions for MySQL.

License

Notifications You must be signed in to change notification settings

hiowenluke/mypower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

  • my.connectServer() *
  • my.isServerOnline() *
  • my.switchToServer() *
  • my.backupAllDatabases() *
  • my.backupDatabase() *
  • my.cloneDatabase() *
  • my.cloneDatabaseStructure() *
  • my.renameDatabase()
  • my.restoreAllDatabases() *
  • my.restoreDatabase() *
  • my.createDatabase() *
  • my.deleteDatabase() *
  • my.dropDatabase() *
  • my.getDatabasesName() *
  • my.getSelectedDatabase() *
  • my.isDatabaseExists() *
  • my.showDatabases() *
  • my.useDatabase() *
  • 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()
  • my.addPrimaryKey()
  • my.addPrimaryKeys()
  • my.getPrimaryKey()
  • my.getPrimaryKeys()
  • my.getMaxFieldValue()
  • my.getMaxId()
  • my.getMaxPrimaryKeyValue()
  • my.getMaxRecord()
  • my.getMinFieldValue()
  • my.getMinId()
  • my.getMinRecord()
  • my.isRecordExists()
  • my.recordsCount()
  • my.getSystemVariable()
  • my.getSystemVariables()
  • my.getVersion()
  • my.getWarningCount()
  • my.isSuccessful()
  • 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

Crud

  • my.next()
  • my.previous()

Paging

Test

git clone https://github.com/hiowenluke/mypower
cd mypower
npm install
npm test

License

MIT

Copyright (c) 2019, Owen Luke

About

A set of database common operations functions for MySQL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published