Class InfluxQLQueryApiImpl

All Implemented Interfaces:
InfluxQLQueryApi

public class InfluxQLQueryApiImpl extends AbstractQueryApi implements InfluxQLQueryApi
  • Constructor Details

  • Method Details

    • query

      @Nonnull public InfluxQLQueryResult query(@Nonnull InfluxQLQuery influxQLQuery)
      Description copied from interface: InfluxQLQueryApi
      Executes an InfluxQL query against the legacy endpoint.
      Specified by:
      query in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      Returns:
      the result
    • query

      @Nonnull public InfluxQLQueryResult query(@Nonnull InfluxQLQuery influxQLQuery, @Nullable InfluxQLQueryResult.Series.ValueExtractor valueExtractor)
      Description copied from interface: InfluxQLQueryApi
      Executes an InfluxQL query against the legacy endpoint. The value extractor is called for each resulting column to convert the string value returned by query into a custom type.

      Example:

       InfluxQLQueryResult result = influxQLQueryApi.query(
                   new InfluxQLQuery("SELECT FIRST(\"free\") FROM \"influxql\"", DATABASE_NAME)
                           .setPrecision(InfluxQLQuery.InfluxQLPrecision.SECONDS),
                   (columnName, rawValue, resultIndex, seriesName) -> {
                       switch (columnName) {
                           case "time":
                               return Instant.ofEpochSecond(Long.parseLong(rawValue));
                           case "first":
                               return new BigDecimal(rawValue);
                           default:
                               throw new IllegalArgumentException("unexpected column " + columnName);
                       }
                   }
           );
       
      Specified by:
      query in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      valueExtractor - a callback, to convert column values
      Returns:
      the result
    • queryCSV

      @Nonnull public InfluxQLQueryResult queryCSV(@Nonnull InfluxQLQuery influxQLQuery)
      Description copied from interface: InfluxQLQueryApi
      Convenience method to specify use of the mime type application/csv in the Accept header. Result timestamps will be in the Epoch format.
      Specified by:
      queryCSV in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      Returns:
      the result
    • queryCSV

      public InfluxQLQueryResult queryCSV(@Nonnull InfluxQLQuery influxQLQuery, @Nullable InfluxQLQueryResult.Series.ValueExtractor valueExtractor)
      Description copied from interface: InfluxQLQueryApi
      Convenience method to specify use of the mime type application/csv in the Accept header. Result timestamps will be in the Epoch format.
      Specified by:
      queryCSV in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      valueExtractor - a callback, to convert column values
      Returns:
      the result
    • queryJSON

      @Nonnull public InfluxQLQueryResult queryJSON(@Nonnull InfluxQLQuery influxQLQuery)
      Description copied from interface: InfluxQLQueryApi
      Convenience method to specify use of the mime type application/json in the Accept header. Result timestamps will be in the RFC3339 format.
      Specified by:
      queryJSON in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      Returns:
      the result
    • queryJSON

      @Nonnull public InfluxQLQueryResult queryJSON(@Nonnull InfluxQLQuery influxQLQuery, @Nullable InfluxQLQueryResult.Series.ValueExtractor valueExtractor)
      Description copied from interface: InfluxQLQueryApi
      Convenience method to specify use of the mime type application/json in the Accept header. Result timestamps will be in the RFC3339 format.
      Specified by:
      queryJSON in interface InfluxQLQueryApi
      Parameters:
      influxQLQuery - the query
      valueExtractor - a callback, to convert column values
      Returns:
      the result