Oliver Rümpelein
d8412c32f2
- Classification - Status - Make some `order` params invisible for `all` params - Solved some order types
29 lines
803 B
Kotlin
29 lines
803 B
Kotlin
@file:Suppress("unused")
|
|
|
|
package de.pheerai.rcdbquery.dataMappings
|
|
|
|
import de.pheerai.rcdbquery.dsl.RcdbQueryParamsBuilder
|
|
|
|
class StartsWith(override val paramValue: String) : RcdbParamOption<String> {
|
|
override val prettyName = "Starts with"
|
|
override val fullName = "Name starting with term"
|
|
|
|
companion object {
|
|
const val staticParamName = "nl"
|
|
}
|
|
}
|
|
|
|
fun RcdbQueryParamsBuilder.startsWith(term: String) {
|
|
if (StartsWith.staticParamName !in this.keys()) {
|
|
this[StartsWith.staticParamName] = listOf(
|
|
StartsWith(term)
|
|
)
|
|
} else {
|
|
error(
|
|
"""Only one starts with term must ever be set
|
|
| Old term: ${this[StartsWith.staticParamName]!![0].paramValue}
|
|
| New term: $term""".trimMargin()
|
|
)
|
|
}
|
|
}
|