Showing preview only (840K chars total). Download the full file or copy to clipboard to get everything.
Repository: theseus-rs/postgresql-embedded
Branch: main
Commit: 1ba09d45f1bb
Files: 183
Total size: 786.5 KB
Directory structure:
gitextract_ipdr6byb/
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ └── feature_request.md
│ ├── codecov.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── benchmarks.yml
│ ├── checks.yml
│ ├── ci.yml
│ ├── pr-benchmarks.yml
│ └── release-plz.yml
├── .gitignore
├── .rustfmt.toml
├── CHANGELOG.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── SECURITY.md
├── clippy.toml
├── deny.toml
├── examples/
│ ├── archive_async/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── archive_sync/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── axum_embedded/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── diesel_embedded/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── diesel.toml
│ │ ├── migrations/
│ │ │ ├── .keep
│ │ │ └── 2024-08-17-200823_create_posts/
│ │ │ ├── down.sql
│ │ │ └── up.sql
│ │ └── src/
│ │ ├── main.rs
│ │ ├── models.rs
│ │ └── schema.rs
│ ├── download_progress_bar/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── embedded_async/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── embedded_sync/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── portal_corp_extension/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── postgres_embedded/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src/
│ │ └── main.rs
│ ├── sqlx_embedded/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src/
│ │ └── main.rs
│ ├── tensor_chord_extension/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ ├── unix_socket/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── main.rs
│ └── zonky/
│ ├── Cargo.toml
│ └── src/
│ └── main.rs
├── postgresql_archive/
│ ├── Cargo.toml
│ ├── README.md
│ ├── benches/
│ │ └── archive.rs
│ ├── src/
│ │ ├── archive.rs
│ │ ├── blocking/
│ │ │ ├── archive.rs
│ │ │ └── mod.rs
│ │ ├── configuration/
│ │ │ ├── custom/
│ │ │ │ ├── matcher.rs
│ │ │ │ └── mod.rs
│ │ │ ├── mod.rs
│ │ │ ├── theseus/
│ │ │ │ ├── extractor.rs
│ │ │ │ ├── matcher.rs
│ │ │ │ └── mod.rs
│ │ │ └── zonky/
│ │ │ ├── extractor.rs
│ │ │ ├── matcher.rs
│ │ │ ├── mod.rs
│ │ │ └── repository.rs
│ │ ├── error.rs
│ │ ├── extractor/
│ │ │ ├── mod.rs
│ │ │ ├── model.rs
│ │ │ ├── registry.rs
│ │ │ ├── tar_gz_extractor.rs
│ │ │ ├── tar_xz_extractor.rs
│ │ │ └── zip_extractor.rs
│ │ ├── hasher/
│ │ │ ├── md5.rs
│ │ │ ├── mod.rs
│ │ │ ├── registry.rs
│ │ │ ├── sha1.rs
│ │ │ ├── sha2_256.rs
│ │ │ └── sha2_512.rs
│ │ ├── lib.rs
│ │ ├── matcher/
│ │ │ ├── mod.rs
│ │ │ └── registry.rs
│ │ ├── repository/
│ │ │ ├── github/
│ │ │ │ ├── mod.rs
│ │ │ │ ├── models.rs
│ │ │ │ └── repository.rs
│ │ │ ├── maven/
│ │ │ │ ├── mod.rs
│ │ │ │ ├── models.rs
│ │ │ │ └── repository.rs
│ │ │ ├── mod.rs
│ │ │ ├── model.rs
│ │ │ └── registry.rs
│ │ └── version.rs
│ └── tests/
│ ├── archive.rs
│ ├── blocking.rs
│ └── zonky.rs
├── postgresql_commands/
│ ├── Cargo.toml
│ ├── README.md
│ └── src/
│ ├── clusterdb.rs
│ ├── createdb.rs
│ ├── createuser.rs
│ ├── dropdb.rs
│ ├── dropuser.rs
│ ├── ecpg.rs
│ ├── error.rs
│ ├── initdb.rs
│ ├── lib.rs
│ ├── oid2name.rs
│ ├── pg_amcheck.rs
│ ├── pg_archivecleanup.rs
│ ├── pg_basebackup.rs
│ ├── pg_checksums.rs
│ ├── pg_config.rs
│ ├── pg_controldata.rs
│ ├── pg_ctl.rs
│ ├── pg_dump.rs
│ ├── pg_dumpall.rs
│ ├── pg_isready.rs
│ ├── pg_receivewal.rs
│ ├── pg_recvlogical.rs
│ ├── pg_resetwal.rs
│ ├── pg_restore.rs
│ ├── pg_rewind.rs
│ ├── pg_test_fsync.rs
│ ├── pg_test_timing.rs
│ ├── pg_upgrade.rs
│ ├── pg_verifybackup.rs
│ ├── pg_waldump.rs
│ ├── pgbench.rs
│ ├── postgres.rs
│ ├── psql.rs
│ ├── reindexdb.rs
│ ├── traits.rs
│ ├── vacuumdb.rs
│ └── vacuumlo.rs
├── postgresql_embedded/
│ ├── Cargo.toml
│ ├── README.md
│ ├── benches/
│ │ └── embedded.rs
│ ├── build/
│ │ ├── build.rs
│ │ └── bundle.rs
│ ├── src/
│ │ ├── blocking/
│ │ │ ├── mod.rs
│ │ │ └── postgresql.rs
│ │ ├── error.rs
│ │ ├── lib.rs
│ │ ├── postgresql.rs
│ │ └── settings.rs
│ └── tests/
│ ├── blocking.rs
│ ├── dump_command.rs
│ ├── environment_variables.rs
│ ├── postgresql.rs
│ ├── start_config.rs
│ ├── unix_socket.rs
│ └── zonky.rs
├── postgresql_extensions/
│ ├── Cargo.toml
│ ├── README.md
│ ├── src/
│ │ ├── blocking/
│ │ │ ├── extensions.rs
│ │ │ └── mod.rs
│ │ ├── error.rs
│ │ ├── extensions.rs
│ │ ├── lib.rs
│ │ ├── matcher.rs
│ │ ├── model.rs
│ │ └── repository/
│ │ ├── mod.rs
│ │ ├── model.rs
│ │ ├── portal_corp/
│ │ │ ├── mod.rs
│ │ │ └── repository.rs
│ │ ├── registry.rs
│ │ ├── steampipe/
│ │ │ ├── extensions.rs
│ │ │ ├── mod.rs
│ │ │ └── repository.rs
│ │ └── tensor_chord/
│ │ ├── mod.rs
│ │ └── repository.rs
│ └── tests/
│ ├── blocking.rs
│ ├── extensions.rs
│ ├── portal_corp.rs
│ └── steampipe.rs
├── release-plz.toml
└── rust-toolchain.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
github: brianheineman
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: "\U0001F41E Bug Report"
about: "If something isn't working as expected \U0001F914."
title: ''
labels: 'i: bug, i: needs triage'
assignees: ''
---
**What steps will reproduce the bug? (please provide code snippet if relevant)**
1. step 1
2. step 2
3. ...
**What happens?**
...
**What did you expect to happen instead?**
...
### Information about your environment
* postgresql_embedded version: [REQUIRED] (e.g. "0.14.2")
* Database version: [REQUIRED] (e.g. "16.4.0")
* Operating system: [REQUIRED]
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: "\U00002728 Feature Request"
about: "I have a suggestion (and may want to implement it \U0001F642)!"
title: ''
labels: 'i: enhancement, i: needs triage'
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context about the feature request here.
================================================
FILE: .github/codecov.yml
================================================
coverage:
status:
patch:
default:
threshold: 0.05%
project:
default:
threshold: 0.05%
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "monthly"
================================================
FILE: .github/workflows/benchmarks.yml
================================================
name: Benchmarks
on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]
permissions:
contents: read
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
components: 'llvm-tools-preview'
toolchain: stable
- name: Install benchmarking tools
uses: bencherdev/bencher@main
- name: Run benchmarks
if: ${{ github.event_name == 'pull_request' }}
env:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_PROJECT: theseus-rs-postgresql-embedded
BENCHER_ADAPTER: rust_criterion
run: |
bencher run \
--branch $GITHUB_HEAD_REF \
--ci-number "${{ github.event.number }}" \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--err \
"cargo bench --features blocking"
- name: Run benchmarks
if: ${{ github.event_name != 'pull_request' }}
env:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_PROJECT: theseus-rs-postgresql-embedded
BENCHER_ADAPTER: rust_criterion
run: |
bencher run "cargo bench --features blocking"
================================================
FILE: .github/workflows/checks.yml
================================================
name: Fast checks
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
on:
workflow_call:
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo audit
run: cargo install cargo-audit
- name: Audit dependencies
run: cargo audit
check:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Check the project
run: |
cargo check --workspace --all-targets --features blocking
cargo check --workspace --all-targets --features bundled
cargo check --workspace --all-targets --features tokio
cargo check --workspace --all-targets --all-features
clippy:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Check lints
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
cargo clippy --all-targets --all-features --examples --tests
deny:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo deny
run: cargo install cargo-deny
- name: Check licenses
run: cargo deny check --allow duplicate
doc:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --no-deps --document-private-items --all-features
fmt:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
================================================
FILE: .github/workflows/ci.yml
================================================
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
checks:
name: Checks
uses: ./.github/workflows/checks.yml
build:
name: ${{ matrix.platform }}
needs: [ checks ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform:
- linux-arm
- linux-x64
- macos-arm
- macos-x64
- windows-x64
include:
- platform: linux-arm
os: ubuntu-24.04-arm
- platform: linux-x64
os: ubuntu-latest
- platform: macos-arm
os: macos-15
- platform: macos-x64
os: macos-15-intel
- platform: windows-x64
os: windows-2022
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@main
with:
tool: cargo-llvm-cov
- name: Tests
if: ${{ matrix.platform != 'linux-x64' }}
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RUST_LOG: "info,postgresql_archive=debug,postgresql_commands=debug,postgresql_embedded=debug"
RUST_LOG_SPAN_EVENTS: full
run: |
cargo test
- name: Tests
if: ${{ matrix.platform == 'linux-x64' }}
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RUST_LOG: "info,postgresql_archive=debug,postgresql_commands=debug,postgresql_embedded=debug"
RUST_LOG_SPAN_EVENTS: full
run: |
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload to codecov.io
if: ${{ matrix.platform == 'linux-x64' }}
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
================================================
FILE: .github/workflows/pr-benchmarks.yml
================================================
name: Benchmarks
on:
pull_request:
types: [ opened, reopened, synchronize ]
permissions:
contents: read
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-22.04
permissions:
pull-requests: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
components: 'llvm-tools-preview'
toolchain: stable
- name: Install benchmarking tools
uses: bencherdev/bencher@main
- name: Run benchmarks
env:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_PROJECT: theseus-rs-postgresql-embedded
BENCHER_ADAPTER: rust_criterion
run: |
bencher run \
--branch $GITHUB_HEAD_REF \
--ci-number "${{ github.event.number }}" \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--err \
"cargo bench --features blocking"
================================================
FILE: .github/workflows/release-plz.yml
================================================
name: Release-plz
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
jobs:
# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
================================================
FILE: .gitignore
================================================
/target
# Rust Rover
/.idea
================================================
FILE: .rustfmt.toml
================================================
newline_style = "Unix"
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## `postgresql_extensions` - [0.20.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.20.1...postgresql_extensions-v0.20.2) - 2026-02-22
### Other
- remove num-format dependency
## `postgresql_embedded` - [0.20.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.20.1...v0.20.2) - 2026-02-22
### Added
- add unix socket support
### Other
- remove num-format dependency
## `postgresql_commands` - [0.20.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.20.1...postgresql_commands-v0.20.2) - 2026-02-22
### Added
- add unix socket support
## `postgresql_archive` - [0.20.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.20.1...postgresql_archive-v0.20.2) - 2026-02-22
### Added
- add unix socket support
### Other
- remove num-format dependency
## `postgresql_extensions` - [0.20.1](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.20.0...postgresql_extensions-v0.20.1) - 2026-02-08
### Other
- update rust to 1.92.0
- reduce map_err by adding some From<Error> implementations
## `postgresql_embedded` - [0.20.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.20.0...v0.20.1) - 2026-02-08
### Added
- add postgresql v18 support
### Fixed
- update to support all targets
### Other
- Merge branch 'main' into caching_builds
- Target
- Cache archives
- update rust to 1.92.0
- reduce map_err by adding some From<Error> implementations
## `postgresql_commands` - [0.20.1](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.20.0...postgresql_commands-v0.20.1) - 2026-02-08
### Other
- update rust to 1.92.0
## `postgresql_archive` - [0.20.1](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.20.0...postgresql_archive-v0.20.1) - 2026-02-08
### Other
- update rust to 1.92.0
- reduce map_err by adding some From<Error> implementations
## `postgresql_extensions` - [0.20.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.19.0...postgresql_extensions-v0.20.0) - 2025-08-31
### Fixed
- always use the build version of postgresql when the bundled feature is enabled to avoid network access
### Other
- remove devcontainer support
## `postgresql_embedded` - [0.20.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.19.0...v0.20.0) - 2025-08-31
### Fixed
- always use the build version of postgresql when the bundled feature is enabled to avoid network access
- [**breaking**] rename pg_dump compression argument to compress
### Other
- minor doc updates
- remove devcontainer support
- correct lint errors
- update to Rust 1.89.0
## `postgresql_commands` - [0.20.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.19.0...postgresql_commands-v0.20.0) - 2025-08-31
### Fixed
- [**breaking**] rename pg_dump compression argument to compress
### Other
- remove devcontainer support
## `postgresql_archive` - [0.20.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.19.0...postgresql_archive-v0.20.0) - 2025-08-31
### Other
- minor doc updates
- remove devcontainer support
## `postgresql_embedded` - [0.19.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.7...v0.19.0) - 2025-06-24
### Added
- allow skipping the installation step during setup
### Other
- correct typo in variable name
- update extractor feature documentation
## `postgresql_archive` - [0.19.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.7...postgresql_archive-v0.19.0) - 2025-06-24
### Other
- update extractor feature documentation
## `postgresql_embedded` - [0.18.7](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.6...v0.18.7) - 2025-06-20
### Fixed
- set CREATE_NO_WINDOW creation flag on Windows
### Other
- update Cargo.toml dependencies
## `postgresql_commands` - [0.18.7](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.18.6...postgresql_commands-v0.18.7) - 2025-06-20
### Fixed
- set CREATE_NO_WINDOW creation flag on Windows
## `postgresql_archive` - [0.18.7](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.6...postgresql_archive-v0.18.7) - 2025-06-20
### Other
- update Cargo.toml dependencies
## `postgresql_extensions` - [0.18.6](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.18.5...postgresql_extensions-v0.18.6) - 2025-06-17
### Added
- add extractor feature flags
### Other
- correct lint errors
## `postgresql_embedded` - [0.18.6](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.5...v0.18.6) - 2025-06-17
### Added
- add extractor feature flags
### Other
- make liblzma an optional dependency
- add documentation for bundled feature flag
- correct lint errors
## `postgresql_archive` - [0.18.6](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.5...postgresql_archive-v0.18.6) - 2025-06-17
### Added
- add extractor feature flags
### Other
- make liblzma an optional dependency
- correct lint errors
## `postgresql_extensions` - [0.18.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.18.4...postgresql_extensions-v0.18.5) - 2025-05-28
### Other
- update Cargo.toml dependencies
## `postgresql_embedded` - [0.18.5](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.4...v0.18.5) - 2025-05-28
### Fixed
- correct theseus build bundle
- revert SupportFn type change
- custom release url not working and compilation failure
### Other
- Merge branch 'main' into main
- update to criterion=0.6.0, pgvector=0.4.1, reqwest=0.12.18, sqlx=0.8.6, tokio=1.45.1, zip=4.0.0
- minor syntax change
- update Cargo.toml dependencies
## `postgresql_commands` - [0.18.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.18.4...postgresql_commands-v0.18.5) - 2025-05-28
### Other
- update Cargo.toml dependencies
## `postgresql_archive` - [0.18.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.4...postgresql_archive-v0.18.5) - 2025-05-28
### Fixed
- correct theseus build bundle
- revert SupportFn type change
- custom release url not working and compilation failure
### Other
- update to criterion=0.6.0, pgvector=0.4.1, reqwest=0.12.18, sqlx=0.8.6, tokio=1.45.1, zip=4.0.0
- minor syntax change
## `postgresql_extensions` - [0.18.4](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.18.3...postgresql_extensions-v0.18.4) - 2025-05-15
### Other
- update Cargo.toml dependencies
## `postgresql_embedded` - [0.18.4](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.3...v0.18.4) - 2025-05-15
### Other
- update to Rust 1.87.0
- update dependencies
- update Cargo.toml dependencies
## `postgresql_commands` - [0.18.4](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.18.3...postgresql_commands-v0.18.4) - 2025-05-15
### Other
- update to Rust 1.87.0
## `postgresql_archive` - [0.18.4](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.3...postgresql_archive-v0.18.4) - 2025-05-15
### Other
- update to Rust 1.87.0
- update dependencies
## `postgresql_extensions` - [0.18.3](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.18.2...postgresql_extensions-v0.18.3) - 2025-04-03
### Other
- update to Rust 1.86.0
## `postgresql_embedded` - [0.18.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.2...v0.18.3) - 2025-04-03
### Other
- update Cargo.toml dependencies
- update to Rust 1.86.0
## `postgresql_archive` - [0.18.3](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.2...postgresql_archive-v0.18.3) - 2025-04-03
### Other
- update Cargo.toml dependencies
## `postgresql_extensions` - [0.18.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.18.1...postgresql_extensions-v0.18.2) - 2025-03-21
### Other
- update Cargo.toml dependencies
## `postgresql_embedded` - [0.18.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.1...v0.18.2) - 2025-03-21
### Other
- update Cargo.toml dependencies
## `postgresql_commands` - [0.18.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.18.1...postgresql_commands-v0.18.2) - 2025-03-21
### Other
- update Cargo.toml dependencies
## `postgresql_archive` - [0.18.2](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.18.1...postgresql_archive-v0.18.2) - 2025-03-21
### Other
- update Cargo.toml dependencies
## `postgresql_embedded` - [0.18.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.18.0...v0.18.1) - 2025-02-26
### Fix
- Check for existing installations in children before installing
## `postgresql_extensions` - [0.18.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.17.5...postgresql_extensions-v0.18.0) - 2025-02-20
### Added
- update to Rust 2024 edition
### Other
- [**breaking**] rename feature rustls-tls to rustls
## `postgresql_commands` - [0.18.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.17.5...postgresql_commands-v0.18.0) - 2025-02-20
### Added
- update to Rust 2024 edition
## `postgresql_embedded` - [0.18.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.5...v0.18.0) - 2025-02-20
### Added
- update to Rust 2024 edition
### Other
- update dependencies
- [**breaking**] rename feature rustls-tls to rustls
## `postgresql_archive` - [0.18.0](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.17.5...postgresql_archive-v0.18.0) - 2025-02-20
### Added
- update to Rust 2024 edition
### Other
- [**breaking**] rename feature rustls-tls to rustls
## `postgresql_extensions` - [0.17.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_extensions-v0.17.4...postgresql_extensions-v0.17.5) - 2025-01-25
### Other
- replace regex with regex-lite to reduce dependencies
- update ci configuration
## `postgresql_commands` - [0.17.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_commands-v0.17.4...postgresql_commands-v0.17.5) - 2025-01-25
### Other
- remove anyhow and human_bytes dependencies
## `postgresql_embedded` - [0.17.5](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.4...v0.17.5) - 2025-01-25
### Other
- make tracing-indicatif optional
- remove anyhow and human_bytes dependencies
- replace regex with regex-lite to reduce dependencies
- remove http dependency
- update ci configuration
## `postgresql_archive` - [0.17.5](https://github.com/theseus-rs/postgresql-embedded/compare/postgresql_archive-v0.17.4...postgresql_archive-v0.17.5) - 2025-01-25
### Other
- replace regex with regex-lite to reduce dependencies
- remove http dependency
- make tracing-indicatif optional
- remove anyhow and human_bytes dependencies
## `postgresql_embedded` - [v0.17.4](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.3...v0.17.4) - 2025-01-17
### Chore
- update to Rust 1.83
- update to Rust 1.84
### Fix
- correct deny.toml
- use tokio::process::spawn() for pc_ctl on Windows
## `postgresql_embedded` - [v0.17.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.2...v0.17.3) - 2024-11-12
### Build
- update codecov action to version 4
- update code coverage generation
- update to Rust 1.82.0
### Chore
- add FUNDING.yml
- add FUNDING.yml
- correct new linting errors
- update dependencies
- add Unicode-3.0 as an allowed license
### Fix
- correct zonky extractor
## `postgresql_embedded` - [v0.17.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.1...v0.17.2) - 2024-10-01
### Build
- correct documentation build
## `postgresql_embedded` - [v0.17.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.17.0...v0.17.1) - 2024-10-01
### Build
- correct documentation build
- update dependencies
## `postgresql_embedded` - [v0.17.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.16.3...v0.17.0) - 2024-09-28
### Chore
- update dependencies
- add issue templates
- forbid clippy allow attributes
- add rust-toolchain.toml
- updates for clippy lints
### Deprecated
- [**breaking**] remove version 12 and deprecate version 13
### Fix
- allow archives to be bundled from alternate github repositories
### Test
- update extension test to run with specific postgresql version
## `postgresql_embedded` - [v0.16.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.16.2...v0.16.3) - 2024-09-04
### Chore
- switch from xz2 to liblzma
- ignore .idea directory
## `postgresql_embedded` - [v0.16.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.16.1...v0.16.2) - 2024-08-24
### Build
- update audit and deny checks
### Docs
- split axum and progress bar examples
- minor doc correction
### Fix
- update dependencies to address [RUSTSEC-2024-0363](https://rustsec.org/advisories/RUSTSEC-2024-0363.html)
### Refactor
- rename embedded_async_diesel_r2d2 to diesel_embedded
## `postgresql_embedded` - [v0.16.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.16.0...v0.16.1) - 2024-08-13
### Build
- remove unused dependencies
### Docs
- add axum example
- add indicatif to axum example
### Feat
- add archive tracing progress bar status
### Fix
- update maven status to set progress bar position
### Test
- update version of postgresql used for testing from 16.3.0 to 16.4.0
- update windows test assertion
## `postgresql_embedded` - [v0.16.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.15.0...v0.16.0) - 2024-08-04
### Build
- sort dependencies
- update dependencies
- address lint error
### Docs
- add PortalCorp example for pgvector
### Feat
- add portal corp extensions
### Fix
- correct steampipe extension url resolution
- add .dll support
- update steampipe to use detected OS if not on macos
- correct extension regex to match file extensions
### Refactor
- [**breaking**] refactor extension matchers
- [**breaking**] return list of files from archive extract function
- [**breaking**] refactor archive extract directories
- refactor zonky extractor to use generic tar_xz_extractor
### Test
- update portal corp test so that it does not run on macos x64
- add tests for extension matchers
- update archive test assertions to be platform specific
- update expected files extracted
- improve matcher error tests
- enable portal corp test for all platforms
## `postgresql_embedded` - [v0.15.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.14.2...v0.15.0) - 2024-08-01
### Build
- update tls features
- add github feature to steampipe and tensor-chord
### Docs
- correct doc errors
- correct doc errors
- add vector extension example
- update vector_extension example to run queries
### Feat
- [**breaking**] initial postgresql_extensions crate
### Fix
- registered github archive repositories for extensions
- correct steampipe install matcher
- [**breaking**] update extension matchers to use postgresql major version
- correct cargo check failure
- correct serialization error writing configuration
- correct vector example error
- linting error
### Refactor
- de-deduplicate steampipe matcher logic
### Test
- add version tests
- remove unused extension model
- update lifecycle test to run on linux only
- update steampipe test to run on macos
- disable steampipe test on macos
- update steampipe matcher test
- improve model test coverage
## `postgresql_embedded` - [v0.14.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.14.1...v0.14.2) - 2024-07-17
### Build
- remove clear caches action
### Docs
- add version optimization documentation
### Fix
- updated PgConfigBuilder interface to align with pg_config executable
- improve commands on windows to return stdout and stderr
- correct linting errors
### Test
- correct windows test failure
## `postgresql_embedded` - [v0.14.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.14.0...v0.14.1) - 2024-07-06
### Build
- change default from rustls-tls to native-tls
- suppress lint warning
- correct lint error
- correct formatting
- update non-windows build configuration
- update non-windows build tests
### Docs
- update docs for new features
### Fix
- correct bug where commands hang on windows when retrieving stdout/stderr
- correct hang when tokio is not used
- update command tests to work on Windows
### Test
- correct linux/macos tests
- increase timeout to 30 seconds
- increase timeout to 30 seconds
- revert timeout to 5 seconds
## `postgresql_embedded` - [v0.14.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.13.0...v0.14.0) - 2024-07-03
### Feat
- [**breaking**] add feature flags to enable zonky
### Test
- correct extract test implementations
## `postgresql_embedded` - [v0.13.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.12.0...v0.13.0) - 2024-07-01
### Build
- pin dependencies
- update use definitions when blocking feature enabled
- unpin dependencies
- correct url dependency definition
- correct documentation link error
- print target triple during build
- remove build caching
- correct lint error
- update license rules
- correct formatting error
### Docs
- update README.md
- simplify documentation
- remove reference to Bytes
- update documentation
- update readmes
### Feat
- [**breaking**] add semantic versioing support and configurable repositories
- add matcher registry
- [**breaking**] add configurable hashers
- add sha2-512 support
- add blake2 and sha3 hash support
- add hasher and matcher supports function
- [**breaking**] add configurable extractors
- add support for installing binaries from the zonky project
- add SHA1 hash support for older Maven repositories
- utilize sqlx for database management to support PostgreSQL installations that do not bundle psql
- update hasher registry to work with Maven central and add MD5 hash
### Fix
- correct asset hash logic
- convert possible panics to errors
### Refactor
- [**breaking**] rename ReleaseNotFound to VersionNotFound
- [**breaking**] remove bytes dependency
- [**breaking**] remove bytes dependency
- remove default registry values
### Test
- remove extraneous tests
- add tests to improve test coverage
- correct test_blake2b_512
- improve test coverage
- add zonky archive integration test
- correct hash test
## `postgresql_embedded` - [v0.12.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.11.0...v0.12.0) - 2024-06-21
### Refactor
- [**breaking**] move version from PostgreSQL::new() to Settings
## `postgresql_embedded` - [v0.11.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.10.2...v0.11.0) - 2024-06-20
### Build
- Enable pedantic lints
### Docs
- update documentation
- updated archive documentation examples
### Feat
- [**breaking**] allow releases URL to be configured
- allow releases url to be specified at build time when the bundles flag is set with the POSTGRESQL_RELEASES_URL
environment variable
- export Version to improve dx
### Fix
- reference settings directly instead of via function call
- update examples
- pass settings release_url when bundled flag is set
### Test
- add missing command error tests and clean up lint directives
## `postgresql_embedded` - [v0.10.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.10.1...v0.10.2) - 2024-06-18
### Fix
- correct errors when PGDATABASE envar is set
## `postgresql_embedded` - [v0.10.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.5...v0.10.1) - 2024-06-14
### Build
- allow Unicode-3.0 license
### Feat
- [**breaking**] add ability to specify multiple pg_ctl options and define server configuration in Settings
## `postgresql_embedded` - [v0.9.5](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.4...v0.9.5) - 2024-06-03
### Build
- address pedantic clippy warnings
### Fix
- don't require rustls for the build script. only enable by default.
## `postgresql_embedded` - [v0.9.4](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.3...v0.9.4) - 2024-05-31
### Feat
- add native-tls support
## `postgresql_embedded` - [v0.9.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.2...v0.9.3) - 2024-05-21
### PostgreSQL
- don't trace self, and when tracing commands only trace the base name. makes the traces less enormous and also avoids
dumping passwords into traces.
## `postgresql_embedded` - [v0.9.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.1...v0.9.2) - 2024-05-19
### Build
- correct lint warnings
- update dependencies
### Chore
- update dependencies
### Fix
- correct debug message
### Test
- add authentication tests
- improve test coverage
## `postgresql_embedded` - [v0.9.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.9.0...v0.9.1) - 2024-05-01
### Fix
- create extract_dir on same filesystem as out_dir
##
`postgresql_embedded` - [v0.9.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.8.3...v0.9.0) - 2024-04-26
### Fix
- [**breaking**] define bootstrap superuser as postgres
- [**breaking**] define bootstrap superuser as postgres
##
`postgresql_embedded` - [v0.8.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.8.2...v0.8.3) - 2024-04-21
### Build
- add CODECOV_TOKEN to code coverage build step
### Chore
- update dependencies
- update reqwest libraries
- address format error
## `postgresql_embedded` - [v0.8.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.8.1...v0.8.2) - 2024-04-05
### Fix
- suppress bytes parameter in tracing instrumentation
## `postgresql_embedded` - [v0.8.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.8.0...v0.8.1) - 2024-04-03
### Build
- update build dependencies to address audit check
### Test
- add command integration test
## `postgresql_embedded` - [v0.8.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.7.3...v0.8.0) - 2024-04-03
### Build
- update dependencies
- correct linting errors
### Refactor
- [**breaking**] move commands into postgresql_commands crate
## `postgresql_embedded` - [v0.7.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.7.2...v0.7.3) - 2024-03-25
### Chore
- remove scorecard.yml
### Feat
- add ability to create settings from a url
### Refact
- remove use of embedded=true parameter
## `postgresql_embedded` - [v0.7.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.7.1...v0.7.2) - 2024-03-16
### Chore
- add Debug trait to CommandBuilder
### Feat
- add tracing instrumentation
## `postgresql_embedded` - [v0.7.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.7.0...v0.7.1) - 2024-03-15
### Fix
- correct parallel archive extract failures
## `postgresql_embedded` - [v0.7.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.6.2...v0.7.0) - 2024-03-15
### Docs
- update vscode development container instructions
### Fix
- [**breaking**] correct parallel archive extract failures
## `postgresql_embedded` - [v0.6.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.6.1...v0.6.2) - 2024-03-07
### Chore
- correct lint error
### Feat
- add reqwest backoff/retry logic and tracing support
## `postgresql_embedded` - [v0.6.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.6.0...v0.6.1) - 2024-03-06
### Chore
- update use of settings of postgres connection and correct typo in output
- update dependencies
- remove use of copy left license MPL-2.0 from dependencies
### Fix
- update dependencies to address RUSTSEC-2024-0020
## `postgresql_embedded` - [v0.6.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.5.0...v0.6.0) - 2024-02-24
### Chore
- correct formatting
- correct linting error
### Fix
- [**breaking**] remove bundled as a default feature and corrected bug when the bundled feature is not used
## `postgresql_embedded` - [v0.5.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.4.1...v0.5.0) - 2024-02-22
### Chore
- remove unnecessary use of command pipes
- update action permissions to reduce write privilege scope
- ignore RUSTSEC-2023-0071 as it is only used in sqlx example code
- correct linting errors
### Ci
- run all benchmarks from workspace at once instead of individually from crates
### Docs
- add SECURITY.md
- add postgres driver and sqlx examples
- add documentation explaining why RUSTSEC-2023-0071 is ignored
### Refactor
- [**breaking**] refactor status to check on demand instead of attempting to track the state dynamically
### Test
- remove unused code
## `postgresql_embedded` - [v0.4.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.4.0...v0.4.1) - 2024-02-18
### Chore
- Add initial dev container support
- update windows to use UTF8 to align with other operating systems and utilize capabilities of the newer releases
from https://github.com/theseus-rs/postgresql-binaries
- add code coverage configuration
- remove extraneous line in Cargo.toml
- update release drafter to version 6 to address node 16 deprecation warning
- update pr-benchmarks name
### Ci
- update build to run benchmarks
- add BENCHER_API_TOKEN to benchmark action
- remove build.yml and move jobs into ci.yml
- split benchmark runs
- update build to run benchmarks
- add benchmark pull request integration
- update approach for setting ci-number
- add pull-requests: write permission
- remove conditional pr benchmark statements
### Docs
- add cargo keywords
- update docs for new functions
- add bencher badges
### Feat
- add devcontainer support
### Refactor
- update psql to manage setting the PGPASSWORD environment variable when pg_password is set
- refactor the way benchmarks run on the main branch vs a PR
### Test
- add benchmarks
- add CommandBuilder test coverage
- correct the embedded lifecycle benchmark name
- reduce archive benchmark sample size to 10
- update benchmark configuration
- remove bencher conditional arguments
- combine benchmark runs into one step
- remove all bencher options
- reduce embedded sample size to 10 to reduce benchmark runtime
- update benchmark pull request configuration
## `postgresql_embedded` - [v0.4.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.3.2...v0.4.0) - 2024-02-13
### Docs
- add postgres to keywords
### Refactor
- [**breaking**] remove archive hash from the public interface and always calculate/verify the has when requesting an
archive
- [**breaking**] remove archive hash from the public interface and always calculate/verify the has when requesting an
archive
- simplified installation logic and improved code coverage
### Test
- improve lifecycle test coverage
- update elapsed error test to sleep longer to prevent intermittent test failure
## `postgresql_embedded` - [v0.3.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.3.1...v0.3.2) - 2024-02-13
### Bug
- correct bug where serialization fails when there is a draft release of the PostgreSQL binaries
### Chore
- add examples
- add missing license definitions
### Test
- update test code coverage
- add tests for examples
## `postgresql_embedded` - [v0.3.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.3.0...v0.3.1) - 2024-02-12
### Chore
- address linting error
- change tracing levels from info to debug
### Ci
- add pull request labeler
### Docs
- update cargo description
### Refactor
- update postgresql_embedded::ArchiveError argument
## `postgresql_embedded` - [v0.3.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.2.3...v0.3.0) - 2024-02-11
### Ci
- add release drafter
### Refactor
- [**breaking**] rename ArchiveError to postgresql_archive::Error and EmbeddedError to postgresql_embedded::Error
## `postgresql_embedded` - [v0.2.3](https://github.com/theseus-rs/postgresql-embedded/compare/v0.2.2...v0.2.3) - 2024-02-11
### Ci
- add scheduled action to clear github caches
## `postgresql_embedded` - [v0.2.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.2.1...v0.2.2) - 2024-02-11
### Bug
- warn when a release tag name does not match the expected version pattern
### Chore
- remove default feature test
- update release to 0.2.2
### Docs
- wrap synchronous API docs in feature blocks
- remove ci badge from rust docs
- update examples in documentation to remove unnecessary use of .unwrap()
### Feat
- enable code coverage
- add code coverage badges
### Test
- add tests to improve code coverage
- updated valid initial statuses
## `postgresql_embedded` - [v0.2.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.2.0...v0.2.1) - 2024-02-10
### Chore
- update release to 0.2.1
### Docs
- enable documentation features
## `postgresql_embedded` - [v0.2.0](https://github.com/theseus-rs/postgresql-embedded/compare/v0.1.2...v0.2.0) - 2024-02-10
### Chore
- update release to 0.2.0
### Docs
- updated examples to use no_run to prevent documentation build failures
## `postgresql_embedded` - [v0.1.2](https://github.com/theseus-rs/postgresql-embedded/compare/v0.1.1...v0.1.2) - 2024-02-10
### Chore
- remove cargo vet check
- remove unused cargo dist configuration
- update release to 0.1.2
### Docs
- update badges for release
- correct crate repository urls
- add documentation for CommandExecutor
- remove note regarding tokio usage for the example
- added documentation for POSTGRESQL_VERSION and GITHUB_TOKEN usage
## `postgresql_embedded` - [v0.1.1](https://github.com/theseus-rs/postgresql-embedded/compare/v0.1.0...v0.1.1) - 2024-02-10
### Docs
- mark docs as ignored to prevent doc release failures
## `postgresql_embedded` - [v0.1.0](https://github.com/theseus-rs/postgresql-embedded/compare/bd97bf1b5b53beb503034d499a0186c75ba6271e...v0.1.0) - 2024-02-10
### Bug
- corrected unused import and unused variable errors when building on windows
- update postgresql_embedded to enable "bundled" as a default feature
- correct doc lint
- correct command test failures on windows
- correct command builder test failures on windows
- correct command builder test bugs on windows
- update archive extract to support symlinks
- corrected extract bug on MacOS caused by a directory being treated as a file
- set encoding to SQL_ASCII for windows until binary is built with UTF8 support; use -o instead of --option when
attempting to start the server
- remove failing code coverage actions
### Build
- *(deps)* bump tempfile from 3.9.0 to 3.10.0
### Chore
- initial CI configuration
- updated tempfile config for cargo vet
- reduce test execution and setup code coverage
- enable rust / cargo caching for ci
- enable caching to ci checks
- update vet check for hermit-abi
- update cargo vet config
- add GITHUB_TOKEN to clippy and tests to address rate limiting
- disable windows build
- add author and release metadata
- add missing crate descriptions
- update release metadata
### Docs
- update MIT License header
- update ci status badge
- disable blocking rust doc examples
### Feat
- add ability to embed PostgreSQL installation in a Rust executable
- add GITHUB_TOKEN as a Bearer token when calling the GitHub API in order to increase the rate limit
- added initial tracing support
### Refactor
- update the name of the postgresql binaries repository
### Test
- refactor version constant tests so that they can be run in parallel to speed up builds
- corrected pg_ctl test
================================================
FILE: Cargo.toml
================================================
[workspace]
default-members = [
"postgresql_archive",
"postgresql_commands",
"postgresql_embedded",
"postgresql_extensions",
]
members = [
"examples/*",
"postgresql_archive",
"postgresql_commands",
"postgresql_embedded",
"postgresql_extensions",
]
resolver = "3"
[workspace.package]
authors = ["Brian Heineman <brian.heineman@gmail.com>"]
categories = ["database"]
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.92.0"
version = "0.20.2"
[workspace.dependencies]
anyhow = "1.0.102"
async-trait = "0.1.89"
axum = "0.8.8"
criterion = "0.8.2"
diesel = "2.3.6"
diesel_migrations = "2.3.1"
flate2 = "1.1.9"
futures-util = "0.3.32"
hex = "0.4.3"
indicatif = "0.18.4"
indoc = "2.0.7"
liblzma = "0.4.6"
md-5 = "0.10.6"
pgvector = "0.4.1"
postgres = "0.19.12"
quick-xml = "0.39.2"
r2d2_postgres = "0.18.2"
rand = "0.10.0"
regex-lite = "0.1.9"
reqwest = { version = "0.13.2", default-features = false }
reqwest-middleware = "0.5.1"
reqwest-retry = "0.9.1"
reqwest-tracing = "0.7.0"
semver = "1.0.27"
serde = "1.0.228"
serde_json = "1.0.149"
sha1 = "0.10.6"
sha2 = "0.10.9"
sqlx = { version = "0.8.6", default-features = false, features = ["postgres"] }
tar = "0.4.44"
target-triple = "1.0.0"
tempfile = "3.25.0"
test-log = "0.2.19"
thiserror = "2.0.18"
tokio = "1.49.0"
tracing = "0.1.44"
tracing-indicatif = "0.3.14"
tracing-subscriber = "0.3.22"
url = "2.5.8"
zip = { version = "8.1.0", default-features = false, features = ["deflate"] }
[workspace.lints.rust]
dead_code = "allow"
missing_debug_implementations = "deny"
unsafe_code = "deny"
warnings = "deny"
[workspace.lints.clippy]
pedantic = { level = "deny", priority = -1 }
allow_attributes = "deny"
fallible_impl_from = "deny"
unwrap_used = "deny"
[workspace.metadata.release]
shared-version = true
dependent-version = "upgrade"
tag-name = "v{{version}}"
================================================
FILE: LICENSE-APACHE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
================================================
FILE: LICENSE-MIT
================================================
MIT License
Copyright (c) 2023 Theseus contributors
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
<p align="center"><img width="250" height="250" src="images/logo.png"></p>
# PostgreSQL Embedded
[](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
[](https://docs.rs/postgresql_embedded)
[](https://codecov.io/gh/theseus-rs/postgresql-embedded)
[](https://bencher.dev/perf/theseus-rs-postgresql-embedded)
[](https://crates.io/crates/postgresql_embedded)
[](https://github.com/theseus-rs/postgresql-embedded#license)
[](https://semver.org/spec/v2.0.0.html)
Install and run a PostgreSQL database locally on Linux, MacOS or Windows. PostgreSQL can be
bundled with your application, or downloaded on demand.
This library provides an embedded-like experience for PostgreSQL similar to what you would have with
SQLite. This is accomplished by downloading and installing PostgreSQL during runtime. There is
also a "bundled" feature that when enabled, will download the PostgreSQL installation archive at
compile time, include it in your binary and install from the binary version at runtime.
In either case, PostgreSQL will run in a separate process space.
## Features
- installing and running PostgreSQL
- running PostgreSQL on ephemeral ports
- Unix socket support
- async and blocking API
- bundling the PostgreSQL archive in an executable
- semantic version resolution
- ability to configure PostgreSQL startup options
- settings builder for fluent configuration
- URL based configuration
- choice of native-tls or rustls
- support for installing PostgreSQL extensions
## Getting Started
### Example
```rust
use postgresql_embedded::{PostgreSQL, Result};
#[tokio::main]
async fn main() -> Result<()> {
let mut postgresql = PostgreSQL::default();
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "test";
postgresql.create_database(database_name).await?;
postgresql.database_exists(database_name).await?;
postgresql.drop_database(database_name).await?;
postgresql.stop().await
}
```
## Notes
Supports using PostgreSQL binaries from:
* [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries) (default)
* [zonkyio/embedded-postgres-binaries](https://github.com/zonkyio/embedded-postgres-binaries)
## Safety
These crates use `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
PostgreSQL is covered under [The PostgreSQL License](https://opensource.org/licenses/postgresql).
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as
defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
## Prior Art
Projects that inspired this one:
* [zonkyio/embedded-postgres-binaries](https://github.com/zonkyio/embedded-postgres-binaries)
* [faokunega/pg-embed](https://github.com/faokunega/pg-embed)
================================================
FILE: SECURITY.md
================================================
# Security Policy
## Supported Versions
Only the latest version of this crate is supported.
## Reporting a Vulnerability
To report a security vulnerability, please use the form
at https://github.com/theseus-rs/postgresql-embedded/security/advisories/new
================================================
FILE: clippy.toml
================================================
allow-unwrap-in-tests = true
================================================
FILE: deny.toml
================================================
# Documentation for this configuration file can be found here
# https://embarkstudios.github.io/cargo-deny/checks/cfg.html
[graph]
targets = [
{ triple = "aarch64-unknown-linux-gnu" },
{ triple = "aarch64-unknown-linux-musl" },
{ triple = "aarch64-apple-darwin" },
{ triple = "x86_64-apple-darwin" },
{ triple = "x86_64-pc-windows-msvc" },
{ triple = "x86_64-unknown-linux-gnu" },
{ triple = "x86_64-unknown-linux-musl" },
]
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
[licenses]
allow = [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"MIT",
"PostgreSQL",
"Unicode-3.0",
"Zlib",
]
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
[advisories]
ignore = [
]
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
[bans]
multiple-versions = "deny"
wildcards = "allow"
deny = []
[[licenses.clarify]]
name = "ring"
expression = "MIT AND ISC AND OpenSSL"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 }
]
================================================
FILE: examples/archive_async/Cargo.toml
================================================
[package]
edition.workspace = true
name = "archive_async"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_archive = { path = "../../postgresql_archive" }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/archive_async/src/main.rs
================================================
#![forbid(unsafe_code)]
#![forbid(clippy::allow_attributes)]
#![deny(clippy::pedantic)]
use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq, extract, get_archive};
#[tokio::main]
async fn main() -> Result<()> {
let url = theseus::URL;
let version_req = VersionReq::STAR;
let (archive_version, archive) = get_archive(url, &version_req).await?;
let out_dir = tempfile::tempdir()?.keep();
extract(url, &archive, &out_dir).await?;
println!(
"PostgreSQL {} extracted to {}",
archive_version,
out_dir.to_string_lossy()
);
Ok(())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_archive_async_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/archive_sync/Cargo.toml
================================================
[package]
edition.workspace = true
name = "archive_sync"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_archive = { path = "../../postgresql_archive", features = ["blocking"] }
tempfile = { workspace = true }
================================================
FILE: examples/archive_sync/src/main.rs
================================================
use postgresql_archive::blocking::{extract, get_archive};
use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq};
fn main() -> Result<()> {
let url = theseus::URL;
let version_req = VersionReq::STAR;
let (archive_version, archive) = get_archive(url, &version_req)?;
let out_dir = tempfile::tempdir()?.keep();
extract(url, &archive, &out_dir)?;
println!(
"PostgreSQL {} extracted to {}",
archive_version,
out_dir.to_string_lossy()
);
Ok(())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_archive_sync_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/axum_embedded/Cargo.toml
================================================
[package]
edition.workspace = true
name = "axum_embedded"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
axum = { workspace = true }
postgresql_embedded = { path = "../../postgresql_embedded" }
postgresql_extensions = { path = "../../postgresql_extensions" }
sqlx = { workspace = true, features = ["runtime-tokio"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/axum_embedded/src/main.rs
================================================
use anyhow::Result;
use axum::extract::State;
use axum::{Json, Router, http::StatusCode, routing::get};
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
use sqlx::PgPool;
use sqlx::postgres::PgPoolOptions;
use std::env;
use std::time::Duration;
use tokio::net::TcpListener;
use tracing::info;
/// Example of how to use postgresql embedded with axum.
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().compact().init();
let db_url =
env::var("DATABASE_URL").unwrap_or_else(|_| "postgresql://postgres@localhost".to_string());
info!("Installing PostgreSQL");
let settings = Settings::from_url(&db_url)?;
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
info!("Installing the vector extension from PortalCorp");
postgresql_extensions::install(
postgresql.settings(),
"portal-corp",
"pgvector_compiled",
&VersionReq::parse("=0.16.12")?,
)
.await?;
info!("Starting PostgreSQL");
postgresql.start().await?;
let database_name = "axum-test";
info!("Creating database {database_name}");
postgresql.create_database(database_name).await?;
info!("Configuring extension");
let settings = postgresql.settings().clone();
let database_url = settings.url(database_name);
let pool = PgPool::connect(database_url.as_str()).await?;
pool.close().await;
info!("Restarting database");
postgresql.stop().await?;
postgresql.start().await?;
info!("Setup connection pool");
let pool = PgPoolOptions::new()
.max_connections(5)
.acquire_timeout(Duration::from_secs(3))
.connect(&database_url)
.await?;
info!("Enabling extension");
enable_extension(&pool).await?;
info!("Start application");
let app = Router::new().route("/", get(extensions)).with_state(pool);
let listener = TcpListener::bind("0.0.0.0:3000").await.unwrap();
info!("Listening on {}", listener.local_addr()?);
axum::serve(listener, app).await?;
Ok(())
}
async fn enable_extension(pool: &PgPool) -> Result<()> {
sqlx::query("CREATE EXTENSION IF NOT EXISTS vector")
.execute(pool)
.await?;
Ok(())
}
async fn extensions(State(pool): State<PgPool>) -> Result<Json<Vec<String>>, (StatusCode, String)> {
sqlx::query_scalar("SELECT name FROM pg_available_extensions ORDER BY name")
.fetch_all(&pool)
.await
.map(Json)
.map_err(internal_error)
}
fn internal_error<E: std::error::Error>(err: E) -> (StatusCode, String) {
(StatusCode::INTERNAL_SERVER_ERROR, err.to_string())
}
================================================
FILE: examples/diesel_embedded/Cargo.toml
================================================
[package]
edition.workspace = true
name = "diesel_embedded"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
diesel = { workspace = true, features = ["postgres", "r2d2"] }
diesel_migrations = { workspace = true, features = ["postgres"] }
postgresql_embedded = { path = "../../postgresql_embedded" }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/diesel_embedded/README.md
================================================
This example is taken from [Getting Started with Diesel](https://diesel.rs/guides/getting-started)
and modified to work with an embedded database.
================================================
FILE: examples/diesel_embedded/diesel.toml
================================================
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
[migrations_directory]
dir = "./migrations"
================================================
FILE: examples/diesel_embedded/migrations/.keep
================================================
================================================
FILE: examples/diesel_embedded/migrations/2024-08-17-200823_create_posts/down.sql
================================================
DROP TABLE posts
================================================
FILE: examples/diesel_embedded/migrations/2024-08-17-200823_create_posts/up.sql
================================================
CREATE TABLE posts
(
id SERIAL PRIMARY KEY,
title VARCHAR NOT NULL,
body TEXT NOT NULL,
published BOOLEAN NOT NULL DEFAULT FALSE
)
================================================
FILE: examples/diesel_embedded/src/main.rs
================================================
use crate::models::{NewPost, Post};
use diesel::r2d2::{ConnectionManager, Pool};
use diesel::{PgConnection, RunQueryDsl, SelectableHelper};
use diesel_migrations::{EmbeddedMigrations, MigrationHarness, embed_migrations};
use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq};
mod models;
pub mod schema;
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/");
#[tokio::main]
async fn main() -> Result<()> {
let settings = Settings {
version: VersionReq::parse("=16.4.0")?,
username: "postgres".to_string(),
password: "postgres".to_string(),
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "diesel_demo";
postgresql.create_database(database_name).await?;
postgresql.database_exists(database_name).await?;
{
let database_url = postgresql.settings().url(database_name);
let manager = ConnectionManager::<PgConnection>::new(database_url);
let pool = Pool::builder()
.test_on_check_out(true)
.build(manager)
.expect("Could not build connection pool");
let mut mig_run = pool.clone().get().unwrap();
mig_run.run_pending_migrations(MIGRATIONS).unwrap();
let post = create_post(
&mut pool.get().unwrap(),
"My First Post",
"This is my firs post",
);
println!("Post '{}' created", post.title);
}
postgresql.drop_database(database_name).await?;
postgresql.stop().await
}
/// Create a new post
///
/// # Panics
/// if the post cannot be saved
pub fn create_post(conn: &mut PgConnection, title: &str, body: &str) -> Post {
use crate::schema::posts;
let new_post = NewPost { title, body };
diesel::insert_into(posts::table)
.values(&new_post)
.returning(Post::as_returning())
.get_result(conn)
.expect("Error saving new post")
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_diesel_embedded_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/diesel_embedded/src/models.rs
================================================
use diesel::prelude::*;
#[derive(Queryable, Selectable)]
#[diesel(table_name = crate::schema::posts)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct Post {
pub id: i32,
pub title: String,
pub body: String,
pub published: bool,
}
#[derive(Insertable)]
#[diesel(table_name = crate::schema::posts)]
pub struct NewPost<'a> {
pub title: &'a str,
pub body: &'a str,
}
================================================
FILE: examples/diesel_embedded/src/schema.rs
================================================
diesel::table! {
posts (id) {
id -> Int4,
title -> Varchar,
body -> Text,
published -> Bool,
}
}
================================================
FILE: examples/download_progress_bar/Cargo.toml
================================================
[package]
edition.workspace = true
name = "download_progress_bar"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
indicatif = { workspace = true }
postgresql_embedded = { path = "../../postgresql_embedded", features = ["indicatif"] }
tracing-indicatif = { workspace = true }
tracing-subscriber = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/download_progress_bar/src/main.rs
================================================
use anyhow::Result;
use indicatif::ProgressStyle;
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
use tracing_indicatif::IndicatifLayer;
use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::prelude::*;
use tracing_subscriber::{Registry, fmt};
/// Example of how to display a progress bar for the postgresql embedded archive download
#[tokio::main]
async fn main() -> Result<()> {
let progress_style = ProgressStyle::with_template("{span_child_prefix}{spinner} {span_name} [{elapsed_precise}] [{wide_bar:.green.bold}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})")?
.progress_chars("=> ");
let indicatif_layer = IndicatifLayer::new().with_progress_style(progress_style);
let subscriber = Registry::default()
.with(fmt::Layer::default().with_filter(LevelFilter::INFO))
.with(indicatif_layer);
subscriber.init();
let settings = Settings {
version: VersionReq::parse("=16.4.0")?,
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "test";
postgresql.create_database(database_name).await?;
postgresql.database_exists(database_name).await?;
postgresql.drop_database(database_name).await?;
postgresql.stop().await?;
Ok(())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_download_progress_bar_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/embedded_async/Cargo.toml
================================================
[package]
edition.workspace = true
name = "embedded_async"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_embedded = { path = "../../postgresql_embedded" }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/embedded_async/src/main.rs
================================================
use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq};
#[tokio::main]
async fn main() -> Result<()> {
let settings = Settings {
version: VersionReq::parse("=16.4.0")?,
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "test";
postgresql.create_database(database_name).await?;
postgresql.database_exists(database_name).await?;
postgresql.drop_database(database_name).await?;
postgresql.stop().await
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_embedded_async_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/embedded_sync/Cargo.toml
================================================
[package]
edition.workspace = true
name = "embedded_sync"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_embedded = { path = "../../postgresql_embedded", features = ["blocking"] }
================================================
FILE: examples/embedded_sync/src/main.rs
================================================
use postgresql_embedded::Result;
use postgresql_embedded::blocking::PostgreSQL;
fn main() -> Result<()> {
let mut postgresql = PostgreSQL::default();
postgresql.setup()?;
postgresql.start()?;
let database_name = "test";
postgresql.create_database(database_name)?;
postgresql.database_exists(database_name)?;
postgresql.drop_database(database_name)?;
postgresql.stop()
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_embedded_sync_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/portal_corp_extension/Cargo.toml
================================================
[package]
edition.workspace = true
name = "portal_corp_extension"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
indoc = { workspace = true }
pgvector = { workspace = true, features = ["sqlx"] }
postgresql_embedded = { path = "../../postgresql_embedded" }
postgresql_extensions = { path = "../../postgresql_extensions" }
sqlx = { workspace = true, features = ["runtime-tokio"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/portal_corp_extension/src/main.rs
================================================
use anyhow::Result;
use indoc::indoc;
use pgvector::Vector;
use sqlx::{PgPool, Row};
use tracing::info;
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
/// Example of how to install and configure the `PortalCorp` pgvector extension.
///
/// See: <https://github.com/pgvector/pgvector?tab=readme-ov-file#getting-started>
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().compact().init();
info!("Installing PostgreSQL");
let postgresql_version = VersionReq::parse("=16.4.0")?;
let settings = Settings {
version: postgresql_version.clone(),
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
let settings = postgresql.settings();
// Skip the test if the PostgreSQL version does not match; when testing with the 'bundled'
// feature, the version may vary and the test will fail.
if settings.version != postgresql_version {
eprintln!("Postgresql version does not match");
return Ok(());
}
info!("Installing the vector extension from PortalCorp");
postgresql_extensions::install(
postgresql.settings(),
"portal-corp",
"pgvector_compiled",
&VersionReq::parse("=0.16.12")?,
)
.await?;
info!("Starting PostgreSQL");
postgresql.start().await?;
let database_name = "vector-example";
info!("Creating database {database_name}");
postgresql.create_database(database_name).await?;
info!("Configuring extension");
let settings = postgresql.settings();
let database_url = settings.url(database_name);
let pool = PgPool::connect(database_url.as_str()).await?;
pool.close().await;
info!("Restarting database");
postgresql.stop().await?;
postgresql.start().await?;
info!("Enabling extension");
let pool = PgPool::connect(database_url.as_str()).await?;
enable_extension(&pool).await?;
info!("Creating table");
create_table(&pool).await?;
info!("Creating data");
create_data(&pool).await?;
info!("Get the nearest neighbors by L2 distance");
execute_query(
&pool,
"SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5",
)
.await?;
info!("Stopping database");
postgresql.stop().await?;
Ok(())
}
async fn enable_extension(pool: &PgPool) -> Result<()> {
sqlx::query("DROP EXTENSION IF EXISTS vector")
.execute(pool)
.await?;
sqlx::query("CREATE EXTENSION IF NOT EXISTS vector")
.execute(pool)
.await?;
Ok(())
}
async fn create_table(pool: &PgPool) -> Result<()> {
sqlx::query(indoc! {"
CREATE TABLE IF NOT EXISTS items (
id bigserial PRIMARY KEY,
embedding vector(3) NOT NULL
)
"})
.execute(pool)
.await?;
Ok(())
}
async fn create_data(pool: &PgPool) -> Result<()> {
sqlx::query(indoc! {"
INSERT INTO items (embedding)
VALUES
('[1,2,3]'),
('[4,5,6]')
"})
.execute(pool)
.await?;
Ok(())
}
async fn execute_query(pool: &PgPool, query: &str) -> Result<()> {
info!("Query: {query}");
let rows = sqlx::query(query).fetch_all(pool).await?;
for row in rows {
let id: i64 = row.try_get("id")?;
let embedding: Vector = row.try_get("embedding")?;
info!("ID: {id}, Embedding: {embedding:?}");
}
Ok(())
}
#[cfg(test)]
mod test {
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
use super::*;
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
#[test]
fn test_portal_corp_extension_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/postgres_embedded/Cargo.toml
================================================
[package]
edition.workspace = true
name = "postgres_embedded"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
postgres = { workspace = true }
postgresql_embedded = { path = "../../postgresql_embedded", features = ["blocking"] }
================================================
FILE: examples/postgres_embedded/README.md
================================================
This example is based on [sqlx/example/todos](https://github.com/launchbadge/sqlx/tree/main/examples/postgres/todos)
and modified to work with the postgres driver.
================================================
FILE: examples/postgres_embedded/src/main.rs
================================================
use anyhow::Result;
use postgres::{Client, NoTls};
use postgresql_embedded::blocking::PostgreSQL;
fn main() -> Result<()> {
let mut postgresql = PostgreSQL::default();
postgresql.setup()?;
postgresql.start()?;
let database_name = "test";
postgresql.create_database(database_name)?;
let settings = postgresql.settings();
let mut client = Client::connect(
format!(
"host={host} port={port} user={username} password={password}",
host = settings.host,
port = settings.port,
username = settings.username,
password = settings.password
)
.as_str(),
NoTls,
)?;
println!("Creating table 'todos'");
create_table_todo(&mut client)?;
let description = "Implement embedded database with postgres";
println!("Adding new todo with description '{description}'");
let todo_id = add_todo(&mut client, description)?;
println!("Added new todo with id {todo_id}");
println!("Marking todo {todo_id} as done");
if complete_todo(&mut client, todo_id)? {
println!("Todo {todo_id} is marked as done");
}
println!("Printing list of all todos");
list_todos(&mut client)?;
Ok(())
}
fn create_table_todo(client: &mut Client) -> Result<()> {
let _ = client.execute(
"CREATE TABLE IF NOT EXISTS todos (id BIGSERIAL PRIMARY KEY, description TEXT NOT NULL, done BOOLEAN NOT NULL DEFAULT FALSE);",
&[],
)?;
Ok(())
}
fn add_todo(client: &mut Client, description: &str) -> Result<i64> {
let row = client.query_one(
"INSERT INTO todos (description) VALUES ($1) RETURNING id",
&[&description],
)?;
let id: i64 = row.get(0);
Ok(id)
}
fn complete_todo(client: &mut Client, id: i64) -> Result<bool> {
let rows_affected = client.execute("UPDATE todos SET done = TRUE WHERE id = $1", &[&id])?;
Ok(rows_affected > 0)
}
fn list_todos(client: &mut Client) -> Result<()> {
let rows = client.query("SELECT id, description, done FROM todos ORDER BY id", &[])?;
for rec in rows {
let id: i64 = rec.get("id");
let description: String = rec.get("description");
let done: bool = rec.get("done");
println!(
"- [{}] {}: {}",
if done { "x" } else { " " },
id,
&description,
);
}
Ok(())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_postgres_embedded_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/sqlx_embedded/Cargo.toml
================================================
[package]
edition.workspace = true
name = "sqlx_embedded"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
postgresql_embedded = { path = "../../postgresql_embedded" }
sqlx = { workspace = true, features = ["runtime-tokio"] }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/sqlx_embedded/README.md
================================================
This example is taken from [sqlx/example/todos](https://github.com/launchbadge/sqlx/tree/main/examples/postgres/todos)
and modified to work with an embedded database.
================================================
FILE: examples/sqlx_embedded/src/main.rs
================================================
use anyhow::Result;
use postgresql_embedded::PostgreSQL;
use sqlx::Row;
use sqlx::postgres::PgPool;
#[tokio::main]
async fn main() -> Result<()> {
let mut postgresql = PostgreSQL::default();
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "test";
postgresql.create_database(database_name).await?;
let settings = postgresql.settings();
let database_url = settings.url(database_name);
let pool = PgPool::connect(database_url.as_str()).await?;
println!("Creating table 'todos'");
create_table_todo(&pool).await?;
let description = "Implement embedded database with sqlx";
println!("Adding new todo with description '{description}'");
let todo_id = add_todo(&pool, description).await?;
println!("Added new todo with id {todo_id}");
println!("Marking todo {todo_id} as done");
if complete_todo(&pool, todo_id).await? {
println!("Todo {todo_id} is marked as done");
}
println!("Printing list of all todos");
list_todos(&pool).await?;
Ok(())
}
async fn create_table_todo(pool: &PgPool) -> Result<()> {
sqlx::query(
"CREATE TABLE IF NOT EXISTS todos(id BIGSERIAL PRIMARY KEY, description TEXT NOT NULL, done BOOLEAN NOT NULL DEFAULT FALSE);"
).execute(pool).await?;
Ok(())
}
async fn add_todo(pool: &PgPool, description: &str) -> Result<i64> {
let rec = sqlx::query("INSERT INTO todos (description) VALUES ($1) RETURNING id")
.bind(description)
.fetch_one(pool)
.await?;
let id: i64 = rec.get("id");
Ok(id)
}
async fn complete_todo(pool: &PgPool, id: i64) -> Result<bool> {
let rows_affected = sqlx::query("UPDATE todos SET done = TRUE WHERE id = $1")
.bind(id)
.execute(pool)
.await?
.rows_affected();
Ok(rows_affected > 0)
}
async fn list_todos(pool: &PgPool) -> Result<()> {
let recs = sqlx::query("SELECT id, description, done FROM todos ORDER BY id")
.fetch_all(pool)
.await?;
for rec in recs {
let id: i64 = rec.get("id");
let description: String = rec.get("description");
let done: bool = rec.get("done");
println!(
"- [{}] {}: {}",
if done { "x" } else { " " },
id,
&description,
);
}
Ok(())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_sqlx_embedded_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/tensor_chord_extension/Cargo.toml
================================================
[package]
edition.workspace = true
name = "tensor_chord_extension"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
anyhow = { workspace = true }
indoc = { workspace = true }
postgresql_embedded = { path = "../../postgresql_embedded" }
postgresql_extensions = { path = "../../postgresql_extensions" }
sqlx = { workspace = true, features = ["runtime-tokio"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/tensor_chord_extension/src/main.rs
================================================
use anyhow::Result;
use indoc::indoc;
use sqlx::{PgPool, Row};
use tracing::info;
use postgresql_embedded::{PostgreSQL, Settings, VersionReq};
/// Example of how to install and configure the `TensorChord` vector extension.
///
/// See: <https://github.com/tensorchord/pgvecto.rs/?tab=readme-ov-file#quick-start>
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().compact().init();
info!("Installing PostgreSQL");
let settings = Settings {
version: VersionReq::parse("=16.4.0")?,
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
info!("Installing the vector extension from TensorChord");
postgresql_extensions::install(
postgresql.settings(),
"tensor-chord",
"pgvecto.rs",
&VersionReq::parse("=0.4.0")?,
)
.await?;
info!("Starting PostgreSQL");
postgresql.start().await?;
let database_name = "vector-example";
info!("Creating database {database_name}");
postgresql.create_database(database_name).await?;
info!("Configuring extension");
let settings = postgresql.settings();
let database_url = settings.url(database_name);
let pool = PgPool::connect(database_url.as_str()).await?;
configure_extension(&pool).await?;
pool.close().await;
info!("Restarting database");
postgresql.stop().await?;
postgresql.start().await?;
info!("Enabling extension");
let pool = PgPool::connect(database_url.as_str()).await?;
enable_extension(&pool).await?;
info!("Creating table");
create_table(&pool).await?;
info!("Creating data");
create_data(&pool).await?;
info!("Squared Euclidean Distance");
execute_query(
&pool,
"SELECT '[1, 2, 3]'::vector <-> '[3, 2, 1]'::vector AS value",
)
.await?;
info!("Negative Dot Product");
execute_query(
&pool,
"SELECT '[1, 2, 3]'::vector <#> '[3, 2, 1]'::vector AS value",
)
.await?;
info!("Cosine Distance");
execute_query(
&pool,
"SELECT '[1, 2, 3]'::vector <=> '[3, 2, 1]'::vector AS value",
)
.await?;
info!("Stopping database");
postgresql.stop().await?;
Ok(())
}
async fn configure_extension(pool: &PgPool) -> Result<()> {
sqlx::query("ALTER SYSTEM SET shared_preload_libraries = \"vectors.so\"")
.execute(pool)
.await?;
sqlx::query("ALTER SYSTEM SET search_path = \"$user\", public, vectors")
.execute(pool)
.await?;
Ok(())
}
async fn enable_extension(pool: &PgPool) -> Result<()> {
sqlx::query("DROP EXTENSION IF EXISTS vectors")
.execute(pool)
.await?;
sqlx::query("CREATE EXTENSION IF NOT EXISTS vectors")
.execute(pool)
.await?;
Ok(())
}
async fn create_table(pool: &PgPool) -> Result<()> {
sqlx::query(indoc! {"
CREATE TABLE IF NOT EXISTS items (
id bigserial PRIMARY KEY,
embedding vector(3) NOT NULL
)
"})
.execute(pool)
.await?;
Ok(())
}
async fn create_data(pool: &PgPool) -> Result<()> {
sqlx::query(indoc! {"
INSERT INTO items (embedding)
VALUES
('[1,2,3]'),
('[4,5,6]')
"})
.execute(pool)
.await?;
sqlx::query(indoc! {"
INSERT INTO items (embedding)
VALUES
(ARRAY[1, 2, 3]::real[]),
(ARRAY[4, 5, 6]::real[]
)
"})
.execute(pool)
.await?;
Ok(())
}
async fn execute_query(pool: &PgPool, query: &str) -> Result<()> {
let row = sqlx::query(query).fetch_one(pool).await?;
let value: f32 = row.try_get("value")?;
info!("{}: {}", query, value);
Ok(())
}
// #[cfg(test)]
// mod test {
// use super::*;
//
// #[test]
// #[ignore = "this extension has been deprecated"]
// fn test_tensor_chord_extension_main() -> Result<()> {
// main()
// }
// }
================================================
FILE: examples/unix_socket/Cargo.toml
================================================
[package]
edition.workspace = true
name = "unix_socket"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_embedded = { path = "../../postgresql_embedded" }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/unix_socket/src/main.rs
================================================
use postgresql_embedded::{PostgreSQL, Result, SettingsBuilder};
#[cfg(unix)]
#[tokio::main]
async fn main() -> Result<()> {
let socket_dir = tempfile::tempdir().expect("failed to create temp dir for socket");
let settings = SettingsBuilder::new()
.socket_dir(socket_dir.path().to_path_buf())
.build();
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
postgresql.start().await?;
let port = postgresql.settings().port;
let socket_file = socket_dir.path().join(format!(".s.PGSQL.{port}"));
println!("PostgreSQL is listening on Unix socket: {socket_file:?}");
let database_name = "test";
postgresql.create_database(database_name).await?;
println!("Created database '{database_name}'");
let exists = postgresql.database_exists(database_name).await?;
println!("Database '{database_name}' exists: {exists}");
postgresql.drop_database(database_name).await?;
println!("Dropped database '{database_name}'");
postgresql.stop().await?;
println!("PostgreSQL stopped");
Ok(())
}
#[cfg(not(unix))]
fn main() {
eprintln!("Unix socket support is only available on Unix platforms");
}
#[cfg(test)]
#[cfg(unix)]
mod test {
use super::*;
#[test]
fn test_unix_socket_main() -> Result<()> {
main()
}
}
================================================
FILE: examples/zonky/Cargo.toml
================================================
[package]
edition.workspace = true
name = "zonky"
publish = false
license.workspace = true
version.workspace = true
[dependencies]
postgresql_archive = { path = "../../postgresql_archive" }
postgresql_embedded = { path = "../../postgresql_embedded", default-features = false, features = ["zonky"] }
tokio = { workspace = true, features = ["full"] }
================================================
FILE: examples/zonky/src/main.rs
================================================
use postgresql_archive::VersionReq;
use postgresql_archive::configuration::zonky;
use postgresql_embedded::{PostgreSQL, Result, Settings};
#[tokio::main]
async fn main() -> Result<()> {
let settings = Settings {
releases_url: zonky::URL.to_string(),
version: VersionReq::parse("=16.3.0")?,
..Default::default()
};
let mut postgresql = PostgreSQL::new(settings);
postgresql.setup().await?;
postgresql.start().await?;
let database_name = "test";
postgresql.create_database(database_name).await?;
postgresql.database_exists(database_name).await?;
postgresql.drop_database(database_name).await?;
postgresql.stop().await
}
#[cfg(test)]
mod test {
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
use super::*;
#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
#[test]
fn test_zonky_main() -> Result<()> {
main()
}
}
================================================
FILE: postgresql_archive/Cargo.toml
================================================
[package]
authors.workspace = true
categories.workspace = true
description = "A library for downloading and extracting PostgreSQL archives"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "postgresql_archive"
repository = "https://github.com/theseus-rs/postgresql-embedded"
rust-version.workspace = true
version.workspace = true
[dependencies]
async-trait = { workspace = true }
flate2 = { workspace = true, optional = true }
futures-util = { workspace = true }
hex = { workspace = true }
liblzma = { workspace = true, optional = true }
md-5 = { workspace = true, optional = true }
quick-xml = { workspace = true, features = ["serialize"], optional = true }
regex-lite = { workspace = true }
reqwest = { workspace = true, default-features = false, features = ["http2", "json", "query", "stream"] }
reqwest-middleware = { workspace = true, features = ["query"] }
reqwest-retry = { workspace = true }
reqwest-tracing = { workspace = true }
semver = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, optional = true }
sha1 = { workspace = true, optional = true }
sha2 = { workspace = true, optional = true }
tar = { workspace = true, optional = true }
target-triple = { workspace = true }
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"], optional = true }
tracing = { workspace = true, features = ["log"] }
tracing-indicatif = { workspace = true, optional = true }
url = { workspace = true }
zip = { workspace = true, optional = true }
[dev-dependencies]
anyhow = { workspace = true }
criterion = { workspace = true }
hex = { workspace = true }
test-log = { workspace = true }
tokio = { workspace = true }
[features]
default = [
"native-tls",
"theseus"
]
blocking = ["dep:tokio"]
github = [
"dep:serde_json",
]
indicatif = [
"dep:tracing-indicatif"
]
maven = [
"dep:quick-xml",
"md5",
"sha1",
"sha2",
]
md5 = ["dep:md-5"]
native-tls = ["reqwest/native-tls"]
rustls = ["reqwest/rustls"]
sha1 = ["dep:sha1"]
sha2 = ["dep:sha2"]
tar-gz = [
"dep:flate2",
"dep:tar",
]
tar-xz = [
"dep:liblzma",
"dep:tar",
]
theseus = [
"github",
"sha2",
"tar-gz",
]
zip = [
"dep:zip",
]
zonky = [
"maven",
"tar-xz",
"zip",
]
[package.metadata.docs.rs]
features = ["blocking"]
targets = ["x86_64-unknown-linux-gnu"]
[[bench]]
harness = false
name = "archive"
[package.metadata.cargo-machete]
ignored = [
"md-5",
"serde_json",
]
================================================
FILE: postgresql_archive/README.md
================================================
# PostgreSQL Archive
[](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
[](https://docs.rs/postgresql_archive)
[](https://codecov.io/gh/theseus-rs/postgresql-embedded)
[](https://bencher.dev/perf/theseus-rs-postgresql-embedded)
[](https://crates.io/crates/postgresql_archive)
[](https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_archive#license)
[](https://semver.org/spec/v2.0.0.html)
A configurable library for downloading and extracting PostgreSQL archives.
## Examples
### Asynchronous API
```rust
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();
extract(url, &archive, &out_dir).await
}
```
### Synchronous API
```rust
use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq};
use postgresql_archive::blocking::{extract, get_archive};
fn main() -> Result<()> {
let url = theseus::URL;
let (archive_version, archive) = get_archive(url, &VersionReq::STAR)?;
let out_dir = std::env::temp_dir();
extract(url, &archive, &out_dir)
}
```
## 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 |
| `indicatif` | Enables tracing-indcatif support | 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 |
### Extractors
| Name | Description | Default? |
|----------|--------------------------|----------|
| `tar-gz` | Enables tar gz extractor | Yes |
| `tar-xz` | Enables tar xz extractor | No |
| `zip` | Enables zip extractor | 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:
* [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries)
* [zonkyio/embedded-postgres-binaries](https://github.com/zonkyio/embedded-postgres-binaries)
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as
defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
================================================
FILE: postgresql_archive/benches/archive.rs
================================================
use criterion::{Criterion, criterion_group, criterion_main};
use postgresql_archive::blocking::{extract, get_archive};
use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq};
use std::fs::{create_dir_all, remove_dir_all};
use std::time::Duration;
fn benchmarks(criterion: &mut Criterion) {
bench_extract(criterion).ok();
}
fn bench_extract(criterion: &mut Criterion) -> Result<()> {
let version_req = VersionReq::STAR;
let (_archive_version, archive) = get_archive(theseus::URL, &version_req)?;
criterion.bench_function("extract", |bencher| {
bencher.iter(|| {
extract_archive(&archive).ok();
});
});
Ok(())
}
fn extract_archive(archive: &Vec<u8>) -> Result<()> {
let out_dir = tempfile::tempdir()?.path().to_path_buf();
create_dir_all(&out_dir)?;
extract(theseus::URL, archive, &out_dir)?;
remove_dir_all(&out_dir)?;
Ok(())
}
criterion_group!(
name = benches;
config = Criterion::default()
.measurement_time(Duration::from_secs(30))
.sample_size(10);
targets = benchmarks
);
criterion_main!(benches);
================================================
FILE: postgresql_archive/src/archive.rs
================================================
//! Manage PostgreSQL archives
#![allow(dead_code)]
use crate::error::Result;
use crate::{extractor, repository};
use regex_lite::Regex;
use semver::{Version, VersionReq};
use std::path::{Path, PathBuf};
use tracing::instrument;
/// Gets the version for the specified [version requirement](VersionReq). If a version for the
/// [version requirement](VersionReq) is not found, then an error is returned.
///
/// # Errors
/// * If the version is not found.
#[instrument(level = "debug")]
pub async fn get_version(url: &str, version_req: &VersionReq) -> Result<Version> {
let repository = repository::registry::get(url)?;
let version = repository.get_version(version_req).await?;
Ok(version)
}
/// Gets the archive for a given [version requirement](VersionReq) that passes the default
/// matcher. If no archive is found for the [version requirement](VersionReq) and matcher then
/// an [error](crate::error::Error) is returned.
///
/// # Errors
/// * If the archive is not found.
/// * If the archive cannot be downloaded.
#[instrument]
pub async fn get_archive(url: &str, version_req: &VersionReq) -> Result<(Version, Vec<u8>)> {
let repository = repository::registry::get(url)?;
let archive = repository.get_archive(version_req).await?;
let version = archive.version().clone();
let bytes = archive.bytes().to_vec();
Ok((version, bytes))
}
/// Extracts the compressed tar `bytes` to the [out_dir](Path).
///
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub async fn extract(url: &str, bytes: &Vec<u8>, out_dir: &Path) -> Result<Vec<PathBuf>> {
let extractor_fn = extractor::registry::get(url)?;
let mut extract_directories = extractor::ExtractDirectories::default();
extract_directories.add_mapping(Regex::new(".*")?, out_dir.to_path_buf());
extractor_fn(bytes, &extract_directories)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::configuration::theseus::URL;
#[tokio::test]
async fn test_get_version() -> Result<()> {
let version_req = VersionReq::parse("=16.4.0")?;
let version = get_version(URL, &version_req).await?;
assert_eq!(Version::new(16, 4, 0), version);
Ok(())
}
#[tokio::test]
async fn test_get_archive() -> Result<()> {
let version_req = VersionReq::parse("=16.4.0")?;
let (version, bytes) = get_archive(URL, &version_req).await?;
assert_eq!(Version::new(16, 4, 0), version);
assert!(!bytes.is_empty());
Ok(())
}
}
================================================
FILE: postgresql_archive/src/blocking/archive.rs
================================================
use crate::{Version, VersionReq};
use std::path::{Path, PathBuf};
use std::sync::LazyLock;
use tokio::runtime::Runtime;
static RUNTIME: LazyLock<Runtime> = LazyLock::new(|| Runtime::new().unwrap());
/// Gets the version for the specified [version requirement](VersionReq). If a version for the
/// [version requirement](VersionReq) is not found, then an error is returned.
///
/// # Errors
/// * If the version is not found.
pub fn get_version(url: &str, version_req: &VersionReq) -> crate::Result<Version> {
RUNTIME
.handle()
.block_on(async move { crate::get_version(url, version_req).await })
}
/// Gets the archive for a given [version requirement](VersionReq) that passes the default
/// matcher.
///
/// If no archive is found for the [version requirement](VersionReq) and matcher then
/// an [error](crate::error::Error) is returned.
///
/// # Errors
/// * If the archive is not found.
/// * If the archive cannot be downloaded.
pub fn get_archive(url: &str, version_req: &VersionReq) -> crate::Result<(Version, Vec<u8>)> {
RUNTIME
.handle()
.block_on(async move { crate::get_archive(url, version_req).await })
}
/// Extracts the compressed tar `bytes` to the [out_dir](Path).
///
/// # Errors
/// Returns an error if the extraction fails.
pub fn extract(url: &str, bytes: &Vec<u8>, out_dir: &Path) -> crate::Result<Vec<PathBuf>> {
RUNTIME
.handle()
.block_on(async move { crate::extract(url, bytes, out_dir).await })
}
================================================
FILE: postgresql_archive/src/blocking/mod.rs
================================================
mod archive;
pub use archive::{extract, get_archive, get_version};
================================================
FILE: postgresql_archive/src/configuration/custom/matcher.rs
================================================
use semver::Version;
/// Matcher for PostgreSQL binaries from custom GitHub release repositories following the same
/// pattern as <https://github.com/theseus-rs/postgresql-binaries>
///
/// # Errors
/// * If the asset matcher fails.
pub fn matcher(_url: &str, name: &str, version: &Version) -> crate::Result<bool> {
let target = target_triple::TARGET;
// TODO: consider relaxing the version format to allow for more flexibility in where the version
// and target appear in the filename.
let expected_name = format!("postgresql-{version}-{target}.tar.gz");
Ok(name == expected_name)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{Result, matcher};
const TEST_URL: &str = "https://github.com/owner/repo";
#[test]
fn test_register_custom_repo() -> Result<()> {
#[expect(clippy::unnecessary_wraps)]
fn supports_fn(url: &str) -> Result<bool> {
Ok(url == TEST_URL)
}
matcher::registry::register(supports_fn, matcher)?;
let matcher = matcher::registry::get(TEST_URL)?;
let version = Version::new(16, 3, 0);
let expected_name = format!("postgresql-{}-{}.tar.gz", version, target_triple::TARGET);
assert!(matcher("", &expected_name, &version)?);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/configuration/custom/mod.rs
================================================
pub mod matcher;
pub use matcher::matcher;
================================================
FILE: postgresql_archive/src/configuration/mod.rs
================================================
pub mod custom;
#[cfg(feature = "theseus")]
pub mod theseus;
#[cfg(feature = "zonky")]
pub mod zonky;
================================================
FILE: postgresql_archive/src/configuration/theseus/extractor.rs
================================================
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};
use std::thread::sleep;
use std::time::Duration;
use tracing::{debug, instrument, warn};
/// Extracts the compressed tar `bytes` to the [out_dir](Path).
///
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let out_dir = extract_directories.get_path(".")?;
let parent_dir = if let Some(parent) = out_dir.parent() {
parent
} else {
debug!("No parent directory for {}", out_dir.to_string_lossy());
out_dir.as_path()
};
create_dir_all(parent_dir)?;
let lock_file = acquire_lock(parent_dir)?;
// If the directory already exists, then the archive has already been
// extracted by another process.
if out_dir.exists() {
debug!(
"Directory already exists {}; skipping extraction: ",
out_dir.to_string_lossy()
);
remove_file(&lock_file)?;
return Ok(Vec::new());
}
let extract_dir = tempfile::tempdir_in(parent_dir)?.keep();
debug!("Extracting archive to {}", extract_dir.to_string_lossy());
let mut archive_extract_directories = ExtractDirectories::default();
archive_extract_directories.add_mapping(Regex::new(".*")?, extract_dir.clone());
let files = tar_gz_extract(bytes, &archive_extract_directories)?;
if out_dir.exists() {
debug!(
"Directory already exists {}; skipping rename and removing extraction directory: {}",
out_dir.to_string_lossy(),
extract_dir.to_string_lossy()
);
remove_dir_all(&extract_dir)?;
} else {
debug!(
"Renaming {} to {}",
extract_dir.to_string_lossy(),
out_dir.to_string_lossy()
);
rename(extract_dir, out_dir)?;
}
if lock_file.is_file() {
debug!("Removing lock file: {}", lock_file.to_string_lossy());
remove_file(lock_file)?;
}
Ok(files)
}
/// Acquires a lock file in the [out_dir](Path) to prevent multiple processes from extracting the
/// archive at the same time.
///
/// # Errors
/// * If the lock file cannot be acquired.
#[instrument(level = "debug")]
fn acquire_lock(out_dir: &Path) -> Result<PathBuf> {
let lock_file = out_dir.join("postgresql-archive.lock");
if lock_file.is_file() {
let metadata = lock_file.metadata()?;
let created = metadata.created()?;
if created.elapsed()?.as_secs() > 300 {
warn!(
"Stale lock file detected; removing file to attempt process recovery: {}",
lock_file.to_string_lossy()
);
remove_file(&lock_file)?;
}
}
debug!(
"Attempting to acquire lock: {}",
lock_file.to_string_lossy()
);
for _ in 0..30 {
let lock = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&lock_file);
match lock {
Ok(_) => {
debug!("Lock acquired: {}", lock_file.to_string_lossy());
return Ok(lock_file);
}
Err(error) => {
warn!("unable to acquire lock: {error}");
sleep(Duration::from_secs(1));
}
}
}
Err(Unexpected("Failed to acquire lock".to_string()))
}
================================================
FILE: postgresql_archive/src/configuration/theseus/matcher.rs
================================================
use semver::Version;
/// Matcher for PostgreSQL binaries from <https://github.com/theseus-rs/postgresql-binaries>
///
/// # Errors
/// * If the asset matcher fails.
pub fn matcher(_url: &str, name: &str, version: &Version) -> crate::Result<bool> {
let target = target_triple::TARGET;
let expected_name = format!("postgresql-{version}-{target}.tar.gz");
Ok(name == expected_name)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::Result;
#[test]
fn test_asset_match_success() -> Result<()> {
let url = "";
let version = Version::parse("16.4.0")?;
let target = target_triple::TARGET;
let name = format!("postgresql-{version}-{target}.tar.gz");
assert!(matcher(url, name.as_str(), &version)?, "{}", name);
Ok(())
}
#[test]
fn test_asset_match_errors() -> Result<()> {
let url = "";
let version = Version::parse("16.4.0")?;
let target = target_triple::TARGET;
let names = vec![
format!("foo-{version}-{target}.tar.gz"),
format!("postgresql-{target}.tar.gz"),
format!("postgresql-{version}.tar.gz"),
format!("postgresql-{version}-{target}.tar"),
format!("postgresql-{version}-{target}"),
];
for name in names {
assert!(!matcher(url, name.as_str(), &version)?, "{}", name);
}
Ok(())
}
}
================================================
FILE: postgresql_archive/src/configuration/theseus/mod.rs
================================================
mod extractor;
mod matcher;
pub const URL: &str = "https://github.com/theseus-rs/postgresql-binaries";
pub use extractor::extract;
pub use matcher::matcher;
================================================
FILE: postgresql_archive/src/configuration/zonky/extractor.rs
================================================
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;
use std::path::{Path, PathBuf};
use std::thread::sleep;
use std::time::Duration;
use tracing::{debug, instrument, warn};
use zip::ZipArchive;
/// Extracts the compressed tar `bytes` to the [out_dir](Path).
///
/// # Errors
/// Returns an error if the extraction fails.
#[expect(clippy::case_sensitive_file_extension_comparisons)]
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let out_dir = extract_directories.get_path(".")?;
let parent_dir = if let Some(parent) = out_dir.parent() {
parent
} else {
debug!("No parent directory for {}", out_dir.to_string_lossy());
out_dir.as_path()
};
create_dir_all(parent_dir)?;
let lock_file = acquire_lock(parent_dir)?;
// If the directory already exists, then the archive has already been
// extracted by another process.
if out_dir.exists() {
debug!(
"Directory already exists {}; skipping extraction: ",
out_dir.to_string_lossy()
);
remove_file(&lock_file)?;
return Ok(Vec::new());
}
let extract_dir = tempfile::tempdir_in(parent_dir)?.keep();
debug!("Extracting archive to {}", extract_dir.to_string_lossy());
let reader = Cursor::new(bytes);
let mut archive = ZipArchive::new(reader)?;
let mut archive_bytes = Vec::new();
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let file_name = file.name().to_string();
if file_name.ends_with(".txz") {
debug!("Found archive file: {file_name}");
std::io::copy(&mut file, &mut archive_bytes)?;
break;
}
}
if archive_bytes.is_empty() {
return Err(Unexpected("Failed to find archive file".to_string()));
}
let mut archive_extract_directories = ExtractDirectories::default();
archive_extract_directories.add_mapping(Regex::new(".*")?, extract_dir.clone());
let files = tar_xz_extract(&archive_bytes, &archive_extract_directories)?;
if out_dir.exists() {
debug!(
"Directory already exists {}; skipping rename and removing extraction directory: {}",
out_dir.to_string_lossy(),
extract_dir.to_string_lossy()
);
remove_dir_all(&extract_dir)?;
} else {
debug!(
"Renaming {} to {}",
extract_dir.to_string_lossy(),
out_dir.to_string_lossy()
);
rename(extract_dir, out_dir)?;
}
if lock_file.is_file() {
debug!("Removing lock file: {}", lock_file.to_string_lossy());
remove_file(lock_file)?;
}
Ok(files)
}
/// Acquires a lock file in the [out_dir](Path) to prevent multiple processes from extracting the
/// archive at the same time.
///
/// # Errors
/// * If the lock file cannot be acquired.
#[instrument(level = "debug")]
fn acquire_lock(out_dir: &Path) -> crate::Result<PathBuf> {
let lock_file = out_dir.join("postgresql-archive.lock");
if lock_file.is_file() {
let metadata = lock_file.metadata()?;
let created = metadata.created()?;
if created.elapsed()?.as_secs() > 300 {
warn!(
"Stale lock file detected; removing file to attempt process recovery: {}",
lock_file.to_string_lossy()
);
remove_file(&lock_file)?;
}
}
debug!(
"Attempting to acquire lock: {}",
lock_file.to_string_lossy()
);
for _ in 0..30 {
let lock = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&lock_file);
match lock {
Ok(_) => {
debug!("Lock acquired: {}", lock_file.to_string_lossy());
return Ok(lock_file);
}
Err(error) => {
warn!("unable to acquire lock: {error}");
sleep(Duration::from_secs(1));
}
}
}
Err(Unexpected("Failed to acquire lock".to_string()))
}
================================================
FILE: postgresql_archive/src/configuration/zonky/matcher.rs
================================================
use crate::Result;
use semver::Version;
use std::env;
/// Matcher for PostgreSQL binaries from <https://github.com/zonkyio/embedded-postgres-binaries>
///
/// # Errors
/// * If the asset matcher fails.
pub fn matcher(_url: &str, name: &str, version: &Version) -> Result<bool> {
let os = get_os();
let arch = get_arch();
let expected_name = format!("embedded-postgres-binaries-{os}-{arch}-{version}.jar");
Ok(name == expected_name)
}
/// Returns the operating system of the current system.
pub(crate) fn get_os() -> &'static str {
match env::consts::OS {
"macos" => "darwin",
os => os,
}
}
/// Returns the architecture of the current system.
pub(crate) fn get_arch() -> &'static str {
match env::consts::ARCH {
"arm" => "arm32v7",
"x86_64" => "amd64",
"aarch64" => "arm64v8",
"powerpc64" => "ppc64le",
"x86" => "i386",
arch => arch,
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::Result;
#[test]
fn test_asset_match_success() -> Result<()> {
let url = "";
let os = get_os();
let arch = get_arch();
let version = Version::parse("16.4.0")?;
let name = format!("embedded-postgres-binaries-{os}-{arch}-{version}.jar");
assert!(matcher(url, name.as_str(), &version)?, "{}", name);
Ok(())
}
#[test]
fn test_asset_match_errors() -> Result<()> {
let url = "";
let os = get_os();
let arch = get_arch();
let version = Version::parse("16.4.0")?;
let names = vec![
format!("foo-{os}-{arch}-{version}.jar"),
format!("embedded-postgres-binaries-{arch}-{version}.jar"),
format!("embedded-postgres-binaries-{os}-{version}.jar"),
format!("embedded-postgres-binaries-{os}-{arch}.jar"),
format!("embedded-postgres-binaries-{os}-{arch}-{version}.zip"),
];
for name in names {
assert!(!matcher(url, name.as_str(), &version)?, "{}", name);
}
Ok(())
}
}
================================================
FILE: postgresql_archive/src/configuration/zonky/mod.rs
================================================
mod extractor;
mod matcher;
mod repository;
pub const URL: &str = "https://github.com/zonkyio/embedded-postgres-binaries";
pub use extractor::extract;
pub use matcher::matcher;
pub use repository::Zonky;
================================================
FILE: postgresql_archive/src/configuration/zonky/repository.rs
================================================
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 async_trait::async_trait;
use semver::{Version, VersionReq};
use tracing::instrument;
/// Zonky repository.
///
/// This repository is used to interact with Zonky Maven repositories
/// (e.g. <https://repo1.maven.org/maven2/io/zonky/test/postgres">).
#[derive(Debug)]
pub struct Zonky {
maven: Box<dyn Repository>,
}
const MAVEN_URL: &str = "https://repo1.maven.org/maven2/io/zonky/test/postgres";
impl Zonky {
/// Creates a new Zonky repository from the specified URL in the format
/// <https://github.com/zonkyio/embedded-postgres-binaries>
///
/// # Errors
/// * If the URL is invalid.
#[expect(clippy::new_ret_no_self)]
pub fn new(_url: &str) -> Result<Box<dyn Repository>> {
let os = get_os();
let arch = get_arch();
let archive = format!("embedded-postgres-binaries-{os}-{arch}");
let url = format!("{MAVEN_URL}/{archive}");
let maven = Maven::new(url.as_str())?;
Ok(Box::new(Zonky { maven }))
}
}
#[async_trait]
impl Repository for Zonky {
#[instrument(level = "debug")]
fn name(&self) -> &str {
"Zonky"
}
#[instrument(level = "debug")]
async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
self.maven.get_version(version_req).await
}
#[instrument]
async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
self.maven.get_archive(version_req).await
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::configuration::zonky;
#[test]
fn test_name() {
let zonky = Zonky::new(zonky::URL).unwrap();
assert_eq!("Zonky", zonky.name());
}
//
// get_version tests
//
#[tokio::test]
async fn test_get_version() -> Result<()> {
let maven = Zonky::new(zonky::URL)?;
let version_req = VersionReq::STAR;
let version = maven.get_version(&version_req).await?;
assert!(version > Version::new(0, 0, 0));
Ok(())
}
#[tokio::test]
async fn test_get_specific_version() -> Result<()> {
let zonky = Zonky::new(zonky::URL)?;
let version_req = VersionReq::parse("=16.2.0")?;
let version = zonky.get_version(&version_req).await?;
assert_eq!(Version::new(16, 2, 0), version);
Ok(())
}
#[tokio::test]
async fn test_get_specific_not_found() -> Result<()> {
let zonky = Zonky::new(zonky::URL)?;
let version_req = VersionReq::parse("=0.0.0")?;
let error = zonky.get_version(&version_req).await.unwrap_err();
assert_eq!("version not found for '=0.0.0'", error.to_string());
Ok(())
}
//
// get_archive tests
//
#[tokio::test]
async fn test_get_archive() -> Result<()> {
let zonky = Zonky::new(zonky::URL)?;
let os = get_os();
let arch = get_arch();
let version = Version::new(16, 2, 0);
let version_req = VersionReq::parse(format!("={version}").as_str())?;
let archive = zonky.get_archive(&version_req).await?;
assert_eq!(
format!("embedded-postgres-binaries-{os}-{arch}-{version}.jar"),
archive.name()
);
assert_eq!(&version, archive.version());
assert!(!archive.bytes().is_empty());
Ok(())
}
}
================================================
FILE: postgresql_archive/src/error.rs
================================================
use std::sync::PoisonError;
/// PostgreSQL archive result type
pub type Result<T, E = Error> = core::result::Result<T, E>;
/// PostgreSQL archive errors
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Asset not found
#[error("asset not found")]
AssetNotFound,
/// Asset hash not found
#[error("asset hash not found for asset '{0}'")]
AssetHashNotFound(String),
/// Error when the hash of the archive does not match the expected hash
#[error("Archive hash [{archive_hash}] does not match expected hash [{hash}]")]
ArchiveHashMismatch { archive_hash: String, hash: String },
/// Invalid version
#[error("version '{0}' is invalid")]
InvalidVersion(String),
/// IO error
#[error("{0}")]
IoError(String),
/// Parse error
#[error("{0}")]
ParseError(String),
/// Poisoned lock
#[error("poisoned lock '{0}'")]
PoisonedLock(String),
/// Repository failure
#[error("{0}")]
RepositoryFailure(String),
/// Unexpected error
#[error("{0}")]
Unexpected(String),
/// Unsupported extractor
#[error("unsupported extractor for '{0}'")]
UnsupportedExtractor(String),
/// Unsupported hasher
#[error("unsupported hasher for '{0}'")]
UnsupportedHasher(String),
/// Unsupported hasher
#[error("unsupported matcher for '{0}'")]
UnsupportedMatcher(String),
/// Unsupported repository
#[error("unsupported repository for '{0}'")]
UnsupportedRepository(String),
/// Version not found
#[error("version not found for '{0}'")]
VersionNotFound(String),
}
/// Converts a [`regex_lite::Error`] into an [`ParseError`](Error::ParseError)
impl From<regex_lite::Error> for Error {
fn from(error: regex_lite::Error) -> Self {
Error::ParseError(error.to_string())
}
}
/// Converts a [`reqwest::Error`] into an [`IoError`](Error::IoError)
impl From<reqwest::Error> for Error {
fn from(error: reqwest::Error) -> Self {
Error::IoError(error.to_string())
}
}
/// Converts a [`reqwest_middleware::Error`] into an [`IoError`](Error::IoError)
impl From<reqwest_middleware::Error> for Error {
fn from(error: reqwest_middleware::Error) -> Self {
Error::IoError(error.to_string())
}
}
/// Converts a [`std::io::Error`] into an [`IoError`](Error::IoError)
impl From<std::io::Error> for Error {
fn from(error: std::io::Error) -> Self {
Error::IoError(error.to_string())
}
}
/// Converts a [`std::time::SystemTimeError`] into an [`IoError`](Error::IoError)
impl From<std::time::SystemTimeError> for Error {
fn from(error: std::time::SystemTimeError) -> Self {
Error::IoError(error.to_string())
}
}
/// Converts a [`std::num::ParseIntError`] into an [`ParseError`](Error::ParseError)
impl From<std::num::ParseIntError> for Error {
fn from(error: std::num::ParseIntError) -> Self {
Error::ParseError(error.to_string())
}
}
/// Converts a [`semver::Error`] into an [`ParseError`](Error::ParseError)
impl From<semver::Error> for Error {
fn from(error: semver::Error) -> Self {
Error::IoError(error.to_string())
}
}
/// Converts a [`std::path::StripPrefixError`] into an [`ParseError`](Error::ParseError)
impl From<std::path::StripPrefixError> for Error {
fn from(error: std::path::StripPrefixError) -> Self {
Error::ParseError(error.to_string())
}
}
/// Converts a [`url::ParseError`] into an [`ParseError`](Error::ParseError)
impl From<url::ParseError> for Error {
fn from(error: url::ParseError) -> Self {
Error::ParseError(error.to_string())
}
}
#[cfg(feature = "maven")]
/// Converts a [`quick_xml::DeError`] into a [`ParseError`](Error::ParseError)
impl From<quick_xml::DeError> for Error {
fn from(error: quick_xml::DeError) -> Self {
Error::ParseError(error.to_string())
}
}
#[cfg(feature = "zip")]
/// Converts a [`zip::result::ZipError`] into a [`ParseError`](Error::Unexpected)
impl From<zip::result::ZipError> for Error {
fn from(error: zip::result::ZipError) -> Self {
Error::Unexpected(error.to_string())
}
}
/// Converts a [`std::sync::PoisonError<T>`] into a [`ParseError`](Error::PoisonedLock)
impl<T> From<PoisonError<T>> for Error {
fn from(value: PoisonError<T>) -> Self {
Error::PoisonedLock(value.to_string())
}
}
/// These are relatively low value tests; they are here to reduce the coverage gap and
/// ensure that the error conversions are working as expected.
#[cfg(test)]
mod test {
use super::*;
use anyhow::anyhow;
use semver::VersionReq;
use std::ops::Add;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::{Duration, SystemTime};
#[test]
fn test_from_regex_error() {
let regex_error = regex_lite::Regex::new("(?=a)").expect_err("regex error");
let error = Error::from(regex_error);
assert_eq!(error.to_string(), "look-around is not supported");
}
#[tokio::test]
async fn test_from_reqwest_error() {
let result = reqwest::get("https://a.com").await;
assert!(result.is_err());
if let Err(error) = result {
let error = Error::from(error);
assert!(error.to_string().contains("error sending request"));
}
}
#[tokio::test]
async fn test_from_reqwest_middeleware_error() {
let reqwest_middleware_error =
reqwest_middleware::Error::Middleware(anyhow!("middleware error: test"));
let error = Error::from(reqwest_middleware_error);
assert!(error.to_string().contains("middleware error: test"));
}
#[test]
fn test_from_io_error() {
let io_error = std::io::Error::new(std::io::ErrorKind::NotFound, "test");
let error = Error::from(io_error);
assert_eq!(error.to_string(), "test");
}
#[test]
fn test_from_parse_int_error() {
let parse_int_error = u64::from_str("test").expect_err("parse int error");
let error = Error::from(parse_int_error);
assert_eq!(error.to_string(), "invalid digit found in string");
}
#[test]
fn test_from_semver_error() {
let semver_error = VersionReq::parse("foo").expect_err("semver error");
let error = Error::from(semver_error);
assert_eq!(
error.to_string(),
"unexpected character 'f' while parsing major version number"
);
}
#[test]
fn test_from_strip_prefix_error() {
let path = PathBuf::from("test");
let strip_prefix_error = path.strip_prefix("foo").expect_err("strip prefix error");
let error = Error::from(strip_prefix_error);
assert_eq!(error.to_string(), "prefix not found");
}
#[test]
fn test_from_system_time_error() {
let future_time = SystemTime::now().add(Duration::from_secs(300));
let system_time_error = SystemTime::now()
.duration_since(future_time)
.expect_err("system time error");
let error = Error::from(system_time_error);
assert_eq!(
error.to_string(),
"second time provided was later than self"
);
}
#[test]
fn test_from_url_parse_error() {
let parse_error = url::ParseError::EmptyHost;
let error = Error::from(parse_error);
assert_eq!(error.to_string(), "empty host");
}
#[cfg(feature = "maven")]
#[test]
fn test_from_quick_xml_error() {
let xml = "<invalid>";
let quick_xml_error = quick_xml::de::from_str::<String>(xml).expect_err("quick_xml error");
let error = Error::from(quick_xml_error);
assert!(matches!(error, Error::ParseError(_)));
}
#[cfg(feature = "zip")]
#[test]
fn test_from_zip_error() {
let zip_error = zip::result::ZipError::FileNotFound;
let error = Error::from(zip_error);
assert!(matches!(error, Error::Unexpected(_)));
assert!(
error
.to_string()
.contains("specified file not found in archive")
);
}
#[test]
fn test_from_poisoned_lock() {
let error = Error::from(std::sync::PoisonError::new(()));
assert!(matches!(error, Error::PoisonedLock(_)));
assert!(error.to_string().contains("poisoned lock"));
}
}
================================================
FILE: postgresql_archive/src/extractor/mod.rs
================================================
mod model;
pub mod registry;
#[cfg(feature = "tar-gz")]
mod tar_gz_extractor;
#[cfg(feature = "tar-xz")]
mod tar_xz_extractor;
#[cfg(feature = "zip")]
mod zip_extractor;
pub use model::ExtractDirectories;
#[cfg(feature = "tar-gz")]
pub use tar_gz_extractor::extract as tar_gz_extract;
#[cfg(feature = "tar-xz")]
pub use tar_xz_extractor::extract as tar_xz_extract;
#[cfg(feature = "zip")]
pub use zip_extractor::extract as zip_extract;
================================================
FILE: postgresql_archive/src/extractor/model.rs
================================================
use crate::{Error, Result};
use regex_lite::Regex;
use std::fmt::Display;
use std::path::PathBuf;
/// Extract directories manage the directories to extract a file in an archive to based upon the
/// associated regex matching the file path.
#[derive(Debug)]
pub struct ExtractDirectories {
mappings: Vec<(Regex, PathBuf)>,
}
impl ExtractDirectories {
/// Creates a new ExtractDirectories instance.
#[must_use]
pub fn new(mappings: Vec<(Regex, PathBuf)>) -> Self {
Self { mappings }
}
/// Adds a new mapping to the ExtractDirectories instance.
pub fn add_mapping(&mut self, regex: Regex, path: PathBuf) {
self.mappings.push((regex, path));
}
/// Returns the path associated with the first regex that matches the file path.
/// If no regex matches, then the file path is returned.
///
/// # Errors
/// Returns an error if the file path cannot be converted to a string.
pub fn get_path(&self, file_path: &str) -> Result<PathBuf> {
for (regex, path) in &self.mappings {
if regex.is_match(file_path) {
return Ok(path.clone());
}
}
Err(Error::Unexpected(format!(
"No regex matched the file path: {file_path}"
)))
}
}
/// Default implementation for ExtractDirectories.
impl Default for ExtractDirectories {
/// Creates a new ExtractDirectories instance with an empty mappings vector.
fn default() -> Self {
ExtractDirectories::new(Vec::new())
}
}
/// Display implementation for ExtractDirectories.
impl Display for ExtractDirectories {
/// Formats the ExtractDirectories instance.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for (regex, path) in &self.mappings {
writeln!(f, "{} -> {}", regex, path.display())?;
}
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_new() -> Result<()> {
let mappings = vec![(Regex::new(".*")?, PathBuf::from("test"))];
let extract_directories = ExtractDirectories::new(mappings);
let path = extract_directories.get_path("foo")?;
assert_eq!("test", path.to_string_lossy());
Ok(())
}
#[test]
fn test_default() {
let extract_directories = ExtractDirectories::default();
let result = extract_directories.get_path("foo");
assert!(result.is_err());
}
#[test]
fn test_add_mapping() -> Result<()> {
let mut extract_directories = ExtractDirectories::default();
extract_directories.add_mapping(Regex::new(".*")?, PathBuf::from("test"));
let path = extract_directories.get_path("foo")?;
assert_eq!("test", path.to_string_lossy());
Ok(())
}
#[test]
fn test_get_path() -> Result<()> {
let mappings = vec![
(Regex::new("test")?, PathBuf::from("test")),
(Regex::new("foo")?, PathBuf::from("bar")),
];
let extract_directories = ExtractDirectories::new(mappings);
let path = extract_directories.get_path("foo")?;
assert_eq!("bar", path.to_string_lossy());
Ok(())
}
#[test]
fn test_display() -> Result<()> {
let mappings = vec![
(Regex::new("test")?, PathBuf::from("test")),
(Regex::new("foo")?, PathBuf::from("bar")),
];
let extract_directories = ExtractDirectories::new(mappings);
let display = extract_directories.to_string();
assert_eq!("test -> test\nfoo -> bar\n", display);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/extractor/registry.rs
================================================
use crate::Error::UnsupportedExtractor;
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "zonky")]
use crate::configuration::zonky;
use crate::extractor::ExtractDirectories;
use std::path::PathBuf;
use std::sync::{Arc, LazyLock, Mutex, RwLock};
static REGISTRY: LazyLock<Arc<Mutex<RepositoryRegistry>>> =
LazyLock::new(|| Arc::new(Mutex::new(RepositoryRegistry::default())));
type SupportsFn = fn(&str) -> Result<bool>;
type ExtractFn = fn(&Vec<u8>, &ExtractDirectories) -> Result<Vec<PathBuf>>;
/// Singleton struct to store extractors
#[expect(clippy::type_complexity)]
struct RepositoryRegistry {
extractors: Vec<(Arc<RwLock<SupportsFn>>, Arc<RwLock<ExtractFn>>)>,
}
impl RepositoryRegistry {
/// Creates a new extractor registry.
fn new() -> Self {
Self {
extractors: Vec::new(),
}
}
/// Registers an extractor. Newly registered extractors take precedence over existing ones.
fn register(&mut self, supports_fn: SupportsFn, extract_fn: ExtractFn) {
self.extractors.insert(
0,
(
Arc::new(RwLock::new(supports_fn)),
Arc::new(RwLock::new(extract_fn)),
),
);
}
/// Gets an extractor that supports the specified URL
///
/// # Errors
/// * If the URL is not supported.
fn get(&self, url: &str) -> Result<ExtractFn> {
for (supports_fn, extractor_fn) in &self.extractors {
let supports_function = supports_fn.read()?;
if supports_function(url)? {
let extractor_function = extractor_fn.read()?;
return Ok(*extractor_function);
}
}
Err(UnsupportedExtractor(url.to_string()))
}
}
impl Default for RepositoryRegistry {
/// Creates a new repository registry with the default repositories registered.
fn default() -> Self {
let mut registry = Self::new();
#[cfg(feature = "theseus")]
registry.register(|url| Ok(url.starts_with(theseus::URL)), theseus::extract);
#[cfg(feature = "zonky")]
registry.register(|url| Ok(url.starts_with(zonky::URL)), zonky::extract);
registry
}
}
/// Registers an extractor. Newly registered extractors take precedence over existing ones.
///
/// # Errors
/// * If the registry is poisoned.
pub fn register(supports_fn: SupportsFn, extractor_fn: ExtractFn) -> Result<()> {
REGISTRY.lock()?.register(supports_fn, extractor_fn);
Ok(())
}
/// Gets an extractor that supports the specified URL
///
/// # Errors
/// * If the URL is not supported.
pub fn get(url: &str) -> Result<ExtractFn> {
REGISTRY.lock()?.get(url)
}
#[cfg(test)]
mod tests {
use super::*;
use regex_lite::Regex;
#[test]
fn test_register() -> Result<()> {
register(|url| Ok(url == "https://foo.com"), |_, _| Ok(Vec::new()))?;
let url = "https://foo.com";
let extractor = get(url)?;
let mut extract_directories = ExtractDirectories::default();
extract_directories.add_mapping(Regex::new(".*")?, PathBuf::from("test"));
assert!(extractor(&Vec::new(), &extract_directories).is_ok());
Ok(())
}
#[test]
fn test_get_error() {
let error = get("foo").unwrap_err();
assert_eq!("unsupported extractor for 'foo'", error.to_string());
}
#[test]
#[cfg(feature = "theseus")]
fn test_get_theseus_postgresql_binaries() {
assert!(get(theseus::URL).is_ok());
}
}
================================================
FILE: postgresql_archive/src/extractor/tar_gz_extractor.rs
================================================
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::ExtractDirectories;
use flate2::bufread::GzDecoder;
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};
/// Extracts the compressed tar `bytes` to paths defined in `extract_directories`.
///
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let input = BufReader::new(Cursor::new(bytes));
let decoder = GzDecoder::new(input);
let mut archive = Archive::new(decoder);
let mut extracted_bytes = 0;
for archive_entry in archive.entries()? {
let mut entry = archive_entry?;
let entry_header = entry.header();
let entry_type = entry_header.entry_type();
let entry_size = entry_header.size()?;
#[cfg(unix)]
let file_mode = entry_header.mode()?;
let entry_header_path = entry_header.path()?.to_path_buf();
let prefix = match entry_header_path.components().next() {
Some(component) => component.as_os_str().to_str().unwrap_or_default(),
None => {
return Err(Unexpected(
"Failed to get file header path prefix".to_string(),
));
}
};
let stripped_entry_header_path = entry_header_path.strip_prefix(prefix)?.to_path_buf();
let Ok(extract_dir) = extract_directories.get_path(prefix) else {
continue;
};
let mut entry_name = extract_dir.clone();
entry_name.push(stripped_entry_header_path);
if entry_type.is_dir() || entry_name.is_dir() {
create_dir_all(&entry_name)?;
} else if entry_type.is_file() {
let mut output_file = File::create(&entry_name)?;
copy(&mut entry, &mut output_file)?;
extracted_bytes += entry_size;
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
output_file.set_permissions(std::fs::Permissions::from_mode(file_mode))?;
}
files.push(entry_name);
} else if entry_type.is_symlink() {
#[cfg(unix)]
if let Some(symlink_target) = entry.link_name()? {
let symlink_path = entry_name.clone();
std::os::unix::fs::symlink(symlink_target.as_ref(), symlink_path)?;
files.push(entry_name);
}
}
}
let number_of_files = files.len();
debug!("Extracted {number_of_files} files totalling {extracted_bytes}");
Ok(files)
}
================================================
FILE: postgresql_archive/src/extractor/tar_xz_extractor.rs
================================================
use crate::Error::Unexpected;
use crate::Result;
use crate::extractor::ExtractDirectories;
use liblzma::bufread::XzDecoder;
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};
/// Extracts the compressed tar `bytes` to paths defined in `extract_directories`.
///
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let input = BufReader::new(Cursor::new(bytes));
let decoder = XzDecoder::new(input);
let mut archive = Archive::new(decoder);
let mut extracted_bytes = 0;
for archive_entry in archive.entries()? {
let mut entry = archive_entry?;
let entry_header = entry.header();
let entry_type = entry_header.entry_type();
let entry_size = entry_header.size()?;
#[cfg(unix)]
let file_mode = entry_header.mode()?;
let entry_header_path = entry_header.path()?.to_path_buf();
let prefix = match entry_header_path.components().next() {
Some(component) => component.as_os_str().to_str().unwrap_or_default(),
None => {
return Err(Unexpected(
"Failed to get file header path prefix".to_string(),
));
}
};
let Ok(extract_dir) = extract_directories.get_path(prefix) else {
continue;
};
let mut entry_name = extract_dir.clone();
entry_name.push(entry_header_path);
if entry_type.is_dir() || entry_name.is_dir() {
create_dir_all(&entry_name)?;
} else if entry_type.is_file() {
if let Some(parent) = entry_name.parent() {
create_dir_all(parent)?;
}
let mut output_file = File::create(&entry_name)?;
copy(&mut entry, &mut output_file)?;
extracted_bytes += entry_size;
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
output_file.set_permissions(std::fs::Permissions::from_mode(file_mode))?;
}
files.push(entry_name);
} else if entry_type.is_symlink() {
#[cfg(unix)]
if let Some(symlink_target) = entry.link_name()? {
let symlink_path = entry_name.clone();
std::os::unix::fs::symlink(symlink_target.as_ref(), symlink_path)?;
files.push(entry_name);
}
}
}
let number_of_files = files.len();
debug!("Extracted {number_of_files} files totalling {extracted_bytes}");
Ok(files)
}
================================================
FILE: postgresql_archive/src/extractor/zip_extractor.rs
================================================
use crate::Result;
use crate::extractor::ExtractDirectories;
use std::fs::create_dir_all;
use std::io::Cursor;
use std::path::PathBuf;
use std::{fs, io};
use tracing::{debug, instrument, warn};
use zip::ZipArchive;
/// Extracts the compressed tar `bytes` to paths defined in `extract_directories`.
///
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let reader = Cursor::new(bytes);
let mut archive = ZipArchive::new(reader)?;
let mut extracted_bytes = 0;
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let file_path = PathBuf::from(file.name());
let file_path = PathBuf::from(file_path.file_name().unwrap_or_default());
let file_name = file_path.to_string_lossy();
let Ok(extract_dir) = extract_directories.get_path(&file_name) else {
continue;
};
create_dir_all(&extract_dir)?;
let mut out = Vec::new();
io::copy(&mut file, &mut out)?;
extracted_bytes += out.len() as u64;
let path = PathBuf::from(&extract_dir).join(file_path);
fs::write(&path, out)?;
files.push(path);
}
let number_of_files = files.len();
debug!("Extracted {number_of_files} files totalling {extracted_bytes}");
Ok(files)
}
================================================
FILE: postgresql_archive/src/hasher/md5.rs
================================================
use crate::Result;
use md5::{Digest, Md5};
/// Hashes the data using MD5.
///
/// # Errors
/// * If the data cannot be hashed.
pub fn hash(data: &Vec<u8>) -> Result<String> {
let mut hasher = Md5::new();
hasher.update(data);
let hash = hex::encode(hasher.finalize());
Ok(hash)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_hash() -> Result<()> {
let data = vec![4, 2];
let hash = hash(&data)?;
assert_eq!("21fb3d1d1a91a7e80dff456205f3380b", hash);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/hasher/mod.rs
================================================
#[cfg(feature = "md5")]
pub mod md5;
pub mod registry;
#[cfg(feature = "sha1")]
pub mod sha1;
#[cfg(feature = "sha2")]
pub mod sha2_256;
#[cfg(feature = "sha2")]
pub mod sha2_512;
================================================
FILE: postgresql_archive/src/hasher/registry.rs
================================================
use crate::Error::UnsupportedHasher;
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "md5")]
use crate::hasher::md5;
#[cfg(feature = "sha1")]
use crate::hasher::sha1;
#[cfg(feature = "sha2")]
use crate::hasher::sha2_256;
#[cfg(all(feature = "sha2", feature = "maven"))]
use crate::hasher::sha2_512;
#[cfg(feature = "maven")]
use crate::repository::maven;
use std::sync::{Arc, LazyLock, Mutex, RwLock};
static REGISTRY: LazyLock<Arc<Mutex<HasherRegistry>>> =
LazyLock::new(|| Arc::new(Mutex::new(HasherRegistry::default())));
pub type SupportsFn = fn(&str, &str) -> Result<bool>;
pub type HasherFn = fn(&Vec<u8>) -> Result<String>;
/// Singleton struct to store hashers
#[expect(clippy::type_complexity)]
struct HasherRegistry {
hashers: Vec<(Arc<RwLock<SupportsFn>>, Arc<RwLock<HasherFn>>)>,
}
impl HasherRegistry {
/// Creates a new hasher registry.
fn new() -> Self {
Self {
hashers: Vec::new(),
}
}
/// Registers a hasher for a supports function. Newly registered hashers will take precedence
/// over existing ones.
fn register(&mut self, supports_fn: SupportsFn, hasher_fn: HasherFn) {
self.hashers.insert(
0,
(
Arc::new(RwLock::new(supports_fn)),
Arc::new(RwLock::new(hasher_fn)),
),
);
}
/// Get a hasher for the specified url and extension.
///
/// # Errors
/// * If the registry is poisoned.
fn get<S: AsRef<str>>(&self, url: S, extension: S) -> Result<HasherFn> {
let url = url.as_ref();
let extension = extension.as_ref();
for (supports_fn, hasher_fn) in &self.hashers {
let supports_function = supports_fn.read()?;
if supports_function(url, extension)? {
let hasher_function = hasher_fn.read()?;
return Ok(*hasher_function);
}
}
Err(UnsupportedHasher(url.to_string()))
}
}
impl Default for HasherRegistry {
/// Creates a new hasher registry with the default hashers registered.
fn default() -> Self {
let mut registry = Self::new();
#[cfg(feature = "theseus")]
registry.register(
|url, extension| Ok(url.starts_with(theseus::URL) && extension == "sha256"),
sha2_256::hash,
);
// Register the Maven hashers: https://maven.apache.org/resolver/about-checksums.html#implemented-checksum-algorithms
#[cfg(feature = "maven")]
registry.register(
|url, extension| Ok(url.starts_with(maven::URL) && extension == "md5"),
md5::hash,
);
#[cfg(feature = "maven")]
registry.register(
|url, extension| Ok(url.starts_with(maven::URL) && extension == "sha1"),
sha1::hash,
);
#[cfg(feature = "maven")]
registry.register(
|url, extension| Ok(url.starts_with(maven::URL) && extension == "sha256"),
sha2_256::hash,
);
#[cfg(feature = "maven")]
registry.register(
|url, extension| Ok(url.starts_with(maven::URL) && extension == "sha512"),
sha2_512::hash,
);
registry
}
}
/// Registers a hasher for a supports function. Newly registered hashers will take precedence
/// over existing ones.
///
/// # Errors
/// * If the registry is poisoned.
pub fn register(supports_fn: SupportsFn, hasher_fn: HasherFn) -> Result<()> {
REGISTRY.lock()?.register(supports_fn, hasher_fn);
Ok(())
}
/// Get a hasher for the specified url and extension.
///
/// # Errors
/// * If the registry is poisoned.
pub fn get<S: AsRef<str>>(url: S, extension: S) -> Result<HasherFn> {
REGISTRY.lock()?.get(url, extension)
}
#[cfg(test)]
mod tests {
use super::*;
fn test_hasher(extension: &str, expected: &str) -> Result<()> {
let hasher = get("https://foo.com", extension)?;
let data = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
let hash = hasher(&data)?;
assert_eq!(expected, hash);
Ok(())
}
#[test]
fn test_register() -> Result<()> {
register(
|_, extension| Ok(extension == "test"),
|_| Ok("42".to_string()),
)?;
test_hasher("test", "42")
}
#[test]
fn test_get_invalid_url_error() {
let error = get("https://foo.com", "foo").unwrap_err();
assert_eq!(
"unsupported hasher for 'https://foo.com'",
error.to_string()
);
}
#[test]
#[cfg(feature = "theseus")]
fn test_get_invalid_extension_error() {
let error = get(theseus::URL, "foo").unwrap_err();
assert_eq!(
format!("unsupported hasher for '{}'", theseus::URL),
error.to_string()
);
}
#[test]
#[cfg(feature = "theseus")]
fn test_get_theseus_postgresql_binaries() {
assert!(get(theseus::URL, "sha256").is_ok());
}
#[test]
#[cfg(feature = "maven")]
fn test_get_zonky_postgresql_binaries() {
assert!(get(maven::URL, "sha512").is_ok());
}
}
================================================
FILE: postgresql_archive/src/hasher/sha1.rs
================================================
use crate::Result;
use sha1::{Digest, Sha1};
/// Hashes the data using SHA1.
///
/// # Errors
/// * If the data cannot be hashed.
pub fn hash(data: &Vec<u8>) -> Result<String> {
let mut hasher = Sha1::new();
hasher.update(data);
let hash = hex::encode(hasher.finalize());
Ok(hash)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_hash() -> Result<()> {
let data = vec![4, 2];
let hash = hash(&data)?;
assert_eq!("1f3e1678e699640dfa5173d3a52b004f5e164d87", hash);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/hasher/sha2_256.rs
================================================
use crate::Result;
use sha2::{Digest, Sha256};
/// Hashes the data using SHA2-256.
///
/// # Errors
/// * If the data cannot be hashed.
pub fn hash(data: &Vec<u8>) -> Result<String> {
let mut hasher = Sha256::new();
hasher.update(data);
let hash = hex::encode(hasher.finalize());
Ok(hash)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_hash() -> Result<()> {
let data = vec![4, 2];
let hash = hash(&data)?;
assert_eq!(
"b7586d310e5efb1b7d10a917ba5af403adbf54f4f77fe7fdcb4880a95dac7e7e",
hash
);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/hasher/sha2_512.rs
================================================
use crate::Result;
use sha2::{Digest, Sha512};
/// Hashes the data using SHA2-512.
///
/// # Errors
/// * If the data cannot be hashed.
pub fn hash(data: &Vec<u8>) -> Result<String> {
let mut hasher = Sha512::new();
hasher.update(data);
let hash = hex::encode(hasher.finalize());
Ok(hash)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_hash() -> Result<()> {
let data = vec![4, 2];
let hash = hash(&data)?;
assert_eq!(
"7df6418d1791a6fe80e726319f16f107534a663346f99e0d155e359a54f6c74391e2f3be19c995c3c903926d348bd86c339bd982e10f09aa776e4ff85d36387a",
hash
);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/lib.rs
================================================
//! # postgresql_archive
//!
//! [](https://codecov.io/gh/theseus-rs/postgresql-embedded)
//! [](https://bencher.dev/perf/theseus-rs-postgresql-embedded)
//! [](https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_archive#license)
//! [](https://semver.org/spec/v2.0.0.html)
//!
//! Retrieve and extract PostgreSQL on Linux, MacOS or Windows.
//!
//! ## Table of contents
//!
//! - [Examples](#examples)
//! - [Feature flags](#feature-flags)
//! - [Supported platforms](#supported-platforms)
//! - [Safety](#safety)
//! - [License](#license)
//! - [Notes](#notes)
//!
//! ## Examples
//!
//! ### Asynchronous API
//!
//! ```no_run
//! 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
//! ```no_run
//! #[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 |
//!
//! ### Extractors
//!
//! | Name | Description | Default? |
//! |----------|--------------------------|----------|
//! | `tar-gz` | Enables tar gz extractor | Yes |
//! | `tar-xz` | Enables tar xz extractor | No |
//! | `zip` | Enables zip extractor | 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:
//!
//! * [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries)
//! * [zonkyio/embedded-postgres-binaries](https://github.com/zonkyio/embedded-postgres-binaries)
//!
//! ## 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](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
//! * MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
//!
//! at your option.
//!
//! PostgreSQL is covered under [The PostgreSQL License](https://opensource.org/licenses/postgresql).
mod archive;
#[cfg(feature = "blocking")]
pub mod blocking;
pub mod configuration;
mod error;
pub mod extractor;
pub mod hasher;
pub mod matcher;
pub mod repository;
mod version;
pub use archive::{extract, get_archive, get_version};
pub use error::{Error, Result};
pub use semver::{Version, VersionReq};
pub use version::{ExactVersion, ExactVersionReq};
================================================
FILE: postgresql_archive/src/matcher/mod.rs
================================================
pub mod registry;
================================================
FILE: postgresql_archive/src/matcher/registry.rs
================================================
use crate::Error::UnsupportedMatcher;
use crate::Result;
#[cfg(feature = "theseus")]
use crate::configuration::theseus;
#[cfg(feature = "zonky")]
use crate::configuration::zonky;
use semver::Version;
use std::sync::{Arc, LazyLock, Mutex, RwLock};
static REGISTRY: LazyLock<Arc<Mutex<MatchersRegistry>>> =
LazyLock::new(|| Arc::new(Mutex::new(MatchersRegistry::default())));
pub type SupportsFn = fn(&str) -> Result<bool>;
pub type MatcherFn = fn(&str, &str, &Version) -> Result<bool>;
/// Singleton struct to store matchers
#[expect(clippy::type_complexity)]
struct MatchersRegistry {
matchers: Vec<(Arc<RwLock<SupportsFn>>, Arc<RwLock<MatcherFn>>)>,
}
impl MatchersRegistry {
/// Creates a new matcher registry.
fn new() -> Self {
Self {
matchers: Vec::new(),
}
}
/// Registers a matcher for a supports function. Newly registered matchers will take precedence
/// over existing ones.
fn register(&mut self, supports_fn: SupportsFn, matcher_fn: MatcherFn) {
self.matchers.insert(
0,
(
Arc::new(RwLock::new(supports_fn)),
Arc::new(RwLock::new(matcher_fn)),
),
);
}
/// Get a matcher for the specified URL.
///
/// # Errors
/// * If the registry is poisoned.
fn get<S: AsRef<str>>(&self, url: S) -> Result<MatcherFn> {
let url = url.as_ref();
for (supports_fn, matcher_fn) in &self.matchers {
let supports_function = supports_fn.read()?;
if supports_function(url)? {
let matcher_function = matcher_fn.read()?;
return Ok(*matcher_function);
}
}
Err(UnsupportedMatcher(url.to_string()))
}
}
impl Default for MatchersRegistry {
/// Creates a new matcher registry with the default matchers registered.
fn default() -> Self {
let mut registry = Self::new();
#[cfg(feature = "theseus")]
registry.register(|url| Ok(url == theseus::URL), theseus::matcher);
#[cfg(feature = "zonky")]
registry.register(|url| Ok(url == zonky::URL), zonky::matcher);
registry
}
}
/// Registers a matcher for a supports function. Newly registered matchers will take precedence over
/// existing ones.
///
/// # Errors
/// * If the registry is poisoned.
pub fn register(supports_fn: SupportsFn, matcher_fn: MatcherFn) -> Result<()> {
REGISTRY.lock()?.register(supports_fn, matcher_fn);
Ok(())
}
/// Get a matcher for the specified URL.
///
/// # Errors
/// * If the registry is poisoned.
pub fn get<S: AsRef<str>>(url: S) -> Result<MatcherFn> {
REGISTRY.lock()?.get(url)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_register() -> Result<()> {
register(
|url| Ok(url == "https://foo.com"),
|_url, name, _version| Ok(name == "foo"),
)?;
let matcher = get("https://foo.com")?;
let version = Version::new(16, 3, 0);
assert!(matcher("", "foo", &version)?);
Ok(())
}
#[test]
fn test_get_error() {
let result = get("foo").unwrap_err();
assert_eq!("unsupported matcher for 'foo'", result.to_string());
}
#[test]
#[cfg(feature = "theseus")]
fn test_get_theseus_postgresql_binaries() {
assert!(get(theseus::URL).is_ok());
}
#[test]
#[cfg(feature = "zonky")]
fn test_get_zonyk_postgresql_binaries() {
assert!(get(zonky::URL).is_ok());
}
}
================================================
FILE: postgresql_archive/src/repository/github/mod.rs
================================================
pub(crate) mod models;
pub mod repository;
================================================
FILE: postgresql_archive/src/repository/github/models.rs
================================================
//! Structs for GitHub API responses
use serde::{Deserialize, Serialize};
/// Represents a GitHub release
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct Release {
pub url: String,
pub assets_url: String,
pub upload_url: String,
pub html_url: String,
pub id: i64,
pub tag_name: String,
pub name: String,
pub draft: bool,
pub prerelease: bool,
pub assets: Vec<Asset>,
}
/// Represents a GitHub asset
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct Asset {
pub url: String,
pub id: i64,
pub node_id: String,
pub name: String,
pub label: String,
pub content_type: String,
pub state: String,
pub size: i64,
pub browser_download_url: String,
}
================================================
FILE: postgresql_archive/src/repository/github/repository.rs
================================================
use crate::Error::{
ArchiveHashMismatch, AssetHashNotFound, AssetNotFound, RepositoryFailure, VersionNotFound,
};
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::RetryTransientMiddleware;
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_tracing::TracingMiddleware;
use semver::{Version, VersionReq};
use std::env;
use std::io::Write;
use std::str::FromStr;
use std::sync::LazyLock;
use tracing::{debug, instrument, warn};
#[cfg(feature = "indicatif")]
use tracing_indicatif::span_ext::IndicatifSpanExt;
use url::Url;
const GITHUB_API_VERSION_HEADER: &str = "X-GitHub-Api-Version";
const GITHUB_API_VERSION: &str = "2022-11-28";
static GITHUB_TOKEN: LazyLock<Option<String>> = LazyLock::new(|| match env::var("GITHUB_TOKEN") {
Ok(token) => {
debug!("GITHUB_TOKEN environment variable found");
Some(token)
}
Err(_) => None,
});
static USER_AGENT: LazyLock<String> = LazyLock::new(|| {
format!(
"{PACKAGE}/{VERSION}",
PACKAGE = env!("CARGO_PKG_NAME"),
VERSION = env!("CARGO_PKG_VERSION")
)
});
/// GitHub repository.
///
/// This repository is used to interact with GitHub. The configuration url should be
/// in the format <https://github.com/owner/repository>
/// (e.g. <https://github.com/theseus-rs/postgresql-binaries>).
#[derive(Debug)]
pub struct GitHub {
url: String,
releases_url: String,
}
impl GitHub {
/// Creates a new GitHub repository from the specified URL in the format
/// <https://github.com/owner/repository>
///
/// # Errors
/// * If the URL is invalid.
#[expect(clippy::new_ret_no_self)]
pub fn new(url: &str) -> Result<Box<dyn Repository>> {
let parsed_url = Url::parse(url)?;
let path = parsed_url.path().trim_start_matches('/');
let path_parts = path.split('/').collect::<Vec<_>>();
let owner = (*path_parts
.first()
.ok_or_else(|| RepositoryFailure(format!("No owner in URL {url}")))?)
.to_string();
let repo = (*path_parts
.get(1)
.ok_or_else(|| RepositoryFailure(format!("No repo in URL {url}")))?)
.to_string();
let releases_url = format!("https://api.github.com/repos/{owner}/{repo}/releases");
Ok(Box::new(Self {
url: url.to_string(),
releases_url,
}))
}
/// Gets the version from the specified tag name.
///
/// # Errors
/// * If the version cannot be parsed.
fn get_version_from_tag_name(tag_name: &str) -> Result<Version> {
// Trim and prefix characters from the tag name (e.g., "v16.4.0" -> "16.4.0").
let tag_name = tag_name.trim_start_matches(|c: char| !c.is_numeric());
match Version::from_str(tag_name) {
Ok(version) => Ok(version),
Err(error) => {
warn!("Failed to parse version {tag_name}");
Err(error.into())
}
}
}
/// Gets the release for the specified [version requirement](VersionReq). If a release for the
/// [version requirement](VersionReq) is not found, then an error is returned.
///
/// # Errors
/// * If the release is not found.
#[instrument(level = "debug")]
async fn get_release(&self, version_req: &VersionReq) -> Result<Release> {
debug!("Attempting to locate release for version requirement {version_req}");
let client = reqwest_client();
let mut result: Option<Release> = None;
let mut page = 1;
loop {
let request = client
.get(&self.releases_url)
.headers(Self::headers())
.query(&[("page", page.to_string().as_str()), ("per_page", "100")]);
let response = request.send().await?.error_for_status()?;
let response_releases = response.json::<Vec<Release>>().await?;
if response_releases.is_empty() {
break;
}
for release in response_releases {
let tag_name = release.tag_name.clone();
let Ok(release_version) = Self::get_version_from_tag_name(tag_name.as_str()) else {
warn!("Failed to parse release version {tag_name}");
continue;
};
if version_req.matches(&release_version) {
if let Some(result_release) = &result {
let result_version =
Self::get_version_from_tag_name(result_release.tag_name.as_str())?;
if release_version > result_version {
result = Some(release);
}
} else {
result = Some(release);
}
}
}
page += 1;
}
match result {
Some(release) => {
let version = Self::get_version_from_tag_name(&release.tag_name)?;
debug!("Version {version} found for version requirement {version_req}");
Ok(release)
}
None => Err(VersionNotFound(version_req.to_string())),
}
}
/// Gets the asset for the specified release that passes the supplied matcher. If an asset for
/// that passes the matcher is not found, then an [AssetNotFound] error is returned.
///
/// # Errors
/// * If the asset is not found.
#[instrument(level = "debug", skip(version, release))]
fn get_asset(
&self,
version: &Version,
release: &Release,
) -> Result<(Asset, Option<Asset>, Option<HasherFn>)> {
let matcher = matcher::registry::get(&self.url)?;
let mut release_asset: Option<Asset> = None;
for asset in &release.assets {
if matcher(&self.url, asset.name.as_str(), version)? {
release_asset = Some(asset.clone());
break;
}
}
let Some(asset) = release_asset else {
return Err(AssetNotFound);
};
// Attempt to find the asset hash for the asset.
let mut asset_hash: Option<Asset> = None;
let mut asset_hasher_fn: Option<HasherFn> = None;
for release_asset in &release.assets {
let release_asset_name = release_asset.name.as_str();
if !release_asset_name.starts_with(&asset.name) {
continue;
}
let extension = release_asset_name
.strip_prefix(format!("{}.", asset.name.as_str()).as_str())
.unwrap_or_default();
if let Ok(hasher_fn) = hasher::registry::get(&self.url, &extension.to_string()) {
asset_hash = Some(release_asset.clone());
asset_hasher_fn = Some(hasher_fn);
break;
}
}
Ok((asset, asset_hash, asset_hasher_fn))
}
/// Returns the headers for the GitHub request.
fn headers() -> HeaderMap {
let mut headers = HeaderMap::new();
headers.append(
GITHUB_API_VERSION_HEADER,
GITHUB_API_VERSION.parse().unwrap(),
);
headers.append("User-Agent", USER_AGENT.parse().unwrap());
if let Some(token) = &*GITHUB_TOKEN {
headers.append("Authorization", format!("Bearer {token}").parse().unwrap());
}
headers
}
}
#[async_trait]
impl Repository for GitHub {
#[instrument(level = "debug")]
fn name(&self) -> &str {
"GitHub"
}
#[instrument(level = "debug")]
async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
let release = self.get_release(version_req).await?;
let version = Self::get_version_from_tag_name(release.tag_name.as_str())?;
Ok(version)
}
#[instrument]
async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
let release = self.get_release(version_req).await?;
let version = Self::get_version_from_tag_name(release.tag_name.as_str())?;
let (asset, asset_hash, asset_hasher_fn) = self.get_asset(&version, &release)?;
let name = asset.name.clone();
let client = reqwest_client();
debug!("Downloading archive {}", asset.browser_download_url);
let request = client
.get(&asset.browser_download_url)
.headers(Self::headers());
let response = request.send().await?.error_for_status()?;
#[cfg(feature = "indicatif")]
let span = tracing::Span::current();
#[cfg(feature = "indicatif")]
{
let content_length = response.content_length().unwrap_or_default();
span.pb_set_length(content_length);
}
let mut bytes = Vec::new();
let mut source = response.bytes_stream();
while let Some(chunk) = source.next().await {
bytes.write_all(&chunk?)?;
#[cfg(feature = "indicatif")]
span.pb_set_position(bytes.len() as u64);
}
debug!(
"Archive {} downloaded: {}",
asset.browser_download_url,
bytes.len(),
);
if let Some(asset_hash) = asset_hash {
let archive_hash = match asset_hasher_fn {
Some(hasher_fn) => hasher_fn(&bytes)?,
None => return Err(AssetHashNotFound(asset.name))?,
};
let hash_len = archive_hash.len();
debug!(
"Downloading archive hash {}",
asset_hash.browser_download_url
);
let request = client
.get(&asset_hash.browser_download_url)
.headers(Self::headers());
let response = request.send().await?.error_for_status()?;
let text = response.text().await?;
let re = Regex::new(&format!(r"[0-9a-f]{{{hash_len}}}"))?;
let hash = match re.find(&text) {
Some(hash) => hash.as_str().to_string(),
None => return Err(AssetHashNotFound(asset.name)),
};
debug!(
"Archive hash {} downloaded: {}",
asset_hash.browser_download_url,
text.len(),
);
if archive_hash != hash {
return Err(ArchiveHashMismatch { archive_hash, hash });
}
}
let archive = Archive::new(name, version, bytes);
Ok(archive)
}
}
/// Creates a new reqwest client with middleware for tracing, and retrying transient errors.
fn reqwest_client() -> ClientWithMiddleware {
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
ClientBuilder::new(reqwest::Client::new())
.with(TracingMiddleware::default())
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build()
}
#[cfg(test)]
mod tests {
use super::*;
use crate::configuration::theseus::URL;
#[test]
fn test_name() {
let github = GitHub::new(URL).unwrap();
assert_eq!("GitHub", github.name());
}
#[test]
fn test_get_version_from_tag_name() -> Result<()> {
let versions = vec!["16.4.0", "v16.4.0"];
for version in versions {
let version = GitHub::get_version_from_tag_name(version)?;
assert_eq!(Version::new(16, 4, 0), version);
}
Ok(())
}
#[test]
fn test_get_version_from_tag_name_error() {
let error = GitHub::get_version_from_tag_name("foo").unwrap_err();
assert_eq!(
"empty string, expected a semver version".to_string(),
error.to_string()
);
}
//
// get_version tests
//
#[tokio::test]
async fn test_get_version() -> Result<()> {
let github = GitHub::new(URL)?;
let version_req = VersionReq::STAR;
let version = github.get_version(&version_req).await?;
assert!(version > Version::new(0, 0, 0));
Ok(())
}
#[tokio::test]
async fn test_get_specific_version() -> Result<()> {
let github = GitHub::new(URL)?;
let version_req = VersionReq::parse("=16.4.0")?;
let version = github.get_version(&version_req).await?;
assert_eq!(Version::new(16, 4, 0), version);
Ok(())
}
#[tokio::test]
async fn test_get_specific_not_found() -> Result<()> {
let github = GitHub::new(URL)?;
let version_req = VersionReq::parse("=0.0.0")?;
let error = github.get_version(&version_req).await.unwrap_err();
assert_eq!("version not found for '=0.0.0'", error.to_string());
Ok(())
}
//
// get_archive tests
//
#[tokio::test]
async fn test_get_archive() -> Result<()> {
let github = GitHub::new(URL)?;
let version_req = VersionReq::parse("=16.4.0")?;
let archive = github.get_archive(&version_req).await?;
assert_eq!(
format!("postgresql-16.4.0-{}.tar.gz", target_triple::TARGET),
archive.name()
);
assert_eq!(&Version::new(16, 4, 0), archive.version());
assert!(!archive.bytes().is_empty());
Ok(())
}
//
// Plugin Support
//
/// Test that a version with a 'v' prefix is correctly parsed; this is a common convention
/// for GitHub releases. Use a known PostgreSQL plugin repository for the test.
#[tokio::test]
async fn test_get_version_with_v_prefix() -> Result<()> {
let github = GitHub::new("https://github.com/turbot/steampipe-plugin-csv")?;
let version_req = VersionReq::parse("=0.12.0")?;
let version = github.get_version(&version_req).await?;
assert_eq!(Version::new(0, 12, 0), version);
Ok(())
}
}
================================================
FILE: postgresql_archive/src/repository/maven/mod.rs
================================================
pub(crate) mod models;
pub mod repository;
pub const URL: &str = "https://repo1.maven.org/maven2";
================================================
FILE: postgresql_archive/src/repository/maven/models.rs
================================================
/// Maven metadata XML structure
///
/// ```xml
/// <metadata>
/// <groupId>io.zonky.test.postgres</groupId>
/// <artifactId>embedded-postgres-binaries-linux-amd64</artifactId>
/// <versioning>
/// <latest>16.2.0</latest>
/// <release>16.2.0</release>
/// <versions>
/// ...
/// <version>15.6.0</version>
/// <version>16.2.0</version>
/// </versions>
/// <lastUpdated>20240210235512</lastUpdated>
/// </versioning>
/// </metadata>
/// ```
use serde::{Deserialize, Serialize};
/// Represents a Maven artifact metadata
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct Metadata {
#[serde(rename = "groupId")]
pub(crate) group_id: String,
#[serde(rename = "artifactId")]
pub(crate) artifact_id: String,
pub(crate) versioning: Versioning,
}
/// Represents Maven versioning information
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct Versioning {
pub(crate) latest: String,
pub(crate) release: String,
pub(crate) versions: Versions,
#[serde(rename = "lastUpdated")]
pub(crate) last_updated: String,
}
/// Represents Maven versions
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct Versions {
pub(crate) version: Vec<String>,
}
================================================
FILE: postgresql_archive/src/repository/maven/repository.rs
================================================
use crate::Error::{ArchiveHashMismatch, RepositoryFailure, VersionNotFound};
use crate::repository::Archive;
use crate::repository::maven::models::Metadata;
use crate::repository::model::Repository;
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::RetryTransientMiddleware;
use reqwest_retry::policies::ExponentialBackoff;
use reqwest_tracing::TracingMiddleware;
use semver::{Version, VersionReq};
use std::env;
use std::io::Write;
use std::sync::LazyLock;
use tracing::{debug, instrument, warn};
#[cfg(feature = "indicatif")]
use tracing_indicatif::span_ext::IndicatifSpanExt;
static USER_AGENT: LazyLock<String> = LazyLock::new(|| {
format!(
"{PACKAGE}/{VERSION}",
PACKAGE = env!("CARGO_PKG_NAME"),
VERSION = env!("CARGO_PKG_VERSION")
)
});
/// Maven repository.
///
/// This repository is used to interact with Maven repositories
/// (e.g. <https://repo1.maven.org/maven2>).
#[derive(Debug)]
pub struct Maven {
url: String,
}
impl Maven {
/// Creates a new Maven repository from the specified URL in the format
/// <https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64>
///
/// # Errors
/// * If the URL is invalid.
#[expect(clippy::new_ret_no_self)]
pub fn new(url: &str) -> Result<Box<dyn Repository>> {
Ok(Box::new(Self {
url: url.to_string(),
}))
}
/// Gets the artifact id and version that matches the specified version requirement.
///
/// # Errors
/// * If the version requirement does not match any versions.
#[instrument(level = "debug")]
async fn get_artifact(&self, version_req: &VersionReq) -> Result<(String, Version)> {
debug!("Attempting to locate release for version requirement {version_req}");
let client = reqwest_client();
let url = format!("{}/maven-metadata.xml", self.url);
let request = client.get(&url).headers(Self::headers());
let response = request.send().await?.error_for_status()?;
let text = response.text().await?;
let metadata: Metadata = quick_xml::de::from_str(&text)?;
let artifact = metadata.artifact_id;
let mut result = None;
for version in &metadata.versioning.versions.version {
let version = Version::parse(version)?;
if version_req.matches(&version) {
if let Some(result_version) = result.clone() {
if version > result_version {
result = Some(version);
}
} else {
result = Some(version);
}
}
}
match &result {
Some(version) => {
debug!("Version {version} found for version requirement {version_req}");
Ok((artifact, version.clone()))
}
None => Err(VersionNotFound(version_req.to_string())),
}
}
/// Returns the headers for the Maven request.
fn headers() -> HeaderMap {
let mut headers = HeaderMap::new();
headers.append("User-Agent", USER_AGENT.parse().unwrap());
headers
}
}
#[async_trait]
impl Repository for Maven {
#[instrument(level = "debug")]
fn name(&self) -> &str {
"Maven"
}
#[instrument(level = "debug")]
async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
debug!("Attempting to locate release for version requirement {version_req}");
let (_, version) = self.get_artifact(version_req).await?;
Ok(version)
}
#[instrument]
async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
let (artifact, version) = self.get_artifact(version_req).await?;
let archive_name = format!("{artifact}-{version}.jar");
let archive_url = format!("{url}/{version}/{artifact}-{version}.jar", url = self.url,);
let mut hasher_result = None;
// Try to find a hasher for the archive; the extensions are ordered by preference.
for extension in &["sha512", "sha256", "sha1", "md5"] {
if let Ok(hasher_fn) = hasher::registry::get(&self.url, &(*extension).to_string()) {
hasher_result = Some((extension, hasher_fn));
}
}
let Some((extension, hasher_fn)) = hasher_result else {
return Err(RepositoryFailure(format!(
"no hashers found for {}",
&self.url
)));
};
let archive_hash_url = format!("{archive_url}.{extension}");
let client = reqwest_client();
debug!("Downloading archive hash {archive_hash_url}");
let request = client.get(&archive_hash_url).headers(Self::headers());
let response = request.send().await?.error_for_status()?;
let hash = response.text().await?;
debug!("Archive hash {archive_hash_url} downloaded: {}", hash.len(),);
debug!("Downloading archive {archive_url}");
let request = client.get(&archive_url).headers(Self::headers());
let response = request.send().await?.error_for_status()?;
#[cfg(feature = "indicatif")]
let span = tracing::Span::current();
#[cfg(feature = "indicatif")]
{
let content_length = response.content_length().unwrap_or_default();
span.pb_set_length(content_length);
}
let mut bytes = Vec::new();
let mut source = response.bytes_stream();
while let Some(chunk) = source.next().await {
bytes.write_all(&chunk?)?;
#[cfg(feature = "indicatif")]
span.pb_set_position(bytes.len() as u64);
}
debug!("Archive {archive_url} downloaded: {}", bytes.len(),);
let archive_hash = hasher_fn(&bytes)?;
if archive_hash != hash {
return Err(ArchiveHashMismatch { archive_hash, hash });
}
let archive = Archive::new(archive_name, version, bytes);
Ok(archive)
}
}
/// Creates a new reqwest client with middleware for tracing, and retrying transient errors.
fn reqwest_client() -> ClientWithMiddleware {
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
ClientBuilder::new(reqwest::Client::new())
.with(TracingMiddleware::default())
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build()
}
#[cfg(test)]
mod tests {
use super::*;
const URL: &str = "https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64";
#[test]
fn test_name() {
let maven = Maven::new(URL).unwrap();
assert_eq!("Maven", maven.name());
}
//
// get_version tests
//
#[tokio::test]
async fn test_get_version() -> Result<()> {
let maven = Maven::new(URL)?;
let version_req = VersionReq::STAR;
let version = maven.get_version(&version_req).await?;
assert!(version > Version::new(0, 0, 0));
Ok(())
}
#[tokio::test]
async fn test_get_specific_version() -> Result<()> {
let maven = Maven::new(URL)?;
let version_req = VersionReq::parse("=16.2.0")?;
let version = maven.get_version(&version_req).await?;
assert_eq!(Version::new(16, 2, 0), version);
Ok(())
}
#[tokio::test]
async fn test_get_specific_not_found() -> Result<()> {
let maven = Maven::new(URL)?;
let version_req = VersionReq::parse("=0.0.0")?;
let error = maven.get_version(&version_req).await.unwrap_err();
assert_eq!("version not found for '=0.0.0'", error.to_string());
Ok(())
}
//
// get_archive tests
//
#[tokio::test]
async fn test_get_archive() -> Result<()> {
let maven = Maven::new(URL)?;
let version = Version::new(16, 2, 0);
let version_req = VersionReq::parse(format!("={version}").as_str())?;
let archive = maven.get_archive(&version_req).await?;
assert_eq!(
format!("embedded-postgres-binaries-linux-amd64-{version}.jar"),
archive.name()
);
assert_eq!(&version, archive.version());
assert!(!archive.bytes().is_empty());
Ok(())
}
}
================================================
FILE: postgresql_archive/src/repository/mod.rs
================================================
#[cfg(feature = "github")]
pub mod github;
#[cfg(feature = "maven")]
pub mod maven;
pub mod model;
pub mod registry;
pub use model::{Archive, Repository};
================================================
FILE: postgresql_archive/src/repository/model.rs
================================================
use async_trait::async_trait;
use semver::{Version, VersionReq};
use std::fmt::Debug;
/// A trait for archive repository implementations.
#[async_trait]
pub trait Repository: Debug + Send + Sync {
/// Gets the name of the repository.
fn name(&self) -> &str;
/// Gets the version for the specified [version requirement](VersionReq). If a
/// [version](Version) for the [version requirement](VersionReq) is not found,
/// then an error is returned.
///
/// # Errors
/// * If the version is not found.
async fn get_version(&self, version_req: &VersionReq) -> crate::Result<Version>;
/// Gets the archive for a given [version requirement](VersionReq) that passes the default
/// matcher. If no archive is found for the [version requirement](VersionReq) and matcher then
/// an [error](crate::error::Error) is returned.
///
/// # Errors
/// * If the archive is not found.
/// * If the archive cannot be downloaded.
async fn get_archive(&self, version_req: &VersionReq) -> crate::Result<Archive>;
}
/// A struct representing an archive.
#[derive(Clone, Debug)]
pub struct Archive {
name: String,
version: Version,
bytes: Vec<u8>,
}
impl Archive {
/// Creates a new archive.
#[must_use]
pub fn new(name: String, version: Version, bytes: Vec<u8>) -> Self {
Self {
name,
version,
bytes,
}
}
/// Gets the name of the archive.
#[must_use]
pub fn name(&self) -> &str {
&self.name
}
/// Gets the version of the archive.
#[must_use]
pub fn version(&self) -> &Version {
&self.version
}
/// Gets the bytes of the archive.
#[must_use]
pub fn bytes(&self) -> &[u8] {
&self.bytes
}
}
#[cfg(test)]
mod tests {
use super::*;
use semver::Version;
#[test]
fn test_archive() {
let name = "test".to_string();
let version = Version::parse("1.0.0").unwrap();
let bytes = vec![0, 1, 2, 3];
let archive = Archive::new(name.clone(), version.clone(), bytes.clone());
assert_eq!(archive.name(), name);
assert_eq!(archive.version(), &version);
assert_eq!(archive.bytes(), bytes.as_slice());
}
}
================================================
FILE: postgresql_archive/src/repository/registry.rs
================================================
use crate::Error::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 std::sync::{Arc, LazyLock, Mutex, RwLock};
static REGISTRY: LazyLock<Arc<Mutex<RepositoryRegistry>>> =
LazyLock::new(|| Arc::new(Mutex::new(RepositoryRegistry::default())));
type SupportsFn = fn(&str) -> Result<bool>;
type NewFn = dyn Fn(&str) -> Result<Box<dyn Repository>> + Send + Sync;
/// Singleton struct to store repositories
#[expect(clippy::type_complexity)]
struct RepositoryRegistry {
repositories: Vec<(Arc<RwLock<SupportsFn>>, Arc<RwLock<NewFn>>)>,
}
impl RepositoryRegistry {
/// Creates a new repository registry.
fn new() -> Self {
Self {
repositories: Vec::new(),
}
}
/// Registers a repository. Newly registered repositories take precedence over existing ones.
fn register(&mut self, supports_fn: SupportsFn, new_fn: Box<NewFn>) {
self.repositories.insert(
0,
(
Arc::new(RwLock::new(supports_fn)),
Arc::new(RwLock::new(new_fn)),
),
);
gitextract_ipdr6byb/ ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── config.yml │ │ └── feature_request.md │ ├── codecov.yml │ ├── dependabot.yml │ └── workflows/ │ ├── benchmarks.yml │ ├── checks.yml │ ├── ci.yml │ ├── pr-benchmarks.yml │ └── release-plz.yml ├── .gitignore ├── .rustfmt.toml ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── SECURITY.md ├── clippy.toml ├── deny.toml ├── examples/ │ ├── archive_async/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── archive_sync/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── axum_embedded/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── diesel_embedded/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── diesel.toml │ │ ├── migrations/ │ │ │ ├── .keep │ │ │ └── 2024-08-17-200823_create_posts/ │ │ │ ├── down.sql │ │ │ └── up.sql │ │ └── src/ │ │ ├── main.rs │ │ ├── models.rs │ │ └── schema.rs │ ├── download_progress_bar/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── embedded_async/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── embedded_sync/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── portal_corp_extension/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── postgres_embedded/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ └── main.rs │ ├── sqlx_embedded/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ └── main.rs │ ├── tensor_chord_extension/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── unix_socket/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ └── zonky/ │ ├── Cargo.toml │ └── src/ │ └── main.rs ├── postgresql_archive/ │ ├── Cargo.toml │ ├── README.md │ ├── benches/ │ │ └── archive.rs │ ├── src/ │ │ ├── archive.rs │ │ ├── blocking/ │ │ │ ├── archive.rs │ │ │ └── mod.rs │ │ ├── configuration/ │ │ │ ├── custom/ │ │ │ │ ├── matcher.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── theseus/ │ │ │ │ ├── extractor.rs │ │ │ │ ├── matcher.rs │ │ │ │ └── mod.rs │ │ │ └── zonky/ │ │ │ ├── extractor.rs │ │ │ ├── matcher.rs │ │ │ ├── mod.rs │ │ │ └── repository.rs │ │ ├── error.rs │ │ ├── extractor/ │ │ │ ├── mod.rs │ │ │ ├── model.rs │ │ │ ├── registry.rs │ │ │ ├── tar_gz_extractor.rs │ │ │ ├── tar_xz_extractor.rs │ │ │ └── zip_extractor.rs │ │ ├── hasher/ │ │ │ ├── md5.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ ├── sha1.rs │ │ │ ├── sha2_256.rs │ │ │ └── sha2_512.rs │ │ ├── lib.rs │ │ ├── matcher/ │ │ │ ├── mod.rs │ │ │ └── registry.rs │ │ ├── repository/ │ │ │ ├── github/ │ │ │ │ ├── mod.rs │ │ │ │ ├── models.rs │ │ │ │ └── repository.rs │ │ │ ├── maven/ │ │ │ │ ├── mod.rs │ │ │ │ ├── models.rs │ │ │ │ └── repository.rs │ │ │ ├── mod.rs │ │ │ ├── model.rs │ │ │ └── registry.rs │ │ └── version.rs │ └── tests/ │ ├── archive.rs │ ├── blocking.rs │ └── zonky.rs ├── postgresql_commands/ │ ├── Cargo.toml │ ├── README.md │ └── src/ │ ├── clusterdb.rs │ ├── createdb.rs │ ├── createuser.rs │ ├── dropdb.rs │ ├── dropuser.rs │ ├── ecpg.rs │ ├── error.rs │ ├── initdb.rs │ ├── lib.rs │ ├── oid2name.rs │ ├── pg_amcheck.rs │ ├── pg_archivecleanup.rs │ ├── pg_basebackup.rs │ ├── pg_checksums.rs │ ├── pg_config.rs │ ├── pg_controldata.rs │ ├── pg_ctl.rs │ ├── pg_dump.rs │ ├── pg_dumpall.rs │ ├── pg_isready.rs │ ├── pg_receivewal.rs │ ├── pg_recvlogical.rs │ ├── pg_resetwal.rs │ ├── pg_restore.rs │ ├── pg_rewind.rs │ ├── pg_test_fsync.rs │ ├── pg_test_timing.rs │ ├── pg_upgrade.rs │ ├── pg_verifybackup.rs │ ├── pg_waldump.rs │ ├── pgbench.rs │ ├── postgres.rs │ ├── psql.rs │ ├── reindexdb.rs │ ├── traits.rs │ ├── vacuumdb.rs │ └── vacuumlo.rs ├── postgresql_embedded/ │ ├── Cargo.toml │ ├── README.md │ ├── benches/ │ │ └── embedded.rs │ ├── build/ │ │ ├── build.rs │ │ └── bundle.rs │ ├── src/ │ │ ├── blocking/ │ │ │ ├── mod.rs │ │ │ └── postgresql.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── postgresql.rs │ │ └── settings.rs │ └── tests/ │ ├── blocking.rs │ ├── dump_command.rs │ ├── environment_variables.rs │ ├── postgresql.rs │ ├── start_config.rs │ ├── unix_socket.rs │ └── zonky.rs ├── postgresql_extensions/ │ ├── Cargo.toml │ ├── README.md │ ├── src/ │ │ ├── blocking/ │ │ │ ├── extensions.rs │ │ │ └── mod.rs │ │ ├── error.rs │ │ ├── extensions.rs │ │ ├── lib.rs │ │ ├── matcher.rs │ │ ├── model.rs │ │ └── repository/ │ │ ├── mod.rs │ │ ├── model.rs │ │ ├── portal_corp/ │ │ │ ├── mod.rs │ │ │ └── repository.rs │ │ ├── registry.rs │ │ ├── steampipe/ │ │ │ ├── extensions.rs │ │ │ ├── mod.rs │ │ │ └── repository.rs │ │ └── tensor_chord/ │ │ ├── mod.rs │ │ └── repository.rs │ └── tests/ │ ├── blocking.rs │ ├── extensions.rs │ ├── portal_corp.rs │ └── steampipe.rs ├── release-plz.toml └── rust-toolchain.toml
SYMBOL INDEX (1769 symbols across 118 files)
FILE: examples/archive_async/src/main.rs
function main (line 9) | async fn main() -> Result<()> {
function test_archive_async_main (line 28) | fn test_archive_async_main() -> Result<()> {
FILE: examples/archive_sync/src/main.rs
function main (line 5) | fn main() -> Result<()> {
function test_archive_sync_main (line 24) | fn test_archive_sync_main() -> Result<()> {
FILE: examples/axum_embedded/src/main.rs
function main (line 14) | async fn main() -> Result<()> {
function enable_extension (line 70) | async fn enable_extension(pool: &PgPool) -> Result<()> {
function extensions (line 77) | async fn extensions(State(pool): State<PgPool>) -> Result<Json<Vec<Strin...
function internal_error (line 85) | fn internal_error<E: std::error::Error>(err: E) -> (StatusCode, String) {
FILE: examples/diesel_embedded/migrations/2024-08-17-200823_create_posts/up.sql
type posts (line 1) | CREATE TABLE posts
FILE: examples/diesel_embedded/src/main.rs
constant MIGRATIONS (line 10) | const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations/");
function main (line 12) | async fn main() -> Result<()> {
function create_post (line 54) | pub fn create_post(conn: &mut PgConnection, title: &str, body: &str) -> ...
function test_diesel_embedded_main (line 71) | fn test_diesel_embedded_main() -> Result<()> {
FILE: examples/diesel_embedded/src/models.rs
type Post (line 6) | pub struct Post {
type NewPost (line 15) | pub struct NewPost<'a> {
FILE: examples/download_progress_bar/src/main.rs
function main (line 11) | async fn main() -> Result<()> {
function test_download_progress_bar_main (line 42) | fn test_download_progress_bar_main() -> Result<()> {
FILE: examples/embedded_async/src/main.rs
function main (line 4) | async fn main() -> Result<()> {
function test_embedded_async_main (line 26) | fn test_embedded_async_main() -> Result<()> {
FILE: examples/embedded_sync/src/main.rs
function main (line 4) | fn main() -> Result<()> {
function test_embedded_sync_main (line 22) | fn test_embedded_sync_main() -> Result<()> {
FILE: examples/portal_corp_extension/src/main.rs
function main (line 13) | async fn main() -> Result<()> {
function enable_extension (line 81) | async fn enable_extension(pool: &PgPool) -> Result<()> {
function create_table (line 91) | async fn create_table(pool: &PgPool) -> Result<()> {
function create_data (line 103) | async fn create_data(pool: &PgPool) -> Result<()> {
function execute_query (line 115) | async fn execute_query(pool: &PgPool, query: &str) -> Result<()> {
function test_portal_corp_extension_main (line 133) | fn test_portal_corp_extension_main() -> Result<()> {
FILE: examples/postgres_embedded/src/main.rs
function main (line 5) | fn main() -> Result<()> {
function create_table_todo (line 44) | fn create_table_todo(client: &mut Client) -> Result<()> {
function add_todo (line 53) | fn add_todo(client: &mut Client, description: &str) -> Result<i64> {
function complete_todo (line 63) | fn complete_todo(client: &mut Client, id: i64) -> Result<bool> {
function list_todos (line 69) | fn list_todos(client: &mut Client) -> Result<()> {
function test_postgres_embedded_main (line 92) | fn test_postgres_embedded_main() -> Result<()> {
FILE: examples/sqlx_embedded/src/main.rs
function main (line 7) | async fn main() -> Result<()> {
function create_table_todo (line 38) | async fn create_table_todo(pool: &PgPool) -> Result<()> {
function add_todo (line 46) | async fn add_todo(pool: &PgPool, description: &str) -> Result<i64> {
function complete_todo (line 56) | async fn complete_todo(pool: &PgPool, id: i64) -> Result<bool> {
function list_todos (line 66) | async fn list_todos(pool: &PgPool) -> Result<()> {
function test_sqlx_embedded_main (line 91) | fn test_sqlx_embedded_main() -> Result<()> {
FILE: examples/tensor_chord_extension/src/main.rs
function main (line 12) | async fn main() -> Result<()> {
function configure_extension (line 86) | async fn configure_extension(pool: &PgPool) -> Result<()> {
function enable_extension (line 96) | async fn enable_extension(pool: &PgPool) -> Result<()> {
function create_table (line 106) | async fn create_table(pool: &PgPool) -> Result<()> {
function create_data (line 118) | async fn create_data(pool: &PgPool) -> Result<()> {
function execute_query (line 139) | async fn execute_query(pool: &PgPool, query: &str) -> Result<()> {
FILE: examples/unix_socket/src/main.rs
function main (line 5) | async fn main() -> Result<()> {
function main (line 37) | fn main() {
function test_unix_socket_main (line 47) | fn test_unix_socket_main() -> Result<()> {
FILE: examples/zonky/src/main.rs
function main (line 6) | async fn main() -> Result<()> {
function test_zonky_main (line 31) | fn test_zonky_main() -> Result<()> {
FILE: postgresql_archive/benches/archive.rs
function benchmarks (line 8) | fn benchmarks(criterion: &mut Criterion) {
function bench_extract (line 12) | fn bench_extract(criterion: &mut Criterion) -> Result<()> {
function extract_archive (line 25) | fn extract_archive(archive: &Vec<u8>) -> Result<()> {
FILE: postgresql_archive/src/archive.rs
function get_version (line 17) | pub async fn get_version(url: &str, version_req: &VersionReq) -> Result<...
function get_archive (line 31) | pub async fn get_archive(url: &str, version_req: &VersionReq) -> Result<...
function extract (line 44) | pub async fn extract(url: &str, bytes: &Vec<u8>, out_dir: &Path) -> Resu...
function test_get_version (line 57) | async fn test_get_version() -> Result<()> {
function test_get_archive (line 65) | async fn test_get_archive() -> Result<()> {
FILE: postgresql_archive/src/blocking/archive.rs
function get_version (line 13) | pub fn get_version(url: &str, version_req: &VersionReq) -> crate::Result...
function get_archive (line 28) | pub fn get_archive(url: &str, version_req: &VersionReq) -> crate::Result...
function extract (line 38) | pub fn extract(url: &str, bytes: &Vec<u8>, out_dir: &Path) -> crate::Res...
FILE: postgresql_archive/src/configuration/custom/matcher.rs
function matcher (line 8) | pub fn matcher(_url: &str, name: &str, version: &Version) -> crate::Resu...
constant TEST_URL (line 21) | const TEST_URL: &str = "https://github.com/owner/repo";
function test_register_custom_repo (line 24) | fn test_register_custom_repo() -> Result<()> {
FILE: postgresql_archive/src/configuration/theseus/extractor.rs
function extract (line 16) | pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories...
function acquire_lock (line 76) | fn acquire_lock(out_dir: &Path) -> Result<PathBuf> {
FILE: postgresql_archive/src/configuration/theseus/matcher.rs
function matcher (line 7) | pub fn matcher(_url: &str, name: &str, version: &Version) -> crate::Resu...
function test_asset_match_success (line 19) | fn test_asset_match_success() -> Result<()> {
function test_asset_match_errors (line 30) | fn test_asset_match_errors() -> Result<()> {
FILE: postgresql_archive/src/configuration/theseus/mod.rs
constant URL (line 4) | pub const URL: &str = "https://github.com/theseus-rs/postgresql-binaries";
FILE: postgresql_archive/src/configuration/zonky/extractor.rs
function extract (line 19) | pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories...
function acquire_lock (line 96) | fn acquire_lock(out_dir: &Path) -> crate::Result<PathBuf> {
FILE: postgresql_archive/src/configuration/zonky/matcher.rs
function matcher (line 9) | pub fn matcher(_url: &str, name: &str, version: &Version) -> Result<bool> {
function get_os (line 17) | pub(crate) fn get_os() -> &'static str {
function get_arch (line 25) | pub(crate) fn get_arch() -> &'static str {
function test_asset_match_success (line 42) | fn test_asset_match_success() -> Result<()> {
function test_asset_match_errors (line 54) | fn test_asset_match_errors() -> Result<()> {
FILE: postgresql_archive/src/configuration/zonky/mod.rs
constant URL (line 5) | pub const URL: &str = "https://github.com/zonkyio/embedded-postgres-bina...
FILE: postgresql_archive/src/configuration/zonky/repository.rs
type Zonky (line 15) | pub struct Zonky {
method new (line 28) | pub fn new(_url: &str) -> Result<Box<dyn Repository>> {
constant MAVEN_URL (line 19) | const MAVEN_URL: &str = "https://repo1.maven.org/maven2/io/zonky/test/po...
method name (line 41) | fn name(&self) -> &str {
method get_version (line 46) | async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
method get_archive (line 51) | async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
function test_name (line 62) | fn test_name() {
function test_get_version (line 72) | async fn test_get_version() -> Result<()> {
function test_get_specific_version (line 81) | async fn test_get_specific_version() -> Result<()> {
function test_get_specific_not_found (line 90) | async fn test_get_specific_not_found() -> Result<()> {
function test_get_archive (line 103) | async fn test_get_archive() -> Result<()> {
FILE: postgresql_archive/src/error.rs
type Result (line 4) | pub type Result<T, E = Error> = core::result::Result<T, E>;
type Error (line 8) | pub enum Error {
method from (line 55) | fn from(error: regex_lite::Error) -> Self {
method from (line 62) | fn from(error: reqwest::Error) -> Self {
method from (line 69) | fn from(error: reqwest_middleware::Error) -> Self {
method from (line 76) | fn from(error: std::io::Error) -> Self {
method from (line 83) | fn from(error: std::time::SystemTimeError) -> Self {
method from (line 90) | fn from(error: std::num::ParseIntError) -> Self {
method from (line 97) | fn from(error: semver::Error) -> Self {
method from (line 104) | fn from(error: std::path::StripPrefixError) -> Self {
method from (line 111) | fn from(error: url::ParseError) -> Self {
method from (line 119) | fn from(error: quick_xml::DeError) -> Self {
method from (line 127) | fn from(error: zip::result::ZipError) -> Self {
method from (line 134) | fn from(value: PoisonError<T>) -> Self {
function test_from_regex_error (line 152) | fn test_from_regex_error() {
function test_from_reqwest_error (line 159) | async fn test_from_reqwest_error() {
function test_from_reqwest_middeleware_error (line 169) | async fn test_from_reqwest_middeleware_error() {
function test_from_io_error (line 177) | fn test_from_io_error() {
function test_from_parse_int_error (line 184) | fn test_from_parse_int_error() {
function test_from_semver_error (line 191) | fn test_from_semver_error() {
function test_from_strip_prefix_error (line 201) | fn test_from_strip_prefix_error() {
function test_from_system_time_error (line 209) | fn test_from_system_time_error() {
function test_from_url_parse_error (line 222) | fn test_from_url_parse_error() {
function test_from_quick_xml_error (line 230) | fn test_from_quick_xml_error() {
function test_from_zip_error (line 239) | fn test_from_zip_error() {
function test_from_poisoned_lock (line 251) | fn test_from_poisoned_lock() {
FILE: postgresql_archive/src/extractor/model.rs
type ExtractDirectories (line 9) | pub struct ExtractDirectories {
method new (line 16) | pub fn new(mappings: Vec<(Regex, PathBuf)>) -> Self {
method add_mapping (line 21) | pub fn add_mapping(&mut self, regex: Regex, path: PathBuf) {
method get_path (line 30) | pub fn get_path(&self, file_path: &str) -> Result<PathBuf> {
method default (line 45) | fn default() -> Self {
method fmt (line 53) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
function test_new (line 66) | fn test_new() -> Result<()> {
function test_default (line 75) | fn test_default() {
function test_add_mapping (line 82) | fn test_add_mapping() -> Result<()> {
function test_get_path (line 91) | fn test_get_path() -> Result<()> {
function test_display (line 103) | fn test_display() -> Result<()> {
FILE: postgresql_archive/src/extractor/registry.rs
type SupportsFn (line 14) | type SupportsFn = fn(&str) -> Result<bool>;
type ExtractFn (line 15) | type ExtractFn = fn(&Vec<u8>, &ExtractDirectories) -> Result<Vec<PathBuf>>;
type RepositoryRegistry (line 19) | struct RepositoryRegistry {
method new (line 25) | fn new() -> Self {
method register (line 32) | fn register(&mut self, supports_fn: SupportsFn, extract_fn: ExtractFn) {
method get (line 46) | fn get(&self, url: &str) -> Result<ExtractFn> {
method default (line 62) | fn default() -> Self {
function register (line 76) | pub fn register(supports_fn: SupportsFn, extractor_fn: ExtractFn) -> Res...
function get (line 85) | pub fn get(url: &str) -> Result<ExtractFn> {
function test_register (line 95) | fn test_register() -> Result<()> {
function test_get_error (line 106) | fn test_get_error() {
function test_get_theseus_postgresql_binaries (line 113) | fn test_get_theseus_postgresql_binaries() {
FILE: postgresql_archive/src/extractor/tar_gz_extractor.rs
function extract (line 16) | pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories...
FILE: postgresql_archive/src/extractor/tar_xz_extractor.rs
function extract (line 16) | pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories...
FILE: postgresql_archive/src/extractor/zip_extractor.rs
function extract (line 15) | pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories...
FILE: postgresql_archive/src/hasher/md5.rs
function hash (line 8) | pub fn hash(data: &Vec<u8>) -> Result<String> {
function test_hash (line 20) | fn test_hash() -> Result<()> {
FILE: postgresql_archive/src/hasher/registry.rs
type SupportsFn (line 20) | pub type SupportsFn = fn(&str, &str) -> Result<bool>;
type HasherFn (line 21) | pub type HasherFn = fn(&Vec<u8>) -> Result<String>;
type HasherRegistry (line 25) | struct HasherRegistry {
method new (line 31) | fn new() -> Self {
method register (line 39) | fn register(&mut self, supports_fn: SupportsFn, hasher_fn: HasherFn) {
method get (line 53) | fn get<S: AsRef<str>>(&self, url: S, extension: S) -> Result<HasherFn> {
method default (line 70) | fn default() -> Self {
function register (line 107) | pub fn register(supports_fn: SupportsFn, hasher_fn: HasherFn) -> Result<...
function get (line 116) | pub fn get<S: AsRef<str>>(url: S, extension: S) -> Result<HasherFn> {
function test_hasher (line 124) | fn test_hasher(extension: &str, expected: &str) -> Result<()> {
function test_register (line 133) | fn test_register() -> Result<()> {
function test_get_invalid_url_error (line 142) | fn test_get_invalid_url_error() {
function test_get_invalid_extension_error (line 152) | fn test_get_invalid_extension_error() {
function test_get_theseus_postgresql_binaries (line 162) | fn test_get_theseus_postgresql_binaries() {
function test_get_zonky_postgresql_binaries (line 168) | fn test_get_zonky_postgresql_binaries() {
FILE: postgresql_archive/src/hasher/sha1.rs
function hash (line 8) | pub fn hash(data: &Vec<u8>) -> Result<String> {
function test_hash (line 20) | fn test_hash() -> Result<()> {
FILE: postgresql_archive/src/hasher/sha2_256.rs
function hash (line 8) | pub fn hash(data: &Vec<u8>) -> Result<String> {
function test_hash (line 20) | fn test_hash() -> Result<()> {
FILE: postgresql_archive/src/hasher/sha2_512.rs
function hash (line 8) | pub fn hash(data: &Vec<u8>) -> Result<String> {
function test_hash (line 20) | fn test_hash() -> Result<()> {
FILE: postgresql_archive/src/matcher/registry.rs
type SupportsFn (line 13) | pub type SupportsFn = fn(&str) -> Result<bool>;
type MatcherFn (line 14) | pub type MatcherFn = fn(&str, &str, &Version) -> Result<bool>;
type MatchersRegistry (line 18) | struct MatchersRegistry {
method new (line 24) | fn new() -> Self {
method register (line 32) | fn register(&mut self, supports_fn: SupportsFn, matcher_fn: MatcherFn) {
method get (line 46) | fn get<S: AsRef<str>>(&self, url: S) -> Result<MatcherFn> {
method default (line 62) | fn default() -> Self {
function register (line 77) | pub fn register(supports_fn: SupportsFn, matcher_fn: MatcherFn) -> Resul...
function get (line 86) | pub fn get<S: AsRef<str>>(url: S) -> Result<MatcherFn> {
function test_register (line 95) | fn test_register() -> Result<()> {
function test_get_error (line 109) | fn test_get_error() {
function test_get_theseus_postgresql_binaries (line 116) | fn test_get_theseus_postgresql_binaries() {
function test_get_zonyk_postgresql_binaries (line 122) | fn test_get_zonyk_postgresql_binaries() {
FILE: postgresql_archive/src/repository/github/models.rs
type Release (line 6) | pub(crate) struct Release {
type Asset (line 21) | pub(crate) struct Asset {
FILE: postgresql_archive/src/repository/github/repository.rs
constant GITHUB_API_VERSION_HEADER (line 28) | const GITHUB_API_VERSION_HEADER: &str = "X-GitHub-Api-Version";
constant GITHUB_API_VERSION (line 29) | const GITHUB_API_VERSION: &str = "2022-11-28";
type GitHub (line 53) | pub struct GitHub {
method new (line 65) | pub fn new(url: &str) -> Result<Box<dyn Repository>> {
method get_version_from_tag_name (line 89) | fn get_version_from_tag_name(tag_name: &str) -> Result<Version> {
method get_release (line 107) | async fn get_release(&self, version_req: &VersionReq) -> Result<Releas...
method get_asset (line 163) | fn get_asset(
method headers (line 204) | fn headers() -> HeaderMap {
method name (line 221) | fn name(&self) -> &str {
method get_version (line 226) | async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
method get_archive (line 233) | async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
function reqwest_client (line 303) | fn reqwest_client() -> ClientWithMiddleware {
function test_name (line 317) | fn test_name() {
function test_get_version_from_tag_name (line 323) | fn test_get_version_from_tag_name() -> Result<()> {
function test_get_version_from_tag_name_error (line 334) | fn test_get_version_from_tag_name_error() {
function test_get_version (line 347) | async fn test_get_version() -> Result<()> {
function test_get_specific_version (line 356) | async fn test_get_specific_version() -> Result<()> {
function test_get_specific_not_found (line 365) | async fn test_get_specific_not_found() -> Result<()> {
function test_get_archive (line 378) | async fn test_get_archive() -> Result<()> {
function test_get_version_with_v_prefix (line 398) | async fn test_get_version_with_v_prefix() -> Result<()> {
FILE: postgresql_archive/src/repository/maven/mod.rs
constant URL (line 4) | pub const URL: &str = "https://repo1.maven.org/maven2";
FILE: postgresql_archive/src/repository/maven/models.rs
type Metadata (line 23) | pub(crate) struct Metadata {
type Versioning (line 33) | pub(crate) struct Versioning {
type Versions (line 43) | pub(crate) struct Versions {
FILE: postgresql_archive/src/repository/maven/repository.rs
type Maven (line 34) | pub struct Maven {
method new (line 45) | pub fn new(url: &str) -> Result<Box<dyn Repository>> {
method get_artifact (line 56) | async fn get_artifact(&self, version_req: &VersionReq) -> Result<(Stri...
method headers (line 89) | fn headers() -> HeaderMap {
method name (line 99) | fn name(&self) -> &str {
method get_version (line 104) | async fn get_version(&self, version_req: &VersionReq) -> Result<Version> {
method get_archive (line 111) | async fn get_archive(&self, version_req: &VersionReq) -> Result<Archive> {
function reqwest_client (line 168) | fn reqwest_client() -> ClientWithMiddleware {
constant URL (line 180) | const URL: &str = "https://repo1.maven.org/maven2/io/zonky/test/postgres...
function test_name (line 183) | fn test_name() {
function test_get_version (line 193) | async fn test_get_version() -> Result<()> {
function test_get_specific_version (line 202) | async fn test_get_specific_version() -> Result<()> {
function test_get_specific_not_found (line 211) | async fn test_get_specific_not_found() -> Result<()> {
function test_get_archive (line 224) | async fn test_get_archive() -> Result<()> {
FILE: postgresql_archive/src/repository/model.rs
type Repository (line 7) | pub trait Repository: Debug + Send + Sync {
method name (line 9) | fn name(&self) -> &str;
method get_version (line 17) | async fn get_version(&self, version_req: &VersionReq) -> crate::Result...
method get_archive (line 26) | async fn get_archive(&self, version_req: &VersionReq) -> crate::Result...
type Archive (line 31) | pub struct Archive {
method new (line 40) | pub fn new(name: String, version: Version, bytes: Vec<u8>) -> Self {
method name (line 50) | pub fn name(&self) -> &str {
method version (line 56) | pub fn version(&self) -> &Version {
method bytes (line 62) | pub fn bytes(&self) -> &[u8] {
function test_archive (line 73) | fn test_archive() {
FILE: postgresql_archive/src/repository/registry.rs
type SupportsFn (line 15) | type SupportsFn = fn(&str) -> Result<bool>;
type NewFn (line 16) | type NewFn = dyn Fn(&str) -> Result<Box<dyn Repository>> + Send + Sync;
type RepositoryRegistry (line 20) | struct RepositoryRegistry {
method new (line 26) | fn new() -> Self {
method register (line 33) | fn register(&mut self, supports_fn: SupportsFn, new_fn: Box<NewFn>) {
method get (line 47) | fn get(&self, url: &str) -> Result<Box<dyn Repository>> {
method default (line 62) | fn default() -> Self {
function register (line 82) | pub fn register(supports_fn: SupportsFn, new_fn: Box<NewFn>) -> Result<(...
function get (line 91) | pub fn get(url: &str) -> Result<Box<dyn Repository>> {
type TestRepository (line 104) | struct TestRepository;
method new (line 109) | fn new(_url: &str) -> Result<Box<dyn Repository>> {
method name (line 116) | fn name(&self) -> &'static str {
method get_version (line 120) | async fn get_version(&self, _version_req: &VersionReq) -> Result<Version> {
method get_archive (line 124) | async fn get_archive(&self, _version_req: &VersionReq) -> Result<Archive> {
function test_register (line 134) | async fn test_register() -> Result<()> {
function test_get_error (line 148) | fn test_get_error() {
function test_get_theseus_postgresql_binaries (line 155) | fn test_get_theseus_postgresql_binaries() {
function test_get_zonky_postgresql_binaries (line 161) | fn test_get_zonky_postgresql_binaries() {
FILE: postgresql_archive/src/version.rs
type ExactVersion (line 5) | pub trait ExactVersion {
method exact_version (line 7) | fn exact_version(&self) -> Option<Version>;
method exact_version (line 12) | fn exact_version(&self) -> Option<Version> {
type ExactVersionReq (line 28) | pub trait ExactVersionReq {
method exact_version_req (line 33) | fn exact_version_req(&self) -> Result<VersionReq>;
method exact_version_req (line 41) | fn exact_version_req(&self) -> Result<VersionReq> {
function test_exact_version_star (line 54) | fn test_exact_version_star() {
function test_exact_version_greater_than (line 60) | fn test_exact_version_greater_than() -> Result<()> {
function test_exact_version_full_no_equals (line 67) | fn test_exact_version_full_no_equals() -> Result<()> {
function test_exact_version_full_equals (line 74) | fn test_exact_version_full_equals() -> Result<()> {
function test_exact_version_major_minor (line 82) | fn test_exact_version_major_minor() -> Result<()> {
function test_exact_version_major (line 89) | fn test_exact_version_major() -> Result<()> {
function test_exact_version_range (line 96) | fn test_exact_version_range() -> Result<()> {
function test_exact_version_req_not_equal (line 103) | fn test_exact_version_req_not_equal() -> Result<()> {
function test_exact_version_req_major_minor_patch (line 110) | fn test_exact_version_req_major_minor_patch() -> Result<()> {
function test_exact_version_prerelease (line 117) | fn test_exact_version_prerelease() -> Result<()> {
FILE: postgresql_archive/tests/archive.rs
function test_get_version_not_found (line 9) | async fn test_get_version_not_found() -> postgresql_archive::Result<()> {
function test_get_version (line 18) | async fn test_get_version() -> anyhow::Result<()> {
function test_get_archive_and_extract (line 27) | async fn test_get_archive_and_extract() -> anyhow::Result<()> {
function test_get_archive_version_not_found (line 49) | async fn test_get_archive_version_not_found() -> postgresql_archive::Res...
FILE: postgresql_archive/tests/blocking.rs
function test_get_version (line 14) | fn test_get_version() -> anyhow::Result<()> {
function test_get_archive_and_extract (line 24) | fn test_get_archive_and_extract() -> anyhow::Result<()> {
FILE: postgresql_archive/tests/zonky.rs
function test_get_version_not_found (line 16) | async fn test_get_version_not_found() -> postgresql_archive::Result<()> {
function test_get_version (line 26) | async fn test_get_version() -> anyhow::Result<()> {
function test_get_archive_and_extract (line 36) | async fn test_get_archive_and_extract() -> anyhow::Result<()> {
function test_get_archive_version_not_found (line 52) | async fn test_get_archive_version_not_found() -> postgresql_archive::Res...
FILE: postgresql_commands/src/clusterdb.rs
type ClusterDbBuilder (line 9) | pub struct ClusterDbBuilder {
method new (line 32) | pub fn new() -> Self {
method from (line 37) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 52) | fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method all (line 59) | pub fn all(mut self) -> Self {
method dbname (line 66) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method echo (line 73) | pub fn echo(mut self) -> Self {
method quiet (line 80) | pub fn quiet(mut self) -> Self {
method table (line 87) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method verbose (line 94) | pub fn verbose(mut self) -> Self {
method version (line 101) | pub fn version(mut self) -> Self {
method help (line 108) | pub fn help(mut self) -> Self {
method host (line 115) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 122) | pub fn port(mut self, port: u16) -> Self {
method username (line 129) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 136) | pub fn no_password(mut self) -> Self {
method password (line 143) | pub fn password(mut self) -> Self {
method pg_password (line 150) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 157) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, db: S) -> Self {
method get_program (line 165) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 170) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 175) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 244) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 255) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 271) | fn test_builder_new() {
function test_builder_from (line 280) | fn test_builder_from() {
function test_builder (line 296) | fn test_builder() {
function test_builder_from_socket (line 329) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/createdb.rs
type CreateDbBuilder (line 9) | pub struct CreateDbBuilder {
method new (line 40) | pub fn new() -> Self {
method from (line 45) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 60) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method tablespace (line 67) | pub fn tablespace<S: AsRef<OsStr>>(mut self, tablespace: S) -> Self {
method echo (line 74) | pub fn echo(mut self) -> Self {
method encoding (line 81) | pub fn encoding<S: AsRef<OsStr>>(mut self, encoding: S) -> Self {
method locale (line 88) | pub fn locale<S: AsRef<OsStr>>(mut self, locale: S) -> Self {
method lc_collate (line 95) | pub fn lc_collate<S: AsRef<OsStr>>(mut self, lc_collate: S) -> Self {
method lc_ctype (line 102) | pub fn lc_ctype<S: AsRef<OsStr>>(mut self, lc_ctype: S) -> Self {
method icu_locale (line 109) | pub fn icu_locale<S: AsRef<OsStr>>(mut self, icu_locale: S) -> Self {
method icu_rules (line 116) | pub fn icu_rules<S: AsRef<OsStr>>(mut self, icu_rules: S) -> Self {
method locale_provider (line 123) | pub fn locale_provider<S: AsRef<OsStr>>(mut self, locale_provider: S) ...
method owner (line 130) | pub fn owner<S: AsRef<OsStr>>(mut self, owner: S) -> Self {
method strategy (line 137) | pub fn strategy<S: AsRef<OsStr>>(mut self, strategy: S) -> Self {
method template (line 144) | pub fn template<S: AsRef<OsStr>>(mut self, template: S) -> Self {
method version (line 151) | pub fn version(mut self) -> Self {
method help (line 158) | pub fn help(mut self) -> Self {
method host (line 165) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 172) | pub fn port(mut self, port: u16) -> Self {
method username (line 179) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 186) | pub fn no_password(mut self) -> Self {
method password (line 193) | pub fn password(mut self) -> Self {
method pg_password (line 200) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 207) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, db: S) -> Self {
method dbname (line 214) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method description (line 221) | pub fn description<S: AsRef<OsStr>>(mut self, description: S) -> Self {
method get_program (line 229) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 234) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 239) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 349) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 360) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 376) | fn test_builder_new() {
function test_builder_from (line 385) | fn test_builder_from() {
function test_builder (line 401) | fn test_builder() {
function test_builder_from_socket (line 442) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/createuser.rs
type CreateUserBuilder (line 9) | pub struct CreateUserBuilder {
method new (line 47) | pub fn new() -> Self {
method from (line 52) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 67) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method with_admin (line 74) | pub fn with_admin<S: AsRef<OsStr>>(mut self, role: S) -> Self {
method connection_limit (line 81) | pub fn connection_limit(mut self, limit: u32) -> Self {
method createdb (line 88) | pub fn createdb(mut self) -> Self {
method no_createdb (line 95) | pub fn no_createdb(mut self) -> Self {
method echo (line 102) | pub fn echo(mut self) -> Self {
method member_of (line 109) | pub fn member_of<S: AsRef<OsStr>>(mut self, role: S) -> Self {
method inherit (line 116) | pub fn inherit(mut self) -> Self {
method no_inherit (line 123) | pub fn no_inherit(mut self) -> Self {
method login (line 130) | pub fn login(mut self) -> Self {
method no_login (line 137) | pub fn no_login(mut self) -> Self {
method with_member (line 144) | pub fn with_member<S: AsRef<OsStr>>(mut self, role: S) -> Self {
method pwprompt (line 151) | pub fn pwprompt(mut self) -> Self {
method createrole (line 158) | pub fn createrole(mut self) -> Self {
method no_createrole (line 165) | pub fn no_createrole(mut self) -> Self {
method superuser (line 172) | pub fn superuser(mut self) -> Self {
method no_superuser (line 179) | pub fn no_superuser(mut self) -> Self {
method valid_until (line 186) | pub fn valid_until<S: AsRef<OsStr>>(mut self, timestamp: S) -> Self {
method version (line 193) | pub fn version(mut self) -> Self {
method interactive (line 200) | pub fn interactive(mut self) -> Self {
method bypassrls (line 207) | pub fn bypassrls(mut self) -> Self {
method no_bypassrls (line 214) | pub fn no_bypassrls(mut self) -> Self {
method replication (line 221) | pub fn replication(mut self) -> Self {
method no_replication (line 228) | pub fn no_replication(mut self) -> Self {
method help (line 235) | pub fn help(mut self) -> Self {
method host (line 242) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 249) | pub fn port(mut self, port: u16) -> Self {
method username (line 256) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 263) | pub fn no_password(mut self) -> Self {
method password (line 270) | pub fn password(mut self) -> Self {
method pg_password (line 277) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 285) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 290) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 295) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 426) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 437) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 453) | fn test_builder_new() {
function test_builder_from (line 462) | fn test_builder_from() {
function test_builder (line 478) | fn test_builder() {
function test_builder_from_socket (line 526) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/dropdb.rs
type DropDbBuilder (line 8) | pub struct DropDbBuilder {
method new (line 30) | pub fn new() -> Self {
method from (line 35) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 50) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method echo (line 57) | pub fn echo(mut self) -> Self {
method force (line 64) | pub fn force(mut self) -> Self {
method interactive (line 71) | pub fn interactive(mut self) -> Self {
method version (line 78) | pub fn version(mut self) -> Self {
method if_exists (line 85) | pub fn if_exists(mut self) -> Self {
method help (line 92) | pub fn help(mut self) -> Self {
method host (line 99) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 106) | pub fn port(mut self, port: u16) -> Self {
method username (line 113) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 120) | pub fn no_password(mut self) -> Self {
method password (line 127) | pub fn password(mut self) -> Self {
method pg_password (line 134) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 141) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, db: S) -> Self {
method dbname (line 148) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method get_program (line 156) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 161) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 166) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 229) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 240) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 256) | fn test_builder_new() {
function test_builder_from (line 265) | fn test_builder_from() {
function test_builder (line 281) | fn test_builder() {
function test_builder_from_socket (line 313) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/dropuser.rs
type DropUserBuilder (line 9) | pub struct DropUserBuilder {
method new (line 28) | pub fn new() -> Self {
method from (line 33) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 48) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method echo (line 55) | pub fn echo(mut self) -> Self {
method interactive (line 62) | pub fn interactive(mut self) -> Self {
method version (line 69) | pub fn version(mut self) -> Self {
method if_exists (line 76) | pub fn if_exists(mut self) -> Self {
method help (line 83) | pub fn help(mut self) -> Self {
method host (line 90) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 97) | pub fn port(mut self, port: u16) -> Self {
method username (line 104) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 111) | pub fn no_password(mut self) -> Self {
method password (line 118) | pub fn password(mut self) -> Self {
method pg_password (line 125) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 133) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 138) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 143) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 193) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 204) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 220) | fn test_builder_new() {
function test_builder_from (line 229) | fn test_builder_from() {
function test_builder (line 245) | fn test_builder() {
function test_builder_from_socket (line 274) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/ecpg.rs
type EcpgBuilder (line 9) | pub struct EcpgBuilder {
method new (line 29) | pub fn new() -> Self {
method from (line 34) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 40) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method c (line 47) | pub fn c(mut self) -> Self {
method compatibility_mode (line 54) | pub fn compatibility_mode<S: AsRef<OsStr>>(mut self, compatibility_mod...
method symbol (line 61) | pub fn symbol<S: AsRef<OsStr>>(mut self, symbol: S) -> Self {
method header_file (line 68) | pub fn header_file(mut self) -> Self {
method system_include_files (line 75) | pub fn system_include_files(mut self) -> Self {
method directory (line 82) | pub fn directory<S: AsRef<OsStr>>(mut self, directory: S) -> Self {
method outfile (line 89) | pub fn outfile<S: AsRef<OsStr>>(mut self, outfile: S) -> Self {
method runtime_behavior (line 96) | pub fn runtime_behavior<S: AsRef<OsStr>>(mut self, runtime_behavior: S...
method regression (line 103) | pub fn regression(mut self) -> Self {
method autocommit (line 110) | pub fn autocommit(mut self) -> Self {
method version (line 117) | pub fn version(mut self) -> Self {
method help (line 124) | pub fn help(mut self) -> Self {
method get_program (line 132) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 137) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 142) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 202) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 207) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 222) | fn test_builder_new() {
function test_builder_from (line 231) | fn test_builder_from() {
function test_builder (line 242) | fn test_builder() {
FILE: postgresql_commands/src/error.rs
type Result (line 2) | pub type Result<T, E = Error> = core::result::Result<T, E>;
type Error (line 6) | pub enum Error {
method from (line 20) | fn from(error: std::io::Error) -> Self {
method from (line 28) | fn from(error: tokio::time::error::Elapsed) -> Self {
function test_from_io_error (line 40) | fn test_from_io_error() {
function test_from_elapsed_error (line 48) | async fn test_from_elapsed_error() {
FILE: postgresql_commands/src/initdb.rs
type InitDbBuilder (line 9) | pub struct InitDbBuilder {
method new (line 52) | pub fn new() -> Self {
method from (line 57) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 65) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method auth (line 72) | pub fn auth<S: AsRef<OsStr>>(mut self, auth: S) -> Self {
method auth_host (line 79) | pub fn auth_host<S: AsRef<OsStr>>(mut self, auth_host: S) -> Self {
method auth_local (line 86) | pub fn auth_local<S: AsRef<OsStr>>(mut self, auth_local: S) -> Self {
method pgdata (line 93) | pub fn pgdata<P: Into<PathBuf>>(mut self, pgdata: P) -> Self {
method encoding (line 100) | pub fn encoding<S: AsRef<OsStr>>(mut self, encoding: S) -> Self {
method allow_group_access (line 107) | pub fn allow_group_access(mut self) -> Self {
method icu_locale (line 114) | pub fn icu_locale<S: AsRef<OsStr>>(mut self, icu_locale: S) -> Self {
method icu_rules (line 121) | pub fn icu_rules<S: AsRef<OsStr>>(mut self, icu_rules: S) -> Self {
method data_checksums (line 128) | pub fn data_checksums(mut self) -> Self {
method locale (line 135) | pub fn locale<S: AsRef<OsStr>>(mut self, locale: S) -> Self {
method lc_collate (line 142) | pub fn lc_collate<S: AsRef<OsStr>>(mut self, lc_collate: S) -> Self {
method lc_ctype (line 149) | pub fn lc_ctype<S: AsRef<OsStr>>(mut self, lc_ctype: S) -> Self {
method lc_messages (line 156) | pub fn lc_messages<S: AsRef<OsStr>>(mut self, lc_messages: S) -> Self {
method lc_monetary (line 163) | pub fn lc_monetary<S: AsRef<OsStr>>(mut self, lc_monetary: S) -> Self {
method lc_numeric (line 170) | pub fn lc_numeric<S: AsRef<OsStr>>(mut self, lc_numeric: S) -> Self {
method lc_time (line 177) | pub fn lc_time<S: AsRef<OsStr>>(mut self, lc_time: S) -> Self {
method no_locale (line 184) | pub fn no_locale(mut self) -> Self {
method locale_provider (line 191) | pub fn locale_provider<S: AsRef<OsStr>>(mut self, locale_provider: S) ...
method pwfile (line 198) | pub fn pwfile<P: Into<PathBuf>>(mut self, pwfile: P) -> Self {
method text_search_config (line 205) | pub fn text_search_config<S: AsRef<OsStr>>(mut self, text_search_confi...
method username (line 212) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method pwprompt (line 219) | pub fn pwprompt(mut self) -> Self {
method waldir (line 226) | pub fn waldir<S: AsRef<OsStr>>(mut self, waldir: S) -> Self {
method wal_segsize (line 233) | pub fn wal_segsize<S: AsRef<OsStr>>(mut self, wal_segsize: S) -> Self {
method set (line 240) | pub fn set<S: AsRef<OsStr>>(mut self, set: S) -> Self {
method debug (line 247) | pub fn debug(mut self) -> Self {
method discard_caches (line 254) | pub fn discard_caches(mut self) -> Self {
method directory (line 261) | pub fn directory<S: AsRef<OsStr>>(mut self, directory: S) -> Self {
method no_clean (line 268) | pub fn no_clean(mut self) -> Self {
method no_sync (line 275) | pub fn no_sync(mut self) -> Self {
method no_instructions (line 282) | pub fn no_instructions(mut self) -> Self {
method show (line 289) | pub fn show(mut self) -> Self {
method sync_only (line 296) | pub fn sync_only(mut self) -> Self {
method version (line 303) | pub fn version(mut self) -> Self {
method help (line 310) | pub fn help(mut self) -> Self {
method get_program (line 318) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 323) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 329) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 498) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 503) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 518) | fn test_builder_new() {
function test_builder_from (line 527) | fn test_builder_from() {
function test_builder (line 541) | fn test_builder() {
FILE: postgresql_commands/src/oid2name.rs
type Oid2NameBuilder (line 9) | pub struct Oid2NameBuilder {
method new (line 31) | pub fn new() -> Self {
method from (line 36) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 50) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method filenode (line 57) | pub fn filenode<S: AsRef<OsStr>>(mut self, filenode: S) -> Self {
method indexes (line 64) | pub fn indexes(mut self) -> Self {
method oid (line 71) | pub fn oid<S: AsRef<OsStr>>(mut self, oid: S) -> Self {
method quiet (line 78) | pub fn quiet(mut self) -> Self {
method tablespaces (line 85) | pub fn tablespaces(mut self) -> Self {
method system_objects (line 92) | pub fn system_objects(mut self) -> Self {
method table (line 99) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method version (line 106) | pub fn version(mut self) -> Self {
method extended (line 113) | pub fn extended(mut self) -> Self {
method help (line 120) | pub fn help(mut self) -> Self {
method dbname (line 127) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 134) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 141) | pub fn port(mut self, port: u16) -> Self {
method username (line 148) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method get_program (line 156) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 161) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 166) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 236) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 241) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 257) | fn test_builder_new() {
function test_builder_from (line 266) | fn test_builder_from() {
function test_builder (line 282) | fn test_builder() {
function test_builder_from_socket (line 314) | fn test_builder_from_socket() {
FILE: postgresql_commands/src/pg_amcheck.rs
type PgAmCheckBuilder (line 9) | pub struct PgAmCheckBuilder {
method new (line 53) | pub fn new() -> Self {
method from (line 58) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 73) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method all (line 80) | pub fn all(mut self) -> Self {
method database (line 87) | pub fn database<S: AsRef<OsStr>>(mut self, database: S) -> Self {
method exclude_database (line 94) | pub fn exclude_database<S: AsRef<OsStr>>(mut self, exclude_database: S...
method index (line 101) | pub fn index<S: AsRef<OsStr>>(mut self, index: S) -> Self {
method exclude_index (line 108) | pub fn exclude_index<S: AsRef<OsStr>>(mut self, exclude_index: S) -> S...
method relation (line 115) | pub fn relation<S: AsRef<OsStr>>(mut self, relation: S) -> Self {
method exclude_relation (line 122) | pub fn exclude_relation<S: AsRef<OsStr>>(mut self, exclude_relation: S...
method schema (line 129) | pub fn schema<S: AsRef<OsStr>>(mut self, schema: S) -> Self {
method exclude_schema (line 136) | pub fn exclude_schema<S: AsRef<OsStr>>(mut self, exclude_schema: S) ->...
method table (line 143) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method exclude_table (line 150) | pub fn exclude_table<S: AsRef<OsStr>>(mut self, exclude_table: S) -> S...
method no_dependent_indexes (line 157) | pub fn no_dependent_indexes(mut self) -> Self {
method no_dependent_toast (line 164) | pub fn no_dependent_toast(mut self) -> Self {
method no_strict_names (line 171) | pub fn no_strict_names(mut self) -> Self {
method exclude_toast_pointers (line 178) | pub fn exclude_toast_pointers(mut self) -> Self {
method on_error_stop (line 185) | pub fn on_error_stop(mut self) -> Self {
method skip (line 192) | pub fn skip<S: AsRef<OsStr>>(mut self, skip: S) -> Self {
method start_block (line 199) | pub fn start_block<S: AsRef<OsStr>>(mut self, start_block: S) -> Self {
method end_block (line 206) | pub fn end_block<S: AsRef<OsStr>>(mut self, end_block: S) -> Self {
method heap_all_indexed (line 213) | pub fn heap_all_indexed(mut self) -> Self {
method parent_check (line 220) | pub fn parent_check(mut self) -> Self {
method root_descend (line 227) | pub fn root_descend(mut self) -> Self {
method host (line 234) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 241) | pub fn port(mut self, port: u16) -> Self {
method username (line 248) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 255) | pub fn no_password(mut self) -> Self {
method password (line 262) | pub fn password(mut self) -> Self {
method pg_password (line 269) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 276) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, maintenance_db: S) ->...
method echo (line 283) | pub fn echo(mut self) -> Self {
method jobs (line 290) | pub fn jobs<S: AsRef<OsStr>>(mut self, jobs: S) -> Self {
method progress (line 297) | pub fn progress(mut self) -> Self {
method verbose (line 304) | pub fn verbose(mut self) -> Self {
method version (line 311) | pub fn version(mut self) -> Self {
method install_missing (line 318) | pub fn install_missing(mut self) -> Self {
method help (line 325) | pub fn help(mut self) -> Self {
method get_program (line 333) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 338) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 344) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 509) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 520) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 536) | fn test_builder_new() {
function test_builder_from (line 545) | fn test_builder_from() {
function test_builder_from_socket (line 561) | fn test_builder_from_socket() {
function test_builder (line 577) | fn test_builder() {
FILE: postgresql_commands/src/pg_archivecleanup.rs
type PgArchiveCleanupBuilder (line 9) | pub struct PgArchiveCleanupBuilder {
method new (line 24) | pub fn new() -> Self {
method from (line 29) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 35) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method debug (line 42) | pub fn debug(mut self) -> Self {
method dry_run (line 49) | pub fn dry_run(mut self) -> Self {
method version (line 56) | pub fn version(mut self) -> Self {
method ext (line 63) | pub fn ext<S: AsRef<OsStr>>(mut self, ext: S) -> Self {
method help (line 70) | pub fn help(mut self) -> Self {
method archive_location (line 77) | pub fn archive_location<S: AsRef<OsStr>>(mut self, archive_location: S...
method oldest_kept_wal_file (line 84) | pub fn oldest_kept_wal_file<S: AsRef<OsStr>>(mut self, oldest_kept_wal...
method get_program (line 92) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 97) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 102) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 138) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 143) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 158) | fn test_builder_new() {
function test_builder_from (line 167) | fn test_builder_from() {
function test_builder (line 178) | fn test_builder() {
FILE: postgresql_commands/src/pg_basebackup.rs
type PgBaseBackupBuilder (line 9) | pub struct PgBaseBackupBuilder {
method new (line 51) | pub fn new() -> Self {
method from (line 56) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 71) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method pgdata (line 78) | pub fn pgdata<P: Into<PathBuf>>(mut self, pgdata: P) -> Self {
method format (line 85) | pub fn format<S: AsRef<OsStr>>(mut self, format: S) -> Self {
method max_rate (line 92) | pub fn max_rate<S: AsRef<OsStr>>(mut self, max_rate: S) -> Self {
method write_recovery_conf (line 99) | pub fn write_recovery_conf(mut self) -> Self {
method target (line 106) | pub fn target<S: AsRef<OsStr>>(mut self, target: S) -> Self {
method tablespace_mapping (line 113) | pub fn tablespace_mapping<S: AsRef<OsStr>>(mut self, tablespace_mappin...
method waldir (line 120) | pub fn waldir<S: AsRef<OsStr>>(mut self, waldir: S) -> Self {
method wal_method (line 127) | pub fn wal_method<S: AsRef<OsStr>>(mut self, wal_method: S) -> Self {
method gzip (line 134) | pub fn gzip(mut self) -> Self {
method compress (line 141) | pub fn compress<S: AsRef<OsStr>>(mut self, compress: S) -> Self {
method checkpoint (line 148) | pub fn checkpoint<S: AsRef<OsStr>>(mut self, checkpoint: S) -> Self {
method create_slot (line 155) | pub fn create_slot(mut self) -> Self {
method label (line 162) | pub fn label<S: AsRef<OsStr>>(mut self, label: S) -> Self {
method no_clean (line 169) | pub fn no_clean(mut self) -> Self {
method no_sync (line 176) | pub fn no_sync(mut self) -> Self {
method progress (line 183) | pub fn progress(mut self) -> Self {
method slot (line 190) | pub fn slot<S: AsRef<OsStr>>(mut self, slot: S) -> Self {
method verbose (line 197) | pub fn verbose(mut self) -> Self {
method version (line 204) | pub fn version(mut self) -> Self {
method manifest_checksums (line 211) | pub fn manifest_checksums<S: AsRef<OsStr>>(mut self, manifest_checksum...
method manifest_force_encode (line 218) | pub fn manifest_force_encode(mut self) -> Self {
method no_estimate_size (line 225) | pub fn no_estimate_size(mut self) -> Self {
method no_manifest (line 232) | pub fn no_manifest(mut self) -> Self {
method no_slot (line 239) | pub fn no_slot(mut self) -> Self {
method no_verify_checksums (line 246) | pub fn no_verify_checksums(mut self) -> Self {
method help (line 253) | pub fn help(mut self) -> Self {
method dbname (line 260) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 267) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 274) | pub fn port(mut self, port: u16) -> Self {
method status_interval (line 281) | pub fn status_interval<S: AsRef<OsStr>>(mut self, status_interval: S) ...
method username (line 288) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 295) | pub fn no_password(mut self) -> Self {
method password (line 302) | pub fn password(mut self) -> Self {
method pg_password (line 309) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 317) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 322) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 328) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 484) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 495) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 511) | fn test_builder_new() {
function test_builder_from (line 520) | fn test_builder_from() {
function test_builder_from_socket (line 536) | fn test_builder_from_socket() {
function test_builder (line 552) | fn test_builder() {
FILE: postgresql_commands/src/pg_checksums.rs
type PgChecksumsBuilder (line 9) | pub struct PgChecksumsBuilder {
method new (line 27) | pub fn new() -> Self {
method from (line 32) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 38) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method pgdata (line 45) | pub fn pgdata<P: Into<PathBuf>>(mut self, pgdata: P) -> Self {
method check (line 52) | pub fn check(mut self) -> Self {
method disable (line 59) | pub fn disable(mut self) -> Self {
method enable (line 66) | pub fn enable(mut self) -> Self {
method filenode (line 73) | pub fn filenode<S: AsRef<OsStr>>(mut self, filenode: S) -> Self {
method no_sync (line 80) | pub fn no_sync(mut self) -> Self {
method progress (line 87) | pub fn progress(mut self) -> Self {
method verbose (line 94) | pub fn verbose(mut self) -> Self {
method version (line 101) | pub fn version(mut self) -> Self {
method help (line 108) | pub fn help(mut self) -> Self {
method get_program (line 116) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 121) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 126) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 175) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 180) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 195) | fn test_builder_new() {
function test_builder_from (line 204) | fn test_builder_from() {
function test_builder (line 215) | fn test_builder() {
FILE: postgresql_commands/src/pg_config.rs
type PgConfigBuilder (line 9) | pub struct PgConfigBuilder {
method new (line 41) | pub fn new() -> Self {
method from (line 46) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 52) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method bindir (line 59) | pub fn bindir(mut self) -> Self {
method docdir (line 66) | pub fn docdir(mut self) -> Self {
method htmldir (line 73) | pub fn htmldir(mut self) -> Self {
method includedir (line 80) | pub fn includedir(mut self) -> Self {
method pkgincludedir (line 87) | pub fn pkgincludedir(mut self) -> Self {
method includedir_server (line 94) | pub fn includedir_server(mut self) -> Self {
method libdir (line 101) | pub fn libdir(mut self) -> Self {
method pkglibdir (line 108) | pub fn pkglibdir(mut self) -> Self {
method localedir (line 115) | pub fn localedir(mut self) -> Self {
method mandir (line 122) | pub fn mandir(mut self) -> Self {
method sharedir (line 129) | pub fn sharedir(mut self) -> Self {
method sysconfdir (line 136) | pub fn sysconfdir(mut self) -> Self {
method pgxs (line 143) | pub fn pgxs(mut self) -> Self {
method configure (line 150) | pub fn configure(mut self) -> Self {
method cc (line 157) | pub fn cc(mut self) -> Self {
method cppflags (line 164) | pub fn cppflags(mut self) -> Self {
method cflags (line 171) | pub fn cflags(mut self) -> Self {
method cflags_sl (line 178) | pub fn cflags_sl(mut self) -> Self {
method ldflags (line 185) | pub fn ldflags(mut self) -> Self {
method ldflags_ex (line 192) | pub fn ldflags_ex(mut self) -> Self {
method ldflags_sl (line 199) | pub fn ldflags_sl(mut self) -> Self {
method libs (line 206) | pub fn libs(mut self) -> Self {
method version (line 213) | pub fn version(mut self) -> Self {
method help (line 220) | pub fn help(mut self) -> Self {
method get_program (line 228) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 233) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 238) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 341) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 346) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 361) | fn test_builder_new() {
function test_builder_from (line 370) | fn test_builder_from() {
function test_builder (line 381) | fn test_builder() {
FILE: postgresql_commands/src/pg_controldata.rs
type PgControlDataBuilder (line 8) | pub struct PgControlDataBuilder {
method new (line 19) | pub fn new() -> Self {
method from (line 24) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 30) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method pgdata (line 37) | pub fn pgdata<P: Into<PathBuf>>(mut self, pgdata: P) -> Self {
method version (line 44) | pub fn version(mut self) -> Self {
method help (line 51) | pub fn help(mut self) -> Self {
method get_program (line 59) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 64) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 69) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 89) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 94) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 109) | fn test_builder_new() {
function test_builder_from (line 118) | fn test_builder_from() {
function test_builder (line 129) | fn test_builder() {
FILE: postgresql_commands/src/pg_ctl.rs
type PgCtlBuilder (line 10) | pub struct PgCtlBuilder {
method new (line 79) | pub fn new() -> Self {
method from (line 84) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 90) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method mode (line 97) | pub fn mode(mut self, mode: Mode) -> Self {
method pgdata (line 104) | pub fn pgdata<P: Into<PathBuf>>(mut self, pgdata: P) -> Self {
method silent (line 111) | pub fn silent(mut self) -> Self {
method timeout (line 118) | pub fn timeout(mut self, timeout: u16) -> Self {
method version (line 125) | pub fn version(mut self) -> Self {
method wait (line 132) | pub fn wait(mut self) -> Self {
method no_wait (line 139) | pub fn no_wait(mut self) -> Self {
method help (line 146) | pub fn help(mut self) -> Self {
method core_files (line 153) | pub fn core_files(mut self) -> Self {
method log (line 160) | pub fn log<P: Into<PathBuf>>(mut self, log: P) -> Self {
method options (line 167) | pub fn options<S: AsRef<OsStr>>(mut self, options: &[S]) -> Self {
method path_to_postgres (line 174) | pub fn path_to_postgres<S: AsRef<OsStr>>(mut self, path_to_postgres: S...
method shutdown_mode (line 181) | pub fn shutdown_mode(mut self, shutdown_mode: ShutdownMode) -> Self {
method signal (line 188) | pub fn signal<S: AsRef<OsStr>>(mut self, signal: S) -> Self {
method pid (line 195) | pub fn pid<S: AsRef<OsStr>>(mut self, pid: S) -> Self {
type Mode (line 31) | pub enum Mode {
method fmt (line 44) | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Resu...
type ShutdownMode (line 60) | pub enum ShutdownMode {
method fmt (line 67) | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Resu...
method get_program (line 203) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 208) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 213) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 286) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 291) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_display_mode (line 306) | fn test_display_mode() {
function test_display_shutdown_mode (line 319) | fn test_display_shutdown_mode() {
function test_builder_new (line 326) | fn test_builder_new() {
function test_builder_from (line 335) | fn test_builder_from() {
function test_builder (line 346) | fn test_builder() {
FILE: postgresql_commands/src/pg_dump.rs
type PgDumpBuilder (line 9) | pub struct PgDumpBuilder {
method new (line 78) | pub fn new() -> Self {
method from (line 83) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 98) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method data_only (line 105) | pub fn data_only(mut self) -> Self {
method large_objects (line 112) | pub fn large_objects(mut self) -> Self {
method no_large_objects (line 119) | pub fn no_large_objects(mut self) -> Self {
method clean (line 126) | pub fn clean(mut self) -> Self {
method create (line 133) | pub fn create(mut self) -> Self {
method extension (line 140) | pub fn extension<S: AsRef<OsStr>>(mut self, extension: S) -> Self {
method encoding (line 147) | pub fn encoding<S: AsRef<OsStr>>(mut self, encoding: S) -> Self {
method file (line 154) | pub fn file<S: AsRef<OsStr>>(mut self, file: S) -> Self {
method format (line 161) | pub fn format<S: AsRef<OsStr>>(mut self, format: S) -> Self {
method jobs (line 168) | pub fn jobs<S: AsRef<OsStr>>(mut self, jobs: S) -> Self {
method schema (line 175) | pub fn schema<S: AsRef<OsStr>>(mut self, schema: S) -> Self {
method exclude_schema (line 182) | pub fn exclude_schema<S: AsRef<OsStr>>(mut self, exclude_schema: S) ->...
method no_owner (line 189) | pub fn no_owner(mut self) -> Self {
method no_reconnect (line 196) | pub fn no_reconnect(mut self) -> Self {
method schema_only (line 203) | pub fn schema_only(mut self) -> Self {
method superuser (line 210) | pub fn superuser<S: AsRef<OsStr>>(mut self, superuser: S) -> Self {
method table (line 217) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method exclude_table (line 224) | pub fn exclude_table<S: AsRef<OsStr>>(mut self, exclude_table: S) -> S...
method verbose (line 231) | pub fn verbose(mut self) -> Self {
method version (line 238) | pub fn version(mut self) -> Self {
method no_privileges (line 245) | pub fn no_privileges(mut self) -> Self {
method compress (line 252) | pub fn compress<S: AsRef<OsStr>>(mut self, compress: S) -> Self {
method binary_upgrade (line 259) | pub fn binary_upgrade(mut self) -> Self {
method column_inserts (line 266) | pub fn column_inserts(mut self) -> Self {
method attribute_inserts (line 273) | pub fn attribute_inserts(mut self) -> Self {
method disable_dollar_quoting (line 280) | pub fn disable_dollar_quoting(mut self) -> Self {
method disable_triggers (line 287) | pub fn disable_triggers(mut self) -> Self {
method enable_row_security (line 294) | pub fn enable_row_security(mut self) -> Self {
method exclude_table_data_and_children (line 301) | pub fn exclude_table_data_and_children<S: AsRef<OsStr>>(
method extra_float_digits (line 312) | pub fn extra_float_digits<S: AsRef<OsStr>>(mut self, extra_float_digit...
method if_exists (line 319) | pub fn if_exists(mut self) -> Self {
method include_foreign_data (line 326) | pub fn include_foreign_data<S: AsRef<OsStr>>(mut self, include_foreign...
method inserts (line 333) | pub fn inserts(mut self) -> Self {
method load_via_partition_root (line 340) | pub fn load_via_partition_root(mut self) -> Self {
method lock_wait_timeout (line 347) | pub fn lock_wait_timeout(mut self, lock_wait_timeout: u16) -> Self {
method no_comments (line 354) | pub fn no_comments(mut self) -> Self {
method no_publications (line 361) | pub fn no_publications(mut self) -> Self {
method no_security_labels (line 368) | pub fn no_security_labels(mut self) -> Self {
method no_subscriptions (line 375) | pub fn no_subscriptions(mut self) -> Self {
method no_table_access_method (line 382) | pub fn no_table_access_method(mut self) -> Self {
method no_tablespaces (line 389) | pub fn no_tablespaces(mut self) -> Self {
method no_toast_compression (line 396) | pub fn no_toast_compression(mut self) -> Self {
method no_unlogged_table_data (line 403) | pub fn no_unlogged_table_data(mut self) -> Self {
method on_conflict_do_nothing (line 410) | pub fn on_conflict_do_nothing(mut self) -> Self {
method quote_all_identifiers (line 417) | pub fn quote_all_identifiers(mut self) -> Self {
method rows_per_insert (line 424) | pub fn rows_per_insert(mut self, rows_per_insert: u64) -> Self {
method section (line 431) | pub fn section<S: AsRef<OsStr>>(mut self, section: S) -> Self {
method serializable_deferrable (line 438) | pub fn serializable_deferrable(mut self) -> Self {
method snapshot (line 445) | pub fn snapshot<S: AsRef<OsStr>>(mut self, snapshot: S) -> Self {
method strict_names (line 452) | pub fn strict_names(mut self) -> Self {
method table_and_children (line 459) | pub fn table_and_children<S: AsRef<OsStr>>(mut self, table_and_childre...
method use_set_session_authorization (line 466) | pub fn use_set_session_authorization(mut self) -> Self {
method help (line 473) | pub fn help(mut self) -> Self {
method dbname (line 480) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 487) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 494) | pub fn port(mut self, port: u16) -> Self {
method username (line 501) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 508) | pub fn no_password(mut self) -> Self {
method password (line 515) | pub fn password(mut self) -> Self {
method pg_password (line 522) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method role (line 529) | pub fn role<S: AsRef<OsStr>>(mut self, rolename: S) -> Self {
method get_program (line 537) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 542) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 548) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 819) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 830) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 846) | fn test_builder_new() {
function test_builder_from (line 855) | fn test_builder_from() {
function test_builder_from_socket (line 871) | fn test_builder_from_socket() {
function test_builder (line 887) | fn test_builder() {
FILE: postgresql_commands/src/pg_dumpall.rs
type PgDumpAllBuilder (line 9) | pub struct PgDumpAllBuilder {
method new (line 64) | pub fn new() -> Self {
method from (line 69) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 84) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method file (line 91) | pub fn file<S: AsRef<OsStr>>(mut self, file: S) -> Self {
method verbose (line 98) | pub fn verbose(mut self) -> Self {
method version (line 105) | pub fn version(mut self) -> Self {
method lock_wait_timeout (line 112) | pub fn lock_wait_timeout(mut self, lock_wait_timeout: u16) -> Self {
method help (line 119) | pub fn help(mut self) -> Self {
method data_only (line 126) | pub fn data_only(mut self) -> Self {
method clean (line 133) | pub fn clean(mut self) -> Self {
method encoding (line 140) | pub fn encoding<S: AsRef<OsStr>>(mut self, encoding: S) -> Self {
method globals_only (line 147) | pub fn globals_only(mut self) -> Self {
method no_owner (line 154) | pub fn no_owner(mut self) -> Self {
method roles_only (line 161) | pub fn roles_only(mut self) -> Self {
method schema_only (line 168) | pub fn schema_only(mut self) -> Self {
method superuser (line 175) | pub fn superuser<S: AsRef<OsStr>>(mut self, superuser: S) -> Self {
method tablespaces_only (line 182) | pub fn tablespaces_only(mut self) -> Self {
method no_privileges (line 189) | pub fn no_privileges(mut self) -> Self {
method binary_upgrade (line 196) | pub fn binary_upgrade(mut self) -> Self {
method column_inserts (line 203) | pub fn column_inserts(mut self) -> Self {
method disable_dollar_quoting (line 210) | pub fn disable_dollar_quoting(mut self) -> Self {
method disable_triggers (line 217) | pub fn disable_triggers(mut self) -> Self {
method exclude_database (line 224) | pub fn exclude_database<S: AsRef<OsStr>>(mut self, exclude_database: S...
method extra_float_digits (line 231) | pub fn extra_float_digits<S: AsRef<OsStr>>(mut self, extra_float_digit...
method if_exists (line 238) | pub fn if_exists(mut self) -> Self {
method inserts (line 245) | pub fn inserts(mut self) -> Self {
method load_via_partition_root (line 252) | pub fn load_via_partition_root(mut self) -> Self {
method no_comments (line 259) | pub fn no_comments(mut self) -> Self {
method no_publications (line 266) | pub fn no_publications(mut self) -> Self {
method no_role_passwords (line 273) | pub fn no_role_passwords(mut self) -> Self {
method no_security_labels (line 280) | pub fn no_security_labels(mut self) -> Self {
method no_subscriptions (line 287) | pub fn no_subscriptions(mut self) -> Self {
method no_sync (line 294) | pub fn no_sync(mut self) -> Self {
method no_table_access_method (line 301) | pub fn no_table_access_method(mut self) -> Self {
method no_tablespaces (line 308) | pub fn no_tablespaces(mut self) -> Self {
method no_toast_compression (line 315) | pub fn no_toast_compression(mut self) -> Self {
method no_unlogged_table_data (line 322) | pub fn no_unlogged_table_data(mut self) -> Self {
method on_conflict_do_nothing (line 329) | pub fn on_conflict_do_nothing(mut self) -> Self {
method quote_all_identifiers (line 336) | pub fn quote_all_identifiers(mut self) -> Self {
method rows_per_insert (line 343) | pub fn rows_per_insert<S: AsRef<OsStr>>(mut self, rows_per_insert: S) ...
method use_set_session_authorization (line 350) | pub fn use_set_session_authorization(mut self) -> Self {
method dbname (line 357) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 364) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method database (line 371) | pub fn database<S: AsRef<OsStr>>(mut self, database: S) -> Self {
method port (line 378) | pub fn port(mut self, port: u16) -> Self {
method username (line 385) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 392) | pub fn no_password(mut self) -> Self {
method password (line 399) | pub fn password(mut self) -> Self {
method pg_password (line 406) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method role (line 413) | pub fn role<S: AsRef<OsStr>>(mut self, role: S) -> Self {
method get_program (line 421) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 426) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 432) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 636) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 647) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 663) | fn test_builder_new() {
function test_builder_from (line 672) | fn test_builder_from() {
function test_builder_from_socket (line 688) | fn test_builder_from_socket() {
function test_builder (line 704) | fn test_builder() {
FILE: postgresql_commands/src/pg_isready.rs
type PgIsReadyBuilder (line 9) | pub struct PgIsReadyBuilder {
method new (line 25) | pub fn new() -> Self {
method from (line 30) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 44) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method dbname (line 51) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method quiet (line 58) | pub fn quiet(mut self) -> Self {
method version (line 65) | pub fn version(mut self) -> Self {
method help (line 72) | pub fn help(mut self) -> Self {
method host (line 79) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 86) | pub fn port(mut self, port: u16) -> Self {
method timeout (line 93) | pub fn timeout(mut self, timeout: u16) -> Self {
method username (line 100) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method get_program (line 108) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 113) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 118) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 162) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 167) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 183) | fn test_builder_new() {
function test_builder_from (line 192) | fn test_builder_from() {
function test_builder_from_socket (line 208) | fn test_builder_from_socket() {
function test_builder (line 224) | fn test_builder() {
FILE: postgresql_commands/src/pg_receivewal.rs
type PgReceiveWalBuilder (line 9) | pub struct PgReceiveWalBuilder {
method new (line 38) | pub fn new() -> Self {
method from (line 43) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 58) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method directory (line 65) | pub fn directory<S: AsRef<OsStr>>(mut self, directory: S) -> Self {
method endpos (line 72) | pub fn endpos<S: AsRef<OsStr>>(mut self, endpos: S) -> Self {
method if_not_exists (line 79) | pub fn if_not_exists(mut self) -> Self {
method no_loop (line 86) | pub fn no_loop(mut self) -> Self {
method no_sync (line 93) | pub fn no_sync(mut self) -> Self {
method status_interval (line 100) | pub fn status_interval<S: AsRef<OsStr>>(mut self, status_interval: S) ...
method slot (line 107) | pub fn slot<S: AsRef<OsStr>>(mut self, slot: S) -> Self {
method synchronous (line 114) | pub fn synchronous(mut self) -> Self {
method verbose (line 121) | pub fn verbose(mut self) -> Self {
method version (line 128) | pub fn version(mut self) -> Self {
method compress (line 135) | pub fn compress<S: AsRef<OsStr>>(mut self, compress: S) -> Self {
method help (line 142) | pub fn help(mut self) -> Self {
method dbname (line 149) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 156) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 163) | pub fn port(mut self, port: u16) -> Self {
method username (line 170) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 177) | pub fn no_password(mut self) -> Self {
method password (line 184) | pub fn password(mut self) -> Self {
method pg_password (line 191) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method create_slot (line 198) | pub fn create_slot(mut self) -> Self {
method drop_slot (line 205) | pub fn drop_slot(mut self) -> Self {
method get_program (line 213) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 218) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 223) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 319) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 330) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 346) | fn test_builder_new() {
function test_builder_from (line 355) | fn test_builder_from() {
function test_builder_from_socket (line 371) | fn test_builder_from_socket() {
function test_builder (line 385) | fn test_builder() {
FILE: postgresql_commands/src/pg_recvlogical.rs
type PgRecvLogicalBuilder (line 9) | pub struct PgRecvLogicalBuilder {
method new (line 41) | pub fn new() -> Self {
method from (line 46) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 61) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method create_slot (line 68) | pub fn create_slot(mut self) -> Self {
method drop_slot (line 75) | pub fn drop_slot(mut self) -> Self {
method start (line 82) | pub fn start(mut self) -> Self {
method endpos (line 89) | pub fn endpos<S: AsRef<OsStr>>(mut self, endpos: S) -> Self {
method file (line 96) | pub fn file<S: AsRef<OsStr>>(mut self, file: S) -> Self {
method fsync_interval (line 103) | pub fn fsync_interval<S: AsRef<OsStr>>(mut self, fsync_interval: S) ->...
method if_not_exists (line 110) | pub fn if_not_exists(mut self) -> Self {
method startpos (line 117) | pub fn startpos<S: AsRef<OsStr>>(mut self, startpos: S) -> Self {
method no_loop (line 124) | pub fn no_loop(mut self) -> Self {
method option (line 131) | pub fn option<S: AsRef<OsStr>>(mut self, option: S) -> Self {
method plugin (line 138) | pub fn plugin<S: AsRef<OsStr>>(mut self, plugin: S) -> Self {
method status_interval (line 145) | pub fn status_interval<S: AsRef<OsStr>>(mut self, status_interval: S) ...
method slot (line 152) | pub fn slot<S: AsRef<OsStr>>(mut self, slot: S) -> Self {
method two_phase (line 159) | pub fn two_phase(mut self) -> Self {
method verbose (line 166) | pub fn verbose(mut self) -> Self {
method version (line 173) | pub fn version(mut self) -> Self {
method help (line 180) | pub fn help(mut self) -> Self {
method dbname (line 187) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method host (line 194) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 201) | pub fn port(mut self, port: u16) -> Self {
method username (line 208) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 215) | pub fn no_password(mut self) -> Self {
method password (line 222) | pub fn password(mut self) -> Self {
method pg_password (line 229) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 237) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 242) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 247) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 358) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 369) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 385) | fn test_builder_new() {
function test_builder_from (line 394) | fn test_builder_from() {
function test_builder_from_socket (line 410) | fn test_builder_from_socket() {
function test_builder (line 424) | fn test_builder() {
FILE: postgresql_commands/src/pg_resetwal.rs
type PgResetWalBuilder (line 9) | pub struct PgResetWalBuilder {
method new (line 31) | pub fn new() -> Self {
method from (line 36) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 42) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method commit_timestamp_ids (line 49) | pub fn commit_timestamp_ids<S: AsRef<OsStr>>(mut self, xid1: S, xid2: ...
method pgdata (line 56) | pub fn pgdata<P: Into<PathBuf>>(mut self, datadir: P) -> Self {
method epoch (line 63) | pub fn epoch<S: AsRef<OsStr>>(mut self, xidepoch: S) -> Self {
method force (line 70) | pub fn force(mut self) -> Self {
method next_wal_file (line 77) | pub fn next_wal_file<S: AsRef<OsStr>>(mut self, walfile: S) -> Self {
method multixact_ids (line 84) | pub fn multixact_ids<S: AsRef<OsStr>>(mut self, mxid1: S, mxid2: S) ->...
method dry_run (line 91) | pub fn dry_run(mut self) -> Self {
method next_oid (line 98) | pub fn next_oid<S: AsRef<OsStr>>(mut self, oid: S) -> Self {
method multixact_offset (line 105) | pub fn multixact_offset<S: AsRef<OsStr>>(mut self, offset: S) -> Self {
method oldest_transaction_id (line 112) | pub fn oldest_transaction_id<S: AsRef<OsStr>>(mut self, xid: S) -> Self {
method version (line 119) | pub fn version(mut self) -> Self {
method next_transaction_id (line 126) | pub fn next_transaction_id<S: AsRef<OsStr>>(mut self, xid: S) -> Self {
method wal_segsize (line 133) | pub fn wal_segsize<S: AsRef<OsStr>>(mut self, size: S) -> Self {
method help (line 140) | pub fn help(mut self) -> Self {
method get_program (line 148) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 153) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 158) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 231) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 236) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 251) | fn test_builder_new() {
function test_builder_from (line 260) | fn test_builder_from() {
function test_builder (line 271) | fn test_builder() {
FILE: postgresql_commands/src/pg_restore.rs
type PgRestoreBuilder (line 9) | pub struct PgRestoreBuilder {
method new (line 61) | pub fn new() -> Self {
method from (line 66) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 81) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method dbname (line 88) | pub fn dbname<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method file (line 95) | pub fn file<S: AsRef<OsStr>>(mut self, filename: S) -> Self {
method format (line 102) | pub fn format<S: AsRef<OsStr>>(mut self, format: S) -> Self {
method list (line 109) | pub fn list(mut self) -> Self {
method verbose (line 116) | pub fn verbose(mut self) -> Self {
method version (line 123) | pub fn version(mut self) -> Self {
method help (line 130) | pub fn help(mut self) -> Self {
method data_only (line 137) | pub fn data_only(mut self) -> Self {
method clean (line 144) | pub fn clean(mut self) -> Self {
method create (line 151) | pub fn create(mut self) -> Self {
method exit_on_error (line 158) | pub fn exit_on_error(mut self) -> Self {
method index (line 165) | pub fn index<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method jobs (line 172) | pub fn jobs<S: AsRef<OsStr>>(mut self, num: S) -> Self {
method use_list (line 179) | pub fn use_list<S: AsRef<OsStr>>(mut self, filename: S) -> Self {
method schema (line 186) | pub fn schema<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method exclude_schema (line 193) | pub fn exclude_schema<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method no_owner (line 200) | pub fn no_owner(mut self) -> Self {
method function (line 207) | pub fn function<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method schema_only (line 214) | pub fn schema_only(mut self) -> Self {
method superuser (line 221) | pub fn superuser<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method table (line 228) | pub fn table<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method trigger (line 235) | pub fn trigger<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method no_privileges (line 242) | pub fn no_privileges(mut self) -> Self {
method single_transaction (line 249) | pub fn single_transaction(mut self) -> Self {
method disable_triggers (line 256) | pub fn disable_triggers(mut self) -> Self {
method enable_row_security (line 263) | pub fn enable_row_security(mut self) -> Self {
method if_exists (line 270) | pub fn if_exists(mut self) -> Self {
method no_comments (line 277) | pub fn no_comments(mut self) -> Self {
method no_data_for_failed_tables (line 284) | pub fn no_data_for_failed_tables(mut self) -> Self {
method no_publications (line 291) | pub fn no_publications(mut self) -> Self {
method no_security_labels (line 298) | pub fn no_security_labels(mut self) -> Self {
method no_subscriptions (line 305) | pub fn no_subscriptions(mut self) -> Self {
method no_table_access_method (line 312) | pub fn no_table_access_method(mut self) -> Self {
method no_tablespaces (line 319) | pub fn no_tablespaces(mut self) -> Self {
method section (line 326) | pub fn section<S: AsRef<OsStr>>(mut self, section: S) -> Self {
method strict_names (line 333) | pub fn strict_names(mut self) -> Self {
method use_set_session_authorization (line 340) | pub fn use_set_session_authorization(mut self) -> Self {
method host (line 347) | pub fn host<S: AsRef<OsStr>>(mut self, hostname: S) -> Self {
method port (line 354) | pub fn port(mut self, port: u16) -> Self {
method username (line 361) | pub fn username<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method no_password (line 368) | pub fn no_password(mut self) -> Self {
method password (line 375) | pub fn password(mut self) -> Self {
method pg_password (line 382) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method role (line 389) | pub fn role<S: AsRef<OsStr>>(mut self, rolename: S) -> Self {
method get_program (line 397) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 402) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 408) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 604) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 615) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 631) | fn test_builder_new() {
function test_builder_from (line 640) | fn test_builder_from() {
function test_builder_from_socket (line 656) | fn test_builder_from_socket() {
function test_builder (line 670) | fn test_builder() {
FILE: postgresql_commands/src/pg_rewind.rs
type PgRewindBuilder (line 9) | pub struct PgRewindBuilder {
method new (line 30) | pub fn new() -> Self {
method from (line 35) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 41) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method restore_target_wal (line 48) | pub fn restore_target_wal(mut self) -> Self {
method target_pgdata (line 55) | pub fn target_pgdata<P: Into<PathBuf>>(mut self, directory: P) -> Self {
method source_pgdata (line 62) | pub fn source_pgdata<P: Into<PathBuf>>(mut self, directory: P) -> Self {
method source_server (line 69) | pub fn source_server<S: AsRef<OsStr>>(mut self, connstr: S) -> Self {
method dry_run (line 76) | pub fn dry_run(mut self) -> Self {
method no_sync (line 83) | pub fn no_sync(mut self) -> Self {
method progress (line 90) | pub fn progress(mut self) -> Self {
method write_recovery_conf (line 97) | pub fn write_recovery_conf(mut self) -> Self {
method config_file (line 104) | pub fn config_file<S: AsRef<OsStr>>(mut self, filename: S) -> Self {
method debug (line 111) | pub fn debug(mut self) -> Self {
method no_ensure_shutdown (line 118) | pub fn no_ensure_shutdown(mut self) -> Self {
method version (line 125) | pub fn version(mut self) -> Self {
method help (line 132) | pub fn help(mut self) -> Self {
method get_program (line 140) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 145) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 150) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 213) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 218) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 233) | fn test_builder_new() {
function test_builder_from (line 242) | fn test_builder_from() {
function test_builder (line 253) | fn test_builder() {
FILE: postgresql_commands/src/pg_test_fsync.rs
type PgTestFsyncBuilder (line 9) | pub struct PgTestFsyncBuilder {
method new (line 19) | pub fn new() -> Self {
method from (line 24) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 30) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method filename (line 37) | pub fn filename<S: AsRef<OsStr>>(mut self, filename: S) -> Self {
method secs_per_test (line 44) | pub fn secs_per_test(mut self, secs: usize) -> Self {
method get_program (line 52) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 57) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 62) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 79) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 84) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 99) | fn test_builder_new() {
function test_builder_from (line 108) | fn test_builder_from() {
function test_builder (line 119) | fn test_builder() {
FILE: postgresql_commands/src/pg_test_timing.rs
type PgTestTimingBuilder (line 9) | pub struct PgTestTimingBuilder {
method new (line 18) | pub fn new() -> Self {
method from (line 23) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 29) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method duration (line 36) | pub fn duration<S: AsRef<OsStr>>(mut self, duration: S) -> Self {
method get_program (line 44) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 49) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 54) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 66) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 71) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 86) | fn test_builder_new() {
function test_builder_from (line 95) | fn test_builder_from() {
function test_builder (line 106) | fn test_builder() {
FILE: postgresql_commands/src/pg_upgrade.rs
type PgUpgradeBuilder (line 9) | pub struct PgUpgradeBuilder {
method new (line 37) | pub fn new() -> Self {
method from (line 42) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 48) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method old_bindir (line 55) | pub fn old_bindir<S: AsRef<OsStr>>(mut self, old_bindir: S) -> Self {
method new_bindir (line 62) | pub fn new_bindir<S: AsRef<OsStr>>(mut self, new_bindir: S) -> Self {
method check (line 69) | pub fn check(mut self) -> Self {
method old_datadir (line 76) | pub fn old_datadir<S: AsRef<OsStr>>(mut self, old_datadir: S) -> Self {
method new_datadir (line 83) | pub fn new_datadir<S: AsRef<OsStr>>(mut self, new_datadir: S) -> Self {
method jobs (line 90) | pub fn jobs<S: AsRef<OsStr>>(mut self, jobs: S) -> Self {
method link (line 97) | pub fn link(mut self) -> Self {
method no_sync (line 104) | pub fn no_sync(mut self) -> Self {
method old_options (line 111) | pub fn old_options<S: AsRef<OsStr>>(mut self, old_options: S) -> Self {
method new_options (line 118) | pub fn new_options<S: AsRef<OsStr>>(mut self, new_options: S) -> Self {
method old_port (line 125) | pub fn old_port(mut self, old_port: u16) -> Self {
method new_port (line 132) | pub fn new_port(mut self, new_port: u16) -> Self {
method retain (line 139) | pub fn retain(mut self) -> Self {
method socketdir (line 146) | pub fn socketdir<S: AsRef<OsStr>>(mut self, socketdir: S) -> Self {
method username (line 153) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method verbose (line 160) | pub fn verbose(mut self) -> Self {
method version (line 167) | pub fn version(mut self) -> Self {
method clone (line 174) | pub fn clone(mut self) -> Self {
method copy (line 181) | pub fn copy(mut self) -> Self {
method help (line 188) | pub fn help(mut self) -> Self {
method get_program (line 196) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 201) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 206) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 304) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 309) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 324) | fn test_builder_new() {
function test_builder_from (line 333) | fn test_builder_from() {
function test_builder (line 344) | fn test_builder() {
FILE: postgresql_commands/src/pg_verifybackup.rs
type PgVerifyBackupBuilder (line 9) | pub struct PgVerifyBackupBuilder {
method new (line 27) | pub fn new() -> Self {
method from (line 32) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 38) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method exit_on_error (line 45) | pub fn exit_on_error(mut self) -> Self {
method ignore (line 52) | pub fn ignore<S: AsRef<OsStr>>(mut self, ignore: S) -> Self {
method manifest_path (line 59) | pub fn manifest_path<S: AsRef<OsStr>>(mut self, manifest_path: S) -> S...
method no_parse_wal (line 66) | pub fn no_parse_wal(mut self) -> Self {
method progress (line 73) | pub fn progress(mut self) -> Self {
method quiet (line 80) | pub fn quiet(mut self) -> Self {
method skip_checksums (line 87) | pub fn skip_checksums(mut self) -> Self {
method wal_directory (line 94) | pub fn wal_directory<S: AsRef<OsStr>>(mut self, wal_directory: S) -> S...
method version (line 101) | pub fn version(mut self) -> Self {
method help (line 108) | pub fn help(mut self) -> Self {
method get_program (line 116) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 121) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 126) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 176) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 181) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 196) | fn test_builder_new() {
function test_builder_from (line 205) | fn test_builder_from() {
function test_builder (line 216) | fn test_builder() {
FILE: postgresql_commands/src/pg_waldump.rs
type PgWalDumpBuilder (line 9) | pub struct PgWalDumpBuilder {
method new (line 35) | pub fn new() -> Self {
method from (line 40) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 46) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method backup_details (line 53) | pub fn backup_details(mut self) -> Self {
method block (line 60) | pub fn block<S: AsRef<OsStr>>(mut self, block: S) -> Self {
method end (line 67) | pub fn end<S: AsRef<OsStr>>(mut self, end: S) -> Self {
method follow (line 74) | pub fn follow(mut self) -> Self {
method fork (line 81) | pub fn fork<S: AsRef<OsStr>>(mut self, fork: S) -> Self {
method limit (line 88) | pub fn limit<S: AsRef<OsStr>>(mut self, limit: S) -> Self {
method path (line 95) | pub fn path<S: AsRef<OsStr>>(mut self, path: S) -> Self {
method quiet (line 102) | pub fn quiet(mut self) -> Self {
method rmgr (line 109) | pub fn rmgr<S: AsRef<OsStr>>(mut self, rmgr: S) -> Self {
method relation (line 116) | pub fn relation<S: AsRef<OsStr>>(mut self, relation: S) -> Self {
method start (line 123) | pub fn start<S: AsRef<OsStr>>(mut self, start: S) -> Self {
method timeline (line 130) | pub fn timeline<S: AsRef<OsStr>>(mut self, timeline: S) -> Self {
method version (line 137) | pub fn version(mut self) -> Self {
method fullpage (line 144) | pub fn fullpage(mut self) -> Self {
method xid (line 151) | pub fn xid<S: AsRef<OsStr>>(mut self, xid: S) -> Self {
method stats (line 158) | pub fn stats<S: AsRef<OsStr>>(mut self, stats: S) -> Self {
method save_fullpage (line 165) | pub fn save_fullpage<S: AsRef<OsStr>>(mut self, save_fullpage: S) -> S...
method help (line 172) | pub fn help(mut self) -> Self {
method get_program (line 180) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 185) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 190) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 281) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 286) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 301) | fn test_builder_new() {
function test_builder_from (line 310) | fn test_builder_from() {
function test_builder (line 321) | fn test_builder() {
FILE: postgresql_commands/src/pgbench.rs
type PgBenchBuilder (line 9) | pub struct PgBenchBuilder {
method new (line 63) | pub fn new() -> Self {
method from (line 68) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 82) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method initialize (line 89) | pub fn initialize(mut self) -> Self {
method init_steps (line 96) | pub fn init_steps<S: AsRef<OsStr>>(mut self, steps: S) -> Self {
method fill_factor (line 103) | pub fn fill_factor(mut self, factor: usize) -> Self {
method no_vacuum (line 110) | pub fn no_vacuum(mut self) -> Self {
method quiet (line 117) | pub fn quiet(mut self) -> Self {
method scale (line 124) | pub fn scale(mut self, scale: usize) -> Self {
method foreign_keys (line 131) | pub fn foreign_keys(mut self) -> Self {
method index_tablespace (line 138) | pub fn index_tablespace<S: AsRef<OsStr>>(mut self, tablespace: S) -> S...
method partition_method (line 145) | pub fn partition_method<S: AsRef<OsStr>>(mut self, method: S) -> Self {
method partitions (line 152) | pub fn partitions(mut self, num: usize) -> Self {
method tablespace (line 159) | pub fn tablespace<S: AsRef<OsStr>>(mut self, tablespace: S) -> Self {
method unlogged_tables (line 166) | pub fn unlogged_tables(mut self) -> Self {
method builtin (line 173) | pub fn builtin<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method file (line 180) | pub fn file<S: AsRef<OsStr>>(mut self, filename: S) -> Self {
method skip_some_updates (line 187) | pub fn skip_some_updates(mut self) -> Self {
method select_only (line 194) | pub fn select_only(mut self) -> Self {
method client (line 201) | pub fn client(mut self, num: usize) -> Self {
method connect (line 208) | pub fn connect(mut self) -> Self {
method define (line 215) | pub fn define<S: AsRef<OsStr>>(mut self, var: S) -> Self {
method jobs (line 222) | pub fn jobs(mut self, num: usize) -> Self {
method log (line 229) | pub fn log(mut self) -> Self {
method latency_limit (line 236) | pub fn latency_limit(mut self, num: usize) -> Self {
method protocol (line 243) | pub fn protocol<S: AsRef<OsStr>>(mut self, protocol: S) -> Self {
method no_vacuum_bench (line 250) | pub fn no_vacuum_bench(mut self) -> Self {
method progress (line 257) | pub fn progress(mut self, num: usize) -> Self {
method report_per_command (line 264) | pub fn report_per_command(mut self) -> Self {
method rate (line 271) | pub fn rate(mut self, num: usize) -> Self {
method scale_bench (line 278) | pub fn scale_bench(mut self, scale: usize) -> Self {
method transactions (line 285) | pub fn transactions(mut self, num: usize) -> Self {
method time (line 292) | pub fn time(mut self, num: usize) -> Self {
method vacuum_all (line 299) | pub fn vacuum_all(mut self) -> Self {
method aggregate_interval (line 306) | pub fn aggregate_interval(mut self, num: usize) -> Self {
method failures_detailed (line 313) | pub fn failures_detailed(mut self) -> Self {
method log_prefix (line 320) | pub fn log_prefix<S: AsRef<OsStr>>(mut self, prefix: S) -> Self {
method max_tries (line 327) | pub fn max_tries(mut self, num: usize) -> Self {
method progress_timestamp (line 334) | pub fn progress_timestamp(mut self) -> Self {
method random_seed (line 341) | pub fn random_seed<S: AsRef<OsStr>>(mut self, seed: S) -> Self {
method sampling_rate (line 348) | pub fn sampling_rate(mut self, rate: f64) -> Self {
method show_script (line 355) | pub fn show_script<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method verbose_errors (line 362) | pub fn verbose_errors(mut self) -> Self {
method debug (line 369) | pub fn debug(mut self) -> Self {
method host (line 376) | pub fn host<S: AsRef<OsStr>>(mut self, hostname: S) -> Self {
method port (line 383) | pub fn port(mut self, port: u16) -> Self {
method username (line 390) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method version (line 397) | pub fn version(mut self) -> Self {
method help (line 404) | pub fn help(mut self) -> Self {
method get_program (line 412) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 417) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 423) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 642) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 647) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 663) | fn test_builder_new() {
function test_builder_from (line 672) | fn test_builder_from() {
function test_builder_from_socket (line 688) | fn test_builder_from_socket() {
function test_builder (line 702) | fn test_builder() {
FILE: postgresql_commands/src/postgres.rs
type PostgresBuilder (line 8) | pub struct PostgresBuilder {
method new (line 47) | pub fn new() -> Self {
method from (line 52) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 65) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method n_buffers (line 72) | pub fn n_buffers(mut self, n_buffers: u32) -> Self {
method runtime_param (line 79) | pub fn runtime_param<S: AsRef<OsStr>>(mut self, name: S, value: S) -> ...
method print_runtime_param (line 86) | pub fn print_runtime_param<S: AsRef<OsStr>>(mut self, name: S) -> Self {
method debugging_level (line 93) | pub fn debugging_level(mut self, level: u8) -> Self {
method data_dir (line 100) | pub fn data_dir<P: Into<PathBuf>>(mut self, dir: P) -> Self {
method european_date_format (line 107) | pub fn european_date_format(mut self) -> Self {
method fsync_off (line 114) | pub fn fsync_off(mut self) -> Self {
method host (line 121) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method tcp_ip_connections (line 128) | pub fn tcp_ip_connections(mut self) -> Self {
method socket_location (line 135) | pub fn socket_location<P: Into<PathBuf>>(mut self, dir: P) -> Self {
method max_connections (line 142) | pub fn max_connections(mut self, max: u32) -> Self {
method port (line 149) | pub fn port(mut self, port: u16) -> Self {
method show_stats (line 156) | pub fn show_stats(mut self) -> Self {
method work_mem (line 163) | pub fn work_mem(mut self, mem: u32) -> Self {
method version (line 170) | pub fn version(mut self) -> Self {
method describe_config (line 177) | pub fn describe_config(mut self) -> Self {
method help (line 184) | pub fn help(mut self) -> Self {
method forbidden_plan_types (line 191) | pub fn forbidden_plan_types<S: AsRef<OsStr>>(mut self, types: S) -> Se...
method allow_system_table_changes (line 198) | pub fn allow_system_table_changes(mut self) -> Self {
method disable_system_indexes (line 205) | pub fn disable_system_indexes(mut self) -> Self {
method show_timings (line 212) | pub fn show_timings<S: AsRef<OsStr>>(mut self, timings: S) -> Self {
method send_sigabrt (line 219) | pub fn send_sigabrt(mut self) -> Self {
method wait_seconds (line 226) | pub fn wait_seconds(mut self, seconds: u32) -> Self {
method single_user_mode (line 233) | pub fn single_user_mode(mut self) -> Self {
method dbname (line 240) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method override_debugging_level (line 247) | pub fn override_debugging_level(mut self, level: u8) -> Self {
method echo_statement (line 254) | pub fn echo_statement(mut self) -> Self {
method no_newline_delimiter (line 261) | pub fn no_newline_delimiter(mut self) -> Self {
method output_file (line 268) | pub fn output_file<P: Into<PathBuf>>(mut self, file: P) -> Self {
method bootstrapping_mode (line 275) | pub fn bootstrapping_mode(mut self) -> Self {
method check_mode (line 282) | pub fn check_mode(mut self) -> Self {
method get_program (line 290) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 295) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 301) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 447) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 452) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 468) | fn test_builder_new() {
function test_builder_from (line 477) | fn test_builder_from() {
function test_builder_from_socket (line 491) | fn test_builder_from_socket() {
function test_builder (line 503) | fn test_builder() {
FILE: postgresql_commands/src/psql.rs
type PsqlBuilder (line 8) | pub struct PsqlBuilder {
method new (line 52) | pub fn new() -> Self {
method from (line 57) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 72) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method command (line 79) | pub fn command<S: AsRef<OsStr>>(mut self, command: S) -> Self {
method dbname (line 86) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method file (line 93) | pub fn file<P: Into<PathBuf>>(mut self, file: P) -> Self {
method list (line 100) | pub fn list(mut self) -> Self {
method variable (line 107) | pub fn variable<S: AsRef<OsStr>>(mut self, variable: (S, S)) -> Self {
method version (line 115) | pub fn version(mut self) -> Self {
method no_psqlrc (line 122) | pub fn no_psqlrc(mut self) -> Self {
method single_transaction (line 129) | pub fn single_transaction(mut self) -> Self {
method help (line 137) | pub fn help<S: AsRef<OsStr>>(mut self, help: S) -> Self {
method echo_all (line 144) | pub fn echo_all(mut self) -> Self {
method echo_errors (line 151) | pub fn echo_errors(mut self) -> Self {
method echo_queries (line 158) | pub fn echo_queries(mut self) -> Self {
method echo_hidden (line 165) | pub fn echo_hidden(mut self) -> Self {
method log_file (line 172) | pub fn log_file<P: Into<PathBuf>>(mut self, log_file: P) -> Self {
method no_readline (line 179) | pub fn no_readline(mut self) -> Self {
method output (line 186) | pub fn output<P: Into<PathBuf>>(mut self, output: P) -> Self {
method quiet (line 193) | pub fn quiet(mut self) -> Self {
method single_step (line 200) | pub fn single_step(mut self) -> Self {
method single_line (line 207) | pub fn single_line(mut self) -> Self {
method no_align (line 214) | pub fn no_align(mut self) -> Self {
method csv (line 221) | pub fn csv(mut self) -> Self {
method field_separator (line 228) | pub fn field_separator<S: AsRef<OsStr>>(mut self, field_separator: S) ...
method html (line 235) | pub fn html(mut self) -> Self {
method pset (line 242) | pub fn pset<S: AsRef<OsStr>>(mut self, pset: (S, S)) -> Self {
method record_separator (line 250) | pub fn record_separator<S: AsRef<OsStr>>(mut self, record_separator: S...
method tuples_only (line 257) | pub fn tuples_only(mut self) -> Self {
method table_attr (line 264) | pub fn table_attr<S: AsRef<OsStr>>(mut self, table_attr: S) -> Self {
method expanded (line 271) | pub fn expanded(mut self) -> Self {
method field_separator_zero (line 278) | pub fn field_separator_zero(mut self) -> Self {
method record_separator_zero (line 285) | pub fn record_separator_zero(mut self) -> Self {
method host (line 292) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 299) | pub fn port(mut self, port: u16) -> Self {
method username (line 306) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 313) | pub fn no_password(mut self) -> Self {
method password (line 320) | pub fn password(mut self) -> Self {
method pg_password (line 327) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 335) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 340) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 346) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 507) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 518) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 534) | fn test_builder_new() {
function test_builder_from (line 543) | fn test_builder_from() {
function test_builder_from_socket (line 559) | fn test_builder_from_socket() {
function test_builder (line 573) | fn test_builder() {
FILE: postgresql_commands/src/reindexdb.rs
type ReindexDbBuilder (line 8) | pub struct ReindexDbBuilder {
method new (line 37) | pub fn new() -> Self {
method from (line 42) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 57) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method all (line 64) | pub fn all(mut self) -> Self {
method concurrently (line 71) | pub fn concurrently(mut self) -> Self {
method dbname (line 78) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method echo (line 85) | pub fn echo(mut self) -> Self {
method index (line 92) | pub fn index<S: AsRef<OsStr>>(mut self, index: S) -> Self {
method jobs (line 99) | pub fn jobs(mut self, jobs: u32) -> Self {
method quiet (line 106) | pub fn quiet(mut self) -> Self {
method system (line 113) | pub fn system(mut self) -> Self {
method schema (line 120) | pub fn schema<S: AsRef<OsStr>>(mut self, schema: S) -> Self {
method table (line 127) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method tablespace (line 134) | pub fn tablespace<S: AsRef<OsStr>>(mut self, tablespace: S) -> Self {
method verbose (line 141) | pub fn verbose(mut self) -> Self {
method version (line 148) | pub fn version(mut self) -> Self {
method help (line 155) | pub fn help(mut self) -> Self {
method host (line 162) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 169) | pub fn port(mut self, port: u16) -> Self {
method username (line 176) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 183) | pub fn no_password(mut self) -> Self {
method password (line 190) | pub fn password(mut self) -> Self {
method pg_password (line 197) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 204) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, maintenance_db: S) ->...
method get_program (line 212) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 217) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 222) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 319) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 330) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 346) | fn test_builder_new() {
function test_builder_from (line 355) | fn test_builder_from() {
function test_builder_from_socket (line 371) | fn test_builder_from_socket() {
function test_builder (line 385) | fn test_builder() {
FILE: postgresql_commands/src/traits.rs
constant CREATE_NO_WINDOW (line 20) | const CREATE_NO_WINDOW: u32 = 0x0800_0000;
type Settings (line 23) | pub trait Settings {
method get_binary_dir (line 25) | fn get_binary_dir(&self) -> PathBuf;
method get_host (line 27) | fn get_host(&self) -> OsString;
method get_port (line 29) | fn get_port(&self) -> u16;
method get_username (line 31) | fn get_username(&self) -> OsString;
method get_password (line 33) | fn get_password(&self) -> OsString;
method get_socket_dir (line 36) | fn get_socket_dir(&self) -> Option<PathBuf> {
method get_binary_dir (line 46) | fn get_binary_dir(&self) -> PathBuf {
method get_host (line 50) | fn get_host(&self) -> OsString {
method get_port (line 54) | fn get_port(&self) -> u16 {
method get_username (line 58) | fn get_username(&self) -> OsString {
method get_password (line 62) | fn get_password(&self) -> OsString {
method get_binary_dir (line 73) | fn get_binary_dir(&self) -> PathBuf {
method get_host (line 77) | fn get_host(&self) -> OsString {
method get_port (line 81) | fn get_port(&self) -> u16 {
method get_username (line 85) | fn get_username(&self) -> OsString {
method get_password (line 89) | fn get_password(&self) -> OsString {
method get_socket_dir (line 93) | fn get_socket_dir(&self) -> Option<PathBuf> {
type TestSettings (line 42) | pub struct TestSettings;
type TestSocketSettings (line 69) | pub struct TestSocketSettings;
type CommandBuilder (line 99) | pub trait CommandBuilder: Debug {
method get_program (line 101) | fn get_program(&self) -> &'static OsStr;
method get_program_dir (line 104) | fn get_program_dir(&self) -> &Option<PathBuf>;
method get_program_file (line 107) | fn get_program_file(&self) -> PathBuf {
method get_args (line 116) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 121) | fn get_envs(&self) -> Vec<(OsString, OsString)>;
method env (line 125) | fn env<S: AsRef<OsStr>>(self, key: S, value: S) -> Self;
method build (line 128) | fn build(self) -> std::process::Command
method build_tokio (line 147) | fn build_tokio(self) -> tokio::process::Command
method get_program (line 342) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 346) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 350) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 354) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 358) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
type CommandToString (line 166) | pub trait CommandToString {
method to_command_string (line 167) | fn to_command_string(&self) -> String;
method to_command_string (line 172) | fn to_command_string(&self) -> String {
method to_command_string (line 180) | fn to_command_string(&self) -> String {
type CommandExecutor (line 188) | pub trait CommandExecutor {
method execute (line 194) | fn execute(&mut self) -> Result<(String, String)>;
method execute (line 207) | fn execute(&mut self) -> Result<(String, String)> {
type AsyncCommandExecutor (line 198) | pub trait AsyncCommandExecutor {
method execute (line 201) | async fn execute(&mut self, timeout: Option<Duration>) -> Result<(Stri...
method execute (line 248) | async fn execute(&mut self, timeout: Option<Duration>) -> Result<(Stri...
function test_command_builder_defaults (line 294) | fn test_command_builder_defaults() {
type TestCommandBuilder (line 335) | struct TestCommandBuilder {
function test_standard_command_builder (line 366) | fn test_standard_command_builder() {
function test_tokio_command_builder (line 389) | fn test_tokio_command_builder() {
function test_standard_to_command_string (line 407) | fn test_standard_to_command_string() {
function test_tokio_to_command_string (line 415) | fn test_tokio_to_command_string() {
function test_standard_command_execute (line 422) | async fn test_standard_command_execute() -> Result<()> {
function test_standard_command_execute_error (line 440) | async fn test_standard_command_execute_error() {
function test_tokio_command_execute (line 447) | async fn test_tokio_command_execute() -> Result<()> {
function test_tokio_command_execute_error (line 466) | async fn test_tokio_command_execute_error() -> Result<()> {
FILE: postgresql_commands/src/vacuumdb.rs
type VacuumDbBuilder (line 9) | pub struct VacuumDbBuilder {
method new (line 52) | pub fn new() -> Self {
method from (line 57) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 72) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method all (line 79) | pub fn all(mut self) -> Self {
method buffer_usage_limit (line 86) | pub fn buffer_usage_limit<S: AsRef<OsStr>>(mut self, buffer_usage_limi...
method dbname (line 93) | pub fn dbname<S: AsRef<OsStr>>(mut self, dbname: S) -> Self {
method disable_page_skipping (line 100) | pub fn disable_page_skipping(mut self) -> Self {
method echo (line 107) | pub fn echo(mut self) -> Self {
method full (line 114) | pub fn full(mut self) -> Self {
method freeze (line 121) | pub fn freeze(mut self) -> Self {
method force_index_cleanup (line 128) | pub fn force_index_cleanup(mut self) -> Self {
method jobs (line 135) | pub fn jobs(mut self, jobs: u32) -> Self {
method min_mxid_age (line 142) | pub fn min_mxid_age<S: AsRef<OsStr>>(mut self, min_mxid_age: S) -> Self {
method min_xid_age (line 149) | pub fn min_xid_age<S: AsRef<OsStr>>(mut self, min_xid_age: S) -> Self {
method no_index_cleanup (line 156) | pub fn no_index_cleanup(mut self) -> Self {
method no_process_main (line 163) | pub fn no_process_main(mut self) -> Self {
method no_process_toast (line 170) | pub fn no_process_toast(mut self) -> Self {
method no_truncate (line 177) | pub fn no_truncate(mut self) -> Self {
method schema (line 184) | pub fn schema<S: AsRef<OsStr>>(mut self, schema: S) -> Self {
method exclude_schema (line 191) | pub fn exclude_schema<S: AsRef<OsStr>>(mut self, exclude_schema: S) ->...
method parallel (line 198) | pub fn parallel(mut self, parallel: u32) -> Self {
method quiet (line 205) | pub fn quiet(mut self) -> Self {
method skip_locked (line 212) | pub fn skip_locked(mut self) -> Self {
method table (line 219) | pub fn table<S: AsRef<OsStr>>(mut self, table: S) -> Self {
method verbose (line 226) | pub fn verbose(mut self) -> Self {
method version (line 233) | pub fn version(mut self) -> Self {
method analyze (line 240) | pub fn analyze(mut self) -> Self {
method analyze_only (line 247) | pub fn analyze_only(mut self) -> Self {
method analyze_in_stages (line 254) | pub fn analyze_in_stages(mut self) -> Self {
method help (line 261) | pub fn help(mut self) -> Self {
method host (line 268) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 275) | pub fn port(mut self, port: u16) -> Self {
method username (line 282) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 289) | pub fn no_password(mut self) -> Self {
method password (line 296) | pub fn password(mut self) -> Self {
method pg_password (line 303) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method maintenance_db (line 310) | pub fn maintenance_db<S: AsRef<OsStr>>(mut self, maintenance_db: S) ->...
method get_program (line 318) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 323) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 329) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 481) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 492) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 508) | fn test_builder_new() {
function test_builder_from (line 517) | fn test_builder_from() {
function test_builder_from_socket (line 533) | fn test_builder_from_socket() {
function test_builder (line 547) | fn test_builder() {
FILE: postgresql_commands/src/vacuumlo.rs
type VacuumLoBuilder (line 9) | pub struct VacuumLoBuilder {
method new (line 28) | pub fn new() -> Self {
method from (line 33) | pub fn from(settings: &dyn Settings) -> Self {
method program_dir (line 48) | pub fn program_dir<P: Into<PathBuf>>(mut self, path: P) -> Self {
method limit (line 55) | pub fn limit(mut self, limit: usize) -> Self {
method dry_run (line 62) | pub fn dry_run(mut self) -> Self {
method verbose (line 69) | pub fn verbose(mut self) -> Self {
method version (line 76) | pub fn version(mut self) -> Self {
method help (line 83) | pub fn help(mut self) -> Self {
method host (line 90) | pub fn host<S: AsRef<OsStr>>(mut self, host: S) -> Self {
method port (line 97) | pub fn port(mut self, port: u16) -> Self {
method username (line 104) | pub fn username<S: AsRef<OsStr>>(mut self, username: S) -> Self {
method no_password (line 111) | pub fn no_password(mut self) -> Self {
method password (line 118) | pub fn password(mut self) -> Self {
method pg_password (line 125) | pub fn pg_password<S: AsRef<OsStr>>(mut self, pg_password: S) -> Self {
method get_program (line 133) | fn get_program(&self) -> &'static OsStr {
method get_program_dir (line 138) | fn get_program_dir(&self) -> &Option<PathBuf> {
method get_args (line 143) | fn get_args(&self) -> Vec<OsString> {
method get_envs (line 194) | fn get_envs(&self) -> Vec<(OsString, OsString)> {
method env (line 205) | fn env<S: AsRef<OsStr>>(mut self, key: S, value: S) -> Self {
function test_builder_new (line 221) | fn test_builder_new() {
function test_builder_from (line 230) | fn test_builder_from() {
function test_builder_from_socket (line 246) | fn test_builder_from_socket() {
function test_builder (line 260) | fn test_builder() {
FILE: postgresql_embedded/benches/embedded.rs
function benchmarks (line 6) | fn benchmarks(criterion: &mut Criterion) {
function bench_lifecycle (line 10) | fn bench_lifecycle(criterion: &mut Criterion) -> Result<()> {
function lifecycle (line 20) | fn lifecycle() -> Result<()> {
FILE: postgresql_embedded/build/build.rs
function main (line 7) | async fn main() -> Result<()> {
FILE: postgresql_embedded/build/bundle.rs
function stage_postgresql_archive (line 19) | pub(crate) async fn stage_postgresql_archive() -> Result<()> {
function cached_archive_path (line 88) | fn cached_archive_path(version: &Version) -> PathBuf {
function supports_github_url (line 96) | fn supports_github_url(url: &str) -> postgresql_archive::Result<bool> {
function register_custom_repository (line 102) | fn register_custom_repository() -> Result<()> {
function register_theseus_repository (line 108) | fn register_theseus_repository() -> Result<()> {
FILE: postgresql_embedded/src/blocking/postgresql.rs
type PostgreSQL (line 9) | pub struct PostgreSQL {
method new (line 17) | pub fn new(settings: Settings) -> Self {
method status (line 25) | pub fn status(&self) -> Status {
method settings (line 31) | pub fn settings(&self) -> &Settings {
method setup (line 42) | pub fn setup(&mut self) -> Result<()> {
method start (line 54) | pub fn start(&mut self) -> Result<()> {
method stop (line 65) | pub fn stop(&self) -> Result<()> {
method create_database (line 76) | pub fn create_database<S>(&self, database_name: S) -> Result<()>
method database_exists (line 90) | pub fn database_exists<S>(&self, database_name: S) -> Result<bool>
method drop_database (line 104) | pub fn drop_database<S>(&self, database_name: S) -> Result<()>
function test_postgresql (line 120) | fn test_postgresql() -> Result<()> {
FILE: postgresql_embedded/src/error.rs
type Result (line 4) | pub type Result<T, E = Error> = core::result::Result<T, E>;
type Error (line 8) | pub enum Error {
method from (line 49) | fn from(error: postgresql_archive::Error) -> Self {
method from (line 56) | fn from(error: std::io::Error) -> Self {
method from (line 63) | fn from(error: FromUtf8Error) -> Self {
function test_from_archive_error (line 75) | fn test_from_archive_error() {
function test_from_io_error (line 82) | fn test_from_io_error() {
function test_from_utf8_error (line 89) | fn test_from_utf8_error() {
FILE: postgresql_embedded/src/lib.rs
function test_version (line 206) | fn test_version() -> Result<()> {
function test_version_latest (line 213) | fn test_version_latest() {
function test_version_18 (line 218) | fn test_version_18() {
function test_version_17 (line 223) | fn test_version_17() {
function test_version_16 (line 228) | fn test_version_16() {
function test_version_15 (line 233) | fn test_version_15() {
function test_version_14 (line 239) | fn test_version_14() {
FILE: postgresql_embedded/src/postgresql.rs
constant PGDATABASE (line 28) | const PGDATABASE: &str = "PGDATABASE";
type Status (line 32) | pub enum Status {
type PostgreSQL (line 45) | pub struct PostgreSQL {
method new (line 53) | pub fn new(settings: Settings) -> Self {
method status (line 76) | pub fn status(&self) -> Status {
method settings (line 90) | pub fn settings(&self) -> &Settings {
method installed_dir (line 98) | fn installed_dir(&self) -> Option<PathBuf> {
method is_initialized (line 143) | fn is_initialized(&self) -> bool {
method is_running (line 148) | fn is_running(&self) -> bool {
method setup (line 161) | pub async fn setup(&mut self) -> Result<()> {
method install (line 183) | async fn install(&mut self) -> Result<()> {
method initialize (line 240) | async fn initialize(&mut self) -> Result<()> {
method start (line 278) | pub async fn start(&mut self) -> Result<()> {
method stop (line 350) | pub async fn stop(&self) -> Result<()> {
method get_pool (line 374) | async fn get_pool(&self) -> Result<PgPool> {
method create_database (line 388) | pub async fn create_database<S>(&self, database_name: S) -> Result<()>
method database_exists (line 418) | pub async fn database_exists<S>(&self, database_name: S) -> Result<bool>
method drop_database (line 446) | pub async fn drop_database<S>(&self, database_name: S) -> Result<()>
method execute_command (line 473) | async fn execute_command<B: CommandBuilder>(
method execute_command (line 484) | async fn execute_command<B: CommandBuilder>(
method default (line 495) | fn default() -> Self {
method drop (line 502) | fn drop(&mut self) {
FILE: postgresql_embedded/src/settings.rs
constant ARCHIVE (line 28) | pub(crate) const ARCHIVE: &[u8] = include_bytes!(concat!(env!("OUT_DIR")...
constant BOOTSTRAP_SUPERUSER (line 31) | pub const BOOTSTRAP_SUPERUSER: &str = "postgres";
constant BOOTSTRAP_DATABASE (line 33) | pub const BOOTSTRAP_DATABASE: &str = "postgres";
type Settings (line 37) | pub struct Settings {
method new (line 72) | pub fn new() -> Self {
method binary_dir (line 125) | pub fn binary_dir(&self) -> PathBuf {
method url (line 134) | pub fn url<S: AsRef<str>>(&self, database_name: S) -> String {
method from_url (line 168) | pub fn from_url<S: AsRef<str>>(url: S) -> Result<Self> {
method get_binary_dir (line 246) | fn get_binary_dir(&self) -> PathBuf {
method get_host (line 250) | fn get_host(&self) -> OsString {
method get_port (line 254) | fn get_port(&self) -> u16 {
method get_username (line 258) | fn get_username(&self) -> OsString {
method get_password (line 262) | fn get_password(&self) -> OsString {
method get_socket_dir (line 266) | fn get_socket_dir(&self) -> Option<PathBuf> {
method default (line 273) | fn default() -> Self {
type SettingsBuilder (line 305) | pub struct SettingsBuilder {
method new (line 312) | pub fn new() -> Self {
method releases_url (line 320) | pub fn releases_url<S: Into<String>>(mut self, releases_url: S) -> Self {
method version (line 327) | pub fn version(mut self, version: VersionReq) -> Self {
method installation_dir (line 334) | pub fn installation_dir<P: Into<PathBuf>>(mut self, dir: P) -> Self {
method password_file (line 341) | pub fn password_file<P: Into<PathBuf>>(mut self, path: P) -> Self {
method data_dir (line 348) | pub fn data_dir<P: Into<PathBuf>>(mut self, dir: P) -> Self {
method host (line 355) | pub fn host<S: Into<String>>(mut self, host: S) -> Self {
method port (line 362) | pub fn port(mut self, port: u16) -> Self {
method username (line 369) | pub fn username<S: Into<String>>(mut self, username: S) -> Self {
method password (line 376) | pub fn password<S: Into<String>>(mut self, password: S) -> Self {
method temporary (line 383) | pub fn temporary(mut self, temporary: bool) -> Self {
method timeout (line 390) | pub fn timeout(mut self, timeout: Option<Duration>) -> Self {
method configuration (line 397) | pub fn configuration(mut self, configuration: HashMap<String, String>)...
method config (line 404) | pub fn config<K: Into<String>, V: Into<String>>(mut self, key: K, valu...
method trust_installation_dir (line 411) | pub fn trust_installation_dir(mut self, trust: bool) -> Self {
method socket_dir (line 419) | pub fn socket_dir<P: Into<PathBuf>>(mut self, dir: P) -> Self {
method build (line 426) | pub fn build(self) -> Settings {
method default (line 432) | fn default() -> Self {
function default_version (line 439) | fn default_version() -> VersionReq {
function test_archive_version (line 458) | fn test_archive_version() {
function test_settings_new (line 463) | fn test_settings_new() {
function test_settings_url_with_socket_dir (line 491) | fn test_settings_url_with_socket_dir() {
function test_settings_from_url (line 506) | fn test_settings_from_url() -> Result<()> {
function test_settings_from_url_with_socket_dir (line 544) | fn test_settings_from_url_with_socket_dir() -> Result<()> {
function test_settings_from_url_invalid_url (line 561) | fn test_settings_from_url_invalid_url() {
function test_settings_from_url_invalid_version (line 566) | fn test_settings_from_url_invalid_version() {
function test_settings_from_url_invalid_timeout (line 571) | fn test_settings_from_url_invalid_timeout() {
function test_settings_builder_defaults (line 576) | fn test_settings_builder_defaults() {
function test_settings_builder_all_fields (line 587) | fn test_settings_builder_all_fields() {
function test_settings_builder_config_method (line 622) | fn test_settings_builder_config_method() {
function test_settings_builder_socket_dir (line 639) | fn test_settings_builder_socket_dir() {
function test_settings_builder_default (line 648) | fn test_settings_builder_default() {
FILE: postgresql_embedded/tests/blocking.rs
function test_embedded_blocking_lifecycle (line 10) | fn test_embedded_blocking_lifecycle() -> Result<()> {
FILE: postgresql_embedded/tests/dump_command.rs
function dump_command (line 10) | async fn dump_command() -> anyhow::Result<()> {
FILE: postgresql_embedded/tests/environment_variables.rs
function lifecycle (line 6) | async fn lifecycle() -> anyhow::Result<()> {
FILE: postgresql_embedded/tests/postgresql.rs
function lifecycle (line 7) | async fn lifecycle() -> Result<()> {
function test_embedded_async_lifecycle (line 37) | async fn test_embedded_async_lifecycle() -> Result<()> {
function test_temporary_database (line 42) | async fn test_temporary_database() -> Result<()> {
function test_persistent_database (line 64) | async fn test_persistent_database() -> Result<()> {
function test_persistent_database_reuse (line 90) | async fn test_persistent_database_reuse() -> Result<()> {
function postgres_concurrency (line 135) | async fn postgres_concurrency() -> Result<()> {
function test_authentication_success (line 149) | async fn test_authentication_success() -> Result<()> {
function test_authentication_invalid_username (line 166) | async fn test_authentication_invalid_username() -> Result<()> {
function test_authentication_invalid_password (line 184) | async fn test_authentication_invalid_password() -> Result<()> {
function test_username_setting (line 202) | async fn test_username_setting() -> Result<()> {
FILE: postgresql_embedded/tests/start_config.rs
function start_config (line 7) | async fn start_config() -> anyhow::Result<()> {
FILE: postgresql_embedded/tests/unix_socket.rs
function test_unix_socket_lifecycle (line 9) | async fn test_unix_socket_lifecycle() -> Result<()> {
function test_unix_socket_with_builder (line 46) | async fn test_unix_socket_with_builder() -> Result<()> {
function test_unix_socket_temporary_cleanup (line 75) | async fn test_unix_socket_temporary_cleanup() -> Result<()> {
function test_unix_socket_url_format (line 101) | fn test_unix_socket_url_format() {
function test_connection_type_tcp_vs_unix_socket (line 117) | async fn test_connection_type_tcp_vs_unix_socket() -> Result<()> {
FILE: postgresql_embedded/tests/zonky.rs
function test_zonky (line 8) | async fn test_zonky() -> Result<()> {
FILE: postgresql_extensions/src/blocking/extensions.rs
function get_available_extensions (line 15) | pub fn get_available_extensions() -> Result<Vec<AvailableExtension>> {
function get_installed_extensions (line 25) | pub fn get_installed_extensions(settings: &impl Settings) -> Result<Vec<...
function install (line 35) | pub fn install(
function uninstall (line 50) | pub fn uninstall(settings: &impl Settings, namespace: &str, name: &str) ...
function test_get_installed_extensions (line 62) | fn test_get_installed_extensions() -> Result<()> {
FILE: postgresql_extensions/src/error.rs
type Result (line 4) | pub type Result<T, E = Error> = core::result::Result<T, E>;
type Error (line 8) | pub enum Error {
method from (line 37) | fn from(value: PoisonError<T>) -> Self {
function test_from_poison_error (line 47) | fn test_from_poison_error() {
FILE: postgresql_extensions/src/extensions.rs
constant CONFIGURATION_FILE (line 19) | const CONFIGURATION_FILE: &str = "postgresql_extensions.json";
function get_available_extensions (line 26) | pub async fn get_available_extensions() -> Result<Vec<AvailableExtension...
function get_installed_extensions (line 41) | pub async fn get_installed_extensions(settings: &impl Settings) -> Resul...
function install (line 58) | pub async fn install(
function uninstall (line 102) | pub async fn uninstall(settings: &impl Settings, namespace: &str, name: ...
function get_configuration_file (line 140) | async fn get_configuration_file(settings: &dyn Settings) -> Result<PathB...
function get_library_path (line 150) | async fn get_library_path(settings: &dyn Settings) -> Result<PathBuf> {
function get_shared_path (line 176) | async fn get_shared_path(settings: &dyn Settings) -> Result<PathBuf> {
function get_extension_path (line 202) | async fn get_extension_path(settings: &dyn Settings) -> Result<PathBuf> {
function get_postgresql_version (line 212) | async fn get_postgresql_version(settings: &dyn Settings) -> Result<Strin...
function execute_command (line 236) | async fn execute_command<B: CommandBuilder>(
function execute_command (line 246) | async fn execute_command<B: CommandBuilder>(
function test_get_installed_extensions (line 259) | async fn test_get_installed_extensions() -> Result<()> {
FILE: postgresql_extensions/src/matcher.rs
function tar_gz_matcher (line 13) | pub fn tar_gz_matcher(url: &str, name: &str, version: &Version) -> Resul...
function zip_matcher (line 27) | pub fn zip_matcher(url: &str, name: &str, version: &Version) -> Result<b...
function matcher (line 40) | pub fn matcher(url: &str, name: &str, _version: &Version) -> Result<bool> {
function regex (line 104) | fn regex(key: &str) -> Result<Regex> {
function test_invalid_url (line 115) | fn test_invalid_url() -> Result<()> {
function test_no_version (line 122) | fn test_no_version() -> Result<()> {
function test_invalid_version (line 128) | fn test_invalid_version() -> Result<()> {
function test_tar_gz_matcher (line 138) | fn test_tar_gz_matcher() -> Result<()> {
function test_zip_matcher (line 160) | fn test_zip_matcher() -> Result<()> {
function test_matcher_success (line 182) | fn test_matcher_success() -> Result<()> {
function test_matcher_errors (line 207) | fn test_matcher_errors() -> Result<()> {
FILE: postgresql_extensions/src/model.rs
type AvailableExtension (line 16) | pub struct AvailableExtension {
method new (line 25) | pub fn new(namespace: &str, name: &str, description: &str) -> Self {
method namespace (line 35) | pub fn namespace(&self) -> &str {
method name (line 41) | pub fn name(&self) -> &str {
method description (line 47) | pub fn description(&self) -> &str {
method fmt (line 53) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type InstalledConfiguration (line 60) | pub struct InstalledConfiguration {
method new (line 67) | pub fn new(extensions: Vec<InstalledExtension>) -> Self {
method read (line 75) | pub async fn read<P: Into<PathBuf>>(path: P) -> Result<Self> {
method write (line 103) | pub async fn write<P: Into<PathBuf>>(&self, path: P) -> Result<()> {
method extensions (line 127) | pub fn extensions(&self) -> &Vec<InstalledExtension> {
method extensions_mut (line 133) | pub fn extensions_mut(&mut self) -> &mut Vec<InstalledExtension> {
type InstalledExtension (line 140) | pub struct InstalledExtension {
method new (line 150) | pub fn new(namespace: &str, name: &str, version: Version, files: Vec<P...
method namespace (line 161) | pub fn namespace(&self) -> &str {
method name (line 167) | pub fn name(&self) -> &str {
method version (line 173) | pub fn version(&self) -> &Version {
method files (line 179) | pub fn files(&self) -> &Vec<PathBuf> {
method fmt (line 185) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type TestSettings (line 191) | pub struct TestSettings;
method get_binary_dir (line 195) | fn get_binary_dir(&self) -> PathBuf {
method get_host (line 199) | fn get_host(&self) -> OsString {
method get_port (line 203) | fn get_port(&self) -> u16 {
method get_username (line 207) | fn get_username(&self) -> OsString {
method get_password (line 211) | fn get_password(&self) -> OsString {
function test_settings (line 222) | fn test_settings() {
function test_available_extension (line 232) | fn test_available_extension() {
function test_installed_configuration (line 244) | fn test_installed_configuration() {
function test_installed_configuration_io (line 251) | async fn test_installed_configuration_io() -> Result<()> {
function test_installed_extension (line 272) | fn test_installed_extension() {
FILE: postgresql_extensions/src/repository/model.rs
type Repository (line 10) | pub trait Repository: Debug + Send + Sync {
method name (line 12) | fn name(&self) -> &str;
method get_available_extensions (line 18) | async fn get_available_extensions(&self) -> Result<Vec<AvailableExtens...
method get_archive (line 24) | async fn get_archive(
method install (line 35) | async fn install(
FILE: postgresql_extensions/src/repository/portal_corp/mod.rs
constant URL (line 3) | pub const URL: &str = "https://github.com/portalcorp";
FILE: postgresql_extensions/src/repository/portal_corp/repository.rs
type PortalCorp (line 17) | pub struct PortalCorp;
method new (line 25) | pub fn new() -> Result<Box<dyn Repository>> {
method initialize (line 33) | pub fn initialize() -> Result<()> {
method name (line 48) | fn name(&self) -> &'static str {
method get_available_extensions (line 52) | async fn get_available_extensions(&self) -> Result<Vec<AvailableExtensio...
method get_archive (line 61) | async fn get_archive(
method install (line 72) | async fn install(
function test_name (line 94) | fn test_name() {
function test_get_available_extensions (line 100) | async fn test_get_available_extensions() -> Result<()> {
FILE: postgresql_extensions/src/repository/registry.rs
type NewFn (line 16) | type NewFn = dyn Fn() -> Result<Box<dyn Repository>> + Send + Sync;
type RepositoryRegistry (line 19) | struct RepositoryRegistry {
method new (line 25) | fn new() -> Self {
method register (line 32) | fn register(&mut self, namespace: &str, new_fn: Box<NewFn>) {
method get (line 42) | fn get(&self, namespace: &str) -> Result<Box<dyn Repository>> {
method default (line 54) | fn default() -> Self {
function register (line 79) | pub fn register(namespace: &str, new_fn: Box<NewFn>) -> Result<()> {
function get (line 88) | pub fn get(namespace: &str) -> Result<Box<dyn Repository>> {
function get_namespaces (line 96) | pub fn get_namespaces() -> Result<Vec<String>> {
function get_repositories (line 104) | pub fn get_repositories() -> Result<Vec<Box<dyn Repository>>> {
type TestRepository (line 122) | struct TestRepository;
method new (line 127) | fn new() -> Result<Box<dyn Repository>> {
method name (line 134) | fn name(&self) -> &'static str {
method get_available_extensions (line 138) | async fn get_available_extensions(&self) -> Result<Vec<AvailableExtensio...
method get_archive (line 142) | async fn get_archive(
method install (line 151) | async fn install(
function test_register (line 163) | async fn test_register() -> Result<()> {
function test_get_error (line 173) | fn test_get_error() {
function test_get_portal_corp_extensions (line 180) | fn test_get_portal_corp_extensions() {
function test_get_steampipe_extensions (line 186) | fn test_get_steampipe_extensions() {
function test_get_tensor_chord_extensions (line 192) | fn test_get_tensor_chord_extensions() {
function test_get_namespaces (line 197) | fn test_get_namespaces() {
function test_get_repositories (line 208) | fn test_get_repositories() {
FILE: postgresql_extensions/src/repository/steampipe/extensions.rs
function init_extensions (line 6) | fn init_extensions() -> Vec<SteampipeExtension> {
type SteampipeExtension (line 727) | pub struct SteampipeExtension {
method new (line 734) | pub fn new(name: &str, description: &str, url: &str) -> SteampipeExten...
function get (line 743) | pub fn get<'a>() -> &'a Vec<SteampipeExtension> {
function test_get (line 752) | fn test_get() {
FILE: postgresql_extensions/src/repository/steampipe/mod.rs
constant URL (line 4) | pub const URL: &str = "https://github.com/turbot";
FILE: postgresql_extensions/src/repository/steampipe/repository.rs
type Steampipe (line 18) | pub struct Steampipe;
method new (line 26) | pub fn new() -> Result<Box<dyn Repository>> {
method initialize (line 34) | pub fn initialize() -> Result<()> {
method name (line 49) | fn name(&self) -> &'static str {
method get_available_extensions (line 53) | async fn get_available_extensions(&self) -> Result<Vec<AvailableExtensio...
method get_archive (line 67) | async fn get_archive(
method install (line 85) | async fn install(
function test_name (line 107) | fn test_name() {
function test_get_available_extensions (line 113) | async fn test_get_available_extensions() -> Result<()> {
function test_get_archive_error (line 128) | async fn test_get_archive_error() -> anyhow::Result<()> {
FILE: postgresql_extensions/src/repository/tensor_chord/mod.rs
constant URL (line 3) | pub const URL: &str = "https://github.com/tensorchord";
FILE: postgresql_extensions/src/repository/tensor_chord/repository.rs
type TensorChord (line 17) | pub struct TensorChord;
method new (line 25) | pub fn new() -> Result<Box<dyn Repository>> {
method initialize (line 33) | pub fn initialize() -> Result<()> {
method name (line 48) | fn name(&self) -> &'static str {
method get_available_extensions (line 52) | async fn get_available_extensions(&self) -> Result<Vec<AvailableExtensio...
method get_archive (line 61) | async fn get_archive(
method install (line 72) | async fn install(
function test_name (line 94) | fn test_name() {
function test_get_available_extensions (line 100) | async fn test_get_available_extensions() -> Result<()> {
FILE: postgresql_extensions/tests/blocking.rs
function test_get_available_extensions (line 6) | fn test_get_available_extensions() -> anyhow::Result<()> {
function test_extensions_blocking_lifecycle (line 25) | fn test_extensions_blocking_lifecycle() -> anyhow::Result<()> {
FILE: postgresql_extensions/tests/extensions.rs
function test_get_available_extensions (line 5) | async fn test_get_available_extensions() -> Result<()> {
function test_extensions_tensor_chord_lifecycle (line 24) | async fn test_extensions_tensor_chord_lifecycle() -> Result<()> {
FILE: postgresql_extensions/tests/portal_corp.rs
function test_extensions_portal_corp_lifecycle (line 7) | async fn test_extensions_portal_corp_lifecycle() -> anyhow::Result<()> {
FILE: postgresql_extensions/tests/steampipe.rs
function test_extensions_steampipe_lifecycle (line 4) | async fn test_extensions_steampipe_lifecycle() -> anyhow::Result<()> {
Condensed preview — 183 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (855K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 22,
"preview": "github: brianheineman\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 517,
"preview": "---\nname: \"\\U0001F41E Bug Report\"\nabout: \"If something isn't working as expected \\U0001F914.\"\ntitle: ''\nlabels: 'i: bug,"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 28,
"preview": "blank_issues_enabled: false\n"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 656,
"preview": "---\nname: \"\\U00002728 Feature Request\"\nabout: \"I have a suggestion (and may want to implement it \\U0001F642)!\"\ntitle: ''"
},
{
"path": ".github/codecov.yml",
"chars": 124,
"preview": "coverage:\n status:\n patch:\n default:\n threshold: 0.05%\n project:\n default:\n threshold: 0."
},
{
"path": ".github/dependabot.yml",
"chars": 110,
"preview": "version: 2\nupdates:\n - package-ecosystem: \"cargo\"\n directory: \"/\"\n schedule:\n interval: \"monthly\"\n"
},
{
"path": ".github/workflows/benchmarks.yml",
"chars": 1434,
"preview": "name: Benchmarks\n\non:\n push:\n branches:\n - main\n pull_request:\n types: [ opened, reopened, synchronize ]\n\np"
},
{
"path": ".github/workflows/checks.yml",
"chars": 2560,
"preview": "name: Fast checks\n\nenv:\n CARGO_TERM_COLOR: always\n RUSTFLAGS: \"-D warnings\"\n\non:\n workflow_call:\n\npermissions:\n cont"
},
{
"path": ".github/workflows/ci.yml",
"chars": 2167,
"preview": "name: ci\n\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\n\npermissions:\n contents: re"
},
{
"path": ".github/workflows/pr-benchmarks.yml",
"chars": 1012,
"preview": "name: Benchmarks\n\non:\n pull_request:\n types: [ opened, reopened, synchronize ]\n\npermissions:\n contents: read\n\njobs:"
},
{
"path": ".github/workflows/release-plz.yml",
"chars": 1364,
"preview": "name: Release-plz\n\npermissions:\n pull-requests: write\n contents: write\n\non:\n push:\n branches:\n - main\n\njobs:\n"
},
{
"path": ".gitignore",
"chars": 29,
"preview": "/target\n\n# Rust Rover\n/.idea\n"
},
{
"path": ".rustfmt.toml",
"chars": 23,
"preview": "newline_style = \"Unix\"\n"
},
{
"path": "CHANGELOG.md",
"chars": 32033,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "Cargo.toml",
"chars": 2015,
"preview": "[workspace]\ndefault-members = [\n \"postgresql_archive\",\n \"postgresql_commands\",\n \"postgresql_embedded\",\n \"pos"
},
{
"path": "LICENSE-APACHE",
"chars": 9723,
"preview": " Apache License\n Version 2.0, January 2004\n http"
},
{
"path": "LICENSE-MIT",
"chars": 1077,
"preview": "MIT License\n\nCopyright (c) 2023 Theseus contributors\n\nPermission is hereby granted, free of charge, to any\nperson obtain"
},
{
"path": "README.md",
"chars": 3699,
"preview": "<p align=\"center\"><img width=\"250\" height=\"250\" src=\"images/logo.png\"></p>\n\n# PostgreSQL Embedded\n\n[]\n#![forbid(clippy::allow_attributes)]\n#![deny(clippy::pedantic)]\n\nuse postgresql_archive::configu"
},
{
"path": "examples/archive_sync/Cargo.toml",
"chars": 255,
"preview": "[package]\nedition.workspace = true\nname = \"archive_sync\"\npublish = false\nlicense.workspace = true\nversion.workspace = tr"
},
{
"path": "examples/archive_sync/src/main.rs",
"chars": 664,
"preview": "use postgresql_archive::blocking::{extract, get_archive};\nuse postgresql_archive::configuration::theseus;\nuse postgresql"
},
{
"path": "examples/axum_embedded/Cargo.toml",
"chars": 505,
"preview": "[package]\nedition.workspace = true\nname = \"axum_embedded\"\npublish = false\nlicense.workspace = true\nversion.workspace = t"
},
{
"path": "examples/axum_embedded/src/main.rs",
"chars": 2646,
"preview": "use anyhow::Result;\nuse axum::extract::State;\nuse axum::{Json, Router, http::StatusCode, routing::get};\nuse postgresql_e"
},
{
"path": "examples/diesel_embedded/Cargo.toml",
"chars": 382,
"preview": "[package]\nedition.workspace = true\nname = \"diesel_embedded\"\npublish = false\nlicense.workspace = true\nversion.workspace ="
},
{
"path": "examples/diesel_embedded/README.md",
"chars": 147,
"preview": "This example is taken from [Getting Started with Diesel](https://diesel.rs/guides/getting-started)\nand modified to work "
},
{
"path": "examples/diesel_embedded/diesel.toml",
"chars": 255,
"preview": "# For documentation on how to configure this file,\n# see https://diesel.rs/guides/configuring-diesel-cli\n\n[print_schema]"
},
{
"path": "examples/diesel_embedded/migrations/.keep",
"chars": 0,
"preview": ""
},
{
"path": "examples/diesel_embedded/migrations/2024-08-17-200823_create_posts/down.sql",
"chars": 17,
"preview": "DROP TABLE posts\n"
},
{
"path": "examples/diesel_embedded/migrations/2024-08-17-200823_create_posts/up.sql",
"chars": 166,
"preview": "CREATE TABLE posts\n(\n id SERIAL PRIMARY KEY,\n title VARCHAR NOT NULL,\n body TEXT NOT NULL,\n "
},
{
"path": "examples/diesel_embedded/src/main.rs",
"chars": 2146,
"preview": "use crate::models::{NewPost, Post};\nuse diesel::r2d2::{ConnectionManager, Pool};\nuse diesel::{PgConnection, RunQueryDsl,"
},
{
"path": "examples/diesel_embedded/src/models.rs",
"chars": 397,
"preview": "use diesel::prelude::*;\n\n#[derive(Queryable, Selectable)]\n#[diesel(table_name = crate::schema::posts)]\n#[diesel(check_fo"
},
{
"path": "examples/diesel_embedded/src/schema.rs",
"chars": 137,
"preview": "diesel::table! {\n posts (id) {\n id -> Int4,\n title -> Varchar,\n body -> Text,\n published "
},
{
"path": "examples/download_progress_bar/Cargo.toml",
"chars": 431,
"preview": "[package]\nedition.workspace = true\nname = \"download_progress_bar\"\npublish = false\nlicense.workspace = true\nversion.works"
},
{
"path": "examples/download_progress_bar/src/main.rs",
"chars": 1484,
"preview": "use anyhow::Result;\nuse indicatif::ProgressStyle;\nuse postgresql_embedded::{PostgreSQL, Settings, VersionReq};\nuse traci"
},
{
"path": "examples/embedded_async/Cargo.toml",
"chars": 252,
"preview": "[package]\nedition.workspace = true\nname = \"embedded_async\"\npublish = false\nlicense.workspace = true\nversion.workspace = "
},
{
"path": "examples/embedded_async/src/main.rs",
"chars": 698,
"preview": "use postgresql_embedded::{PostgreSQL, Result, Settings, VersionReq};\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n "
},
{
"path": "examples/embedded_sync/Cargo.toml",
"chars": 226,
"preview": "[package]\nedition.workspace = true\nname = \"embedded_sync\"\npublish = false\nlicense.workspace = true\nversion.workspace = t"
},
{
"path": "examples/embedded_sync/src/main.rs",
"chars": 533,
"preview": "use postgresql_embedded::Result;\nuse postgresql_embedded::blocking::PostgreSQL;\n\nfn main() -> Result<()> {\n let mut p"
},
{
"path": "examples/portal_corp_extension/Cargo.toml",
"chars": 567,
"preview": "[package]\nedition.workspace = true\nname = \"portal_corp_extension\"\npublish = false\nlicense.workspace = true\nversion.works"
},
{
"path": "examples/portal_corp_extension/src/main.rs",
"chars": 3706,
"preview": "use anyhow::Result;\nuse indoc::indoc;\nuse pgvector::Vector;\nuse sqlx::{PgPool, Row};\nuse tracing::info;\n\nuse postgresql_"
},
{
"path": "examples/postgres_embedded/Cargo.toml",
"chars": 292,
"preview": "[package]\nedition.workspace = true\nname = \"postgres_embedded\"\npublish = false\nlicense.workspace = true\nversion.workspace"
},
{
"path": "examples/postgres_embedded/README.md",
"chars": 164,
"preview": "This example is based on [sqlx/example/todos](https://github.com/launchbadge/sqlx/tree/main/examples/postgres/todos)\nand"
},
{
"path": "examples/postgres_embedded/src/main.rs",
"chars": 2531,
"preview": "use anyhow::Result;\nuse postgres::{Client, NoTls};\nuse postgresql_embedded::blocking::PostgreSQL;\n\nfn main() -> Result<("
},
{
"path": "examples/sqlx_embedded/Cargo.toml",
"chars": 339,
"preview": "[package]\nedition.workspace = true\nname = \"sqlx_embedded\"\npublish = false\nlicense.workspace = true\nversion.workspace = t"
},
{
"path": "examples/sqlx_embedded/README.md",
"chars": 167,
"preview": "This example is taken from [sqlx/example/todos](https://github.com/launchbadge/sqlx/tree/main/examples/postgres/todos)\na"
},
{
"path": "examples/sqlx_embedded/src/main.rs",
"chars": 2469,
"preview": "use anyhow::Result;\nuse postgresql_embedded::PostgreSQL;\nuse sqlx::Row;\nuse sqlx::postgres::PgPool;\n\n#[tokio::main]\nasyn"
},
{
"path": "examples/tensor_chord_extension/Cargo.toml",
"chars": 515,
"preview": "[package]\nedition.workspace = true\nname = \"tensor_chord_extension\"\npublish = false\nlicense.workspace = true\nversion.work"
},
{
"path": "examples/tensor_chord_extension/src/main.rs",
"chars": 3960,
"preview": "use anyhow::Result;\nuse indoc::indoc;\nuse sqlx::{PgPool, Row};\nuse tracing::info;\n\nuse postgresql_embedded::{PostgreSQL,"
},
{
"path": "examples/unix_socket/Cargo.toml",
"chars": 281,
"preview": "[package]\nedition.workspace = true\nname = \"unix_socket\"\npublish = false\nlicense.workspace = true\nversion.workspace = tru"
},
{
"path": "examples/unix_socket/src/main.rs",
"chars": 1334,
"preview": "use postgresql_embedded::{PostgreSQL, Result, SettingsBuilder};\n\n#[cfg(unix)]\n#[tokio::main]\nasync fn main() -> Result<("
},
{
"path": "examples/zonky/Cargo.toml",
"chars": 350,
"preview": "[package]\nedition.workspace = true\nname = \"zonky\"\npublish = false\nlicense.workspace = true\nversion.workspace = true\n\n[de"
},
{
"path": "examples/zonky/src/main.rs",
"chars": 937,
"preview": "use postgresql_archive::VersionReq;\nuse postgresql_archive::configuration::zonky;\nuse postgresql_embedded::{PostgreSQL, "
},
{
"path": "postgresql_archive/Cargo.toml",
"chars": 2549,
"preview": "[package]\nauthors.workspace = true\ncategories.workspace = true\ndescription = \"A library for downloading and extracting P"
},
{
"path": "postgresql_archive/README.md",
"chars": 4267,
"preview": "# PostgreSQL Archive\n\n[]\n\nuse crate::error::Result;\nuse crate::{extractor, repository};\nuse r"
},
{
"path": "postgresql_archive/src/blocking/archive.rs",
"chars": 1491,
"preview": "use crate::{Version, VersionReq};\nuse std::path::{Path, PathBuf};\nuse std::sync::LazyLock;\nuse tokio::runtime::Runtime;\n"
},
{
"path": "postgresql_archive/src/blocking/mod.rs",
"chars": 68,
"preview": "mod archive;\n\npub use archive::{extract, get_archive, get_version};\n"
},
{
"path": "postgresql_archive/src/configuration/custom/matcher.rs",
"chars": 1294,
"preview": "use semver::Version;\n\n/// Matcher for PostgreSQL binaries from custom GitHub release repositories following the same\n///"
},
{
"path": "postgresql_archive/src/configuration/custom/mod.rs",
"chars": 44,
"preview": "pub mod matcher;\n\npub use matcher::matcher;\n"
},
{
"path": "postgresql_archive/src/configuration/mod.rs",
"chars": 102,
"preview": "pub mod custom;\n#[cfg(feature = \"theseus\")]\npub mod theseus;\n#[cfg(feature = \"zonky\")]\npub mod zonky;\n"
},
{
"path": "postgresql_archive/src/configuration/theseus/extractor.rs",
"chars": 3637,
"preview": "use crate::Error::Unexpected;\nuse crate::Result;\nuse crate::extractor::{ExtractDirectories, tar_gz_extract};\nuse regex_l"
},
{
"path": "postgresql_archive/src/configuration/theseus/matcher.rs",
"chars": 1417,
"preview": "use semver::Version;\n\n/// Matcher for PostgreSQL binaries from <https://github.com/theseus-rs/postgresql-binaries>\n///\n/"
},
{
"path": "postgresql_archive/src/configuration/theseus/mod.rs",
"chars": 159,
"preview": "mod extractor;\nmod matcher;\n\npub const URL: &str = \"https://github.com/theseus-rs/postgresql-binaries\";\n\npub use extract"
},
{
"path": "postgresql_archive/src/configuration/zonky/extractor.rs",
"chars": 4314,
"preview": "use crate::Error::Unexpected;\nuse crate::Result;\nuse crate::extractor::{ExtractDirectories, tar_xz_extract};\nuse regex_l"
},
{
"path": "postgresql_archive/src/configuration/zonky/matcher.rs",
"chars": 2073,
"preview": "use crate::Result;\nuse semver::Version;\nuse std::env;\n\n/// Matcher for PostgreSQL binaries from <https://github.com/zonk"
},
{
"path": "postgresql_archive/src/configuration/zonky/mod.rs",
"chars": 206,
"preview": "mod extractor;\nmod matcher;\nmod repository;\n\npub const URL: &str = \"https://github.com/zonkyio/embedded-postgres-binarie"
},
{
"path": "postgresql_archive/src/configuration/zonky/repository.rs",
"chars": 3514,
"preview": "use crate::Result;\nuse crate::configuration::zonky::matcher::{get_arch, get_os};\nuse crate::repository::Archive;\nuse cra"
},
{
"path": "postgresql_archive/src/error.rs",
"chars": 8333,
"preview": "use std::sync::PoisonError;\n\n/// PostgreSQL archive result type\npub type Result<T, E = Error> = core::result::Result<T, "
},
{
"path": "postgresql_archive/src/extractor/mod.rs",
"chars": 437,
"preview": "mod model;\npub mod registry;\n#[cfg(feature = \"tar-gz\")]\nmod tar_gz_extractor;\n#[cfg(feature = \"tar-xz\")]\nmod tar_xz_extr"
},
{
"path": "postgresql_archive/src/extractor/model.rs",
"chars": 3591,
"preview": "use crate::{Error, Result};\nuse regex_lite::Regex;\nuse std::fmt::Display;\nuse std::path::PathBuf;\n\n/// Extract directori"
},
{
"path": "postgresql_archive/src/extractor/registry.rs",
"chars": 3551,
"preview": "use crate::Error::UnsupportedExtractor;\nuse crate::Result;\n#[cfg(feature = \"theseus\")]\nuse crate::configuration::theseus"
},
{
"path": "postgresql_archive/src/extractor/tar_gz_extractor.rs",
"chars": 2763,
"preview": "use crate::Error::Unexpected;\nuse crate::Result;\nuse crate::extractor::ExtractDirectories;\nuse flate2::bufread::GzDecode"
},
{
"path": "postgresql_archive/src/extractor/tar_xz_extractor.rs",
"chars": 2770,
"preview": "use crate::Error::Unexpected;\nuse crate::Result;\nuse crate::extractor::ExtractDirectories;\nuse liblzma::bufread::XzDecod"
},
{
"path": "postgresql_archive/src/extractor/zip_extractor.rs",
"chars": 1437,
"preview": "use crate::Result;\nuse crate::extractor::ExtractDirectories;\nuse std::fs::create_dir_all;\nuse std::io::Cursor;\nuse std::"
},
{
"path": "postgresql_archive/src/hasher/md5.rs",
"chars": 537,
"preview": "use crate::Result;\nuse md5::{Digest, Md5};\n\n/// Hashes the data using MD5.\n///\n/// # Errors\n/// * If the data cannot be "
},
{
"path": "postgresql_archive/src/hasher/mod.rs",
"chars": 180,
"preview": "#[cfg(feature = \"md5\")]\npub mod md5;\npub mod registry;\n#[cfg(feature = \"sha1\")]\npub mod sha1;\n#[cfg(feature = \"sha2\")]\np"
},
{
"path": "postgresql_archive/src/hasher/registry.rs",
"chars": 5162,
"preview": "use crate::Error::UnsupportedHasher;\nuse crate::Result;\n#[cfg(feature = \"theseus\")]\nuse crate::configuration::theseus;\n#"
},
{
"path": "postgresql_archive/src/hasher/sha1.rs",
"chars": 549,
"preview": "use crate::Result;\nuse sha1::{Digest, Sha1};\n\n/// Hashes the data using SHA1.\n///\n/// # Errors\n/// * If the data cannot "
},
{
"path": "postgresql_archive/src/hasher/sha2_256.rs",
"chars": 615,
"preview": "use crate::Result;\nuse sha2::{Digest, Sha256};\n\n/// Hashes the data using SHA2-256.\n///\n/// # Errors\n/// * If the data c"
},
{
"path": "postgresql_archive/src/hasher/sha2_512.rs",
"chars": 679,
"preview": "use crate::Result;\nuse sha2::{Digest, Sha512};\n\n/// Hashes the data using SHA2-512.\n///\n/// # Errors\n/// * If the data c"
},
{
"path": "postgresql_archive/src/lib.rs",
"chars": 4740,
"preview": "//! # postgresql_archive\n//!\n//! []\nuse crate::configuration::theseus;\n"
},
{
"path": "postgresql_archive/src/repository/github/mod.rs",
"chars": 43,
"preview": "pub(crate) mod models;\npub mod repository;\n"
},
{
"path": "postgresql_archive/src/repository/github/models.rs",
"chars": 753,
"preview": "//! Structs for GitHub API responses\nuse serde::{Deserialize, Serialize};\n\n/// Represents a GitHub release\n#[derive(Clon"
},
{
"path": "postgresql_archive/src/repository/github/repository.rs",
"chars": 14134,
"preview": "use crate::Error::{\n ArchiveHashMismatch, AssetHashNotFound, AssetNotFound, RepositoryFailure, VersionNotFound,\n};\nus"
},
{
"path": "postgresql_archive/src/repository/maven/mod.rs",
"chars": 100,
"preview": "pub(crate) mod models;\npub mod repository;\n\npub const URL: &str = \"https://repo1.maven.org/maven2\";\n"
},
{
"path": "postgresql_archive/src/repository/maven/models.rs",
"chars": 1265,
"preview": "/// Maven metadata XML structure\n///\n/// ```xml\n/// <metadata>\n/// <groupId>io.zonky.test.postgres</groupId>\n/// <ar"
},
{
"path": "postgresql_archive/src/repository/maven/repository.rs",
"chars": 8422,
"preview": "use crate::Error::{ArchiveHashMismatch, RepositoryFailure, VersionNotFound};\nuse crate::repository::Archive;\nuse crate::"
},
{
"path": "postgresql_archive/src/repository/mod.rs",
"chars": 156,
"preview": "#[cfg(feature = \"github\")]\npub mod github;\n#[cfg(feature = \"maven\")]\npub mod maven;\npub mod model;\npub mod registry;\n\npu"
},
{
"path": "postgresql_archive/src/repository/model.rs",
"chars": 2268,
"preview": "use async_trait::async_trait;\nuse semver::{Version, VersionReq};\nuse std::fmt::Debug;\n\n/// A trait for archive repositor"
},
{
"path": "postgresql_archive/src/repository/registry.rs",
"chars": 4730,
"preview": "use crate::Error::UnsupportedRepository;\nuse crate::Result;\n#[cfg(feature = \"theseus\")]\nuse crate::configuration::theseu"
},
{
"path": "postgresql_archive/src/version.rs",
"chars": 3722,
"preview": "use crate::Result;\nuse semver::{Version, VersionReq};\n\n/// A trait for getting the exact version from a [version require"
},
{
"path": "postgresql_archive/tests/archive.rs",
"chars": 1873,
"preview": "use postgresql_archive::configuration::theseus;\nuse postgresql_archive::extract;\nuse postgresql_archive::{get_archive, g"
},
{
"path": "postgresql_archive/tests/blocking.rs",
"chars": 1094,
"preview": "#[cfg(feature = \"blocking\")]\nuse postgresql_archive::VersionReq;\n#[cfg(feature = \"blocking\")]\nuse postgresql_archive::bl"
},
{
"path": "postgresql_archive/tests/zonky.rs",
"chars": 1766,
"preview": "#[cfg(feature = \"zonky\")]\nuse postgresql_archive::configuration::zonky;\n#[cfg(feature = \"zonky\")]\nuse postgresql_archive"
},
{
"path": "postgresql_commands/Cargo.toml",
"chars": 780,
"preview": "[package]\nauthors.workspace = true\ncategories.workspace = true\ndescription = \"PostgreSQL commands for interacting with a"
},
{
"path": "postgresql_commands/README.md",
"chars": 2061,
"preview": "# PostgreSQL Commands\n\n[]\nmod bundle;\n\nuse anyhow::Result;\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n #[cfg(f"
},
{
"path": "postgresql_embedded/build/bundle.rs",
"chars": 4324,
"preview": "#![allow(dead_code)]\n\nuse anyhow::Result;\nuse postgresql_archive::configuration::{custom, theseus};\nuse postgresql_archi"
},
{
"path": "postgresql_embedded/src/blocking/mod.rs",
"chars": 49,
"preview": "mod postgresql;\n\npub use postgresql::PostgreSQL;\n"
},
{
"path": "postgresql_embedded/src/blocking/postgresql.rs",
"chars": 3766,
"preview": "use crate::{Result, Settings, Status};\nuse std::sync::LazyLock;\nuse tokio::runtime::Runtime;\n\nstatic RUNTIME: LazyLock<R"
},
{
"path": "postgresql_embedded/src/error.rs",
"chars": 3306,
"preview": "use std::string::FromUtf8Error;\n\n/// `PostgreSQL` embedded result type\npub type Result<T, E = Error> = core::result::Res"
},
{
"path": "postgresql_embedded/src/lib.rs",
"chars": 8167,
"preview": "//! # postgresql_embedded\n//!\n//! []\nuse postgresql_archiv"
},
{
"path": "postgresql_embedded/tests/blocking.rs",
"chars": 1155,
"preview": "#[cfg(feature = \"blocking\")]\nuse postgresql_embedded::blocking::PostgreSQL;\n#[cfg(feature = \"blocking\")]\nuse postgresql_"
},
{
"path": "postgresql_embedded/tests/dump_command.rs",
"chars": 1247,
"preview": "use postgresql_commands::pg_dump::PgDumpBuilder;\nuse postgresql_commands::psql::PsqlBuilder;\nuse postgresql_commands::{C"
},
{
"path": "postgresql_embedded/tests/environment_variables.rs",
"chars": 820,
"preview": "use postgresql_embedded::{PostgreSQL, Status};\nuse std::env;\nuse test_log::test;\n\n#[test(tokio::test)]\nasync fn lifecycl"
},
{
"path": "postgresql_embedded/tests/postgresql.rs",
"chars": 6388,
"preview": "use postgresql_commands::CommandBuilder;\nuse postgresql_commands::psql::PsqlBuilder;\nuse postgresql_embedded::{PostgreSQ"
},
{
"path": "postgresql_embedded/tests/start_config.rs",
"chars": 973,
"preview": "use postgresql_embedded::{BOOTSTRAP_DATABASE, PostgreSQL, Settings};\nuse sqlx::{PgPool, Row};\nuse std::collections::Hash"
},
{
"path": "postgresql_embedded/tests/unix_socket.rs",
"chars": 6769,
"preview": "#[cfg(unix)]\nmod unix_socket_tests {\n use postgresql_embedded::{PostgreSQL, Result, SettingsBuilder, Status};\n use"
},
{
"path": "postgresql_embedded/tests/zonky.rs",
"chars": 1266,
"preview": "#[cfg(feature = \"zonky\")]\nuse postgresql_archive::configuration::zonky;\n#[cfg(feature = \"zonky\")]\nuse postgresql_embedde"
},
{
"path": "postgresql_extensions/Cargo.toml",
"chars": 2052,
"preview": "[package]\nauthors.workspace = true\ncategories.workspace = true\ndescription = \"A library for managing PostgreSQL extensio"
},
{
"path": "postgresql_extensions/README.md",
"chars": 3104,
"preview": "# PostgreSQL Extensions\n\n[]\nuse crate::model::AvailableExtension;\nuse crate::{InstalledExtension, Result};\nuse postgresql_comma"
},
{
"path": "postgresql_extensions/src/blocking/mod.rs",
"chars": 111,
"preview": "mod extensions;\n\npub use extensions::{get_available_extensions, get_installed_extensions, install, uninstall};\n"
},
{
"path": "postgresql_extensions/src/error.rs",
"chars": 1572,
"preview": "use std::sync::PoisonError;\n\n/// PostgreSQL extensions result type\npub type Result<T, E = Error> = core::result::Result<"
},
{
"path": "postgresql_extensions/src/extensions.rs",
"chars": 9549,
"preview": "use crate::Error::IoError;\nuse crate::model::AvailableExtension;\nuse crate::repository::registry;\nuse crate::repository:"
},
{
"path": "postgresql_extensions/src/lib.rs",
"chars": 3978,
"preview": "//! # PostgreSQL Extensions\n//!\n//! []\nuse"
},
{
"path": "postgresql_extensions/src/repository/mod.rs",
"chars": 218,
"preview": "pub mod model;\n#[cfg(feature = \"portal-corp\")]\npub mod portal_corp;\npub mod registry;\n#[cfg(feature = \"steampipe\")]\npub "
},
{
"path": "postgresql_extensions/src/repository/model.rs",
"chars": 1216,
"preview": "use crate::Result;\nuse crate::model::AvailableExtension;\nuse async_trait::async_trait;\nuse semver::{Version, VersionReq}"
},
{
"path": "postgresql_extensions/src/repository/portal_corp/mod.rs",
"chars": 76,
"preview": "pub mod repository;\n\npub const URL: &str = \"https://github.com/portalcorp\";\n"
},
{
"path": "postgresql_extensions/src/repository/portal_corp/repository.rs",
"chars": 3199,
"preview": "use crate::Result;\nuse crate::matcher::zip_matcher;\nuse crate::model::AvailableExtension;\nuse crate::repository::Reposit"
},
{
"path": "postgresql_extensions/src/repository/registry.rs",
"chars": 6576,
"preview": "use crate::Error::UnsupportedNamespace;\nuse crate::Result;\nuse crate::repository::model::Repository;\n#[cfg(feature = \"po"
},
{
"path": "postgresql_extensions/src/repository/steampipe/extensions.rs",
"chars": 33273,
"preview": "use std::sync::LazyLock;\n\nstatic EXTENSIONS: LazyLock<Vec<SteampipeExtension>> = LazyLock::new(init_extensions);\n\n#[expe"
},
{
"path": "postgresql_extensions/src/repository/steampipe/mod.rs",
"chars": 88,
"preview": "mod extensions;\npub mod repository;\n\npub const URL: &str = \"https://github.com/turbot\";\n"
},
{
"path": "postgresql_extensions/src/repository/steampipe/repository.rs",
"chars": 4218,
"preview": "use crate::Error::ExtensionNotFound;\nuse crate::Result;\nuse crate::matcher::tar_gz_matcher;\nuse crate::model::AvailableE"
},
{
"path": "postgresql_extensions/src/repository/tensor_chord/mod.rs",
"chars": 77,
"preview": "pub mod repository;\n\npub const URL: &str = \"https://github.com/tensorchord\";\n"
},
{
"path": "postgresql_extensions/src/repository/tensor_chord/repository.rs",
"chars": 3231,
"preview": "use crate::Result;\nuse crate::matcher::zip_matcher;\nuse crate::model::AvailableExtension;\nuse crate::repository::Reposit"
},
{
"path": "postgresql_extensions/tests/blocking.rs",
"chars": 2221,
"preview": "#[cfg(feature = \"blocking\")]\nuse test_log::test;\n\n#[cfg(feature = \"blocking\")]\n#[test]\nfn test_get_available_extensions("
},
{
"path": "postgresql_extensions/tests/extensions.rs",
"chars": 2165,
"preview": "use anyhow::Result;\nuse postgresql_extensions::get_available_extensions;\n\n#[tokio::test]\nasync fn test_get_available_ext"
},
{
"path": "postgresql_extensions/tests/portal_corp.rs",
"chars": 1739,
"preview": "#[cfg(not(any(\n all(target_os = \"linux\", target_arch = \"aarch64\"),\n all(target_os = \"macos\", target_arch = \"x86_64"
},
{
"path": "postgresql_extensions/tests/steampipe.rs",
"chars": 1644,
"preview": "#[cfg(any(target_os = \"linux\", target_os = \"macos\"))]\n#[cfg(feature = \"steampipe\")]\n#[tokio::test]\nasync fn test_extensi"
},
{
"path": "release-plz.toml",
"chars": 1126,
"preview": "[workspace]\nchangelog_path = \"./CHANGELOG.md\"\ngit_release_enable = false\ngit_tag_enable = false\npr_name = \"postgresql-em"
},
{
"path": "rust-toolchain.toml",
"chars": 51,
"preview": "[toolchain]\nchannel = \"1.92.0\"\nprofile = \"default\"\n"
}
]
About this extraction
This page contains the full source code of the theseus-rs/postgresql-embedded GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 183 files (786.5 KB), approximately 199.3k tokens, and a symbol index with 1769 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.