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,9 +1,5 @@
package metadata
import (
"regexp"
)
// Column struct
type Column struct {
Name string `sql:"primary_key"`
@ -15,16 +11,6 @@ type Column struct {
Comment string
}
// GoLangComment returns column comment without ascii control characters
func (c Column) GoLangComment() string {
if c.Comment == "" {
return ""
}
// remove ascii control characters from string
return regexp.MustCompile(`[[:cntrl:]]+`).ReplaceAllString(c.Comment, "")
}
// DataTypeKind is database type kind(base, enum, user-defined, array)
type DataTypeKind string