Skip to content

Commit

Permalink
feat: define basic structures and implement TimeFilter (GreptimeTeam#…
Browse files Browse the repository at this point in the history
…5086)

* feat: define basic structures and implement TimeFilter

Signed-off-by: Ruihang Xia <[email protected]>

* document column filter

Signed-off-by: Ruihang Xia <[email protected]>

* define context

Signed-off-by: Ruihang Xia <[email protected]>

* change variable name to avoid typo checker

Signed-off-by: Ruihang Xia <[email protected]>

* change error referring style

Signed-off-by: Ruihang Xia <[email protected]>

* refine context definition

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored Dec 4, 2024
1 parent ff4c153 commit 5092f5f
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"src/flow",
"src/frontend",
"src/index",
"src/log-query",
"src/log-store",
"src/meta-client",
"src/meta-srv",
Expand Down
15 changes: 15 additions & 0 deletions src/log-query/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "log-query"
version.workspace = true
edition.workspace = true
license.workspace = true

[lints]
workspace = true

[dependencies]
chrono.workspace = true
common-error.workspace = true
common-macro.workspace = true
snafu.workspace = true
table.workspace = true
46 changes: 46 additions & 0 deletions src/log-query/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::any::Any;

use common_error::ext::ErrorExt;
use common_macro::stack_trace_debug;
use snafu::Snafu;

use crate::TimeFilter;

#[derive(Snafu)]
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum Error {
#[snafu(display("Invalid time filter: {filter:?}"))]
InvalidTimeFilter { filter: TimeFilter },

#[snafu(display("Invalid date format: {input}"))]
InvalidDateFormat { input: String },

#[snafu(display("Invalid span format: {input}"))]
InvalidSpanFormat { input: String },

#[snafu(display("End time {end} is before start time {start}"))]
EndBeforeStart { start: String, end: String },
}

impl ErrorExt for Error {
fn as_any(&self) -> &dyn Any {
self
}
}

pub type Result<T> = std::result::Result<T, Error>;
18 changes: 18 additions & 0 deletions src/log-query/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod error;
mod log_query;

pub use log_query::*;
Loading

0 comments on commit 5092f5f

Please sign in to comment.