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

com.skillw.pouvoir.internal.feature.database.mongodb.MongoContainerHolder.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.internal.feature.database.mongodb

import com.mongodb.client.MongoClient
import com.mongodb.client.MongoDatabase
import com.skillw.pouvoir.api.feature.database.ContainerHolder

/**
 * @className MongoContainerHolder
 *
 * @author Glom
 * @date 2023/8/11 22:49 Copyright 2024 Glom.
 */
class MongoContainerHolder(private val mongoClient: MongoClient, database: String) : ContainerHolder() {
    private val mongoDatabase: MongoDatabase = mongoClient.getDatabase(database)

    override fun createContainer(tableName: String, userKey: Boolean): MongoContainer {
        return MongoContainer(tableName, this, mongoDatabase)
    }

    override fun disconnect() {
        mongoClient.close()
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy