With this change, undo & redo log will support same API to Log & read back the values. ReadLog() now also supports reading back slices, slice elements & reslicing.
Updates to Log() API
For Logging, the old usage was:
//undoTx
undoTx.Log(&a)
a = 10.1
//redoTx
redoTx.Log(&a,10.1)
New usage:
tx.Log(&a, 10.1) // does the a = 10.1 operation internally if tx == undoTx
For undo transactions, the old usage is also supported. So, both of the following are valid & do the same thing:
// OLD WAY, STILL WORKS
undoTx.Log(&a)
a = 10.1
// NEW WAY, DOES SAME THING
undoTx.Log(&a, 10.1)
Updates to ReadLog() API. Works for both undo/redo tx
Slice elements can be read as follows:
f := tx.ReadLog(&slice1, 10).(float64) // Same as f := s slice1[10]
Slices can be read as follows:
s := tx.ReadLog(&slice1, 2,5).([]float64) // Same as f := slice1[2:5]t := tx.ReadLog(&slice2) // Same as t := slice2
With this change, undo & redo log will support same API to Log & read back the values. ReadLog() now also supports reading back slices, slice elements & reslicing.
Updates to Log() API For Logging, the old usage was:
New usage:
tx.Log(&a, 10.1) // does the a = 10.1 operation internally if tx == undoTx
For undo transactions, the old usage is also supported. So, both of the following are valid & do the same thing:
Updates to ReadLog() API. Works for both undo/redo tx
f := tx.ReadLog(&slice1, 10).(float64) // Same as f := s slice1[10]
s := tx.ReadLog(&slice1, 2,5).([]float64) // Same as f := slice1[2:5]
t := tx.ReadLog(&slice2) // Same as t := slice2