js.web.indexeddb.IDBIndex Maven / Gradle / Ivy
package js.web.indexeddb;
import js.lang.Any;
import js.lang.JsNumber;
import js.lang.Unknown;
import js.util.collections.Array;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSProperty;
import javax.annotation.Nullable;
/**
* IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.
*/
public interface IDBIndex extends Any {
@JSBody(script = "return IDBIndex.prototype")
static IDBIndex prototype() {
throw new UnsupportedOperationException("Available only in JavaScript");
}
@JSBody(script = "return new IDBIndex()")
static IDBIndex create() {
throw new UnsupportedOperationException("Available only in JavaScript");
}
@JSProperty
Unknown getKeyPath();
@JSProperty
boolean isMultiEntry();
/**
* Returns the name of the index.
*/
@JSProperty
String getName();
@JSProperty
void setName(String name);
/**
* Returns the IDBObjectStore the index belongs to.
*/
@JSProperty
IDBObjectStore getObjectStore();
@JSProperty
boolean isUnique();
/**
* Retrieves the number of records matching the given key or key range in query.
*
* If successful, request's result will be the count.
*/
IDBRequest count(IDBValidKey key);
IDBRequest count(IDBKeyRange key);
IDBRequest count();
/**
* Retrieves the value of the first record matching the given key or key range in query.
*
* If successful, request's result will be the value, or undefined if there was no matching record.
*/
IDBRequest get(IDBValidKey key);
IDBRequest get(IDBKeyRange key);
/**
* Retrieves the values of the records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the values.
*/
IDBRequest> getAll(@Nullable IDBValidKey query, int count);
IDBRequest> getAll(@Nullable IDBKeyRange query, int count);
IDBRequest> getAll(IDBValidKey query);
IDBRequest> getAll(IDBKeyRange query);
IDBRequest> getAll();
/**
* Retrieves the keys of records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the keys.
*/
IDBRequest> getAllKeys(@Nullable IDBValidKey query, int count);
IDBRequest> getAllKeys(@Nullable IDBKeyRange query, int count);
IDBRequest> getAllKeys(IDBValidKey query);
IDBRequest> getAllKeys(IDBKeyRange query);
IDBRequest> getAllKeys();
/**
* Retrieves the key of the first record matching the given key or key range in query.
*
* If successful, request's result will be the key, or undefined if there was no matching record.
*/
IDBRequest getKey(IDBValidKey key);
IDBRequest getKey(IDBKeyRange key);
/**
* Opens a cursor over the records matching query, ordered by direction. If query is null, all records in index are matched.
*
* If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.
*/
IDBRequest openCursor(@Nullable IDBValidKey query, IDBCursorDirection direction);
IDBRequest openCursor(@Nullable IDBKeyRange query, IDBCursorDirection direction);
IDBRequest openCursor(IDBValidKey query);
IDBRequest openCursor(IDBKeyRange query);
IDBRequest openCursor();
/**
* Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.
*
* If successful, request's result will be an IDBCursor, or null if there were no matching records.
*/
IDBRequest openKeyCursor(@Nullable IDBValidKey query, IDBCursorDirection direction);
IDBRequest openKeyCursor(@Nullable IDBKeyRange query, IDBCursorDirection direction);
IDBRequest openKeyCursor(IDBValidKey query);
IDBRequest openKeyCursor(IDBKeyRange query);
IDBRequest openKeyCursor();
}