From 3b612857fe259ce81acfe2ab397a84d0af42e784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 14 May 2022 15:22:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4struct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.go | 3 +++ struct.go | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/init.go b/init.go index 60cb36e..975b340 100644 --- a/init.go +++ b/init.go @@ -20,6 +20,8 @@ var ( JSON *ownJSON // String ... String *stringOperate + // Struct ... + Struct *ownStruct ) func init() { @@ -29,4 +31,5 @@ func init() { IP = &ip{} JSON = &ownJSON{} String = &stringOperate{} + Struct = &ownStruct{} } diff --git a/struct.go b/struct.go index 0e200af..5addc86 100644 --- a/struct.go +++ b/struct.go @@ -1,4 +1,4 @@ -// Package util... +// Package util ... // // Description : util ... // @@ -9,12 +9,20 @@ package util import "encoding/json" -// StructToMap 结构体转为map +// ownStruct ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 15:19 2022/5/14 +type ownStruct struct { +} + +// ToMap 结构体转为map // // Author : go_developer@163.com<白茶清欢> // // Date : 11:12 下午 2021/3/14 -func StructToMap(data interface{}) (map[string]interface{}, error) { +func (os *ownStruct) ToMap(data interface{}) (map[string]interface{}, error) { var ( byteData []byte err error