pub struct PriceQuery<'a> { /* private fields */ }Expand description
Query interface for MTG card prices backed by the all_prices_today DuckDB view.
Implementations§
Source§impl<'a> PriceQuery<'a>
impl<'a> PriceQuery<'a>
Sourcepub fn new(conn: &'a Connection) -> Self
pub fn new(conn: &'a Connection) -> Self
Create a new PriceQuery bound to the given connection.
Sourcepub fn get(&self, uuid: &str) -> Result<Value>
pub fn get(&self, uuid: &str) -> Result<Value>
Get the full nested price structure for a card UUID.
Returns a nested object keyed by source -> provider -> price_type -> finish -> date -> price.
Sourcepub fn today(&self, uuid: &str, filter: &PriceFilter) -> Result<Vec<Value>>
pub fn today(&self, uuid: &str, filter: &PriceFilter) -> Result<Vec<Value>>
Get the most recent price for each provider/price_type/finish group for a card UUID.
Optionally filtered by provider, finish, and price_type via PriceFilter.
Sourcepub fn history(
&self,
uuid: &str,
date_from: Option<&str>,
date_to: Option<&str>,
filter: &PriceFilter,
) -> Result<Vec<Value>>
pub fn history( &self, uuid: &str, date_from: Option<&str>, date_to: Option<&str>, filter: &PriceFilter, ) -> Result<Vec<Value>>
Get price history for a card UUID, optionally filtered by date range and price filters.
Sourcepub fn price_trend(&self, uuid: &str, filter: &PriceFilter) -> Result<Value>
pub fn price_trend(&self, uuid: &str, filter: &PriceFilter) -> Result<Value>
Get aggregated price trend statistics for a card UUID.
Returns min_price, max_price, avg_price, first_date, last_date, data_points.
Sourcepub fn cheapest_printing(
&self,
name: &str,
filter: &PriceFilter,
) -> Result<Option<Value>>
pub fn cheapest_printing( &self, name: &str, filter: &PriceFilter, ) -> Result<Option<Value>>
Find the cheapest printing of a card by name.
Joins cards to all_prices_today and returns the printing with the lowest price.
Sourcepub fn cheapest_printings(
&self,
filter: &PriceFilter,
limit: Option<usize>,
offset: Option<usize>,
) -> Result<Vec<Value>>
pub fn cheapest_printings( &self, filter: &PriceFilter, limit: Option<usize>, offset: Option<usize>, ) -> Result<Vec<Value>>
Find the cheapest available printing of each card (global leaderboard).
Groups by card name and uses arg_min() for efficient single-pass aggregation.
Returns name, cheapest_set, cheapest_number, cheapest_uuid, min_price.
Sourcepub fn most_expensive_printings(
&self,
filter: &PriceFilter,
limit: Option<usize>,
offset: Option<usize>,
) -> Result<Vec<Value>>
pub fn most_expensive_printings( &self, filter: &PriceFilter, limit: Option<usize>, offset: Option<usize>, ) -> Result<Vec<Value>>
Find the most expensive printing of each card (global leaderboard).
Groups by card name and uses arg_max() for efficient single-pass aggregation.
Returns name, priciest_set, priciest_number, priciest_uuid, max_price.