use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.
the class AbstractWhereSupplier method exitIn.
@Override
public void exitIn(QueryParser.InContext ctx) {
boolean hasNot = Objects.nonNull(ctx.not());
String name = ctx.name().getText();
QueryValue<?>[] values = ctx.value().stream().map(ValueConverter::get).toArray(QueryValue[]::new);
ArrayQueryValue value = DefaultArrayValue.of(values);
checkCondition(new DefaultCondition(name, IN, value), hasNot);
}
use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.
the class FindByMethodQueryProviderTest method shouldReturnParserQuery27.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "findByAgeBetween" })
public void shouldReturnParserQuery27(String query) {
Operator operator = Operator.BETWEEN;
String entity = "entity";
SelectQuery selectQuery = queryProvider.apply(query, entity);
assertNotNull(selectQuery);
assertEquals(entity, selectQuery.getEntity());
assertTrue(selectQuery.getFields().isEmpty());
assertTrue(selectQuery.getOrderBy().isEmpty());
assertEquals(0, selectQuery.getLimit());
assertEquals(0, selectQuery.getSkip());
Optional<Where> where = selectQuery.getWhere();
assertTrue(where.isPresent());
Condition condition = where.get().getCondition();
QueryValue<?> value = condition.getValue();
assertEquals(operator, condition.getOperator());
QueryValue<?>[] values = MethodArrayValue.class.cast(value).get();
ParamQueryValue param1 = (ParamQueryValue) values[0];
ParamQueryValue param2 = (ParamQueryValue) values[1];
assertNotEquals(param2.get(), param1.get());
}
Aggregations