Struct leptos_query::QueryOptions
source · pub struct QueryOptions<V> {
pub default_value: Option<V>,
pub stale_time: Option<Duration>,
pub cache_time: Option<Duration>,
pub refetch_interval: Option<Duration>,
pub resource_option: ResourceOption,
}Expand description
Options for a query crate::use_query::use_query
Fields§
§default_value: Option<V>Placeholder value to use while the query is loading for the first time.
stale_time: Option<Duration>The duration that should pass before a query is considered stale.
If the query is stale, it will be refetched.
If no stale time, the query will never be considered stale.
Stale time is checked when QueryState::read is used.
Stale time can never be greater than cache_time.
Default is 0 milliseconds.
NOTE: If different stale times are used for the same key, the minimum time for the currently ACTIVE query will be used.
cache_time: Option<Duration>The amount of time a query will be cached, once it’s considered stale. If no cache time, the query will never be revoked from cache. cache_time can never be less than stale_time. Default is 5 minutes. NOTE: If different cache times are used for the same key, the minimum time will be used.
refetch_interval: Option<Duration>If no refetch interval, the query will never refetch.
resource_option: ResourceOptionDetermines which type of resource to use.
Implementations§
source§impl<V> QueryOptions<V>
impl<V> QueryOptions<V>
sourcepub fn stale_time(stale_time: Duration) -> Self
pub fn stale_time(stale_time: Duration) -> Self
QueryOption with custom stale_time.
sourcepub fn refetch_interval(refetch_interval: Duration) -> Self
pub fn refetch_interval(refetch_interval: Duration) -> Self
QueryOption with custom refetch_interval.
Trait Implementations§
source§impl<V: Clone> Clone for QueryOptions<V>
impl<V: Clone> Clone for QueryOptions<V>
source§fn clone(&self) -> QueryOptions<V>
fn clone(&self) -> QueryOptions<V>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more