更新json文件
This commit is contained in:
parent
fe96264f73
commit
5c78dd1201
3
init.go
3
init.go
@ -16,6 +16,8 @@ var (
|
||||
Hash *hash
|
||||
// IP ...
|
||||
IP *ip
|
||||
// JSON ...
|
||||
JSON *ownJSON
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -23,4 +25,5 @@ func init() {
|
||||
File = &file{}
|
||||
Hash = &hash{}
|
||||
IP = &ip{}
|
||||
JSON = &ownJSON{}
|
||||
}
|
||||
|
20
json.go
20
json.go
@ -16,34 +16,42 @@ import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// JSONUnmarshalWithNumber 解析json
|
||||
// ownJSON ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:01 2022/5/14
|
||||
type ownJSON struct {
|
||||
}
|
||||
|
||||
// UnmarshalWithNumber 解析json
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 8:39 下午 2021/9/14
|
||||
func JSONUnmarshalWithNumber(byteData []byte, receiver interface{}) error {
|
||||
func (oj *ownJSON) UnmarshalWithNumber(byteData []byte, receiver interface{}) error {
|
||||
decoder := json.NewDecoder(bytes.NewReader(byteData))
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// JSONUnmarshalWithNumberForIOReader ...
|
||||
// UnmarshalWithNumberForIOReader ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 8:43 下午 2021/9/14
|
||||
func JSONUnmarshalWithNumberForIOReader(ioReader io.ReadCloser, receiver interface{}) error {
|
||||
func (oj *ownJSON) UnmarshalWithNumberForIOReader(ioReader io.ReadCloser, receiver interface{}) error {
|
||||
decoder := json.NewDecoder(ioReader)
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// JSONConsoleOutput ...
|
||||
// ConsoleOutput ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 5:45 下午 2021/11/5
|
||||
func JSONConsoleOutput(data interface{}) {
|
||||
func (oj *ownJSON) ConsoleOutput(data interface{}) {
|
||||
var out bytes.Buffer
|
||||
switch reflect.TypeOf(data).Kind() {
|
||||
case reflect.Slice:
|
||||
|
Loading…
Reference in New Issue
Block a user