* WIP: start mongo engine * WIP: mongo accessor and admin * integrate mongo store to main * disable mongo tests by default, only in CI * connection with constructor * add mongo buffered writer * buffered mongo writer * fix nil responses on an empty list from mongo * missing mongo index for scores * cancelable store * add gridfs implementation of avatar store * fix race on mongo session copy * gridfs avatars without tmp files * move avatar store * minor comments and refactoring for avatar store * merged from current master * simplify gridfs reader * lint: fix minor warns * test mongo against env defined url * pass MONGO_REMARK_TEST to docker and travis * set dockerfile env for mongo test url * increase connect timeout in mongo tests * pass MONGO_REMARK_TEST to drone build * add MONGO_REMARK_TEST to branch stage of drone * mass mongo test url via build_args_from_env * populate mongo IP to docker build hosts * test env * pass mongo ip via .mongo * remove .mongo temp from git * add .mongo -> env to linter step * allow more time to autoflush writer test * default mongo tests to "mongo" if not in env * merge fresh master into * add test for mongo cleanup * msg for a failed test * lazy fix for failed test * add an ability to skip all mongo tests * add backend dev instructions * remove unused code from mongo server * move mongo testing to connection_test * restore testing.go * lint: minor warns for testing code
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
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
|
|
}
|