mypower

    0.9.2 • Public • Published

    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

    Crud

    Goto

    • 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

    Keywords

    none

    Install

    npm i mypower

    DownloadsWeekly Downloads

    44

    Version

    0.9.2

    License

    MIT

    Unpacked Size

    113 kB

    Total Files

    137

    Last publish

    Collaborators

    • avatar