forked from eggjs/egg-mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
43 lines (35 loc) · 866 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as mongoose from 'mongoose';
declare module 'egg' {
type MongooseModels = {
[key: string]: mongoose.Model<any>
};
type MongooseSingleton = {
clients: Map<string, mongoose.Connection>,
get (id: string) : mongoose.Connection
};
type MongooseConfig = {
url: string,
options?: mongoose.ConnectionOptions
};
// extend app
interface Application {
mongooseDB: mongoose.Connection | MongooseSingleton;
mongoose: typeof mongoose;
model: MongooseModels;
}
// extend context
interface Context {
model: MongooseModels;
}
// extend your config
interface EggAppConfig {
mongoose: {
url?: string,
options?: mongoose.ConnectionOptions,
client?: MongooseConfig,
clients?: {
[key: string]: MongooseConfig
}
};
}
}