Replies: 1 comment
-
On the example page we have the following code to create a simple connection: final conn = await Connection.open(
Endpoint(
host: 'localhost',
database: 'postgres',
username: 'user',
password: 'pass',
),
// The postgres server hosted locally doesn't have SSL by default. If you're
// accessing a postgres server over the Internet, the server should support
// SSL and you should swap out the mode with `SslMode.verifyFull`.
settings: ConnectionSettings(sslMode: SslMode.disable),
);
// ...
final result2 = await conn.execute(
Sql.named('SELECT * FROM a_table WHERE id=@id'),
parameters: {'id': 'example row'},
); The same thing with connection pooling: final pool = await Pool.withEndpoints(
[Endpoint(
host: 'localhost',
database: 'postgres',
username: 'user',
password: 'pass',
)],
// The postgres server hosted locally doesn't have SSL by default. If you're
// accessing a postgres server over the Internet, the server should support
// SSL and you should swap out the mode with `SslMode.verifyFull`.
settings: PoolSettings(sslMode: SslMode.disable),
);
// ...
final result2 = await pool.execute(
Sql.named('SELECT * FROM a_table WHERE id=@id'),
parameters: {'id': 'example row'},
); The configuration options are in In another words, Does this give a good-enough starting point? Note: we are not that strong on beginner-friendly documentation, PRs are accepted. |
Beta Was this translation helpful? Give feedback.
-
Hi all)
Beta Was this translation helpful? Give feedback.
All reactions