From 7649b41e9a89fe6d3523a63577ad56304ca96757 Mon Sep 17 00:00:00 2001 From: hao Date: Tue, 3 Nov 2020 18:21:31 +0800 Subject: [PATCH] add limit --- template/sql.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/template/sql.tpl b/template/sql.tpl index 6cfb4b5..e1fc2c7 100644 --- a/template/sql.tpl +++ b/template/sql.tpl @@ -256,7 +256,8 @@ func SQLGet{{$tableInfo.TableNameCamel}}Col(ctx context.Context, tx mcommon.DbEx FROM {{$tableInfo.TableName}} WHERE - id=:id`) + id=:id +LIMIT 1`) var row DB{{$tableInfo.TableNameCamel}} ok, err := mcommon.DbGetNamedContent( @@ -318,6 +319,7 @@ FROM query.WriteString("\n") argMap[key] = value } + query.WriteString("LIMIT 1") var row DB{{$tableInfo.TableNameCamel}} ok, err := mcommon.DbGetNamedContent(