protected StringBuilder relation2Sql(Condition.Relation relation) { String key = relation.serialKey().toString(); Object value = relation.serialValue();
private static boolean matchCondition(BackendEntry item, Condition c) { // TODO: Compatible with BackendEntry TextBackendEntry entry = (TextBackendEntry) item; // Not supported by memory if (!(c instanceof Condition.Relation)) { throw new BackendException("Unsupported condition: " + c); } Condition.Relation r = (Condition.Relation) c; String key = r.serialKey().toString(); // TODO: deal with others Relation like: <, >=, ... if (r.relation() == Condition.RelationType.CONTAINS_KEY) { return entry.contains(r.serialValue().toString()); } else if (r.relation() == Condition.RelationType.CONTAINS) { return entry.containsValue(r.serialValue().toString()); } else if (r.relation() == Condition.RelationType.EQ) { return entry.contains(key, r.serialValue().toString()); } else if (entry.contains(key)) { return r.test(entry.column(key)); } return false; } }
protected Clause relation2Cql(Relation relation) { String key = relation.serialKey().toString(); Object value = relation.serialValue();
protected StringBuilder relation2Sql(Condition.Relation relation) { String key = relation.serialKey().toString(); Object value = relation.serialValue();
protected Clause relation2Cql(Relation relation) { String key = relation.serialKey().toString(); Object value = relation.serialValue();
@Override protected Query writeQueryCondition(Query query) { ConditionQuery result = (ConditionQuery) query; // No user-prop when serialize assert result.allSysprop(); for (Condition.Relation r : result.relations()) { // Serialize key if (query.resultType().isSchema()) { r.serialKey(((HugeKeys) r.key()).string()); } else { r.serialKey(formatSyspropName((HugeKeys) r.key())); } if (r.value() instanceof Id) { // Serialize id value r.serialValue(writeId((Id) r.value())); } else { // Serialize other type value r.serialValue(JsonUtil.toJson(r.value())); } if (r.relation() == Condition.RelationType.CONTAINS_KEY) { // Serialize has-key String key = (String) r.serialValue(); r.serialValue(formatPropertyName(key)); } } return result; }
private static boolean matchCondition(BackendEntry item, Condition c) { // TODO: Compatible with BackendEntry TextBackendEntry entry = (TextBackendEntry) item; // Not supported by memory if (!(c instanceof Condition.Relation)) { throw new BackendException("Unsupported condition: " + c); } Condition.Relation r = (Condition.Relation) c; String key = r.serialKey().toString(); // TODO: deal with others Relation like: <, >=, ... if (r.relation() == Condition.RelationType.CONTAINS_KEY) { return entry.contains(r.serialValue().toString()); } else if (r.relation() == Condition.RelationType.CONTAINS) { return entry.containsValue(r.serialValue().toString()); } else if (r.relation() == Condition.RelationType.EQ) { return entry.contains(key, r.serialValue().toString()); } else if (entry.contains(key)) { return r.test(entry.column(key)); } return false; } }
@Override protected Query writeQueryCondition(Query query) { ConditionQuery result = (ConditionQuery) query; // No user-prop when serialize assert result.allSysprop(); for (Condition.Relation r : result.relations()) { // Serialize key if (query.resultType().isSchema()) { r.serialKey(((HugeKeys) r.key()).string()); } else { r.serialKey(formatSyspropName((HugeKeys) r.key())); } if (r.value() instanceof Id) { // Serialize id value r.serialValue(writeId((Id) r.value())); } else { // Serialize other type value r.serialValue(JsonUtil.toJson(r.value())); } if (r.relation() == Condition.RelationType.CONTAINS_KEY) { // Serialize has-key String key = (String) r.serialValue(); r.serialValue(formatPropertyName(key)); } } return result; }