use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldReturnErrorWhenBetweenIsNotIterable.
@Test
public void shouldReturnErrorWhenBetweenIsNotIterable() {
assertThrows(IllegalArgumentException.class, () -> {
Column column = Column.of("age", 12);
ColumnCondition.between(column);
});
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldReturnErrorWhenIterableHasMoreThanTwoElement2.
@Test
public void shouldReturnErrorWhenIterableHasMoreThanTwoElement2() {
assertThrows(IllegalArgumentException.class, () -> {
Column column = Column.of("age", Arrays.asList(12, 12, 12));
ColumnCondition.between(column);
});
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnEntity method toMap.
@Override
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, Column> entry : columns.entrySet()) {
Column column = entry.getValue();
map.put(entry.getKey(), convert(column.get()));
}
return Collections.unmodifiableMap(map);
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ConditionQueryParser method getEntity.
protected ColumnEntity getEntity(ConditionQuerySupplier query, String columnFamily, Params params, ColumnObserverParser observer) {
ColumnEntity entity = ColumnEntity.of(columnFamily);
if (query.useJSONCondition()) {
JSONQueryValue jsonValue = query.getValue().orElseThrow(() -> new QueryException("It is an invalid state of" + " either Update or Insert."));
List<Column> columns = JsonObjects.getColumns(jsonValue.get());
entity.addAll(columns);
return entity;
}
query.getConditions().stream().map(c -> Conditions.getCondition(c, params, observer, columnFamily)).map(ColumnCondition::getColumn).forEach(entity::add);
return entity;
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnCondition method or.
@Override
public ColumnCondition or(ColumnCondition condition) {
validateReadOnly();
requireNonNull(condition, "Condition is required");
if (Condition.OR.equals(this.condition)) {
Column newColumn = getConditions(condition, Condition.OR);
return new DefaultColumnCondition(newColumn, Condition.OR);
}
return DefaultColumnCondition.or(this, condition);
}
Aggregations