Does anyone have any suggestions on how to handle multi-keyed records cleanly in ReStore? I've used a unique integer as a surrogate key in the past, and I know you can use defineAsID: for single keys including strings, but I need to do something wherea record has a string name _and_ a numeric version (separate from the _version provided by ReStore) so the version can be incremented by the user when they choose to do so, so it appears something like this in the DB:
NAME VERSION ...
TEST_1 1
The _version field could be any value depending on how many changes have been made to the object, but the VERSION field could remain at 1 until explicity versioned by the user.
Any ideas greatly appreciated.
Thanks,
Scott
Hi Scott,instance variables/fields) so you'd need to find another way to handle this unfortunately.
Are you saying the string name and numeric version form a composite key? i.e. there could be more than one record with the same name, but they'd all have different versions? ReStore doesn't currently support composite keys (keys consisting of multiple
Note there's been a recent enhancement to ReStore to allow more flexibility in primary key types, mainly to accommodate GUID/UUID keys but also others e.g. Strings (I don't *think* ReStore previously supported String keys, at least if it did it wasaccidental). These haven't been added to the documentation yet but the relevant test classes should provide some clues - see SSWReStoreAlternativeIDTest and subclasses. Also see implementors of the following methods:
reStoreIDClasswhere a record has a string name _and_ a numeric version (separate from the _version provided by ReStore) so the version can be incremented by the user when they choose to do so, so it appears something like this in the DB:
reStoreNewUniqueID
reStoreNewUnique
Hope this helps.
John
On Thursday, November 4, 2021 at 8:23:36 PM UTC, Scott McWilliams wrote:
Does anyone have any suggestions on how to handle multi-keyed records cleanly in ReStore? I've used a unique integer as a surrogate key in the past, and I know you can use defineAsID: for single keys including strings, but I need to do something
Hi John,NAME VERSION ...
TEST_1 1
The _version field could be any value depending on how many changes have been made to the object, but the VERSION field could remain at 1 until explicity versioned by the user.
Any ideas greatly appreciated.
Thanks,
Scott
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 225:01:07 |
Calls: | 6,623 |
Calls today: | 5 |
Files: | 12,171 |
Messages: | 5,318,597 |