brokkr-models::models::template_targets Rust
Structs
brokkr-models::models::template_targets::TemplateTarget
pub
Derives: Queryable, Selectable, Identifiable, AsChangeset, Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash, ToSchema, ``
Represents a template target in the database.
Fields
| Name | Type | Description |
|---|---|---|
id | Uuid | Unique identifier for the template target. |
template_id | Uuid | ID of the template associated with this target. |
stack_id | Uuid | ID of the stack associated with this target. |
created_at | DateTime < Utc > | Timestamp when the target association was created. |
brokkr-models::models::template_targets::NewTemplateTarget
pub
Derives: Insertable, Debug, Clone, Serialize, Deserialize, ToSchema
Represents a new template target to be inserted into the database.
Fields
| Name | Type | Description |
|---|---|---|
template_id | Uuid | ID of the template to associate with a stack. |
stack_id | Uuid | ID of the stack to associate with a template. |
Methods
new pub
#![allow(unused)]
fn main() {
fn new (template_id : Uuid , stack_id : Uuid) -> Result < Self , String >
}
Creates a new NewTemplateTarget instance.
Parameters:
| Name | Type | Description |
|---|---|---|
template_id | - | UUID of the template to associate with a stack. |
stack_id | - | UUID of the stack to associate with a template. |
Returns:
Returns Ok(NewTemplateTarget) if both UUIDs are valid and non-nil, otherwise returns an Err with a description of the validation failure.
Source
#![allow(unused)]
fn main() {
pub fn new(template_id: Uuid, stack_id: Uuid) -> Result<Self, String> {
// Validate template_id
if template_id.is_nil() {
return Err("Invalid template ID".to_string());
}
// Validate stack_id
if stack_id.is_nil() {
return Err("Invalid stack ID".to_string());
}
Ok(NewTemplateTarget {
template_id,
stack_id,
})
}
}