Crate tarantool_rs
source ·Expand description
tarantool-rs
- Asyncronous Tokio-based client for Tarantool.
This crate provide async connector and necessary abstractions for interaction with Tarantool instance.
Example
use tarantool_rs::{Connection, ExecutorExt, IteratorType};
// Create connection to Tarantool instace
let conn = Connection::builder().build("127.0.0.1:3301").await?;
// Execute Lua code with one argument, returning this argument
let number: u64 = conn.eval("return ...", (42, )).await?.decode_result()?;
assert_eq!(number, 42);
// Call Lua function 'rand' (assuming it exists and return 42)
let number: u64 = conn.call("rand", ()).await?.decode_first()?;
assert_eq!(number, 42);
// Get 'clients' space with 2 fields - 'id' and 'name'
let clients_space = conn.space("clients").await?.expect("Space exists");
// Insert tuple into 'clients' space
clients_space.insert((1, "John Doe")).await?;
// Select tuples from clients space using primary index
let clients: Vec<(i64, String)> = clients_space
.select(None, None, None, (1, ))
.await?;
Features
- authorization
- evaluating Lua expressions
- remote function calling
- CRUD operations
- transaction control (begin/commit/rollback)
- reconnection in background
- SQL requests
- chunked responses
- watchers and events
- connection pooling
- automatic schema fetching and reloading
- graceful shutdown protocol support
- pre Tarantool 2.10 versions support
- customizable connection features (streams/watchers/mvcc)
- custom Tarantool MP types (UUID, …)
- …
Modules
- Errors module.
- Schema (spaces and indices) helper types.
- Various helpers.
Structs
- Tuple, returned from
call
andeval
requests. - Connection to Tarantool instance.
- Build connection to Tarantool.
- Operation in
upsert
orupdate
request. - Tuple, returned from all data-manipulation operations (insert, update, upsert, replace, delete).
- Response, returned from SQL requests.
- Abstraction, providing sequential processing of requests.
- Started transaction (docs).
- Build transaction.
Enums
- Represents all possible errors of this crate.
- Iterator type for
select
requests. - Interval parameters for background reconnection.
- Transaction isolation level.
- Represents any valid MessagePack value.
Traits
- Type, which can make requests to Tarantool and create streams and transactions.
- Helper trait around
Executor
trait, which allows to send specific requests with any type, implementingExecitor
trait. - Trait, describing type, which can be encoded into MessagePack tuple.
Type Aliases
- Alias for
std::result::Result<T, crate::Error>
.