use darkredis::{CommandList, Connection, ResponseStream, Result, Value};
use futures::StreamExt;
#[cfg_attr(feature = "runtime_tokio", tokio::main)]
#[cfg_attr(feature = "runtime_async_std", async_std::main)]
async fn main() -> Result<()> {
let mut connection = Connection::connect("127.0.0.1:6379").await?;
let key = "some-key";
let commands = CommandList::new("SET")
.arg(&key)
.arg(b"some-value")
.command("GET")
.arg(&key)
.command("DEL")
.arg(&key);
let mut stream: ResponseStream = connection.run_commands(commands).await?;
assert_eq!(stream.next().await.unwrap().unwrap(), Value::Ok);
assert_eq!(
stream.next().await.unwrap().unwrap(),
Value::String(b"some-value".to_vec())
);
assert_eq!(stream.next().await.unwrap().unwrap(), Value::Integer(1));
Ok(())
}