-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for insert-returning in generator
- Loading branch information
Showing
3 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ba.sake.squery.generator | ||
|
||
sealed abstract class DbType(val squeryPackage: String) { | ||
def supportsReturning: Boolean = false | ||
} | ||
|
||
object DbType { | ||
|
||
def fromDatabaseProductName(dbName: String): DbType = { | ||
if (dbName.contains("h2")) H2 | ||
else if (dbName.contains("postgres")) PostgreSQL | ||
else if (dbName.contains("mysql")) MySQL | ||
else if (dbName.contains("mariadb")) MariaDB | ||
else if (dbName.contains("oracle")) Oracle | ||
else throw new RuntimeException(s"Unknown database type $dbName") | ||
} | ||
|
||
case object H2 extends DbType("h2") | ||
case object PostgreSQL extends DbType("postgres") { | ||
override def supportsReturning: Boolean = true | ||
} | ||
case object MySQL extends DbType("mysql") | ||
case object MariaDB extends DbType("mariadb") | ||
case object Oracle extends DbType("oracle") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters