在 dartlang 中指定光标在索引数据库索引上的方向



如何指定在 dart 的索引数据库对象存储中迭代找到的对象时光标将采用的方向?

从版本 28108 开始,这是这样工作的:

Future<String> getObject(int keyvalue, String storeName)=>
    db.transactionStore(storeName, "readonly")
      .objectStore(storeName)
      .index("frameId");
      .openCursor(key: keyvalue, direction: "prev", autoAdvance: true)
      .first
      .then((CursorWithValue cursor)=>cursor.value)

方向允许的值为:"下一个"、"下一个唯一"、"上一个"和"上一个唯一"。

这个答案取自 https://code.google.com/p/dart/issues/detail?id=2694

最新更新