Search in sources :

Example 1 with SortType

use of jakarta.nosql.SortType in project jnosql-diana by eclipse.

the class FindByMethodQueryProvider method sort.

private Sort sort(MethodParser.OrderNameContext context) {
    String text = context.variable().getText();
    SortType type = context.desc() == null ? SortType.ASC : SortType.DESC;
    return Sort.of(getFormatField(text), type);
}
Also used : SortType(jakarta.nosql.SortType)

Example 2 with SortType

use of jakarta.nosql.SortType in project jnosql-diana by eclipse.

the class AntlrSelectQueryProvider method sort.

private Sort sort(QueryParser.OrderNameContext context) {
    String text = context.name().getText();
    SortType type = context.desc() == null ? SortType.ASC : SortType.DESC;
    return Sort.of(text, type);
}
Also used : SortType(jakarta.nosql.SortType)

Example 3 with SortType

use of jakarta.nosql.SortType in project jnosql-diana by eclipse.

the class FindByMethodQueryProviderTest method shouldReturnParserQuery21.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "findByOrderByNameAsc" })
public void shouldReturnParserQuery21(String query) {
    SortType type = SortType.ASC;
    checkOrderBy(query, type);
}
Also used : SortType(jakarta.nosql.SortType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with SortType

use of jakarta.nosql.SortType in project jnosql-diana by eclipse.

the class FindByMethodQueryProviderTest method shouldReturnParserQuery23.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "findByOrderByNameDescAgeAsc" })
public void shouldReturnParserQuery23(String query) {
    SortType type = SortType.DESC;
    SortType type2 = SortType.ASC;
    checkOrderBy(query, type, type2);
}
Also used : SortType(jakarta.nosql.SortType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

SortType (jakarta.nosql.SortType)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 ValueSource (org.junit.jupiter.params.provider.ValueSource)2