瀏覽代碼

FindOneBy 漏 Context (#1642)

xybingbing 3 年之前
父節點
當前提交
09e6d94f9e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      tools/goctl/model/sql/template/find.go

+ 1 - 1
tools/goctl/model/sql/template/find.go

@@ -32,7 +32,7 @@ func (m *default{{.upperStartCamelObject}}Model) FindOne(ctx context.Context, {{
 
 // FindOneByField defines find row by field.
 var FindOneByField = `
-func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}({{.in}}) (*{{.upperStartCamelObject}}, error) {
+func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error) {
 	{{if .withCache}}{{.cacheKey}}
 	var resp {{.upperStartCamelObject}}
 	err := m.QueryRowIndexCtx(ctx, &resp, {{.cacheKeyVariable}}, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) (i interface{}, e error) {