Skip to content

Commit

Permalink
feat(shared/database): static mysql connection getter
Browse files Browse the repository at this point in the history
  • Loading branch information
itIsMaku committed Mar 23, 2024
1 parent e524bea commit 521d129
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cz.maku.mommons.storage.database.type;

import cz.maku.mommons.storage.database.SQLRow;
import org.jetbrains.annotations.NotNull;

import java.sql.*;
import java.util.ArrayList;
Expand All @@ -22,6 +23,15 @@ public MySQL(Connection connection) {
instance = this;
}

@NotNull
public static Connection connection() {
if (instance == null) {
throw new RuntimeException("MySQL is not initialized!");
}

return instance.getConnection();
}

public static MySQL getApi() {
return instance;
}
Expand Down

0 comments on commit 521d129

Please sign in to comment.