Wondering what’s next for npm?Check out our public roadmap! »

    nrql-parser

    0.2.0 • Public • Published

    NRQL Parser

    Peg grammar (using pegjs) for New Relic Insight's query language.

    $ ./bin/nrql-parse -e "SELECT uniqueCount(user) FROM  PageView WHERE userAgentOS = 'Mac' FACET countryCode LIMIT 20 SINCE 1 day ago" 
    
    
    {
      "type": "Select",
      "selects": [
        {
          "type": "SelectClause",
          "value": {
            "type": "FunctionExpression",
            "name": "uniqueCount",
            "arguments": [
              {
                "type": "Identifier",
                "name": "user"
              }
            ]
          }
        }
      ],
      "from": {
        "type": "Identifier",
        "name": "PageView"
      },
      "where": {
        "type": "WhereCondition",
        "condition": {
          "attribute": {
            "type": "Identifier",
            "name": "userAgentOS"
          },
          "op": "=",
          "right": {
            "type": "StringLiteral",
            "value": "Mac"
          }
        }
      },
      "facet": {
        "type": "Identifier",
        "name": "countryCode"
      },
      "limit": {
        "type": "FloatLiteral",
        "value": 20
      },
      "since": {
        "type": "TimeAgo",
        "duration": {
          "type": "duration",
          "quantity": {
            "type": "FloatLiteral",
            "value": 1
          },
          "unit": "d"
        }
      }
    }
    

    Keywords

    none

    Install

    npm i nrql-parser

    DownloadsWeekly Downloads

    3

    Version

    0.2.0

    License

    MIT

    Last publish

    Collaborators

    • avatar