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.8.184
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 {

    @NewChain
    fun forUpdate() :KEntities

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

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

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

    fun  findMapByIds(type: KClass, ids: Collection): Map

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

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

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

    fun  findAll(type: KClass): List

    fun  findAll(entityType: KClass, block: (SortDsl.() -> Unit)): List

    fun > findAllViews(view: KClass, block: (SortDsl.() -> Unit)): 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  save(
        entity: E,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KSimpleSaveResult

    fun  save(
        input: Input,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KSimpleSaveResult

    fun  saveEntities(
        entities: Collection,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KBatchSaveResult

    fun  saveInputs(
        entities: Collection>,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KBatchSaveResult

    @Deprecated(
        "Will be deleted in 1.0, please use saveEntities",
        replaceWith = ReplaceWith("saveEntities")
    )
    fun  batchSave(
        entities: Collection,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KBatchSaveResult =
        saveEntities(entities, con, block)

    @Deprecated(
        "Will be deleted in 1.0, please use saveEntities",
        replaceWith = ReplaceWith("saveEntities")
    )
    fun  saveAll(
        entities: Collection,
        con: Connection? = null,
        block: (KSaveCommandDsl.() -> Unit)? = null
    ): KBatchSaveResult =
        saveEntities(entities, con, block)

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

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

    @Deprecated(
        "Will be deleted in 1.0, please use deleteAll",
        replaceWith = ReplaceWith("deleteAll")
    )
    fun batchDelete(
        type: KClass<*>,
        ids: Collection<*>,
        con: Connection? = null,
        block: (KDeleteCommandDsl.() -> Unit)? = null
    ): KDeleteResult =
        deleteAll(type, ids, con, block)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy