EfficientDynamoDb
EfficientDynamoDb copied to clipboard
Replace `TableNamePrefix` with `ITableNameFormatter` for Better Flexibility
Based on the suggestion from issue https://github.com/AllocZero/EfficientDynamoDb/issues/267
Currently, the API uses a TableNamePrefix string to modify table names. This works, but is inflexible.
This PR introduces an ITableNameFormatter interface to handle table name resolution.
This allows for:
- Custom naming strategies (e.g., environment-based, hashing, localization)
- Cleaner separation of concerns
- Easier testing and mocking
Migration Path:
- Mark
TableNamePrefixas[Obsolete] - If
TableNamePrefixis set, internally create aPrefixTableNameFormatterto maintain compatibility
This preserves backward compatibility while enabling greater extensibility.
Benchmark and Heap Alloc should have no- to minimal- effect. Size of passed argument (string? or ITableNameFormatter?) is the same. The formatter allows for non-heap formatting of table names (except for the simple formatter, which is more or less included for testing purposes)