Crate qldb[−][src]
Expand description
Amazon’s QLDB Driver
Driver for Amazon’s QLDB Database implemented in pure rust.
The driver is fairly tested and should be ready to test in real projects. We are using it internally, so we will keep it updated.
Example
use qldb::QldbClient; use std::collections::HashMap; let client = QldbClient::default("rust-crate-test", 200).await?; let mut value_to_insert = HashMap::new(); // This will insert a documents with a key "test_column" // with the value "IonValue::String(test_value)" value_to_insert.insert("test_column", "test_value"); client .transaction_within(|client| async move { client .query("INSERT INTO TestTable VALUE ?") .param(value_to_insert) .execute() .await?; Ok(()) }) .await?;
Session Pool
The driver has a session pool. The second parameter in the QldbClient::default is the maximun size of the connection pool.
Test
For tests you will need to have some AWS credentials in your PC (as env variables or in ~/.aws/credentials). There needs to be a QLDB database with the name “rust-crate-test” in the aws account. The tests need to be run sequentially, so in order to run the tests please run the following command:
RUST_TEST_THREADS=1 cargo test
Re-exports
pub use ion_binary_rs as ion; |
Structs
Cursor | Cursor allows to get all values from a statement page by page. |
Document | It contains the IonValue representing the QLDB Document. |
DocumentCollection | Represents a collection of documents. It implements so you can call in order to use it in for loops or with . |
QldbClient | It allows to start transactions. In QLDB all queries are transactions. So you always need to create a transaction for every query. |
QueryBuilder | Represents the query being built. It allows to add parameters and to execute the query. |
Transaction | Every query in QLDB is within a transaction. Ideally you will interact with this object via the method QLDBClient::transaction_within. |
Enums
QldbError | |
QldbExtractError | |
Region | An AWS region. |
Type Definitions
QldbExtractResult | |
QldbResult |