diff --git a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpression.kt b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpression.kt index e03cc83c..c34519ee 100644 --- a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpression.kt +++ b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpression.kt @@ -10,7 +10,7 @@ import ch.ergon.dope.validtype.StringType class SubstringExpression( private val inStr: TypeExpression, private val startPos: Int, - private val length: Int, + private val length: Int? = null, ) : TypeExpression, FunctionOperator { override fun toDopeQuery(manager: DopeQueryManager): DopeQuery { val inStrDopeQuery = inStr.toDopeQuery(manager) @@ -19,13 +19,13 @@ class SubstringExpression( symbol = "SUBSTR", inStrDopeQuery, startPos.toDopeType().toDopeQuery(manager), - length.toDopeType().toDopeQuery(manager), + length?.toDopeType()?.toDopeQuery(manager), ), parameters = inStrDopeQuery.parameters, ) } } -fun substr(inStr: TypeExpression, startPos: Int, length: Int) = SubstringExpression(inStr, startPos, length) +fun substr(inStr: TypeExpression, startPos: Int, length: Int? = null) = SubstringExpression(inStr, startPos, length) -fun substr(inStr: String, startPos: Int, length: Int = inStr.length) = substr(inStr.toDopeType(), startPos, length) +fun substr(inStr: String, startPos: Int, length: Int? = null) = substr(inStr.toDopeType(), startPos, length) diff --git a/core/src/test/kotlin/ch/ergon/dope/buildTest/StringFunctionsTest.kt b/core/src/test/kotlin/ch/ergon/dope/buildTest/StringFunctionsTest.kt index fbd5068c..be906123 100644 --- a/core/src/test/kotlin/ch/ergon/dope/buildTest/StringFunctionsTest.kt +++ b/core/src/test/kotlin/ch/ergon/dope/buildTest/StringFunctionsTest.kt @@ -599,7 +599,7 @@ class StringFunctionsTest : ManagerDependentTest { @Test fun `should Support Substring`() { val expected = - "SELECT SUBSTR(\"N1QL is awesome\", 3, 15) AS `end_of_string`, SUBSTR(\"N1QL is awesome\", 3, 1) AS" + + "SELECT SUBSTR(\"N1QL is awesome\", 3) AS `end_of_string`, SUBSTR(\"N1QL is awesome\", 3, 1) AS" + " `single_letter`, SUBSTR(\"N1QL is awesome\", 3, 3) AS `three_letters`" val actual: String = create.select( diff --git a/core/src/test/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpressionTest.kt b/core/src/test/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpressionTest.kt index 93401489..66659012 100644 --- a/core/src/test/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpressionTest.kt +++ b/core/src/test/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/function/stringfunction/SubstringExpressionTest.kt @@ -52,6 +52,17 @@ class SubstringExpressionTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + @Test + fun `should support substring function type int`() { + val inStr = someStringField("inStr") + val startPos = 1 + val expected = SubstringExpression(inStr, startPos) + + val actual = substr(inStr, startPos) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + @Test fun `should support substring function string int int`() { val inStr = someString("inStr") @@ -68,8 +79,7 @@ class SubstringExpressionTest : ManagerDependentTest { fun `should support substring function string int`() { val inStr = someString("inStr") val startPos = 1 - val length = inStr.length - val expected = SubstringExpression(inStr.toDopeType(), startPos, length) + val expected = SubstringExpression(inStr.toDopeType(), startPos) val actual = substr(inStr, startPos) diff --git a/crystal-map-connector/build.gradle.kts b/crystal-map-connector/build.gradle.kts index 7cd3ae4d..ca8b5381 100644 --- a/crystal-map-connector/build.gradle.kts +++ b/crystal-map-connector/build.gradle.kts @@ -32,7 +32,7 @@ repositories { } dependencies { - implementation("com.github.SchwarzIT.crystal-map:crystal-map-api:3.18.0") + implementation("com.github.SchwarzIT.crystal-map:crystal-map-api:4.0.3") implementation(kotlin("reflect")) implementation(project(":core")) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/CrystalMapAdapter.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/CrystalMapAdapter.kt index 65f5cfc9..8df734fd 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/CrystalMapAdapter.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/CrystalMapAdapter.kt @@ -1,6 +1,8 @@ package ch.ergon.dope +import ch.ergon.dope.resolvable.expression.TypeExpression import ch.ergon.dope.resolvable.expression.unaliased.type.Field +import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.resolvable.formatPathToQueryString import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType @@ -8,41 +10,84 @@ import ch.ergon.dope.validtype.DopeSchemaArray import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMConverterList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMObject import com.schwarz.crystalapi.schema.CMObjectList import com.schwarz.crystalapi.schema.CMType import com.schwarz.crystalapi.schema.Schema +import kotlin.reflect.KClass fun CMType.toDopeType(reference: String = path): Field = Field( when (this) { - is CMField<*> -> this.name - is CMList<*> -> this.name + is CMJsonField<*> -> this.name + is CMJsonList<*> -> this.name is CMObjectList<*> -> this.name is CMObject<*> -> TODO("DOPE-216") - else -> throw IllegalArgumentException("Unsupported type $this") }, reference, ) +@JvmName("toDopeTypeNumber") +fun Convertable.toDopeType(other: CMConverterField): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), Number::class).toDopeType() + +@JvmName("toDopeTypeString") +fun Convertable.toDopeType(other: CMConverterField): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), String::class).toDopeType() + +@JvmName("toDopeTypeBoolean") +fun Convertable.toDopeType(other: CMConverterField): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), Boolean::class).toDopeType() + +@JvmName("toDopeTypeListNumber") +fun Convertable.toDopeType(other: CMConverterList): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), Number::class).toDopeType() + +@JvmName("toDopeTypeListString") +fun Convertable.toDopeType(other: CMConverterList): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), String::class).toDopeType() + +@JvmName("toDopeTypeListBoolean") +fun Convertable.toDopeType(other: CMConverterList): TypeExpression = + requireValidConvertable(other.typeConverter.write(this), Boolean::class).toDopeType() + +fun CMConverterField.toDopeType(other: Convertable) = + requireValidConvertable(typeConverter.write(other), Number::class).toDopeType() + +fun CMConverterField.toDopeType(other: Convertable) = + requireValidConvertable(typeConverter.write(other), String::class).toDopeType() + +fun CMConverterField.toDopeType(other: Convertable) = + requireValidConvertable(typeConverter.write(other), Boolean::class).toDopeType() + @JvmName("toDopeNumberField") -fun CMField.toDopeType(reference: String = path): Field = Field(name, reference) +fun CMJsonField.toDopeType(reference: String = path): Field = Field(name, reference) @JvmName("toDopeStringField") -fun CMField.toDopeType(reference: String = path): Field = Field(name, reference) +fun CMJsonField.toDopeType(reference: String = path): Field = Field(name, reference) @JvmName("toDopeBooleanField") -fun CMField.toDopeType(reference: String = path): Field = Field(name, reference) +fun CMJsonField.toDopeType(reference: String = path): Field = Field(name, reference) @JvmName("toDopeNumberArrayField") -fun CMList.toDopeType(): Field> = Field(name, path) +fun CMJsonList.toDopeType(): Field> = Field(name, path) @JvmName("toDopeStringArrayField") -fun CMList.toDopeType(): Field> = Field(name, path) +fun CMJsonList.toDopeType(): Field> = Field(name, path) @JvmName("toDopeBooleanArrayField") -fun CMList.toDopeType(): Field> = Field(name, path) +fun CMJsonList.toDopeType(): Field> = Field(name, path) + +fun CMJsonList.toDopeType(): Field> = Field(name, path) // TODO: DOPE-192 fun CMObjectList.toDopeType() = DopeSchemaArray(element, formatPathToQueryString(name, path)) + +private fun Convertable.requireValidConvertable(jsonType: JsonType?, jsonTypeClass: KClass) = + requireNotNull(jsonType) { + "Conversion failed: " + + "The value of type '${this::class.simpleName}' couldn't be converted to the expected JSON type '${jsonTypeClass.simpleName}'. " + } diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/ArrayAggregate.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/ArrayAggregate.kt index 4fe8ed3e..22dfaab2 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/ArrayAggregate.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/ArrayAggregate.kt @@ -5,29 +5,29 @@ import ch.ergon.dope.resolvable.expression.unaliased.aggregator.ArrayAggregateEx import ch.ergon.dope.resolvable.expression.unaliased.aggregator.arrayAggregate import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("arrayAggNumber") -fun arrayAggregate(field: CMField, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonField, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) @JvmName("arrayAggString") -fun arrayAggregate(field: CMField, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonField, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) @JvmName("arrayAggBoolean") -fun arrayAggregate(field: CMField, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonField, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) @JvmName("arrayAggNumberArray") -fun arrayAggregate(field: CMList, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonList, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) @JvmName("arrayAggStringArray") -fun arrayAggregate(field: CMList, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonList, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) @JvmName("arrayAggBooleanArray") -fun arrayAggregate(field: CMList, quantifier: AggregateQuantifier? = null): +fun arrayAggregate(field: CMJsonList, quantifier: AggregateQuantifier? = null): ArrayAggregateExpression = arrayAggregate(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Count.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Count.kt index a85b2818..ce980c60 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Count.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Count.kt @@ -4,29 +4,29 @@ import ch.ergon.dope.resolvable.expression.unaliased.aggregator.AggregateQuantif import ch.ergon.dope.resolvable.expression.unaliased.aggregator.CountExpression import ch.ergon.dope.resolvable.expression.unaliased.aggregator.count import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("countNumber") -fun count(field: CMField, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonField, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) @JvmName("countString") -fun count(field: CMField, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonField, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) @JvmName("countBoolean") -fun count(field: CMField, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonField, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) @JvmName("countNumber") -fun count(field: CMList, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonList, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) @JvmName("countString") -fun count(field: CMList, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonList, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) @JvmName("countBoolean") -fun count(field: CMList, quantifier: AggregateQuantifier? = null): +fun count(field: CMJsonList, quantifier: AggregateQuantifier? = null): CountExpression = count(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Max.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Max.kt index 2e66efe3..cbc93f97 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Max.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Max.kt @@ -5,29 +5,29 @@ import ch.ergon.dope.resolvable.expression.unaliased.aggregator.MaxExpression import ch.ergon.dope.resolvable.expression.unaliased.aggregator.max import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("maxNumber") -fun max(field: CMField, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonField, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) @JvmName("maxString") -fun max(field: CMField, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonField, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) @JvmName("maxBoolean") -fun max(field: CMField, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonField, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) @JvmName("maxNumber") -fun max(field: CMList, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonList, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) @JvmName("maxString") -fun max(field: CMList, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonList, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) @JvmName("maxBoolean") -fun max(field: CMList, quantifier: AggregateQuantifier? = null): +fun max(field: CMJsonList, quantifier: AggregateQuantifier? = null): MaxExpression = max(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Min.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Min.kt index 24122292..c1534d98 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Min.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/Min.kt @@ -5,29 +5,29 @@ import ch.ergon.dope.resolvable.expression.unaliased.aggregator.MinExpression import ch.ergon.dope.resolvable.expression.unaliased.aggregator.min import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("minNumber") -fun min(field: CMField, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonField, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) @JvmName("minString") -fun min(field: CMField, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonField, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) @JvmName("minBoolean") -fun min(field: CMField, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonField, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) @JvmName("minNumber") -fun min(field: CMList, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonList, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) @JvmName("minString") -fun min(field: CMList, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonList, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) @JvmName("minBoolean") -fun min(field: CMList, quantifier: AggregateQuantifier? = null): +fun min(field: CMJsonList, quantifier: AggregateQuantifier? = null): MinExpression = min(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/NumberAggregate.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/NumberAggregate.kt index da57b697..5db3567e 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/NumberAggregate.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/aggregator/NumberAggregate.kt @@ -15,28 +15,28 @@ import ch.ergon.dope.resolvable.expression.unaliased.aggregator.sum import ch.ergon.dope.resolvable.expression.unaliased.aggregator.variance import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("avgNumber") -fun avg(field: CMField, quantifier: AggregateQuantifier? = null): +fun avg(field: CMJsonField, quantifier: AggregateQuantifier? = null): AverageExpression = avg(field.toDopeType(), quantifier) @JvmName("meanNumber") -fun mean(field: CMField, quantifier: AggregateQuantifier? = null): +fun mean(field: CMJsonField, quantifier: AggregateQuantifier? = null): MeanExpression = mean(field.toDopeType(), quantifier) @JvmName("medianNumber") -fun median(field: CMField, quantifier: AggregateQuantifier? = null): +fun median(field: CMJsonField, quantifier: AggregateQuantifier? = null): MedianExpression = median(field.toDopeType(), quantifier) @JvmName("sumNumber") -fun sum(field: CMField, quantifier: AggregateQuantifier? = null): +fun sum(field: CMJsonField, quantifier: AggregateQuantifier? = null): SumExpression = sum(field.toDopeType(), quantifier) @JvmName("stdDevNumber") -fun stdDev(field: CMField, quantifier: AggregateQuantifier? = null): +fun stdDev(field: CMJsonField, quantifier: AggregateQuantifier? = null): StandardDeviationExpression = stdDev(field.toDopeType(), quantifier) @JvmName("varianceNumber") -fun variance(field: CMField, quantifier: AggregateQuantifier? = null): +fun variance(field: CMJsonField, quantifier: AggregateQuantifier? = null): VarianceExpression = variance(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/DeleteClause.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/DeleteClause.kt index 1907f55e..79d287f7 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/DeleteClause.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/DeleteClause.kt @@ -6,18 +6,18 @@ import ch.ergon.dope.resolvable.clause.IDeleteOffsetClause import ch.ergon.dope.resolvable.clause.IDeleteUseKeysClause import ch.ergon.dope.resolvable.clause.IDeleteWhereClause import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMType fun IDeleteOffsetClause.returning(field: CMType, vararg fields: CMType) = returning(field.toDopeType(), *fields.map { it.toDopeType() }.toTypedArray()) -fun IDeleteLimitClause.offset(numberExpression: CMField) = offset(numberExpression.toDopeType()) +fun IDeleteLimitClause.offset(numberExpression: CMJsonField) = offset(numberExpression.toDopeType()) -fun IDeleteWhereClause.limit(numberExpression: CMField) = limit(numberExpression.toDopeType()) +fun IDeleteWhereClause.limit(numberExpression: CMJsonField) = limit(numberExpression.toDopeType()) -fun IDeleteUseKeysClause.where(booleanExpression: CMField) = where(booleanExpression.toDopeType()) +fun IDeleteUseKeysClause.where(booleanExpression: CMJsonField) = where(booleanExpression.toDopeType()) -fun IDeleteClause.useKeys(useKeys: CMField) = useKeys(useKeys.toDopeType()) -fun IDeleteClause.useKeys(useKeys: CMList) = useKeys(useKeys.toDopeType()) +fun IDeleteClause.useKeys(useKeys: CMJsonField) = useKeys(useKeys.toDopeType()) +fun IDeleteClause.useKeys(useKeys: CMJsonList) = useKeys(useKeys.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/SelectClause.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/SelectClause.kt index cfc1c43e..d0f6d97b 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/SelectClause.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/SelectClause.kt @@ -11,41 +11,43 @@ import ch.ergon.dope.resolvable.clause.ISelectWhereClause import ch.ergon.dope.resolvable.clause.model.OrderByType import ch.ergon.dope.resolvable.fromable.Bucket import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMType -fun ISelectLimitClause.offset(numberField: CMField) = offset(numberField.toDopeType()) +fun ISelectLimitClause.offset(numberField: CMJsonField) = offset(numberField.toDopeType()) -fun ISelectOrderByClause.limit(numberField: CMField) = limit(numberField.toDopeType()) +fun ISelectOrderByClause.limit(numberField: CMJsonField) = limit(numberField.toDopeType()) -fun ISelectGroupByClause.orderBy(stringField: CMField) = orderBy(stringField.toDopeType()) +fun ISelectGroupByClause.orderBy(stringField: CMJsonField) = orderBy(stringField.toDopeType()) -fun ISelectGroupByClause.orderBy(stringField: CMField, orderByType: OrderByType) = +fun ISelectGroupByClause.orderBy(stringField: CMJsonField, orderByType: OrderByType) = orderBy(stringField.toDopeType(), orderByType) fun ISelectWhereClause.groupBy(field: CMType, vararg fields: CMType) = groupBy(field.toDopeType(), *fields.map { it.toDopeType() }.toTypedArray()) -fun ISelectUseKeysClause.where(whereExpression: CMField) = where(whereExpression.toDopeType()) +fun ISelectUseKeysClause.where(whereExpression: CMJsonField) = where(whereExpression.toDopeType()) -fun ISelectFromClause.useKeys(useKeys: CMField) = useKeys(useKeys.toDopeType()) -fun ISelectFromClause.useKeys(useKeys: CMList) = useKeys(useKeys.toDopeType()) +fun ISelectFromClause.useKeys(useKeys: CMJsonField) = useKeys(useKeys.toDopeType()) +fun ISelectFromClause.useKeys(useKeys: CMJsonList) = useKeys(useKeys.toDopeType()) -fun ISelectJoinClause.join(bucket: Bucket, onKeys: CMField) = join(bucket, onKeys.toDopeType()) -fun ISelectJoinClause.join(bucket: Bucket, onKey: CMField, forBucket: Bucket) = join(bucket, onKey.toDopeType(), forBucket) +fun ISelectJoinClause.join(bucket: Bucket, onKeys: CMJsonField) = join(bucket, onKeys.toDopeType()) +fun ISelectJoinClause.join(bucket: Bucket, onKey: CMJsonField, forBucket: Bucket) = join(bucket, onKey.toDopeType(), forBucket) -fun ISelectJoinClause.innerJoin(bucket: Bucket, onKeys: CMField) = innerJoin(bucket, onKeys.toDopeType()) -fun ISelectJoinClause.innerJoin(bucket: Bucket, onKey: CMField, forBucket: Bucket) = innerJoin(bucket, onKey.toDopeType(), forBucket) +fun ISelectJoinClause.innerJoin(bucket: Bucket, onKeys: CMJsonField) = innerJoin(bucket, onKeys.toDopeType()) +fun ISelectJoinClause.innerJoin(bucket: Bucket, onKey: CMJsonField, forBucket: Bucket) = + innerJoin(bucket, onKey.toDopeType(), forBucket) -fun ISelectJoinClause.leftJoin(bucket: Bucket, onKeys: CMField) = leftJoin(bucket, onKeys.toDopeType()) -fun ISelectJoinClause.leftJoin(bucket: Bucket, onKey: CMField, forBucket: Bucket) = leftJoin(bucket, onKey.toDopeType(), forBucket) +fun ISelectJoinClause.leftJoin(bucket: Bucket, onKeys: CMJsonField) = leftJoin(bucket, onKeys.toDopeType()) +fun ISelectJoinClause.leftJoin(bucket: Bucket, onKey: CMJsonField, forBucket: Bucket) = + leftJoin(bucket, onKey.toDopeType(), forBucket) @JvmName("unnestString") -fun ISelectUnnestClause.unnest(arrayField: CMList) = unnest(arrayField.toDopeType()) +fun ISelectUnnestClause.unnest(arrayField: CMJsonList) = unnest(arrayField.toDopeType()) @JvmName("unnestNumber") -fun ISelectUnnestClause.unnest(arrayField: CMList) = unnest(arrayField.toDopeType()) +fun ISelectUnnestClause.unnest(arrayField: CMJsonList) = unnest(arrayField.toDopeType()) @JvmName("unnestBoolean") -fun ISelectUnnestClause.unnest(arrayField: CMList) = unnest(arrayField.toDopeType()) +fun ISelectUnnestClause.unnest(arrayField: CMJsonList) = unnest(arrayField.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/UpdateClause.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/UpdateClause.kt index 9a4daec7..f3b689de 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/UpdateClause.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/clause/UpdateClause.kt @@ -15,16 +15,17 @@ import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMType fun IUpdateLimitClause.returning(field: CMType, vararg fields: CMType) = returning(field.toDopeType(), *fields.map { it.toDopeType() }.toTypedArray()) -fun IUpdateWhereClause.limit(numberField: CMField) = limit(numberField.toDopeType()) +fun IUpdateWhereClause.limit(numberField: CMJsonField) = limit(numberField.toDopeType()) -fun IUpdateUnsetClause.where(whereExpression: CMField) = where(whereExpression.toDopeType()) +fun IUpdateUnsetClause.where(whereExpression: CMJsonField) = where(whereExpression.toDopeType()) fun IUpdateUnsetClause.unset(field: CMType) = UnsetClause(field.toDopeType(), parentClause = this) @@ -34,183 +35,219 @@ fun UnsetClause.unset(field: CMType) = @JvmName("setCMNumberFieldToCMNumberField") fun IUpdateSetClause.set( - field: CMField, - value: CMField, + field: CMJsonField, + value: CMJsonField, ) = SetClause(field.toDopeType().to(value.toDopeType()), parentClause = this) @JvmName("setCMNumberFieldToCMNumberField") fun SetClause.set( - field: CMField, - value: CMField, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonField, + value: CMJsonField, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMStringFieldToCMStringField") fun IUpdateUseKeysClause.set( - field: CMField, - value: CMField, + field: CMJsonField, + value: CMJsonField, ) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMStringFieldToCMStringField") fun SetClause.set( - field: CMField, - value: CMField, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonField, + value: CMJsonField, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMBooleanFieldToCMBooleanField") fun IUpdateUseKeysClause.set( - field: CMField, - value: CMField, + field: CMJsonField, + value: CMJsonField, ) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMBooleanFieldToCMBooleanField") fun SetClause.set( - field: CMField, - value: CMField, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonField, + value: CMJsonField, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMNumberListToCMNumberList") fun IUpdateUseKeysClause.set( - field: CMList, - value: CMList, + field: CMJsonList, + value: CMJsonList, ) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMNumberListToCMNumberList") fun SetClause.set( - field: CMList, - value: CMList, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonList, + value: CMJsonList, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMStringListToCMStringList") fun IUpdateUseKeysClause.set( - field: CMList, - value: CMList, + field: CMJsonList, + value: CMJsonList, ) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMStringListToCMStringList") fun SetClause.set( - field: CMList, - value: CMList, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonList, + value: CMJsonList, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMBooleanListToCMBooleanList") fun IUpdateUseKeysClause.set( - field: CMList, - value: CMList, + field: CMJsonList, + value: CMJsonList, ) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMBooleanListToCMBooleanList") fun SetClause.set( - field: CMList, - value: CMList, -) = this.set(field.toDopeType(), value.toDopeType()) + field: CMJsonList, + value: CMJsonList, +) = set(field.toDopeType(), value.toDopeType()) @JvmName("setCMNumberFieldToNumberTypeExpression") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, ) = set(field.toDopeType(), value) @JvmName("setCMNumberFieldToNumberTypeExpression") fun SetClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMStringFieldToStringTypeExpression") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, ) = set(field.toDopeType(), value) @JvmName("setCMStringFieldToStringTypeExpression") fun SetClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMBooleanFieldToBooleanTypeExpression") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, ) = set(field.toDopeType(), value) @JvmName("setCMBooleanFieldToBooleanTypeExpression") fun SetClause.set( - field: CMField, + field: CMJsonField, value: TypeExpression, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMNumberListToNumberArrayTypeExpression") fun IUpdateUseKeysClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, ) = set(field.toDopeType(), value) @JvmName("setCMNumberListToNumberArrayTypeExpression") fun SetClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMStringListToStringArrayTypeExpression") fun IUpdateUseKeysClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, ) = set(field.toDopeType(), value) @JvmName("setCMStringListToStringArrayTypeExpression") fun SetClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMBooleanListToBooleanArrayTypeExpression") fun IUpdateUseKeysClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, ) = set(field.toDopeType(), value) @JvmName("setCMBooleanListToBooleanArrayTypeExpression") fun SetClause.set( - field: CMList, + field: CMJsonList, value: TypeExpression>, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) @JvmName("setCMNumberFieldToNumber") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: Number, ) = set(field.toDopeType(), value) @JvmName("setCMNumberFieldToNumber") fun SetClause.set( - field: CMField, + field: CMJsonField, value: Number, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) + +@JvmName("setCMConverterNumberFieldToNumber") +fun IUpdateUseKeysClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) + +@JvmName("setCMConverterNumberFieldToNumber") +fun SetClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) @JvmName("setCMStringFieldToString") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: String, ) = set(field.toDopeType(), value) @JvmName("setCMStringFieldToString") fun SetClause.set( - field: CMField, + field: CMJsonField, value: String, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) + +@JvmName("setCMConverterStringFieldToNumber") +fun IUpdateUseKeysClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) + +@JvmName("setCMConverterStringFieldToNumber") +fun SetClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) @JvmName("setCMBooleanFieldToBoolean") fun IUpdateUseKeysClause.set( - field: CMField, + field: CMJsonField, value: Boolean, ) = set(field.toDopeType(), value) @JvmName("setCMBooleanFieldToBoolean") fun SetClause.set( - field: CMField, + field: CMJsonField, value: Boolean, -) = this.set(field.toDopeType(), value) +) = set(field.toDopeType(), value) + +@JvmName("setCMConverterBooleanFieldToNumber") +fun IUpdateUseKeysClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) + +@JvmName("setCMConverterBooleanFieldToNumber") +fun SetClause.set( + field: CMConverterField, + value: Convertable, +) = set(field.toDopeType(), field.toDopeType(value)) -fun IUpdateClause.useKeys(useKeys: CMField) = useKeys(useKeys.toDopeType()) -fun IUpdateClause.useKeys(useKeys: CMList) = useKeys(useKeys.toDopeType()) +fun IUpdateClause.useKeys(useKeys: CMJsonField) = useKeys(useKeys.toDopeType()) +fun IUpdateClause.useKeys(useKeys: CMJsonList) = useKeys(useKeys.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/Negation.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/Negation.kt index 5de718f9..5a1d3bdd 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/Negation.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/Negation.kt @@ -2,6 +2,6 @@ package ch.ergon.dope.extension.type.arithmetic import ch.ergon.dope.resolvable.expression.unaliased.type.arithmetic.neg import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun neg(number: CMField) = neg(number.toDopeType()) +fun neg(number: CMJsonField) = neg(number.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/NumberInfix.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/NumberInfix.kt index 2f679423..40df8a31 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/NumberInfix.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/arithmetic/NumberInfix.kt @@ -9,54 +9,70 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.arithmetic.sub import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField -fun CMField.add(numberExpression: TypeExpression) = toDopeType().add(numberExpression) +fun CMJsonField.add(numberExpression: TypeExpression) = toDopeType().add(numberExpression) -fun CMField.add(number: CMField) = toDopeType().add(number.toDopeType()) +fun CMJsonField.add(number: CMJsonField) = toDopeType().add(number.toDopeType()) -fun TypeExpression.add(number: CMField) = add(number.toDopeType()) +fun TypeExpression.add(number: CMJsonField) = add(number.toDopeType()) -fun Number.add(number: CMField) = toDopeType().add(number.toDopeType()) +fun Number.add(number: CMJsonField) = toDopeType().add(number.toDopeType()) -fun CMField.add(number: Number) = toDopeType().add(number.toDopeType()) +fun CMJsonField.add(number: Number) = toDopeType().add(number.toDopeType()) -fun CMField.sub(numberExpression: TypeExpression) = toDopeType().sub(numberExpression) +fun Convertable.add(other: CMConverterField) = + toDopeType(other).add(other.toDopeType()) -fun CMField.sub(number: CMField) = toDopeType().sub(number.toDopeType()) +fun CMJsonField.sub(numberExpression: TypeExpression) = toDopeType().sub(numberExpression) -fun TypeExpression.sub(number: CMField) = sub(number.toDopeType()) +fun CMJsonField.sub(number: CMJsonField) = toDopeType().sub(number.toDopeType()) -fun Number.sub(number: CMField) = toDopeType().sub(number.toDopeType()) +fun TypeExpression.sub(number: CMJsonField) = sub(number.toDopeType()) -fun CMField.sub(number: Number) = toDopeType().sub(number.toDopeType()) +fun Number.sub(number: CMJsonField) = toDopeType().sub(number.toDopeType()) -fun CMField.mul(numberExpression: TypeExpression) = toDopeType().mul(numberExpression) +fun CMJsonField.sub(number: Number) = toDopeType().sub(number.toDopeType()) -fun CMField.mul(number: CMField) = toDopeType().mul(number.toDopeType()) +fun Convertable.sub(other: CMConverterField) = + toDopeType(other).sub(other.toDopeType()) -fun TypeExpression.mul(number: CMField) = mul(number.toDopeType()) +fun CMJsonField.mul(numberExpression: TypeExpression) = toDopeType().mul(numberExpression) -fun Number.mul(number: CMField) = toDopeType().mul(number.toDopeType()) +fun CMJsonField.mul(number: CMJsonField) = toDopeType().mul(number.toDopeType()) -fun CMField.mul(number: Number) = toDopeType().mul(number.toDopeType()) +fun TypeExpression.mul(number: CMJsonField) = mul(number.toDopeType()) -fun CMField.div(numberExpression: TypeExpression) = toDopeType().div(numberExpression) +fun Number.mul(number: CMJsonField) = toDopeType().mul(number.toDopeType()) -fun CMField.div(number: CMField) = toDopeType().div(number.toDopeType()) +fun CMJsonField.mul(number: Number) = toDopeType().mul(number.toDopeType()) -fun TypeExpression.div(number: CMField) = div(number.toDopeType()) +fun Convertable.mul(other: CMConverterField) = + toDopeType(other).mul(other.toDopeType()) -fun Number.div(number: CMField) = toDopeType().div(number.toDopeType()) +fun CMJsonField.div(numberExpression: TypeExpression) = toDopeType().div(numberExpression) -fun CMField.div(number: Number) = toDopeType().div(number.toDopeType()) +fun CMJsonField.div(number: CMJsonField) = toDopeType().div(number.toDopeType()) -fun CMField.mod(numberExpression: TypeExpression) = toDopeType().mod(numberExpression) +fun TypeExpression.div(number: CMJsonField) = div(number.toDopeType()) -fun CMField.mod(number: CMField) = toDopeType().mod(number.toDopeType()) +fun Number.div(number: CMJsonField) = toDopeType().div(number.toDopeType()) -fun TypeExpression.mod(number: CMField) = mod(number.toDopeType()) +fun CMJsonField.div(number: Number) = toDopeType().div(number.toDopeType()) -fun Number.mod(number: CMField) = toDopeType().mod(number.toDopeType()) +fun Convertable.div(other: CMConverterField) = + toDopeType(other).div(other.toDopeType()) -fun CMField.mod(number: Number) = toDopeType().mod(number.toDopeType()) +fun CMJsonField.mod(numberExpression: TypeExpression) = toDopeType().mod(numberExpression) + +fun CMJsonField.mod(number: CMJsonField) = toDopeType().mod(number.toDopeType()) + +fun TypeExpression.mod(number: CMJsonField) = mod(number.toDopeType()) + +fun Number.mod(number: CMJsonField) = toDopeType().mod(number.toDopeType()) + +fun CMJsonField.mod(number: Number) = toDopeType().mod(number.toDopeType()) + +fun Convertable.mod(other: CMConverterField) = + toDopeType(other).mod(other.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayConcat.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayConcat.kt index ed9c749f..6cb18b71 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayConcat.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayConcat.kt @@ -6,13 +6,13 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("stringArrayConcat") fun arrayConcat( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayConcatExpression = arrayConcat( firstArray.toDopeType(), secondArray.toDopeType(), @@ -21,9 +21,9 @@ fun arrayConcat( @JvmName("numberArrayConcat") fun arrayConcat( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayConcatExpression = arrayConcat( firstArray.toDopeType(), secondArray.toDopeType(), @@ -32,9 +32,9 @@ fun arrayConcat( @JvmName("booleanArrayConcat") fun arrayConcat( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayConcatExpression = arrayConcat( firstArray.toDopeType(), secondArray.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayContains.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayContains.kt index d7f91a3e..70c4fcc7 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayContains.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayContains.kt @@ -7,26 +7,39 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberArrayContains") -fun arrayContains(array: CMList, value: CMField): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: CMJsonField): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) -fun arrayContains(array: CMList, value: Number): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: Number): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) +@JvmName("numberArrayContains") +fun arrayContains(array: CMConverterList, value: Convertable): + ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType(array)) + @JvmName("stringArrayContains") -fun arrayContains(array: CMList, value: CMField): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: CMJsonField): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) -fun arrayContains(array: CMList, value: String): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: String): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) +@JvmName("stringArrayContains") +fun arrayContains(array: CMConverterList, value: Convertable): + ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType(array)) + @JvmName("booleanArrayContains") -fun arrayContains(array: CMList, value: CMField): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: CMJsonField): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) -fun arrayContains(array: CMList, value: Boolean): ArrayContainsExpression = +fun arrayContains(array: CMJsonList, value: Boolean): ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType()) + +@JvmName("booleanArrayContains") +fun arrayContains(array: CMConverterList, value: Convertable): + ArrayContainsExpression = arrayContains(array.toDopeType(), value.toDopeType(array)) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayDistinct.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayDistinct.kt index e5b61b6a..435a2229 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayDistinct.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayDistinct.kt @@ -6,16 +6,16 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberArrayDistinct") -fun arrayDistinct(array: CMList): ArrayDistinctExpression = +fun arrayDistinct(array: CMJsonList): ArrayDistinctExpression = arrayDistinct(array.toDopeType()) @JvmName("stringArrayDistinct") -fun arrayDistinct(array: CMList): ArrayDistinctExpression = +fun arrayDistinct(array: CMJsonList): ArrayDistinctExpression = arrayDistinct(array.toDopeType()) @JvmName("booleanArrayDistinct") -fun arrayDistinct(array: CMList): ArrayDistinctExpression = +fun arrayDistinct(array: CMJsonList): ArrayDistinctExpression = arrayDistinct(array.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayIntersect.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayIntersect.kt index 31dda006..e6507779 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayIntersect.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayIntersect.kt @@ -6,13 +6,13 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("stringArrayIntersect") fun arrayIntersect( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayIntersectExpression = arrayIntersect( firstArray.toDopeType(), secondArray.toDopeType(), @@ -21,9 +21,9 @@ fun arrayIntersect( @JvmName("numberArrayIntersect") fun arrayIntersect( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayIntersectExpression = arrayIntersect( firstArray.toDopeType(), secondArray.toDopeType(), @@ -32,9 +32,9 @@ fun arrayIntersect( @JvmName("booleanArrayIntersect") fun arrayIntersect( - firstArray: CMList, - secondArray: CMList, - vararg additionalArrays: CMList, + firstArray: CMJsonList, + secondArray: CMJsonList, + vararg additionalArrays: CMJsonList, ): ArrayIntersectExpression = arrayIntersect( firstArray.toDopeType(), secondArray.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayLength.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayLength.kt index d5fc45d8..69ec90bf 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayLength.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArrayLength.kt @@ -6,16 +6,16 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberArrayLength") -fun arrayLength(array: CMList): ArrayLengthExpression = +fun arrayLength(array: CMJsonList): ArrayLengthExpression = arrayLength(array.toDopeType()) @JvmName("stringArrayLength") -fun arrayLength(array: CMList): ArrayLengthExpression = +fun arrayLength(array: CMJsonList): ArrayLengthExpression = arrayLength(array.toDopeType()) @JvmName("booleanArrayLength") -fun arrayLength(array: CMList): ArrayLengthExpression = +fun arrayLength(array: CMJsonList): ArrayLengthExpression = arrayLength(array.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArraySum.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArraySum.kt index 81b60b04..38ad527f 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArraySum.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/array/ArraySum.kt @@ -6,16 +6,16 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberArraySum") -fun arraySum(array: CMList): ArraySumExpression = +fun arraySum(array: CMJsonList): ArraySumExpression = arraySum(array.toDopeType()) @JvmName("stringArraySum") -fun arraySum(array: CMList): ArraySumExpression = +fun arraySum(array: CMJsonList): ArraySumExpression = arraySum(array.toDopeType()) @JvmName("booleanArraySum") -fun arraySum(array: CMList): ArraySumExpression = +fun arraySum(array: CMJsonList): ArraySumExpression = arraySum(array.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissing.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissing.kt index 49b007e4..e55b6db0 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissing.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissing.kt @@ -2,14 +2,14 @@ package ch.ergon.dope.extension.type.conditional import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.ifMissing import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("ifCMNumberFieldIsMissing") fun ifMissing( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -18,9 +18,9 @@ fun ifMissing( @JvmName("ifCMStringFieldIsMissing") fun ifMissing( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -29,9 +29,9 @@ fun ifMissing( @JvmName("ifCMBooleanFieldIsMissing") fun ifMissing( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -40,9 +40,9 @@ fun ifMissing( @JvmName("ifCMNumberStringIsMissing") fun ifMissing( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -51,9 +51,9 @@ fun ifMissing( @JvmName("ifCMStringListIsMissing") fun ifMissing( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -62,9 +62,9 @@ fun ifMissing( @JvmName("ifCMBooleanListIsMissing") fun ifMissing( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissing( firstExpression.toDopeType(), secondExpression.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissingOrNull.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissingOrNull.kt index 190f9c71..2bac4481 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissingOrNull.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfMissingOrNull.kt @@ -3,14 +3,14 @@ package ch.ergon.dope.extension.type.conditional import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.coalesce import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.ifMissingOrNull import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("ifCMNumberFieldIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -19,9 +19,9 @@ fun ifMissingOrNull( @JvmName("ifCMStringFieldIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -30,9 +30,9 @@ fun ifMissingOrNull( @JvmName("ifCMBooleanFieldIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -41,9 +41,9 @@ fun ifMissingOrNull( @JvmName("ifCMNumberListIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -52,9 +52,9 @@ fun ifMissingOrNull( @JvmName("ifCMStringListIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -63,9 +63,9 @@ fun ifMissingOrNull( @JvmName("ifCMBooleanListIsMissingOrNull") fun ifMissingOrNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifMissingOrNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -74,9 +74,9 @@ fun ifMissingOrNull( @JvmName("coalesceCMNumberField") fun coalesce( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -85,9 +85,9 @@ fun coalesce( @JvmName("coalesceCMStringField") fun coalesce( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -96,9 +96,9 @@ fun coalesce( @JvmName("coalesceCMBooleanField") fun coalesce( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -107,9 +107,9 @@ fun coalesce( @JvmName("coalesceCMNumberList") fun coalesce( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -118,9 +118,9 @@ fun coalesce( @JvmName("coalesceCMStringList") fun coalesce( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -129,9 +129,9 @@ fun coalesce( @JvmName("coalesceCMBooleanField") fun coalesce( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = coalesce( firstExpression.toDopeType(), secondExpression.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfNull.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfNull.kt index df4768cd..5f11e0d8 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfNull.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/IfNull.kt @@ -2,14 +2,14 @@ package ch.ergon.dope.extension.type.conditional import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.ifNull import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("ifCMNumberFieldIsNull") fun ifNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -18,9 +18,9 @@ fun ifNull( @JvmName("ifCMStringFieldIsNull") fun ifNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -29,9 +29,9 @@ fun ifNull( @JvmName("ifCMBooleanFieldIsNull") fun ifNull( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -40,9 +40,9 @@ fun ifNull( @JvmName("ifCMNumberListIsNull") fun ifNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -51,9 +51,9 @@ fun ifNull( @JvmName("ifCMStringListIsNull") fun ifNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -62,9 +62,9 @@ fun ifNull( @JvmName("ifCMBooleanListIsNull") fun ifNull( - firstExpression: CMList, - secondExpression: CMList, - vararg additionalExpressions: CMList, + firstExpression: CMJsonList, + secondExpression: CMJsonList, + vararg additionalExpressions: CMJsonList, ) = ifNull( firstExpression.toDopeType(), secondExpression.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl.kt index a9a97818..e2518e02 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl.kt @@ -1,42 +1,56 @@ package ch.ergon.dope.extension.type.conditional import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.nvl +import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("nvlCMNumberField") -fun nvl(initialExpression: CMField, substituteExpression: CMField) = +fun nvl(initialExpression: CMJsonField, substituteExpression: CMJsonField) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMStringField") -fun nvl(initialExpression: CMField, substituteExpression: CMField) = +fun nvl(initialExpression: CMJsonField, substituteExpression: CMJsonField) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMBooleanField") -fun nvl(initialExpression: CMField, substituteExpression: CMField) = +fun nvl(initialExpression: CMJsonField, substituteExpression: CMJsonField) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMNumberList") -fun nvl(initialExpression: CMList, substituteExpression: CMList) = +fun nvl(initialExpression: CMJsonList, substituteExpression: CMJsonList) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMStringList") -fun nvl(initialExpression: CMList, substituteExpression: CMList) = +fun nvl(initialExpression: CMJsonList, substituteExpression: CMJsonList) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMBooleanList") -fun nvl(initialExpression: CMList, substituteExpression: CMList) = +fun nvl(initialExpression: CMJsonList, substituteExpression: CMJsonList) = nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMNumberFieldAndNumber") -fun nvl(initialExpression: CMField, substituteExpression: Number) = - nvl(initialExpression.toDopeType(), substituteExpression) +fun nvl(initialExpression: CMJsonField, substituteExpression: Number) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMStringFieldAndString") -fun nvl(initialExpression: CMField, substituteExpression: String) = - nvl(initialExpression.toDopeType(), substituteExpression) +fun nvl(initialExpression: CMJsonField, substituteExpression: String) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) @JvmName("nvlCMBooleanFieldAndBoolean") -fun nvl(initialExpression: CMField, substituteExpression: Boolean) = - nvl(initialExpression.toDopeType(), substituteExpression) +fun nvl(initialExpression: CMJsonField, substituteExpression: Boolean) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType()) + +@JvmName("nvlCMConverterNumberList") +fun nvl(initialExpression: CMConverterField, substituteExpression: Convertable) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType(initialExpression)) + +@JvmName("nvlCMConverterStringList") +fun nvl(initialExpression: CMConverterField, substituteExpression: Convertable) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType(initialExpression)) + +@JvmName("nvlCMConverterBooleanList") +fun nvl(initialExpression: CMConverterField, substituteExpression: Convertable) = + nvl(initialExpression.toDopeType(), substituteExpression.toDopeType(initialExpression)) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl2.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl2.kt index 7567a45e..8dfe7b92 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl2.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/conditional/Nvl2.kt @@ -8,112 +8,112 @@ import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMType @JvmName("nvl2CMNumberFieldAndCMNumberField") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMStringFieldAndCMStringField") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMBooleanFieldAndCMBooleanField") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMNumberListAndCMNumberList") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMStringListAndCMStringList") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMBooleanListAndCMBooleanList") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMNumberFieldAndNumberType") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringFieldAndStringType") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanFieldAndBooleanType") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMNumberListAndArrayNumberType") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringListAndArrayStringType") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanListAndArrayBooleanType") fun nvl2( initialExpression: CMType, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMNumberFieldAndNumber") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: Number, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringFieldAndString") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: String, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanFieldAndBoolean") fun nvl2( initialExpression: CMType, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: Boolean, ) = nvl2(initialExpression.toDopeType(), valueIfExists.toDopeType(), valueIfNotExists) @@ -121,63 +121,63 @@ fun nvl2( fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2StringTypeAndCMStringField") fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2BooleanTypeAndCMBooleanField") fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayNumberTypeAndCMNumberList") fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayStringTypeAndCMStringList") fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayBooleanTypeAndCMBooleanList") fun nvl2( initialExpression: CMType, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2NumberAndCMNumberField") fun nvl2( initialExpression: CMType, valueIfExists: Number, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2StringAndCMStringField") fun nvl2( initialExpression: CMType, valueIfExists: String, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2BooleanAndCMBooleanField") fun nvl2( initialExpression: CMType, valueIfExists: Boolean, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression.toDopeType(), valueIfExists, valueIfNotExists.toDopeType()) fun nvl2( @@ -201,105 +201,105 @@ fun nvl2( @JvmName("nvl2CMNumberFieldAndCMNumberField") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMStringFieldAndCMStringField") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMBooleanFieldAndCMBooleanField") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, - valueIfNotExists: CMField, + valueIfExists: CMJsonField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMNumberListAndCMNumberList") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMStringListAndCMStringList") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMBooleanListAndCMBooleanList") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, - valueIfNotExists: CMList, + valueIfExists: CMJsonList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists.toDopeType()) @JvmName("nvl2CMNumberFieldAndNumberType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringFieldAndStringType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanFieldAndBooleanType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: UnaliasedExpression, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMNumberListAndArrayNumberType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringListAndArrayStringType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanListAndArrayBooleanType") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMList, + valueIfExists: CMJsonList, valueIfNotExists: UnaliasedExpression>, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMNumberFieldAndNumber") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: Number, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMStringFieldAndString") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: String, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @JvmName("nvl2CMBooleanFieldAndBoolean") fun nvl2( initialExpression: UnaliasedExpression, - valueIfExists: CMField, + valueIfExists: CMJsonField, valueIfNotExists: Boolean, ) = nvl2(initialExpression, valueIfExists.toDopeType(), valueIfNotExists) @@ -307,61 +307,61 @@ fun nvl2( fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2StringTypeAndCMStringField") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2BooleanTypeAndCMBooleanField") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayNumberTypeAndCMNumberList") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayStringTypeAndCMStringList") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2ArrayBooleanTypeAndCMBooleanList") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: UnaliasedExpression>, - valueIfNotExists: CMList, + valueIfNotExists: CMJsonList, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2NumberAndCMNumberField") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: Number, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2StringAndCMStringField") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: String, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) @JvmName("nvl2BooleanAndCMBooleanField") fun nvl2( initialExpression: UnaliasedExpression, valueIfExists: Boolean, - valueIfNotExists: CMField, + valueIfNotExists: CMJsonField, ) = nvl2(initialExpression, valueIfExists, valueIfNotExists.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/LogicalInfix.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/LogicalInfix.kt index b8fce4b3..daeb5859 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/LogicalInfix.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/LogicalInfix.kt @@ -6,24 +6,29 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.logical.or import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField -fun TypeExpression.or(boolean: CMField) = or(boolean.toDopeType()) +fun TypeExpression.or(boolean: CMJsonField) = or(boolean.toDopeType()) -fun CMField.or(booleanExpression: TypeExpression) = toDopeType().or(booleanExpression) +fun CMJsonField.or(booleanExpression: TypeExpression) = toDopeType().or(booleanExpression) -fun CMField.or(boolean: Boolean) = toDopeType().or(boolean.toDopeType()) +fun CMJsonField.or(boolean: Boolean) = toDopeType().or(boolean.toDopeType()) -fun CMField.or(boolean: CMField) = toDopeType().or(boolean.toDopeType()) +fun CMJsonField.or(boolean: CMJsonField) = toDopeType().or(boolean.toDopeType()) -fun Boolean.or(booleanExpression: CMField) = toDopeType().or(booleanExpression.toDopeType()) +fun Boolean.or(booleanExpression: CMJsonField) = toDopeType().or(booleanExpression.toDopeType()) -fun TypeExpression.and(boolean: CMField) = and(boolean.toDopeType()) +fun CMConverterField.or(boolean: Convertable) = toDopeType().or(boolean.toDopeType(this)) -fun CMField.and(booleanExpression: TypeExpression) = toDopeType().and(booleanExpression) +fun TypeExpression.and(boolean: CMJsonField) = and(boolean.toDopeType()) -fun CMField.and(boolean: Boolean) = toDopeType().and(boolean.toDopeType()) +fun CMJsonField.and(booleanExpression: TypeExpression) = toDopeType().and(booleanExpression) -fun CMField.and(boolean: CMField) = toDopeType().and(boolean.toDopeType()) +fun CMJsonField.and(boolean: Boolean) = toDopeType().and(boolean.toDopeType()) -fun Boolean.and(booleanExpression: CMField) = toDopeType().and(booleanExpression.toDopeType()) +fun CMJsonField.and(boolean: CMJsonField) = toDopeType().and(boolean.toDopeType()) + +fun Boolean.and(booleanExpression: CMJsonField) = toDopeType().and(booleanExpression.toDopeType()) + +fun CMConverterField.and(boolean: Convertable) = toDopeType().and(boolean.toDopeType(this)) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/Not.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/Not.kt index 140883f3..f2786fc8 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/Not.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/logical/Not.kt @@ -2,6 +2,6 @@ package ch.ergon.dope.extension.type.logical import ch.ergon.dope.resolvable.expression.unaliased.type.logical.not import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun not(boolean: CMField) = not(boolean.toDopeType()) +fun not(boolean: CMJsonField) = not(boolean.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Absolute.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Absolute.kt index c46a4699..17236708 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Absolute.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Absolute.kt @@ -2,6 +2,6 @@ package ch.ergon.dope.extension.type.numberfunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.abs import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun abs(field: CMField) = abs(field.toDopeType()) +fun abs(field: CMJsonField) = abs(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/LogarithmicExponentFunctions.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/LogarithmicExponentFunctions.kt index 36bb16a0..d78f827c 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/LogarithmicExponentFunctions.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/LogarithmicExponentFunctions.kt @@ -8,22 +8,22 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.power import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.sqrt import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun exp(field: CMField) = exp(field.toDopeType()) +fun exp(field: CMJsonField) = exp(field.toDopeType()) -fun log(field: CMField) = log(field.toDopeType()) +fun log(field: CMJsonField) = log(field.toDopeType()) -fun ln(field: CMField) = ln(field.toDopeType()) +fun ln(field: CMJsonField) = ln(field.toDopeType()) -fun power(base: CMField, exponent: CMField) = power(base.toDopeType(), exponent.toDopeType()) +fun power(base: CMJsonField, exponent: CMJsonField) = power(base.toDopeType(), exponent.toDopeType()) -fun power(base: CMField, exponent: TypeExpression) = power(base.toDopeType(), exponent) +fun power(base: CMJsonField, exponent: TypeExpression) = power(base.toDopeType(), exponent) -fun power(base: CMField, exponent: Number) = power(base.toDopeType(), exponent) +fun power(base: CMJsonField, exponent: Number) = power(base.toDopeType(), exponent) -fun power(base: TypeExpression, exponent: CMField) = power(base, exponent.toDopeType()) +fun power(base: TypeExpression, exponent: CMJsonField) = power(base, exponent.toDopeType()) -fun power(base: Number, exponent: CMField) = power(base, exponent.toDopeType()) +fun power(base: Number, exponent: CMJsonField) = power(base, exponent.toDopeType()) -fun sqrt(field: CMField) = sqrt(field.toDopeType()) +fun sqrt(field: CMJsonField) = sqrt(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Random.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Random.kt index a52eed42..49412274 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Random.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Random.kt @@ -2,6 +2,6 @@ package ch.ergon.dope.extension.type.numberfunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.random import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun random(field: CMField) = random(field.toDopeType()) +fun random(field: CMJsonField) = random(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/RoundingFunctions.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/RoundingFunctions.kt index d35fc021..3841947e 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/RoundingFunctions.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/RoundingFunctions.kt @@ -7,32 +7,32 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.round import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.trunc import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun ceil(field: CMField) = ceil(field.toDopeType()) +fun ceil(field: CMJsonField) = ceil(field.toDopeType()) -fun floor(field: CMField) = floor(field.toDopeType()) +fun floor(field: CMJsonField) = floor(field.toDopeType()) -fun round(field: CMField) = round(field.toDopeType()) +fun round(field: CMJsonField) = round(field.toDopeType()) -fun round(field: CMField, digits: CMField) = round(field.toDopeType(), digits.toDopeType()) +fun round(field: CMJsonField, digits: CMJsonField) = round(field.toDopeType(), digits.toDopeType()) -fun round(field: CMField, digits: TypeExpression) = round(field.toDopeType(), digits) +fun round(field: CMJsonField, digits: TypeExpression) = round(field.toDopeType(), digits) -fun round(field: CMField, digits: Number) = round(field.toDopeType(), digits) +fun round(field: CMJsonField, digits: Number) = round(field.toDopeType(), digits) -fun round(value: TypeExpression, digits: CMField) = round(value, digits.toDopeType()) +fun round(value: TypeExpression, digits: CMJsonField) = round(value, digits.toDopeType()) -fun round(value: Number, digits: CMField) = round(value, digits.toDopeType()) +fun round(value: Number, digits: CMJsonField) = round(value, digits.toDopeType()) -fun trunc(field: CMField) = trunc(field.toDopeType()) +fun trunc(field: CMJsonField) = trunc(field.toDopeType()) -fun trunc(field: CMField, digits: CMField) = trunc(field.toDopeType(), digits.toDopeType()) +fun trunc(field: CMJsonField, digits: CMJsonField) = trunc(field.toDopeType(), digits.toDopeType()) -fun trunc(field: CMField, digits: TypeExpression) = trunc(field.toDopeType(), digits) +fun trunc(field: CMJsonField, digits: TypeExpression) = trunc(field.toDopeType(), digits) -fun trunc(field: CMField, digits: Number) = trunc(field.toDopeType(), digits) +fun trunc(field: CMJsonField, digits: Number) = trunc(field.toDopeType(), digits) -fun trunc(value: TypeExpression, digits: CMField) = trunc(value, digits.toDopeType()) +fun trunc(value: TypeExpression, digits: CMJsonField) = trunc(value, digits.toDopeType()) -fun trunc(value: Number, digits: CMField) = trunc(value, digits.toDopeType()) +fun trunc(value: Number, digits: CMJsonField) = trunc(value, digits.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Sign.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Sign.kt index 9236828f..dfbe41d6 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Sign.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/Sign.kt @@ -2,6 +2,6 @@ package ch.ergon.dope.extension.type.numberfunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.sign import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun sign(field: CMField) = sign(field.toDopeType()) +fun sign(field: CMJsonField) = sign(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/TrigonometryFunctions.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/TrigonometryFunctions.kt index 86e6ce83..543086ae 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/TrigonometryFunctions.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/numberfunction/TrigonometryFunctions.kt @@ -12,35 +12,35 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.sin import ch.ergon.dope.resolvable.expression.unaliased.type.function.numeric.tan import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun acos(field: CMField) = acos(field.toDopeType()) +fun acos(field: CMJsonField) = acos(field.toDopeType()) -fun asin(field: CMField) = asin(field.toDopeType()) +fun asin(field: CMJsonField) = asin(field.toDopeType()) -fun atan(field: CMField) = atan(field.toDopeType()) +fun atan(field: CMJsonField) = atan(field.toDopeType()) -fun atan2(divisor: CMField, dividend: CMField) = +fun atan2(divisor: CMJsonField, dividend: CMJsonField) = atan2(divisor.toDopeType(), dividend.toDopeType()) -fun atan2(divisor: CMField, dividend: TypeExpression) = +fun atan2(divisor: CMJsonField, dividend: TypeExpression) = atan2(divisor.toDopeType(), dividend) -fun atan2(divisor: CMField, dividend: Number) = +fun atan2(divisor: CMJsonField, dividend: Number) = atan2(divisor.toDopeType(), dividend) -fun atan2(divisor: TypeExpression, dividend: CMField) = +fun atan2(divisor: TypeExpression, dividend: CMJsonField) = atan2(divisor, dividend.toDopeType()) -fun atan2(divisor: Number, dividend: CMField) = +fun atan2(divisor: Number, dividend: CMJsonField) = atan2(divisor, dividend.toDopeType()) -fun cos(field: CMField) = cos(field.toDopeType()) +fun cos(field: CMJsonField) = cos(field.toDopeType()) -fun degrees(field: CMField) = degrees(field.toDopeType()) +fun degrees(field: CMJsonField) = degrees(field.toDopeType()) -fun radians(field: CMField) = radians(field.toDopeType()) +fun radians(field: CMJsonField) = radians(field.toDopeType()) -fun sin(field: CMField) = sin(field.toDopeType()) +fun sin(field: CMJsonField) = sin(field.toDopeType()) -fun tan(field: CMField) = tan(field.toDopeType()) +fun tan(field: CMJsonField) = tan(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Between.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Between.kt index 4f9a02df..2a5f0d2d 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Between.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Between.kt @@ -8,116 +8,133 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.relational.notBetween import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("betweenNumber") -fun CMField.between(start: CMField, end: CMField): BetweenExpression = +fun CMJsonField.between(start: CMJsonField, end: CMJsonField): BetweenExpression = toDopeType().between(start.toDopeType(), end.toDopeType()) @JvmName("betweenNumber") -fun CMField.between(start: CMField, end: TypeExpression): BetweenExpression = +fun CMJsonField.between(start: CMJsonField, end: TypeExpression): BetweenExpression = toDopeType().between(start.toDopeType(), end) @JvmName("betweenNumber") -fun CMField.between(start: TypeExpression, end: CMField): BetweenExpression = +fun CMJsonField.between(start: TypeExpression, end: CMJsonField): BetweenExpression = toDopeType().between(start, end.toDopeType()) @JvmName("betweenNumber") -fun CMField.between(start: TypeExpression, end: TypeExpression): BetweenExpression = +fun CMJsonField.between(start: TypeExpression, end: TypeExpression): BetweenExpression = toDopeType().between(start, end) @JvmName("betweenNumber") -fun TypeExpression.between(start: CMField, end: CMField): BetweenExpression = - this.between(start.toDopeType(), end.toDopeType()) +fun TypeExpression.between(start: CMJsonField, end: CMJsonField): BetweenExpression = + between(start.toDopeType(), end.toDopeType()) @JvmName("betweenNumber") -fun TypeExpression.between(start: CMField, end: TypeExpression): BetweenExpression = - this.between(start.toDopeType(), end) +fun TypeExpression.between(start: CMJsonField, end: TypeExpression): BetweenExpression = + between(start.toDopeType(), end) @JvmName("betweenNumber") -fun TypeExpression.between(start: TypeExpression, end: CMField): BetweenExpression = - this.between(start, end.toDopeType()) +fun TypeExpression.between(start: TypeExpression, end: CMJsonField): BetweenExpression = + between(start, end.toDopeType()) + +@JvmName("betweenNumber") +fun CMConverterField.between(start: Convertable, end: Convertable): + BetweenExpression = toDopeType().between(toDopeType(start), toDopeType(end)) @JvmName("betweenString") -fun CMField.between(start: CMField, end: CMField): BetweenExpression = +fun CMJsonField.between(start: CMJsonField, end: CMJsonField): BetweenExpression = toDopeType().between(start.toDopeType(), end.toDopeType()) @JvmName("betweenString") -fun CMField.between(start: CMField, end: TypeExpression): BetweenExpression = +fun CMJsonField.between(start: CMJsonField, end: TypeExpression): BetweenExpression = toDopeType().between(start.toDopeType(), end) @JvmName("betweenString") -fun CMField.between(start: TypeExpression, end: CMField): BetweenExpression = +fun CMJsonField.between(start: TypeExpression, end: CMJsonField): BetweenExpression = toDopeType().between(start, end.toDopeType()) @JvmName("betweenString") -fun CMField.between(start: TypeExpression, end: TypeExpression): BetweenExpression = +fun CMJsonField.between(start: TypeExpression, end: TypeExpression): BetweenExpression = toDopeType().between(start, end) @JvmName("betweenString") -fun TypeExpression.between(start: CMField, end: CMField): BetweenExpression = - this.between(start.toDopeType(), end.toDopeType()) +fun TypeExpression.between(start: CMJsonField, end: CMJsonField): BetweenExpression = + between(start.toDopeType(), end.toDopeType()) @JvmName("betweenString") -fun TypeExpression.between(start: CMField, end: TypeExpression): BetweenExpression = - this.between(start.toDopeType(), end) +fun TypeExpression.between(start: CMJsonField, end: TypeExpression): BetweenExpression = + between(start.toDopeType(), end) @JvmName("betweenString") -fun TypeExpression.between(start: TypeExpression, end: CMField): BetweenExpression = - this.between(start, end.toDopeType()) +fun TypeExpression.between(start: TypeExpression, end: CMJsonField): BetweenExpression = + between(start, end.toDopeType()) -@JvmName("betweenNumber") -fun CMField.notBetween(start: CMField, end: CMField): NotBetweenExpression = +@JvmName("betweenString") +fun CMConverterField.between(start: Convertable, end: Convertable): BetweenExpression = + toDopeType().between(toDopeType(start), toDopeType(end)) + +@JvmName("notBetweenNumber") +fun CMJsonField.notBetween(start: CMJsonField, end: CMJsonField): NotBetweenExpression = toDopeType().notBetween(start.toDopeType(), end.toDopeType()) -@JvmName("betweenNumber") -fun CMField.notBetween(start: CMField, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun CMJsonField.notBetween(start: CMJsonField, end: TypeExpression): NotBetweenExpression = toDopeType().notBetween(start.toDopeType(), end) -@JvmName("betweenNumber") -fun CMField.notBetween(start: TypeExpression, end: CMField): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun CMJsonField.notBetween(start: TypeExpression, end: CMJsonField): NotBetweenExpression = toDopeType().notBetween(start, end.toDopeType()) -@JvmName("betweenNumber") -fun CMField.notBetween(start: TypeExpression, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun CMJsonField.notBetween(start: TypeExpression, end: TypeExpression): NotBetweenExpression = toDopeType().notBetween(start, end) -@JvmName("betweenNumber") -fun TypeExpression.notBetween(start: CMField, end: CMField): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun TypeExpression.notBetween(start: CMJsonField, end: CMJsonField): NotBetweenExpression = this.notBetween(start.toDopeType(), end.toDopeType()) -@JvmName("betweenNumber") -fun TypeExpression.notBetween(start: CMField, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun TypeExpression.notBetween(start: CMJsonField, end: TypeExpression): NotBetweenExpression = this.notBetween(start.toDopeType(), end) -@JvmName("betweenNumber") -fun TypeExpression.notBetween(start: TypeExpression, end: CMField): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun TypeExpression.notBetween(start: TypeExpression, end: CMJsonField): NotBetweenExpression = this.notBetween(start, end.toDopeType()) -@JvmName("betweenString") -fun CMField.notBetween(start: CMField, end: CMField): NotBetweenExpression = +@JvmName("notBetweenNumber") +fun CMConverterField.notBetween(start: Convertable, end: Convertable): + NotBetweenExpression = toDopeType().notBetween(toDopeType(start), toDopeType(end)) + +@JvmName("notBetweenString") +fun CMJsonField.notBetween(start: CMJsonField, end: CMJsonField): NotBetweenExpression = toDopeType().notBetween(start.toDopeType(), end.toDopeType()) -@JvmName("betweenString") -fun CMField.notBetween(start: CMField, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenString") +fun CMJsonField.notBetween(start: CMJsonField, end: TypeExpression): NotBetweenExpression = toDopeType().notBetween(start.toDopeType(), end) -@JvmName("betweenString") -fun CMField.notBetween(start: TypeExpression, end: CMField): NotBetweenExpression = +@JvmName("notBetweenString") +fun CMJsonField.notBetween(start: TypeExpression, end: CMJsonField): NotBetweenExpression = toDopeType().notBetween(start, end.toDopeType()) -@JvmName("betweenString") -fun CMField.notBetween(start: TypeExpression, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenString") +fun CMJsonField.notBetween(start: TypeExpression, end: TypeExpression): NotBetweenExpression = toDopeType().notBetween(start, end) -@JvmName("betweenString") -fun TypeExpression.notBetween(start: CMField, end: CMField): NotBetweenExpression = +@JvmName("notBetweenString") +fun TypeExpression.notBetween(start: CMJsonField, end: CMJsonField): NotBetweenExpression = this.notBetween(start.toDopeType(), end.toDopeType()) -@JvmName("betweenString") -fun TypeExpression.notBetween(start: CMField, end: TypeExpression): NotBetweenExpression = +@JvmName("notBetweenString") +fun TypeExpression.notBetween(start: CMJsonField, end: TypeExpression): NotBetweenExpression = this.notBetween(start.toDopeType(), end) -@JvmName("betweenString") -fun TypeExpression.notBetween(start: TypeExpression, end: CMField): NotBetweenExpression = +@JvmName("notBetweenString") +fun TypeExpression.notBetween(start: TypeExpression, end: CMJsonField): NotBetweenExpression = this.notBetween(start, end.toDopeType()) + +@JvmName("notBetweenString") +fun CMConverterField.notBetween(start: Convertable, end: Convertable): + NotBetweenExpression = toDopeType().notBetween(toDopeType(start), toDopeType(end)) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Equals.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Equals.kt index 446fa921..25cad23b 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Equals.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Equals.kt @@ -10,124 +10,149 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isEqualToNumber") -fun CMField.isEqualTo(right: Number): EqualsExpression = +fun CMJsonField.isEqualTo(right: Number): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToNumber") -fun Number.isEqualTo(right: CMField): EqualsExpression = +fun Number.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToNumber") -fun CMField.isEqualTo(right: CMField): EqualsExpression = +fun CMJsonField.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToNumber") -fun TypeExpression.isEqualTo(right: CMField): EqualsExpression = +fun TypeExpression.isEqualTo(right: CMJsonField): EqualsExpression = isEqualTo(right.toDopeType()) @JvmName("isEqualToNumber") -fun CMField.isEqualTo(right: TypeExpression): EqualsExpression = +fun CMJsonField.isEqualTo(right: TypeExpression): EqualsExpression = toDopeType().isEqualTo(right) +@JvmName("isEqualToNumberConverter") +fun CMConverterField.isEqualTo(other: Convertable): EqualsExpression = + toDopeType().isEqualTo(toDopeType(other)) + +@JvmName("isEqualToNumberConverter") +fun Convertable.isEqualTo(other: CMConverterField): EqualsExpression = + toDopeType(other).isEqualTo(other.toDopeType()) + @JvmName("isEqualToString") -fun CMField.isEqualTo(right: String): EqualsExpression = +fun CMJsonField.isEqualTo(right: String): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToString") -fun String.isEqualTo(right: CMField): EqualsExpression = +fun String.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToString") -fun CMField.isEqualTo(right: CMField): EqualsExpression = +fun CMJsonField.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToString") -fun TypeExpression.isEqualTo(right: CMField): EqualsExpression = +fun TypeExpression.isEqualTo(right: CMJsonField): EqualsExpression = isEqualTo(right.toDopeType()) @JvmName("isEqualToString") -fun CMField.isEqualTo(right: TypeExpression): EqualsExpression = +fun CMJsonField.isEqualTo(right: TypeExpression): EqualsExpression = toDopeType().isEqualTo(right) +@JvmName("isEqualToStringConverter") +fun CMConverterField.isEqualTo(other: JsonType): EqualsExpression = + toDopeType().isEqualTo(toDopeType(other)) + +@JvmName("isEqualToStringConverter") +fun Convertable.isEqualTo(other: CMConverterField): EqualsExpression = + toDopeType(other).isEqualTo(other.toDopeType()) + @JvmName("isEqualToBoolean") -fun CMField.isEqualTo(right: Boolean): EqualsExpression = +fun CMJsonField.isEqualTo(right: Boolean): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToBoolean") -fun Boolean.isEqualTo(right: CMField): EqualsExpression = +fun Boolean.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToBoolean") -fun CMField.isEqualTo(right: CMField): EqualsExpression = +fun CMJsonField.isEqualTo(right: CMJsonField): EqualsExpression = toDopeType().isEqualTo(right.toDopeType()) @JvmName("isEqualToBoolean") -fun TypeExpression.isEqualTo(right: CMField): EqualsExpression = +fun TypeExpression.isEqualTo(right: CMJsonField): EqualsExpression = isEqualTo(right.toDopeType()) @JvmName("isEqualToBoolean") -fun CMField.isEqualTo(right: TypeExpression): EqualsExpression = +fun CMJsonField.isEqualTo(right: TypeExpression): EqualsExpression = toDopeType().isEqualTo(right) +@JvmName("isEqualToBooleanConverter") +fun CMConverterField.isEqualTo(other: JsonType): EqualsExpression = + toDopeType().isEqualTo(toDopeType(other)) + +@JvmName("isEqualToBooleanConverter") +fun Convertable.isEqualTo(other: CMConverterField): EqualsExpression = + toDopeType(other).isEqualTo(other.toDopeType()) + @JvmName("isNotEqualToNumber") -fun CMField.isNotEqualTo(right: Number): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: Number): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToNumber") -fun Number.isNotEqualTo(right: CMField): NotEqualsExpression = +fun Number.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToNumber") -fun CMField.isNotEqualTo(right: CMField): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToNumber") -fun TypeExpression.isNotEqualTo(right: CMField): NotEqualsExpression = +fun TypeExpression.isNotEqualTo(right: CMJsonField): NotEqualsExpression = isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToNumber") -fun CMField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = toDopeType().isNotEqualTo(right) @JvmName("isNotEqualToString") -fun CMField.isNotEqualTo(right: String): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: String): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToString") -fun String.isNotEqualTo(right: CMField): NotEqualsExpression = +fun String.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToString") -fun CMField.isNotEqualTo(right: CMField): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToString") -fun TypeExpression.isNotEqualTo(right: CMField): NotEqualsExpression = +fun TypeExpression.isNotEqualTo(right: CMJsonField): NotEqualsExpression = isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToString") -fun CMField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = toDopeType().isNotEqualTo(right) @JvmName("isNotEqualToBoolean") -fun CMField.isNotEqualTo(right: Boolean): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: Boolean): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToBoolean") -fun Boolean.isNotEqualTo(right: CMField): NotEqualsExpression = +fun Boolean.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToBoolean") -fun CMField.isNotEqualTo(right: CMField): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: CMJsonField): NotEqualsExpression = toDopeType().isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToBoolean") -fun TypeExpression.isNotEqualTo(right: CMField): NotEqualsExpression = +fun TypeExpression.isNotEqualTo(right: CMJsonField): NotEqualsExpression = isNotEqualTo(right.toDopeType()) @JvmName("isNotEqualToBoolean") -fun CMField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = +fun CMJsonField.isNotEqualTo(right: TypeExpression): NotEqualsExpression = toDopeType().isNotEqualTo(right) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Exists.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Exists.kt index bf946601..591f190a 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Exists.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Exists.kt @@ -6,13 +6,13 @@ import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("existsNumberArray") -fun exists(field: CMList): ExistsExpression = exists(field.toDopeType()) +fun exists(field: CMJsonList): ExistsExpression = exists(field.toDopeType()) @JvmName("existsStringArray") -fun exists(field: CMList): ExistsExpression = exists(field.toDopeType()) +fun exists(field: CMJsonList): ExistsExpression = exists(field.toDopeType()) @JvmName("existsExistsArray") -fun exists(field: CMList): ExistsExpression = exists(field.toDopeType()) +fun exists(field: CMJsonList): ExistsExpression = exists(field.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterOrEqualThan.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterOrEqualThan.kt index 5d0bebf4..5b1ba8be 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterOrEqualThan.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterOrEqualThan.kt @@ -7,44 +7,61 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isGreaterOrEqualThanNumber") -fun CMField.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanNumber") -fun TypeExpression.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun TypeExpression.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanNumber") -fun Number.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun Number.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanNumber") -fun CMField.isGreaterOrEqualThan(right: TypeExpression): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: TypeExpression): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right) @JvmName("isGreaterOrEqualThanNumber") -fun CMField.isGreaterOrEqualThan(right: Number): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: Number): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) +@JvmName("isGreaterOrEqualThanNumberConverter") +fun CMConverterField.isGreaterOrEqualThan(other: Convertable): + GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(toDopeType(other)) + +@JvmName("isGreaterOrEqualThanNumberConverter") +fun Convertable.isGreaterOrEqualThan(other: CMConverterField): + GreaterOrEqualThanExpression = toDopeType(other).isGreaterOrEqualThan(other.toDopeType()) + @JvmName("isGreaterOrEqualThanString") -fun CMField.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanString") -fun TypeExpression.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun TypeExpression.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanString") -fun String.isGreaterOrEqualThan(right: CMField): GreaterOrEqualThanExpression = +fun String.isGreaterOrEqualThan(right: CMJsonField): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) @JvmName("isGreaterOrEqualThanString") -fun CMField.isGreaterOrEqualThan(right: TypeExpression): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: TypeExpression): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right) @JvmName("isGreaterOrEqualThanString") -fun CMField.isGreaterOrEqualThan(right: String): GreaterOrEqualThanExpression = +fun CMJsonField.isGreaterOrEqualThan(right: String): GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(right.toDopeType()) + +@JvmName("isGreaterOrEqualThanStringConverter") +fun CMConverterField.isGreaterOrEqualThan(other: Convertable): + GreaterOrEqualThanExpression = toDopeType().isGreaterOrEqualThan(toDopeType(other)) + +@JvmName("isGreaterOrEqualThanStringConverter") +fun Convertable.isGreaterOrEqualThan(other: CMConverterField): + GreaterOrEqualThanExpression = toDopeType(other).isGreaterOrEqualThan(other.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterThan.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterThan.kt index 6c6aba35..b30bed2a 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterThan.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/GreaterThan.kt @@ -7,44 +7,61 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isGreaterThanNumber") -fun CMField.isGreaterThan(right: CMField): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: CMJsonField): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanNumber") -fun TypeExpression.isGreaterThan(right: CMField): GreaterThanExpression = +fun TypeExpression.isGreaterThan(right: CMJsonField): GreaterThanExpression = isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanNumber") -fun Number.isGreaterThan(right: CMField): GreaterThanExpression = +fun Number.isGreaterThan(right: CMJsonField): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanNumber") -fun CMField.isGreaterThan(right: TypeExpression): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: TypeExpression): GreaterThanExpression = toDopeType().isGreaterThan(right) @JvmName("isGreaterThanNumber") -fun CMField.isGreaterThan(right: Number): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: Number): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) +@JvmName("isGreaterThanNumberConverter") +fun CMConverterField.isGreaterThan(other: Convertable): + GreaterThanExpression = toDopeType().isGreaterThan(toDopeType(other)) + +@JvmName("isGreaterThanNumberConverter") +fun Convertable.isGreaterThan(other: CMConverterField): + GreaterThanExpression = toDopeType(other).isGreaterThan(other.toDopeType()) + @JvmName("isGreaterThanString") -fun CMField.isGreaterThan(right: CMField): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: CMJsonField): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanString") -fun TypeExpression.isGreaterThan(right: CMField): GreaterThanExpression = +fun TypeExpression.isGreaterThan(right: CMJsonField): GreaterThanExpression = isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanString") -fun String.isGreaterThan(right: CMField): GreaterThanExpression = +fun String.isGreaterThan(right: CMJsonField): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) @JvmName("isGreaterThanString") -fun CMField.isGreaterThan(right: TypeExpression): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: TypeExpression): GreaterThanExpression = toDopeType().isGreaterThan(right) @JvmName("isGreaterThanString") -fun CMField.isGreaterThan(right: String): GreaterThanExpression = +fun CMJsonField.isGreaterThan(right: String): GreaterThanExpression = toDopeType().isGreaterThan(right.toDopeType()) + +@JvmName("isGreaterThanStringConverter") +fun CMConverterField.isGreaterThan(other: JsonType): GreaterThanExpression = + toDopeType().isGreaterThan(toDopeType(other)) + +@JvmName("isGreaterThanStringConverter") +fun Convertable.isGreaterThan(other: CMConverterField): GreaterThanExpression = + toDopeType(other).isGreaterThan(other.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Greatest.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Greatest.kt index 8327676b..c0260b36 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Greatest.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Greatest.kt @@ -2,13 +2,13 @@ package ch.ergon.dope.extension.type.relational import ch.ergon.dope.resolvable.expression.unaliased.type.function.comparison.greatestOf import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("greatestOfCMNumberField") fun greatestOf( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = greatestOf( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -17,9 +17,9 @@ fun greatestOf( @JvmName("greatestOfCMStringField") fun greatestOf( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = greatestOf( firstExpression.toDopeType(), secondExpression.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/In.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/In.kt index 2226d9b5..294ac5af 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/In.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/In.kt @@ -11,125 +11,151 @@ import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMConverterList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("inArrayNumber") -fun CMField.inArray(array: TypeExpression>): InExpression = +fun CMJsonField.inArray(array: TypeExpression>): InExpression = toDopeType().inArray(array) @JvmName("inArrayString") -fun CMField.inArray(array: TypeExpression>): InExpression = +fun CMJsonField.inArray(array: TypeExpression>): InExpression = toDopeType().inArray(array) @JvmName("inArrayBoolean") -fun CMField.inArray(array: TypeExpression>): InExpression = +fun CMJsonField.inArray(array: TypeExpression>): InExpression = toDopeType().inArray(array) @JvmName("inArrayNumber") -fun TypeExpression.inArray(array: CMList): InExpression = - this.inArray(array.toDopeType()) +fun TypeExpression.inArray(array: CMJsonList): InExpression = + inArray(array.toDopeType()) @JvmName("inArrayString") -fun TypeExpression.inArray(array: CMList): InExpression = - this.inArray(array.toDopeType()) +fun TypeExpression.inArray(array: CMJsonList): InExpression = + inArray(array.toDopeType()) @JvmName("inArrayBoolean") -fun TypeExpression.inArray(array: CMList): InExpression = - this.inArray(array.toDopeType()) +fun TypeExpression.inArray(array: CMJsonList): InExpression = + inArray(array.toDopeType()) @JvmName("inArrayNumber") -fun CMField.inArray(array: CMList): InExpression = +fun CMJsonField.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayString") -fun CMField.inArray(array: CMList): InExpression = +fun CMJsonField.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayBoolean") -fun CMField.inArray(array: CMList): InExpression = +fun CMJsonField.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayNumber") -fun CMField.inArray(array: Collection>): InExpression = +fun CMJsonField.inArray(array: Collection>): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayString") -fun CMField.inArray(array: Collection>): InExpression = +fun CMJsonField.inArray(array: Collection>): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayBoolean") -fun CMField.inArray(array: Collection>): InExpression = +fun CMJsonField.inArray(array: Collection>): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayNumber") -fun Number.inArray(array: CMList): InExpression = +fun Number.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayString") -fun String.inArray(array: CMList): InExpression = +fun String.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) @JvmName("inArrayBoolean") -fun Boolean.inArray(array: CMList): InExpression = +fun Boolean.inArray(array: CMJsonList): InExpression = toDopeType().inArray(array.toDopeType()) +@JvmName("inArrayNumberConverter") +fun Convertable.inArray(array: CMConverterList): InExpression = + toDopeType(array).inArray(array.toDopeType()) + +@JvmName("inArrayStringConverter") +fun Convertable.inArray(array: CMConverterList): InExpression = + toDopeType(array).inArray(array.toDopeType()) + +@JvmName("inArrayBooleanConverter") +fun Convertable.inArray(array: CMConverterList): InExpression = + toDopeType(array).inArray(array.toDopeType()) + +@JvmName("inArrayNumberConverter") +fun CMConverterField.inArray(array: Collection): + InExpression = toDopeType().inArray(array.map { it.toDopeType(this) }.toDopeType()) + +@JvmName("inArrayStringConverter") +fun CMConverterField.inArray(array: Collection): InExpression = + toDopeType().inArray(array.map { it.toDopeType(this) }.toDopeType()) + +@JvmName("inArrayBooleanConverter") +fun CMConverterField.inArray(array: Collection): InExpression = + toDopeType().inArray(array.map { it.toDopeType(this) }.toDopeType()) + @JvmName("notInArrayNumber") -fun CMField.notInArray(array: TypeExpression>): NotInExpression = +fun CMJsonField.notInArray(array: TypeExpression>): NotInExpression = toDopeType().notInArray(array) @JvmName("notInArrayString") -fun CMField.notInArray(array: TypeExpression>): NotInExpression = +fun CMJsonField.notInArray(array: TypeExpression>): NotInExpression = toDopeType().notInArray(array) @JvmName("notInArrayBoolean") -fun CMField.notInArray(array: TypeExpression>): NotInExpression = +fun CMJsonField.notInArray(array: TypeExpression>): NotInExpression = toDopeType().notInArray(array) @JvmName("notInArrayNumber") -fun TypeExpression.notInArray(array: CMList): NotInExpression = +fun TypeExpression.notInArray(array: CMJsonList): NotInExpression = this.notInArray(array.toDopeType()) @JvmName("notInArrayString") -fun TypeExpression.notInArray(array: CMList): NotInExpression = +fun TypeExpression.notInArray(array: CMJsonList): NotInExpression = this.notInArray(array.toDopeType()) @JvmName("notInArrayBoolean") -fun TypeExpression.notInArray(array: CMList): NotInExpression = +fun TypeExpression.notInArray(array: CMJsonList): NotInExpression = this.notInArray(array.toDopeType()) @JvmName("notInArrayNumber") -fun CMField.notInArray(array: CMList): NotInExpression = +fun CMJsonField.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayString") -fun CMField.notInArray(array: CMList): NotInExpression = +fun CMJsonField.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayBoolean") -fun CMField.notInArray(array: CMList): NotInExpression = +fun CMJsonField.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayNumber") -fun CMField.notInArray(array: Collection>): NotInExpression = +fun CMJsonField.notInArray(array: Collection>): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayString") -fun CMField.notInArray(array: Collection>): NotInExpression = +fun CMJsonField.notInArray(array: Collection>): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayBoolean") -fun CMField.notInArray(array: Collection>): NotInExpression = +fun CMJsonField.notInArray(array: Collection>): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayNumber") -fun Number.notInArray(array: CMList): NotInExpression = +fun Number.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayString") -fun String.notInArray(array: CMList): NotInExpression = +fun String.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) @JvmName("notInArrayBoolean") -fun Boolean.notInArray(array: CMList): NotInExpression = +fun Boolean.notInArray(array: CMJsonList): NotInExpression = toDopeType().notInArray(array.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsMissing.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsMissing.kt index 4528bb0f..6b0dcb9d 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsMissing.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsMissing.kt @@ -3,22 +3,22 @@ package ch.ergon.dope.extension.type.relational import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isMissing import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isNotMissing import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isMissingNumber") -fun CMField.isMissing() = toDopeType().isMissing() +fun CMJsonField.isMissing() = toDopeType().isMissing() @JvmName("isMissingString") -fun CMField.isMissing() = toDopeType().isMissing() +fun CMJsonField.isMissing() = toDopeType().isMissing() @JvmName("isMissingBoolean") -fun CMField.isMissing() = toDopeType().isMissing() +fun CMJsonField.isMissing() = toDopeType().isMissing() @JvmName("isNotMissingNumber") -fun CMField.isNotMissing() = toDopeType().isNotMissing() +fun CMJsonField.isNotMissing() = toDopeType().isNotMissing() @JvmName("isNotMissingString") -fun CMField.isNotMissing() = toDopeType().isNotMissing() +fun CMJsonField.isNotMissing() = toDopeType().isNotMissing() @JvmName("isNotMissingBoolean") -fun CMField.isNotMissing() = toDopeType().isNotMissing() +fun CMJsonField.isNotMissing() = toDopeType().isNotMissing() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsNull.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsNull.kt index 8d69bf4d..7ae1097f 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsNull.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsNull.kt @@ -3,22 +3,22 @@ package ch.ergon.dope.extension.type.relational import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isNotNull import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isNull import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isNullNumber") -fun CMField.isNull() = toDopeType().isNull() +fun CMJsonField.isNull() = toDopeType().isNull() @JvmName("isNullString") -fun CMField.isNull() = toDopeType().isNull() +fun CMJsonField.isNull() = toDopeType().isNull() @JvmName("isNullBoolean") -fun CMField.isNull() = toDopeType().isNull() +fun CMJsonField.isNull() = toDopeType().isNull() @JvmName("isNotNullNumber") -fun CMField.isNotNull() = toDopeType().isNotNull() +fun CMJsonField.isNotNull() = toDopeType().isNotNull() @JvmName("isNotNullString") -fun CMField.isNotNull() = toDopeType().isNotNull() +fun CMJsonField.isNotNull() = toDopeType().isNotNull() @JvmName("isNotNullBoolean") -fun CMField.isNotNull() = toDopeType().isNotNull() +fun CMJsonField.isNotNull() = toDopeType().isNotNull() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsValued.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsValued.kt index 792494e1..a9cdf8b6 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsValued.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/IsValued.kt @@ -3,22 +3,22 @@ package ch.ergon.dope.extension.type.relational import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isNotValued import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isValued import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isValuedNumber") -fun CMField.isValued() = toDopeType().isValued() +fun CMJsonField.isValued() = toDopeType().isValued() @JvmName("isValuedString") -fun CMField.isValued() = toDopeType().isValued() +fun CMJsonField.isValued() = toDopeType().isValued() @JvmName("isValuedBoolean") -fun CMField.isValued() = toDopeType().isValued() +fun CMJsonField.isValued() = toDopeType().isValued() @JvmName("isNotValuedNumber") -fun CMField.isNotValued() = toDopeType().isNotValued() +fun CMJsonField.isNotValued() = toDopeType().isNotValued() @JvmName("isNotValuedString") -fun CMField.isNotValued() = toDopeType().isNotValued() +fun CMJsonField.isNotValued() = toDopeType().isNotValued() @JvmName("isNotValuedBoolean") -fun CMField.isNotValued() = toDopeType().isNotValued() +fun CMJsonField.isNotValued() = toDopeType().isNotValued() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Least.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Least.kt index cc88be66..a7359346 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Least.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Least.kt @@ -2,13 +2,13 @@ package ch.ergon.dope.extension.type.relational import ch.ergon.dope.resolvable.expression.unaliased.type.function.comparison.leastOf import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("leastOfCMNumberField") fun leastOf( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = leastOf( firstExpression.toDopeType(), secondExpression.toDopeType(), @@ -17,9 +17,9 @@ fun leastOf( @JvmName("leastOfCMStringField") fun leastOf( - firstExpression: CMField, - secondExpression: CMField, - vararg additionalExpressions: CMField, + firstExpression: CMJsonField, + secondExpression: CMJsonField, + vararg additionalExpressions: CMJsonField, ) = leastOf( firstExpression.toDopeType(), secondExpression.toDopeType(), diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessOrEqualThan.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessOrEqualThan.kt index 20197520..99a99606 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessOrEqualThan.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessOrEqualThan.kt @@ -7,44 +7,61 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isLessOrEqualThanNumber") -fun CMField.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanNumber") -fun TypeExpression.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun TypeExpression.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanNumber") -fun Number.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun Number.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanNumber") -fun CMField.isLessOrEqualThan(right: TypeExpression): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: TypeExpression): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right) @JvmName("isLessOrEqualThanNumber") -fun CMField.isLessOrEqualThan(right: Number): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: Number): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) +@JvmName("isLessOrEqualThanNumberConverter") +fun CMConverterField.isLessOrEqualThan(other: Convertable): + LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(toDopeType(other)) + +@JvmName("isLessOrEqualThanNumberConverter") +fun Convertable.isLessOrEqualThan(other: CMConverterField): + LessOrEqualThanExpression = toDopeType(other).isLessOrEqualThan(other.toDopeType()) + @JvmName("isLessOrEqualThanString") -fun CMField.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanString") -fun TypeExpression.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun TypeExpression.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanString") -fun String.isLessOrEqualThan(right: CMField): LessOrEqualThanExpression = +fun String.isLessOrEqualThan(right: CMJsonField): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) @JvmName("isLessOrEqualThanString") -fun CMField.isLessOrEqualThan(right: TypeExpression): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: TypeExpression): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right) @JvmName("isLessOrEqualThanString") -fun CMField.isLessOrEqualThan(right: String): LessOrEqualThanExpression = +fun CMJsonField.isLessOrEqualThan(right: String): LessOrEqualThanExpression = toDopeType().isLessOrEqualThan(right.toDopeType()) + +@JvmName("isLessOrEqualThanStringConverter") +fun CMConverterField.isLessOrEqualThan(other: JsonType): LessOrEqualThanExpression = + toDopeType().isLessOrEqualThan(toDopeType(other)) + +@JvmName("isLessOrEqualThanStringConverter") +fun Convertable.isLessOrEqualThan(other: CMConverterField): LessOrEqualThanExpression = + toDopeType(other).isLessOrEqualThan(other.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessThan.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessThan.kt index 8e67d5c2..b5314012 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessThan.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/LessThan.kt @@ -7,44 +7,61 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("isLessThanNumber") -fun CMField.isLessThan(right: CMField): LessThanExpression = +fun CMJsonField.isLessThan(right: CMJsonField): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) @JvmName("isLessThanNumber") -fun TypeExpression.isLessThan(right: CMField): LessThanExpression = +fun TypeExpression.isLessThan(right: CMJsonField): LessThanExpression = isLessThan(right.toDopeType()) @JvmName("isLessThanNumber") -fun Number.isLessThan(right: CMField): LessThanExpression = +fun Number.isLessThan(right: CMJsonField): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) @JvmName("isLessThanNumber") -fun CMField.isLessThan(right: TypeExpression): LessThanExpression = +fun CMJsonField.isLessThan(right: TypeExpression): LessThanExpression = toDopeType().isLessThan(right) @JvmName("isLessThanNumber") -fun CMField.isLessThan(right: Number): LessThanExpression = +fun CMJsonField.isLessThan(right: Number): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) +@JvmName("isLessThanNumberConverter") +fun CMConverterField.isLessThan(other: Convertable): + LessThanExpression = toDopeType().isLessThan(toDopeType(other)) + +@JvmName("isLessThanNumberConverter") +fun Convertable.isLessThan(other: CMConverterField): + LessThanExpression = toDopeType(other).isLessThan(other.toDopeType()) + @JvmName("isLessThanString") -fun CMField.isLessThan(right: CMField): LessThanExpression = +fun CMJsonField.isLessThan(right: CMJsonField): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) @JvmName("isLessThanString") -fun TypeExpression.isLessThan(right: CMField): LessThanExpression = +fun TypeExpression.isLessThan(right: CMJsonField): LessThanExpression = isLessThan(right.toDopeType()) @JvmName("isLessThanString") -fun String.isLessThan(right: CMField): LessThanExpression = +fun String.isLessThan(right: CMJsonField): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) @JvmName("isLessThanString") -fun CMField.isLessThan(right: TypeExpression): LessThanExpression = +fun CMJsonField.isLessThan(right: TypeExpression): LessThanExpression = toDopeType().isLessThan(right) @JvmName("isLessThanString") -fun CMField.isLessThan(right: String): LessThanExpression = +fun CMJsonField.isLessThan(right: String): LessThanExpression = toDopeType().isLessThan(right.toDopeType()) + +@JvmName("isLessThanStringConverter") +fun CMConverterField.isLessThan(other: JsonType): LessThanExpression = + toDopeType().isLessThan(toDopeType(other)) + +@JvmName("isLessThanStringConverter") +fun Convertable.isLessThan(other: CMConverterField): LessThanExpression = + toDopeType(other).isLessThan(other.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Like.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Like.kt index be89f6ba..dff0b612 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Like.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Like.kt @@ -8,32 +8,32 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.StringType import ch.ergon.dope.validtype.ValidType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField -fun Field.isLike(right: CMField) = isLike(right.toDopeType()) +fun Field.isLike(right: CMJsonField) = isLike(right.toDopeType()) @JvmName("isLikeNumber") -fun CMField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) +fun CMJsonField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) @JvmName("isLikeString") -fun CMField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) +fun CMJsonField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) @JvmName("isLikeString") -fun CMField.isLike(right: TypeExpression) = toDopeType().isLike(right) +fun CMJsonField.isLike(right: TypeExpression) = toDopeType().isLike(right) @JvmName("isLikeBoolean") -fun CMField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) +fun CMJsonField.isLike(right: String) = toDopeType().isLike(right.toDopeType()) -fun Field.isNotLike(right: CMField) = isNotLike(right.toDopeType()) +fun Field.isNotLike(right: CMJsonField) = isNotLike(right.toDopeType()) @JvmName("isNotLikeNumber") -fun CMField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) +fun CMJsonField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) @JvmName("isNotLikeString") -fun CMField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) +fun CMJsonField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) @JvmName("isNotLikeString") -fun CMField.isNotLike(right: TypeExpression) = toDopeType().isNotLike(right) +fun CMJsonField.isNotLike(right: TypeExpression) = toDopeType().isNotLike(right) @JvmName("isNotLikeBoolean") -fun CMField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) +fun CMJsonField.isNotLike(right: String) = toDopeType().isNotLike(right.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/SatisfiesSchemaExpression.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/SatisfiesSchemaExpression.kt index 6e6cba13..dae57ac8 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/SatisfiesSchemaExpression.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/SatisfiesSchemaExpression.kt @@ -14,8 +14,8 @@ import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.DopeSchemaArray import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMObject import com.schwarz.crystalapi.schema.CMObjectList import com.schwarz.crystalapi.schema.CMType @@ -42,8 +42,8 @@ class SchemaIterator(val variable: String, val schema: S) { val schemaAttribute = schema.getCMType() val newPath = if (schemaAttribute.path.isBlank()) variable else "${schemaAttribute.path}`.`$variable" return when (schemaAttribute) { - is CMField<*> -> CMField(schemaAttribute.name, newPath) as A - is CMList<*> -> CMList(schemaAttribute.name, newPath) as A + is CMJsonField<*> -> CMJsonField(schemaAttribute.name, newPath) as A + is CMJsonList<*> -> CMJsonList(schemaAttribute.name, newPath) as A is CMObject<*> -> CMObject(schemaAttribute.element, newPath) as A is CMObjectList<*> -> CMObjectList(schemaAttribute.element, schemaAttribute.name, newPath) as A else -> error("Unsupported CMType: $schemaAttribute") @@ -74,19 +74,19 @@ fun CMObjectList.any( ) = AnySatisfiesSchemaExpression(iteratorName, toDopeType(), predicate) @JvmName("anyNumber") -fun CMList.any( +fun CMJsonList.any( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().any(iteratorName, predicate) @JvmName("anyString") -fun CMList.any( +fun CMJsonList.any( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().any(iteratorName, predicate) @JvmName("anyBoolean") -fun CMList.any( +fun CMJsonList.any( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().any(iteratorName, predicate) @@ -102,19 +102,19 @@ fun CMObjectList.every( ) = EverySatisfiesSchemaExpression(iteratorName, toDopeType(), predicate) @JvmName("everyNumber") -fun CMList.every( +fun CMJsonList.every( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().every(iteratorName, predicate) @JvmName("everyString") -fun CMList.every( +fun CMJsonList.every( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().every(iteratorName, predicate) @JvmName("everyBoolean") -fun CMList.every( +fun CMJsonList.every( iteratorName: String? = null, predicate: (Iterator) -> TypeExpression, ) = toDopeType().every(iteratorName, predicate) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Within.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Within.kt index 9c8e12cd..b2b92f33 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Within.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/relational/Within.kt @@ -11,125 +11,138 @@ import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMConverterList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("withinNumberArray") -fun CMField.withinArray(array: TypeExpression>): WithinExpression = +fun CMJsonField.withinArray(array: TypeExpression>): WithinExpression = toDopeType().withinArray(array) @JvmName("withinStringArray") -fun CMField.withinArray(array: TypeExpression>): WithinExpression = +fun CMJsonField.withinArray(array: TypeExpression>): WithinExpression = toDopeType().withinArray(array) @JvmName("withinBooleanArray") -fun CMField.withinArray(array: TypeExpression>): WithinExpression = +fun CMJsonField.withinArray(array: TypeExpression>): WithinExpression = toDopeType().withinArray(array) @JvmName("withinNumberArray") -fun TypeExpression.withinArray(array: CMList): WithinExpression = - this.withinArray(array.toDopeType()) +fun TypeExpression.withinArray(array: CMJsonList): WithinExpression = + withinArray(array.toDopeType()) @JvmName("withinStringArray") -fun TypeExpression.withinArray(array: CMList): WithinExpression = - this.withinArray(array.toDopeType()) +fun TypeExpression.withinArray(array: CMJsonList): WithinExpression = + withinArray(array.toDopeType()) @JvmName("withinBooleanArray") -fun TypeExpression.withinArray(array: CMList): WithinExpression = - this.withinArray(array.toDopeType()) +fun TypeExpression.withinArray(array: CMJsonList): WithinExpression = + withinArray(array.toDopeType()) @JvmName("withinNumberArray") -fun CMField.withinArray(array: CMList): WithinExpression = +fun CMJsonField.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinStringArray") -fun CMField.withinArray(array: CMList): WithinExpression = +fun CMJsonField.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinBooleanArray") -fun CMField.withinArray(array: CMList): WithinExpression = +fun CMJsonField.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinNumberArray") -fun CMField.withinArray(array: Collection>): WithinExpression = +fun CMJsonField.withinArray(array: Collection>): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinStringArray") -fun CMField.withinArray(array: Collection>): WithinExpression = +fun CMJsonField.withinArray(array: Collection>): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinBooleanArray") -fun CMField.withinArray(array: Collection>): WithinExpression = +fun CMJsonField.withinArray(array: Collection>): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinNumberArray") -fun Number.withinArray(array: CMList): WithinExpression = +fun Number.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinStringArray") -fun String.withinArray(array: CMList): WithinExpression = +fun String.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) @JvmName("withinBooleanArray") -fun Boolean.withinArray(array: CMList): WithinExpression = +fun Boolean.withinArray(array: CMJsonList): WithinExpression = toDopeType().withinArray(array.toDopeType()) +@JvmName("withinArrayNumberConverter") +fun Convertable.withinArray(array: CMConverterList): WithinExpression = + toDopeType(array).withinArray(array.toDopeType()) + +@JvmName("withinArrayStringConverter") +fun Convertable.withinArray(array: CMConverterList): WithinExpression = + toDopeType(array).withinArray(array.toDopeType()) + +@JvmName("withinArrayBooleanConverter") +fun Convertable.withinArray(array: CMConverterList): WithinExpression = + toDopeType(array).withinArray(array.toDopeType()) + @JvmName("notWithinNumberArray") -fun CMField.notWithinArray(array: TypeExpression>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: TypeExpression>): NotWithinExpression = toDopeType().notWithinArray(array) @JvmName("notWithinStringArray") -fun CMField.notWithinArray(array: TypeExpression>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: TypeExpression>): NotWithinExpression = toDopeType().notWithinArray(array) @JvmName("notWithinBooleanArray") -fun CMField.notWithinArray(array: TypeExpression>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: TypeExpression>): NotWithinExpression = toDopeType().notWithinArray(array) @JvmName("notWithinNumberArray") -fun TypeExpression.notWithinArray(array: CMList): NotWithinExpression = +fun TypeExpression.notWithinArray(array: CMJsonList): NotWithinExpression = this.notWithinArray(array.toDopeType()) @JvmName("notWithinStringArray") -fun TypeExpression.notWithinArray(array: CMList): NotWithinExpression = +fun TypeExpression.notWithinArray(array: CMJsonList): NotWithinExpression = this.notWithinArray(array.toDopeType()) @JvmName("notWithinBooleanArray") -fun TypeExpression.notWithinArray(array: CMList): NotWithinExpression = +fun TypeExpression.notWithinArray(array: CMJsonList): NotWithinExpression = this.notWithinArray(array.toDopeType()) @JvmName("notWithinNumberArray") -fun CMField.notWithinArray(array: CMList): NotWithinExpression = +fun CMJsonField.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinStringArray") -fun CMField.notWithinArray(array: CMList): NotWithinExpression = +fun CMJsonField.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinBooleanArray") -fun CMField.notWithinArray(array: CMList): NotWithinExpression = +fun CMJsonField.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinNumberArray") -fun CMField.notWithinArray(array: Collection>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: Collection>): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinStringArray") -fun CMField.notWithinArray(array: Collection>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: Collection>): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinBooleanArray") -fun CMField.notWithinArray(array: Collection>): NotWithinExpression = +fun CMJsonField.notWithinArray(array: Collection>): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinNumberArray") -fun Number.notWithinArray(array: CMList): NotWithinExpression = +fun Number.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinStringArray") -fun String.notWithinArray(array: CMList): NotWithinExpression = +fun String.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) @JvmName("notWithinBooleanArray") -fun Boolean.notWithinArray(array: CMList): NotWithinExpression = +fun Boolean.notWithinArray(array: CMJsonList): NotWithinExpression = toDopeType().notWithinArray(array.toDopeType()) diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsArray.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsArray.kt index 2acd8e42..465107b4 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsArray.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsArray.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.isArray import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberIsArray") -fun CMField.isArray() = toDopeType().isArray() +fun CMJsonField.isArray() = toDopeType().isArray() @JvmName("stringIsArray") -fun CMField.isArray() = toDopeType().isArray() +fun CMJsonField.isArray() = toDopeType().isArray() @JvmName("booleanIsArray") -fun CMField.isArray() = toDopeType().isArray() +fun CMJsonField.isArray() = toDopeType().isArray() @JvmName("numberListIsArray") -fun CMList.isArray() = toDopeType().isArray() +fun CMJsonList.isArray() = toDopeType().isArray() @JvmName("stringListIsArray") -fun CMList.isArray() = toDopeType().isArray() +fun CMJsonList.isArray() = toDopeType().isArray() @JvmName("booleanListIsArray") -fun CMList.isArray() = toDopeType().isArray() +fun CMJsonList.isArray() = toDopeType().isArray() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsAtom.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsAtom.kt index 02dab37c..21c1639c 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsAtom.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsAtom.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.isAtom import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberIsAtom") -fun CMField.isAtom() = toDopeType().isAtom() +fun CMJsonField.isAtom() = toDopeType().isAtom() @JvmName("stringIsAtom") -fun CMField.isAtom() = toDopeType().isAtom() +fun CMJsonField.isAtom() = toDopeType().isAtom() @JvmName("booleanIsAtom") -fun CMField.isAtom() = toDopeType().isAtom() +fun CMJsonField.isAtom() = toDopeType().isAtom() @JvmName("numberListIsAtom") -fun CMList.isAtom() = toDopeType().isAtom() +fun CMJsonList.isAtom() = toDopeType().isAtom() @JvmName("stringListIsAtom") -fun CMList.isAtom() = toDopeType().isAtom() +fun CMJsonList.isAtom() = toDopeType().isAtom() @JvmName("booleanListIsAtom") -fun CMList.isAtom() = toDopeType().isAtom() +fun CMJsonList.isAtom() = toDopeType().isAtom() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsBoolean.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsBoolean.kt index 0e33c746..928a1adb 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsBoolean.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsBoolean.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.isBoolean import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberIsBoolean") -fun CMField.isBoolean() = toDopeType().isBoolean() +fun CMJsonField.isBoolean() = toDopeType().isBoolean() @JvmName("stringIsBoolean") -fun CMField.isBoolean() = toDopeType().isBoolean() +fun CMJsonField.isBoolean() = toDopeType().isBoolean() @JvmName("booleanIsBoolean") -fun CMField.isBoolean() = toDopeType().isBoolean() +fun CMJsonField.isBoolean() = toDopeType().isBoolean() @JvmName("numberListIsBoolean") -fun CMList.isBoolean() = toDopeType().isBoolean() +fun CMJsonList.isBoolean() = toDopeType().isBoolean() @JvmName("stringListIsBoolean") -fun CMList.isBoolean() = toDopeType().isBoolean() +fun CMJsonList.isBoolean() = toDopeType().isBoolean() @JvmName("booleanListIsBoolean") -fun CMList.isBoolean() = toDopeType().isBoolean() +fun CMJsonList.isBoolean() = toDopeType().isBoolean() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsNumber.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsNumber.kt index 4062cdb3..1df9e5aa 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsNumber.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsNumber.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.isNumber import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberIsNumber") -fun CMField.isNumber() = toDopeType().isNumber() +fun CMJsonField.isNumber() = toDopeType().isNumber() @JvmName("stringIsNumber") -fun CMField.isNumber() = toDopeType().isNumber() +fun CMJsonField.isNumber() = toDopeType().isNumber() @JvmName("booleanIsNumber") -fun CMField.isNumber() = toDopeType().isNumber() +fun CMJsonField.isNumber() = toDopeType().isNumber() @JvmName("numberListIsNumber") -fun CMList.isNumber() = toDopeType().isNumber() +fun CMJsonList.isNumber() = toDopeType().isNumber() @JvmName("stringListIsNumber") -fun CMList.isNumber() = toDopeType().isNumber() +fun CMJsonList.isNumber() = toDopeType().isNumber() @JvmName("booleanListIsNumber") -fun CMList.isNumber() = toDopeType().isNumber() +fun CMJsonList.isNumber() = toDopeType().isNumber() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsString.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsString.kt index 87326a50..93bbe04a 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsString.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/IsString.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.isString import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberIsString") -fun CMField.isString() = toDopeType().isString() +fun CMJsonField.isString() = toDopeType().isString() @JvmName("stringIsString") -fun CMField.isString() = toDopeType().isString() +fun CMJsonField.isString() = toDopeType().isString() @JvmName("booleanIsString") -fun CMField.isString() = toDopeType().isString() +fun CMJsonField.isString() = toDopeType().isString() @JvmName("numberListIsString") -fun CMList.isString() = toDopeType().isString() +fun CMJsonList.isString() = toDopeType().isString() @JvmName("stringListIsString") -fun CMList.isString() = toDopeType().isString() +fun CMJsonList.isString() = toDopeType().isString() @JvmName("booleanListIsString") -fun CMList.isString() = toDopeType().isString() +fun CMJsonList.isString() = toDopeType().isString() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToArray.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToArray.kt index 3942377d..8b4ccf69 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToArray.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToArray.kt @@ -2,13 +2,13 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.toArray import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField +import com.schwarz.crystalapi.schema.CMJsonField @JvmName("numberToArray") -fun CMField.toArray() = toDopeType().toArray() +fun CMJsonField.toArray() = toDopeType().toArray() @JvmName("stringToArray") -fun CMField.toArray() = toDopeType().toArray() +fun CMJsonField.toArray() = toDopeType().toArray() @JvmName("booleanToArray") -fun CMField.toArray() = toDopeType().toArray() +fun CMJsonField.toArray() = toDopeType().toArray() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToBoolean.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToBoolean.kt index 46ef1ce0..517b41b4 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToBoolean.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToBoolean.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.toBool import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberToBoolean") -fun CMField.toBool() = toDopeType().toBool() +fun CMJsonField.toBool() = toDopeType().toBool() @JvmName("stringToBoolean") -fun CMField.toBool() = toDopeType().toBool() +fun CMJsonField.toBool() = toDopeType().toBool() @JvmName("booleanToBoolean") -fun CMField.toBool() = toDopeType().toBool() +fun CMJsonField.toBool() = toDopeType().toBool() @JvmName("numberListToBoolean") -fun CMList.toBool() = toDopeType().toBool() +fun CMJsonList.toBool() = toDopeType().toBool() @JvmName("stringListToBoolean") -fun CMList.toBool() = toDopeType().toBool() +fun CMJsonList.toBool() = toDopeType().toBool() @JvmName("booleanListToBoolean") -fun CMList.toBool() = toDopeType().toBool() +fun CMJsonList.toBool() = toDopeType().toBool() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToNumber.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToNumber.kt index c7e0c6c9..f553bde0 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToNumber.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToNumber.kt @@ -5,38 +5,38 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction. import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType import ch.ergon.dope.toDopeType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberToNumber") -fun CMField.toNumber() = toDopeType().toNumber() +fun CMJsonField.toNumber() = toDopeType().toNumber() @JvmName("stringToNumber") -fun CMField.toNumber() = toDopeType().toNumber() +fun CMJsonField.toNumber() = toDopeType().toNumber() @JvmName("stringToNumber") -fun CMField.toNumber(filterChars: String) = toDopeType().toNumber(filterChars.toDopeType()) +fun CMJsonField.toNumber(filterChars: String) = toDopeType().toNumber(filterChars.toDopeType()) @JvmName("stringToNumber") -fun CMField.toNumber(filterChars: TypeExpression) = toDopeType().toNumber(filterChars) +fun CMJsonField.toNumber(filterChars: TypeExpression) = toDopeType().toNumber(filterChars) @JvmName("stringToNumber") -fun String.toNumber(filterChars: CMField) = toDopeType().toNumber(filterChars.toDopeType()) +fun String.toNumber(filterChars: CMJsonField) = toDopeType().toNumber(filterChars.toDopeType()) @JvmName("stringToNumber") -fun TypeExpression.toNumber(filterChars: CMField) = toNumber(filterChars.toDopeType()) +fun TypeExpression.toNumber(filterChars: CMJsonField) = toNumber(filterChars.toDopeType()) @JvmName("stringToNumber") -fun CMField.toNumber(filterChars: CMField) = toDopeType().toNumber(filterChars.toDopeType()) +fun CMJsonField.toNumber(filterChars: CMJsonField) = toDopeType().toNumber(filterChars.toDopeType()) @JvmName("booleanToNumber") -fun CMField.toNumber() = toDopeType().toNumber() +fun CMJsonField.toNumber() = toDopeType().toNumber() @JvmName("numberListToNumber") -fun CMList.toNumber() = toDopeType().toNumber() +fun CMJsonList.toNumber() = toDopeType().toNumber() @JvmName("stringListToNumber") -fun CMList.toNumber() = toDopeType().toNumber() +fun CMJsonList.toNumber() = toDopeType().toNumber() @JvmName("booleanListToNumber") -fun CMList.toNumber() = toDopeType().toNumber() +fun CMJsonList.toNumber() = toDopeType().toNumber() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToString.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToString.kt index 1089e3c9..6830b03a 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToString.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/ToString.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.toStr import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("numberToString") -fun CMField.toStr() = toDopeType().toStr() +fun CMJsonField.toStr() = toDopeType().toStr() @JvmName("stringToString") -fun CMField.toStr() = toDopeType().toStr() +fun CMJsonField.toStr() = toDopeType().toStr() @JvmName("booleanToString") -fun CMField.toStr() = toDopeType().toStr() +fun CMJsonField.toStr() = toDopeType().toStr() @JvmName("toStringNumberList") -fun CMList.toStr() = toDopeType().toStr() +fun CMJsonList.toStr() = toDopeType().toStr() @JvmName("toStringStringList") -fun CMList.toStr() = toDopeType().toStr() +fun CMJsonList.toStr() = toDopeType().toStr() @JvmName("toStringBooleanList") -fun CMList.toStr() = toDopeType().toStr() +fun CMJsonList.toStr() = toDopeType().toStr() diff --git a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/TypeOf.kt b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/TypeOf.kt index bb4ba9d0..cf3dfe8e 100644 --- a/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/TypeOf.kt +++ b/crystal-map-connector/src/main/kotlin/ch/ergon/dope/extension/type/typefunction/TypeOf.kt @@ -2,23 +2,23 @@ package ch.ergon.dope.extension.type.typefunction import ch.ergon.dope.resolvable.expression.unaliased.type.function.typefunction.typeOf import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList @JvmName("typeOfNumber") -fun typeOf(field: CMField) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonField) = typeOf(field.toDopeType()) @JvmName("typeOfString") -fun typeOf(field: CMField) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonField) = typeOf(field.toDopeType()) @JvmName("typeOfBoolean") -fun typeOf(field: CMField) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonField) = typeOf(field.toDopeType()) @JvmName("typeOfNumberList") -fun typeOf(field: CMList) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonList) = typeOf(field.toDopeType()) @JvmName("typeOfStringList") -fun typeOf(field: CMList) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonList) = typeOf(field.toDopeType()) @JvmName("typeOfBooleanList") -fun typeOf(field: CMList) = typeOf(field.toDopeType()) +fun typeOf(field: CMJsonList) = typeOf(field.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/CrystalMapAdapterTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/CrystalMapAdapterTest.kt index 5985a7c8..e7623f7a 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/CrystalMapAdapterTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/CrystalMapAdapterTest.kt @@ -1,13 +1,16 @@ package ch.ergon.dope import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCorruptField +import ch.ergon.dope.helper.someString import ch.ergon.dope.resolvable.expression.unaliased.type.Field import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList +import org.junit.jupiter.api.assertThrows import kotlin.test.Test import kotlin.test.assertEquals @@ -15,56 +18,66 @@ class CrystalMapAdapterTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should convert CMField with Number`() { - val cmField = CMField("testName", "testPath") + fun `should convert CMJsonField with Number`() { + val cmJsonField = CMJsonField("testName", "testPath") - val actual: Field = cmField.toDopeType() + val actual: Field = cmJsonField.toDopeType() - assertEquals("`${cmField.path}`.`${cmField.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonField.path}`.`${cmJsonField.name}`", actual.toDopeQuery(manager).queryString) } @Test - fun `should convert CMField with String`() { - val cmField = CMField("testName", "testPath") + fun `should convert CMJsonField with String`() { + val cmJsonField = CMJsonField("testName", "testPath") - val actual: Field = cmField.toDopeType() + val actual: Field = cmJsonField.toDopeType() - assertEquals("`${cmField.path}`.`${cmField.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonField.path}`.`${cmJsonField.name}`", actual.toDopeQuery(manager).queryString) } @Test - fun `should convert CMField with Boolean`() { - val cmField = CMField("testName", "testPath") + fun `should convert CMJsonField with Boolean`() { + val cmJsonField = CMJsonField("testName", "testPath") - val actual: Field = cmField.toDopeType() + val actual: Field = cmJsonField.toDopeType() - assertEquals("`${cmField.path}`.`${cmField.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonField.path}`.`${cmJsonField.name}`", actual.toDopeQuery(manager).queryString) } @Test - fun `should convert CMList string`() { - val cmList = CMList("testName", "testPath") + fun `should convert CMJsonList string`() { + val cmJsonList = CMJsonList("testName", "testPath") - val actual: Field> = cmList.toDopeType() + val actual: Field> = cmJsonList.toDopeType() - assertEquals("`${cmList.path}`.`${cmList.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonList.path}`.`${cmJsonList.name}`", actual.toDopeQuery(manager).queryString) } @Test - fun `should convert CMList number`() { - val cmList = CMList("testName", "testPath") + fun `should convert CMJsonList number`() { + val cmJsonList = CMJsonList("testName", "testPath") - val actual: Field> = cmList.toDopeType() + val actual: Field> = cmJsonList.toDopeType() - assertEquals("`${cmList.path}`.`${cmList.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonList.path}`.`${cmJsonList.name}`", actual.toDopeQuery(manager).queryString) } @Test - fun `should convert CMList boolean`() { - val cmList = CMList("testName", "testPath") + fun `should convert CMJsonList boolean`() { + val cmJsonList = CMJsonList("testName", "testPath") - val actual: Field> = cmList.toDopeType() + val actual: Field> = cmJsonList.toDopeType() - assertEquals("`${cmList.path}`.`${cmList.name}`", actual.toDopeQuery(manager).queryString) + assertEquals("`${cmJsonList.path}`.`${cmJsonList.name}`", actual.toDopeQuery(manager).queryString) + } + + @Test + fun `should throw exception when resolving corrupt field`() { + val string = someString() + val corruptField = someCorruptField() + + assertThrows { + string.toDopeType(corruptField) + } } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/ArrayAggTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/ArrayAggTest.kt index e45b93a9..ee2ea7f7 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/ArrayAggTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/ArrayAggTest.kt @@ -19,7 +19,7 @@ class ArrayAggTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support array_agg with CMField Number`() { + fun `should support array_agg with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -30,7 +30,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMField Number and type`() { + fun `should support array_agg with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -41,7 +41,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMField string`() { + fun `should support array_agg with CMJsonField string`() { val field = someCMStringField() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -52,7 +52,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMField string and type`() { + fun `should support array_agg with CMJsonField string and type`() { val field = someCMStringField() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -63,7 +63,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMField boolean`() { + fun `should support array_agg with CMJsonField boolean`() { val field = someCMBooleanField() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -74,7 +74,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMField boolean and type`() { + fun `should support array_agg with CMJsonField boolean and type`() { val field = someCMBooleanField() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -85,7 +85,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList Number`() { + fun `should support array_agg with CMJsonList Number`() { val field = someCMNumberList() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -96,7 +96,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList Number and type`() { + fun `should support array_agg with CMJsonList Number and type`() { val field = someCMNumberList() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -107,7 +107,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList string`() { + fun `should support array_agg with CMJsonList string`() { val field = someCMStringList() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -118,7 +118,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList string and type`() { + fun `should support array_agg with CMJsonList string and type`() { val field = someCMStringList() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -129,7 +129,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList Boolean`() { + fun `should support array_agg with CMJsonList Boolean`() { val field = someCMBooleanList() val quantifier = null val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) @@ -140,7 +140,7 @@ class ArrayAggTest : ManagerDependentTest { } @Test - fun `should support array_agg with CMList Boolean and type`() { + fun `should support array_agg with CMJsonList Boolean and type`() { val field = someCMBooleanList() val quantifier = ALL val expected = ArrayAggregateExpression(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/CountTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/CountTest.kt index b4bd4858..24bad4d9 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/CountTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/CountTest.kt @@ -19,7 +19,7 @@ class CountTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support count with CMField Number`() { + fun `should support count with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -30,7 +30,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMField Number and type`() { + fun `should support count with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) @@ -41,7 +41,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMField string`() { + fun `should support count with CMJsonField string`() { val field = someCMStringField() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -52,7 +52,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMField string and type`() { + fun `should support count with CMJsonField string and type`() { val field = someCMStringField() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) @@ -63,7 +63,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMField boolean`() { + fun `should support count with CMJsonField boolean`() { val field = someCMBooleanField() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -74,7 +74,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMField boolean and type`() { + fun `should support count with CMJsonField boolean and type`() { val field = someCMBooleanField() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) @@ -85,7 +85,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList Number`() { + fun `should support count with CMJsonList Number`() { val field = someCMNumberList() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -96,7 +96,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList Number and type`() { + fun `should support count with CMJsonList Number and type`() { val field = someCMNumberList() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) @@ -107,7 +107,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList string`() { + fun `should support count with CMJsonList string`() { val field = someCMStringList() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -118,7 +118,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList string and type`() { + fun `should support count with CMJsonList string and type`() { val field = someCMStringList() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) @@ -129,7 +129,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList Boolean`() { + fun `should support count with CMJsonList Boolean`() { val field = someCMBooleanList() val quantifier = null val expected = CountExpression(field.toDopeType(), quantifier) @@ -140,7 +140,7 @@ class CountTest : ManagerDependentTest { } @Test - fun `should support count with CMList Boolean and type`() { + fun `should support count with CMJsonList Boolean and type`() { val field = someCMBooleanList() val quantifier = ALL val expected = CountExpression(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MaxTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MaxTest.kt index 89832511..08278fdf 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MaxTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MaxTest.kt @@ -19,7 +19,7 @@ class MaxTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support max with CMField Number`() { + fun `should support max with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -30,7 +30,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMField Number and type`() { + fun `should support max with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) @@ -41,7 +41,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMField string`() { + fun `should support max with CMJsonField string`() { val field = someCMStringField() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -52,7 +52,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMField string and type`() { + fun `should support max with CMJsonField string and type`() { val field = someCMStringField() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) @@ -63,7 +63,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMField boolean`() { + fun `should support max with CMJsonField boolean`() { val field = someCMBooleanField() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -74,7 +74,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMField boolean and type`() { + fun `should support max with CMJsonField boolean and type`() { val field = someCMBooleanField() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) @@ -85,7 +85,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList Number`() { + fun `should support max with CMJsonList Number`() { val field = someCMNumberList() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -96,7 +96,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList Number and type`() { + fun `should support max with CMJsonList Number and type`() { val field = someCMNumberList() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) @@ -107,7 +107,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList string`() { + fun `should support max with CMJsonList string`() { val field = someCMStringList() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -118,7 +118,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList string and type`() { + fun `should support max with CMJsonList string and type`() { val field = someCMStringList() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) @@ -129,7 +129,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList Boolean`() { + fun `should support max with CMJsonList Boolean`() { val field = someCMBooleanList() val quantifier = null val expected = MaxExpression(field.toDopeType(), quantifier) @@ -140,7 +140,7 @@ class MaxTest : ManagerDependentTest { } @Test - fun `should support max with CMList Boolean and type`() { + fun `should support max with CMJsonList Boolean and type`() { val field = someCMBooleanList() val quantifier = ALL val expected = MaxExpression(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MinTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MinTest.kt index f5f81a26..f5d77659 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MinTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/MinTest.kt @@ -19,7 +19,7 @@ class MinTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support min with CMField Number`() { + fun `should support min with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -30,7 +30,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMField Number and type`() { + fun `should support min with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) @@ -41,7 +41,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMField string`() { + fun `should support min with CMJsonField string`() { val field = someCMStringField() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -52,7 +52,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMField string and type`() { + fun `should support min with CMJsonField string and type`() { val field = someCMStringField() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) @@ -63,7 +63,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMField boolean`() { + fun `should support min with CMJsonField boolean`() { val field = someCMBooleanField() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -74,7 +74,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMField boolean and type`() { + fun `should support min with CMJsonField boolean and type`() { val field = someCMBooleanField() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) @@ -85,7 +85,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList Number`() { + fun `should support min with CMJsonList Number`() { val field = someCMNumberList() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -96,7 +96,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList Number and type`() { + fun `should support min with CMJsonList Number and type`() { val field = someCMNumberList() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) @@ -107,7 +107,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList string`() { + fun `should support min with CMJsonList string`() { val field = someCMStringList() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -118,7 +118,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList string and type`() { + fun `should support min with CMJsonList string and type`() { val field = someCMStringList() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) @@ -129,7 +129,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList Boolean`() { + fun `should support min with CMJsonList Boolean`() { val field = someCMBooleanList() val quantifier = null val expected = MinExpression(field.toDopeType(), quantifier) @@ -140,7 +140,7 @@ class MinTest : ManagerDependentTest { } @Test - fun `should support min with CMList Boolean and type`() { + fun `should support min with CMJsonList Boolean and type`() { val field = someCMBooleanList() val quantifier = ALL val expected = MinExpression(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/NumberAggregateTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/NumberAggregateTest.kt index 02f3d82d..77ed2a04 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/NumberAggregateTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/aggregator/NumberAggregateTest.kt @@ -24,7 +24,7 @@ class NumberAggregateTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support avg with CMField Number`() { + fun `should support avg with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = AverageExpression(field.toDopeType(), quantifier) @@ -35,7 +35,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support avg with CMField Number and type`() { + fun `should support avg with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = AverageExpression(field.toDopeType(), quantifier) @@ -46,7 +46,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support mean with CMField Number`() { + fun `should support mean with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = MeanExpression(field.toDopeType(), quantifier) @@ -57,7 +57,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support mean with CMField Number and type`() { + fun `should support mean with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = MeanExpression(field.toDopeType(), quantifier) @@ -68,7 +68,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support median with CMField Number`() { + fun `should support median with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = MedianExpression(field.toDopeType(), quantifier) @@ -79,7 +79,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support median with CMField Number and type`() { + fun `should support median with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = MedianExpression(field.toDopeType(), quantifier) @@ -90,7 +90,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support sum with CMField Number`() { + fun `should support sum with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = SumExpression(field.toDopeType(), quantifier) @@ -101,7 +101,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support sum with CMField Number and type`() { + fun `should support sum with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = SumExpression(field.toDopeType(), quantifier) @@ -112,7 +112,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support stddev with CMField Number`() { + fun `should support stddev with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = StandardDeviationExpression(field.toDopeType(), quantifier) @@ -123,7 +123,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support stddev with CMField Number and type`() { + fun `should support stddev with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = StandardDeviationExpression(field.toDopeType(), quantifier) @@ -134,7 +134,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support variance with CMField Number`() { + fun `should support variance with CMJsonField Number`() { val field = someCMNumberField() val quantifier = null val expected = VarianceExpression(field.toDopeType(), quantifier) @@ -145,7 +145,7 @@ class NumberAggregateTest : ManagerDependentTest { } @Test - fun `should support variance with CMField Number and type`() { + fun `should support variance with CMJsonField Number and type`() { val field = someCMNumberField() val quantifier = ALL val expected = VarianceExpression(field.toDopeType(), quantifier) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/clause/UpdateClauseTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/clause/UpdateClauseTest.kt index 91015489..5fa0e0e0 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/clause/UpdateClauseTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/clause/UpdateClauseTest.kt @@ -11,10 +11,14 @@ import ch.ergon.dope.helper.ManagerDependentTest import ch.ergon.dope.helper.someBoolean import ch.ergon.dope.helper.someCMBooleanField import ch.ergon.dope.helper.someCMBooleanList +import ch.ergon.dope.helper.someCMConverterBooleanField +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMNumberList import ch.ergon.dope.helper.someCMStringField import ch.ergon.dope.helper.someCMStringList +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someString import ch.ergon.dope.helper.someUpdate @@ -56,7 +60,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField number to CMField number`() { + fun `should support update set CMJsonField number to CMJsonField number`() { val field = someCMNumberField() val value = someCMNumberField() val parentClause = someUpdate() @@ -68,7 +72,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField number to CMField number`() { + fun `should support update additional set CMJsonField number to CMJsonField number`() { val numberField = someCMNumberField() val numberValue = someCMNumberField() val stringField = someCMStringField() @@ -86,7 +90,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField string to CMField string`() { + fun `should support update set CMJsonField string to CMJsonField string`() { val field = someCMStringField() val value = someCMStringField() val parentClause = someUpdate() @@ -98,7 +102,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField string to CMField string`() { + fun `should support update additional set CMJsonField string to CMJsonField string`() { val numberField = someCMNumberField() val numberValue = someCMNumberField() val stringField = someCMStringField() @@ -116,7 +120,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField boolean to CMField boolean`() { + fun `should support update set CMJsonField boolean to CMJsonField boolean`() { val field = someCMBooleanField() val value = someCMBooleanField() val parentClause = someUpdate() @@ -128,7 +132,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField boolean to CMField boolean`() { + fun `should support update additional set CMJsonField boolean to CMJsonField boolean`() { val booleanField = someCMBooleanField() val booleanValue = someCMBooleanField() val stringField = someCMStringField() @@ -146,7 +150,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList number to CMList number`() { + fun `should support update set CMJsonList number to CMJsonList number`() { val field = someCMNumberList() val value = someCMNumberList() val parentClause = someUpdate() @@ -158,7 +162,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList number to CMList number`() { + fun `should support update additional set CMJsonList number to CMJsonList number`() { val numberField = someCMNumberList() val numberValue = someCMNumberList() val stringField = someCMStringList() @@ -176,7 +180,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList string to CMList string`() { + fun `should support update set CMJsonList string to CMJsonList string`() { val field = someCMStringList() val value = someCMStringList() val parentClause = someUpdate() @@ -188,7 +192,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList string to CMList string`() { + fun `should support update additional set CMJsonList string to CMJsonList string`() { val numberField = someCMNumberList() val numberValue = someCMNumberList() val stringField = someCMStringList() @@ -206,7 +210,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList boolean to CMList boolean`() { + fun `should support update set CMJsonList boolean to CMJsonList boolean`() { val field = someCMBooleanList() val value = someCMBooleanList() val parentClause = someUpdate() @@ -218,7 +222,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList boolean to CMList boolean`() { + fun `should support update additional set CMJsonList boolean to CMJsonList boolean`() { val booleanField = someCMBooleanList() val booleanValue = someCMBooleanList() val stringField = someCMStringList() @@ -236,7 +240,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField number to TypeExpression number`() { + fun `should support update set CMJsonField number to TypeExpression number`() { val field = someCMNumberField() val value = someNumber().toDopeType() val parentClause = someUpdate() @@ -248,7 +252,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField number to TypeExpression number`() { + fun `should support update additional set CMJsonField number to TypeExpression number`() { val numberField = someCMNumberField() val numberValue = someNumber().toDopeType() val stringField = someCMStringField() @@ -266,7 +270,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField string to TypeExpression string`() { + fun `should support update set CMJsonField string to TypeExpression string`() { val field = someCMStringField() val value = someString().toDopeType() val parentClause = someUpdate() @@ -278,7 +282,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField string to TypeExpression string`() { + fun `should support update additional set CMJsonField string to TypeExpression string`() { val numberField = someCMNumberField() val numberValue = someCMNumberField() val stringField = someCMStringField() @@ -296,7 +300,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField boolean to TypeExpression boolean`() { + fun `should support update set CMJsonField boolean to TypeExpression boolean`() { val field = someCMBooleanField() val value = someBoolean().toDopeType() val parentClause = someUpdate() @@ -308,7 +312,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField boolean to TypeExpression boolean`() { + fun `should support update additional set CMJsonField boolean to TypeExpression boolean`() { val booleanField = someCMBooleanField() val booleanValue = someBoolean().toDopeType() val stringField = someCMStringField() @@ -326,7 +330,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList number to TypeExpression number`() { + fun `should support update set CMJsonList number to TypeExpression number`() { val field = someCMNumberList() val value = listOf(someNumber().toDopeType(), someNumber().toDopeType()).toDopeType() val parentClause = someUpdate() @@ -338,7 +342,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList number to TypeExpression number`() { + fun `should support update additional set CMJsonList number to TypeExpression number`() { val numberField = someCMNumberList() val numberValue = listOf(someNumber().toDopeType(), someNumber().toDopeType()).toDopeType() val stringField = someCMStringList() @@ -356,7 +360,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList string to TypeExpression string`() { + fun `should support update set CMJsonList string to TypeExpression string`() { val field = someCMStringList() val value = listOf(someString().toDopeType(), someString().toDopeType()).toDopeType() val parentClause = someUpdate() @@ -368,7 +372,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList string to TypeExpression string`() { + fun `should support update additional set CMJsonList string to TypeExpression string`() { val numberField = someCMNumberList() val numberValue = someCMNumberList() val stringField = someCMStringList() @@ -386,7 +390,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMList boolean to TypeExpression boolean`() { + fun `should support update set CMJsonList boolean to TypeExpression boolean`() { val field = someCMBooleanList() val value = listOf(someBoolean().toDopeType(), someBoolean().toDopeType()).toDopeType() val parentClause = someUpdate() @@ -398,7 +402,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMList boolean to TypeExpression boolean`() { + fun `should support update additional set CMJsonList boolean to TypeExpression boolean`() { val booleanField = someCMBooleanList() val booleanValue = listOf(someBoolean().toDopeType(), someBoolean().toDopeType()).toDopeType() val stringField = someCMStringList() @@ -416,7 +420,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField number to number`() { + fun `should support update set CMJsonField number to number`() { val field = someCMNumberField() val value = someNumber() val parentClause = someUpdate() @@ -428,7 +432,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField number to number`() { + fun `should support update additional set CMJsonField number to number`() { val numberField = someCMNumberField() val numberValue = someNumber() val stringField = someCMStringField() @@ -446,7 +450,37 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField string to string`() { + fun `should support update set CMConverterField number to date`() { + val field = someCMConverterNumberField() + val value = someDate() + val parentClause = someUpdate() + val expected = SetClause(field.toDopeType().to(value.toInstant().epochSecond.toDopeType()), parentClause = parentClause) + + val actual = parentClause.set(field, value) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support update additional set CMConverterField number to date`() { + val dateField = someCMConverterNumberField() + val dateValue = someDate() + val stringField = someCMStringField() + val stringValue = someCMStringField() + val parentClause = someUpdate() + val expected = SetClause( + stringField.toDopeType().to(stringValue.toDopeType()), + dateField.toDopeType().to(dateValue.toInstant().epochSecond.toDopeType()), + parentClause = parentClause, + ) + + val actual = parentClause.set(stringField, stringValue).set(dateField, dateValue) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support update set CMJsonField string to string`() { val field = someCMStringField() val value = someString() val parentClause = someUpdate() @@ -458,7 +492,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField string to string`() { + fun `should support update additional set CMJsonField string to string`() { val numberField = someCMNumberField() val numberValue = someCMNumberField() val stringField = someCMStringField() @@ -476,7 +510,37 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update set CMField boolean to boolean`() { + fun `should support update set CMConverterField string to date`() { + val field = someCMConverterStringField() + val value = someDate() + val parentClause = someUpdate() + val expected = SetClause(field.toDopeType().to(value.toInstant().epochSecond.toString().toDopeType()), parentClause = parentClause) + + val actual = parentClause.set(field, value) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support update additional set CMConverterField string to date`() { + val dateField = someCMConverterStringField() + val dateValue = someDate() + val stringField = someCMStringField() + val stringValue = someCMStringField() + val parentClause = someUpdate() + val expected = SetClause( + stringField.toDopeType().to(stringValue.toDopeType()), + dateField.toDopeType().to(dateValue.toInstant().epochSecond.toString().toDopeType()), + parentClause = parentClause, + ) + + val actual = parentClause.set(stringField, stringValue).set(dateField, dateValue) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support update set CMJsonField boolean to boolean`() { val field = someCMBooleanField() val value = someBoolean() val parentClause = someUpdate() @@ -488,7 +552,7 @@ class UpdateClauseTest : ManagerDependentTest { } @Test - fun `should support update additional set CMField boolean to boolean`() { + fun `should support update additional set CMJsonField boolean to boolean`() { val booleanField = someCMBooleanField() val booleanValue = someBoolean() val stringField = someCMStringField() @@ -505,6 +569,36 @@ class UpdateClauseTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + @Test + fun `should support update set CMConverterField boolean to date`() { + val field = someCMConverterBooleanField() + val value = someDate() + val parentClause = someUpdate() + val expected = SetClause(field.toDopeType().to(true.toDopeType()), parentClause = parentClause) + + val actual = parentClause.set(field, value) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support update additional set CMConverterField boolean to date`() { + val dateField = someCMConverterBooleanField() + val dateValue = someDate() + val stringField = someCMStringField() + val stringValue = someCMStringField() + val parentClause = someUpdate() + val expected = SetClause( + stringField.toDopeType().to(stringValue.toDopeType()), + dateField.toDopeType().to(true.toDopeType()), + parentClause = parentClause, + ) + + val actual = parentClause.set(stringField, stringValue).set(dateField, dateValue) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + @Test fun `should support update unset with CM`() { val stringField = someCMStringField() diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NegationTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NegationTest.kt index b3570458..d9bec672 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NegationTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NegationTest.kt @@ -13,7 +13,7 @@ class NegationTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support neg with CMField Number`() { + fun `should support neg with CMJsonField Number`() { val field = someCMNumberField() val expected = NegationExpression(field.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NumberInfixTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NumberInfixTest.kt index a0413592..233512db 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NumberInfixTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/arithmetic/NumberInfixTest.kt @@ -7,7 +7,9 @@ import ch.ergon.dope.extension.type.arithmetic.mod import ch.ergon.dope.extension.type.arithmetic.mul import ch.ergon.dope.extension.type.arithmetic.sub import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCMConverterNumberField import ch.ergon.dope.helper.someCMNumberField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.resolvable.expression.unaliased.type.arithmetic.AdditionExpression @@ -24,7 +26,7 @@ class NumberInfixTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support add with CMField CMField`() { + fun `should support add with CMJsonField CMJsonField`() { val left = someCMNumberField() val right = someCMNumberField() val expected = AdditionExpression(left.toDopeType(), right.toDopeType()) @@ -35,7 +37,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support add with CMField type`() { + fun `should support add with CMJsonField type`() { val left = someCMNumberField() val right = someNumberField() val expected = AdditionExpression(left.toDopeType(), right) @@ -46,7 +48,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support add with type CMField`() { + fun `should support add with type CMJsonField`() { val left = someNumberField() val right = someCMNumberField() val expected = AdditionExpression(left, right.toDopeType()) @@ -57,7 +59,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support add with Number CMField`() { + fun `should support add with Number CMJsonField`() { val left = someNumber() val right = someCMNumberField() val expected = AdditionExpression(left.toDopeType(), right.toDopeType()) @@ -68,7 +70,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support add with CMField Number`() { + fun `should support add with CMJsonField Number`() { val left = someCMNumberField() val right = someNumber() val expected = AdditionExpression(left.toDopeType(), right.toDopeType()) @@ -79,7 +81,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support sub with CMField CMField`() { + fun `should support sub with CMJsonField CMJsonField`() { val left = someCMNumberField() val right = someCMNumberField() val expected = SubtractionExpression(left.toDopeType(), right.toDopeType()) @@ -90,7 +92,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support sub with CMField type`() { + fun `should support sub with CMJsonField type`() { val left = someCMNumberField() val right = someNumberField() val expected = SubtractionExpression(left.toDopeType(), right) @@ -101,7 +103,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support sub with type CMField`() { + fun `should support sub with type CMJsonField`() { val left = someNumberField() val right = someCMNumberField() val expected = SubtractionExpression(left, right.toDopeType()) @@ -112,7 +114,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support sub with Number CMField`() { + fun `should support sub with Number CMJsonField`() { val left = someNumber() val right = someCMNumberField() val expected = SubtractionExpression(left.toDopeType(), right.toDopeType()) @@ -123,7 +125,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support sub with CMField Number`() { + fun `should support sub with CMJsonField Number`() { val left = someCMNumberField() val right = someNumber() val expected = SubtractionExpression(left.toDopeType(), right.toDopeType()) @@ -134,7 +136,18 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mul with CMField CMField`() { + fun `should support sub with Date CMConverterNumber`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = SubtractionExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.sub(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support mul with CMJsonField CMJsonField`() { val left = someCMNumberField() val right = someCMNumberField() val expected = MultiplicationExpression(left.toDopeType(), right.toDopeType()) @@ -145,7 +158,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mul with CMField type`() { + fun `should support mul with CMJsonField type`() { val left = someCMNumberField() val right = someNumberField() val expected = MultiplicationExpression(left.toDopeType(), right) @@ -156,7 +169,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mul with type CMField`() { + fun `should support mul with type CMJsonField`() { val left = someNumberField() val right = someCMNumberField() val expected = MultiplicationExpression(left, right.toDopeType()) @@ -167,7 +180,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mul with Number CMField`() { + fun `should support mul with Number CMJsonField`() { val left = someNumber() val right = someCMNumberField() val expected = MultiplicationExpression(left.toDopeType(), right.toDopeType()) @@ -178,7 +191,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mul with CMField Number`() { + fun `should support mul with CMJsonField Number`() { val left = someCMNumberField() val right = someNumber() val expected = MultiplicationExpression(left.toDopeType(), right.toDopeType()) @@ -189,7 +202,18 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support div with CMField CMField`() { + fun `should support mul with Date CMConverterNumber`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = MultiplicationExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.mul(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support div with CMJsonField CMJsonField`() { val left = someCMNumberField() val right = someCMNumberField() val expected = DivisionExpression(left.toDopeType(), right.toDopeType()) @@ -200,7 +224,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support div with CMField type`() { + fun `should support div with CMJsonField type`() { val left = someCMNumberField() val right = someNumberField() val expected = DivisionExpression(left.toDopeType(), right) @@ -211,7 +235,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support div with type CMField`() { + fun `should support div with type CMJsonField`() { val left = someNumberField() val right = someCMNumberField() val expected = DivisionExpression(left, right.toDopeType()) @@ -222,7 +246,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support div with Number CMField`() { + fun `should support div with Number CMJsonField`() { val left = someNumber() val right = someCMNumberField() val expected = DivisionExpression(left.toDopeType(), right.toDopeType()) @@ -233,7 +257,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support div with CMField Number`() { + fun `should support div with CMJsonField Number`() { val left = someCMNumberField() val right = someNumber() val expected = DivisionExpression(left.toDopeType(), right.toDopeType()) @@ -244,7 +268,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mod with CMField CMField`() { + fun `should support mod with CMJsonField CMJsonField`() { val left = someCMNumberField() val right = someCMNumberField() val expected = ModuloExpression(left.toDopeType(), right.toDopeType()) @@ -255,7 +279,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mod with CMField type`() { + fun `should support mod with CMJsonField type`() { val left = someCMNumberField() val right = someNumberField() val expected = ModuloExpression(left.toDopeType(), right) @@ -266,7 +290,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mod with type CMField`() { + fun `should support mod with type CMJsonField`() { val left = someNumberField() val right = someCMNumberField() val expected = ModuloExpression(left, right.toDopeType()) @@ -277,7 +301,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mod with Number CMField`() { + fun `should support mod with Number CMJsonField`() { val left = someNumber() val right = someCMNumberField() val expected = ModuloExpression(left.toDopeType(), right.toDopeType()) @@ -288,7 +312,7 @@ class NumberInfixTest : ManagerDependentTest { } @Test - fun `should support mod with CMField Number`() { + fun `should support mod with CMJsonField Number`() { val left = someCMNumberField() val right = someNumber() val expected = ModuloExpression(left.toDopeType(), right.toDopeType()) @@ -297,4 +321,15 @@ class NumberInfixTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support mod with Date CMConverterNumber`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = ModuloExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.mod(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/array/ArrayFunctionTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/array/ArrayFunctionTest.kt index e8175f37..7f918a88 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/array/ArrayFunctionTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/array/ArrayFunctionTest.kt @@ -95,30 +95,30 @@ class ArrayFunctionTest : ManagerDependentTest { @Test fun `should support ARRAY_DISTINCT with CM Number list`() { - val cmList = someCMNumberList() - val expected = ArrayDistinctExpression(cmList.toDopeType()) + val CMJsonList = someCMNumberList() + val expected = ArrayDistinctExpression(CMJsonList.toDopeType()) - val actual = arrayDistinct(cmList) + val actual = arrayDistinct(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_DISTINCT with CM String list`() { - val cmList = someCMStringList() - val expected = ArrayDistinctExpression(cmList.toDopeType()) + val CMJsonList = someCMStringList() + val expected = ArrayDistinctExpression(CMJsonList.toDopeType()) - val actual = arrayDistinct(cmList) + val actual = arrayDistinct(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_DISTINCT with CM Boolean list`() { - val cmList = someCMBooleanList() - val expected = ArrayDistinctExpression(cmList.toDopeType()) + val CMJsonList = someCMBooleanList() + val expected = ArrayDistinctExpression(CMJsonList.toDopeType()) - val actual = arrayDistinct(cmList) + val actual = arrayDistinct(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @@ -158,60 +158,60 @@ class ArrayFunctionTest : ManagerDependentTest { @Test fun `should support ARRAY_LENGTH with CM Number list`() { - val cmList = someCMNumberList() - val expected = ArrayLengthExpression(cmList.toDopeType()) + val CMJsonList = someCMNumberList() + val expected = ArrayLengthExpression(CMJsonList.toDopeType()) - val actual = arrayLength(cmList) + val actual = arrayLength(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_LENGTH with CM String list`() { - val cmList = someCMStringList() - val expected = ArrayLengthExpression(cmList.toDopeType()) + val CMJsonList = someCMStringList() + val expected = ArrayLengthExpression(CMJsonList.toDopeType()) - val actual = arrayLength(cmList) + val actual = arrayLength(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_LENGTH with CM Boolean list`() { - val cmList = someCMBooleanList() - val expected = ArrayLengthExpression(cmList.toDopeType()) + val CMJsonList = someCMBooleanList() + val expected = ArrayLengthExpression(CMJsonList.toDopeType()) - val actual = arrayLength(cmList) + val actual = arrayLength(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_SUM with CM Number list`() { - val cmList = someCMNumberList() - val expected = ArraySumExpression(cmList.toDopeType()) + val CMJsonList = someCMNumberList() + val expected = ArraySumExpression(CMJsonList.toDopeType()) - val actual = arraySum(cmList) + val actual = arraySum(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_SUM with CM String list`() { - val cmList = someCMStringList() - val expected = ArraySumExpression(cmList.toDopeType()) + val CMJsonList = someCMStringList() + val expected = ArraySumExpression(CMJsonList.toDopeType()) - val actual = arraySum(cmList) + val actual = arraySum(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } @Test fun `should support ARRAY_SUM with CM Boolean list`() { - val cmList = someCMBooleanList() - val expected = ArraySumExpression(cmList.toDopeType()) + val CMJsonList = someCMBooleanList() + val expected = ArraySumExpression(CMJsonList.toDopeType()) - val actual = arraySum(cmList) + val actual = arraySum(CMJsonList) assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/conditional/NvlTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/conditional/NvlTest.kt index 7914571e..1c98f601 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/conditional/NvlTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/conditional/NvlTest.kt @@ -6,10 +6,14 @@ import ch.ergon.dope.helper.ManagerDependentTest import ch.ergon.dope.helper.someBoolean import ch.ergon.dope.helper.someCMBooleanField import ch.ergon.dope.helper.someCMBooleanList +import ch.ergon.dope.helper.someCMConverterBooleanField +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMNumberList import ch.ergon.dope.helper.someCMStringField import ch.ergon.dope.helper.someCMStringList +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someString import ch.ergon.dope.resolvable.expression.unaliased.type.function.conditional.NvlExpression @@ -119,4 +123,37 @@ class NvlTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support nvl CMNumberField date`() { + val initialExpression = someCMConverterNumberField() + val substituteExpression = someDate() + val expected = NvlExpression(initialExpression.toDopeType(), substituteExpression.toInstant().epochSecond.toDopeType()) + + val actual = nvl(initialExpression, substituteExpression) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support nvl CMStringField date`() { + val initialExpression = someCMConverterStringField() + val substituteExpression = someDate() + val expected = NvlExpression(initialExpression.toDopeType(), substituteExpression.toInstant().epochSecond.toString().toDopeType()) + + val actual = nvl(initialExpression, substituteExpression) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support nvl CMBooleanField date`() { + val initialExpression = someCMConverterBooleanField() + val substituteExpression = someDate() + val expected = NvlExpression(initialExpression.toDopeType(), true.toDopeType()) + + val actual = nvl(initialExpression, substituteExpression) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/LogicalInfixTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/LogicalInfixTest.kt index 2ecb61cb..d16fa3e3 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/LogicalInfixTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/LogicalInfixTest.kt @@ -18,7 +18,7 @@ class LogicalInfixTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support or with CMField CMField`() { + fun `should support or with CMJsonField CMJsonField`() { val left = someCMBooleanField() val right = someCMBooleanField() val expected = OrExpression(left.toDopeType(), right.toDopeType()) @@ -29,7 +29,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support or with CMField type`() { + fun `should support or with CMJsonField type`() { val left = someCMBooleanField() val right = someBooleanField() val expected = OrExpression(left.toDopeType(), right) @@ -40,7 +40,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support or with type CMField`() { + fun `should support or with type CMJsonField`() { val left = someBooleanField() val right = someCMBooleanField() val expected = OrExpression(left, right.toDopeType()) @@ -51,7 +51,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support or with Boolean CMField`() { + fun `should support or with Boolean CMJsonField`() { val left = someBoolean() val right = someCMBooleanField() val expected = OrExpression(left.toDopeType(), right.toDopeType()) @@ -62,7 +62,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support or with CMField Boolean`() { + fun `should support or with CMJsonField Boolean`() { val left = someCMBooleanField() val right = someBoolean() val expected = OrExpression(left.toDopeType(), right.toDopeType()) @@ -73,7 +73,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support and with CMField CMField`() { + fun `should support and with CMJsonField CMJsonField`() { val left = someCMBooleanField() val right = someCMBooleanField() val expected = AndExpression(left.toDopeType(), right.toDopeType()) @@ -84,7 +84,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support and with CMField type`() { + fun `should support and with CMJsonField type`() { val left = someCMBooleanField() val right = someBooleanField() val expected = AndExpression(left.toDopeType(), right) @@ -95,7 +95,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support and with type CMField`() { + fun `should support and with type CMJsonField`() { val left = someBooleanField() val right = someCMBooleanField() val expected = AndExpression(left, right.toDopeType()) @@ -106,7 +106,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support and with Boolean CMField`() { + fun `should support and with Boolean CMJsonField`() { val left = someBoolean() val right = someCMBooleanField() val expected = AndExpression(left.toDopeType(), right.toDopeType()) @@ -117,7 +117,7 @@ class LogicalInfixTest : ManagerDependentTest { } @Test - fun `should support and with CMField Boolean`() { + fun `should support and with CMJsonField Boolean`() { val left = someCMBooleanField() val right = someBoolean() val expected = AndExpression(left.toDopeType(), right.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/NotTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/NotTest.kt index c88cc874..5d563f4c 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/NotTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/logical/NotTest.kt @@ -13,7 +13,7 @@ class NotTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support not with CMField CMField`() { + fun `should support not with CMJsonField CMJsonField`() { val expression = someCMBooleanField() val expected = NotExpression(expression.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/numeric/NumberFunctionTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/numeric/NumberFunctionTest.kt index e0a3a350..5ec9898c 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/numeric/NumberFunctionTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/numeric/NumberFunctionTest.kt @@ -32,7 +32,7 @@ class NumberFunctionTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support ABS number function with number CMField`() { + fun `should support ABS number function with number CMJsonField`() { val expected = "ABS(`CMNumberField`)" val actual = abs(someCMNumberField()).toDopeQuery(manager).queryString @@ -41,7 +41,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ACOS number function with number CMField`() { + fun `should support ACOS number function with number CMJsonField`() { val expected = "ACOS(`CMNumberField`)" val actual = acos(someCMNumberField()).toDopeQuery(manager).queryString @@ -50,7 +50,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ASIN number function with number CMField`() { + fun `should support ASIN number function with number CMJsonField`() { val expected = "ASIN(`CMNumberField`)" val actual = asin(someCMNumberField()).toDopeQuery(manager).queryString @@ -59,7 +59,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN number function with number CMField`() { + fun `should support ATAN number function with number CMJsonField`() { val expected = "ATAN(`CMNumberField`)" val actual = atan(someCMNumberField()).toDopeQuery(manager).queryString @@ -68,7 +68,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN2 number function with divisor and dividend as number CMField`() { + fun `should support ATAN2 number function with divisor and dividend as number CMJsonField`() { val expected = "ATAN2(`CMNumberField`, `anotherNumberField`)" val actual = atan2(someCMNumberField(), someCMNumberField("anotherNumberField")).toDopeQuery(manager).queryString @@ -77,7 +77,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN2 number function with divisor as number CMField and dividend as TypeExpression`() { + fun `should support ATAN2 number function with divisor as number CMJsonField and dividend as TypeExpression`() { val expected = "ATAN2(`CMNumberField`, 1)" val actual = atan2(someCMNumberField(), 1.toDopeType()).toDopeQuery(manager).queryString @@ -86,7 +86,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN2 number function with divisor as number CMField and dividend as Number`() { + fun `should support ATAN2 number function with divisor as number CMJsonField and dividend as Number`() { val expected = "ATAN2(`CMNumberField`, 1)" val actual = atan2(someCMNumberField(), 1).toDopeQuery(manager).queryString @@ -95,7 +95,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN2 number function with divisor as TypeExpression and dividend as number CMField`() { + fun `should support ATAN2 number function with divisor as TypeExpression and dividend as number CMJsonField`() { val expected = "ATAN2(1, `CMNumberField`)" val actual = atan2(1.toDopeType(), someCMNumberField()).toDopeQuery(manager).queryString @@ -104,7 +104,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ATAN2 number function with divisor as Number and dividend as number CMField`() { + fun `should support ATAN2 number function with divisor as Number and dividend as number CMJsonField`() { val expected = "ATAN2(1, `CMNumberField`)" val actual = atan2(1, someCMNumberField()).toDopeQuery(manager).queryString @@ -113,7 +113,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support CEIL number function with number CMField`() { + fun `should support CEIL number function with number CMJsonField`() { val expected = "CEIL(`CMNumberField`)" val actual = ceil(someCMNumberField()).toDopeQuery(manager).queryString @@ -122,7 +122,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support COS number function with number CMField`() { + fun `should support COS number function with number CMJsonField`() { val expected = "COS(`CMNumberField`)" val actual = cos(someCMNumberField()).toDopeQuery(manager).queryString @@ -131,7 +131,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support DEGREES number function with number CMField`() { + fun `should support DEGREES number function with number CMJsonField`() { val expected = "DEGREES(`CMNumberField`)" val actual = degrees(someCMNumberField()).toDopeQuery(manager).queryString @@ -140,7 +140,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support EXP number function with number CMField`() { + fun `should support EXP number function with number CMJsonField`() { val expected = "EXP(`CMNumberField`)" val actual = exp(someCMNumberField()).toDopeQuery(manager).queryString @@ -149,7 +149,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support LN number function with number CMField`() { + fun `should support LN number function with number CMJsonField`() { val expected = "LN(`CMNumberField`)" val actual = ln(someCMNumberField()).toDopeQuery(manager).queryString @@ -158,7 +158,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support LOG number function with number CMField`() { + fun `should support LOG number function with number CMJsonField`() { val expected = "LOG(`CMNumberField`)" val actual = log(someCMNumberField()).toDopeQuery(manager).queryString @@ -167,7 +167,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support FLOOR number function with number CMField`() { + fun `should support FLOOR number function with number CMJsonField`() { val expected = "FLOOR(`CMNumberField`)" val actual = floor(someCMNumberField()).toDopeQuery(manager).queryString @@ -176,7 +176,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support POWER number function with base and exponent as number CMField`() { + fun `should support POWER number function with base and exponent as number CMJsonField`() { val expected = "POWER(`CMNumberField`, `anotherNumberField`)" val actual = power(someCMNumberField(), someCMNumberField("anotherNumberField")).toDopeQuery(manager).queryString @@ -185,7 +185,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support POWER number function with base as number CMField and exponent as TypeExpression`() { + fun `should support POWER number function with base as number CMJsonField and exponent as TypeExpression`() { val expected = "POWER(`CMNumberField`, 1)" val actual = power(someCMNumberField(), 1.toDopeType()).toDopeQuery(manager).queryString @@ -194,7 +194,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support POWER number function with base as number CMField and exponent as Number`() { + fun `should support POWER number function with base as number CMJsonField and exponent as Number`() { val expected = "POWER(`CMNumberField`, 1)" val actual = power(someCMNumberField(), 1).toDopeQuery(manager).queryString @@ -203,7 +203,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support POWER number function with base as TypeExpression and exponent as number CMField`() { + fun `should support POWER number function with base as TypeExpression and exponent as number CMJsonField`() { val expected = "POWER(1, `CMNumberField`)" val actual = power(1.toDopeType(), someCMNumberField()).toDopeQuery(manager).queryString @@ -212,7 +212,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support POWER number function with base as Number and exponent as number CMField`() { + fun `should support POWER number function with base as Number and exponent as number CMJsonField`() { val expected = "POWER(1, `CMNumberField`)" val actual = power(1, someCMNumberField()).toDopeQuery(manager).queryString @@ -221,7 +221,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support RADIANS number function with number CMField`() { + fun `should support RADIANS number function with number CMJsonField`() { val expected = "RADIANS(`CMNumberField`)" val actual = radians(someCMNumberField()).toDopeQuery(manager).queryString @@ -230,7 +230,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support RANDOM number function with number CMField`() { + fun `should support RANDOM number function with number CMJsonField`() { val expected = "RANDOM(`CMNumberField`)" val actual = random(someCMNumberField()).toDopeQuery(manager).queryString @@ -239,7 +239,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with number CMField`() { + fun `should support ROUND number function with number CMJsonField`() { val expected = "ROUND(`CMNumberField`)" val actual = round(someCMNumberField()).toDopeQuery(manager).queryString @@ -248,7 +248,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with value and digits as number CMField`() { + fun `should support ROUND number function with value and digits as number CMJsonField`() { val expected = "ROUND(`CMNumberField`, `anotherNumberField`)" val actual = round(someCMNumberField(), someCMNumberField("anotherNumberField")).toDopeQuery(manager).queryString @@ -257,7 +257,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with value as number CMField and digits as TypeExpression`() { + fun `should support ROUND number function with value as number CMJsonField and digits as TypeExpression`() { val expected = "ROUND(`CMNumberField`, 1)" val actual = round(someCMNumberField(), 1.toDopeType()).toDopeQuery(manager).queryString @@ -266,7 +266,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with value as number CMField and digits as Number`() { + fun `should support ROUND number function with value as number CMJsonField and digits as Number`() { val expected = "ROUND(`CMNumberField`, 1)" val actual = round(someCMNumberField(), 1).toDopeQuery(manager).queryString @@ -275,7 +275,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with value as TypeExpression and digits as number CMField`() { + fun `should support ROUND number function with value as TypeExpression and digits as number CMJsonField`() { val expected = "ROUND(1, `CMNumberField`)" val actual = round(1.toDopeType(), someCMNumberField()).toDopeQuery(manager).queryString @@ -284,7 +284,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support ROUND number function with value as Number and digits as number CMField`() { + fun `should support ROUND number function with value as Number and digits as number CMJsonField`() { val expected = "ROUND(1, `CMNumberField`)" val actual = round(1, someCMNumberField()).toDopeQuery(manager).queryString @@ -293,7 +293,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support SIGN number function with number CMField`() { + fun `should support SIGN number function with number CMJsonField`() { val expected = "SIGN(`CMNumberField`)" val actual = sign(someCMNumberField()).toDopeQuery(manager).queryString @@ -302,7 +302,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support SIN number function with number CMField`() { + fun `should support SIN number function with number CMJsonField`() { val expected = "SIN(`CMNumberField`)" val actual = sin(someCMNumberField()).toDopeQuery(manager).queryString @@ -311,7 +311,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support SQRT number function with number CMField`() { + fun `should support SQRT number function with number CMJsonField`() { val expected = "SQRT(`CMNumberField`)" val actual = sqrt(someCMNumberField()).toDopeQuery(manager).queryString @@ -320,7 +320,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TAN number function with number CMField`() { + fun `should support TAN number function with number CMJsonField`() { val expected = "TAN(`CMNumberField`)" val actual = tan(someCMNumberField()).toDopeQuery(manager).queryString @@ -329,7 +329,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with number CMField`() { + fun `should support TRUNC number function with number CMJsonField`() { val expected = "TRUNC(`CMNumberField`)" val actual = trunc(someCMNumberField()).toDopeQuery(manager).queryString @@ -338,7 +338,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with value and digits as number CMField`() { + fun `should support TRUNC number function with value and digits as number CMJsonField`() { val expected = "TRUNC(`CMNumberField`, `anotherNumberField`)" val actual = trunc(someCMNumberField(), someCMNumberField("anotherNumberField")).toDopeQuery(manager).queryString @@ -347,7 +347,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with value as number CMField and digits as TypeExpression`() { + fun `should support TRUNC number function with value as number CMJsonField and digits as TypeExpression`() { val expected = "TRUNC(`CMNumberField`, 1)" val actual = trunc(someCMNumberField(), 1.toDopeType()).toDopeQuery(manager).queryString @@ -356,7 +356,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with value as number CMField and digits as Number`() { + fun `should support TRUNC number function with value as number CMJsonField and digits as Number`() { val expected = "TRUNC(`CMNumberField`, 1)" val actual = trunc(someCMNumberField(), 1).toDopeQuery(manager).queryString @@ -365,7 +365,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with value as TypeExpression and digits as number CMField`() { + fun `should support TRUNC number function with value as TypeExpression and digits as number CMJsonField`() { val expected = "TRUNC(1, `CMNumberField`)" val actual = trunc(1.toDopeType(), someCMNumberField()).toDopeQuery(manager).queryString @@ -374,7 +374,7 @@ class NumberFunctionTest : ManagerDependentTest { } @Test - fun `should support TRUNC number function with value as Number and digits as number CMField`() { + fun `should support TRUNC number function with value as Number and digits as number CMJsonField`() { val expected = "TRUNC(1, `CMNumberField`)" val actual = trunc(1, someCMNumberField()).toDopeQuery(manager).queryString diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/EqualsTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/EqualsTest.kt index 8568f137..df9c42ec 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/EqualsTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/EqualsTest.kt @@ -7,8 +7,12 @@ import ch.ergon.dope.helper.ManagerDependentTest import ch.ergon.dope.helper.someBoolean import ch.ergon.dope.helper.someBooleanField import ch.ergon.dope.helper.someCMBooleanField +import ch.ergon.dope.helper.someCMConverterBooleanField +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMStringField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someString @@ -24,7 +28,7 @@ class EqualsTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support equals to with CMFieldNumber CMFieldNumber`() { + fun `should support equals to with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -35,7 +39,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldNumber NumberType`() { + fun `should support equals to with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = EqualsExpression(left.toDopeType(), right) @@ -46,7 +50,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with NumberType CMFieldNumber`() { + fun `should support equals to with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = EqualsExpression(left, right.toDopeType()) @@ -57,7 +61,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with Number CMFieldNumber`() { + fun `should support equals to with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -68,7 +72,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldNumber Number`() { + fun `should support equals to with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -79,7 +83,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldString CMFieldString`() { + fun `should support equals to with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -90,7 +94,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldString StringType`() { + fun `should support equals to with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = EqualsExpression(left.toDopeType(), right) @@ -101,7 +105,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with StringType CMFieldNumber`() { + fun `should support equals to with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = EqualsExpression(left, right.toDopeType()) @@ -112,7 +116,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with String CMFieldString`() { + fun `should support equals to with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -123,7 +127,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldString String`() { + fun `should support equals to with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -134,7 +138,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldBoolean CMFieldBoolean`() { + fun `should support equals to with CMJsonFieldBoolean CMJsonFieldBoolean`() { val left = someCMBooleanField() val right = someCMBooleanField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -145,7 +149,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldBoolean BooleanType`() { + fun `should support equals to with CMJsonFieldBoolean BooleanType`() { val left = someCMBooleanField() val right = someBooleanField() val expected = EqualsExpression(left.toDopeType(), right) @@ -156,7 +160,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with BooleanType CMFieldBoolean`() { + fun `should support equals to with BooleanType CMJsonFieldBoolean`() { val left = someBooleanField() val right = someCMBooleanField() val expected = EqualsExpression(left, right.toDopeType()) @@ -167,7 +171,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with Boolean CMFieldBoolean`() { + fun `should support equals to with Boolean CMJsonFieldBoolean`() { val left = someBoolean() val right = someCMBooleanField() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -178,7 +182,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support equals to with CMFieldBoolean Boolean`() { + fun `should support equals to with CMJsonFieldBoolean Boolean`() { val left = someCMBooleanField() val right = someBoolean() val expected = EqualsExpression(left.toDopeType(), right.toDopeType()) @@ -189,7 +193,73 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldNumber CMFieldNumber`() { + fun `should support equals to with CMConverterNumberField date`() { + val left = someCMConverterNumberField() + val right = someDate() + val expected = EqualsExpression(left.toDopeType(), right.toInstant().epochSecond.toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support equals to with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = EqualsExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support equals to with CMConverterStringField date`() { + val left = someCMConverterStringField() + val right = someDate() + val expected = EqualsExpression(left.toDopeType(), right.toInstant().epochSecond.toString().toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support equals to with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringField() + val expected = EqualsExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support equals to with CMConverterBooleanField date`() { + val left = someCMConverterBooleanField() + val right = someDate() + val expected = EqualsExpression(left.toDopeType(), true.toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support equals to with date CMConverterBooleanField`() { + val left = someDate() + val right = someCMConverterBooleanField() + val expected = EqualsExpression(true.toDopeType(), right.toDopeType()) + + val actual = left.isEqualTo(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support not equals to with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -200,7 +270,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldNumber NumberType`() { + fun `should support not equals to with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = NotEqualsExpression(left.toDopeType(), right) @@ -211,7 +281,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with NumberType CMFieldNumber`() { + fun `should support not equals to with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = NotEqualsExpression(left, right.toDopeType()) @@ -222,7 +292,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with Number CMFieldNumber`() { + fun `should support not equals to with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -233,7 +303,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldNumber Number`() { + fun `should support not equals to with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -244,7 +314,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldString CMFieldString`() { + fun `should support not equals to with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -255,7 +325,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldString StringType`() { + fun `should support not equals to with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = NotEqualsExpression(left.toDopeType(), right) @@ -266,7 +336,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with StringType CMFieldNumber`() { + fun `should support not equals to with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = NotEqualsExpression(left, right.toDopeType()) @@ -277,7 +347,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with String CMFieldString`() { + fun `should support not equals to with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -288,7 +358,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldString String`() { + fun `should support not equals to with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -299,7 +369,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldBoolean CMFieldBoolean`() { + fun `should support not equals to with CMJsonFieldBoolean CMJsonFieldBoolean`() { val left = someCMBooleanField() val right = someCMBooleanField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -310,7 +380,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldBoolean BooleanType`() { + fun `should support not equals to with CMJsonFieldBoolean BooleanType`() { val left = someCMBooleanField() val right = someBooleanField() val expected = NotEqualsExpression(left.toDopeType(), right) @@ -321,7 +391,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with BooleanType CMFieldBoolean`() { + fun `should support not equals to with BooleanType CMJsonFieldBoolean`() { val left = someBooleanField() val right = someCMBooleanField() val expected = NotEqualsExpression(left, right.toDopeType()) @@ -332,7 +402,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with Boolean CMFieldBoolean`() { + fun `should support not equals to with Boolean CMJsonFieldBoolean`() { val left = someBoolean() val right = someCMBooleanField() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) @@ -343,7 +413,7 @@ class EqualsTest : ManagerDependentTest { } @Test - fun `should support not equals to with CMFieldBoolean Boolean`() { + fun `should support not equals to with CMJsonFieldBoolean Boolean`() { val left = someCMBooleanField() val right = someBoolean() val expected = NotEqualsExpression(left.toDopeType(), right.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterOrEqualThanTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterOrEqualThanTest.kt index a4184a80..77a7d7af 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterOrEqualThanTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterOrEqualThanTest.kt @@ -3,8 +3,11 @@ package ch.ergon.dope.extensions.type.relational import ch.ergon.dope.DopeQueryManager import ch.ergon.dope.extension.type.relational.isGreaterOrEqualThan import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMStringField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someString @@ -19,7 +22,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support greater or equal than with CMFieldNumber CMFieldNumber`() { + fun `should support greater or equal than with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -30,7 +33,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with CMFieldNumber NumberType`() { + fun `should support greater or equal than with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right) @@ -41,7 +44,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with NumberType CMFieldNumber`() { + fun `should support greater or equal than with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = GreaterOrEqualThanExpression(left, right.toDopeType()) @@ -52,7 +55,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with Number CMFieldNumber`() { + fun `should support greater or equal than with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -63,7 +66,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with CMFieldNumber Number`() { + fun `should support greater or equal than with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -74,7 +77,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with CMFieldString CMFieldString`() { + fun `should support greater or equal than with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -85,7 +88,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with CMFieldString StringType`() { + fun `should support greater or equal than with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right) @@ -96,7 +99,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with StringType CMFieldNumber`() { + fun `should support greater or equal than with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = GreaterOrEqualThanExpression(left, right.toDopeType()) @@ -107,7 +110,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with String CMFieldString`() { + fun `should support greater or equal than with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -118,7 +121,7 @@ class GreaterOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support greater or equal than with CMFieldString String`() { + fun `should support greater or equal than with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -127,4 +130,48 @@ class GreaterOrEqualThanTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support greater or equal than with CMConverterNumberField date`() { + val left = someCMConverterNumberField() + val right = someDate() + val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toInstant().epochSecond.toDopeType()) + + val actual = left.isGreaterOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater or equal than with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = GreaterOrEqualThanExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.isGreaterOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater or equal than with CMConverterStringField date`() { + val left = someCMConverterStringField() + val right = someDate() + val expected = GreaterOrEqualThanExpression(left.toDopeType(), right.toInstant().epochSecond.toString().toDopeType()) + + val actual = left.isGreaterOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater or equal than with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringField() + val expected = GreaterOrEqualThanExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.isGreaterOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterThanTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterThanTest.kt index d9c5b3b9..66b3c1fa 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterThanTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/GreaterThanTest.kt @@ -3,8 +3,11 @@ package ch.ergon.dope.extensions.type.relational import ch.ergon.dope.DopeQueryManager import ch.ergon.dope.extension.type.relational.isGreaterThan import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMStringField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someString @@ -19,7 +22,7 @@ class GreaterThanTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support greater than with CMFieldNumber CMFieldNumber`() { + fun `should support greater than with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -30,7 +33,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with CMFieldNumber NumberType`() { + fun `should support greater than with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = GreaterThanExpression(left.toDopeType(), right) @@ -41,7 +44,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with NumberType CMFieldNumber`() { + fun `should support greater than with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = GreaterThanExpression(left, right.toDopeType()) @@ -52,7 +55,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with Number CMFieldNumber`() { + fun `should support greater than with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -63,7 +66,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with CMFieldNumber Number`() { + fun `should support greater than with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -74,7 +77,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with CMFieldString CMFieldString`() { + fun `should support greater than with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -85,7 +88,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with CMFieldString StringType`() { + fun `should support greater than with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = GreaterThanExpression(left.toDopeType(), right) @@ -96,7 +99,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with StringType CMFieldNumber`() { + fun `should support greater than with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = GreaterThanExpression(left, right.toDopeType()) @@ -107,7 +110,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with String CMFieldString`() { + fun `should support greater than with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -118,7 +121,7 @@ class GreaterThanTest : ManagerDependentTest { } @Test - fun `should support greater than with CMFieldString String`() { + fun `should support greater than with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = GreaterThanExpression(left.toDopeType(), right.toDopeType()) @@ -127,4 +130,48 @@ class GreaterThanTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support greater than with CMConverterNumberField date`() { + val left = someCMConverterNumberField() + val right = someDate() + val expected = GreaterThanExpression(left.toDopeType(), right.toInstant().epochSecond.toDopeType()) + + val actual = left.isGreaterThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater than with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = GreaterThanExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.isGreaterThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater than with CMConverterStringField date`() { + val left = someCMConverterStringField() + val right = someDate() + val expected = GreaterThanExpression(left.toDopeType(), right.toInstant().epochSecond.toString().toDopeType()) + + val actual = left.isGreaterThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support greater than with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringField() + val expected = GreaterThanExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.isGreaterThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/InTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/InTest.kt index 16f24a20..a57b508b 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/InTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/InTest.kt @@ -9,10 +9,14 @@ import ch.ergon.dope.helper.someBooleanField import ch.ergon.dope.helper.someBooleanFieldList import ch.ergon.dope.helper.someCMBooleanField import ch.ergon.dope.helper.someCMBooleanList +import ch.ergon.dope.helper.someCMConverterBooleanList +import ch.ergon.dope.helper.someCMConverterNumberList +import ch.ergon.dope.helper.someCMConverterStringList import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMNumberList import ch.ergon.dope.helper.someCMStringField import ch.ergon.dope.helper.someCMStringList +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someNumberFieldList @@ -30,7 +34,7 @@ class InTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support in array with CMFieldNumber ListNumber`() { + fun `should support in array with CMJsonFieldNumber ListNumber`() { val left = someCMNumberField() val right = someNumberFieldList() val expected = InExpression(left.toDopeType(), right) @@ -41,7 +45,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldString ListString`() { + fun `should support in array with CMJsonFieldString ListString`() { val left = someCMStringField() val right = someStringFieldList() val expected = InExpression(left.toDopeType(), right) @@ -52,7 +56,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldBoolean ListBoolean`() { + fun `should support in array with CMJsonFieldBoolean ListBoolean`() { val left = someCMBooleanField() val right = someBooleanFieldList() val expected = InExpression(left.toDopeType(), right) @@ -63,7 +67,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldNumber CMListNumber`() { + fun `should support in array with CMJsonFieldNumber CMJsonListNumber`() { val left = someCMNumberField() val right = someCMNumberList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -74,7 +78,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldString CMListString`() { + fun `should support in array with CMJsonFieldString CMJsonListString`() { val left = someCMStringField() val right = someCMStringList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -85,7 +89,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldBoolean CMListBoolean`() { + fun `should support in array with CMJsonFieldBoolean CMJsonListBoolean`() { val left = someCMBooleanField() val right = someCMBooleanList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -96,7 +100,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldNumber Collection`() { + fun `should support in array with CMJsonFieldNumber Collection`() { val left = someCMNumberField() val right = listOf(someNumberField()) val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -107,7 +111,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldString Collection`() { + fun `should support in array with CMJsonFieldString Collection`() { val left = someCMStringField() val right = listOf(someStringField()) val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -118,7 +122,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with CMFieldBoolean Collection`() { + fun `should support in array with CMJsonFieldBoolean Collection`() { val left = someCMBooleanField() val right = listOf(someBooleanField()) val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -129,7 +133,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with Number CMList`() { + fun `should support in array with Number CMJsonList`() { val left = someNumber() val right = someCMNumberList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -140,7 +144,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with String CMList`() { + fun `should support in array with String CMJsonList`() { val left = someString() val right = someCMStringList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -151,7 +155,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support in array with Boolean CMList`() { + fun `should support in array with Boolean CMJsonList`() { val left = someBoolean() val right = someCMBooleanList() val expected = InExpression(left.toDopeType(), right.toDopeType()) @@ -162,7 +166,40 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldNumber ListNumber`() { + fun `should support in array with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberList() + val expected = InExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.inArray(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support in array with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringList() + val expected = InExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.inArray(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support in array with date CMConverterBooleanField`() { + val left = someDate() + val right = someCMConverterBooleanList() + val expected = InExpression(true.toDopeType(), right.toDopeType()) + + val actual = left.inArray(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support not in array with CMJsonFieldNumber ListNumber`() { val left = someCMNumberField() val right = someNumberFieldList() val expected = NotInExpression(left.toDopeType(), right) @@ -173,7 +210,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldString ListString`() { + fun `should support not in array with CMJsonFieldString ListString`() { val left = someCMStringField() val right = someStringFieldList() val expected = NotInExpression(left.toDopeType(), right) @@ -184,7 +221,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldBoolean ListBoolean`() { + fun `should support not in array with CMJsonFieldBoolean ListBoolean`() { val left = someCMBooleanField() val right = someBooleanFieldList() val expected = NotInExpression(left.toDopeType(), right) @@ -195,7 +232,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldNumber CMListNumber`() { + fun `should support not in array with CMJsonFieldNumber CMJsonListNumber`() { val left = someCMNumberField() val right = someCMNumberList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -206,7 +243,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldString CMListString`() { + fun `should support not in array with CMJsonFieldString CMJsonListString`() { val left = someCMStringField() val right = someCMStringList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -217,7 +254,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldBoolean CMListBoolean`() { + fun `should support not in array with CMJsonFieldBoolean CMJsonListBoolean`() { val left = someCMBooleanField() val right = someCMBooleanList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -228,7 +265,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldNumber Collection`() { + fun `should support not in array with CMJsonFieldNumber Collection`() { val left = someCMNumberField() val right = listOf(someNumberField()) val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -239,7 +276,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldString Collection`() { + fun `should support not in array with CMJsonFieldString Collection`() { val left = someCMStringField() val right = listOf(someStringField()) val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -250,7 +287,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with CMFieldBoolean Collection`() { + fun `should support not in array with CMJsonFieldBoolean Collection`() { val left = someCMBooleanField() val right = listOf(someBooleanField()) val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -261,7 +298,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with Number CMList`() { + fun `should support not in array with Number CMJsonList`() { val left = someNumber() val right = someCMNumberList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -272,7 +309,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with String CMList`() { + fun `should support not in array with String CMJsonList`() { val left = someString() val right = someCMStringList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) @@ -283,7 +320,7 @@ class InTest : ManagerDependentTest { } @Test - fun `should support not in array with Boolean CMList`() { + fun `should support not in array with Boolean CMJsonList`() { val left = someBoolean() val right = someCMBooleanList() val expected = NotInExpression(left.toDopeType(), right.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsMissingTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsMissingTest.kt index 3f7050f8..6af915a5 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsMissingTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsMissingTest.kt @@ -17,7 +17,7 @@ class IsMissingTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support isMissing CMFieldNumber`() { + fun `should support isMissing CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsMissingExpression(field.toDopeType()) @@ -27,7 +27,7 @@ class IsMissingTest : ManagerDependentTest { } @Test - fun `should support isMissing CMFieldString`() { + fun `should support isMissing CMJsonFieldString`() { val field = someCMStringField() val expected = IsMissingExpression(field.toDopeType()) @@ -37,7 +37,7 @@ class IsMissingTest : ManagerDependentTest { } @Test - fun `should support isMissing CMFieldBoolean`() { + fun `should support isMissing CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsMissingExpression(field.toDopeType()) @@ -47,7 +47,7 @@ class IsMissingTest : ManagerDependentTest { } @Test - fun `should support is not Missing CMFieldNumber`() { + fun `should support is not Missing CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsNotMissingExpression(field.toDopeType()) @@ -57,7 +57,7 @@ class IsMissingTest : ManagerDependentTest { } @Test - fun `should support is not Missing CMFieldString`() { + fun `should support is not Missing CMJsonFieldString`() { val field = someCMStringField() val expected = IsNotMissingExpression(field.toDopeType()) @@ -67,7 +67,7 @@ class IsMissingTest : ManagerDependentTest { } @Test - fun `should support is not Missing CMFieldBoolean`() { + fun `should support is not Missing CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsNotMissingExpression(field.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsNullTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsNullTest.kt index c43f1f8b..a7a48be2 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsNullTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsNullTest.kt @@ -17,7 +17,7 @@ class IsNullTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support is Null CMFieldNumber`() { + fun `should support is Null CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsNullExpression(field.toDopeType()) @@ -27,7 +27,7 @@ class IsNullTest : ManagerDependentTest { } @Test - fun `should support is Null CMFieldString`() { + fun `should support is Null CMJsonFieldString`() { val field = someCMStringField() val expected = IsNullExpression(field.toDopeType()) @@ -37,7 +37,7 @@ class IsNullTest : ManagerDependentTest { } @Test - fun `should support is Null CMFieldBoolean`() { + fun `should support is Null CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsNullExpression(field.toDopeType()) @@ -47,7 +47,7 @@ class IsNullTest : ManagerDependentTest { } @Test - fun `should support is not Null CMFieldNumber`() { + fun `should support is not Null CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsNotNullExpression(field.toDopeType()) @@ -57,7 +57,7 @@ class IsNullTest : ManagerDependentTest { } @Test - fun `should support is not Null CMFieldString`() { + fun `should support is not Null CMJsonFieldString`() { val field = someCMStringField() val expected = IsNotNullExpression(field.toDopeType()) @@ -67,7 +67,7 @@ class IsNullTest : ManagerDependentTest { } @Test - fun `should support is not Null CMFieldBoolean`() { + fun `should support is not Null CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsNotNullExpression(field.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsValuedTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsValuedTest.kt index 5cd52886..467a89df 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsValuedTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/IsValuedTest.kt @@ -17,7 +17,7 @@ class IsValuedTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support Valued CMFieldNumber`() { + fun `should support Valued CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsValuedExpression(field.toDopeType()) @@ -27,7 +27,7 @@ class IsValuedTest : ManagerDependentTest { } @Test - fun `should support Valued CMFieldString`() { + fun `should support Valued CMJsonFieldString`() { val field = someCMStringField() val expected = IsValuedExpression(field.toDopeType()) @@ -37,7 +37,7 @@ class IsValuedTest : ManagerDependentTest { } @Test - fun `should support Valued CMFieldBoolean`() { + fun `should support Valued CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsValuedExpression(field.toDopeType()) @@ -47,7 +47,7 @@ class IsValuedTest : ManagerDependentTest { } @Test - fun `should support is not Valued CMFieldNumber`() { + fun `should support is not Valued CMJsonFieldNumber`() { val field = someCMNumberField() val expected = IsNotValuedExpression(field.toDopeType()) @@ -57,7 +57,7 @@ class IsValuedTest : ManagerDependentTest { } @Test - fun `should support is not Valued CMFieldString`() { + fun `should support is not Valued CMJsonFieldString`() { val field = someCMStringField() val expected = IsNotValuedExpression(field.toDopeType()) @@ -67,7 +67,7 @@ class IsValuedTest : ManagerDependentTest { } @Test - fun `should support is not Valued CMFieldBoolean`() { + fun `should support is not Valued CMJsonFieldBoolean`() { val field = someCMBooleanField() val expected = IsNotValuedExpression(field.toDopeType()) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessOrEqualThanTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessOrEqualThanTest.kt index 75bedb50..4c55ff66 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessOrEqualThanTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessOrEqualThanTest.kt @@ -3,8 +3,11 @@ package ch.ergon.dope.extensions.type.relational import ch.ergon.dope.DopeQueryManager import ch.ergon.dope.extension.type.relational.isLessOrEqualThan import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMStringField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someString @@ -19,7 +22,7 @@ class LessOrEqualThanTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support less or equal than with CMFieldNumber CMFieldNumber`() { + fun `should support less or equal than with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -30,7 +33,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with CMFieldNumber NumberType`() { + fun `should support less or equal than with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = LessOrEqualThanExpression(left.toDopeType(), right) @@ -41,7 +44,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with NumberType CMFieldNumber`() { + fun `should support less or equal than with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = LessOrEqualThanExpression(left, right.toDopeType()) @@ -52,7 +55,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with Number CMFieldNumber`() { + fun `should support less or equal than with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -63,7 +66,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with CMFieldNumber Number`() { + fun `should support less or equal than with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -74,7 +77,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with CMFieldString CMFieldString`() { + fun `should support less or equal than with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -85,7 +88,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with CMFieldString StringType`() { + fun `should support less or equal than with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = LessOrEqualThanExpression(left.toDopeType(), right) @@ -96,7 +99,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with StringType CMFieldNumber`() { + fun `should support less or equal than with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = LessOrEqualThanExpression(left, right.toDopeType()) @@ -107,7 +110,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with String CMFieldString`() { + fun `should support less or equal than with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -118,7 +121,7 @@ class LessOrEqualThanTest : ManagerDependentTest { } @Test - fun `should support less or equal than with CMFieldString String`() { + fun `should support less or equal than with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = LessOrEqualThanExpression(left.toDopeType(), right.toDopeType()) @@ -127,4 +130,48 @@ class LessOrEqualThanTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support less or equal than with CMConverterNumberField date`() { + val left = someCMConverterNumberField() + val right = someDate() + val expected = LessOrEqualThanExpression(left.toDopeType(), right.toInstant().epochSecond.toDopeType()) + + val actual = left.isLessOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less or equal than with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = LessOrEqualThanExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.isLessOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less or equal than with CMConverterStringField date`() { + val left = someCMConverterStringField() + val right = someDate() + val expected = LessOrEqualThanExpression(left.toDopeType(), right.toInstant().epochSecond.toString().toDopeType()) + + val actual = left.isLessOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less or equal than with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringField() + val expected = LessOrEqualThanExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.isLessOrEqualThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessThanTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessThanTest.kt index fcd9d2d4..a0c40c2e 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessThanTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LessThanTest.kt @@ -3,8 +3,11 @@ package ch.ergon.dope.extensions.type.relational import ch.ergon.dope.DopeQueryManager import ch.ergon.dope.extension.type.relational.isLessThan import ch.ergon.dope.helper.ManagerDependentTest +import ch.ergon.dope.helper.someCMConverterNumberField +import ch.ergon.dope.helper.someCMConverterStringField import ch.ergon.dope.helper.someCMNumberField import ch.ergon.dope.helper.someCMStringField +import ch.ergon.dope.helper.someDate import ch.ergon.dope.helper.someNumber import ch.ergon.dope.helper.someNumberField import ch.ergon.dope.helper.someString @@ -19,7 +22,7 @@ class LessThanTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support less than with CMFieldNumber CMFieldNumber`() { + fun `should support less than with CMJsonFieldNumber CMJsonFieldNumber`() { val left = someCMNumberField() val right = someCMNumberField() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -30,7 +33,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with CMFieldNumber NumberType`() { + fun `should support less than with CMJsonFieldNumber NumberType`() { val left = someCMNumberField() val right = someNumberField() val expected = LessThanExpression(left.toDopeType(), right) @@ -41,7 +44,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with NumberType CMFieldNumber`() { + fun `should support less than with NumberType CMJsonFieldNumer`() { val left = someNumberField() val right = someCMNumberField() val expected = LessThanExpression(left, right.toDopeType()) @@ -52,7 +55,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with Number CMFieldNumber`() { + fun `should support less than with Number CMJsonFieldNumber`() { val left = someNumber() val right = someCMNumberField() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -63,7 +66,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with CMFieldNumber Number`() { + fun `should support less than with CMJsonFieldNumber Number`() { val left = someCMNumberField() val right = someNumber() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -74,7 +77,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with CMFieldString CMFieldString`() { + fun `should support less than with CMJsonFieldString CMJsonFieldString`() { val left = someCMStringField() val right = someCMStringField() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -85,7 +88,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with CMFieldString StringType`() { + fun `should support less than with CMJsonFieldString StringType`() { val left = someCMStringField() val right = someStringField() val expected = LessThanExpression(left.toDopeType(), right) @@ -96,7 +99,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with StringType CMFieldNumber`() { + fun `should support less than with StringType CMJsonFieldNumer`() { val left = someStringField() val right = someCMStringField() val expected = LessThanExpression(left, right.toDopeType()) @@ -107,7 +110,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with String CMFieldString`() { + fun `should support less than with String CMJsonFieldString`() { val left = someString() val right = someCMStringField() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -118,7 +121,7 @@ class LessThanTest : ManagerDependentTest { } @Test - fun `should support less than with CMFieldString String`() { + fun `should support less than with CMJsonFieldString String`() { val left = someCMStringField() val right = someString() val expected = LessThanExpression(left.toDopeType(), right.toDopeType()) @@ -127,4 +130,48 @@ class LessThanTest : ManagerDependentTest { assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) } + + @Test + fun `should support less than with CMConverterNumberField date`() { + val left = someCMConverterNumberField() + val right = someDate() + val expected = LessThanExpression(left.toDopeType(), right.toInstant().epochSecond.toDopeType()) + + val actual = left.isLessThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less than with date CMConverterNumberField`() { + val left = someDate() + val right = someCMConverterNumberField() + val expected = LessThanExpression(left.toInstant().epochSecond.toDopeType(), right.toDopeType()) + + val actual = left.isLessThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less than with CMConverterStringField date`() { + val left = someCMConverterStringField() + val right = someDate() + val expected = LessThanExpression(left.toDopeType(), right.toInstant().epochSecond.toString().toDopeType()) + + val actual = left.isLessThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } + + @Test + fun `should support less than with date CMConverterStringField`() { + val left = someDate() + val right = someCMConverterStringField() + val expected = LessThanExpression(left.toInstant().epochSecond.toString().toDopeType(), right.toDopeType()) + + val actual = left.isLessThan(right) + + assertEquals(expected.toDopeQuery(manager), actual.toDopeQuery(manager)) + } } diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LikeTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LikeTest.kt index 530d2e0b..1a96f59f 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LikeTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/LikeTest.kt @@ -16,7 +16,7 @@ class LikeTest : ManagerDependentTest { override lateinit var manager: DopeQueryManager @Test - fun `should support extensions for is like with CMField`() { + fun `should support extensions for is like with CMJsonField`() { val someCMStringField = someCMStringField() val right = "%".toDopeType() val expected = LikeExpression(someCMStringField.toDopeType(), right) @@ -27,7 +27,7 @@ class LikeTest : ManagerDependentTest { } @Test - fun `should support extensions for is not like with CMField`() { + fun `should support extensions for is not like with CMJsonField`() { val someCMStringField = someCMStringField() val right = "%".toDopeType() val expected = NotLikeExpression(someCMStringField.toDopeType(), right) diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/SatisfiesTest.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/SatisfiesTest.kt index 7bdd8739..fb94e356 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/SatisfiesTest.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/extensions/type/relational/SatisfiesTest.kt @@ -10,8 +10,8 @@ import ch.ergon.dope.resolvable.expression.unaliased.type.arithmetic.mod import ch.ergon.dope.resolvable.expression.unaliased.type.function.stringfunction.upper import ch.ergon.dope.resolvable.expression.unaliased.type.relational.isEqualTo import ch.ergon.dope.toDopeType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList import com.schwarz.crystalapi.schema.CMObjectList import com.schwarz.crystalapi.schema.Schema import kotlin.test.Test @@ -22,18 +22,18 @@ class SatisfiesTest : ManagerDependentTest { class Dummy(path: String = "") : Schema { val objectList: CMObjectList = CMObjectList(Dummy2(path), "objectList", path) - val stringList: CMList = CMList("stringList", path) - val numberList: CMList = CMList("numberList", path) - val booleanList: CMList = CMList("booleanList", path) + val stringList: CMJsonList = CMJsonList("stringList", path) + val numberList: CMJsonList = CMJsonList("numberList", path) + val booleanList: CMJsonList = CMJsonList("booleanList", path) } class Dummy2(path: String = "") : Schema { - val type: CMField = CMField("type", path) + val type: CMJsonField = CMJsonField("type", path) val otherObjectList: CMObjectList = CMObjectList(Dummy3(path), "otherObjectList", path) } class Dummy3(path: String = "") : Schema { - val something: CMField = CMField("something", path) + val something: CMJsonField = CMJsonField("something", path) } @Test @@ -65,7 +65,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support any satisfies with cmList number`() { + fun `should support any satisfies with CMJsonList number`() { val expected = DopeQuery( queryString = "ANY `iterator1` IN `numberList` SATISFIES (`iterator1` % 2) = 1 END", parameters = emptyMap(), @@ -77,7 +77,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support any satisfies with cmList string`() { + fun `should support any satisfies with CMJsonList string`() { val expected = DopeQuery( queryString = "ANY `iterator1` IN `stringList` SATISFIES UPPER(`iterator1`) = \"some value\" END", parameters = emptyMap(), @@ -89,7 +89,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support any satisfies with cmList boolean`() { + fun `should support any satisfies with CMJsonList boolean`() { val expected = DopeQuery( queryString = "ANY `iterator1` IN `booleanList` SATISFIES `iterator1` END", parameters = emptyMap(), @@ -144,7 +144,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support every satisfies with cmList number`() { + fun `should support every satisfies with CMJsonList number`() { val expected = DopeQuery( queryString = "EVERY `iterator1` IN `numberList` SATISFIES (`iterator1` % 2) = 1 END", parameters = emptyMap(), @@ -156,7 +156,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support every satisfies with cmList string`() { + fun `should support every satisfies with CMJsonList string`() { val expected = DopeQuery( queryString = "EVERY `iterator1` IN `stringList` SATISFIES UPPER(`iterator1`) = \"some value\" END", parameters = emptyMap(), @@ -168,7 +168,7 @@ class SatisfiesTest : ManagerDependentTest { } @Test - fun `should support every satisfies with cmList boolean`() { + fun `should support every satisfies with CMJsonList boolean`() { val expected = DopeQuery( queryString = "EVERY `iterator1` IN `booleanList` SATISFIES `iterator1` END", parameters = emptyMap(), diff --git a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/helper/Builder.kt b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/helper/Builder.kt index f1f12f83..555dea46 100644 --- a/crystal-map-connector/src/test/kotlin/ch/ergon/dope/helper/Builder.kt +++ b/crystal-map-connector/src/test/kotlin/ch/ergon/dope/helper/Builder.kt @@ -15,22 +15,44 @@ import ch.ergon.dope.validtype.ArrayType import ch.ergon.dope.validtype.BooleanType import ch.ergon.dope.validtype.NumberType import ch.ergon.dope.validtype.StringType -import com.schwarz.crystalapi.schema.CMField -import com.schwarz.crystalapi.schema.CMList +import com.schwarz.crystalapi.ITypeConverter +import com.schwarz.crystalapi.schema.CMConverterField +import com.schwarz.crystalapi.schema.CMConverterList +import com.schwarz.crystalapi.schema.CMJsonField +import com.schwarz.crystalapi.schema.CMJsonList +import java.time.Instant +import java.util.* fun someBucket(name: String = "someBucket") = UnaliasedBucket(name) -fun someCMNumberField(name: String = "CMNumberField", path: String = "") = CMField(name, path) -fun someCMStringField(name: String = "CMStringField", path: String = "") = CMField(name, path) -fun someCMBooleanField(name: String = "CMBooleanField", path: String = "") = CMField(name, path) +fun someCMNumberField(name: String = "CMNumberField", path: String = "") = CMJsonField(name, path) +fun someCMStringField(name: String = "CMStringField", path: String = "") = CMJsonField(name, path) +fun someCMBooleanField(name: String = "CMBooleanField", path: String = "") = CMJsonField(name, path) + +fun someCMConverterNumberField(name: String = "CMConverterNumberField", path: String = "") = + CMConverterField(name, path, DateNumberConverterInstance) +fun someCMConverterStringField(name: String = "CMConverterStringField", path: String = "") = + CMConverterField(name, path, DateStringConverterInstance) +fun someCMConverterBooleanField(name: String = "CMConverterBooleanField", path: String = "") = + CMConverterField(name, path, DateBooleanConverterInstance) + +fun someCorruptField(name: String = "corruptField", path: String = "") = + CMConverterField(name, path, CorruptStringNumberConverterInstance) fun someNumberFieldList(name: String = "numberFieldList", path: String = "") = Field>(name, path) fun someStringFieldList(name: String = "stringFieldList", path: String = "") = Field>(name, path) fun someBooleanFieldList(name: String = "booleanFieldList", path: String = "") = Field>(name, path) -fun someCMNumberList(name: String = "CMNumberList", path: String = "") = CMList(name, path) -fun someCMStringList(name: String = "CMStringList", path: String = "") = CMList(name, path) -fun someCMBooleanList(name: String = "CMBooleanList", path: String = "") = CMList(name, path) +fun someCMNumberList(name: String = "CMNumberList", path: String = "") = CMJsonList(name, path) +fun someCMStringList(name: String = "CMStringList", path: String = "") = CMJsonList(name, path) +fun someCMBooleanList(name: String = "CMBooleanList", path: String = "") = CMJsonList(name, path) + +fun someCMConverterNumberList(name: String = "CMConverterNumberList", path: String = "") = + CMConverterList(name, path, DateNumberConverterInstance) +fun someCMConverterStringList(name: String = "CMConverterStringList", path: String = "") = + CMConverterList(name, path, DateStringConverterInstance) +fun someCMConverterBooleanList(name: String = "CMConverterBooleanList", path: String = "") = + CMConverterList(name, path, DateBooleanConverterInstance) fun someSelect(expression: Expression = AsteriskExpression()) = SelectClause(expression) fun someFrom(fromable: Fromable = someBucket(), selectClause: SelectClause = someSelect()) = FromClause(fromable, selectClause) @@ -45,6 +67,8 @@ fun someString(value: String = "someString") = value fun someBoolean(value: Boolean = true) = value +fun someDate(value: Date = Date(12345)) = value + fun someNumberField(name: String = "numberField", bucket: Bucket = someBucket("")) = Field(name, getBucketName(bucket)) fun someStringField(name: String = "stringField", bucket: Bucket = someBucket("")) = Field(name, getBucketName(bucket)) fun someBooleanField(name: String = "booleanField", bucket: Bucket = someBucket("")) = Field(name, getBucketName(bucket)) @@ -53,3 +77,37 @@ private fun getBucketName(bucket: Bucket) = when (bucket) { is AliasedBucket -> bucket.alias is UnaliasedBucket -> bucket.name } + +object DateNumberConverterInstance : DateNumberConverter() + +abstract class DateNumberConverter : ITypeConverter { + override fun write(value: Date?): Number? = + value?.toInstant()?.epochSecond + + override fun read(value: Number?): Date? = value?.toLong()?.let { Date.from(Instant.ofEpochSecond(it)) } +} + +object DateStringConverterInstance : DateStringConverter() + +abstract class DateStringConverter : ITypeConverter { + override fun write(value: Date?): String? = + value?.toInstant()?.epochSecond.toString() + + override fun read(value: String?): Date? = value?.toLong()?.let { Date.from(Instant.ofEpochSecond(it)) } +} + +object DateBooleanConverterInstance : DateBooleanConverter() + +abstract class DateBooleanConverter : ITypeConverter { + override fun write(value: Date?): Boolean? = value != null + + override fun read(value: Boolean?): Date? = Date(1) +} + +object CorruptStringNumberConverterInstance : CorruptStringNumberConverter() + +abstract class CorruptStringNumberConverter : ITypeConverter { + override fun write(value: String?) = null + + override fun read(value: Number?) = null +}