org.babyfish.jimmer.sql.kt.Mutations.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql-kotlin Show documentation
Show all versions of jimmer-sql-kotlin Show documentation
A revolutionary ORM framework for both java and kotlin
package org.babyfish.jimmer.sql.kt
import org.babyfish.jimmer.kt.toImmutableProp
import org.babyfish.jimmer.sql.ast.mutation.AbstractMutationResult
import org.babyfish.jimmer.sql.runtime.MutationPath
import org.babyfish.jimmer.sql.exception.SaveException
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
fun MutationPath.contains(type: KClass<*>): Boolean =
contains(type.java)
fun MutationPath.contains(prop: KProperty1<*, *>): Boolean =
contains(prop.toImmutableProp())
fun AbstractMutationResult.getAffectedRowCount(type: KClass<*>): Int =
getAffectedRowCount(type.java)
fun AbstractMutationResult.getAffectedRowCount(prop: KProperty1<*, *>): Int =
getAffectedRowCount(prop.toImmutableProp())
fun SaveException.NotUnique.isMatched(
vararg props: KProperty1
): Boolean = isMatched(
*props.map { it.toImmutableProp() }.toTypedArray()
)
@Suppress("UNCHECKED_CAST")
operator fun SaveException.NotUnique.get(prop: KProperty1<*, T>): T =
getValue(prop.toImmutableProp()) as T
© 2015 - 2024 Weber Informatics LLC | Privacy Policy