package decoder
import (
"fmt"
"reflect"
"unsafe"
)
type funcDecoder struct {
typ reflect .Type
structName string
fieldName string
}
func newFuncDecoder(typ reflect .Type , structName , fieldName string ) *funcDecoder {
fnDecoder := &funcDecoder {typ , structName , fieldName }
return fnDecoder
}
func (d *funcDecoder ) Decode (ctx *RuntimeContext , cursor , depth int64 , p unsafe .Pointer ) (int64 , error ) {
buf := ctx .Buf
cursor = skipWhiteSpace (buf , cursor )
if buf [cursor ] == 'n' {
if buf [cursor +1 ] != 'u' || buf [cursor +2 ] != 'l' || buf [cursor +3 ] != 'l' {
return 0 , literalSyntaxError (buf , cursor , "null" )
}
*(*unsafe .Pointer )(p ) = nil
return cursor + 4 , nil
}
return ctx .skipTypeError (cursor , depth , d .typ )
}
func (d *funcDecoder ) DecodePath (ctx *RuntimeContext , cursor , depth int64 ) ([][]byte , int64 , error ) {
return nil , 0 , fmt .Errorf ("json: func decoder does not support decode path" )
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .