From 9679f5e22a704569289c488e8b1e7573627c400a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?maxin=5B=E9=A9=AC=E9=91=AB=5D?= Date: Tue, 12 Apr 2016 21:28:29 +0800 Subject: [PATCH] reduce the data transmission --- orm/orm_queryset.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/orm/orm_queryset.go b/orm/orm_queryset.go index 9c2e68aa..87229cfb 100644 --- a/orm/orm_queryset.go +++ b/orm/orm_queryset.go @@ -192,7 +192,9 @@ func (o *querySet) All(container interface{}, cols ...string) (int64, error) { // query one row data and map to containers. // cols means the columns when querying. func (o *querySet) One(container interface{}, cols ...string) error { - o.limit = 1 + if o.limit != 1 { + o.limit = 2 + } num, err := o.orm.alias.DbBaser.ReadBatch(o.orm.db, o, o.mi, o.cond, container, o.orm.alias.TZ, cols) if err != nil { return err