use crate::{
db::{
EntityResponse, PersistedRow,
query::{
explain::{ExplainExecutionNodeDescriptor, ExplainPlan},
fluent::load::{FluentLoadQuery, LoadQueryResult},
intent::{CompiledQuery, PlannedQuery, Query, QueryError},
trace::QueryTracePlan,
},
},
traits::{EntityKind, EntityValue},
};
pub struct PartialWindowLoadQuery<'a, E>
where
E: EntityKind,
{
inner: FluentLoadQuery<'a, E>,
}
impl<'a, E> PartialWindowLoadQuery<'a, E>
where
E: EntityKind,
{
pub(in crate::db) const fn new(inner: FluentLoadQuery<'a, E>) -> Self {
Self { inner }
}
#[doc(hidden)]
#[must_use]
pub const fn query(&self) -> &Query<E> {
self.inner.query()
}
#[must_use]
pub fn trusted_read_unchecked(mut self) -> Self {
self.inner = self.inner.trusted_read_unchecked();
self
}
pub fn explain(&self) -> Result<ExplainPlan, QueryError> {
self.inner.explain()
}
pub fn plan_hash_hex(&self) -> Result<String, QueryError> {
self.inner.plan_hash_hex()
}
pub fn trace(&self) -> Result<QueryTracePlan, QueryError> {
self.inner.trace()
}
pub fn planned(&self) -> Result<PlannedQuery<E>, QueryError> {
self.inner.planned()
}
pub fn plan(&self) -> Result<CompiledQuery<E>, QueryError> {
self.inner.plan()
}
}
impl<E> PartialWindowLoadQuery<'_, E>
where
E: PersistedRow,
{
pub fn execute(&self) -> Result<LoadQueryResult<E>, QueryError>
where
E: EntityValue,
{
self.inner.execute()
}
pub fn execute_rows(&self) -> Result<EntityResponse<E>, QueryError>
where
E: EntityValue,
{
self.inner.execute_rows()
}
pub fn explain_execution(&self) -> Result<ExplainExecutionNodeDescriptor, QueryError>
where
E: EntityValue,
{
self.inner.explain_execution()
}
pub fn explain_execution_text(&self) -> Result<String, QueryError>
where
E: EntityValue,
{
self.inner.explain_execution_text()
}
pub fn explain_execution_json(&self) -> Result<String, QueryError>
where
E: EntityValue,
{
self.inner.explain_execution_json()
}
pub fn explain_execution_verbose(&self) -> Result<String, QueryError>
where
E: EntityValue,
{
self.inner.explain_execution_verbose()
}
}