module Jennifer::Model::OptimisticLocking
Direct including types
Defined in:
jennifer/model/optimistic_locking.crMacro Summary
- 
        with_optimistic_lock(locking_column = lock_version)
        
          
Add optimistic locking to model By default, it uses column
lock_version : Int32as lock The column used as lock must be typeInt32orInt64and the default value of 0 You can use a different column name as lock by passing the column name to the method. 
Macro Detail
        
        macro with_optimistic_lock(locking_column = lock_version)
        #
      
      
        Add optimistic locking to model
By default, it uses column lock_version : Int32 as lock
The column used as lock must be type Int32 or Int64 and the default value of 0
You can use a different column name as lock by passing the column name to the method.
class MyModel < Jennifer::Model::Base
  with_optimistic_lock
  mapping(
    id: {type: Int32, primary: true},
    lock_version: {type: Int32, default: 0},
  )
end
Or use a custom column name for the locking column:
class MyModel < Jennifer::Model::Base
  with_optimistic_lock :custom_lock
  mapping(
    id: {type: Int32, primary: true},
    custom_lock: {type: Int32, default: 0},
  )
end