14
// OnAfterCommit adds the provided effect function to set of such functions to
15
// be invoked when Buffer.Apply is called.
17
>
b.effects = append(b.effects, effect)
18
>
}
19
20
// OnAfterRollback adds the provided effect function to set of such functions to
21
// be invoked when Buffer.Cancel is called.
23
>
b.cancels = append(b.cancels, effect)
24
>
}
25
26
// Apply invokes the buffered effect functions in the order that they were added
27
// to this Buffer.
28
// It returns true if any effects were applied.
30
>
applied := false
31
>
b.cancels = nil
32
>
for _, effect := range b.effects {
34
>
applied = true
35
>
}
37
>
return applied
38
}
39