diff --git a/bfcodegen/csid-generate.template b/bfcodegen/csid-generate.template index 9c1aa8b..b141d64 100644 --- a/bfcodegen/csid-generate.template +++ b/bfcodegen/csid-generate.template @@ -167,7 +167,10 @@ func (id {{.Name}}) Valid() error { return validateID(prefix{{.Name}}, string(id)) } -func (i {{.Name}}) String() string { +func (i *{{.Name}}) String() string { + if i == nil { + return "" + } return string(i) } diff --git a/bfcodegen/enum-generate.template b/bfcodegen/enum-generate.template index ec6fbd8..e3915b2 100644 --- a/bfcodegen/enum-generate.template +++ b/bfcodegen/enum-generate.template @@ -69,7 +69,10 @@ func (e {{.EnumTypeName}}) ValuesMeta() []enums.EnumMetaValue { } {{if $hasStr}} -func (e {{.EnumTypeName}}) String() string { +func (e *{{.EnumTypeName}}) String() string { + if i == nil { + return "" + } return string(e) } {{end}} diff --git a/bfcodegen/id-generate.template b/bfcodegen/id-generate.template index 7111fe4..1181a93 100644 --- a/bfcodegen/id-generate.template +++ b/bfcodegen/id-generate.template @@ -21,7 +21,10 @@ func (i {{.Name}}) MarshalBSONValue() (bsontype.Type, []byte, error) { } } -func (i {{.Name}}) String() string { +func (i *{{.Name}}) String() string { + if i == nil { + return "" + } return string(i) } diff --git a/go.mod b/go.mod index 9f59a89..9d19e0f 100644 --- a/go.mod +++ b/go.mod @@ -22,11 +22,11 @@ require ( require ( 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/dustin/go-humanize v1.0.1 // 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-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect diff --git a/go.sum b/go.sum index b996de0..6148d18 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,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= @@ -20,6 +22,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= 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= diff --git a/goextVersion.go b/goextVersion.go index f6f8593..42d5da4 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.532" +const GoextVersion = "0.0.533" -const GoextVersionTimestamp = "2024-10-13T16:33:39+0200" +const GoextVersionTimestamp = "2024-10-22T09:36:40+0200"