From 9ce43f13f8475872735b6b779500e099d88eed24 Mon Sep 17 00:00:00 2001 From: Maaz Ahmed <maaz.a@subcom.tech> Date: Wed, 29 Nov 2023 16:46:41 +0530 Subject: [PATCH] chore: update README --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c17f73d..bb5d6d1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,33 @@ # mquery (placeholder name) A Rust library for handling PROMQL (and possibly MetricsQL) queries. +# Usage Example +```rust +use mquery::{Auth, QueryManager}; +use tokio::runtime::Runtime; + +dotenv::dotenv().expect("No .env file found in working dir"); +let url = std::env::var("VM_URL").expect("VM URL not found in env"); +let token = std::env::var("VM_TOKEN").expect("VM URL not found in env"); +let rt = Runtime::new().unwrap(); +let query = "total_http_requests"; +let _response = rt + .block_on( + QueryManager::new(url.parse().unwrap()) + .auth(Auth::Bearer(token)) + .query(query), + ) + .expect("operation failed"); +} +``` + # Roadmap - [x] Basic raw queries (Instant and Ranged) - [ ] Query Builder - [ ] Basic queries - [ ] Operators - [ ] Functions +- [ ] Runtime syntax checking - [ ] Compile time syntax checking -- [ ] Deserialize to custom data types +- [ ] Deserialize to custom data types (with the help of proc-macros?) - [ ] Encapsulated raw queries with methods for constructing interpolated versions -- GitLab