Source File
jx.go
Belonging Package
github.com/go-faster/jx
// Package jx implements RFC 7159 json encoding and decoding.package jximport ()// Valid reports whether data is valid json.func ( []byte) bool {:= GetDecoder()defer PutDecoder().ResetBytes()return .Validate() == nil}var (encPool = &sync.Pool{New: func() interface{} {return &Encoder{}},}writerPool = &sync.Pool{New: func() interface{} {return &Writer{}},}decPool = &sync.Pool{New: func() interface{} {return &Decoder{}},})// GetDecoder gets *Decoder from pool.func () *Decoder {return decPool.Get().(*Decoder)}// PutDecoder puts *Decoder into pool.func ( *Decoder) {.Reset(nil)decPool.Put()}// GetEncoder returns *Encoder from pool.func () *Encoder {return encPool.Get().(*Encoder)}// PutEncoder puts *Encoder to poolfunc ( *Encoder) {.Reset().SetIdent(0)encPool.Put()}// GetWriter returns *Writer from pool.func () *Writer {return writerPool.Get().(*Writer)}// PutWriter puts *Writer to poolfunc ( *Writer) {.Reset()writerPool.Put()}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |