---
title: "v1.6 2019-04-09"
url: "https://goframe.org/release/v1.6.0"
markdown_url: "https://goframe.org/release/v1.6.0.md"
locale: "zh-Hans"
version: "2.10.x(Latest)"
section: "版本发布记录"
category: "版本发布记录 / 历史版本记录 v1.x"
published: "2024-11-04"
updated: "2024-11-18"
description: "v1.6版本带来了多项功能和改进，包括gcron定时任务模块的运行日志记录、gredis模块的全局分组配置、gcfg和gview模块的默认配置文件检索路径优化、ghttp模块的CORS特性、TLSConfig配置、以及gdb模块的新链式操作方法。修复了多个模块的资源竞争问题和转换失败问题，全面提升了系统的稳定性和安全性。"
keywords: ["GoFrame", "GoFrame框架", "gcron", "gredis", "gcfg", "gview", "ghttp", "gdb", "gconv", "gvalid"]
---

# v1.6 2019-04-09

### 新功能/改进

1. `gcron` 定时任务模块增加运行日志记录功能： [https://goframe.org/os/gcron/index](https://wiki.goframe.org/os/gcron/index)
2. `gredis` 增加全局分组配置功能，并增加更多的配置选项 `maxIdle/maxActive/idleTimeout/maxConnLifetime`： [https://goframe.org/database/gredis/index](https://wiki.goframe.org/database/gredis/index)
3. `gcfg` 模块增加更多的默认配置文件检索路径，并且增加全局分组配置特性，增加 `Instance` 单例方法： [https://goframe.org/os/gcfg/index](https://wiki.goframe.org/os/gcfg/index)
4. `gview` 模块增加更多的默认配置文件检索路径，并且增加 `Instance` 单例方法： [https://goframe.org/os/gview/index](https://wiki.goframe.org/os/gview/index)
5. `ghttp` 模块新功能及改进：
    - 新增 `CORS` HTTP(S)跨域请求特性: [https://goframe.org/net/ghttp/cors](https://wiki.goframe.org/net/ghttp/cors)
    - 增加 `TLSConfig` 配置功能；
    - 去掉路由注册方法的 `error` 返回值，当产生注册错误时直接终端打印错误/输出到日志文件；
    - 增加在 `HTTP Code 302` 跳转时的 `Set-Cookie` 支持；
    - 增加对 `SESSION ID` 的安全性检查；
    - 增加对基于 `HTTPS` 的 `WebSocket` 支持（ `WSS`）： [https://goframe.org/net/ghttp/websocket/index](https://wiki.goframe.org/net/ghttp/websocket/index)
    - `Request` 对象增加 `Error` 方法，用于输出自定义错误信息到 `WebServer` 错误日志中；
    - 其他一些改进；
6. `gdb` 模块新功能及改进：
    - 新增 `Instance` 单例管理方法；
    - 新增 `Structs/Scan` 链式操作方法， `gdb.DB/TX` 新增 `GetStructs/GetScan` 方法，用于结果集 `struct`/ `slice` 映射转换： [https://goframe.org/database/gdb/chaining](https://wiki.goframe.org/database/gdb/chaining)
    - 新增 `Safe` 链式操作方法（默认非并发安全），用于链式安全控制： [https://goframe.org/database/gdb/chaining](https://wiki.goframe.org/database/gdb/chaining)
    - `Where` 链式操作方法改进：
      - 方法支持任意的 `string/map/slice/struct/*struct` 类型；
      - 逻辑调整，当链式操作中存在多个 `Where` 方法调用时，自动转换为 `And` 条件；
      - 支持 `slice` 条件参数，常用在 `SELECT IN` 查询中，例如： `Where("uid IN(?)", g.Slice{1,2,3})`；
      - 支持在 `map` 类型条件参数的 `key` 中传递条件，例如： `Where(g.Map{"uid>?", uid})`；
7. `gconv` 及 `gvalid` 模块改进并去掉对私有 `struct` 方法属性的转换/校验；
8. `gconv.Map` 转换方法新增对 `json tag`: `-`, `omitempty` 的支持: [https://goframe.org/util/gconv/map](https://wiki.goframe.org/util/gconv/map)
9. `gstr` 模块新增 `ReplaceI/ReplaceIByArray/ReplaceIByMap` 大小写非敏感替换方法；
10. `gutil` 模块增加 `IsEmpty` 方法，用于判断给定变量是否为空（整型0, 布尔false, slice/map长度为0, 其他为nil的情况，判断为空），并增加快捷方法 `g.IsEmpty`；
11. `gutil` 模块增加 `Export` 方法，用于导出返回格式化打印的变量内容字符串，并增加快捷方法 `g.Export`；
12. `gspath` 增加缓存及非缓存检索检索方法 `Search`/ `SearchWithCache`；
13. `gjson` 模块增加默认的 `UseNumber` 功能支持；
14. `gmap` 增加 `SetIfNotExistFunc/SetIfNotExistFuncLock` 方法；
15. 迁移 `greuseport` 模块到新的仓库： [https://github.com/gogf/greuseport](https://github.com/gogf/greuseport)
16. 大量的单元测试完善；

### Bug Fix

1. 修复 `gqueue` 模块的资源竞争问题；
2. 修复 `gconv.GTime` 转换失败问题；
3. 修复 `gconv.String` 在转换 `int` 参数时字节溢出问题；
4. 修复 `ghttp.Request` 的 `HTTP Basic Auth` 校验问题；
5. 修复 `gxml` 针对于非 `UTF-8` 编码内容转换的并发安全问题；
6. 修复 `gtime` 部分 `Format`（ `G`& `j`）格式失效问题；
7. 修复 `gudp.Conn` 对象的 `RemoteAddr` 获取客户端连接地址方法问题；
8. 修复 `gmap/gcache` 模块的 `GetOrSetFuncLock` 方法，增加对回调方法返回值的 `nil` 判断，只有非nil返回值才会被保存；
