Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor InfluxDbQuery to more ergonomic handling #31

Open
Empty2k12 opened this issue Oct 11, 2019 · 0 comments
Open

Refactor InfluxDbQuery to more ergonomic handling #31

Empty2k12 opened this issue Oct 11, 2019 · 0 comments

Comments

@Empty2k12
Copy link
Collaborator

This issue captures some discussion from #21

@pcpthm and @Drevoed suggest refactoring the query to something like this, removing the InfluxDbQuery trait and instead turning that into an Enum.

pub enum InfluxDbQuery {
    Write(InfluxDbWriteQuery),
    Read(InfluxDbReadQuery)
}

impl InfluxDbQuery {
    pub fn build(&self) -> Result<ValidQuery, InfluxDbError> {
        use InfluxDbQuery::*;
        
        match self {
            Write(write_query) => write_query.build(),
            Read(read_query) => read_query.build()
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants