Re: [IndexedDB] Computed indexes

On Thu, Jun 24, 2010 at 3:48 PM, Shawn Wilsher <sdwilsh@mozilla.com> wrote:

>  On 6/24/2010 7:01 AM, Jeremy Orlow wrote:
>
>> So what your proposing is that the keyPath would essentially be a string
>> of
>> the body of a function which runs for every index (on that objectStore)
>> for
>> every value inserted into that object store?  This seems like half way
>> between the eval-like idea I mentioned earlier.  It certainly seems to
>> have
>> advantages for complex keyPaths, but I'm still not so hot on having
>> boilerplate/assumptions (like needing "return" and assuming "value" is
>> present) present in every single keyPath.  Especially when the use cases
>> (while important) don't seem to be the common case.  (In fact, can you
>> even
>> do this in SQL?  If not, I think it's pretty strong evidence against
>> needing
>> to do arbitrary calculations in a keyPath.)
>>
> You can do something like this with triggers I think.
>

Triggers are actually a feature people within Google have asked me for.
 Such a thing would be useful for more than just computed indexes but would
likely be more heavyweight.  As far as I can tell, a trigger that fires on
changes to an objectStore would be enough to implement this feature
yourself.  We should probably look at general purpose triggers along side
these other keyPath proposals.


>
> Cheers,
>
> Shawn
>
>

Received on Thursday, 24 June 2010 14:55:48 UTC