Implemented postgres table and enum comment generation
This commit is contained in:
parent
929109622e
commit
ff82eb5df7
4 changed files with 33 additions and 3 deletions
|
|
@ -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, "")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue