Skip to content

Commit

Permalink
feat(mysql, mongo): support custom tables
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 18, 2021
1 parent 49c2c39 commit 875f75b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/plugin-mongo/src/database.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { MongoClient, Db, Collection } from 'mongodb'
import { App, Channel, Database, Tables, TableType, User } from 'koishi-core'
import { App, Channel, Database, User, Tables as KoishiTables } from 'koishi-core'
import { URLSearchParams } from 'url'

type TableType = keyof Tables

export interface Tables extends KoishiTables {}

export interface Config {
username?: string
password?: string
Expand Down
6 changes: 5 additions & 1 deletion packages/plugin-mysql/src/database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPool, Pool, PoolConfig, escape as mysqlEscape, escapeId, format, OkPacket, TypeCast } from 'mysql'
import { TableType, Tables, App, Database } from 'koishi-core'
import { Tables as KoishiTables, App, Database } from 'koishi-core'
import { Logger } from 'koishi-utils'
import { types } from 'util'

Expand All @@ -9,6 +9,10 @@ declare module 'mysql' {
}
}

type TableType = keyof Tables

export interface Tables extends KoishiTables {}

const logger = new Logger('mysql')

export interface Config extends PoolConfig {}
Expand Down

0 comments on commit 875f75b

Please sign in to comment.