pub struct ResourceSpec {
pub kind: String,
pub name: String,
pub route: String,
pub storage: StorageSpec,
pub indexes: Vec<IndexSpec>,
pub uniques: Vec<UniqueSpec>,
pub relations: Vec<RelationSpec>,
pub api: ApiSpec,
pub policy: PolicySpec,
pub validate: ValidateSpec,
pub examples: HashMap<String, Value>,
pub events: EventSpec,
}
Expand description
Resource specification for code generation and API definition
Fields§
§kind: String
§name: String
§route: String
§storage: StorageSpec
§indexes: Vec<IndexSpec>
§uniques: Vec<UniqueSpec>
§relations: Vec<RelationSpec>
§api: ApiSpec
§policy: PolicySpec
§validate: ValidateSpec
§examples: HashMap<String, Value>
§events: EventSpec
Implementations§
Source§impl ResourceSpec
impl ResourceSpec
Sourcepub fn table_name(&self) -> &str
pub fn table_name(&self) -> &str
Get the table name for this resource
Sourcepub fn primary_key(&self) -> Option<&FieldSpec>
pub fn primary_key(&self) -> Option<&FieldSpec>
Get the primary key field specification
Sourcepub fn required_fields(&self) -> Vec<&FieldSpec>
pub fn required_fields(&self) -> Vec<&FieldSpec>
Get all required fields
Sourcepub fn indexed_fields(&self) -> Vec<&FieldSpec>
pub fn indexed_fields(&self) -> Vec<&FieldSpec>
Get all indexed fields
Sourcepub fn has_soft_delete(&self) -> bool
pub fn has_soft_delete(&self) -> bool
Check if resource has soft delete enabled
Sourcepub fn has_timestamps(&self) -> bool
pub fn has_timestamps(&self) -> bool
Check if resource has timestamps enabled
Trait Implementations§
Source§impl Clone for ResourceSpec
impl Clone for ResourceSpec
Source§fn clone(&self) -> ResourceSpec
fn clone(&self) -> ResourceSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ResourceSpec
impl Debug for ResourceSpec
Source§impl<'de> Deserialize<'de> for ResourceSpec
impl<'de> Deserialize<'de> for ResourceSpec
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
Auto Trait Implementations§
impl Freeze for ResourceSpec
impl RefUnwindSafe for ResourceSpec
impl Send for ResourceSpec
impl Sync for ResourceSpec
impl Unpin for ResourceSpec
impl UnwindSafe for ResourceSpec
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