https://github.com/twihno/connection-string-generator
A VERY simple rust crate to generate database connection strings programmatically
https://github.com/twihno/connection-string-generator
connection-string database database-connection
Last synced: about 1 year ago
JSON representation
A VERY simple rust crate to generate database connection strings programmatically
- Host: GitHub
- URL: https://github.com/twihno/connection-string-generator
- Owner: twihno
- License: mit
- Created: 2024-08-19T18:24:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-20T14:19:53.000Z (over 1 year ago)
- Last Synced: 2025-03-01T06:17:20.912Z (about 1 year ago)
- Topics: connection-string, database, database-connection
- Language: Rust
- Homepage: https://crates.io/crates/connection_string_generator
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Connection string generator
A VERY simple crate to generate database connection strings programmatically.
## Currently supported databases
- PostgreSQL
- Microsoft SQL Server
## Examples
### PostgreSQL
```rust
let conn_string = PostgresConnectionString::new()
.set_username_and_password("user", "password")
.set_host_with_port("localhost", 5432)
.set_database_name("db_name")
.set_connect_timeout(30);
println!("{conn_string}");
```
### Microsoft SQL Server
```rust
let conn_string = SqlServerConnectionString::new()
.set_username_and_password("user", "password")
.set_host_with_default_port("sql.test.com")
.set_database_name("db_name")
.set_connect_timeout(30)
.enable_encryption_and_trust_server_certificate();
println!("{conn_string}");
```