rcdbquery/src/main/kotlin/de/pheerai/rcdbquery/dataMappings/StartsWith.kt
Oliver Rümpelein d2dc84a17b Several usability enhancements:
- You can now return "all" data available
 - The use of `Order.NAME_2` has been found and the item has been change to
 - `ORIGINAL_NAME` to reflect this
 - All `Order`-types now have their designated DSL method
 - It is now possible to search for items starting with a term
 - `inversion()` Order method has been renamed to `inversions()`
2020-04-26 14:43:45 +02:00

28 lines
801 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()
)
}
}