Source File
enc_comma.go
Belonging Package
github.com/go-faster/jx
package jx// begin should be called before new Array or Object.func ( *Encoder) () {.first = append(.first, true)}// end should be called after Array or Object.func ( *Encoder) () {if len(.first) == 0 {return}.first = .first[:.current()]}func ( *Encoder) () int { return len(.first) - 1 }// comma should be called before any new value.func ( *Encoder) () bool {// Writing commas.// 1. Before every field expect first.// 2. Before every array element except first.if len(.first) == 0 {return false}:= .current()_ = .first[]if .first[] {.first[] = falsereturn false}return .byte(',') ||.writeIndent()}
![]() |
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. |