v0.0.335 added DescriptionMeta
to enum codegen
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 58s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 58s
This commit is contained in:
parent
2fad6340c7
commit
af38b06d22
@ -75,6 +75,12 @@ func (e {{.EnumTypeName}}) Meta() enums.EnumMetaValue {
|
|||||||
{{if $hasDescr}} return enums.EnumMetaValue{VarName: e.VarName(), Value: e, Description: langext.Ptr(e.Description())} {{else}} return enums.EnumMetaValue{VarName: e.VarName(), Value: e, Description: nil} {{end}}
|
{{if $hasDescr}} return enums.EnumMetaValue{VarName: e.VarName(), Value: e, Description: langext.Ptr(e.Description())} {{else}} return enums.EnumMetaValue{VarName: e.VarName(), Value: e, Description: nil} {{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{if $hasDescr}}
|
||||||
|
func (e {{.EnumTypeName}}) DescriptionMeta() enums.EnumDescriptionMetaValue {
|
||||||
|
return enums.EnumDescriptionMetaValue{VarName: e.VarName(), Value: e.String(), Description: e.Description()}
|
||||||
|
}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
func Parse{{.EnumTypeName}}(vv string) ({{.EnumTypeName}}, bool) {
|
func Parse{{.EnumTypeName}}(vv string) ({{.EnumTypeName}}, bool) {
|
||||||
for _, ev := range __{{.EnumTypeName}}Values {
|
for _, ev := range __{{.EnumTypeName}}Values {
|
||||||
if string(ev) == vv {
|
if string(ev) == vv {
|
||||||
@ -94,4 +100,12 @@ func {{.EnumTypeName}}ValuesMeta() []enums.EnumMetaValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{if $hasDescr}}
|
||||||
|
func (e {{.EnumTypeName}}) ValuesDescriptionMeta() []enums.EnumDescriptionMetaValue {
|
||||||
|
return []enums.EnumMetaValue{ {{range .Values}}
|
||||||
|
{{.VarName}}.DescriptionMeta(), {{end}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
@ -15,10 +15,17 @@ type StringEnum interface {
|
|||||||
type DescriptionEnum interface {
|
type DescriptionEnum interface {
|
||||||
Enum
|
Enum
|
||||||
Description() string
|
Description() string
|
||||||
|
DescriptionMeta() EnumDescriptionMetaValue
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnumMetaValue struct {
|
type EnumMetaValue struct {
|
||||||
VarName string `json:"varName"`
|
VarName string `json:"varName"`
|
||||||
Value any `json:"value"`
|
Value Enum `json:"value"`
|
||||||
Description *string `json:"description"`
|
Description *string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EnumDescriptionMetaValue struct {
|
||||||
|
VarName string `json:"varName"`
|
||||||
|
Value Enum `json:"value"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.334"
|
const GoextVersion = "0.0.335"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-12-05T19:23:27+0100"
|
const GoextVersionTimestamp = "2023-12-05T19:38:03+0100"
|
||||||
|
Loading…
Reference in New Issue
Block a user