chore: fix golint issues (#1396)
This commit is contained in:
3
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
Executable file → Normal file
3
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
Executable file → Normal file
@@ -1,4 +1,5 @@
|
||||
package api // ApiParser
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package spec
|
||||
|
||||
// RoutePrefixKey is the prefix keyword for the routes.
|
||||
const RoutePrefixKey = "prefix"
|
||||
|
||||
type (
|
||||
|
||||
@@ -371,6 +371,7 @@ func getTableFields(table *model.Table) (map[string]*Field, error) {
|
||||
return fieldM, nil
|
||||
}
|
||||
|
||||
// GetSafeTables escapes the golang keywords from sql tables.
|
||||
func GetSafeTables(tables []*parser.Table) []*parser.Table {
|
||||
var list []*parser.Table
|
||||
for _, t := range tables {
|
||||
@@ -381,6 +382,7 @@ func GetSafeTables(tables []*parser.Table) []*parser.Table {
|
||||
return list
|
||||
}
|
||||
|
||||
// GetSafeTable escapes the golang keywords from sql table.
|
||||
func GetSafeTable(table *parser.Table) *parser.Table {
|
||||
table.Name = su.EscapeGolangKeyword(table.Name)
|
||||
for _, c := range table.Columns {
|
||||
|
||||
@@ -96,6 +96,7 @@ func isNumber(r rune) bool {
|
||||
return '0' <= r && r <= '9'
|
||||
}
|
||||
|
||||
// EscapeGolangKeyword escapes the golang keywords.
|
||||
func EscapeGolangKeyword(s string) string {
|
||||
if !isGolangKeyword(s) {
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user