Extracted golang comment format function
This commit is contained in:
parent
30e02dc9c0
commit
64884e4969
7 changed files with 50 additions and 44 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue