2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.influxdb.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.persistence.FilterCriteria;
19 * Creates InfluxDB query sentence given an OpenHab persistence {@link FilterCriteria}
21 * @author Joan Pujol Espinar - Initial contribution
24 public interface FilterCriteriaQueryCreator {
26 * Create query from {@link FilterCriteria}
28 * @param criteria Criteria to create query from
29 * @param retentionPolicy Name of the retentionPolicy/bucket to use in query
30 * @return Created query as a String
32 String createQuery(FilterCriteria criteria, String retentionPolicy);
34 default String getOperationSymbol(FilterCriteria.Operator operator, InfluxDBVersion version) {
47 return version == InfluxDBVersion.V1 ? "<>" : "!=";
49 throw new UnnexpectedConditionException("Not expected operator " + operator);