ferric_fred/
aggregation_method.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum AggregationMethod {
7 Average,
9 Sum,
11 EndOfPeriod,
13}
14
15impl AggregationMethod {
16 pub fn query_code(self) -> &'static str {
18 match self {
19 Self::Average => "avg",
20 Self::Sum => "sum",
21 Self::EndOfPeriod => "eop",
22 }
23 }
24}
25
26#[cfg(test)]
27mod tests {
28 use super::*;
29
30 #[test]
31 fn query_codes_match_fred() {
32 assert_eq!(AggregationMethod::Average.query_code(), "avg");
33 assert_eq!(AggregationMethod::Sum.query_code(), "sum");
34 assert_eq!(AggregationMethod::EndOfPeriod.query_code(), "eop");
35 }
36}