diff options
author | 2023-11-27 13:15:03 +0000 | |
---|---|---|
committer | 2023-11-27 13:15:03 +0000 | |
commit | 66b77acb1c8b86f0be3836ccaf31683c0bfa317a (patch) | |
tree | 9a255a8ea8ef97229b6d75d17de45bdac1755be9 /vendor/github.com/bytedance/sonic/api.go | |
parent | [bugfix] Add Actor to outgoing poll vote Create; other fixes (#2384) (diff) | |
download | gotosocial-66b77acb1c8b86f0be3836ccaf31683c0bfa317a.tar.xz |
[chore]: Bump github.com/gin-contrib/cors from 1.4.0 to 1.5.0 (#2388)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/api.go')
-rw-r--r-- | vendor/github.com/bytedance/sonic/api.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/github.com/bytedance/sonic/api.go b/vendor/github.com/bytedance/sonic/api.go index a042476f1..9525b7afd 100644 --- a/vendor/github.com/bytedance/sonic/api.go +++ b/vendor/github.com/bytedance/sonic/api.go @@ -68,7 +68,11 @@ type Config struct { // ValidateString indicates decoder and encoder to valid string values: decoder will return errors // when unescaped control chars(\u0000-\u001f) in the string value of JSON. - ValidateString bool + ValidateString bool + + // NoValidateJSONMarshaler indicates that the encoder should not validate the output string + // after encoding the JSONMarshaler to JSON. + NoValidateJSONMarshaler bool } var ( @@ -87,6 +91,7 @@ var ( // ConfigFastest is the fastest config of APIs, aiming at speed. ConfigFastest = Config{ NoQuoteTextMarshaler: true, + NoValidateJSONMarshaler: true, }.Froze() ) @@ -183,4 +188,9 @@ func Get(src []byte, path ...interface{}) (ast.Node, error) { // which can reduce unnecessary memory copy. func GetFromString(src string, path ...interface{}) (ast.Node, error) { return ast.NewSearcher(src).GetByPath(path...) -}
\ No newline at end of file +} + +// Valid reports whether data is a valid JSON encoding. +func Valid(data []byte) bool { + return ConfigDefault.Valid(data) +} |