Ai
1 Star 0 Fork 0

xkgo/mgo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
compatibility.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
Dom 提交于 2018-06-15 21:49 +08:00 . Release/r2018.06.15 (#191)
package bson
// Current state of the JSON tag fallback option.
var useJSONTagFallback = false
var useRespectNilValues = false
// SetJSONTagFallback enables or disables the JSON-tag fallback for structure tagging. When this is enabled, structures
// without BSON tags on a field will fall-back to using the JSON tag (if present).
func SetJSONTagFallback(state bool) {
useJSONTagFallback = state
}
// JSONTagFallbackState returns the current status of the JSON tag fallback compatability option. See SetJSONTagFallback
// for more information.
func JSONTagFallbackState() bool {
return useJSONTagFallback
}
// SetRespectNilValues enables or disables serializing nil slices or maps to `null` values.
// In other words it enables `encoding/json` compatible behaviour.
func SetRespectNilValues(state bool) {
useRespectNilValues = state
}
// RespectNilValuesState returns the current status of the JSON nil slices and maps fallback compatibility option.
// See SetRespectNilValues for more information.
func RespectNilValuesState() bool {
return useRespectNilValues
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xkgo/mgo.git
git@gitee.com:xkgo/mgo.git
xkgo
mgo
mgo
973b45f12ba5

搜索帮助