From a72733d81abc37f73c492fe7cbdb1c1e37cc76c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 22 Oct 2024 16:37:13 +0800 Subject: [PATCH 1/8] update go mod --- go.mod | 22 +++++++++++----------- go.sum | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index b079a16..221a322 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,11 @@ go 1.21.0 toolchain go1.23.1 require ( - git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240924065029-c865046cd9e7 + git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763 git.zhangdeman.cn/zhangdeman/exception v0.0.0-20240930081343-1e7f84ed8465 git.zhangdeman.cn/zhangdeman/logger v0.0.0-20240725055115-98eb52ae307a git.zhangdeman.cn/zhangdeman/network v0.0.0-20230925112156-f0eb86dd2442 - git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20240924063449-ef80c6cb79d1 + git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20241013112816-e3de2835a971 github.com/gin-gonic/gin v1.10.0 github.com/go-playground/validator/v10 v10.22.1 github.com/mcuadros/go-defaults v1.2.0 @@ -28,12 +28,12 @@ require ( github.com/BurntSushi/toml v1.4.0 // indirect github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect github.com/bytedance/sonic v1.12.3 // indirect - github.com/bytedance/sonic/loader v0.2.0 // indirect + github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 // indirect - github.com/gabriel-vasile/mimetype v1.4.5 // indirect + github.com/gabriel-vasile/mimetype v1.4.6 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -54,18 +54,18 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/tidwall/gjson v1.17.3 // indirect + github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/arch v0.10.0 // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/arch v0.11.0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index db08b0a..2550479 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240924065029-c865046cd9e7 h1:tyCPCMK+68PZ0axZylQHitMVp1d5mzNr9/YqMHXqo+A= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240924065029-c865046cd9e7/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763 h1:aG59AjZAn/Y+smWoa6l6HQB+yh/Rpml79EvmfjEb6Ks= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda h1:bMD6r9gjRy7cO+T4zRQVYAesgIblBdTnhzT1vN5wjvI= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda/go.mod h1:dT0rmHcJ9Z9IqWeMIt7YzR88nKkNV2V3dfG0j9Q6lK0= git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 h1:I/wOsRpCSRkU9vo1u703slQsmK0wnNeZzsWQOGtIAG0= @@ -21,6 +23,8 @@ git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2 h1:P2k git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2/go.mod h1:7KaMpQmWgiNLpEkaV7oDtep7geI1f/VoCoPVcyvMjAE= git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20240924063449-ef80c6cb79d1 h1:LYw8NJeWcOiyrGjH9weyxnaMit94MlIngL+uskbLjtw= git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20240924063449-ef80c6cb79d1/go.mod h1:+2qNxuRsfyfOvXk9HNwn+CmyPmmhhrQm/eIi1FDU1jw= +git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20241013112816-e3de2835a971 h1:vCkhZliMy2H+OqhcIyhPYQcH13wFuYb9LUeAu71ToNA= +git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20241013112816-e3de2835a971/go.mod h1:+2qNxuRsfyfOvXk9HNwn+CmyPmmhhrQm/eIi1FDU1jw= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ= @@ -30,6 +34,8 @@ github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKz github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= +github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= @@ -42,6 +48,8 @@ github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 h1:CaO/zOnF8VvUfEbhRatPcwKVWamvbY github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4= github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4= github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= +github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc= +github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= @@ -122,6 +130,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94= github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -139,20 +149,32 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/arch v0.10.0 h1:S3huipmSclq3PJMNe76NGwkBR504WFkQ5dhzWzP8ZW8= golang.org/x/arch v0.10.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4= +golang.org/x/arch v0.11.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -- 2.36.6 From 2c99eb96562621d117681fadc1af837feecf1921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 22 Oct 2024 16:49:45 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B6=89=E5=8F=8A=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=BD=93=E8=A7=A3=E6=9E=90=E9=80=82=E9=85=8D=E5=99=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request/abstract/parse_body.go | 26 +++++++++++++++ request/parse_body/execute.go | 47 +++++++++++++++++++++++++++ request/parse_body/form_url_encode.go | 8 +++++ request/parse_body/json.go | 8 +++++ request/parse_body/xml.go | 8 +++++ request/parse_body/yml.go | 8 +++++ 6 files changed, 105 insertions(+) create mode 100644 request/abstract/parse_body.go create mode 100644 request/parse_body/execute.go create mode 100644 request/parse_body/form_url_encode.go create mode 100644 request/parse_body/json.go create mode 100644 request/parse_body/xml.go create mode 100644 request/parse_body/yml.go diff --git a/request/abstract/parse_body.go b/request/abstract/parse_body.go new file mode 100644 index 0000000..2b4a497 --- /dev/null +++ b/request/abstract/parse_body.go @@ -0,0 +1,26 @@ +// Package abstract ... +// +// Description : abstract ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:38 +package abstract + +import ( + "github.com/gin-gonic/gin" +) + +// RequestBodyParseAdaptor 解析请求body的接口适配器约束 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:39 2024/10/22 +type RequestBodyParseAdaptor interface { + // Parse 解析Body数据,解析结果会反序列化至 receiver , 同时, 会以 map 结构返回 + Parse(ctx *gin.Context, receiver any) ([]byte, error) + // Unmarshal 自定义反序列化的方法, 为 nil 则使用内置的序列化方式 + Unmarshal() func(sourceData []byte, receiver any) error + // ContentType 当前适配器用与解析何种type + ContentType() string +} diff --git a/request/parse_body/execute.go b/request/parse_body/execute.go new file mode 100644 index 0000000..0455ce4 --- /dev/null +++ b/request/parse_body/execute.go @@ -0,0 +1,47 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:43 +package parse_body + +import ( + "errors" + "git.zhangdeman.cn/zhangdeman/gin/request/abstract" + "github.com/gin-gonic/gin" + "strings" +) + +var ( + requestBodyParseAdaptorTable = map[string]abstract.RequestBodyParseAdaptor{} +) + +// Register 注册适配器实例 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:45 2024/10/22 +func Register(adaptor abstract.RequestBodyParseAdaptor) { + if nil == adaptor { + return + } + requestBodyParseAdaptorTable[adaptor.ContentType()] = adaptor +} + +// Execute 解析请求BODY数据 +func Execute(ctx *gin.Context, receiver any) ([]byte, error) { + contentType := strings.ToLower(strings.ReplaceAll(ctx.ContentType(), " ", "")) + // 裁剪出真实的类型,之所以截取,是因为 content_type 中可能还包含编码信息, 如 : application/json;charset=utf8 + contentTypeArr := strings.Split(contentType, ";") + contentType = contentTypeArr[0] + if _, exist := requestBodyParseAdaptorTable[contentType]; !exist { + return nil, errors.New(contentType + " : adaptor not found") + } + if parseResult, err := requestBodyParseAdaptorTable[contentType].Parse(ctx, receiver); nil != err { + return nil, err + } else { + return parseResult, err + } +} diff --git a/request/parse_body/form_url_encode.go b/request/parse_body/form_url_encode.go new file mode 100644 index 0000000..8a18ca3 --- /dev/null +++ b/request/parse_body/form_url_encode.go @@ -0,0 +1,8 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:43 +package parse_body diff --git a/request/parse_body/json.go b/request/parse_body/json.go new file mode 100644 index 0000000..676d6c7 --- /dev/null +++ b/request/parse_body/json.go @@ -0,0 +1,8 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:42 +package parse_body diff --git a/request/parse_body/xml.go b/request/parse_body/xml.go new file mode 100644 index 0000000..676d6c7 --- /dev/null +++ b/request/parse_body/xml.go @@ -0,0 +1,8 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:42 +package parse_body diff --git a/request/parse_body/yml.go b/request/parse_body/yml.go new file mode 100644 index 0000000..8a18ca3 --- /dev/null +++ b/request/parse_body/yml.go @@ -0,0 +1,8 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:43 +package parse_body -- 2.36.6 From 56441151cfa9f21633d2abc6e95eb0f2f0fed09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 22 Oct 2024 17:14:53 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0json=E7=9A=84=E8=AF=B7?= =?UTF-8?q?=E6=B1=82Body=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.go | 12 +++++++++ request/parse_body/base.go | 46 +++++++++++++++++++++++++++++++++++ request/parse_body/execute.go | 21 ++++++++++++++++ request/parse_body/json.go | 41 +++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 init.go create mode 100644 request/parse_body/base.go diff --git a/init.go b/init.go new file mode 100644 index 0000000..5a03c6a --- /dev/null +++ b/init.go @@ -0,0 +1,12 @@ +// Package gin ... +// +// Description : gin ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 17:01 +package gin + +import ( + _ "git.zhangdeman.cn/zhangdeman/gin/request/parse_body" +) diff --git a/request/parse_body/base.go b/request/parse_body/base.go new file mode 100644 index 0000000..792fa8f --- /dev/null +++ b/request/parse_body/base.go @@ -0,0 +1,46 @@ +// Package parse_body ... +// +// Description : parse_body ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2024-10-22 16:51 +package parse_body + +import ( + "bytes" + "github.com/gin-gonic/gin" + "io" +) + +type base struct { +} + +// Unmarshal 反序列化方法,可以不指定 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:54 2024/10/22 +func (b base) Unmarshal() func(sourceData []byte, receiver any) error { + return nil +} + +// DoParse 解析 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 17:08 2024/10/22 +func (b base) DoParse(ctx *gin.Context, receiver any, unmarshalFunc func(sourceData []byte, receiver any) error) ([]byte, error) { + data, err := io.ReadAll(ctx.Request.Body) + if nil != err { + return nil, err + } + ctx.Request.Body = io.NopCloser(bytes.NewBuffer(data)) + if nil == unmarshalFunc || nil == receiver { + return data, nil + } + if err := unmarshalFunc(data, receiver); nil != err { + return nil, err + } + return data, err +} diff --git a/request/parse_body/execute.go b/request/parse_body/execute.go index 0455ce4..22937e5 100644 --- a/request/parse_body/execute.go +++ b/request/parse_body/execute.go @@ -18,6 +18,15 @@ var ( requestBodyParseAdaptorTable = map[string]abstract.RequestBodyParseAdaptor{} ) +func init() { + adaptorList := []abstract.RequestBodyParseAdaptor{ + JsonAdaptor{}, + } + for _, itemAdaptor := range adaptorList { + Register(itemAdaptor) + } +} + // Register 注册适配器实例 // // Author : go_developer@163.com<白茶清欢> @@ -45,3 +54,15 @@ func Execute(ctx *gin.Context, receiver any) ([]byte, error) { return parseResult, err } } + +// ExecuteForMap 高层级包装,表单解析为map +func ExecuteForMap(ctx *gin.Context) (map[string]any, error) { + var ( + err error + result map[string]any + ) + if _, err = Execute(ctx, &result); nil != err { + return nil, err + } + return result, nil +} diff --git a/request/parse_body/json.go b/request/parse_body/json.go index 676d6c7..cb2301c 100644 --- a/request/parse_body/json.go +++ b/request/parse_body/json.go @@ -6,3 +6,44 @@ // // Date : 2024-10-22 16:42 package parse_body + +import ( + "git.zhangdeman.cn/zhangdeman/consts" + "git.zhangdeman.cn/zhangdeman/serialize" + "github.com/gin-gonic/gin" +) + +type JsonAdaptor struct { + base +} + +// Parse 解析json请求体 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 17:13 2024/10/22 +func (j JsonAdaptor) Parse(ctx *gin.Context, receiver any) ([]byte, error) { + unmarshalFunc := j.Unmarshal() + if nil == unmarshalFunc { + unmarshalFunc = serialize.JSON.UnmarshalWithNumber + } + return j.DoParse(ctx, receiver, unmarshalFunc) +} + +// Unmarshal 指定解析方法 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:56 2024/10/22 +func (j JsonAdaptor) Unmarshal() func(sourceData []byte, receiver any) error { + return serialize.JSON.UnmarshalWithNumber +} + +// ContentType 请求类型固定返回json +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 16:59 2024/10/22 +func (j JsonAdaptor) ContentType() string { + return consts.MimeTypeJson +} -- 2.36.6 From cffb0c87795cfbe226c8c6c4bd1017fa1b920a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 22 Oct 2024 17:20:30 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0form=20url=20encode?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request/parse_body/execute.go | 1 + request/parse_body/form_url_encode.go | 36 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/request/parse_body/execute.go b/request/parse_body/execute.go index 22937e5..bc023c4 100644 --- a/request/parse_body/execute.go +++ b/request/parse_body/execute.go @@ -21,6 +21,7 @@ var ( func init() { adaptorList := []abstract.RequestBodyParseAdaptor{ JsonAdaptor{}, + FormUrlEncode{}, } for _, itemAdaptor := range adaptorList { Register(itemAdaptor) diff --git a/request/parse_body/form_url_encode.go b/request/parse_body/form_url_encode.go index 8a18ca3..a456279 100644 --- a/request/parse_body/form_url_encode.go +++ b/request/parse_body/form_url_encode.go @@ -6,3 +6,39 @@ // // Date : 2024-10-22 16:43 package parse_body + +import ( + "encoding/json" + "git.zhangdeman.cn/zhangdeman/consts" + "git.zhangdeman.cn/zhangdeman/serialize" + "github.com/gin-gonic/gin" +) + +type FormUrlEncode struct { + base +} + +func (f FormUrlEncode) Parse(ctx *gin.Context, receiver any) ([]byte, error) { + if err := ctx.Request.ParseForm(); nil != err { + return nil, err + } + body := map[string]string{} + for paramName, itemParam := range ctx.Request.PostForm { + if len(itemParam) > 0 { + body[paramName] = itemParam[0] + } else { + body[paramName] = "" + } + } + byteData, _ := json.Marshal(body) + if nil != receiver { + if err := serialize.JSON.UnmarshalWithNumber(byteData, receiver); nil != receiver { + return nil, err + } + } + return byteData, nil +} + +func (f FormUrlEncode) ContentType() string { + return consts.MimeTypeXWWWFormUrlencoded +} -- 2.36.6 From a0b4cdb41433bed531ad65d28b0b0df24c892888 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, 4 Nov 2024 15:57:39 +0800 Subject: [PATCH 5/8] update go mod --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 221a322..be1adf2 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,11 @@ go 1.21.0 toolchain go1.23.1 require ( - git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763 + git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059 git.zhangdeman.cn/zhangdeman/exception v0.0.0-20240930081343-1e7f84ed8465 git.zhangdeman.cn/zhangdeman/logger v0.0.0-20240725055115-98eb52ae307a git.zhangdeman.cn/zhangdeman/network v0.0.0-20230925112156-f0eb86dd2442 + git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558 git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20241013112816-e3de2835a971 github.com/gin-gonic/gin v1.10.0 github.com/go-playground/validator/v10 v10.22.1 @@ -22,7 +23,6 @@ require ( git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda // indirect git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 // indirect git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 // indirect - git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240618035451-8d48a6bd39dd // indirect git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e // indirect git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2 // indirect github.com/BurntSushi/toml v1.4.0 // indirect diff --git a/go.sum b/go.sum index 2550479..fdc7212 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240924065029-c865046cd9e7 h1:tyCPCM git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240924065029-c865046cd9e7/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763 h1:aG59AjZAn/Y+smWoa6l6HQB+yh/Rpml79EvmfjEb6Ks= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059 h1:TPAYdTKKUjgxtCnK38d1Tb4teyQp1C7wYHPdR32yZtM= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda h1:bMD6r9gjRy7cO+T4zRQVYAesgIblBdTnhzT1vN5wjvI= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda/go.mod h1:dT0rmHcJ9Z9IqWeMIt7YzR88nKkNV2V3dfG0j9Q6lK0= git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 h1:I/wOsRpCSRkU9vo1u703slQsmK0wnNeZzsWQOGtIAG0= @@ -17,6 +19,8 @@ git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 h1:gUDlQ git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0/go.mod h1:VHb9qmhaPDAQDcS6vUiDCamYjZ4R5lD1XtVsh55KsMI= git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240618035451-8d48a6bd39dd h1:2Y37waOVCmVvx0Rp8VGEptE2/2JVMImtxB4dKKDk/3w= git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240618035451-8d48a6bd39dd/go.mod h1:6+7whkCmb4sJDIfH3HxNuXRveaM0gCCNWd2uXZqNtIE= +git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558 h1:ZVJyyDKfYeA3TsN8UOi4IprkouK4wIIfCKe+F9byLWA= +git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558/go.mod h1:/9eicss/Dt9tp2jwZ/4cXDqDKo/Dez+HuT5/NGdqW+s= 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= git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2 h1:P2kuhU2TFWk9mPbJlZCK6FMDVS7S3NGafWKD4eNqKiI= -- 2.36.6 From f6db9e8edba6d79c8347c64df1d0af905d8fe912 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, 4 Nov 2024 16:12:09 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20wrapperHandle=20->=20P?= =?UTF-8?q?arseBody?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request/wrapper.go | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/request/wrapper.go b/request/wrapper.go index 9e149cb..85cc7f1 100644 --- a/request/wrapper.go +++ b/request/wrapper.go @@ -8,11 +8,9 @@ package request import ( - "bytes" - "git.zhangdeman.cn/zhangdeman/consts" + "git.zhangdeman.cn/zhangdeman/gin/request/parse_body" "git.zhangdeman.cn/zhangdeman/wrapper" "github.com/gin-gonic/gin" - "io" "strings" ) @@ -140,28 +138,8 @@ func (wh *wrapperHandle) GetDomain(ctx *gin.Context) string { // Date : 11:25 2024/7/26 func (wh *wrapperHandle) ParseBody(ctx *gin.Context) map[string]any { body := map[string]any{} - contentType := wh.GetContentType(ctx, "") - if strings.Contains(contentType, consts.MimeTypeXWWWFormUrlencoded) { // form请求 - if err := ctx.Request.ParseForm(); nil != err { - return body - } - for paramName, itemParam := range ctx.Request.PostForm { - if len(itemParam) > 0 { - body[paramName] = itemParam[0] - } else { - body[paramName] = "" - } - } - return body - } - - if strings.Contains(contentType, consts.MimeTypeJson) || nil != ctx.Request.Body { // json请求 或者非 json请求 存在 body - data, err := io.ReadAll(ctx.Request.Body) - if nil != err { - return body - } - ctx.Request.Body = io.NopCloser(bytes.NewBuffer(data)) - return body + if _, err := parse_body.Execute(ctx, &body); nil != err { + return map[string]any{} } return body -- 2.36.6 From 6a917d338ae6cd64d0cd3a279f17d74ac3842517 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, 4 Nov 2024 17:06:51 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=94=AF=E6=8C=81xml=20body=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 ++- go.sum | 6 ++++++ request/parse_body/execute.go | 1 + request/parse_body/xml.go | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index be1adf2..0105eb7 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21.0 toolchain go1.23.1 require ( - git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059 + git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104082108-0f97a870bbc3 git.zhangdeman.cn/zhangdeman/exception v0.0.0-20240930081343-1e7f84ed8465 git.zhangdeman.cn/zhangdeman/logger v0.0.0-20240725055115-98eb52ae307a git.zhangdeman.cn/zhangdeman/network v0.0.0-20230925112156-f0eb86dd2442 @@ -53,6 +53,7 @@ require ( github.com/mssola/user_agent v0.6.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/sbabiv/xml2map v1.2.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect diff --git a/go.sum b/go.sum index fdc7212..16ce8ba 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,10 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763 h1:aG59Aj git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241015035056-b6f4a6512763/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059 h1:TPAYdTKKUjgxtCnK38d1Tb4teyQp1C7wYHPdR32yZtM= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241023090605-10cff9173059/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104081823-ab1d691f309d h1:LvQIKDKQ6NNgX/3l3A7tukOFcUeTzC1kEZSeq8eIdUU= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104081823-ab1d691f309d/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104082108-0f97a870bbc3 h1:BiAlBJ+DuRs/xD7nDQD2JT8Oc+V+0Uwt36qZwdXGvzI= +git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104082108-0f97a870bbc3/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda h1:bMD6r9gjRy7cO+T4zRQVYAesgIblBdTnhzT1vN5wjvI= git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda/go.mod h1:dT0rmHcJ9Z9IqWeMIt7YzR88nKkNV2V3dfG0j9Q6lK0= git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 h1:I/wOsRpCSRkU9vo1u703slQsmK0wnNeZzsWQOGtIAG0= @@ -120,6 +124,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sbabiv/xml2map v1.2.1 h1:1lT7t0hhUvXZCkdxqtq4n8/ZCnwLWGq4rDuDv5XOoFE= +github.com/sbabiv/xml2map v1.2.1/go.mod h1:2TPoAfcaM7+Sd4iriPvzyntb2mx7GY+kkQpB/GQa/eo= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/request/parse_body/execute.go b/request/parse_body/execute.go index bc023c4..fee7d20 100644 --- a/request/parse_body/execute.go +++ b/request/parse_body/execute.go @@ -22,6 +22,7 @@ func init() { adaptorList := []abstract.RequestBodyParseAdaptor{ JsonAdaptor{}, FormUrlEncode{}, + XmlAdaptor{}, } for _, itemAdaptor := range adaptorList { Register(itemAdaptor) diff --git a/request/parse_body/xml.go b/request/parse_body/xml.go index 676d6c7..584b0a0 100644 --- a/request/parse_body/xml.go +++ b/request/parse_body/xml.go @@ -6,3 +6,37 @@ // // Date : 2024-10-22 16:42 package parse_body + +import ( + "bytes" + "git.zhangdeman.cn/zhangdeman/consts" + "git.zhangdeman.cn/zhangdeman/serialize" + "github.com/gin-gonic/gin" + "github.com/sbabiv/xml2map" +) + +type XmlAdaptor struct { + base +} + +func (x XmlAdaptor) Parse(ctx *gin.Context, receiver any) ([]byte, error) { + unmarshalFunc := x.Unmarshal() + if nil == unmarshalFunc { + unmarshalFunc = serialize.Xml.UnmarshalWithNumber + } + return x.DoParse(ctx, receiver, unmarshalFunc) +} + +func (x XmlAdaptor) Unmarshal() func(sourceData []byte, receiver any) error { + return func(sourceData []byte, receiver any) error { + res, err := xml2map.NewDecoder(bytes.NewReader(sourceData)).Decode() + if nil != err { + return err + } + return serialize.JSON.Transition(res, receiver) + } +} + +func (x XmlAdaptor) ContentType() string { + return consts.MimeTypeXml +} -- 2.36.6 From 196c420fcc2516c04335b94d6ae2b0d8f29ab793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 5 Nov 2024 17:31:44 +0800 Subject: [PATCH 8/8] update go mod --- go.mod | 6 +++--- go.sum | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0105eb7..0b986d3 100644 --- a/go.mod +++ b/go.mod @@ -9,12 +9,13 @@ require ( git.zhangdeman.cn/zhangdeman/exception v0.0.0-20240930081343-1e7f84ed8465 git.zhangdeman.cn/zhangdeman/logger v0.0.0-20240725055115-98eb52ae307a git.zhangdeman.cn/zhangdeman/network v0.0.0-20230925112156-f0eb86dd2442 - git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558 + git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241104092308-ecb02113459e git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20241013112816-e3de2835a971 github.com/gin-gonic/gin v1.10.0 github.com/go-playground/validator/v10 v10.22.1 github.com/mcuadros/go-defaults v1.2.0 github.com/pkg/errors v0.9.1 + github.com/sbabiv/xml2map v1.2.1 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 ) @@ -27,7 +28,7 @@ require ( git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2 // indirect github.com/BurntSushi/toml v1.4.0 // indirect github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect - github.com/bytedance/sonic v1.12.3 // indirect + github.com/bytedance/sonic v1.12.4 // indirect github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect @@ -53,7 +54,6 @@ require ( github.com/mssola/user_agent v0.6.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sbabiv/xml2map v1.2.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect diff --git a/go.sum b/go.sum index 16ce8ba..c3d4640 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,8 @@ git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240618035451-8d48a6bd39dd h1:2Y3 git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20240618035451-8d48a6bd39dd/go.mod h1:6+7whkCmb4sJDIfH3HxNuXRveaM0gCCNWd2uXZqNtIE= git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558 h1:ZVJyyDKfYeA3TsN8UOi4IprkouK4wIIfCKe+F9byLWA= git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241023104258-2e0a298aa558/go.mod h1:/9eicss/Dt9tp2jwZ/4cXDqDKo/Dez+HuT5/NGdqW+s= +git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241104092308-ecb02113459e h1:A045F67AMSqFKGD9kk2uLa+6c/zpmW8vjjSRmSsdjPs= +git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241104092308-ecb02113459e/go.mod h1:XqgER4jDYwskFgj2riJ9XptIjzgYWubY+Zq8iB2WkY0= 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= git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20240723075210-85feada512b2 h1:P2kuhU2TFWk9mPbJlZCK6FMDVS7S3NGafWKD4eNqKiI= @@ -39,6 +41,8 @@ github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+I github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg= github.com/bytedance/sonic v1.12.3 h1:W2MGa7RCU1QTeYRTPE3+88mVC0yXmsRQRChiyVocVjU= github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic v1.12.4 h1:9Csb3c9ZJhfUWeMtpCDCq6BUoH5ogfDFLUgQ/jG+R0k= +github.com/bytedance/sonic v1.12.4/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -- 2.36.6