This is an improved version of #151, aimed at solving #150.
The general idea is that you specify the auto-incrementing key's name in DBSchemaValue["autoIncrementKeyPath"], and then internally it labels that property as optional when accepting new records in add and put. It even works with nested keys like "my.nested.id".
As a bonus, when autoIncrementKeyPath is set, createObjectStore now knows what to expect in its 2nd parameter - that it must have an auto incrementing key of the same name. This will help catch some typos.
The only caveat is I'm not sure how to make the 2nd parameter of createObjectStore optional if and only if autoIncrementKeyPath is undefined. See the comment I left in there.
This is an improved version of #151, aimed at solving #150.
The general idea is that you specify the auto-incrementing key's name in
DBSchemaValue["autoIncrementKeyPath"]
, and then internally it labels that property as optional when accepting new records inadd
andput
. It even works with nested keys like"my.nested.id"
.As a bonus, when
autoIncrementKeyPath
is set,createObjectStore
now knows what to expect in its 2nd parameter - that it must have an auto incrementing key of the same name. This will help catch some typos.The only caveat is I'm not sure how to make the 2nd parameter of
createObjectStore
optional if and only ifautoIncrementKeyPath
is undefined. See the comment I left in there.