Description:
Currently, the Set, Delete, and related helper methods (setWithTransaction, setWithBatch, setDirect, etc.) use an afterCommit function as a pointer argument to communicate post-commit hooks back to the caller. This pattern is a bit confusing and makes the function signatures less clear.
Proposal:
Refactor these methods to return the afterCommit function as a return value instead of using a pointer argument. This will make the code easier to read and maintain, and clarify the intent of these functions.
Benefits:
- Clearer function signatures.
- More idiomatic Go code.
- Easier to reason about post-commit hook execution.
Example:
Change from:
func setWithTransaction(..., afterCommit *func()) error
to:
func setWithTransaction(...) (afterCommit func(), err error)
and update all call sites accordingly.
Description:
Currently, the
Set,Delete, and related helper methods (setWithTransaction,setWithBatch,setDirect, etc.) use anafterCommitfunction as a pointer argument to communicate post-commit hooks back to the caller. This pattern is a bit confusing and makes the function signatures less clear.Proposal:
Refactor these methods to return the
afterCommitfunction as a return value instead of using a pointer argument. This will make the code easier to read and maintain, and clarify the intent of these functions.Benefits:
Example:
Change from:
to:
and update all call sites accordingly.