mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
add limit 1 for function One of package gdb
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user