All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.kt.KEntities.kt Maven / Gradle / Ivy

There is a newer version: 0.9.35
Show newest version
package org.babyfish.jimmer.sql.kt

import org.babyfish.jimmer.Input
import org.babyfish.jimmer.View
import org.babyfish.jimmer.lang.NewChain
import org.babyfish.jimmer.sql.fetcher.Fetcher
import org.babyfish.jimmer.sql.kt.ast.mutation.*
import org.babyfish.jimmer.sql.kt.ast.query.SortDsl
import org.babyfish.jimmer.sql.kt.ast.query.KExample
import java.sql.Connection
import kotlin.reflect.KClass

/**
 * To be absolutely cache friendly,
 * all query methods in this class that start with "find" ignore the global filters.
 *
 * The mentions here ignore global filters, only for aggregate root objects,
 * excluding deeper objects fetched by object fetcher.
 */
interface KEntities : KSaver {

    @NewChain
    fun forUpdate() :KEntities

    @NewChain
    fun forConnection(con: Connection?) :KEntities

    fun  findById(type: KClass, id: Any): T?

    fun  findOneById(type: KClass, id: Any): T

    fun  findByIds(type: KClass, ids: Iterable<*>): List

    /**
     * @param [T] Entity type or output DTO type
     */
    fun  findMapByIds(type: KClass, ids: Iterable): Map

    fun  findById(fetcher: Fetcher, id: Any): E?

    fun  findOneById(fetcher: Fetcher, id: Any): E

    fun  findByIds(fetcher: Fetcher, ids: Iterable<*>): List

    fun  findMapByIds(fetcher: Fetcher, ids: Iterable): Map

    fun  findAll(type: KClass): List

    fun  findAll(type: KClass, block: (SortDsl.() -> Unit)? = null): List

    fun > findAllViews(view: KClass, block: (SortDsl.() -> Unit) ?= null): List

    fun  findAll(fetcher: Fetcher, block: (SortDsl.() -> Unit)? = null): List

    fun  findByExample(
        example: KExample,
        fetcher: Fetcher? = null,
        block: (SortDsl.() -> Unit)? = null
    ): List

    fun > findByExample(
        viewType: KClass,
        example: KExample,
        block: (SortDsl.() -> Unit)? = null
    ): List

    fun delete(
        type: KClass<*>,
        id: Any,
        con: Connection? = null,
        block: (KDeleteCommandDsl.() -> Unit)? = null
    ): KDeleteResult

    fun deleteAll(
        type: KClass<*>,
        ids: Iterable<*>,
        con: Connection? = null,
        block: (KDeleteCommandDsl.() -> Unit)? = null
    ): KDeleteResult
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy