PostgresDb.fromUrl constructor
PostgresDb.fromUrl(- String url,
- {int port = 5432,
- int timeoutInSeconds = 30,
- int queryTimeoutInSeconds = 30,
- String timeZone = 'UTC',
- bool useSSL = false,
- bool isUnixSocket = false,
- bool allowClearTextPassword = false,
- ReplicationMode replicationMode = ReplicationMode.none}
)
Implementation
PostgresDb.fromUrl(
String url, {
this.port = 5432,
int timeoutInSeconds = 30,
int queryTimeoutInSeconds = 30,
String timeZone = 'UTC',
bool useSSL = false,
bool isUnixSocket = false,
bool allowClearTextPassword = false,
ReplicationMode replicationMode = ReplicationMode.none,
}) {
var base = url.split('postgresql://');
if (base.length > 1) {
host = base[1].split('@').last.split('/')[0];
databaseName = url.split('/').last;
username = base[1].split(':').first;
password = base[1].split('@').first.split(':').last;
} else {
host = '';
databaseName = '';
username = '';
password = '';
}
db = PostgreSQLConnection(
host,
port,
databaseName,
username: username,
password: password,
timeoutInSeconds: timeoutInSeconds,
queryTimeoutInSeconds: queryTimeoutInSeconds,
timeZone: timeZone,
useSSL: useSSL,
isUnixSocket: isUnixSocket,
allowClearTextPassword: allowClearTextPassword,
replicationMode: replicationMode,
);
}