Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ resolver = "2"
[workspace.package]
authors = ["Brian Heineman <brian.heineman@gmail.com>"]
categories = ["database"]
edition = "2021"
edition = "2024"
keywords = ["postgresql", "postgres", "embedded", "database", "server"]
license = "(Apache-2.0 OR MIT) AND PostgreSQL"
repository = "https://github.com/theseus-rs/postgresql-embedded"
rust-version = "1.84.0"
rust-version = "1.85.0"
version = "0.17.5"

[workspace.dependencies]
anyhow = "1.0.95"
anyhow = "1.0.96"
async-trait = "0.1.86"
axum = "0.8.1"
criterion = "0.5.1"
Expand All @@ -34,7 +34,6 @@ diesel_migrations = "2.2.0"
flate2 = "1.0.35"
futures-util = "0.3.30"
hex = "0.4.3"
home = "0.5.11"
indicatif = "0.17.11"
indoc = "2.0.5"
liblzma = "0.3.6"
Expand All @@ -57,8 +56,8 @@ sha1 = "0.10.6"
sha2 = "0.10.8"
sqlx = { version = "0.8.3", default-features = false, features = ["postgres"] }
tar = "0.4.43"
target-triple = "0.1.3"
tempfile = "3.16.0"
target-triple = "0.1.4"
tempfile = "3.17.1"
test-log = "0.2.17"
thiserror = "2.0.11"
tokio = "1.43.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/archive_async/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(clippy::pedantic)]

use postgresql_archive::configuration::theseus;
use postgresql_archive::{extract, get_archive, Result, VersionReq};
use postgresql_archive::{Result, VersionReq, extract, get_archive};

#[tokio::main]
async fn main() -> Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions examples/axum_embedded/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use anyhow::Result;
use axum::extract::State;
use axum::{http::StatusCode, routing::get, Json, Router};
use axum::{Json, Router, http::StatusCode, routing::get};
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
use sqlx::postgres::PgPoolOptions;
use sqlx::PgPool;
use sqlx::postgres::PgPoolOptions;
use std::env;
use std::time::Duration;
use tokio::net::TcpListener;
Expand Down
2 changes: 1 addition & 1 deletion examples/diesel_embedded/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::models::{NewPost, Post};
use diesel::r2d2::{ConnectionManager, Pool};
use diesel::{PgConnection, RunQueryDsl, SelectableHelper};
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
use diesel_migrations::{EmbeddedMigrations, MigrationHarness, embed_migrations};
use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq};

mod models;
Expand Down
2 changes: 1 addition & 1 deletion examples/download_progress_bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
use tracing_indicatif::IndicatifLayer;
use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, Registry};
use tracing_subscriber::{Registry, fmt};

/// Example of how to display a progress bar for the postgresql embedded archive download
#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/embedded_sync/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![forbid(clippy::allow_attributes)]
#![deny(clippy::pedantic)]

use postgresql_embedded::blocking::PostgreSQL;
use postgresql_embedded::Result;
use postgresql_embedded::blocking::PostgreSQL;

fn main() -> Result<()> {
let mut postgresql = PostgreSQL::default();
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlx_embedded/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use anyhow::Result;
use postgresql_embedded::PostgreSQL;
use sqlx::postgres::PgPool;
use sqlx::Row;
use sqlx::postgres::PgPool;

#[tokio::main]
async fn main() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion examples/zonky/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![forbid(clippy::allow_attributes)]
#![deny(clippy::pedantic)]

use postgresql_archive::configuration::zonky;
use postgresql_archive::VersionReq;
use postgresql_archive::configuration::zonky;
use postgresql_embedded::{PostgreSQL, Result, Settings};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion postgresql_archive/benches/archive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use postgresql_archive::blocking::{extract, get_archive};
use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq};
Expand Down
2 changes: 1 addition & 1 deletion postgresql_archive/src/configuration/theseus/extractor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::extractor::{tar_gz_extract, ExtractDirectories};
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::{ExtractDirectories, tar_gz_extract};
use regex_lite::Regex;
use std::fs::{create_dir_all, remove_dir_all, remove_file, rename};
use std::path::{Path, PathBuf};
Expand Down
2 changes: 1 addition & 1 deletion postgresql_archive/src/configuration/zonky/extractor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::extractor::{tar_xz_extract, ExtractDirectories};
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::{ExtractDirectories, tar_xz_extract};
use regex_lite::Regex;
use std::fs::{create_dir_all, remove_dir_all, remove_file, rename};
use std::io::Cursor;
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/src/configuration/zonky/repository.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::Result;
use crate::configuration::zonky::matcher::{get_arch, get_os};
use crate::repository::Archive;
use crate::repository::maven::repository::Maven;
use crate::repository::model::Repository;
use crate::repository::Archive;
use crate::Result;
use async_trait::async_trait;
use semver::{Version, VersionReq};
use tracing::instrument;
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/src/extractor/registry.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::Error::{PoisonedLock, UnsupportedExtractor};
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "zonky")]
use crate::configuration::zonky;
use crate::extractor::ExtractDirectories;
use crate::Error::{PoisonedLock, UnsupportedExtractor};
use crate::Result;
use std::path::PathBuf;
use std::sync::{Arc, LazyLock, Mutex, RwLock};

Expand Down
6 changes: 3 additions & 3 deletions postgresql_archive/src/extractor/tar_gz_extractor.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::extractor::ExtractDirectories;
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::ExtractDirectories;
use flate2::bufread::GzDecoder;
use num_format::{Locale, ToFormattedString};
use std::fs::{create_dir_all, File};
use std::io::{copy, BufReader, Cursor};
use std::fs::{File, create_dir_all};
use std::io::{BufReader, Cursor, copy};
use std::path::PathBuf;
use tar::Archive;
use tracing::{debug, instrument, warn};
Expand Down
6 changes: 3 additions & 3 deletions postgresql_archive/src/extractor/tar_xz_extractor.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::extractor::ExtractDirectories;
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::ExtractDirectories;
use liblzma::bufread::XzDecoder;
use num_format::{Locale, ToFormattedString};
use std::fs::{create_dir_all, File};
use std::io::{copy, BufReader, Cursor};
use std::fs::{File, create_dir_all};
use std::io::{BufReader, Cursor, copy};
use std::path::PathBuf;
use tar::Archive;
use tracing::{debug, instrument, warn};
Expand Down
2 changes: 1 addition & 1 deletion postgresql_archive/src/extractor/zip_extractor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::extractor::ExtractDirectories;
use crate::Result;
use crate::extractor::ExtractDirectories;
use num_format::{Locale, ToFormattedString};
use std::fs::create_dir_all;
use std::io::Cursor;
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/src/hasher/registry.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::Error::{PoisonedLock, UnsupportedHasher};
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "md5")]
Expand All @@ -10,8 +12,6 @@ use crate::hasher::sha2_256;
use crate::hasher::sha2_512;
#[cfg(feature = "maven")]
use crate::repository::maven;
use crate::Error::{PoisonedLock, UnsupportedHasher};
use crate::Result;
use std::sync::{Arc, LazyLock, Mutex, RwLock};

static REGISTRY: LazyLock<Arc<Mutex<HasherRegistry>>> =
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/src/matcher/registry.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::Error::{PoisonedLock, UnsupportedMatcher};
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "zonky")]
use crate::configuration::zonky;
use crate::Error::{PoisonedLock, UnsupportedMatcher};
use crate::Result;
use semver::Version;
use std::sync::{Arc, LazyLock, Mutex, RwLock};

