typespeed 2.0.16 → 2.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,105 +2,295 @@ import * as express from "express";
2
2
  import IoRedis from "ioredis";
3
3
  import "reflect-metadata";
4
4
 
5
-
5
+ /**设置路由中间件 */
6
6
  declare function setRouter(app: express.Application): void;
7
+ /**上传文件装饰器,装饰页面具备解析上传文件的能力 */
7
8
  declare function upload(target: any, propertyKey: string): void;
9
+ /**
10
+ * 页面支持 JWT 鉴权能力
11
+ * @param jwtConfig jwt 配置
12
+ */
8
13
  declare function jwt(jwtConfig: any): (target: any, propertyKey: string) => void;
14
+ /**
15
+ * GET 请求装饰器
16
+ * @param value 请求路径
17
+ */
9
18
  declare const getMapping: (value: string) => (target: any, propertyKey: string) => void;
19
+ /**
20
+ * POST 请求装饰器
21
+ * @param value 请求路径
22
+ */
10
23
  declare const postMapping: (value: string) => (target: any, propertyKey: string) => void;
24
+ /**
25
+ * 请求装饰器,不区分请求类型
26
+ * @param value 请求路径
27
+ */
11
28
  declare const requestMapping: (value: string) => (target: any, propertyKey: string) => void;
