Expand description
§postgresql_archive
Retrieve and extract PostgreSQL on Linux, MacOS or Windows.
§Table of contents
§Examples
§Asynchronous API
use postgresql_archive::{extract, get_archive, Result, VersionReq };
use postgresql_archive::configuration::theseus;
#[tokio::main]
async fn main() -> Result<()> {
let url = theseus::URL;
let (archive_version, archive) = get_archive(url, &VersionReq::STAR).await?;
let out_dir = std::env::temp_dir();
let files = extract(url, &archive, &out_dir).await?;
Ok(())
}
§Synchronous API
#[cfg(feature = "blocking")] {
use postgresql_archive::configuration::theseus;
use postgresql_archive::VersionReq;
use postgresql_archive::blocking::{extract, get_archive};
let url = theseus::URL;
let (archive_version, archive) = get_archive(url, &VersionReq::STAR).unwrap();
let out_dir = std::env::temp_dir();
let result = extract(url, &archive, &out_dir).unwrap();
}
§Feature flags
postgresql_archive uses [feature flags] to address compile time and binary size uses.
The following features are available:
Name | Description | Default? |
---|---|---|
blocking | Enables the blocking API | No |
native-tls | Enables native-tls support | Yes |
rustls | Enables rustls support | No |
§Configurations
Name | Description | Default? |
---|---|---|
theseus | Enables theseus PostgreSQL binaries | Yes |
zonky | Enables zonky PostgreSQL binaries | No |
§Hashers
Name | Description | Default? |
---|---|---|
md5 | Enables md5 hashers | No |
sha1 | Enables sha1 hashers | No |
sha2 | Enables sha2 hashers | Yes¹ |
¹ enabled by the theseus
feature flag.
§Repositories
Name | Description | Default? |
---|---|---|
github | Enables github repository | Yes¹ |
maven | Enables maven repository | No |
¹ enabled by the theseus
feature flag.
§Supported platforms
postgresql_archive
provides implementations for the following:
§Safety
This crate uses #![forbid(unsafe_code)]
to ensure everything is implemented in 100% safe Rust.
§License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
PostgreSQL is covered under The PostgreSQL License.
Modules§
Structs§
- Version
- SemVer version as defined by https://semver.org.
- Version
Req - SemVer version requirement describing the intersection of some version
comparators, such as
>=1.2.3, <1.8
.
Enums§
- Error
- PostgreSQL archive errors
Traits§
- Exact
Version - A trait for getting the exact version from a version requirement.
- Exact
Version Req - A trait for getting the exact version requirement from a version.
Functions§
- extract
- Extracts the compressed tar
bytes
to the out_dir. - get_
archive - Gets the archive for a given version requirement that passes the default matcher. If no archive is found for the version requirement and matcher then an error is returned.
- get_
version - Gets the version for the specified version requirement. If a version for the version requirement is not found, then an error is returned.
Type Aliases§
- Result
- PostgreSQL archive result type