Search in sources :

Example 81 with DocumentCondition

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

the class BaseQueryBuilder method appendCondition.

protected void appendCondition(DocumentCondition newCondition) {
    DocumentCondition documentCondition = getDocumentCondition(newCondition);
    if (nonNull(condition)) {
        if (and) {
            this.condition = condition.and(documentCondition);
        } else {
            this.condition = condition.or(documentCondition);
        }
    } else {
        this.condition = documentCondition;
    }
    this.negate = false;
    this.name = null;
}
Also used : DocumentCondition(jakarta.nosql.document.DocumentCondition)

Example 82 with DocumentCondition

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

the class BaseQueryBuilder method inImpl.

protected <T> void inImpl(Iterable<T> values) {
    requireNonNull(values, "values is required");
    DocumentCondition newCondition = DocumentCondition.in(Document.of(name, values));
    appendCondition(newCondition);
}
Also used : DocumentCondition(jakarta.nosql.document.DocumentCondition)

Example 83 with DocumentCondition

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

the class BaseQueryBuilder method likeImpl.

protected void likeImpl(String value) {
    requireNonNull(value, "value is required");
    DocumentCondition newCondition = DocumentCondition.like(Document.of(name, value));
    appendCondition(newCondition);
}
Also used : DocumentCondition(jakarta.nosql.document.DocumentCondition)

Example 84 with DocumentCondition

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

the class DefaultDocumentTemplateTest method shouldReturnFind.

@Test
public void shouldReturnFind() {
    subject.find(Person.class, "10");
    ArgumentCaptor<DocumentQuery> queryCaptor = ArgumentCaptor.forClass(DocumentQuery.class);
    verify(managerMock).select(queryCaptor.capture());
    DocumentQuery query = queryCaptor.getValue();
    DocumentCondition condition = query.getCondition().get();
    assertEquals("Person", query.getDocumentCollection());
    assertEquals(DocumentCondition.eq(Document.of("_id", 10L)), condition);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) DocumentCondition(jakarta.nosql.document.DocumentCondition) Test(org.junit.jupiter.api.Test)

Example 85 with DocumentCondition

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

the class AbstractMapperQuery method gteImpl.

protected <T> void gteImpl(T value) {
    requireNonNull(value, "value is required");
    DocumentCondition newCondition = DocumentCondition.gte(Document.of(mapping.getColumnField(name), getValue(value)));
    appendCondition(newCondition);
}
Also used : DocumentCondition(jakarta.nosql.document.DocumentCondition)

Aggregations

DocumentCondition (jakarta.nosql.document.DocumentCondition)132 Test (org.junit.jupiter.api.Test)68 DocumentQuery (jakarta.nosql.document.DocumentQuery)64 Document (jakarta.nosql.document.Document)60 List (java.util.List)37 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)37 ValueSource (org.junit.jupiter.params.provider.ValueSource)37 DocumentDeleteQuery (jakarta.nosql.document.DocumentDeleteQuery)33 Person (jakarta.nosql.tck.entities.Person)17 Pagination (jakarta.nosql.mapping.Pagination)13 DocumentPreparedStatement (jakarta.nosql.document.DocumentPreparedStatement)10 TypeReference (jakarta.nosql.TypeReference)7 Params (jakarta.nosql.Params)6 DocumentEntity (jakarta.nosql.document.DocumentEntity)6 DocumentObserverParser (jakarta.nosql.document.DocumentObserverParser)5 QueryException (jakarta.nosql.QueryException)4 ServiceLoaderProvider (jakarta.nosql.ServiceLoaderProvider)4 DocumentCollectionManager (jakarta.nosql.document.DocumentCollectionManager)4 DocumentQueryParams (jakarta.nosql.document.DocumentQueryParams)4 SelectQueryConverter (jakarta.nosql.document.SelectQueryConverter)4