df-plugin 0.3.18

This is an Plugin
Documentation
use json::{JsonValue, object};
use df_plugin::{Action, actions, Model};

pub struct {{model}} {}

impl Model for {{model}} {
    fn title(&mut self) -> &'static str { "{{title}}"}
    fn table(&mut self) -> &'static str { "{{plugin_model}}"}
    fn fields(&mut self) -> JsonValue {
        let fields = object! {};
        return fields;
    }
    fn action(&mut self, name: &str) -> Box<dyn Action> {
        match name {
            "table" => Box::new({{model}}Table { model: {{model}} {} }),
            "add" => Box::new({{model}}Add { model: {{model}} {} }),
            "delete" => Box::new({{model}}Delete { model: {{model}} {} }),
            "get" => Box::new({{model}}Get { model: {{model}} {} }),
            "put" => Box::new({{model}}Put { model: {{model}} {} }),
            "select" => Box::new({{model}}Select { model: {{model}} {} }),
            _ => actions(name)
        }
    }
}

pub mod table;
pub mod add;
pub mod delete;
pub mod get;
pub mod put;
pub mod select;