pub struct Module {
pub name: String,
pub fields: Vec<String>,
pub belongs_to: Vec<Relation>,
}Expand description
One application module as recorded in gize.toml (ADR-009 revision).
name is the module/table name as used on disk (snake_case, e.g. users, products).
fields reuse the CLI’s name:Type grammar verbatim (see crate::field) so the
manifest and the command line share one definition of a model. belongs_to records the
module’s 1-N relationships (ADR-014).
Fields§
§name: String§fields: Vec<String>§belongs_to: Vec<Relation>Implementations§
Source§impl Module
impl Module
Sourcepub fn named(name: impl Into<String>) -> Self
pub fn named(name: impl Into<String>) -> Self
A module with just a name and no declared shape (used by gize make app, and when
upgrading a legacy names-only manifest).
Sourcepub fn model_spec(&self) -> Result<ModelSpec>
pub fn model_spec(&self) -> Result<ModelSpec>
Recover the model definition this module describes, for regenerating its code during
gize sync (ADR-009 revision). The struct name is derived from the module/table name
(posts -> Post); the fields are re-parsed from their name:Type tokens.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Module
impl<'de> Deserialize<'de> for Module
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Module
impl StructuralPartialEq for Module
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
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
Mutably borrows from an owned value. Read more
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§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.