[−][src]Struct qldb::QLDBClient
It allows to start transactions. In QLDB all queries are transactions. So you always need to create a transaction for every query.
The recommended method is transaction_within
.
Implementations
impl QLDBClient
[src]
pub async fn default(ledger_name: &str) -> QLDBResult<QLDBClient>
[src]
Creates a new QLDBClient.
This function will take the credentials from several locations in this order:
- Environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
- credential_process command in the AWS config file, usually located at ~/.aws/config.
- AWS credentials file. Usually located at ~/.aws/credentials.
- IAM instance profile. Will only work if running on an EC2 instance with an instance profile/role.
https://docs.rs/rusoto_credential/0.45.0/rusoto_credential/struct.ChainProvider.html
For the region it will will attempt to read the AWS_DEFAULT_REGION or AWS_REGION environment variable. If it is malformed, it will fall back to Region::UsEast1. If it is not present it will fallback on the value associated with the current profile in ~/.aws/config or the file specified by the AWS_CONFIG_FILE environment variable. If that is malformed of absent it will fall back on Region::UsEast1
pub async fn read_query(&self, statement: &str) -> QLDBResult<QueryBuilder>
[src]
Shorthand method that creates a transaction and executes a query. Currently it doesn't filter by statements, so any statement can be sent but it won't have effect as it will rollback any change. This allows to read big quantities of data without failing other transactions that may be reading that data at the same time.
This is a good option when you want to execute an isolated non-ACID SELECT/COUNT statement.
pub async fn transaction(&self) -> QLDBResult<Transaction>
[src]
Starts a transaction and returns you the transaction handler. When using this method the transaction won't automatically commit or rollback when finished. If they are left open they will be canceled when the transaction times out on the DB side (30 seconds).
Use this method if you really need to use the transaction handler
directly. If not, you may be better off using the method
transaction_within
.
pub async fn transaction_within<F, R, FR>(&self, clousure: F) -> QLDBResult<R> where
R: Debug,
FR: Future<Output = QLDBResult<R>>,
F: FnOnce(Transaction) -> FR,
[src]
R: Debug,
FR: Future<Output = QLDBResult<R>>,
F: FnOnce(Transaction) -> FR,
It call the closure providing an already made transaction. Once the closure finishes it will call commit or rollback if any error.
Trait Implementations
impl Clone for QLDBClient
[src]
pub fn clone(&self) -> QLDBClient
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl !RefUnwindSafe for QLDBClient
[src]
impl Send for QLDBClient
[src]
impl Sync for QLDBClient
[src]
impl Unpin for QLDBClient
[src]
impl !UnwindSafe for QLDBClient
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,