class AzuCLI::Generate::Service

Overview

Service generator for business logic with CRUD actions

Defined in:

azu_cli/generators/service.cr

Constant Summary

OUTPUT_DIR = "./src/services"

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, action : String = "create", attributes : Hash(String, String) = {} of String => String) #

[View source]

Instance Method Detail

def ____collect_files(____files) #
Description copied from class Teeplate::FileTree

:nodoc:


[View source]
def __ecr0(____io) #

[View source]
def __ecr2(____io) #

[View source]
def __ecr4(____io) #

[View source]
def __ecr7(____io) #

[View source]
def __ecr9(____io) #

[View source]
def action : String #

[View source]
def action=(action : String) #

[View source]
def attributes : Hash(String, String) #

[View source]
def attributes=(attributes : Hash(String, String)) #

[View source]
def camel_case_name : String #

[View source]
def constructor_params : String #

Generate constructor parameters for model


[View source]
def crystal_type(attr_type : String) : String #

Get Crystal type for attribute


[View source]
def full_module_name : String #

Get the full nested module name for the service


[View source]
def generate_create_service_content : String #

[View source]
def generate_destroy_service_content : String #

[View source]
def generate_index_service_content : String #

[View source]
def generate_result_concern(output_dir : String, force : Bool = false) #

Helper method to generate Result concern directly


[View source]
def generate_service_file(output_dir : String, force : Bool = false) #

Helper method to generate service files directly


[View source]
def generate_show_service_content : String #

[View source]
def generate_update_service_content : String #

[View source]
def id_type : String #

Determine ID type based on database configuration or default to Int64


[View source]
def model_class : String #

[View source]
def module_name : String #

[View source]
def module_name=(module_name : String) #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def param_list : String #

Generate parameter list from attributes


[View source]
def render(output_dir : String, force : Bool = false, interactive : Bool = true, list : Bool = false, color : Bool = false) #

Override render to generate one file per action + Result concern


[View source]
def resource_plural : String #

[View source]
def resource_plural=(resource_plural : String) #

[View source]
def service_class_name : String #

[View source]
def snake_case_name : String #

[View source]
def snake_case_name=(snake_case_name : String) #

[View source]
def update_params : String #

Generate update parameters hash


[View source]