DatabaseConfig class final

Database configuration section.

Implemented types

Constructors

DatabaseConfig({required String defaultConnection, required Map<String, ConnectionConfig> connections})
const
DatabaseConfig.fromEnv(Env env, {required String basePath})
Reads DB_* variables. DB_CONNECTION selects the default connection (sqlite by default). Relative SQLite paths resolve against basePath.
factory

Properties

connections → Map<String, ConnectionConfig>
final
defaultConnection → String
final
hashCode → int
The hash code for this object.
no setterinherited
key → String
Top-level key of the section, e.g. app or database.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sharesSqliteFile(int isolates) → bool
Whether the default connection is a SQLite file that isolates isolates would share. It works (WAL, busy_timeout), but a writer waiting for another isolate's lock blocks its whole event loop, since SQLite calls are synchronous: for production with several isolates, PostgreSQL (or MySQL) is the database to use.
toMap() → Map<String, Object?>
Plain-map projection used for dot-notation access.
override
toString() → String
A string representation of this object.
inherited
withConnections(Map<String, ConnectionConfig> extra) → DatabaseConfig
This configuration with extra connections added (or replacing ones of the same name).

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

check(Env env, ConfigRepository config) → Iterable<ConfigIssue>
Boot check: DB_CONNECTION must name a configured connection.