Class: Arfi::Commands::Functions
- Inherits:
-
Thor
- Object
- Thor
- Arfi::Commands::Functions
- Includes:
- FunctionsCandidates, FunctionsCreation, FunctionsHelpers, FunctionsPaths, FunctionsRendering
- Defined in:
- lib/arfi/commands/functions.rb
Overview
Thor CLI for managing SQL function files.
Instance Method Summary collapse
-
#create(function_ref) ⇒ void
steep:ignore:end Create (or overwrite with –force) a SQL function file in the appropriate directory.
-
#destroy(function_ref) ⇒ void
steep:ignore:end Delete a SQL function file from disk (supports both new and legacy locations).
-
#list ⇒ void
steep:ignore:end List SQL function files ARFI would load for the chosen adapter.
Instance Method Details
#create(function_ref) ⇒ void
This method returns an undefined value.
steep:ignore:end Create (or overwrite with –force) a SQL function file in the appropriate directory.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/arfi/commands/functions.rb', line 59 def create(function_ref) validate_schema_format! validate_adapter_option! schema, function_name = parse_function_ref(function_ref) validate_identifiers!(schema, function_name) ensure_dirs!(adapter: adapter_opt, schema: schema) content = build_sql_function(schema, function_name, original_ref: function_ref) write_file(schema, function_name, content) end |
#destroy(function_ref) ⇒ void
This method returns an undefined value.
steep:ignore:end Delete a SQL function file from disk (supports both new and legacy locations).
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/arfi/commands/functions.rb', line 87 def destroy(function_ref) validate_schema_format! validate_adapter_option! schema, function_name = parse_function_ref(function_ref) validate_identifiers!(schema, function_name) ensure_dirs!(adapter: adapter_opt, schema: schema) remove_function_file(schema, function_name) end |
#list ⇒ void
This method returns an undefined value.
steep:ignore:end List SQL function files ARFI would load for the chosen adapter.
117 118 119 120 121 122 123 124 125 |
# File 'lib/arfi/commands/functions.rb', line 117 def list validate_schema_format! validate_adapter_option! adapter = resolve_adapter rows = resolve_functions_for(adapter: adapter) render_list(rows) end |