From 65bbc033bf12d0022fb7d66e890902ad95332198 Mon Sep 17 00:00:00 2001 From: ctfang <2206582181@qq.com> Date: Sun, 10 Apr 2022 12:56:37 +0800 Subject: [PATCH] first --- console/commands/orm/mysql.go.text | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/console/commands/orm/mysql.go.text b/console/commands/orm/mysql.go.text index 6a750ba..623ab39 100644 --- a/console/commands/orm/mysql.go.text +++ b/console/commands/orm/mysql.go.text @@ -130,10 +130,10 @@ func (orm *OrmMysqlTableName) Count() int64 { } // First 检索单个对象 -func (orm *OrmMysqlTableName) First(conds ...interface{}) (*MysqlTableName, int64) { +func (orm *OrmMysqlTableName) First(conds ...interface{}) (*MysqlTableName, bool) { dest := &MysqlTableName{} db := orm.db.Limit(1).Find(dest, conds...) - return dest, db.RowsAffected + return dest, db.RowsAffected == 1 } // Take return a record that match given conditions, the order will depend on the database implementation