MockDataStoreService
MockDataStoreService copied to clipboard
Implement DataStores v2
This PR implements DataStores v2 APIs. Resolves #22 Some tests are disabled in this branch as they were failing when I forked.
Changes:
- Implemented metadata API to
MockDataStoreService:GetAsyncandMockDataStoreService:SetAsyncwith corresponding tests - Added hack to
Utils.importPairsFromTableto inject metadata - Added hack to
MockDataStoreService:ExportToJSONto inject metadata
I'm currently stuck on finding a good way to make this change compatible with JSON exporting/importing. Currently I'm injecting metadata to exported JSON as the __metadata key under __data, and removing it on import if it's present. I'm not sure there's a non-breaking way to introduce this.
Maybe it'd be better to return a tuple from ExportToJSON; encodedData, encodedMetadata? There's also the question of how versioning from v2 fits into this which I'm not sure how to answer yet.