use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class BaseQueryBuilder method likeImpl.
protected void likeImpl(String value) {
requireNonNull(value, "value is required");
ColumnCondition newCondition = ColumnCondition.like(Column.of(name, value));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class BaseQueryBuilder method betweenImpl.
protected void betweenImpl(Number valueA, Number valueB) {
requireNonNull(valueA, "valueA is required");
requireNonNull(valueB, "valueB is required");
ColumnCondition newCondition = ColumnCondition.between(Column.of(name, asList(valueA, valueB)));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class BaseQueryBuilder method gtImpl.
protected void gtImpl(Number value) {
requireNonNull(value, "value is required");
ColumnCondition newCondition = ColumnCondition.gt(Column.of(name, value));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameNot.
@Test
public void shouldSelectWhereNameNot() {
String columnFamily = "columnFamily";
String name = "Ada Lovelace";
ColumnDeleteQuery query = delete().from(columnFamily).where("name").not().eq(name).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
ColumnCondition negate = column.get(ColumnCondition.class);
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.NOT, condition.getCondition());
assertEquals(Condition.EQUALS, negate.getCondition());
assertEquals("name", negate.getColumn().getName());
assertEquals(name, negate.getColumn().get());
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameOr.
@Test
public void shouldSelectWhereNameOr() {
String columnFamily = "columnFamily";
String name = "Ada Lovelace";
ColumnDeleteQuery query = delete().from(columnFamily).where("name").eq(name).or("age").gt(10).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
List<ColumnCondition> conditions = column.get(new TypeReference<List<ColumnCondition>>() {
});
assertEquals(Condition.OR, condition.getCondition());
assertThat(conditions, Matchers.containsInAnyOrder(ColumnCondition.eq(Column.of("name", name)), ColumnCondition.gt(Column.of("age", 10))));
}
Aggregations