Home Manual Reference Source Test Repository
import Expression from 'opengate-js/src/util/Expression.js'
public class | source

Expression

Static Method Summary

Static Public Methods
public static

and(args: ...*): object

public static

eq(key: String, value: String): object

public static

gt(key: String, value: String): object

public static

gte(key: String, value: String): object

public static

in(key: String, value: String): object

public static

like(key: String, value: String): object

public static

lt(key: String, value: String): object

public static

lte(key: String, value: String): object

public static

neq(key: String, value: String): object

public static

or(args: ...*): object

Static Public Methods

public static and(args: ...*): object source

Params:

NameTypeAttributeDescription
args ...*

Return:

object

This returns a json with the query of the logical operator "and" built.

Example:

Ex.and(Ex.like("collected.serialNumber", "SN"), Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"))


returns:

{
  and : [
    {
      like: {
        "collected.serialNumber": "SN"
      }
    },  
    {
      eq: {
        "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
      }
    }
  ]
}

public static eq(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "eq" built.

Example:

Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25")


returns:

{
  eq : {
    "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
  }
}

public static gt(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "gt" built.

Example:

Ex.gt("collected.imei", "123456786543210")


returns:

{
  gt : {
    "collected.imei": "123456786543210"
  }
}

public static gte(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "gte" built.

Example:

Ex.gte("collected.imei", "123456786543210")


{
  gte : {
    "collected.imei": "123456786543210"
  }
}

public static in(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "in" built.

Example:

Ex.in("entityId", ["e64ccd08-e302-4b65-b19d-e38eeb7b2d24","e64ccd08-e302-4b65-b19d-e38eeb7b2d25"])


{
  in : {
    "entityId": ["e64ccd08-e302-4b65-b19d-e38eeb7b2d24","e64ccd08-e302-4b65-b19d-e38eeb7b2d25"]
  }
}

public static like(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "like" built.

Example:

Ex.like("collected.serialNumber", "SN")


returns:

{
  like : {
    "collected.serialNumber": "SN"
  }
}

public static lt(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "lt" built.

Example:

Ex.lt("collected.imei", "123456786543210")


returns:

{
  lt : {
    "collected.imei": "123456786543210"
  }
}

public static lte(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "lte" built.

Example:

Ex.lte("collected.imei", "123456786543210")


{
  lte : {
    "collected.imei": "123456786543210"
  }
}

public static neq(key: String, value: String): object source

Params:

NameTypeAttributeDescription
key String

This is the name of the field

value String

This is the value of the field

Return:

object

This returns a json with the query of the operator "neq" built.

Example:

Ex.neq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25")


returns:

{
  neq : {
    "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
  }
}

public static or(args: ...*): object source

Params:

NameTypeAttributeDescription
args ...*

Return:

object

This returns a json with the query of the logical operator "or" built.

Example:

Ex.or(Ex.like("collected.serialNumber", "SN"), Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"))


returns:

{
  or : [
    {
      like: {
        "collected.serialNumber": "SN"
      }
    },  
    {
      eq: {
        "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
      }
    }
  ]
}