pub struct ViewSpec {
pub name: String,
pub sql: String,
}Expand description
A SQL view definition (CREATE VIEW <name> AS <select>). Views are
session-scoped in the engine (not persisted to the catalog), so a view
created via a migration lives in the kit’s long-lived SQL session for the
database’s lifetime — mirroring how the daemon and long-lived apps use
MongrelDB. See Database::sql / refresh_sql_session.
Fields§
§name: String§sql: StringThe AS <select> body — the full SELECT ... statement the view
resolves to. Stored verbatim; not validated here.
Implementations§
Source§impl ViewSpec
impl ViewSpec
pub fn new(name: impl Into<String>, sql: impl Into<String>) -> ViewSpec
Sourcepub fn create_sql(&self) -> String
pub fn create_sql(&self) -> String
CREATE VIEW <name> AS <select>. The engine’s CREATE VIEW is
effectively replace-on-write (it overwrites any existing entry), so
this is also used for ReplaceView.
pub fn drop_sql(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ViewSpec
impl<'de> Deserialize<'de> for ViewSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ViewSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ViewSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ViewSpec
Source§impl Serialize for ViewSpec
impl Serialize for ViewSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ViewSpec
Auto Trait Implementations§
impl Freeze for ViewSpec
impl RefUnwindSafe for ViewSpec
impl Send for ViewSpec
impl Sync for ViewSpec
impl Unpin for ViewSpec
impl UnsafeUnpin for ViewSpec
impl UnwindSafe for ViewSpec
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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