Trait Pgstac

Source
pub trait Pgstac: GenericClient {
Show 26 methods // Provided methods async fn pgstac_version(&self) -> Result<String> { ... } async fn readonly(&self) -> Result<bool> { ... } async fn context(&self) -> Result<bool> { ... } async fn set_pgstac_setting(&self, key: &str, value: &str) -> Result<()> { ... } async fn collections(&self) -> Result<Vec<JsonValue>> { ... } async fn collection(&self, id: &str) -> Result<Option<JsonValue>> { ... } async fn add_collection<T>(&self, collection: T) -> Result<()> where T: Serialize { ... } async fn upsert_collection<T>(&self, collection: T) -> Result<()> where T: Serialize { ... } async fn update_collection_extents(&self) -> Result<()> { ... } async fn update_collection<T>(&self, collection: T) -> Result<()> where T: Serialize { ... } async fn delete_collection(&self, id: &str) -> Result<()> { ... } async fn item( &self, id: &str, collection: Option<&str>, ) -> Result<Option<JsonValue>> { ... } async fn add_item<T>(&self, item: T) -> Result<()> where T: Serialize { ... } async fn add_items<T>(&self, items: &[T]) -> Result<()> where T: Serialize { ... } async fn update_item<T>(&self, item: T) -> Result<()> where T: Serialize { ... } async fn upsert_item<T>(&self, item: T) -> Result<()> where T: Serialize { ... } async fn upsert_items<T>(&self, items: &[T]) -> Result<()> where T: Serialize { ... } async fn delete_item( &self, id: &str, collection: Option<&str>, ) -> Result<()> { ... } async fn search(&self, search: Search) -> Result<Page> { ... } async fn pgstac( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Row, Error> { ... } async fn pgstac_string( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<String> { ... } async fn pgstac_bool( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<bool> { ... } async fn pgstac_vec<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Vec<T>> where T: DeserializeOwned { ... } async fn pgstac_opt<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Option<T>> where T: DeserializeOwned { ... } async fn pgstac_value<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<T> where T: DeserializeOwned { ... } async fn pgstac_void( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<()> { ... }
}
Expand description

Methods for working with pgstac.

Provided Methods§

Source

async fn pgstac_version(&self) -> Result<String>

Returns the pgstac version.

Source

async fn readonly(&self) -> Result<bool>

Returns whether the pgstac database is readonly.

Source

async fn context(&self) -> Result<bool>

Returns the value of the context pgstac setting.

This setting defaults to “off”. See the pgstac docs for more information on the settings and their meaning.

Source

async fn set_pgstac_setting(&self, key: &str, value: &str) -> Result<()>

Sets the value of a pgstac setting.

Source

async fn collections(&self) -> Result<Vec<JsonValue>>

Fetches all collections.

Source

async fn collection(&self, id: &str) -> Result<Option<JsonValue>>

Fetches a collection by id.

Source

async fn add_collection<T>(&self, collection: T) -> Result<()>
where T: Serialize,

Adds a collection.

Source

async fn upsert_collection<T>(&self, collection: T) -> Result<()>
where T: Serialize,

Adds or updates a collection.

Source

async fn update_collection_extents(&self) -> Result<()>

Updates all collection extents.

Source

async fn update_collection<T>(&self, collection: T) -> Result<()>
where T: Serialize,

Updates a collection.

Source

async fn delete_collection(&self, id: &str) -> Result<()>

Deletes a collection.

Source

async fn item( &self, id: &str, collection: Option<&str>, ) -> Result<Option<JsonValue>>

Fetches an item.

Source

async fn add_item<T>(&self, item: T) -> Result<()>
where T: Serialize,

Adds an item.

Source

async fn add_items<T>(&self, items: &[T]) -> Result<()>
where T: Serialize,

Adds items.

Source

async fn update_item<T>(&self, item: T) -> Result<()>
where T: Serialize,

Updates an item.

Source

async fn upsert_item<T>(&self, item: T) -> Result<()>
where T: Serialize,

Upserts an item.

Source

async fn upsert_items<T>(&self, items: &[T]) -> Result<()>
where T: Serialize,

Upserts items.

To avoid having to iterate the entire slice to serialize, these items must all be serde_json::Value.

Source

async fn delete_item(&self, id: &str, collection: Option<&str>) -> Result<()>

Deletes an item.

Source

async fn search(&self, search: Search) -> Result<Page>

Searches for items.

Source

async fn pgstac( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Row, Error>

Runs a pgstac function.

Source

async fn pgstac_string( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<String>

Returns a string result from a pgstac function.

Source

async fn pgstac_bool( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<bool>

Returns a bool result from a pgstac function.

Source

async fn pgstac_vec<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Vec<T>>

Returns a vector from a pgstac function.

Source

async fn pgstac_opt<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Option<T>>

Returns an optional value from a pgstac function.

Source

async fn pgstac_value<T>( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<T>

Returns a deserializable value from a pgstac function.

Source

async fn pgstac_void( &self, function: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<()>

Returns nothing from a pgstac function.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Pgstac for T
where T: GenericClient,