@dlovely/mysql
v1.1.0
Published
对mysql的简易连接,能创建数据库、数据表管理,并使用sql编辑器
Downloads
7
Readme
mysql-manager
目录
- 快速入门
- 客户端
- 数据库
- 数据表
- 数据表操作
- 增
- 删
- 改
- 查
- 联表
快速入门
安装
# npm
$ npm install --save @dlovely/mysql
# yarn
$ yarn add @dlovely/mysql
# pnpm
$ pnpm add @dlovely/mysql
使用
// mysql-table.ts
export const table1_columns = [
{ name: 'id', readonly: true, not_null: true, has_defa: true },
{ name: 'name', readonly: false, not_null: true, has_defa: false }
]
// mysql.ts
import { createMySqlPool } from '@dlovely/mysql'
import { table1_columns } from './mysql-table'
const server = createMySqlPool()
export const database = server.createDataBase('database')
export const table1 = database.createTable('table1', table1_columns)
// index.ts
import { table1 } from './mysql'
!async function() {
const result = await table1.select()
console.log(result)
}