br-addon 0.2.20

This is an addon
Documentation
use br_addon::action::Action;
use br_addon::module::Module;
use br_fields::Field;
use json::{object, JsonValue};

#[derive(Debug, Clone)]
pub struct {{model}} {}

impl Module for {{model}} {
    fn title(&self) -> &'static str { "{{title}}"}
    fn table(&self) -> bool {false}
    fn table_unique(&self) -> &'static [&'static str] { &[]  }
    fn table_index(&self) -> &'static [&'static [&'static str]] { &[]  }

    fn fields(&mut self) -> JsonValue {
        let fields = object! {};
        fields
    }
    fn action(&mut self, name: &str) -> Result<Box<dyn Action>, String> {
        Ok(match name {
             "table" => Box::new({{model}}Table {module: self.clone(),}),
             "add" => Box::new({{model}}Add {module: self.clone(),}),
             "del" => Box::new({{model}}Del {module: self.clone(),}),
             "get" => Box::new({{model}}Get {module: self.clone(),}),
             "put" => Box::new({{model}}Put {module: self.clone(),}),
             "select" => Box::new({{model}}Select {module: self.clone(),}),
             _ => return Err(format!("invalid action: {name}")),
        })
    }
}
mod table;
mod add;
mod del;
mod get;
mod put;
mod select;