Skip to content

Commit daa4fbf

Browse files
committed
feat(goctl): add withCache value for deleteMethod/findOneMethod/findOneByFieldExtraMethod/insertMethod/updateMethod tpl
feat(goctl): add withCache value for deleteMethod/findOneMethod/findOneByFieldExtraMethod/insertMethod/updateMethod tpl
1 parent 39729f3 commit daa4fbf

File tree

5 files changed

+7
-1
lines changed

5 files changed

+7
-1
lines changed

tools/goctl/model/sql/gen/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func genDelete(table Table, withCache, postgreSql bool) (string, string, error)
5858
deleteMethodOut, err := util.With("deleteMethod").
5959
Parse(text).
6060
Execute(map[string]any{
61+
"withCache": withCache,
6162
"lowerStartCamelPrimaryKey": util.EscapeGolangKeyword(stringx.From(table.PrimaryKey.Name.ToCamel()).Untitle()),
6263
"dataType": table.PrimaryKey.DataType,
6364
"data": table,

tools/goctl/model/sql/gen/findone.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func genFindOne(table Table, withCache, postgreSql bool) (string, string, error)
4040
findOneMethod, err := util.With("findOneMethod").
4141
Parse(text).
4242
Execute(map[string]any{
43+
"withCache": withCache,
4344
"upperStartCamelObject": camel,
4445
"lowerStartCamelPrimaryKey": util.EscapeGolangKeyword(stringx.From(table.PrimaryKey.Name.ToCamel()).Untitle()),
4546
"dataType": table.PrimaryKey.DataType,

tools/goctl/model/sql/gen/findonebyfield.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func genFindOneByField(table Table, withCache, postgreSql bool) (*findOneCode, e
6969
in = inJoin.With(", ").Source()
7070
}
7171
output, err := t.Execute(map[string]any{
72+
"withCache": withCache,
7273
"upperStartCamelObject": camelTableName,
7374
"upperField": key.FieldNameJoin.Camel().With("").Source(),
7475
"in": in,
@@ -89,6 +90,7 @@ func genFindOneByField(table Table, withCache, postgreSql bool) (*findOneCode, e
8990
}
9091

9192
out, err := util.With("findOneByFieldExtraMethod").Parse(text).Execute(map[string]any{
93+
"withCache": withCache,
9294
"upperStartCamelObject": camelTableName,
9395
"primaryKeyLeft": table.PrimaryCacheKey.VarLeft,
9496
"lowerStartCamelObject": stringx.From(camelTableName).Untitle(),

tools/goctl/model/sql/gen/insert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error)
4141
}
4242
}
4343

44-
count += 1
44+
count++
4545
if postgreSql {
4646
expressions = append(expressions, fmt.Sprintf("$%d", count))
4747
} else {
@@ -79,6 +79,7 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error)
7979
}
8080

8181
insertMethodOutput, err := util.With("insertMethod").Parse(text).Execute(map[string]any{
82+
"withCache": withCache,
8283
"upperStartCamelObject": camel,
8384
"data": table,
8485
})

tools/goctl/model/sql/gen/update.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func genUpdate(table Table, withCache, postgreSql bool) (
9696

9797
updateMethodOutput, err := util.With("updateMethod").Parse(text).Execute(
9898
map[string]any{
99+
"withCache": withCache,
99100
"upperStartCamelObject": camelTableName,
100101
"data": table,
101102
},

0 commit comments

Comments
 (0)