IFTSTransaction
Transaction.
Almost methods are the same interface as IndexedFTS and IFTSArrayPromise. Probably this class is faster than other classes in most cases.
Please be careful, IFTSTransaction are sometimes makes a big cache. Should not keep many transactions if not need.
Constructor Summary
Public Constructor | ||
public |
constructor(db: IndexedFTS, transaction: IDBTransaction) |
Member Summary
Public Members | ||
public |
db: IndexedDB |
|
public |
Promise for await closing transaction. |
|
public |
transaction: IDBTransaction |
Method Summary
Public Methods | ||
public |
between(column: object, lower: object, upper: object): IFTSArrayPromise Get contents that have property is between argument values. |
|
public |
delete(keys: object): Promise<IFTSTransaction> Delete contents from database. |
|
public |
equals(column: object, value: object): IFTSArrayPromise Get contents that have fully matched property. |
|
public |
Filtering elements by function and returns IFTSArrayPromise. |
|
public |
Get content by primary key. |
|
public |
Get all contents. |
|
public |
Get N-Gram set from index. |
|
public |
Get word set from index. |
|
public |
greater(column: object, value: object): IFTSArrayPromise Get contents that have property greater than value. |
|
public |
greaterOrEquals(column: object, value: object): IFTSArrayPromise Get contents that have property greater than value or equals value. |
|
public |
lower(column: object, value: object): IFTSArrayPromise Get contents that have property lower than value. |
|
public |
lowerOrEquals(column: object, value: object): IFTSArrayPromise Get contents that have property lower than value or equals value. |
|
public |
Do something process for each elements and returns IFTSArrayPromise. |
|
public |
put(contents: object): Promise<IFTSTransaction> Put contents into database. |
|
public |
Get contents that have matched property by full-text search. |
|
public |
searchWord(columns: object | object[], query: string, options: object): IFTSArrayPromise Find contents that have fully matched word in property. |
|
public |
sort(column: object, order: 'asc' | 'desc', offset: Number, limit: Number): IFTSArrayPromise Sort and get all contents. |
Public Constructors
public constructor(db: IndexedFTS, transaction: IDBTransaction) source
Params:
Name | Type | Attribute | Description |
db | IndexedFTS | database. |
|
transaction | IDBTransaction | transaction of IndexedDB. |
Public Methods
public between(column: object, lower: object, upper: object): IFTSArrayPromise source
Get contents that have property is between argument values.
public delete(keys: object): Promise<IFTSTransaction> source
Delete contents from database.
Params:
Name | Type | Attribute | Description |
keys | object | key of contents. allowed multiple arguments. |
Return:
Promise<IFTSTransaction> | returns self for chain. Will reject with InvalidKeyError if keys included null or undefined. |
public equals(column: object, value: object): IFTSArrayPromise source
Get contents that have fully matched property.
public filter(fun: function(content: object, index: Number): object): IFTSArrayPromise source
Filtering elements by function and returns IFTSArrayPromise.
WARNING: This method won't use the index. Other methods(eg. IFTSTransaction#equals or IFTSTransaction#lower may faster than this.
public get(key: object): Promise<object|undefined> source
Get content by primary key.
Params:
Name | Type | Attribute | Description |
key | object | the key of content. |
Return:
Promise<object|undefined> | content. promise will reject with InvalidKeyError if keys included null or undefined. result value will be undefined if not found. |
public getNGrams(column: string, options: object): Promise<Map<string, number>> source
Get N-Gram set from index.
public getWords(column: string, options: object): Promise<Map<string, number>> source
Get word set from index.
public greater(column: object, value: object): IFTSArrayPromise source
Get contents that have property greater than value.
public greaterOrEquals(column: object, value: object): IFTSArrayPromise source
Get contents that have property greater than value or equals value.
public lower(column: object, value: object): IFTSArrayPromise source
Get contents that have property lower than value.
public lowerOrEquals(column: object, value: object): IFTSArrayPromise source
Get contents that have property lower than value or equals value.
public map(fun: function(content: object, index: Number): object): IFTSArrayPromise source
Do something process for each elements and returns IFTSArrayPromise.
NOTE: This method doesn't fast. May better do filtering before doing map if need filtering.
public put(contents: object): Promise<IFTSTransaction> source
Put contents into database.
Params:
Name | Type | Attribute | Description |
contents | object | contents for save. allowed multiple arguments. |
public search(columns: object | object[], query: string, options: object): IFTSArrayPromise source
Get contents that have matched property by full-text search.
All target columns have to made ngram index when created database. If you didn't made ngram index, you can use IFTSArrayPromise#search (but this way is very slow).
public searchWord(columns: object | object[], query: string, options: object): IFTSArrayPromise source
Find contents that have fully matched word in property.
All target columns have to made word index when created database. If you didn't made word index, you can use IFTSArrayPromise#searchWord (but this way is very slow).
public sort(column: object, order: 'asc' | 'desc', offset: Number, limit: Number): IFTSArrayPromise source
Sort and get all contents.