feat:filter_test_suffix
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"go/token"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// AutoCodeStruct 初始版本自动化代码工具
|
||||
@@ -23,6 +24,11 @@ type AutoCodeStruct struct {
|
||||
PackageT string `json:"-"`
|
||||
}
|
||||
|
||||
func (a *AutoCodeStruct) Pretreatment() {
|
||||
a.KeyWord()
|
||||
a.SuffixTest()
|
||||
}
|
||||
|
||||
// KeyWord 是go关键字的处理加上 _ ,防止编译报错
|
||||
// Author [SliverHorn](https://github.com/SliverHorn)
|
||||
func (a *AutoCodeStruct) KeyWord() {
|
||||
@@ -31,6 +37,14 @@ func (a *AutoCodeStruct) KeyWord() {
|
||||
}
|
||||
}
|
||||
|
||||
// SuffixTest 处理_test 后缀
|
||||
// Author [SliverHorn](https://github.com/SliverHorn)
|
||||
func (a *AutoCodeStruct) SuffixTest() {
|
||||
if strings.HasSuffix(a.Package, "test") {
|
||||
a.Package = a.Package + "_"
|
||||
}
|
||||
}
|
||||
|
||||
type Field struct {
|
||||
FieldName string `json:"fieldName"` // Field名
|
||||
FieldDesc string `json:"fieldDesc"` // 中文名
|
||||
|
||||
Reference in New Issue
Block a user