#sql-server #server-connection #connection-string #database-connection

connection_string_generator

A VERY simple crate to generate database connection strings programmatically

2 unstable releases

0.2.0 Aug 20, 2024
0.1.0 Aug 19, 2024

#822 in Database interfaces

MIT license

33KB
490 lines

Connection string generator

A VERY simple crate to generate database connection strings programmatically.

Currently supported databases

  • PostgreSQL
  • Microsoft SQL Server

Examples

PostgreSQL

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

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}");

lib.rs:

A VERY simple crate to generate database connection strings programmatically.

Currently supported databases

  • PostgreSQL
  • Microsoft SQL Server

No runtime deps

Features