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

jvmMain.MongoKeyValueStoreFactory.kt Maven / Gradle / Ivy

There is a newer version: 0.26.0
Show newest version
package io.fluidsonic.raptor.keyvaluestore.mongo

import io.fluidsonic.mongo.*
import io.fluidsonic.raptor.keyvaluestore.*
import kotlin.reflect.*


private class MongoKeyValueStoreFactory(
	private val database: MongoDatabase,
) : RaptorKeyValueStoreFactory {

	override fun  create(name: String, keyClass: KClass, valueClass: KClass): RaptorKeyValueStore =
		MongoKeyValueStore(
			collection = database.getCollectionOf(name),
			keyClass = keyClass,
			valueClass = valueClass,
		)
}


public fun RaptorKeyValueStoreFactory.Companion.mongo(database: MongoDatabase): RaptorKeyValueStoreFactory =
	MongoKeyValueStoreFactory(database = database)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy