6 releases (breaking)

0.5.1 Nov 15, 2024
0.5.0 Nov 15, 2024
0.4.0 Oct 8, 2024
0.3.0 Sep 23, 2024
0.1.0 Aug 8, 2024

#385 in Web programming

Download history 1/week @ 2024-08-17 159/week @ 2024-09-07 63/week @ 2024-09-14 187/week @ 2024-09-21 41/week @ 2024-09-28 202/week @ 2024-10-05 36/week @ 2024-10-12 1/week @ 2024-10-19 19/week @ 2024-11-02 180/week @ 2024-11-09 130/week @ 2024-11-16 8/week @ 2024-11-23 12/week @ 2024-11-30

335 downloads per month

PostgreSQL

495KB
12K SLoC

PGXN Distribution Metadata

license-badge crates-badge release-badge ci-badge cov-badge docs-badge deps-badge

The pgxn_meta crate provides PGXN Meta v1 and v2 validation and management


The PGXN Meta v1 and v2 specs define the requirements for the metadata file (META.json) file for PGXN source distribution packages. This project provides Rust a crates for working with spec META.json files, as well as PGXN-generated release META.json files.

Crate Usage

Click to show Cargo.toml.
[dependencies]
serde_json = "1.0"
pgxn_meta = "0.2"
use serde_json::json;
use pgxn_meta::dist::Distribution;

func main() {
    // Load the contents of a META.json file into a serde_json::Value.
    let meta = json!({
      "name": "pair",
      "abstract": "A key/value pair data type",
      "version": "0.1.8",
      "maintainer": "theory <theory@pgxn.org>",
      "license": "postgresql",
      "provides": {
        "pair": {
          "file": "sql/pair.sql",
          "version": "0.1.8"
        }
      },
      "meta-spec": { "version": "1.0.0" }
    });

    // Validate and load the META.json contents.
    match Distribution::try_from(meta) {
        Err(e) => panic!("Validation failed: {e}"),
        Ok(dist) => println!("Loaded {} {}", dist.name(), dist.version()),
    };
}

See the pgxn_meta docs on docs.rs for complete details.

Installation

There are several ways to install the pgxn_meta distribution META.json validation CLI.

ubi

Install the universal binary installer (ubi) and use it to install pgxn_meta and many other tools.

ubi --project pgxn/meta --exe pgxn_meta --in ~/bin

Binary Releases

Grab the appropriate binary release, untar or unzip it, and put the pgxn_meta executable somewhere in your path.

Cargo

Compile and install pgxn_meta via cargo by running:

cargo install pgxn_meta

See the cargo docs to learn where the binary will be installed.

Usage

Simply execute pgxn_meta to validate the PGXN META.json file in the current directory:

pgxn_meta

If the file has a different name, simply pass it:

pgxn_meta widget.json

Contributing

We welcome community contributions to this project. All contributors must abide by the PostgresSQL Code of Conduct.

  • Create Issues to submit bug reports and feature requests
  • Submit Pull Requests to fix issues or add features

License

This project is distributed under the PostgreSQL License.

Dependencies

~16MB
~293K SLoC