github.com/gogf/gf/v2@v2.7.4/database/gdb/gdb_model_lock.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gdb 8 9 // LockUpdate sets the lock for update for current operation. 10 func (m *Model) LockUpdate() *Model { 11 model := m.getModel() 12 model.lockInfo = "FOR UPDATE" 13 return model 14 } 15 16 // LockShared sets the lock in share mode for current operation. 17 func (m *Model) LockShared() *Model { 18 model := m.getModel() 19 model.lockInfo = "LOCK IN SHARE MODE" 20 return model 21 }