Function postgres_backend_with_config

Source
pub async fn postgres_backend_with_config(
    config: DatabaseConfig,
) -> Result<PostgresBackend, PostgresError>
Expand description

Create a new PostgreSQL backend with a custom config

This function can be used to create a backend that can be passed into with_database()

ยงExample

use testkit_postgres::{postgres_backend_with_config, DatabaseConfig};
use testkit_core::with_database;

async fn test() {
    let config = DatabaseConfig::new("postgres://admin@postgres/postgres", "postgres://user@postgres/postgres");
    let backend = postgres_backend_with_config(config).await.unwrap();
    let context = with_database(backend)
        .execute()
        .await
        .unwrap();
}