gdb_model_lock.go 622 B

123456789101112131415161718192021
  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. package gdb
  7. // LockUpdate sets the lock for update for current operation.
  8. func (m *Model) LockUpdate() *Model {
  9. model := m.getModel()
  10. model.lockInfo = "FOR UPDATE"
  11. return model
  12. }
  13. // LockShared sets the lock in share mode for current operation.
  14. func (m *Model) LockShared() *Model {
  15. model := m.getModel()
  16. model.lockInfo = "LOCK IN SHARE MODE"
  17. return model
  18. }