From b89a28f0bccd62c637ccce384377c603f759f448 Mon Sep 17 00:00:00 2001 From: zxdstyle <1430822515@qq.com> Date: Thu, 21 Oct 2021 18:18:34 +0800 Subject: [PATCH 1/2] Update go.mod --- go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/go.mod b/go.mod index 69e74ac..3d427b7 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.14 require ( github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e github.com/gogf/gf/v2 v2.0.0-20211012081552-854747574d9e + github.com/jinzhu/inflection v1.0.0 github.com/lib/pq v1.2.0 github.com/mattn/go-runewidth v0.0.10 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect From 75907067c747b13be837125e5b59149854877123 Mon Sep 17 00:00:00 2001 From: zxdstyle <1430822515@qq.com> Date: Thu, 21 Oct 2021 18:19:26 +0800 Subject: [PATCH 2/2] Update gen_dao.go --- command/gen/gen_dao.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/command/gen/gen_dao.go b/command/gen/gen_dao.go index 3eaf44a..3c305dd 100644 --- a/command/gen/gen_dao.go +++ b/command/gen/gen_dao.go @@ -18,6 +18,7 @@ import ( "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" + "github.com/jinzhu/inflection" "github.com/olekukonko/tablewriter" _ "github.com/denisenkom/go-mssqldb" @@ -281,7 +282,7 @@ func doGenDaoForArray(index int, parser *gcmd.Parser) { // Generating dao & model go files one by one according to given table name. newTableNames := make([]string, len(tableNames)) for i, tableName := range tableNames { - newTableName := tableName + newTableName := inflection.Singular(tableName) for _, v := range removePrefixArray { newTableName = gstr.TrimLeftStr(newTableName, v, 1) }