Coder Social home page Coder Social logo

redis_ts's Introduction

redis_ts

crates.io Continuous integration

redis_ts provides a small trait with extension functions for the redis crate to allow working with redis time series data that can be installed as a redis module. Time series commands are available as synchronous and asynchronous versions.

The crate is called redis_ts and you can depend on it via cargo. You will also need redis in your dependencies. It has been tested against redis 0.25.2 but should work with versions higher than that.

[dependencies]
redis = "0.25.2"
redis_ts = "0.5.4"

Or via git:

[dependencies.redis_ts]
git = "https://github.com/tompro/redis_ts.git"

With async feature inherited from the redis crate (either: 'async-std-comp' or 'tokio-comp):

 [dependencies]
 redis = "0.25.2"
 redis_ts = { version = "0.5.4", features = ['tokio-comp'] }

Synchronous usage

To enable redis time series commands you simply load the redis_ts::TsCommands into the scope. All redis time series commands will then be available on your redis connection.

use redis::Commands;
use redis_ts::{TsCommands, TsOptions};

let client = redis::Client::open("redis://127.0.0.1/")?;
let mut con = client.get_connection()?;

let _:() = con.ts_create("my_ts", TsOptions::default())?;

Asynchronous usage

To enable redis time series async commands you simply load the redis_ts::TsAsyncCommands into the scope. All redis time series commands will then be available on your async redis connection.

use redis::AsyncCommands;
use redis_ts::{AsyncTsCommands, TsOptions};

let client = redis::Client::open("redis://127.0.0.1/")?;
let mut con = client.get_async_connection().await?;

let _:() = con.ts_create("my_ts", TsOptions::default()).await?;

Compatibility note

Versions >= 0.5 contains a breaking change in the argument list of range queries. With some recent additions in the Redis time series module the number of arguments for ts_range, ts_revrange, ts_mrange and ts_mrevrange have simply grown to long. All existing and the new arguments are now replaced by a single TsRangeQuery struct for which there is also a builder available.

redis_ts's People

Contributors

tompro avatar ronan22 avatar gkorland avatar avaziman avatar gamahead avatar sgaim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.