Package com.influxdb.query.dsl.functions
Class AbstractFunctionFlux<CALL extends AbstractFunctionCallFlux>
java.lang.Object
com.influxdb.query.dsl.Flux
com.influxdb.query.dsl.VariableAssignment
com.influxdb.query.dsl.functions.AbstractFunctionFlux<CALL>
- Type Parameters:
CALL
- the type of theAbstractFunctionCallFlux
- All Implemented Interfaces:
Expression
,HasImports
,IsVariableAssignment
The base class for function definitions.
The function definition describes the implementation of a function.
A concrete call to this function can be created via the
invoke()
method.
Example Definition
public static class MyCustomFunction extends AbstractFunctionFlux<MyCustomFunction.MyCustomFunctionCall> { public MyCustomFunction() { super("from2", new FromFlux() .withPropertyValue("bucket", "n"), MyCustomFunctionCall::new, new Parameter("n")); addImport("foo"); } public static class MyCustomFunctionCall extends AbstractFunctionCallFlux { public MyCustomFunctionCall(@Nonnull String name) { super(name); } public MyCustomFunctionCall withN(final String n) { this.withPropertyValueEscaped("n", n); return this; } } }
Example Usage
MyCustomFunction fun = new MyCustomFunction(); Expressions flux = new Expressions( fun, fun.invoke().withN("bar").count(), fun.invoke().withN("bar2"), );
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.influxdb.query.dsl.VariableAssignment
expression, name
Fields inherited from class com.influxdb.query.dsl.Flux
functionsParameters, imports
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractFunctionFlux
(String name, Expression functionDefinition, Function<String, CALL> invocationFactory, AbstractFunctionFlux.Parameter... parameter) -
Method Summary
Methods inherited from class com.influxdb.query.dsl.VariableAssignment
appendActual, getVariableName
Methods inherited from class com.influxdb.query.dsl.Flux
addImport, aggregateWindow, aggregateWindow, arrayFrom, arrayFrom, asVariable, collectImports, columns, columns, count, count, covariance, covariance, covariance, covariance, covariance, covariance, covariance, covariance, covariance, cumulativeSum, cumulativeSum, cumulativeSum, derivative, derivative, difference, difference, difference, difference, difference, difference, distinct, distinct, drop, drop, drop, drop, duplicate, duplicate, elapsed, elapsed, elapsed, elapsed, expression, fill, fill, filter, filter, first, from, from, from, function, group, groupBy, groupBy, groupBy, groupExcept, groupExcept, groupExcept, integral, integral, interpolateLinear, interpolateLinear, join, join, keep, keep, keep, keep, last, last, limit, limit, limit, map, map, max, max, mean, mean, min, min, pivot, pivot, pivot, quantile, quantile, quantile, quantile, quantile, range, range, range, range, range, range, range, reduce, reduce, rename, rename, rename, sample, sample, sample, set, set, skew, skew, sort, sort, sort, sort, sort, sort, spread, spread, stddev, stddev, sum, sum, tail, tail, tail, timeShift, timeShift, timeShift, timeShift, to, to, to, to, to, to, to, to, toBool, toDuration, toFloat, toInt, toString, toString, toStringConvert, toTime, toUInt, truncateTimeColumn, union, window, window, window, window, window, window, window, withFunction, withFunctionNamed, withPipedFunction, withPropertyNamed, withPropertyNamed, withPropertyValue, withPropertyValue, withPropertyValueEscaped, yield, yield
-
Constructor Details
-
AbstractFunctionFlux
protected AbstractFunctionFlux(@Nonnull String name, @Nonnull Expression functionDefinition, @Nonnull Function<String, CALL> invocationFactory, @Nonnull AbstractFunctionFlux.Parameter... parameter) - Parameters:
name
- the name of the function (the variable th function is assigned to)functionDefinition
- the function bodyinvocationFactory
- a factory to create an invocation, should be theconstructor reference
to the concreteCALL
implementationparameter
- the parameters of this function
-
-
Method Details
-
toString
- Specified by:
toString
in interfaceExpression
- Overrides:
toString
in classVariableAssignment
- Parameters:
parameters
- parameters to resolveprependImports
- true, if the imports should be prepended- Returns:
- the string representation of the expression
-
invoke
- Returns:
- A flux invoking this method. The invocation arguments can be adjusted via this flux.
-
invokePiped
-
getImports
- Specified by:
getImports
in interfaceHasImports
- Overrides:
getImports
in classVariableAssignment
- Returns:
- all used imports of this flux
-