@mmstudio/an000049
v4.0.0
Published
数据库操作
Downloads
12
Readme
数据库操作
操作数据库,支持多种数据库
postgresql
yarn add pg
{
"dbconfig":{
"client": "mysql",
"connection": {
"host": "127.0.0.1",
"user": "your_database_user",
"password": "your_database_password",
"database": "myapp_test"
}
}
}
{
"dbconfig":{
"client": "pg",
"connection": "pgconnectstring",
"searchPath": [
"knex",
"public"
]
}
}
{
"dbconfig":{
"client": "pg",
"version": "7.2",
"connection": {
"host": "127.0.0.1",
"user": "your_database_user",
"password": "your_database_password",
"database": "myapp_test"
}
}
}
mysql/mariadb
yarn add mysql2
or
yarn add mysql
mm.json
{
"dbconfig":{
"client": "mysql",
"version": "5.7",
"connection": {
"host": "127.0.0.1",
"user": "your_database_user",
"password": "your_database_password",
"database": "myapp_test"
}
}
}
{
"dbconfig":{
"client": "mysql",
"connection": {
"host": "127.0.0.1",
"user": "your_database_user",
"password": "your_database_password",
"database": "myapp_test"
},
"userParams": {
"userParam1": "451"
}
}
}
{
"dbconfig":{
"client": "mysql",
"connection": {
"host": "127.0.0.1",
"user": "your_database_user",
"password": "your_database_password",
"database": "myapp_test"
},
"pool": {
"min": 0,
"max": 7
}
}
}
oracle
yarn add oracledb
{
"dbconfig":{
"client": "oracledb",
"connection": {},
"fetchAsString": [
"number",
"clob"
]
}
}
sqlite
yarn add sqlite3
{
"dbconfig":{
"client": "sqlite3",
"connection": {
"filename": "./mydb.sqlite"
}
}
}
mssqlserver
yarn add mssql
{
"dbconfig":{
"client": "mssql",
"connection": {
}
}
}