node-influx
    Preparing search index...

    Class Expression

    Expression is used to build filtering expressions, like those used in WHERE clauses. It can be used for fluent and safe building of queries using untrusted input.

    e => e
    .field('host').equals.value('ares.peet.io')
    .or
    .field('host').matches(/example\.com$/)
    .or
    .expr(e => e
    .field('country').equals.value('US')
    .and
    .field('state').equals.value('WA'));

    // Generates:
    // "host" = 'ares.peet.io' OR "host" ~= /example\.com$/ OR \
    // ("county" = 'US' AND "state" = 'WA')

    Implements

    Index
    • Inserts a subexpression; invokes the function with a new expression that can be chained on.

      Parameters

      Returns this

      e.field('a').equals.value('b')
      .or.expr(e =>
      e.field('b').equals.value('b')
      .and.field('a').equals.value('c'))
      .toString()
      // "a" = 'b' OR ("b" = 'b' AND "a" = 'c')
    • Inserts a field reference into the expression; the name will be automatically escaped.

      Parameters

      • name: string

      Returns this

    • Inserts a tag reference into the expression; the name will be automatically escaped.

      Parameters

      • name: string

      Returns this

    • Converts the expression into its InfluxQL representation.

      Returns string

    • Value chains on a value to the expression.

      • Numbers will be inserted verbatim
      • Strings will be escaped and inserted
      • Booleans will be inserted correctly
      • Dates will be formatted and inserted correctly, including INanoDates.
      • Regular expressions will be inserted correctly, however an error will be thrown if they contain flags, as regex flags do not work in Influx
      • Otherwise we'll try to call .toString() on the value, throwing if we cannot do so.

      Parameters

      • value: any

      Returns this