Skip to content

Commit

Permalink
feat: implemented jdbc driver methods
Browse files Browse the repository at this point in the history
  • Loading branch information
QuadStingray committed Oct 16, 2024
1 parent 8e24215 commit 2ecc276
Show file tree
Hide file tree
Showing 40 changed files with 3,445 additions and 619 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ libraryDependencies += "com.vdurmont" % "semver4j" % "3.1.0"

libraryDependencies += "com.github.jsqlparser" % "jsqlparser" % "4.9"

libraryDependencies += "org.postgresql" % "postgresql" % "42.7.3"
libraryDependencies += "org.liquibase" % "liquibase-core" % "4.28.0" % Test

buildInfoPackage := "dev.mongocamp.driver.mongodb"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ class DatabaseProvider(val config: MongoConfig, val registry: CodecRegistry) ext
private val cachedMongoDAOMap = new mutable.HashMap[String, MongoDAO[Document]]()
private var cachedClient: Option[MongoClient] = None

val DefaultDatabaseName: String = config.database
private var defaultDatabaseName: String = config.database

def DefaultDatabaseName: String = defaultDatabaseName

def connectionString = {
s"mongodb://${config.host}:${config.port}/${config.database}"
}

def setDefaultDatabaseName(databaseName: String): Unit = {
defaultDatabaseName = databaseName
}

def client: MongoClient = {
if (isClosed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ case class MongoConfig(
database: String,
host: String = DefaultHost,
port: Int = DefaultPort,
applicationName: String = DefaultApplicationName,
var applicationName: String = DefaultApplicationName,
userName: Option[String] = None,
password: Option[String] = None,
authDatabase: String = DefaultAuthenticationDatabaseName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object MongoIndex extends ObservableIncludes with LazyLogging {
indexOptions.getOrElse("weights", Map()).asInstanceOf[Map[String, _]].keys.toList
else
indexOptions.getOrElse("key", Map).asInstanceOf[Map[String, _]].keys.toList,
indexOptions.getOrElse("unique", false).asInstanceOf[Boolean],
indexOptions.getOrElse("unique", indexOptions("name").toString.equalsIgnoreCase("_id_")).asInstanceOf[Boolean],
indexOptions.getOrElse("v", -1).asInstanceOf[Int],
indexOptions.getOrElse("ns", "").toString,
indexOptions.getOrElse("key", Map).asInstanceOf[Map[String, _]],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package dev.mongocamp.driver.mongodb.exception

class SqlCommandNotSupportedException(message: String) extends Exception(message)
Loading

0 comments on commit 2ecc276

Please sign in to comment.