Skip to main content

PriceQuery

Struct PriceQuery 

Source
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>

Source

pub fn new(conn: &'a Connection) -> Self

Create a new PriceQuery bound to the given connection.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PriceQuery<'a>

§

impl<'a> !Send for PriceQuery<'a>

§

impl<'a> !Sync for PriceQuery<'a>

§

impl<'a> !UnwindSafe for PriceQuery<'a>

§

impl<'a> Freeze for PriceQuery<'a>

§

impl<'a> Unpin for PriceQuery<'a>

§

impl<'a> UnsafeUnpin for PriceQuery<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more