use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-diana by eclipse.
the class BaseQueryBuilder method gteImpl.
protected void gteImpl(Number value) {
requireNonNull(value, "value is required");
DocumentCondition newCondition = DocumentCondition.gte(Document.of(name, value));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameLte.
@Test
public void shouldSelectWhereNameLte() {
String documentCollection = "documentCollection";
Number value = 10;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").lte(value).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.LESSER_EQUALS_THAN, condition.getCondition());
assertEquals("name", document.getName());
assertEquals(value, document.get());
}
use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameLike.
@Test
public void shouldSelectWhereNameLike() {
String documentCollection = "documentCollection";
String name = "Ada Lovelace";
DocumentDeleteQuery query = delete().from(documentCollection).where("name").like(name).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.LIKE, condition.getCondition());
assertEquals("name", document.getName());
assertEquals(name, document.get());
}
use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameLt.
@Test
public void shouldSelectWhereNameLt() {
String documentCollection = "documentCollection";
Number value = 10;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").lt(value).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.LESSER_THAN, condition.getCondition());
assertEquals("name", document.getName());
assertEquals(value, document.get());
}
use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
String documentCollection = "documentCollection";
Number valueA = 10;
Number valueB = 20;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").between(valueA, valueB).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.BETWEEN, condition.getCondition());
assertEquals("name", document.getName());
assertThat(document.get(new TypeReference<List<Number>>() {
}), Matchers.contains(10, 20));
}
Aggregations