Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QueriesUtil

Hierarchy

  • QueriesUtil

Index

Methods

addAndFilter

  • addAndFilter(query: any, filter: any): any
  • Parameters

    • query: any
    • filter: any

    Returns any

addFilter

  • addFilter(query: any, filter: any, operator: "and" | "or"): any
  • Parameters

    • query: any
    • filter: any
    • operator: "and" | "or"

    Returns any

addOrFilter

  • addOrFilter(query: any, filter: any): any
  • Parameters

    • query: any
    • filter: any

    Returns any

addOrderbys

  • addOrderbys(query: any, orderbys: any, how: "prepend" | "append"): any
  • Parameters

    • query: any
    • orderbys: any
    • how: "prepend" | "append"

    Returns any

appendOrderbys

  • appendOrderbys(query: any, orderbys: any): any
  • Parameters

    • query: any
    • orderbys: any

    Returns any

buildQuery

  • buildQuery(query: any): string
  • Parameters

    • query: any

    Returns string

    Returns a query string ready to be sent in request params to backend.

    Example

      const query = {
        __filter: {
          'name': 'My Device*',
          'c8y_Availability.status': {
            __in: ['AVAILABLE', 'UNAVAILABLE']
          },
          'creationTime': {
            __lt: '2015-11-30T13:28:123Z'
          },
          'c8y_ActiveAlarmsStatus.critical': {
            __gt: 0
          },
          __or: [
            {__not: {__has: 'c8y_ActiveAlarmsStatus.major'}},
            {
              __or: [
                {__bygroupid: 10300},
                {__bygroupid: 10400}
              ]
            }
          ]
        },
        __orderby: [
          {'name': 1},
          {'creationTime': -1},
          {'c8y_ActiveAlarmsStatus.critical': -1}
        ]
      };
    
      const params = {
        query: queriesUtil.buildQuery(query)
      };
    

buildQueryFilter

  • buildQueryFilter(queryFilter: any, _queryKey?: any, _glueType?: any): string
  • Parameters

    • queryFilter: any
    • Optional _queryKey: any
    • Optional _glueType: any

    Returns string

buildQueryOrderby

  • buildQueryOrderby(queryOrderbys: any): string
  • Parameters

    • queryOrderbys: any

    Returns string

prependOrderbys

  • prependOrderbys(query: any, orderbys: any): any
  • Parameters

    • query: any
    • orderbys: any

    Returns any

Generated using TypeDoc