io.objectbox.kotlin.QueryBuilder.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objectbox-kotlin Show documentation
Show all versions of objectbox-kotlin Show documentation
ObjectBox is a fast NoSQL database for Objects
The newest version!
/*
* Copyright 2021 ObjectBox Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.objectbox.kotlin
import io.objectbox.Property
import io.objectbox.query.QueryBuilder
/** An alias for the "in" method, which is a reserved keyword in Kotlin. */
inline fun QueryBuilder.inValues(property: Property, values: LongArray): QueryBuilder =
`in`(property, values)
/** An alias for the "in" method, which is a reserved keyword in Kotlin. */
inline fun QueryBuilder.inValues(property: Property, values: IntArray): QueryBuilder =
`in`(property, values)
/** An alias for the "in" method, which is a reserved keyword in Kotlin. */
inline fun QueryBuilder.inValues(
property: Property, values: Array,
stringOrder: QueryBuilder.StringOrder
): QueryBuilder = `in`(property, values, stringOrder)
// Shortcuts for Short
/** Shortcut for [equal(property, value.toLong())][QueryBuilder.equal] */
inline fun QueryBuilder.equal(property: Property, value: Short): QueryBuilder {
return equal(property, value.toLong())
}
/** Shortcut for [notEqual(property, value.toLong())][QueryBuilder.notEqual] */
inline fun QueryBuilder.notEqual(property: Property, value: Short): QueryBuilder {
return notEqual(property, value.toLong())
}
/** Shortcut for [less(property, value.toLong())][QueryBuilder.less] */
inline fun QueryBuilder.less(property: Property, value: Short): QueryBuilder {
return less(property, value.toLong())
}
/** Shortcut for [lessOrEqual(property, value.toLong())][QueryBuilder.lessOrEqual] */
inline fun QueryBuilder.lessOrEqual(property: Property, value: Short): QueryBuilder {
return lessOrEqual(property, value.toLong())
}
/** Shortcut for [greater(property, value.toLong())][QueryBuilder.greater] */
inline fun QueryBuilder.greater(property: Property, value: Short): QueryBuilder {
return greater(property, value.toLong())
}
/** Shortcut for [greaterOrEqual(property, value.toLong())][QueryBuilder.greaterOrEqual] */
inline fun QueryBuilder.greaterOrEqual(property: Property, value: Short): QueryBuilder {
return greaterOrEqual(property, value.toLong())
}
/** Shortcut for [between(property, value1.toLong(), value2.toLong())][QueryBuilder.between] */
inline fun QueryBuilder.between(property: Property, value1: Short, value2: Short): QueryBuilder {
return between(property, value1.toLong(), value2.toLong())
}
// Shortcuts for Int
/** Shortcut for [equal(property, value.toLong())][QueryBuilder.equal] */
inline fun QueryBuilder.equal(property: Property, value: Int): QueryBuilder {
return equal(property, value.toLong())
}
/** Shortcut for [notEqual(property, value.toLong())][QueryBuilder.notEqual] */
inline fun QueryBuilder.notEqual(property: Property, value: Int): QueryBuilder {
return notEqual(property, value.toLong())
}
/** Shortcut for [less(property, value.toLong())][QueryBuilder.less] */
inline fun QueryBuilder.less(property: Property, value: Int): QueryBuilder {
return less(property, value.toLong())
}
/** Shortcut for [lessOrEqual(property, value.toLong())][QueryBuilder.lessOrEqual] */
inline fun QueryBuilder.lessOrEqual(property: Property, value: Int): QueryBuilder {
return lessOrEqual(property, value.toLong())
}
/** Shortcut for [greater(property, value.toLong())][QueryBuilder.greater] */
inline fun QueryBuilder.greater(property: Property, value: Int): QueryBuilder {
return greater(property, value.toLong())
}
/** Shortcut for [greaterOrEqual(property, value.toLong())][QueryBuilder.greaterOrEqual] */
inline fun QueryBuilder.greaterOrEqual(property: Property, value: Int): QueryBuilder {
return greaterOrEqual(property, value.toLong())
}
/** Shortcut for [between(property, value1.toLong(), value2.toLong())][QueryBuilder.between] */
inline fun QueryBuilder.between(property: Property, value1: Int, value2: Int): QueryBuilder {
return between(property, value1.toLong(), value2.toLong())
}
// Shortcuts for Float
/** Shortcut for [equal(property, value.toDouble(), tolerance.toDouble())][QueryBuilder.equal] */
inline fun QueryBuilder.equal(property: Property, value: Float, tolerance: Float): QueryBuilder {
return equal(property, value.toDouble(), tolerance.toDouble())
}
/** Shortcut for [less(property, value.toDouble())][QueryBuilder.less] */
inline fun QueryBuilder.less(property: Property, value: Float): QueryBuilder {
return less(property, value.toDouble())
}
/** Shortcut for [lessOrEqual(property, value.toDouble())][QueryBuilder.lessOrEqual] */
inline fun QueryBuilder.lessOrEqual(property: Property, value: Float): QueryBuilder {
return lessOrEqual(property, value.toDouble())
}
/** Shortcut for [greater(property, value.toDouble())][QueryBuilder.greater] */
inline fun QueryBuilder.greater(property: Property, value: Float): QueryBuilder {
return greater(property, value.toDouble())
}
/** Shortcut for [greaterOrEqual(property, value.toDouble())][QueryBuilder.greaterOrEqual] */
inline fun QueryBuilder.greaterOrEqual(property: Property, value: Float): QueryBuilder {
return greaterOrEqual(property, value.toDouble())
}
/** Shortcut for [between(property, value1.toDouble(), value2.toDouble())][QueryBuilder.between] */
inline fun QueryBuilder.between(property: Property, value1: Float, value2: Float): QueryBuilder {
return between(property, value1.toDouble(), value2.toDouble())
}