feat: add jsonparser

This commit is contained in:
sujit
2024-10-05 16:49:12 +05:45
parent 138e2ed8c5
commit 324c6f691e
14 changed files with 1841 additions and 21 deletions

26
jsonparser/bytes_safe.go Normal file
View File

@@ -0,0 +1,26 @@
//go:build appengine || appenginevm
// +build appengine appenginevm
package jsonparser
import (
"strconv"
)
// See fastbytes_unsafe.go for explanation on why *[]byte is used (signatures must be consistent with those in that file)
func equalStr(b *[]byte, s string) bool {
return string(*b) == s
}
func parseFloat(b *[]byte) (float64, error) {
return strconv.ParseFloat(string(*b), 64)
}
func bytesToString(b *[]byte) string {
return string(*b)
}
func StringToBytes(s string) []byte {
return []byte(s)
}