vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Class QueryParser

    Implements

    Index

    Constructors

    Properties

    fieldList: string[]
    groupBy?: string[]
    index: number = 0
    limit?: number
    mode?: "user" | "system"
    offset?: number
    orderBy?: string[]
    parser: Parser
    queryString: string
    securityEnforced?: boolean
    sobjectType: string
    visibilityContext?: string
    whereCondition?: string | QueryBinary | QueryUnary

    Methods

    • Parse the query and extract the SObject type from the query string. If the QueryParser fails to parse the query, it will fallback to a regex matching.

      Parameters

      • this: void
      • queryString: string

        SOQL string

      Returns undefined | string

      SObject type of the SOQL or undefined if the query is not a SOQL query

    • Parse an SOQL string and return a SalesforceQueryData object containing the decomposed query.

      The parser will try to parse the query as accurately as possible, but it will not validate the query. If it encounters an unexpected keyword or operator the parser will not throw an error when in the root expression but will instead return the part of the query that it was able to parse.

      The parser will throw an error if it encounters an unexpected keyword or operator in a sub-expression or if the query is not starting with SELECT and lacking the FROM keyword.

      This parser supports the following parts of a SOQL query:

      • field list
      • sobject type
      • where condition
      • limit and offset
      • order by
      • group by
      • visibility context
      • query mode -security enforced

      To convert the decomposed query back to a SOQL string see QueryFormatter.format which converts a SalesforceQueryData object back to an SOQL string.

      Sub-queries and nested-queries are not parsed and will be stored as a string in the field list or condition

      Parameters

      • this: void
      • queryString: string

        SOQL string to parse

      Returns SalesforceQueryData

      Decomposed query that can be analyzed and modified.