Crates.io | v_rusty_tarantool |
lib.rs | v_rusty_tarantool |
version | 0.1.5 |
source | src |
created_at | 2021-01-15 10:17:42.433025 |
updated_at | 2021-01-15 10:17:42.433025 |
description | Tarantul async client based on tokio framework |
homepage | |
repository | https://github.com/zheludkovm/RustyTarantool |
max_upload_size | |
id | 342277 |
size | 130,332 |
Ported java connector to tarantool db
https://github.com/tarantool/tarantool-java
Use tokio.io as base client framework
Call echo stored procedure
run tarantool
cd test-tarantool;tarantool init-tarantool.lua
Lua stored procedure:
function test(a,b)
return a,b,11
end
Rust client :
println!("Connect to tarantool and call simple stored procedure!");
let mut rt = Runtime::new().unwrap();
let addr = "127.0.0.1:3301".parse().unwrap();
let client = ClientConfig::new(addr, "rust", "rust").build();
let response_future = client.call_fn2("test", &("param11", "param12") , &2)
.and_then(|response| {
let res : ((String,String), (u64,), (Option<u64>,)) = response.decode_trio()?;
Ok(res)
}) ;
match rt.block_on(response_future) {
Err(e) => println!("err={:?}", e),
Ok(res) => println!("stored procedure response ={:?}", res)
}
Output :
Connect to tarantool and call simple stored procedure!
stored procedure response =(("param11", "param12"), (2,), (Some(11),))
On examples part of project you can also see more complicated example :
http server connecting to tarantool