From 28ccd490c182c1cfa5db118516b69dea6085a439 Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Thu, 9 Jan 2025 01:22:02 +0300 Subject: [PATCH] Runtime expression builder --- .../serdha/api/v0/misc/RuntimeExpression.kt | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/misc/RuntimeExpression.kt diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/misc/RuntimeExpression.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/misc/RuntimeExpression.kt new file mode 100644 index 0000000..ce88db5 --- /dev/null +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/misc/RuntimeExpression.kt @@ -0,0 +1,41 @@ +package ru.landgrafhomyak.serdha.api.v0.misc + +import ru.landgrafhomyak.serdha.api.v0.runtime.ParametersSetter +import ru.landgrafhomyak.serdha.api.v0.runtime.Row + +public interface RuntimeExpression { + public val userExtension: ExpressionUserExtension + + public interface RuntimeExpressionInput, ExpressionUserExtension : Any> : Column + public interface RuntimeExpressionOutput, ExpressionUserExtension : Any> : InputParam + + public fun interface InputLinker { + public fun link(linker: Scope) + + public interface Scope { + public operator fun > set(p: RuntimeExpressionInput, e: Expression) + } + } + + public fun interface OutputLinker { + public fun link(linker: Scope) + + public interface Scope { + public operator fun > get(p: RuntimeExpressionOutput): Expression + } + } + + public interface Creator { + public fun createExpression(creator: Scope): ExpressionUserExtension + + public interface Scope { + public fun > input(name: String, type: DT): RuntimeExpressionInput + public fun > output(name: String, type: DT): RuntimeExpressionOutput + public var action: Action + } + } + + public interface Action { + public fun calculate(input: Row, output: ParametersSetter) + } +} \ No newline at end of file