forked from minio/simdjson-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
18 lines (16 loc) · 807 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package simdjson
// ParserOption is a parser option.
type ParserOption func(pj *internalParsedJson) error
// WithCopyStrings will copy strings so they no longer reference the input.
// For enhanced performance, simdjson-go can point back into the original JSON buffer for strings,
// however this can lead to issues in streaming use cases scenarios, or scenarios in which
// the underlying JSON buffer is reused. So the default behaviour is to create copies of all
// strings (not just those transformed anyway for unicode escape characters) into the separate
// Strings buffer (at the expense of using more memory and less performance).
// Default: true - strings are copied.
func WithCopyStrings(b bool) ParserOption {
return func(pj *internalParsedJson) error {
pj.copyStrings = b
return nil
}
}