Skip to content

Commit 4cf93ce

Browse files
authored
feat: add more type definition for mysql.get method (#20)
1 parent 4137cfc commit 4cf93ce

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ interface EggMySqlConfig {
2727

2828
type EggMySQLInsertResult = object[];
2929
type EggMySQLSelectResult = object[];
30+
type EggMySQLGetResult = object;
3031
interface EggMySQLCondition {
3132
where?: object;
3233
orders?: [string, "desc" | "asc" | "DESC" | "ASC"][];
@@ -53,7 +54,12 @@ interface EggMySQLLiterals {
5354
interface EggMySQL {
5455
literals: EggMySQLLiterals;
5556
/// Returns mysql client instance.
56-
get: (dbName: string) => EggMySQL;
57+
get(dbName: string): EggMySQL;
58+
get(
59+
table: string,
60+
where?: object,
61+
condition?: EggMySQLCondition
62+
): Promise<EggMySQLGetResult>;
5763
/// execute sql e.g.
5864
/// query('update posts set hits = (hits + ?) where id = ?', [1, postId])
5965
query: (

0 commit comments

Comments
 (0)