module Marten::DB::Connection
Defined in:
marten/db/connection.crmarten/db/connection/base.cr
marten/db/connection/mysql.cr
marten/db/connection/postgresql.cr
marten/db/connection/sqlite.cr
Constant Summary
-
DEFAULT_CONNECTION_NAME =
"default"
-
IMPLEMENTATIONS =
{MYSQL_ID => MySQL, POSTGRESQL_ID => PostgreSQL, SQLITE_ID => SQLite}
-
MYSQL_ID =
"mysql"
-
POSTGRESQL_ID =
"postgresql"
-
SQLITE_ID =
"sqlite"
Class Method Summary
-
.default
Returns the default database connection.
-
.for(table_name)
Returns the connection to use for the passed
table_name
. -
.get(db_alias : String | Symbol)
Returns the database connection configured for a given
db_alias
. - .register(db_config : Conf::GlobalSettings::Database)
- .registry
Class Method Detail
def self.get(db_alias : String | Symbol)
#
Returns the database connection configured for a given db_alias
.
If no database connection can be found, a Marten::DB::Errors::UnknownConnection
exception is raised.