mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-10 02:28:13 -07:00
global: snapshot
This commit is contained in:
@@ -162,12 +162,12 @@ impl<T: DeserializeOwned> Endpoint<T> {{
|
||||
}}
|
||||
|
||||
/// Fetch all data points for this metric/index.
|
||||
pub fn get(&self) -> Result<Vec<T>> {{
|
||||
pub fn get(&self) -> Result<MetricData<T>> {{
|
||||
self.client.get(&self.path())
|
||||
}}
|
||||
|
||||
/// Fetch data points within a range.
|
||||
pub fn range(&self, from: Option<i64>, to: Option<i64>) -> Result<Vec<T>> {{
|
||||
pub fn range(&self, from: Option<i64>, to: Option<i64>) -> Result<MetricData<T>> {{
|
||||
let mut params = Vec::new();
|
||||
if let Some(f) = from {{ params.push(format!("from={{}}", f)); }}
|
||||
if let Some(t) = to {{ params.push(format!("to={{}}", t)); }}
|
||||
|
||||
@@ -7,8 +7,8 @@ use brk_types::TreeNode;
|
||||
|
||||
use crate::{
|
||||
ClientMetadata, LanguageSyntax, PatternField, RustSyntax, child_type_name,
|
||||
generate_tree_node_field, get_node_fields, get_pattern_instance_base, prepare_tree_node,
|
||||
to_snake_case,
|
||||
generate_leaf_field, generate_tree_node_field, get_node_fields, get_pattern_instance_base,
|
||||
prepare_tree_node, to_snake_case,
|
||||
};
|
||||
|
||||
use super::client::field_type_with_generic;
|
||||
@@ -100,16 +100,21 @@ fn generate_tree_node(
|
||||
field_name, child_struct, path_expr
|
||||
)
|
||||
.unwrap();
|
||||
} else {
|
||||
// Leaf field
|
||||
generate_tree_node_field(
|
||||
} else if let TreeNode::Leaf(leaf) = child_node {
|
||||
// Leaf field - use shared helper
|
||||
generate_leaf_field(
|
||||
output,
|
||||
&syntax,
|
||||
field_info,
|
||||
"client.clone()",
|
||||
child_name,
|
||||
leaf,
|
||||
metadata,
|
||||
" ",
|
||||
child_name,
|
||||
None,
|
||||
);
|
||||
} else {
|
||||
panic!(
|
||||
"Field '{}' is a leaf with no TreeNode::Leaf. This shouldn't happen.",
|
||||
field_info.name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ pub fn js_type_to_rust(js_type: &str) -> String {
|
||||
} else {
|
||||
match js_type {
|
||||
"string" => "String".to_string(),
|
||||
"integer" => "i64".to_string(),
|
||||
"number" => "f64".to_string(),
|
||||
"boolean" => "bool".to_string(),
|
||||
"*" => "serde_json::Value".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user