diff options
author | 2024-03-11 10:12:06 +0000 | |
---|---|---|
committer | 2024-03-11 10:12:06 +0000 | |
commit | e24efcac8b67baa9454bf27631e5e49f898a88d4 (patch) | |
tree | d9adec2f05e1d8714edee66062a4b95a81ee2a61 /vendor/github.com/bytedance/sonic/internal/encoder/encoder.go | |
parent | [bugfix] Fix whitespace move_id issue (#2742) (diff) | |
download | gotosocial-e24efcac8b67baa9454bf27631e5e49f898a88d4.tar.xz |
[chore]: Bump github.com/gin-contrib/cors from 1.5.0 to 1.7.0 (#2745)
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/encoder/encoder.go')
-rw-r--r-- | vendor/github.com/bytedance/sonic/internal/encoder/encoder.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go index bd8bae357..0a46455eb 100644 --- a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go +++ b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go @@ -41,6 +41,7 @@ const ( bitNoNullSliceOrMap bitValidateString bitNoValidateJSONMarshaler + bitNoEncoderNewline // used for recursive compile bitPointerValue = 63 @@ -76,6 +77,9 @@ const ( // NoValidateJSONMarshaler indicates that the encoder should not validate the output string // after encoding the JSONMarshaler to JSON. NoValidateJSONMarshaler Options = 1 << bitNoValidateJSONMarshaler + + // NoEncoderNewline indicates that the encoder should not add a newline after every message + NoEncoderNewline Options = 1 << bitNoEncoderNewline // CompatibleWithStd is used to be compatible with std encoder. CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler @@ -129,6 +133,16 @@ func (self *Encoder) SetNoValidateJSONMarshaler(f bool) { } } +// SetNoEncoderNewline specifies if option NoEncoderNewline opens +func (self *Encoder) SetNoEncoderNewline(f bool) { + if f { + self.Opts |= NoEncoderNewline + } else { + self.Opts &= ^NoEncoderNewline + } +} + + // SetCompactMarshaler specifies if option CompactMarshaler opens func (self *Encoder) SetCompactMarshaler(f bool) { if f { |