12
-
29
+ /**
30
+ * INSERT 装饰器
31
+ * 将方法作为 INSERT SQL 使用
32
+ * @param sql INSERT SQL 语句
33
+ */
13
34
  declare function insert(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
35
+ /**
36
+ * UPDATE 装饰器
37
+ * 将方法作为 UPDATE SQL 使用
38
+ * @param sql UPDATE SQL 语句
39
+ */
14
40
  declare function update(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
41
+ /**
42
+ * DELETE 装饰器
43
+ * 将方法作为 DELETE SQL 使用
44
+ * @param sql DELETE SQL 语句
45
+ */
15
46
  declare function remove(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
47
+ /**
48
+ * SELECT 装饰器
49
+ * 将方法作为 SELECT SQL 使用
50
+ * @param sql SELECT SQL 语句
51
+ */
16
52
  declare function select(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
53
+ /**
54
+ * SELECT 结果类型装饰器,和 @select 配合使用
55
+ * @param dataClass 结果类型
56
+ */
17
57
  declare function resultType(dataClass: any): (target: any, propertyKey: string) => void;
58
+ /**
59
+ * SQL 参数装饰器,标注 SQL 语句的绑定参数值,和 @select @insert @update @remove 配合使用
60
+ * @param name 参数在 SQL 语句内的标记值
61
+ */
18
62
  declare function param(name: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
63
+ /**
64
+ * SELECT 缓存装饰器,自动缓存 SELECT 查询结果,和 @select 配合使用
65
+ * 当执行 @insert @update @remove 时,会自动清除缓存。
66
+ * @param ttl 缓存时间,单位秒
67
+ */
19
68
  declare function cache(ttl: number): (target: any, propertyKey: string) => void;
69
+ /**模型数据操作类 */
20
70
  declare class Model {
71
+ /**分页数据 */
21
72
  page: any;
22
73
  private table;
23
74
  constructor(table?: string);
75
+ /**
76
+ * 查询多条数据
77
+ * @param conditions 查询条件,支持对象和字符串
78
+ * @param sort 排序字段
79
+ * @param fields 定义返回字段
80
+ * @param limit 限制返回数据条数
81
+ */
24
82
  findAll<T>(conditions: object | string, sort?: string | object, fields?: string | [string], limit?: number | object): Promise<T[]>;
83
+ /**
84
+ * 插入数据,支持单条或多条数据同时插入
85
+ * @param rows 插入数据,支持对象和数组;对象为单条数据,数组为多条数据。
86
+ */
25
87
  create(rows: any): Promise<number>;
88
+ /**
89
+ * 查询单条数据
90
+ * @param conditions 查询条件,支持对象和字符串
91
+ * @param sort 排序字段
92
+ * @param fields 定义返回字段
93
+ */
26
94
  find<T>(conditions: any, sort: any, fields?: string): Promise<T>;
95
+ /**
96
+ * 更新数据
97
+ * @param conditions 更新条件,支持对象和字符串,符合条件的数据将被更新
98
+ * @param fieldToValues 更新字段和值
99
+ */
27
100
  update(conditions: any, fieldToValues: any): Promise<number>;
101
+ /**
102
+ * 删除数据
103
+ * @param conditions 删除条件,支持对象和字符串,符合条件的数据将被删除
104
+ */
28
105
  delete(conditions: any): Promise<number>;
106
+ /**
107
+ * 查询数据条数,返回符合条件的记录条数
108
+ * @param conditions 查询条件,支持对象和字符串
109
+ */
29
110
  findCount(conditions: any): Promise<number>;
111
+ /**
112
+ * 增加字段值
113
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被增加
114
+ * @param field 需要增加的字段
115
+ * @param optval 增加数量值,默认为 1
116
+ */
30
117
  incr(conditions: any, field: any, optval?: number): Promise<number>;
118
+ /**
119
+ * 减少字段值
120
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被减少
121
+ * @param field 需要减少的字段
122
+ * @param optval 减少数量值,默认为 1
123
+ */
31
124
  decr(conditions: any, field: any, optval?: number): Promise<number>;
125
+ /**
126
+ * 计算分页数据
127
+ * @param page 当前页码
128
+ * @param total 记录总条数
129
+ * @param pageSize 每页显示条数
130
+ * @param scope 分页显示页码数量
131
+ */
32
132
  pager(page: any, total: any, pageSize?: number, scope?: number): any;
33
133
  private where;
34
134
  private range;
35
135
  }
36
-
136
+ /**
137
+ * 应用程序入口装饰器
138
+ *
139
+ * 被装饰的类将作为应用程序入口,框架将启动该类的 main 方法
140
+ */
37
141
  declare function app<T extends {
38
142
  new (...args: any[]): {};
39
143
  }>(constructor: T): void;
144
+ /**获取配置文件中的配置项 */
40
145
  declare function config(node: string): any;
146
+ /**组件装饰器,被装饰的类可以通过 @autoware 取得实例 */
41
147
  declare function component(constructorFunction: any): void;
148
+ /**获取组件实例函数,返回结果同 @autoware */
42
149
  declare function getComponent(constructorFunction: any): any;
150
+ /**提供对象装饰器,框架将使用 @bean 装饰的方法来获取对象实例 */
43
151
  declare function bean(target: any, propertyKey: string): void;
152
+ /**获取对象实例函数,返回结果由 @bean 装饰的方法提供 */
44
153
  declare function getBean(mappingClass: Function): any;
154
+ /**配置装饰器,装饰类成员变量值,获取配置文件中的配置项 */
45
155
  declare function value(configPath: string): any;
156
+ /**自动装配装饰器,无参数版本,被装饰的类成员变量将自动注入实例 */
46
157
  declare function autoware(target: any, propertyKey: string): void;
158
+ /**自动装配装饰器,带参数版本,可输入参数作为实例初始化参数,被装饰的类成员变量将自动注入实例 */
47
159
  declare function resource(...args: any[]): any;
160
+ /**日志函数,输出打印日志 */
48
161
  declare function log(message?: any, ...optionalParams: any[]): void;
162
+ /**错误日志函数,输出打印错误日志 */
49
163
  declare function error(message?: any, ...optionalParams: any[]): void;
164
+ /**路由页面前置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之前执行 */
50
165
  declare function before(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
166
+ /**路由页面后置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之后执行 */
51
167
  declare function after(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
168
+ /**定时程序装饰器,参数支持 crontab 格式字符串,可根据参数定时执行被装饰的方法 */
52
169
  declare function schedule(cronTime: string | Date): (target: any, propertyKey: string) => void;
170
+ /**RabbitMQ 监听装饰器,参数是监听的队列名称,当接受到消息时将执行被装饰方法 */
171
+ declare function rabbitListener(queue: string): (target: any, propertyKey: string) => void;
172
+ /**框架 Web 服务工厂类 */
53
173
  declare abstract class ServerFactory {
174
+ /**Web 服务实例 */
54
175
  app: any;
176
+ /**中间件列表 */
55
177
  protected middlewareList: Array<any>;
178
+ /**
179
+ * 设置一个中间件
180
+ * @param middleware 中间件
181
+ */
56
182
  abstract setMiddleware(middleware: any): any;
183
+ /**
184
+ * 启动 Web 服务
185
+ * @param port 端口号
186
+ */
57
187
  abstract start(port: number): any;
58
188
  }
189
+ /**日志工厂类 */
59
190
  declare abstract class LogFactory {
191
+ /**
192
+ * 日志打印方法
193
+ * @param message 日志内容
194
+ */
60
195
  abstract log(message?: any, ...optionalParams: any[]): void;
196
+ /**
197
+ * 错误日志打印方法
198
+ * @param message 日志内容
199
+ */
61
200
  abstract error(message?: any, ...optionalParams: any[]): void;
62
201
  }
202
+ /**数据源工厂类 */
63
203
  declare abstract class DataSourceFactory {
204
+ /**获取读库连接 */
64
205
  abstract readConnection(): any;
206
+ /**获取写库连接 */
65
207
  abstract writeConnection(): any;
66
208
  }
209
+ /**缓存工厂类 */
67
210
  declare abstract class CacheFactory {
211
+ /**
212
+ * 获取缓存
213
+ * @param key 缓存键
214
+ */
68
215
  abstract get(key: string): any;
216
+ /**
217
+ * 设置缓存
218
+ * @param key 缓存键
219
+ * @param value 缓存值
220
+ * @param expire 过期时间,单位秒
221
+ */
69
222
  abstract set(key: string, value: any, expire?: number): void;
223
+ /**
224
+ * 删除缓存
225
+ * @param key 缓存键
226
+ */
70
227
  abstract del(key: string): void;
228
+ /**
229
+ * 判断缓存是否存在
230
+ * @param key 缓存键
231
+ * @returns 是否存在
232
+ */
71
233
  abstract has(key: string): boolean;
234
+ /**清空缓存 */
72
235
  abstract flush(): void;
73
236
  }
74
-
75
-
237
+ /**Redis 操作类 */
76
238
  declare class Redis extends IoRedis {
239
+ /**获取 Redis 实例 */
77
240
  getRedis(): Redis;
78
241
  constructor(config: any);
79
242
  }
243
+ /**读写数据源实现类 */
80
244
  declare class ReadWriteDb extends DataSourceFactory {
81
245
  private readonly readSession;
82
246
  private readonly writeSession;
247
+ /**获取数据源实例 */
83
248
  getDataSource(): DataSourceFactory;
84
249
  constructor();
85
250
  private getConnectionByConfig;
86
251
  readConnection(): any;
87
252
  writeConnection(): any;
88
253
  }
89
-
254
+ /**RabbitMQ 操作类 */
90
255
  declare class RabbitMQ {
256
+ /**获取 RabbitMQ 实例 */
91
257
  getRabbitMQ(): RabbitMQ;
258
+ /**
259
+ * 发送消息到交换机
260
+ * @alias publish
261
+ * @param exchange 交换机名称
262
+ * @param routingKey 交换机路由名称,默认为 ''
263
+ * @param message 发送的消息
264
+ */
92
265
  publishMessageToExchange(exchange: string, routingKey: string, message: string): Promise<void>;
266
+ /**
267
+ * 发送消息到队列
268
+ * @alias send
269
+ * @param queue 队列名称
270
+ * @param message 发送的消息
271
+ */
93
272
  sendMessageToQueue(queue: string, message: string): Promise<void>;
273
+ /**
274
+ * 发送消息到交换机
275
+ * @param exchange 交换机名称
276
+ * @param routingKey 交换机路由名称,默认为 ''
277
+ * @param message 发送的消息
278
+ */
94
279
  publish(exchange: string, routingKey: string, message: string): Promise<void>;
280
+ /**
281
+ * 发送消息到队列
282
+ * @param queue 队列名称
283
+ * @param message 发送的消息
284
+ */
95
285
  send(queue: string, message: string): Promise<void>;
96
286
  }
97
- declare function rabbitListener(queue: string): (target: any, propertyKey: string) => void;
98
-
287
+ /**缓存实现类 */
99
288
  declare class NodeCache extends CacheFactory {
100
289
  private NodeCache;
101
290
  private nodeCacheOptions;
102
291
  private config;
103
292
  constructor();
293
+ /**获取缓存对象 */
104
294
  getNodeCache(): CacheFactory;
105
295
  get(key: string): any;
106
296
  set(key: string, value: any, expire?: number): void;
@@ -108,13 +298,14 @@ declare class NodeCache extends CacheFactory {
108
298
  has(key: string): boolean;
109
299
  flush(): void;
110
300
  }
111
-
301
+ /**日志实现类 */
112
302
  declare class LogDefault extends LogFactory {
303
+ /**获取日志实例 */
113
304
  createLog(): LogFactory;
114
305
  log(message?: any, ...optionalParams: any[]): void;
115
306
  error(message?: any, ...optionalParams: any[]): void;
116
307
  }
117
-
308
+ /**Web 服务实现类,使用 ExpressJS 提供 Web 服务 */
118
309
  declare class ExpressServer extends ServerFactory {
119
310
  view: string;
120
311
  private static;
@@ -124,6 +315,7 @@ declare class ExpressServer extends ServerFactory {
124
315
  private session;
125
316
  private redisConfig;
126
317
  private redisClient;
318
+ /**获取 Web 服务实例 */
127
319
  getSever(): ServerFactory;
128
320
  setMiddleware(middleware: any): void;
129
321
  start(port: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespeed",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "description": "A new Framework for TypeScript.",
5
5
  "author": "speedphp",
6
6
  "license": "MIT License",
@@ -2,105 +2,295 @@ import * as express from "express";
2
2
  import IoRedis from "ioredis";
3
3
  import "reflect-metadata";
4
4
 
5
-
5
+ /**设置路由中间件 */
6
6
  declare function setRouter(app: express.Application): void;
7
+ /**上传文件装饰器,装饰页面具备解析上传文件的能力 */
7
8
  declare function upload(target: any, propertyKey: string): void;
9
+ /**
10
+ * 页面支持 JWT 鉴权能力
11
+ * @param jwtConfig jwt 配置
12
+ */
8
13
  declare function jwt(jwtConfig: any): (target: any, propertyKey: string) => void;
14
+ /**
15
+ * GET 请求装饰器
16
+ * @param value 请求路径
17
+ */
9
18
  declare const getMapping: (value: string) => (target: any, propertyKey: string) => void;
19
+ /**
20
+ * POST 请求装饰器
21
+ * @param value 请求路径
22
+ */
10
23
  declare const postMapping: (value: string) => (target: any, propertyKey: string) => void;
24
+ /**
25
+ * 请求装饰器,不区分请求类型
26
+ * @param value 请求路径
27
+ */
11
28
  declare const requestMapping: (value: string) => (target: any, propertyKey: string) => void;
12
-
29
+ /**
30
+ * INSERT 装饰器
31
+ * 将方法作为 INSERT SQL 使用
32
+ * @param sql INSERT SQL 语句
33
+ */
13
34
  declare function insert(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
35
+ /**
36
+ * UPDATE 装饰器
37
+ * 将方法作为 UPDATE SQL 使用
38
+ * @param sql UPDATE SQL 语句
39
+ */
14
40
  declare function update(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
41
+ /**
42
+ * DELETE 装饰器
43
+ * 将方法作为 DELETE SQL 使用
44
+ * @param sql DELETE SQL 语句
45
+ */
15
46
  declare function remove(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
47
+ /**
48
+ * SELECT 装饰器
49
+ * 将方法作为 SELECT SQL 使用
50
+ * @param sql SELECT SQL 语句
51
+ */
16
52
  declare function select(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
53
+ /**
54
+ * SELECT 结果类型装饰器,和 @select 配合使用
55
+ * @param dataClass 结果类型
56
+ */
17
57
  declare function resultType(dataClass: any): (target: any, propertyKey: string) => void;
58
+ /**
59
+ * SQL 参数装饰器,标注 SQL 语句的绑定参数值,和 @select @insert @update @remove 配合使用
60
+ * @param name 参数在 SQL 语句内的标记值
61
+ */
18
62
  declare function param(name: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
63
+ /**
64
+ * SELECT 缓存装饰器,自动缓存 SELECT 查询结果,和 @select 配合使用
65
+ * 当执行 @insert @update @remove 时,会自动清除缓存。
66
+ * @param ttl 缓存时间,单位秒
67
+ */
19
68
  declare function cache(ttl: number): (target: any, propertyKey: string) => void;
69
+ /**模型数据操作类 */
20
70
  declare class Model {
71
+ /**分页数据 */
21
72
  page: any;
22
73
  private table;
23
74
  constructor(table?: string);
75
+ /**
76
+ * 查询多条数据
77
+ * @param conditions 查询条件,支持对象和字符串
78
+ * @param sort 排序字段
79
+ * @param fields 定义返回字段
80
+ * @param limit 限制返回数据条数
81
+ */
24
82
  findAll<T>(conditions: object | string, sort?: string | object, fields?: string | [string], limit?: number | object): Promise<T[]>;
83
+ /**
84
+ * 插入数据,支持单条或多条数据同时插入
85
+ * @param rows 插入数据,支持对象和数组;对象为单条数据,数组为多条数据。
86
+ */
25
87
  create(rows: any): Promise<number>;
88
+ /**
89
+ * 查询单条数据
90
+ * @param conditions 查询条件,支持对象和字符串
91
+ * @param sort 排序字段
92
+ * @param fields 定义返回字段
93
+ */
26
94
  find<T>(conditions: any, sort: any, fields?: string): Promise<T>;
95
+ /**
96
+ * 更新数据
97
+ * @param conditions 更新条件,支持对象和字符串,符合条件的数据将被更新
98
+ * @param fieldToValues 更新字段和值
99
+ */
27
100
  update(conditions: any, fieldToValues: any): Promise<number>;
101
+ /**
102
+ * 删除数据
103
+ * @param conditions 删除条件,支持对象和字符串,符合条件的数据将被删除
104
+ */
28
105
  delete(conditions: any): Promise<number>;
106
+ /**
107
+ * 查询数据条数,返回符合条件的记录条数
108
+ * @param conditions 查询条件,支持对象和字符串
109
+ */
29
110
  findCount(conditions: any): Promise<number>;
111
+ /**
112
+ * 增加字段值
113
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被增加
114
+ * @param field 需要增加的字段
115
+ * @param optval 增加数量值,默认为 1
116
+ */
30
117
  incr(conditions: any, field: any, optval?: number): Promise<number>;
118
+ /**
119
+ * 减少字段值
120
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被减少
121
+ * @param field 需要减少的字段
122
+ * @param optval 减少数量值,默认为 1
123
+ */
31
124
  decr(conditions: any, field: any, optval?: number): Promise<number>;
125
+ /**
126
+ * 计算分页数据
127
+ * @param page 当前页码
128
+ * @param total 记录总条数
129
+ * @param pageSize 每页显示条数
130
+ * @param scope 分页显示页码数量
131
+ */
32
132
  pager(page: any, total: any, pageSize?: number, scope?: number): any;
33
133
  private where;
34
134
  private range;
35
135
  }
36
-
136
+ /**
137
+ * 应用程序入口装饰器
138
+ *
139
+ * 被装饰的类将作为应用程序入口,框架将启动该类的 main 方法
140
+ */
37
141
  declare function app<T extends {
38
142
  new (...args: any[]): {};
39
143
  }>(constructor: T): void;
144
+ /**获取配置文件中的配置项 */
40
145
  declare function config(node: string): any;
146
+ /**组件装饰器,被装饰的类可以通过 @autoware 取得实例 */
41
147
  declare function component(constructorFunction: any): void;
148
+ /**获取组件实例函数,返回结果同 @autoware */
42
149
  declare function getComponent(constructorFunction: any): any;
150
+ /**提供对象装饰器,框架将使用 @bean 装饰的方法来获取对象实例 */
43
151
  declare function bean(target: any, propertyKey: string): void;
152
+ /**获取对象实例函数,返回结果由 @bean 装饰的方法提供 */
44
153
  declare function getBean(mappingClass: Function): any;
154
+ /**配置装饰器,装饰类成员变量值,获取配置文件中的配置项 */
45
155
  declare function value(configPath: string): any;
156
+ /**自动装配装饰器,无参数版本,被装饰的类成员变量将自动注入实例 */
46
157
  declare function autoware(target: any, propertyKey: string): void;
158
+ /**自动装配装饰器,带参数版本,可输入参数作为实例初始化参数,被装饰的类成员变量将自动注入实例 */
47
159
  declare function resource(...args: any[]): any;
160
+ /**日志函数,输出打印日志 */
48
161
  declare function log(message?: any, ...optionalParams: any[]): void;
162
+ /**错误日志函数,输出打印错误日志 */
49
163
  declare function error(message?: any, ...optionalParams: any[]): void;
164
+ /**路由页面前置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之前执行 */
50
165
  declare function before(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
166
+ /**路由页面后置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之后执行 */
51
167
  declare function after(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
168
+ /**定时程序装饰器,参数支持 crontab 格式字符串,可根据参数定时执行被装饰的方法 */
52
169
  declare function schedule(cronTime: string | Date): (target: any, propertyKey: string) => void;
170
+ /**RabbitMQ 监听装饰器,参数是监听的队列名称,当接受到消息时将执行被装饰方法 */
171
+ declare function rabbitListener(queue: string): (target: any, propertyKey: string) => void;
172
+ /**框架 Web 服务工厂类 */
53
173
  declare abstract class ServerFactory {
174
+ /**Web 服务实例 */
54
175
  app: any;
176
+ /**中间件列表 */
55
177
  protected middlewareList: Array<any>;
178
+ /**
179
+ * 设置一个中间件
180
+ * @param middleware 中间件
181
+ */
56
182
  abstract setMiddleware(middleware: any): any;
183
+ /**
184
+ * 启动 Web 服务
185
+ * @param port 端口号
186
+ */
57
187
  abstract start(port: number): any;
58
188
  }
189
+ /**日志工厂类 */
59
190
  declare abstract class LogFactory {
191
+ /**
192
+ * 日志打印方法
193
+ * @param message 日志内容
194
+ */
60
195
  abstract log(message?: any, ...optionalParams: any[]): void;
196
+ /**
197
+ * 错误日志打印方法
198
+ * @param message 日志内容
199
+ */
61
200
  abstract error(message?: any, ...optionalParams: any[]): void;
62
201
  }
202
+ /**数据源工厂类 */
63
203
  declare abstract class DataSourceFactory {
204
+ /**获取读库连接 */
64
205
  abstract readConnection(): any;
206
+ /**获取写库连接 */
65
207
  abstract writeConnection(): any;
66
208
  }
209
+ /**缓存工厂类 */
67
210
  declare abstract class CacheFactory {
211
+ /**
212
+ * 获取缓存
213
+ * @param key 缓存键
214
+ */
68
215
  abstract get(key: string): any;
216
+ /**
217
+ * 设置缓存
218
+ * @param key 缓存键
219
+ * @param value 缓存值
220
+ * @param expire 过期时间,单位秒
221
+ */
69
222
  abstract set(key: string, value: any, expire?: number): void;
223
+ /**
224
+ * 删除缓存
225
+ * @param key 缓存键
226
+ */
70
227
  abstract del(key: string): void;
228
+ /**
229
+ * 判断缓存是否存在
230
+ * @param key 缓存键
231
+ * @returns 是否存在
232
+ */
71
233
  abstract has(key: string): boolean;
234
+ /**清空缓存 */
72
235
  abstract flush(): void;
73
236
  }
74
-
75
-
237
+ /**Redis 操作类 */
76
238
  declare class Redis extends IoRedis {
239
+ /**获取 Redis 实例 */
77
240
  getRedis(): Redis;
78
241
  constructor(config: any);
79
242
  }
243
+ /**读写数据源实现类 */
80
244
  declare class ReadWriteDb extends DataSourceFactory {
81
245
  private readonly readSession;
82
246
  private readonly writeSession;
247
+ /**获取数据源实例 */
83
248
  getDataSource(): DataSourceFactory;
84
249
  constructor();
85
250
  private getConnectionByConfig;
86
251
  readConnection(): any;
87
252
  writeConnection(): any;
88
253
  }
89
-
254
+ /**RabbitMQ 操作类 */
90
255
  declare class RabbitMQ {
256
+ /**获取 RabbitMQ 实例 */
91
257
  getRabbitMQ(): RabbitMQ;
258
+ /**
259
+ * 发送消息到交换机
260
+ * @alias publish
261
+ * @param exchange 交换机名称
262
+ * @param routingKey 交换机路由名称,默认为 ''
263
+ * @param message 发送的消息
264
+ */
92
265
  publishMessageToExchange(exchange: string, routingKey: string, message: string): Promise<void>;
266
+ /**
267
+ * 发送消息到队列
268
+ * @alias send
269
+ * @param queue 队列名称
270
+ * @param message 发送的消息
271
+ */
93
272
  sendMessageToQueue(queue: string, message: string): Promise<void>;
273
+ /**
274
+ * 发送消息到交换机
275
+ * @param exchange 交换机名称
276
+ * @param routingKey 交换机路由名称,默认为 ''
277
+ * @param message 发送的消息
278
+ */
94
279
  publish(exchange: string, routingKey: string, message: string): Promise<void>;
280
+ /**
281
+ * 发送消息到队列
282
+ * @param queue 队列名称
283
+ * @param message 发送的消息
284
+ */
95
285
  send(queue: string, message: string): Promise<void>;
96
286
  }
97
- declare function rabbitListener(queue: string): (target: any, propertyKey: string) => void;
98
-
287
+ /**缓存实现类 */
99
288
  declare class NodeCache extends CacheFactory {
100
289
  private NodeCache;
101
290
  private nodeCacheOptions;
102
291
  private config;
103
292
  constructor();
293
+ /**获取缓存对象 */
104
294
  getNodeCache(): CacheFactory;
105
295
  get(key: string): any;
106
296
  set(key: string, value: any, expire?: number): void;
@@ -108,13 +298,14 @@ declare class NodeCache extends CacheFactory {
108
298
  has(key: string): boolean;
109
299
  flush(): void;
110
300
  }
111
-
301
+ /**日志实现类 */
112
302
  declare class LogDefault extends LogFactory {
303
+ /**获取日志实例 */
113
304
  createLog(): LogFactory;
114
305
  log(message?: any, ...optionalParams: any[]): void;
115
306
  error(message?: any, ...optionalParams: any[]): void;
116
307
  }
117
-
308
+ /**Web 服务实现类,使用 ExpressJS 提供 Web 服务 */
118
309
  declare class ExpressServer extends ServerFactory {
119
310
  view: string;
120
311
  private static;
@@ -124,6 +315,7 @@ declare class ExpressServer extends ServerFactory {
124
315
  private session;
125
316
  private redisConfig;
126
317
  private redisClient;
318
+ /**获取 Web 服务实例 */
127
319
  getSever(): ServerFactory;
128
320
  setMiddleware(middleware: any): void;
129
321
  start(port: number): void;