Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-home committed Apr 10, 2022
1 parent ce47cee commit 65bbc03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions console/commands/orm/mysql.go.text
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65bbc03

Please sign in to comment.