# mysql-dal **Repository Path**: npm-packages/mysql-dal ## Basic Information - **Project Name**: mysql-dal - **Description**: mysql-orm mini package - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-27 - **Last Updated**: 2022-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mysql-dal ## About a mysql-orm mini package ## How use ### First make a mysql-config.js file ```javascript // mysql config file like this: module.exports = { connectionLimit: 10, host: '127.0.0.1', user: 'root', password: 'your password', port: 3306, database: 'db-name' } ``` ### And then new class ```javascript let SqlDal=require('mysql-dal'); let config=require('./mysql-config'); let sqlDal=new SqlDal(config,'tb_user'); sqlDal.findAll().then(console.log,console.log); ``` ### API ```javascript query(sqlStr, params):Promise insert(entity):Promise truncate():Promise remove(whereStr):Promise removeById(id):Promise update(entity, whereStr):Promise updateByParams(entity, where):Promise updateById(entity, id):Promise findAll(columns,orderStr):Promise findById(id):Promise findOne(query):Promise findWithQuery(query):Promise findTop(columns, count, whereStr):Promise findCount(fromStr, whereStr):Promise find(columns, whereStr, sortStr, count):Promise findByPage(fieldStr, fromStr, whereStr, sortStr, pageIndex, pageSize):Promise getTableNames(tableName):Promise findColumnName(tableName):Promise findMaxId(tableName):Promise ```