Skip to content

Commit

Permalink
fix -cache=true insert no clean cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaelemmmm committed Mar 20, 2022
1 parent f0c935a commit 9fcdb9f
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion tools/goctl/model/sql/gen/insert.go
Expand Up @@ -55,7 +55,6 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error)
Parse(text).
Execute(map[string]interface{}{
"withCache": withCache,
"containsIndexCache": table.ContainsUniqueCacheKey,
"upperStartCamelObject": camel,
"lowerStartCamelObject": stringx.From(camel).Untitle(),
"expression": strings.Join(expressions, ", "),
Expand Down

1 comment on commit 9fcdb9f

@Mikaelemmmm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在生成model代码指定-cache=true时,如果表中只有主键没有其他唯一索引时候,insert是不删除缓存的,但是findone会查缓存,这样会有问题在findone不存在的数据时候会缓存* ,那先findone在insert就会有问题

When the generated model code specifies - cache = true, if there is only a primary key in the table and there is no other unique index, the insert will not delete the cache, but findone will check the cache, which will cause problems. If there is no data in findone, it will cache *, then findone will have problems in the insert first

Please sign in to comment.