{"id":13438994,"url":"https://github.com/panoptix-za/influxdb-rs","last_synced_at":"2025-03-20T06:32:09.733Z","repository":{"id":66121508,"uuid":"80702412","full_name":"panoptix-za/influxdb-rs","owner":"panoptix-za","description":null,"archived":false,"fork":false,"pushed_at":"2017-10-24T18:09:14.000Z","size":34,"stargazers_count":8,"open_issues_count":1,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-28T00:24:12.561Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panoptix-za.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-02T07:18:09.000Z","updated_at":"2023-09-17T04:46:30.000Z","dependencies_parsed_at":"2023-05-15T08:45:30.033Z","dependency_job_id":null,"html_url":"https://github.com/panoptix-za/influxdb-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Finfluxdb-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Finfluxdb-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Finfluxdb-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Finfluxdb-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panoptix-za","download_url":"https://codeload.github.com/panoptix-za/influxdb-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566009,"owners_count":20473405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:10.263Z","updated_at":"2025-03-20T06:32:04.724Z","avatar_url":"https://github.com/panoptix-za.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","库"],"sub_categories":["Database","数据库 Database","数据库"],"readme":"# influxdb\n\ninfluxdb provides an asynchronous Rust interface to an [InfluxDB][] database.\n\nThis crate supports insertion of strings already in the InfluxDB Line Protocol.\nThe `influxdb-derive` crate provides convenient serialization of Rust structs\nto this format.\n\n[InfluxDB]: https://www.influxdata.com/\n\n## Examples\n\nTo serialize a struct into the InfluxDB Line Protocol format, use the\n`influxdb-derive` crate's macros as shown below with `MyMeasure`.\n\nThen create an instance of `influxdb::AsyncDb` and add instances of your\nstruct. Check out the code in the `examples` directory to see how this code\ninteracts with futures.\n\n```rust\nextern crate influxdb;\n#[macro_use]\nextern crate influxdb_derive;\nextern crate tokio_core;\n\nuse std::time::SystemTime;\nuse influxdb::{Measurement, AsyncDb};\n\n// `Measurement` is the trait that `AsyncDb` needs in order to insert\n#[derive(Measurement)]\n// The default measurement name will be the struct name; this optional\n// annotation allows customization of the name sent to InfluxDB.\n#[influx(rename = \"my_measure\")]\nstruct MyMeasure {\n    // Specify which struct fields are InfluxDB tags.\n    // Tags must be `String`s or `\u0026str`s.\n    #[influx(tag)]\n    region: String,\n    // Specify which struct fields are InfluxDB fields.\n    // Supported types are integers, floats, strings, and booleans.\n    // The rename annotation works with struct fields as well.\n    #[influx(field, rename = \"amount\")]\n    count: i32,\n    // Specify which struct field is the InfluxDB timestamp.\n    #[influx(timestamp)]\n    when: SystemTime,\n    // Struct fields that aren't annotated won't be sent to InfluxDB.\n    other: i32,\n}\n\nfn main() {\n    let mut core = tokio_core::reactor::Core::new()\n        .expect(\"Unable to create reactor core\");\n\n    let async_db = AsyncDb::new(\n        core.handle(),            // A tokio_core handle\n        \"http://localhost:8086/\", // URL to InfluxDB\n        \"my_database\"             // Name of the database in InfluxDB\n    ).expect(\"Unable to create AsyncDb\");\n\n    let now = SystemTime::now();\n    let batch = vec![\n        MyMeasure { region: String::from(\"us-east\"), count: 3, when: now, other: 0 },\n        MyMeasure { region: String::from(\"us-west\"), count: 20, when: now, other: 1 },\n    ];\n\n    let insert = async_db.add_data(\u0026batch); // Returns a Future\n    core.run(insert).expect(\"Unable to run future to completion\");\n}\n```\n\n## Running the tests\n\nThe tests assume that InfluxDB is running and has been configured to accept\ndata via UDP.\n\nOn macOS, you can install InfluxDB via Homebrew:\n\n```\nbrew install influxdb\n```\n\nThen add the UDP configuration by appending the provided\n`tests/influxdb.udp.conf` to the configuration file\n`/usr/local/etc/influxdb.conf` to create a local configuration file:\n\n```\ncat /usr/local/etc/influxdb.conf tests/influxdb.udp.conf \u003e influxdb.conf\n```\n\nAnd start InfluxDB with that local configuration file:\n\n```\ninfluxd -config influxdb.conf\n```\n\nOn Linux, one way to accomplish the same setup is to follow the steps in\n`.travis.yml`.\n\nOnce you have InfluxDB configured and running, run the tests:\n\n```\ncargo test\n```\n\n## Caveats\n\n- Because InfluxDB acknowledges requests by ending the HTTP session before it\n  has actually performed the requested action, occasionally tests may fail.\n  Examples include:\n  - The database has not been created when an indexing request is sent\n  - The data has not been indexed when a query request is sent\n- String escaping has not been implemented; attempting to send the following\n  characters will result in malformed Line Protocol data being sent:\n  - In measurements: commas or spaces\n  - In tag keys, tag values, and field keys: commas, equal signs, or spaces\n  - In string field values: quotes\n- Currently, queries return values as `serde_json::Value`s. This is a leaky\n  abstraction, and not all `serde_json::Value`s are possible.\n- The UDP insertion interface creates one socket per submission; this should\n  reuse the socket.\n\n## Features not currently implemented\n\n- HTTPS/TLS\n- InfluxDB Authorization\n- Chunked responses\n\n## License\n\ninfluxdb-rs is distributed under the terms of both the MIT license and the\nApache License (Version 2.0).\n\n## Authors\n\nThis crate was created by Jake Goulding and Carol (Nichols || Goulding) of\n[Integer 32][], sponsored by Stephan Buys of [Panoptix][].\n\n[Integer 32]: http://www.integer32.com/\n[Panoptix]: http://www.panoptix.co.za/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanoptix-za%2Finfluxdb-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanoptix-za%2Finfluxdb-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanoptix-za%2Finfluxdb-rs/lists"}