Crate sonnerie_api
source ·Expand description
This is a simple client API for Sonnerie, a timeseries database.
It lets you do a variety of insertions and reads.
Example
extern crate sonnerie_api;
fn main() -> std::io::Result<()>
{
let stream = std::net::TcpStream::connect("localhost:5599")?;
let mut client = sonnerie_api::Client::new(stream)?;
// read a series (a read transaction is automatically created and closed)
// start a write transaction
client.begin_write()?;
client.create_series("fibonacci", "u")?;
client.add_value(
"fibonacci",
&"2018-01-06T00:00:00".parse().unwrap(),
13.0,
)?;
let results: Vec<(sonnerie_api::NaiveDateTime, Vec<sonnerie_api::OwnedColumn>)> =
client.read_series("fibonacci")?;
for row in &results
{
// interpret each column as an integer
for col in &row.1 { let _: u32 = col.from(); }
}
// save the transaction
client.commit()?;
Ok(())
}Structs
Sonnerie Client API
This is a reference to a column’s value.
You can call
from to convert it to a
concrete type.A function returned by
Client::create_and_add.ISO 8601 combined date and time without timezone.
Same as
Column, except can be moved
and is heavier weight.Error for when client could not understand the server
An object returned by
Client::add_rows.Enums
Indicates what direction to search chronologically.
Traits
Functions
The maximum timestamp allowed by Sonnerie.