Interface QueryBuilder2
- All Known Implementing Classes:
AbstractSqlLikeQueryBuilder2
,CosmosSqlQueryBuilder2
,JpaQueryBuilder2
,MongoQueryBuilder2
,SqlQueryBuilder2
@Internal
@Introspected
public interface QueryBuilder2
An interface capable of encoding a query into a string and a set of named parameters.
- Since:
- 1.0
- Author:
- graemerocher, Denis Stepanov
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
The base query definition.static interface
The delete query definition.static interface
The insert query definition.static interface
The select query definition.static interface
The update query definition. -
Method Summary
Modifier and TypeMethodDescriptionbuildDelete
(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryBuilder2.DeleteQueryDefinition definition) Encode the given query into the encoded query instance.@Nullable QueryResult
buildInsert
(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata, QueryBuilder2.InsertQueryDefinition definition) Builds an insert statement for the given entity.@NonNull String
buildLimitAndOffset
(long limit, long offset) Generate the limit and offset query.buildSelect
(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryBuilder2.SelectQueryDefinition query) Encode the given query for the passed annotation metadata and query.buildUpdate
(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryBuilder2.UpdateQueryDefinition definition) Encode the given query into the encoded query instance.
-
Method Details
-
buildInsert
@Nullable @Nullable QueryResult buildInsert(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata, QueryBuilder2.InsertQueryDefinition definition) Builds an insert statement for the given entity.- Parameters:
repositoryMetadata
- The repository annotation metadatadefinition
- The definition- Returns:
- The insert statement or null if the implementation doesn't require insert statements
-
buildSelect
QueryResult buildSelect(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryBuilder2.SelectQueryDefinition query) Encode the given query for the passed annotation metadata and query.- Parameters:
annotationMetadata
- The annotation metadataquery
- The query model- Returns:
- The query result
-
buildUpdate
QueryResult buildUpdate(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryBuilder2.UpdateQueryDefinition definition) Encode the given query into the encoded query instance.- Parameters:
annotationMetadata
- The annotation metadatadefinition
- The definition- Returns:
- The encoded query
-
buildDelete
QueryResult buildDelete(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryBuilder2.DeleteQueryDefinition definition) Encode the given query into the encoded query instance.- Parameters:
annotationMetadata
- The annotation metadatadefinition
- The query definition- Returns:
- The encoded query
-
buildLimitAndOffset
Generate the limit and offset query.- Parameters:
limit
- The limit (-1 of not set)offset
- The offset (0 if not set)- Returns:
- The encoded query
-