fix-break-line

master
stevenzack 4 years ago committed by Kevin Wan
parent 926d746df5
commit de2f8c06fb

@ -2,6 +2,7 @@ package ktgen
import (
"errors"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
"github.com/urfave/cli"

@ -1,17 +1,20 @@
package ktgen
import (
"github.com/tal-tech/go-zero/tools/goctl/api/util"
"log"
"strings"
"text/template"
"github.com/tal-tech/go-zero/tools/goctl/api/util"
)
var funcsMap = template.FuncMap{
"lowCamelCase": lowCamelCase,
"pathToFuncName": pathToFuncName,
"parseType": parseType,
"add": add,
}
func lowCamelCase(s string) string {
if len(s) < 1 {
return ""
@ -25,12 +28,13 @@ func pathToFuncName(path string) string {
path = "/" + path
}
path = strings.Replace(path, "/", "_", -1)
path = strings.Replace(path, "-", "_", -1)
path = strings.ReplaceAll(path, "/", "_")
path = strings.ReplaceAll(path, "-", "_")
camel := util.ToCamelCase(path)
return util.ToLower(camel[:1]) + camel[1:]
}
func parseType(t string) string {
t = strings.Replace(t, "*", "", -1)
if strings.HasPrefix(t, "[]") {

@ -1,13 +1,14 @@
package ktgen
import (
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
"log"
"os"
"path/filepath"
"text/template"
"github.com/iancoleman/strcase"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
)
const (

Loading…
Cancel
Save