#[non_exhaustive]pub enum BuildError {
LockRequiresSelect,
DistinctOnRequiresPostgres,
EmptyInsert,
EmptyUpdate,
OffsetWithoutLimit,
LockWithUnion,
InvalidHavingOperator(String),
}Expand description
Invalid query construction, detected when compiling a
QueryBuilder.
Returned by try_to_sql /
try_compile (and the sqlx handoff twins
try_to_sqlx_query / try_to_sqlx_query_as). The panicking
to_sql path panics with this type’s
Display message.
All variants describe caller mistakes (a query that cannot be rendered as valid SQL), never internal compiler state — a web app can therefore map errors caused by end-user input (e.g. an operator or pagination parameter taken from a request) to HTTP 4XX and the rest to 5XX.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LockRequiresSelect
for_update()/for_share() on a non-SELECT query.
DistinctOnRequiresPostgres
distinct_on(...) compiled for a dialect without DISTINCT ON.
EmptyInsert
insert() with no columns.
EmptyUpdate
update() with no columns.
OffsetWithoutLimit
offset(...) without limit(...).
LockWithUnion
for_update()/for_share() combined with UNION.
InvalidHavingOperator(String)
having() received an operator outside the fixed allowlist. Carries the
rejected operator as passed by the caller.
Trait Implementations§
Source§impl Clone for BuildError
impl Clone for BuildError
Source§fn clone(&self) -> BuildError
fn clone(&self) -> BuildError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BuildError
impl Debug for BuildError
Source§impl Display for BuildError
impl Display for BuildError
impl Eq for BuildError
Source§impl Error for BuildError
impl Error for BuildError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<BuildError> for Error
impl From<BuildError> for Error
Source§fn from(e: BuildError) -> Self
fn from(e: BuildError) -> Self
Source§impl PartialEq for BuildError
impl PartialEq for BuildError
Source§fn eq(&self, other: &BuildError) -> bool
fn eq(&self, other: &BuildError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BuildError
Auto Trait Implementations§
impl Freeze for BuildError
impl RefUnwindSafe for BuildError
impl Send for BuildError
impl Sync for BuildError
impl Unpin for BuildError
impl UnsafeUnpin for BuildError
impl UnwindSafe for BuildError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more