Extracted golang comment format function

This commit is contained in:
Volker Lieber 2024-09-26 14:17:21 +02:00
parent 30e02dc9c0
commit 64884e4969
7 changed files with 50 additions and 44 deletions

View file

@ -1,7 +1,5 @@
package metadata
import "regexp"
// Table metadata struct
type Table struct {
Name string `sql:"primary_key"`
@ -23,13 +21,3 @@ func (t Table) MutableColumns() []Column {
return ret
}
// GoLangComment returns table comment without ascii control characters
func (t Table) GoLangComment() string {
if t.Comment == "" {
return ""
}
// remove ascii control characters from string
return regexp.MustCompile(`[[:cntrl:]]+`).ReplaceAllString(t.Comment, "")
}