-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use IDBCursor methods in the beginning of reading a cursor (#73)
- Loading branch information
1 parent
b3ab7a4
commit e923c35
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.juul.indexeddb | ||
|
||
import com.juul.indexeddb.external.IDBCursor | ||
|
||
public sealed class CursorStart { | ||
|
||
internal abstract fun apply(cursor: IDBCursor) | ||
|
||
public data class Advance(val count: Int) : CursorStart() { | ||
override fun apply(cursor: IDBCursor) { | ||
cursor.advance(count) | ||
} | ||
} | ||
|
||
public data class Continue(val key: Key) : CursorStart() { | ||
override fun apply(cursor: IDBCursor) { | ||
cursor.`continue`(key.toJs()) | ||
} | ||
} | ||
|
||
public data class ContinuePrimaryKey(val key: Key, val primaryKey: Key) : CursorStart() { | ||
override fun apply(cursor: IDBCursor) { | ||
cursor.continuePrimaryKey(key.toJs(), primaryKey.toJs()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters