use of jakarta.nosql.document.DocumentCondition in project jnosql-diana by eclipse.
the class BaseQueryBuilder method gtImpl.
protected <T> void gtImpl(T value) {
requireNonNull(value, "value is required");
DocumentCondition newCondition = DocumentCondition.gt(Document.of(name, value));
appendCondition(newCondition);
}
use of jakarta.nosql.document.DocumentCondition in project jnosql-diana by eclipse.
the class DeleteQueryParserTest method shouldReturnParserQuery15.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "delete from God where age between 10 and 30" })
public void shouldReturnParserQuery15(String query) {
ArgumentCaptor<DocumentDeleteQuery> captor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
parser.query(query, documentCollection, observer);
Mockito.verify(documentCollection).delete(captor.capture());
DocumentDeleteQuery documentQuery = captor.getValue();
checkBaseQuery(documentQuery);
assertTrue(documentQuery.getCondition().isPresent());
DocumentCondition condition = documentQuery.getCondition().get();
assertEquals(Condition.BETWEEN, condition.getCondition());
assertEquals(Document.of("age", Arrays.asList(10L, 30L)), condition.getDocument());
}
use of jakarta.nosql.document.DocumentCondition in project jnosql-diana by eclipse.
the class DeleteQueryParserTest method shouldReturnParserQuery16.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "delete from God where name = \"diana\"" })
public void shouldReturnParserQuery16(String query) {
ArgumentCaptor<DocumentDeleteQuery> captor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
parser.query(query, documentCollection, observer);
Mockito.verify(documentCollection).delete(captor.capture());
DocumentDeleteQuery documentQuery = captor.getValue();
checkBaseQuery(documentQuery);
assertTrue(documentQuery.getCondition().isPresent());
DocumentCondition condition = documentQuery.getCondition().get();
assertEquals(Condition.EQUALS, condition.getCondition());
assertEquals(Document.of("name", "diana"), condition.getDocument());
}
use of jakarta.nosql.document.DocumentCondition in project jnosql-diana by eclipse.
the class DeleteQueryParserTest method shouldReturnParserQuery13.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "delete from God where stamina <= -10.23" })
public void shouldReturnParserQuery13(String query) {
ArgumentCaptor<DocumentDeleteQuery> captor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
parser.query(query, documentCollection, observer);
Mockito.verify(documentCollection).delete(captor.capture());
DocumentDeleteQuery documentQuery = captor.getValue();
checkBaseQuery(documentQuery);
assertTrue(documentQuery.getCondition().isPresent());
DocumentCondition condition = documentQuery.getCondition().get();
assertEquals(Condition.LESSER_EQUALS_THAN, condition.getCondition());
assertEquals(Document.of("stamina", -10.23), condition.getDocument());
}
use of jakarta.nosql.document.DocumentCondition in project jnosql-diana by eclipse.
the class DeleteQueryParserTest method shouldReturnParserQuery19.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "delete from God where age = convert(12, java.lang.Integer)" })
public void shouldReturnParserQuery19(String query) {
ArgumentCaptor<DocumentDeleteQuery> captor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
parser.query(query, documentCollection, observer);
Mockito.verify(documentCollection).delete(captor.capture());
DocumentDeleteQuery documentQuery = captor.getValue();
checkBaseQuery(documentQuery);
assertTrue(documentQuery.getCondition().isPresent());
DocumentCondition condition = documentQuery.getCondition().get();
Document document = condition.getDocument();
assertEquals(Condition.EQUALS, condition.getCondition());
assertEquals("age", document.getName());
assertEquals(Value.of(12), document.getValue());
}
Aggregations