Search in sources :

Example 1 with Condition

use of jakarta.nosql.Condition in project jnosql-diana-driver by eclipse.

the class Relations method load.

private static void load(ColumnCondition columnCondition, List<Relation> relations) {
    Column column = columnCondition.getColumn();
    Condition condition = columnCondition.getCondition();
    switch(condition) {
        case EQUALS:
            relations.add(Relation.column(QueryUtils.getName(column)).isEqualTo(getTerm(column)));
            return;
        case GREATER_THAN:
            relations.add(Relation.column(QueryUtils.getName(column)).isGreaterThan(getTerm(column)));
            return;
        case GREATER_EQUALS_THAN:
            relations.add(Relation.column(QueryUtils.getName(column)).isGreaterThanOrEqualTo(getTerm(column)));
            return;
        case LESSER_THAN:
            relations.add(Relation.column(QueryUtils.getName(column)).isLessThan(getTerm(column)));
            return;
        case LESSER_EQUALS_THAN:
            relations.add(Relation.column(QueryUtils.getName(column)).isLessThanOrEqualTo(getTerm(column)));
            return;
        case IN:
            relations.add(Relation.column(QueryUtils.getName(column)).in(getIinValue(column.getValue())));
            return;
        case LIKE:
            relations.add(Relation.column(QueryUtils.getName(column)).like(getTerm(column)));
            return;
        case AND:
            column.get(new TypeReference<List<ColumnCondition>>() {
            }).forEach(cc -> load(cc, relations));
            return;
        case OR:
        default:
            throw new UnsupportedOperationException("The columnCondition " + condition + " is not supported in cassandra column driver");
    }
}
Also used : ColumnCondition(jakarta.nosql.column.ColumnCondition) Condition(jakarta.nosql.Condition) Column(jakarta.nosql.column.Column) TypeReference(jakarta.nosql.TypeReference) ColumnCondition(jakarta.nosql.column.ColumnCondition)

Aggregations

Condition (jakarta.nosql.Condition)1 TypeReference (jakarta.nosql.TypeReference)1 Column (jakarta.nosql.column.Column)1 ColumnCondition (jakarta.nosql.column.ColumnCondition)1