2021-07-27 17:39:21 +02:00
|
|
|
package metadata
|
|
|
|
|
|
2024-09-24 20:41:27 +02:00
|
|
|
import "regexp"
|
|
|
|
|
|
2021-07-27 17:39:21 +02:00
|
|
|
// Enum metadata struct
|
|
|
|
|
type Enum struct {
|
2024-09-24 20:41:27 +02:00
|
|
|
Name string `sql:"primary_key"`
|
|
|
|
|
Comment string
|
|
|
|
|
Values []string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GoLangComment returns enum comment without ascii control characters
|
|
|
|
|
func (e Enum) GoLangComment() string {
|
|
|
|
|
if e.Comment == "" {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// remove ascii control characters from string
|
|
|
|
|
return regexp.MustCompile(`[[:cntrl:]]+`).ReplaceAllString(e.Comment, "")
|
2021-07-27 17:39:21 +02:00
|
|
|
}
|