Class VariableAssignment

java.lang.Object
com.influxdb.query.dsl.Flux
com.influxdb.query.dsl.VariableAssignment
All Implemented Interfaces:
Expression, HasImports, IsVariableAssignment
Direct Known Subclasses:
AbstractFunctionFlux

public class VariableAssignment extends Flux implements IsVariableAssignment
Hold the variable name and expression of an assignment.

Example

 VariableAssignment a = Flux.from("test1").asVariable("a");
 VariableAssignment b = Flux.from("test2").asVariable("b");

 String flux = new Expressions(
    a,
    b,
    a.first().yield("firstA"),
    b.first().yield("firstB"),
    a.last().yield("lastA"),
    b.last().yield("lastB")
 ).toString();
 
See Also:
  • Field Details

    • name

      @Nonnull protected final String name
    • expression

      @Nonnull protected final Expression expression
  • Constructor Details

    • VariableAssignment

      public VariableAssignment(@Nonnull String name, @Nonnull Expression expression)
      Parameters:
      name - the name of teh variable
      expression - the expression to assign to the variable
  • Method Details

    • getVariableName

      @Nonnull public String getVariableName()
      Specified by:
      getVariableName in interface IsVariableAssignment
      Returns:
      the name of the variable
    • appendActual

      public void appendActual(@Nonnull Map<String,Object> parameters, @Nonnull StringBuilder builder)
      Description copied from class: Flux
      Append actual Flux function to Flux query.
      Specified by:
      appendActual in class Flux
      Parameters:
      parameters - named parameters for Flux query
      builder - Flux query chaing
    • toString

      public String toString(@Nonnull Map<String,Object> parameters, boolean prependImports)
      Specified by:
      toString in interface Expression
      Overrides:
      toString in class Flux
      Parameters:
      parameters - parameters to resolve
      prependImports - true, if the imports should be prepended
      Returns:
      the string representation of the expression
    • getImports

      public Set<String> getImports()
      Specified by:
      getImports in interface HasImports
      Overrides:
      getImports in class Flux
      Returns:
      all used imports of this flux