-
-
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.
- Loading branch information
Showing
15 changed files
with
107 additions
and
123 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
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
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
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
6 changes: 6 additions & 0 deletions
6
core/src/main/java/org/geysermc/databaseutils/DatabaseType.java
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,6 @@ | ||
package org.geysermc.databaseutils; | ||
|
||
public enum DatabaseType { | ||
SQL, | ||
MONGODB | ||
} |
29 changes: 0 additions & 29 deletions
29
core/src/main/java/org/geysermc/databaseutils/DatabaseTypePresent.java
This file was deleted.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
core/src/main/java/org/geysermc/databaseutils/DatabaseWithDialectType.java
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,45 @@ | ||
package org.geysermc.databaseutils; | ||
|
||
import java.util.Locale; | ||
import java.util.Objects; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.geysermc.databaseutils.sql.SqlDialect; | ||
|
||
public enum DatabaseWithDialectType { | ||
H2(DatabaseType.SQL, SqlDialect.H2), | ||
SQL_SERVER(DatabaseType.SQL, SqlDialect.SQL_SERVER), | ||
MYSQL(DatabaseType.SQL, SqlDialect.MYSQL), | ||
ORACLE_DATABASE(DatabaseType.SQL, SqlDialect.ORACLE_DATABASE), | ||
POSTGRESQL(DatabaseType.SQL, SqlDialect.POSTGRESQL), | ||
SQLITE(DatabaseType.SQL, SqlDialect.SQLITE), | ||
MONGODB(DatabaseType.MONGODB, null); | ||
|
||
private static final DatabaseWithDialectType[] VALUES = values(); | ||
|
||
private final DatabaseType databaseType; | ||
private final SqlDialect dialect; | ||
|
||
DatabaseWithDialectType(@NonNull DatabaseType databaseType, @Nullable SqlDialect dialect) { | ||
this.databaseType = Objects.requireNonNull(databaseType); | ||
this.dialect = dialect; | ||
} | ||
|
||
public static @Nullable DatabaseWithDialectType byName(@NonNull String name) { | ||
var normalized = name.replace('-', '_').replace(' ', '_').toUpperCase(Locale.ROOT); | ||
for (DatabaseWithDialectType value : VALUES) { | ||
if (value.name().equals(normalized)) { | ||
return value; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public @NonNull DatabaseType databaseType() { | ||
return databaseType; | ||
} | ||
|
||
public @Nullable SqlDialect dialect() { | ||
return dialect; | ||
} | ||
} |
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
35 changes: 0 additions & 35 deletions
35
core/src/main/java/org/geysermc/databaseutils/sql/SqlDatabasePresent.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.