Crate pgstac

source ·
Expand description

Rust interface for pgstac

§Examples

Client provides an interface to query a pgstac database. It can be created from anything that implements tokio_postgres::GenericClient.

use pgstac::Client;
use tokio_postgres::NoTls;

let config = "postgresql://username:password@localhost:5432/postgis";
let (client, connection) = tokio_postgres::connect(config, NoTls).await.unwrap();
let client = Client::new(&client);

If you want to work in a transaction, you can do that too:

use stac::Collection;
let (mut client, connection) = tokio_postgres::connect(config, NoTls).await.unwrap();
let transaction = client.transaction().await.unwrap();
let client = Client::new(&transaction);
client.add_collection(Collection::new("an-id", "a description")).await.unwrap();
transaction.commit().await.unwrap();

Structs§

  • A pgstac client.
  • A page of search results.

Enums§

  • Crate-specific error enum.

Type Aliases§

  • Crate-specific result type.