Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ abstract class BaseIntegrationTest {
fun queryWithNamedParameters(dopeQuery: CouchbaseDopeQuery) =
queryExecution(
queryString = dopeQuery.queryString,
queryParameters = QueryParameters.named(dopeQuery.parameters.namedParameters),
queryParameters = QueryParameters.named {
dopeQuery.parameters.namedParameters.map {
param(it.key, it.value)
}
},
)

fun queryWithPositionalParameters(dopeQuery: CouchbaseDopeQuery) =
queryExecution(
queryString = dopeQuery.queryString,
queryParameters = QueryParameters.positional(dopeQuery.parameters.positionalParameters),
queryParameters = QueryParameters.positional {
dopeQuery.parameters.positionalParameters.map {
param(it)
}
},
)

private fun queryExecution(queryString: String, queryParameters: QueryParameters = QueryParameters.None) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ const val MAX_TIMEOUT_IN_SECONDS = 15
const val COUCHBASE_IMAGE = "couchbase/server:7.6.4"

object TestCouchbaseDatabase {
val container = CouchbaseContainer(
DockerImageName.parse(COUCHBASE_IMAGE),
)
val container = CouchbaseContainer(DockerImageName.parse(COUCHBASE_IMAGE))
val cluster: Cluster
val testBucket = UnaliasedBucket(BUCKET)
val testAppOrderAuditBucket = UnaliasedBucket(BUCKET, BucketScope("app", ScopeCollection("order_audit")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import com.schwarz.crystalapi.schema.CMJsonField
import com.schwarz.crystalapi.schema.CMJsonList
import com.schwarz.crystalapi.schema.CMType

fun QueryBuilder
.select(expression: CMType, vararg expressions: CMType) =
fun QueryBuilder.select(expression: CMType, vararg expressions: CMType) =
select(expression.toDopeType(), *expressions.map { it.toDopeType() }.toTypedArray())

fun QueryBuilder
.select(firstExpression: Selectable, secondExpression: CMType, vararg expressions: CMType) =
fun QueryBuilder.select(firstExpression: Selectable, secondExpression: CMType, vararg expressions: CMType) =
select(firstExpression, *listOf(secondExpression, *expressions).map { it.toDopeType() }.toTypedArray())

fun QueryBuilder
.select(firstExpression: CMType, secondExpression: Selectable, vararg expressions: Selectable) =
fun QueryBuilder.select(firstExpression: CMType, secondExpression: Selectable, vararg expressions: Selectable) =
select(firstExpression.toDopeType(), secondExpression, *expressions)

fun QueryBuilder.selectDistinct(expression: CMType, vararg expressions: CMType) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,25 @@ import com.schwarz.crystalapi.schema.CMJsonField
import com.schwarz.crystalapi.schema.CMJsonList

@JvmName("maxNumber")
fun max(field: CMJsonField<out Number>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonField<out Number>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)

@JvmName("maxString")
fun max(field: CMJsonField<String>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonField<String>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)

@JvmName("maxBoolean")
fun max(field: CMJsonField<Boolean>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonField<Boolean>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)

@JvmName("maxNumber")
fun max(field: CMJsonList<out Number>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonList<out Number>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)

@JvmName("maxString")
fun max(field: CMJsonList<String>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonList<String>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)

@JvmName("maxBoolean")
fun max(field: CMJsonList<Boolean>, quantifier: AggregateQuantifier? = null) = max(
field.toDopeType(),
quantifier,
)
fun max(field: CMJsonList<Boolean>, quantifier: AggregateQuantifier? = null) =
max(field.toDopeType(), quantifier)
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,25 @@ import com.schwarz.crystalapi.schema.CMJsonField
import com.schwarz.crystalapi.schema.CMJsonList

@JvmName("minNumber")
fun min(field: CMJsonField<out Number>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonField<out Number>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)

@JvmName("minString")
fun min(field: CMJsonField<String>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonField<String>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)

@JvmName("minBoolean")
fun min(field: CMJsonField<Boolean>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonField<Boolean>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)

@JvmName("minNumber")
fun min(field: CMJsonList<out Number>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonList<out Number>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)

@JvmName("minString")
fun min(field: CMJsonList<String>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonList<String>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)

@JvmName("minBoolean")
fun min(field: CMJsonList<Boolean>, quantifier: AggregateQuantifier? = null) = min(
field.toDopeType(),
quantifier,
)
fun min(field: CMJsonList<Boolean>, quantifier: AggregateQuantifier? = null) =
min(field.toDopeType(), quantifier)
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.initCap
import ch.ergon.dope.resolvable.expression.type.function.string.title
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.initCap() = toDopeType().initCap()

fun CMJsonField<String>.title() = toDopeType().title()

fun String.initCap() = toDopeType().initCap()

fun String.title() = toDopeType().title()
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.length
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.length() = toDopeType().length()

fun String.length() = toDopeType().length()
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.lower
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.lower() = toDopeType().lower()

fun String.lower() = toDopeType().lower()
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun TypeExpression<StringType>.ltrim(extra: CMJsonField<String>) =

fun CMJsonField<String>.ltrim(extra: TypeExpression<StringType>? = null) =
toDopeType().ltrim(extra)

fun String.ltrim(extra: TypeExpression<StringType>? = null) =
toDopeType().ltrim(extra)

fun String.ltrim(extra: String) =
toDopeType().ltrim(extra.toDopeType())
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.mbLength
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.mbLength() = toDopeType().mbLength()

fun String.mbLength() = toDopeType().mbLength()
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ fun TypeExpression<StringType>.mbLpad(size: CMJsonField<Number>, char: TypeExpre
fun TypeExpression<StringType>.mbLpad(size: TypeExpression<NumberType>, char: CMJsonField<String>) =
mbLpad(size, char.toDopeType())

fun TypeExpression<StringType>.mbLpad(size: TypeExpression<NumberType>, char: String) =
mbLpad(size, char.toDopeType())

fun String.mbLpad(size: CMJsonField<Number>, char: CMJsonField<String>) =
toDopeType().mbLpad(size.toDopeType(), char.toDopeType())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun String.mbPosition(searchStr: CMJsonField<String>) =

fun TypeExpression<StringType>.mbPosition(searchStr: CMJsonField<String>) =
mbPosition(searchStr.toDopeType())

fun String.mbPosition(searchStr: TypeExpression<StringType>) =
toDopeType().mbPosition(searchStr)

fun String.mbPosition(searchStr: String) =
toDopeType().mbPosition(searchStr.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun String.mbPosition1(searchStr: CMJsonField<String>) =

fun TypeExpression<StringType>.mbPosition1(searchStr: CMJsonField<String>) =
mbPosition1(searchStr.toDopeType())

fun String.mbPosition1(searchStr: TypeExpression<StringType>) =
toDopeType().mbPosition1(searchStr)

fun String.mbPosition1(searchStr: String) =
toDopeType().mbPosition1(searchStr.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ fun TypeExpression<StringType>.mbRpad(size: CMJsonField<Number>, prefix: TypeExp
fun TypeExpression<StringType>.mbRpad(size: TypeExpression<NumberType>, prefix: CMJsonField<String>) =
mbRpad(size, prefix.toDopeType())

fun TypeExpression<StringType>.mbRpad(size: TypeExpression<NumberType>, prefix: String) =
mbRpad(size, prefix.toDopeType())

fun String.mbRpad(size: CMJsonField<Number>, prefix: CMJsonField<String>) =
toDopeType().mbRpad(size.toDopeType(), prefix.toDopeType())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun String.position(searchStr: CMJsonField<String>) =

fun TypeExpression<StringType>.position(searchStr: CMJsonField<String>) =
position(searchStr.toDopeType())

fun String.position(searchStr: TypeExpression<StringType>) =
toDopeType().position(searchStr)

fun String.position(searchStr: String) =
toDopeType().position(searchStr.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun String.position1(searchStr: CMJsonField<String>) =

fun TypeExpression<StringType>.position1(searchStr: CMJsonField<String>) =
position1(searchStr.toDopeType())

fun String.position1(searchStr: TypeExpression<StringType>) =
toDopeType().position1(searchStr)

fun String.position1(searchStr: String) =
toDopeType().position1(searchStr.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,3 @@ fun TypeExpression<StringType>.repeat(repetitions: CMJsonField<Number>) =

fun String.repeat(repetitions: CMJsonField<Number>) =
toDopeType().repeat(repetitions.toDopeType())

fun String.repeat(repetitions: TypeExpression<NumberType>) =
toDopeType().repeat(repetitions)

fun String.repeat(repetitions: Number) =
toDopeType().repeat(repetitions.toDopeType())
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.reverse
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.reverse() = toDopeType().reverse()

fun String.reverse() = toDopeType().reverse()
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ fun TypeExpression<StringType>.rpad(size: CMJsonField<Number>, prefix: TypeExpre
fun TypeExpression<StringType>.rpad(size: TypeExpression<NumberType>, prefix: CMJsonField<String>) =
rpad(size, prefix.toDopeType())

fun TypeExpression<StringType>.rpad(size: TypeExpression<NumberType>, prefix: String) =
rpad(size, prefix.toDopeType())

fun String.rpad(size: CMJsonField<Number>, prefix: CMJsonField<String>) =
toDopeType().rpad(size.toDopeType(), prefix.toDopeType())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun TypeExpression<StringType>.rtrim(extra: CMJsonField<String>) =

fun CMJsonField<String>.rtrim(extra: TypeExpression<StringType>? = null) =
toDopeType().rtrim(extra)

fun String.rtrim(extra: TypeExpression<StringType>? = null) =
toDopeType().rtrim(extra)

fun String.rtrim(extra: String) =
toDopeType().rtrim(extra.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ fun TypeExpression<StringType>.split(inSubstring: CMJsonField<String>) =

fun CMJsonField<String>.split(inSubstring: TypeExpression<StringType>? = null) =
toDopeType().split(inSubstring)

fun String.split(inSubstring: TypeExpression<StringType>? = null) =
toDopeType().split(inSubstring)

fun String.split(inSubstring: String) =
toDopeType().split(inSubstring.toDopeType())
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.suffixes
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.suffixes() = toDopeType().suffixes()

fun String.suffixes() = toDopeType().suffixes()
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,3 @@ fun CMJsonField<String>.trim(char: Char) =

fun String.trim(char: CMJsonField<String>) =
toDopeType().trim(char.toDopeType())

fun String.trim(char: TypeExpression<StringType>? = null) =
toDopeType().trim(char)

fun String.trim(char: String) =
toDopeType().trim(char.toDopeType())
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.upper
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.upper() = toDopeType().upper()

fun String.upper() = toDopeType().upper()
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.urlDecode
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.urlDecode() = toDopeType().urlDecode()

fun String.urlDecode() = toDopeType().urlDecode()
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ch.ergon.dope.extension.expression.type.function.string

import ch.ergon.dope.resolvable.expression.type.function.string.urlEncode
import ch.ergon.dope.resolvable.expression.type.toDopeType
import ch.ergon.dope.toDopeType
import com.schwarz.crystalapi.schema.CMJsonField

fun CMJsonField<String>.urlEncode() = toDopeType().urlEncode()

fun String.urlEncode() = toDopeType().urlEncode()
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ fun CMJsonField<Boolean>.notWithinArray(selectClause: ISelectOffsetClause<Boolea

@JvmName("notWithinNumberArray")
fun TypeExpression<NumberType>.notWithinArray(array: CMJsonList<out Number>): NotWithinExpression<NumberType> =
this.notWithinArray(array.toDopeType())
notWithinArray(array.toDopeType())

@JvmName("notWithinStringArray")
fun TypeExpression<StringType>.notWithinArray(array: CMJsonList<String>): NotWithinExpression<StringType> =
this.notWithinArray(array.toDopeType())
notWithinArray(array.toDopeType())

@JvmName("notWithinBooleanArray")
fun TypeExpression<BooleanType>.notWithinArray(array: CMJsonList<Boolean>): NotWithinExpression<BooleanType> =
this.notWithinArray(array.toDopeType())
notWithinArray(array.toDopeType())

@JvmName("notWithinNumberArray")
fun CMJsonField<out Number>.notWithinArray(array: CMJsonList<out Number>): NotWithinExpression<NumberType> =
Expand Down
Loading
Loading