Implemented postgres table and enum comment generation

This commit is contained in:
Volker Lieber 2024-09-24 20:41:27 +02:00
parent 929109622e
commit ff82eb5df7
4 changed files with 33 additions and 3 deletions

View file

@ -1,7 +1,20 @@
package metadata
import "regexp"
// Enum metadata struct
type Enum struct {
Name string `sql:"primary_key"`
Values []string
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, "")
}