Home Reference Source
import IFTSArrayPromise from 'indexedfts/lib/ArrayPromise.js'
public class | source

IFTSArrayPromise

Promise like object for contents array.

Almost methods are the same interface as IndexedFTS and IFTSTransaction. But this class will processing all contents without using indexes. Please consider using IFTSTransaction directly if it can.

Static Method Summary

Static Public Methods
public static

reject(indexes: Set<string>, value: object): IFTSArrayPromise

Make rejected promise.

public static

resolve(indexes: Set<string>, value: object[]): IFTSArrayPromise

Make resolved promise.

Constructor Summary

Public Constructor
public

constructor(indexes: Set<string>, promise: Promise<object[]>)

Member Summary

Public Members
public
public

Method Summary

Public Methods
public

between(column: object, lower: object, upper: object): IFTSArrayPromise

Get contents that have property is between argument values.

public

catch(fun: function(error: *): *): Promise

Set error handling function.

public

equals(column: object, value: object): IFTSArrayPromise

Get contents that have fully matched property.

public

filter(fun: function(content: object, index: Number): boolean): IFTSArrayPromise

Filtering elements by function and make a new IFTSArrayPromise.

public

Get contents that have property greater than value.

public

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

Get contents that have property lower than value or equals value.

public

map(fun: function(content: object, index: Number): object): IFTSArrayPromise

Do something process for each elements and make a new IFTSArrayPromise.

public

search(columns: object | object[], query: string, options: object): IFTSArrayPromise

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 contents.

public

then(fun: function(contents: object[]): *): Promise

Set next function.

Static Public Methods

public static reject(indexes: Set<string>, value: object): IFTSArrayPromise source

Make rejected promise.

Params:

NameTypeAttributeDescription
indexes Set<string>

index names.

value object

value for promise.

public static resolve(indexes: Set<string>, value: object[]): IFTSArrayPromise source

Make resolved promise.

Params:

NameTypeAttributeDescription
indexes Set<string>

index names.

value object[]

value for promise.

Public Constructors

public constructor(indexes: Set<string>, promise: Promise<object[]>) source

Params:

NameTypeAttributeDescription
indexes Set<string>

index names.

promise Promise<object[]>

Promise for wrapping.

Public Members

public indexes: Set<string> source

public promise: Promise<object[]> source

Public Methods

public between(column: object, lower: object, upper: object): IFTSArrayPromise source

Get contents that have property is between argument values.

Params:

NameTypeAttributeDescription
column object

column name for search.

lower object

minimal value.

upper object

maximum value.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public catch(fun: function(error: *): *): Promise source

Set error handling function.

Params:

NameTypeAttributeDescription
fun function(error: *): *

error handling function.

Return:

Promise

public equals(column: object, value: object): IFTSArrayPromise source

Get contents that have fully matched property.

Params:

NameTypeAttributeDescription
column object

column name for search.

value object

value for search.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public filter(fun: function(content: object, index: Number): boolean): IFTSArrayPromise source

Filtering elements by function and make a new IFTSArrayPromise.

Params:

NameTypeAttributeDescription
fun function(content: object, index: Number): boolean

function for filtering element.

public greater(column: object, value: object): IFTSArrayPromise source

Get contents that have property greater than value.

Params:

NameTypeAttributeDescription
column object

column name for search.

value object

value for search.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public greaterOrEquals(column: object, value: object): IFTSArrayPromise source

Get contents that have property greater than value or equals value.

Params:

NameTypeAttributeDescription
column object

column name for search.

value object

value for search.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public lower(column: object, value: object): IFTSArrayPromise source

Get contents that have property lower than value.

Params:

NameTypeAttributeDescription
column object

column name for search.

value object

value for search.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public lowerOrEquals(column: object, value: object): IFTSArrayPromise source

Get contents that have property lower than value or equals value.

Params:

NameTypeAttributeDescription
column object

column name for search.

value object

value for search.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public map(fun: function(content: object, index: Number): object): IFTSArrayPromise source

Do something process for each elements and make a new IFTSArrayPromise.

Params:

NameTypeAttributeDescription
fun function(content: object, index: Number): object

function for processing element.

Get contents that have matched property by full-text search.

This method can search even if didn't made ngram index.

WARNING: This method always processes all contents without using indexes. Please consider using IFTSTransaction#search.

Params:

NameTypeAttributeDescription
columns object | object[]

column names for search.

query string

query for search.

options object
  • optional

optional arguments.

options.ignoreCase boolean
  • optional
  • default: false

ignore case if true. default is false.

Return:

IFTSArrayPromise

matched contents.

public searchWord(columns: object | object[], query: string, options: object): IFTSArrayPromise source

Find contents that have fully matched word in property.

This method can search even if didn't made word index.

WARNING: This method always processes all contents without using indexes. Please consider using IFTSTransaction#searchWord.

Params:

NameTypeAttributeDescription
columns object | object[]

column names for search.

query string

query for search.

options object
  • optional

optional arguments.

options.ignoreCase boolean
  • optional
  • default: false

ignore case if true. default is false.

Return:

IFTSArrayPromise

matched contents. may reject with NoSuchColumnError.

public sort(column: object, order: 'asc' | 'desc', offset: Number, limit: Number): IFTSArrayPromise source

Sort contents.

Params:

NameTypeAttributeDescription
column object

the column for sorting.

order 'asc' | 'desc'
  • optional
  • default: 'asc'

sort order.

offset Number
  • optional
  • default: 0

starting offset of the result.

limit Number
  • optional

maximum number of result length. will unlimited if omitted.

Return:

IFTSArrayPromise

sorted contents.

public then(fun: function(contents: object[]): *): Promise source

Set next function.

Params:

NameTypeAttributeDescription
fun function(contents: object[]): *

next function.

Return:

Promise