[][src]Crate qldb

Amazon's QLDB Driver

Driver for Amazon's QLDB Database implemented in pure rust.

Documentation Crates.io

Example

use qldb::QLDBClient;
let client = QLDBClient::default("rust-crate-test").await?;
 
let mut map = HashMap::new();
map.insert(
    "test_column".to_string(),
    IonValue::String("test_value".to_string()),
);
IonValue::Struct(map)
 
client
    .transaction_within(|client| {
        let test_table = test_table.clone();
        async move {
             
            let _ = client
                .query(&format!("INSERT INTO {} VALUE ?", test_table), &[get_value_to_insert()])
                .await;
                 
            client.rollback().await
        }
    })
    .await?;

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

Structs

QLDBClient

It allows to start transactions. In QLDB all queries are transactions. So you always need to create a transaction for every query.

QLDBTransaction

Every query in QLDB is within a transaction. Ideally you will interact with this object via the method QLDBClient::transaction_within.

Enums

QLDBError
Region

An AWS region.

Type Definitions

QLDBResult