-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Utilize PropertyValue, so we can get both numbers and strings from in…
…to event properties
- Loading branch information
Showing
15 changed files
with
133 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ruby 3.3.5 | ||
ruby 3.3.4 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use std::collections::HashMap; | ||
|
||
use bigdecimal::BigDecimal; | ||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Default, PartialEq, Deserialize)] | ||
pub struct Event { | ||
pub code: String, | ||
pub timestamp: u64, | ||
pub properties: HashMap<String, PropertyValue>, | ||
} | ||
|
||
#[derive(Debug, PartialEq, Deserialize)] | ||
#[serde(untagged)] | ||
pub enum PropertyValue { | ||
String(String), | ||
Number(BigDecimal), | ||
} | ||
|
||
impl From<&str> for PropertyValue { | ||
fn from(value: &str) -> Self { | ||
PropertyValue::String(value.into()) | ||
} | ||
} | ||
impl From<String> for PropertyValue { | ||
fn from(value: String) -> Self { | ||
PropertyValue::String(value) | ||
} | ||
} | ||
|
||
impl From<u64> for PropertyValue { | ||
fn from(value: u64) -> Self { | ||
PropertyValue::Number(value.into()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
pub use evaluate::{EvaluationResult, Event, ExpressionValue}; | ||
pub use evaluate::{EvaluationResult, ExpressionValue}; | ||
pub use event::{Event, PropertyValue}; | ||
pub use parser::{Expression, ExpressionParser, ParseError}; | ||
pub use pest::Parser; | ||
|
||
mod evaluate; | ||
mod event; | ||
mod parser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
source "https://rubygems.org" | ||
|
||
ruby "3.3.5" | ||
ruby "3.3.4" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ DEPENDENCIES | |
rspec (~> 3) | ||
|
||
RUBY VERSION | ||
ruby 3.3.5p100 | ||
ruby 3.3.4p94 | ||
|
||
BUNDLED WITH | ||
2.5.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters