mirror of
https://github.com/eiblog/eiblog.git
synced 2026-03-01 00:34:58 +08:00
add vendor
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
package jsonutil
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
func Unmarshal(data string, v interface{}) error {
|
||||
|
||||
sh := *(*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
arr := (*[1<<30]byte)(unsafe.Pointer(sh.Data))
|
||||
return json.Unmarshal(arr[:sh.Len], v)
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user