Expand Down
12 changes: 6 additions & 6 deletions postgresql_archive/src/repository/github/repository.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use crate::hasher::registry::HasherFn;
use crate::repository::github::models::{Asset, Release};
use crate::repository::model::Repository;
use crate::repository::Archive;
use crate::Error::{
ArchiveHashMismatch, AssetHashNotFound, AssetNotFound, RepositoryFailure, VersionNotFound,
};
use crate::{hasher, matcher, Result};
use crate::hasher::registry::HasherFn;
use crate::repository::Archive;
use crate::repository::github::models::{Asset, Release};
use crate::repository::model::Repository;
use crate::{Result, hasher, matcher};
use async_trait::async_trait;
use futures_util::StreamExt;
use regex_lite::Regex;
use reqwest::header::HeaderMap;
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_retry::RetryTransientMiddleware;
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_tracing::TracingMiddleware;
use semver::{Version, VersionReq};
use std::env;
Expand Down
8 changes: 4 additions & 4 deletions postgresql_archive/src/repository/maven/repository.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::Error::{ArchiveHashMismatch, ParseError, RepositoryFailure, VersionNotFound};
use crate::repository::Archive;
use crate::repository::maven::models::Metadata;
use crate::repository::model::Repository;
use crate::repository::Archive;
use crate::Error::{ArchiveHashMismatch, ParseError, RepositoryFailure, VersionNotFound};
use crate::{hasher, Result};
use crate::{Result, hasher};
use async_trait::async_trait;
use futures_util::StreamExt;
use reqwest::header::HeaderMap;
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_retry::RetryTransientMiddleware;
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_tracing::TracingMiddleware;
use semver::{Version, VersionReq};
use std::env;
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/src/repository/registry.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::Error::{PoisonedLock, UnsupportedRepository};
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "zonky")]
use crate::configuration::zonky;
#[cfg(feature = "github")]
use crate::repository::github::repository::GitHub;
use crate::repository::model::Repository;
use crate::Error::{PoisonedLock, UnsupportedRepository};
use crate::Result;
use std::sync::{Arc, LazyLock, Mutex, RwLock};

static REGISTRY: LazyLock<Arc<Mutex<RepositoryRegistry>>> =
Expand Down
4 changes: 2 additions & 2 deletions postgresql_archive/tests/blocking.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[cfg(feature = "blocking")]
use postgresql_archive::VersionReq;
#[cfg(feature = "blocking")]
use postgresql_archive::blocking::{extract, get_archive, get_version};
#[cfg(feature = "blocking")]
use postgresql_archive::configuration::theseus;
#[cfg(feature = "blocking")]
use postgresql_archive::VersionReq;
#[cfg(feature = "blocking")]
use std::fs::remove_dir_all;
#[cfg(feature = "blocking")]
use test_log::test;
Expand Down
4 changes: 2 additions & 2 deletions postgresql_commands/src/clusterdb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::traits::CommandBuilder;
use crate::Settings;
use crate::traits::CommandBuilder;
use std::convert::AsRef;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
Expand Down Expand Up @@ -258,8 +258,8 @@ impl CommandBuilder for ClusterDbBuilder {
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::CommandToString;
use crate::TestSettings;
use crate::traits::CommandToString;
use test_log::test;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions postgresql_commands/src/createdb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::traits::CommandBuilder;
use crate::Settings;
use crate::traits::CommandBuilder;
use std::convert::AsRef;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
Expand Down Expand Up @@ -363,8 +363,8 @@ impl CommandBuilder for CreateDbBuilder {
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::CommandToString;
use crate::TestSettings;
use crate::traits::CommandToString;
use test_log::test;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions postgresql_commands/src/createuser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::traits::CommandBuilder;
use crate::Settings;
use crate::traits::CommandBuilder;
use std::convert::AsRef;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
Expand Down Expand Up @@ -440,8 +440,8 @@ impl CommandBuilder for CreateUserBuilder {
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::CommandToString;
use crate::TestSettings;
use crate::traits::CommandToString;
use test_log::test;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions postgresql_commands/src/dropdb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::traits::CommandBuilder;
use crate::Settings;
use crate::traits::CommandBuilder;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;

Expand Down Expand Up @@ -243,8 +243,8 @@ impl CommandBuilder for DropDbBuilder {
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::CommandToString;
use crate::TestSettings;
use crate::traits::CommandToString;
use test_log::test;

#[test]
Expand Down
Loading