Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

NameTypeDescription
idUuidUnique identifier for the template target.
template_idUuidID of the template associated with this target.
stack_idUuidID of the stack associated with this target.
created_atDateTime < 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

NameTypeDescription
template_idUuidID of the template to associate with a stack.
stack_idUuidID 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:

NameTypeDescription
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,
        })
    }
}