add limit 1 for function One of package gdb

This commit is contained in:
john
2020-07-14 21:42:28 +08:00
parent 05cc0c4644
commit aaa726e6dc

View File

@ -91,7 +91,7 @@ func (m *Model) One(where ...interface{}) (Record, error) {
if len(where) > 0 {
return m.Where(where[0], where[1:]...).One()
}
all, err := m.All()
all, err := m.Limit(1).All()
if err != nil {
return nil, err
}