Class StringBasedN1qlQueryParser
java.lang.Object
org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser
- Author:
- Subhashni Balakrishnan, Michael Reiche
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
This class is exposed to SpEL parsing through the variable#"n1ql"
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Pattern
regexp that detect $named placeholder (starts with a letter, then alphanum chars)final N1QLExpression
static final Pattern
regexp that detect positional placeholder ($ followed by digits only)static final Pattern
regexp that detects " and ' quote boundaries, ignoring escaped quotesstatic final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement.static final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement.static final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement.static final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement WHERE clause.static final String
static final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement.static final String
Use this variable in a SpEL expression in a@Query
annotation's inline statement. -
Constructor Summary
ConstructorDescriptionStringBasedN1qlQueryParser
(String bucketName, String collection, CouchbaseConverter couchbaseConverter, Class domainClass, Class resultClass, String typeField, String typeValue, boolean isCount, String[] distinctFields, String[] fields) StringBasedN1qlQueryParser
(String statement, CouchbaseQueryMethod queryMethod, String bucketName, CouchbaseConverter couchbaseConverter, String typeField, String typeValue, ParameterAccessor accessor, SpelExpressionParser parser, QueryMethodEvaluationContextProvider evaluationContextProvider) -
Method Summary
Modifier and TypeMethodDescriptioncreateN1qlSpelValues
(String bucketName, String collection, Class domainClass, Class resultClass, String typeField, String typeValue, boolean isCount, String[] distinctFields, String[] fields) doParse
(SpelExpressionParser parser, EvaluationContext evaluationContext, boolean isCountQuery) protected com.couchbase.client.java.json.JsonValue
getPlaceholderValues
(ParameterAccessor accessor) protected boolean
-
Field Details
-
SPEL_PREFIX
- See Also:
-
SPEL_SELECT_FROM_CLAUSE
Use this variable in a SpEL expression in a@Query
annotation's inline statement. This will be replaced by the correctSELECT x FROM y
clause needed for entity mapping. Eg."#{"#n1ql.selectEntity"} WHERE test = true"
. Note this only makes sense once, as the beginning of the statement.- See Also:
-
SPEL_BUCKET
Use this variable in a SpEL expression in a@Query
annotation's inline statement. This will be replaced by the (escaped) bucket name corresponding to the repository's entity. Eg."SELECT * FROM #{"#n1ql.bucket"} LIMIT 3"
.- See Also:
-
SPEL_ENTITY
Use this variable in a SpEL expression in a@Query
annotation's inline statement. This will be replaced by the fields allowing to construct the repository's entity (SELECT clause). Eg."SELECT #{"#n1ql.fields"} FROM test"
.- See Also:
-
SPEL_FILTER
Use this variable in a SpEL expression in a@Query
annotation's inline statement WHERE clause. This will be replaced by the expression allowing to only select documents matching the entity's class. Eg."SELECT * FROM test WHERE test = true AND #{"#n1ql.filter"}"
.- See Also:
-
SPEL_DELETE
Use this variable in a SpEL expression in a@Query
annotation's inline statement. This will be replaced by the correctdelete
expression needed Eg."#{"#n1ql.delete"} WHERE test = true"
. Note this only makes sense once, as the beginning of the statement.- See Also:
-
SPEL_RETURNING
Use this variable in a SpEL expression in a@Query
annotation's inline statement. This will be replaced by the correctreturning
clause needed for entity mapping. Eg."#{"#n1ql.returning"} WHERE test = true"
. Note this only makes sense once, as the beginning of the statement.- See Also:
-
NAMED_PLACEHOLDER_PATTERN
regexp that detect $named placeholder (starts with a letter, then alphanum chars) -
POSITIONAL_PLACEHOLDER_PATTERN
regexp that detect positional placeholder ($ followed by digits only) -
QUOTE_DETECTION_PATTERN
regexp that detects " and ' quote boundaries, ignoring escaped quotes -
parsedExpression
-
-
Constructor Details
-
StringBasedN1qlQueryParser
public StringBasedN1qlQueryParser(String statement, CouchbaseQueryMethod queryMethod, String bucketName, CouchbaseConverter couchbaseConverter, String typeField, String typeValue, ParameterAccessor accessor, SpelExpressionParser parser, QueryMethodEvaluationContextProvider evaluationContextProvider) -
StringBasedN1qlQueryParser
-
-
Method Details
-
createN1qlSpelValues
-
doParse
public String doParse(SpelExpressionParser parser, EvaluationContext evaluationContext, boolean isCountQuery) -
getPlaceholderValues
-
useGeneratedCountQuery
protected boolean useGeneratedCountQuery() -
getCountContext
-
getStatementContext
-
getStatement
-