Reference Source
public class | source

DataQuery

Constructor Summary

Public Constructor
public

constructor(arg_model: DataModel): nothing

Data record class, contains one collection item attributes.

Member Summary

Public Members
public
Private Members
private

_fields: *[]

private

_groupby: *[]

private

_hash: *

private
private

_limit: {"offset": *, "length": number, "first": *, "last": number}

private

_model: *

private

_orderby: *[]

private

_where: {}

private

Method Summary

Public Methods
public

get_fields(): array

Get query fields.

public

Get query limit as { offset:..., length:..., first:..., last:...}.

public

Get record model.

public

get_page(arg_page_size: integer): integer

Get query limit page index.

public

Get hash string.

public

set_fields(arg_fields_names: array): nothing

Set query fields.

public

set_limit(arg_offset: integer, arg_length: integer): nothing

Set query limit with offset and count.

public

set_page(arg_page_size: integer, arg_page_index: integer): nothing

Set query limit with page size and page index.

public

set_range(arg_first: integer, arg_last: integer): nothing

Set query limit with first and last indices.

Private Methods
private

Calculate query hash string.

private

_emit(arg_event: string, arg_datas: any): nothing

Emit on event.

Public Constructors

public constructor(arg_model: DataModel): nothing source

Data record class, contains one collection item attributes.

API:
    ->constructor(arg_model)

    ->get_model():DataModel - get record model.
    ->hash():string - get query hash string.

    ->set_fields(arg_fields_names:array):nothing - set query fields.
    ->get_fields():array - get query fields names.

    ->set_limit(arg_offset:integer, arg_length:integer):nothing - set query limit with offset and length.
    ->set_range(arg_first:integer, arg_last:integer):nothing - set query limit with first and last index.
    ->get_limit():object - get query limit as { offset:..., length:..., first:..., last:...}
    ->set_page(arg_page_size, arg_page_index):nothing - set query limit with a page index.
    ->get_page(arg_page_size):integer - get query page.

    ->set_where(arg_where:object):nothing - set query where clause.
    ->get_where():object - get query where clause.
    ->and():this
    ->or():this
    ->not():this
    ->field(arg_field_name):this
    ->lt():this
    ->gt():this
    ->lte():this
    ->gte():this
    ->equal():this
    ->notequal():this
    ->like():this
    ->value(arg_string):this

    ->set_orderby(arg_orderby:array):nothing - set query orderby clause.
    ->get_orderby():array - get query orderby clause.

    ->set_groupby(arg_groupby:array):nothing - set query groupby clause.
    ->get_groupby():array - get query groupby clause.

Params:

NameTypeAttributeDescription
arg_model DataModel

data model: contains schema.

Return:

nothing

Public Members

public is_data_query: boolean source

Private Members

private _fields: *[] source

private _groupby: *[] source

private _hash: * source

private _hash_is_dirty: boolean source

private _limit: {"offset": *, "length": number, "first": *, "last": number} source

private _model: * source

private _orderby: *[] source

private _where: {} source

private _where_cursor: * source

Public Methods

public get_fields(): array source

Get query fields.

Return:

array

public get_limit(): object source

Get query limit as { offset:..., length:..., first:..., last:...}.

Return:

object

public get_model(): DataModel source

Get record model.

Return:

DataModel

public get_page(arg_page_size: integer): integer source

Get query limit page index.

Params:

NameTypeAttributeDescription
arg_page_size integer

query page size.

Return:

integer

public hash(): string source

Get hash string.

Return:

string

public set_fields(arg_fields_names: array): nothing source

Set query fields.

Params:

NameTypeAttributeDescription
arg_fields_names array

query fields names

Return:

nothing

public set_limit(arg_offset: integer, arg_length: integer): nothing source

Set query limit with offset and count.

Params:

NameTypeAttributeDescription
arg_offset integer

query limit offset.

arg_length integer

query limit length.

Return:

nothing

public set_page(arg_page_size: integer, arg_page_index: integer): nothing source

Set query limit with page size and page index.

Params:

NameTypeAttributeDescription
arg_page_size integer

query page size.

arg_page_index integer

query page index.

Return:

nothing

public set_range(arg_first: integer, arg_last: integer): nothing source

Set query limit with first and last indices.

Params:

NameTypeAttributeDescription
arg_first integer

query limit first index.

arg_last integer

query limit last index.

Return:

nothing

Private Methods

private _calculate_hash(): string source

Calculate query hash string.

Return:

string

private _emit(arg_event: string, arg_datas: any): nothing source

Emit on event.

Params:

NameTypeAttributeDescription
arg_event string

event name.

arg_datas any

event datas (optional, default:undefined).

Return:

nothing