Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Implement influx client extension #2262

Merged
merged 1 commit into from
Sep 23, 2020
Merged

Implement influx client extension #2262

merged 1 commit into from
Sep 23, 2020

Conversation

jgrund
Copy link
Member

@jgrund jgrund commented Sep 22, 2020

Implement an influx client extenstion that allows for direct
serialization to a struct instead of needing to traverse the result and
build it by hand. Ex:

struct MgsFsTime {
    time: u64,
}

let xs: Vec<MgsFsTime> = client
        .query_into(
            format!(
                r#"
            SELECT mgs_fs,is_mgs_fs
            FROM target
            WHERE mgs_fs='{}' AND is_mgs_fs=true
            ORDER BY time ASC
            LIMIT 2"#,
                fs_names
            )
            .as_str(),
            Some(Precision::Nanoseconds),
        )
        .await?
        .unwrap_or_default();

Signed-off-by: Joe Grund jgrund@whamcloud.io


This change is Reviewable

@jgrund jgrund requested a review from a team September 22, 2020 17:20
@jgrund jgrund self-assigned this Sep 22, 2020
johnsonw
johnsonw previously approved these changes Sep 22, 2020
Implement an influx client extenstion that allows for direct
serialization to a struct instead of needing to traverse the result and
build it by hand. Ex:

```rust
struct MgsFsTime {
    time: u64,
}

let xs: Vec<MgsFsTime> = client
        .query_into(
            format!(
                r#"
            SELECT mgs_fs,is_mgs_fs
            FROM target
            WHERE mgs_fs='{}' AND is_mgs_fs=true
            ORDER BY time ASC
            LIMIT 2"#,
                fs_names
            )
            .as_str(),
            Some(Precision::Nanoseconds),
        )
        .await?
        .unwrap_or_default();
```

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
@jgrund jgrund merged commit 47bdfaf into master Sep 23, 2020
@jgrund jgrund deleted the influx-client-ext branch September 23, 2020 00:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants