Search in sources :

Example 61 with DocumentCondition

use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-artemis by eclipse.

the class AbstractMapperQuery method betweenImpl.

protected void betweenImpl(Number valueA, Number valueB) {
    requireNonNull(valueA, "valueA is required");
    requireNonNull(valueB, "valueB is required");
    DocumentCondition newCondition = DocumentCondition.between(Document.of(representation.getColumnField(name), asList(getValue(valueA), getValue(valueB))));
    appendCondition(newCondition);
}
Also used : DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Example 62 with DocumentCondition

use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-artemis by eclipse.

the class AbstractMapperQuery method eqImpl.

protected <T> void eqImpl(T value) {
    requireNonNull(value, "value is required");
    DocumentCondition newCondition = DocumentCondition.eq(Document.of(representation.getColumnField(name), getValue(value)));
    appendCondition(newCondition);
}
Also used : DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Example 63 with DocumentCondition

use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-artemis by eclipse.

the class AbstractMapperQuery method ltImpl.

protected void ltImpl(Number value) {
    requireNonNull(value, "value is required");
    DocumentCondition newCondition = DocumentCondition.lt(Document.of(representation.getColumnField(name), getValue(value)));
    appendCondition(newCondition);
}
Also used : DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Example 64 with DocumentCondition

use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-artemis by eclipse.

the class AbstractMapperQuery method inImpl.

protected <T> void inImpl(Iterable<T> values) {
    requireNonNull(values, "values is required");
    List<Object> convertedValues = StreamSupport.stream(values.spliterator(), false).map(this::getValue).collect(toList());
    DocumentCondition newCondition = DocumentCondition.in(Document.of(representation.getColumnField(name), convertedValues));
    appendCondition(newCondition);
}
Also used : DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Example 65 with DocumentCondition

use of org.jnosql.diana.api.document.DocumentCondition in project jnosql-artemis by eclipse.

the class AbstractMapperQuery method lteImpl.

protected void lteImpl(Number value) {
    requireNonNull(value, "value is required");
    DocumentCondition newCondition = DocumentCondition.lte(Document.of(representation.getColumnField(name), getValue(value)));
    appendCondition(newCondition);
}
Also used : DocumentCondition(org.jnosql.diana.api.document.DocumentCondition)

Aggregations

DocumentCondition (org.jnosql.diana.api.document.DocumentCondition)69 Test (org.junit.jupiter.api.Test)46 Document (org.jnosql.diana.api.document.Document)31 DocumentQuery (org.jnosql.diana.api.document.DocumentQuery)29 DocumentDeleteQuery (org.jnosql.diana.api.document.DocumentDeleteQuery)23 List (java.util.List)22 Person (org.jnosql.artemis.model.Person)13 Collections.singletonList (java.util.Collections.singletonList)7 Pagination (org.jnosql.artemis.Pagination)7 Sort (org.jnosql.diana.api.Sort)7 Proxy (java.lang.reflect.Proxy)6 Duration (java.time.Duration)6 Optional (java.util.Optional)6 Consumer (java.util.function.Consumer)6 Inject (javax.inject.Inject)6 CDIExtension (org.jnosql.artemis.CDIExtension)6 Converters (org.jnosql.artemis.Converters)6 DynamicQueryException (org.jnosql.artemis.DynamicQueryException)6 RepositoryAsync (org.jnosql.artemis.RepositoryAsync)6 DocumentTemplateAsync (org.jnosql.artemis.document.DocumentTemplateAsync)6