# emysql **Repository Path**: osdpape/e-mysql ## Basic Information - **Project Name**: emysql - **Description**: 🛠️ Based on mysql basic secondary packaging, the pursuit of creating a simple and easy to use mysql-ORM library - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: http://emysql.dpapejs.cn/ - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-05-23 - **Last Updated**: 2025-07-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # emysql ![npm](https://img.shields.io/npm/v/@dpapejs/emysql) ![npm](https://img.shields.io/npm/dm/@dpapejs/emysql) ![NPM](https://img.shields.io/npm/l/@dpapejs/emysql) #### 介绍 🛠️ 基于 `mysql` 基础二次封装,追求打造简单、好用的 `mysql-ORM` 库. #### 安装教程 ```sh npm i @dpapejs/emysql@latest -S ``` #### 使用说明 ```ts import emysql from '@dpapejs/emysql' // 引用库 // 函数实例化 const mysql = new emysql({ password: '[database login password]', user: '[database login username]', database: 'database name' }) // 创建表结构 await mysql.table.create([ { tableName: 'create_table', columns: [ { name: 'id', dataType: 'INT', primaryKey: true, autoIncrement: true, comments: '主键id' }, { name: 'name', dataType: 'VARCHAR', length: 45, notNull: true, comments: '名称' }, { name: 'create_at', dataType: 'DATETIME', notNull: true, comments: '创建时间' } ] } ]) // 插入数据 const now = new Date() await mysql.change.insert({ t: 'create_table', params: { name: 'test', create_at: now } }) // 查询数据 const list = await mysql.query({ t: 'query_test', fields: ['name', 'id'], condition: { id: 1 } }) console.log(list) // [{id:1,name:"test"}] ```