You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add user defaults migration helper, which takes a list of of MigrationInfo. MigrationInfo is a struct that contains a KeyType to be migrated to, String which is the old key, and a processing block, that takes the old value and processes it to to return a new suitable value for KeyType.
This is the actual use case that I have. I have simplified it so it makes more sense:
old value: "CityId" -> "kw-city-asimah" new key: "general-settings:city" -> ""
so, we can do this:
letmigrationInfo=MigrationInfo(
keyType =Key<GeneralSettings,City>(id:"city", defaultValue:City.asimah),
oldKey ="CityId",
processor ={ oldValue in// process from a string to a City typereturn mydb.getCity(oldValue)})
The text was updated successfully, but these errors were encountered:
Add user defaults migration helper, which takes a list of of
MigrationInfo
.MigrationInfo
is a struct that contains aKeyType
to be migrated to,String
which is the old key, and a processing block, that takes the old value and processes it to to return a new suitable value forKeyType
.This is the actual use case that I have. I have simplified it so it makes more sense:
old value: "CityId" -> "kw-city-asimah"
new key: "general-settings:city" -> ""
so, we can do this:
The text was updated successfully, but these errors were encountered: