Direcstore

Data Query

Specification of data query in Direcbase

DirecStore - data query specification

The data query is presented by plain object which can be constructed and pass thru data services

Select query

        {
    select: {
        from: name,     // table or view name
        fields: [],     // fields name
        where: [        // data filter conditions
            {
                left: field_name,   // field name
                opr: operator,      // operator i.e. = > < like
                right: value        // comparable value
            }
        ],
        limit: number,              // maximum number of rows can be returned
        offset: number,             // number of rows skipped from begining
        orderBy: [
            {
                field: field_name,  // sort by field name
                order: asc | desc,  // ordering 
            }
        ]
    }
}        

      

Insert query - currently support single data row only

        {
    insert: {
        into: name,     // table or view name
        entry: {        // pairs of field name and value in a data row
            field1: value1,
            field2: value2,
            ...
        },      
    }
}        

      

Update query - currently support single data row only

        {
    update: {
        into: name,     // table or view name
        doc:  doc_id,   // id of the updating data row
        entry: {        // pairs of field name and value in a data row
            field1: value1,
            field2: value2,
            ...
        },      
    }
}  

      

Delete query - currently support single data row only

        {
    delete: {
        from: name,     // table or view name
        doc:  doc_id,   // id of the deleting data row
    }
}