Skip to content

Commit 02b5b59

Browse files
committed
#### Version 1.4.9
* 新增: ConcurrenceMap增加GetTimeDuration接口,用于直接返回time.Duration类型数据 * 新增: ReadonlyMap增加GetTimeDuration接口,用于直接返回time.Duration类型数据 * 新增: dotweb增加UseTimeoutHook接口,用于设置请求处理超过设置时间钩子函数 * 调整:dotweb内建集成三类中间件,无需单独引用Middleware库 * RequestLogMiddleware * TimeoutHookMiddleware * dotweb.SetExceptionHandle * 新增 example/basemiddleware * 集成vendor: gopkg.in/yaml.v2 * 2018-02-12 12:00
1 parent 53ec94c commit 02b5b59

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

core/concurrenceMap.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func (ctx *ItemMap) Once(key string) (value interface{}, exists bool) {
100100
return value, exists
101101
}
102102

103-
104103
// GetString 读取指定key在ConcurrenceMap中的内容,以string格式输出
105104
// 如果不存在key,返回空字符串
106105
func (ctx *ItemMap) GetString(key string) string {
@@ -111,7 +110,6 @@ func (ctx *ItemMap) GetString(key string) string {
111110
return fmt.Sprint(value)
112111
}
113112

114-
115113
// GetInt 读取指定key在ConcurrenceMap中的内容,以int格式输出
116114
// 如果不存在key,或者转换失败,返回0
117115
func (ctx *ItemMap) GetInt(key string) int {
@@ -138,9 +136,8 @@ func (ctx *ItemMap) GetTimeDuration(key string) time.Duration {
138136
timeDuration, err := time.ParseDuration(ctx.GetString(key))
139137
if err != nil {
140138
return 0
141-
} else {
142-
return timeDuration
143139
}
140+
return timeDuration
144141
}
145142

146143
// Exists check exists key

0 commit comments

Comments
 (0)