From 86c1a4a3a9dda6bac730048249acdc5b248ba6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 13 Oct 2025 12:45:11 +0800 Subject: [PATCH] feat: add func --- go.mod | 2 +- go.sum | 2 ++ json.go | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 76829e8..a786684 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.0 toolchain go1.24.2 require ( - git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995 + git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250916024308-d378e6c57772 git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e github.com/BurntSushi/toml v1.5.0 github.com/go-ini/ini v1.67.0 diff --git a/go.sum b/go.sum index c84956c..e380038 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995 h1:LmPRAf0AsxRVFPibdpZR89ajlsz8hof2IvMMyTqiEq4= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995/go.mod h1:5p8CEKGBxi7qPtTXDI3HDmqKAfIm5i/aBWdrbkbdNjc= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250916024308-d378e6c57772 h1:Yo1ur3LnDF5s7F7tpJsNrdUSF8LwYKnN9TdQU32F3eU= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250916024308-d378e6c57772/go.mod h1:5p8CEKGBxi7qPtTXDI3HDmqKAfIm5i/aBWdrbkbdNjc= git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e h1:Q973S6CcWr1ICZhFI1STFOJ+KUImCl2BaIXm6YppBqI= git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e/go.mod h1:VpPjBlwz8U+OxZuxzHQBv1aEEZ3pStH6bZvT21ADEbI= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= diff --git a/json.go b/json.go index faf6fc5..ffad461 100644 --- a/json.go +++ b/json.go @@ -78,6 +78,11 @@ func (oj *ownJSON) UnmarshalWithNumberForIOReaderIgnoreError(ioReader io.ReadClo return } +// UnmarshalForString ... +func (oj *ownJSON) UnmarshalForString(input string, receiver any) error { + return oj.Unmarshal([]byte(input), receiver) +} + // UnmarshalWithNumberForString 字符串转结构体 // // Author : go_developer@163.com<白茶清欢>