Class: Arfi::Commands::Functions
Overview
Thor CLI for managing SQL function files.
Constant Summary
Arfi::Commands::FunctionsCandidates::DEFAULT_SCHEMA
Arfi::Commands::FunctionsPaths::DEFAULT_SCHEMA, Arfi::Commands::FunctionsPaths::ROOT_DIR
Arfi::Commands::FunctionsCreation::ADAPTERS, Arfi::Commands::FunctionsCreation::DEFAULT_SCHEMA, Arfi::Commands::FunctionsCreation::ROOT_DIR
Arfi::Commands::FunctionsHelpers::ADAPTERS, Arfi::Commands::FunctionsHelpers::DEFAULT_SCHEMA, Arfi::Commands::FunctionsHelpers::IDENT, Arfi::Commands::FunctionsHelpers::ROOT_DIR
Instance Method Summary
collapse
#adapter_candidates, #collect_postgresql_schema_candidates, #generic_candidates
#all_mode_rows, #calculate_widths, #default_mode_row, #render_table_rows, #stringify_rows, #table_columns
#adapter_canonical_path, #generic_canonical_path, #generic_function_paths, #mysql_function_paths, #postgresql_function_paths
#build_mysql_skeleton, #build_postgresql_skeleton, #evaluate_template
#check_schema_conflict!, #primary_db_config
Methods inherited from Thor
default_task, map, subcommand
Instance Method Details
#adapter_opt ⇒ String?
68
|
# File 'sig/lib/arfi/commands/functions.rbs', line 68
def adapter_opt: () -> String?
|
#build_from_file ⇒ String
60
|
# File 'sig/lib/arfi/commands/functions.rbs', line 60
def build_from_file: (String? schema, String function_name, original_ref: String) -> String
|
#build_resolved_rows ⇒ Array[::Hash[Symbol, untyped]]
94
|
# File 'sig/lib/arfi/commands/functions.rbs', line 94
def build_resolved_rows: (::Hash[String, Array[candidate]] by_key) -> Array[::Hash[Symbol, untyped]]
|
#build_sql_function ⇒ String
58
|
# File 'sig/lib/arfi/commands/functions.rbs', line 58
def build_sql_function: (String? schema, String function_name, original_ref: String) -> String
|
#canonical_path ⇒ String
64
|
# File 'sig/lib/arfi/commands/functions.rbs', line 64
def canonical_path: (String? schema, String function_name) -> String
|
#collect_all_candidates ⇒ Array[candidate]
90
|
# File 'sig/lib/arfi/commands/functions.rbs', line 90
def collect_all_candidates: (::Pathname root, String adapter) -> Array[candidate]
|
#collect_candidates ⇒ Array[candidate]
74
|
# File 'sig/lib/arfi/commands/functions.rbs', line 74
def collect_candidates: (glob: ::Pathname, schema: String, source: String, origin: String, priority: Integer) -> Array[candidate]
|
#create(function_ref) ⇒ void
This method returns an undefined value.
steep:ignore:end
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
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
|
#ensure_dirs! ⇒ void
This method returns an undefined value.
56
|
# File 'sig/lib/arfi/commands/functions.rbs', line 56
def ensure_dirs!: (adapter: String?, schema: String?) -> void
|
#function_paths ⇒ Array[String]
66
|
# File 'sig/lib/arfi/commands/functions.rbs', line 66
def function_paths: (String? schema, String function_name) -> Array[String]
|
#group_candidates_by_key ⇒ ::Hash[String, Array[candidate]]
92
|
# File 'sig/lib/arfi/commands/functions.rbs', line 92
def group_candidates_by_key: (Array[candidate] candidates) -> ::Hash[String, Array[candidate]]
|
#infer_adapter_from_config ⇒ String?
70
|
# File 'sig/lib/arfi/commands/functions.rbs', line 70
def infer_adapter_from_config: () -> String?
|
#list ⇒ void
This method returns an undefined value.
steep:ignore:end
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
|
#parse_function_ref ⇒ [String?, String]
50
|
# File 'sig/lib/arfi/commands/functions.rbs', line 50
def parse_function_ref: (String ref) -> [String?, String]
|
#print_table ⇒ void
This method returns an undefined value.
76
|
# File 'sig/lib/arfi/commands/functions.rbs', line 76
def print_table: (Array[resolved_row] rows) -> void
|
#rel ⇒ String
78
|
# File 'sig/lib/arfi/commands/functions.rbs', line 78
def rel: (::Pathname | String path) -> String
|
#remove_function_file ⇒ void
This method returns an undefined value.
80
|
# File 'sig/lib/arfi/commands/functions.rbs', line 80
def remove_function_file: (String? schema, String function_name) -> void
|
#render_list ⇒ void
This method returns an undefined value.
84
|
# File 'sig/lib/arfi/commands/functions.rbs', line 84
def render_list: (Array[::Hash[Symbol, untyped]] rows) -> void
|
#resolve_adapter ⇒ String
82
|
# File 'sig/lib/arfi/commands/functions.rbs', line 82
def resolve_adapter: () -> String
|
#resolve_functions_for ⇒ Array[::Hash[Symbol, untyped]]
72
|
# File 'sig/lib/arfi/commands/functions.rbs', line 72
def resolve_functions_for: (adapter: String) -> Array[::Hash[Symbol, untyped]]
|
#resolve_key_group ⇒ Array[::Hash[Symbol, untyped]]
86
|
# File 'sig/lib/arfi/commands/functions.rbs', line 86
def resolve_key_group: (Array[candidate] arr) -> Array[::Hash[Symbol, untyped]]
|
#resolve_schema_name ⇒ String?
88
|
# File 'sig/lib/arfi/commands/functions.rbs', line 88
def resolve_schema_name: (String? schema) -> String?
|
#schema_opt ⇒ String?
52
|
# File 'sig/lib/arfi/commands/functions.rbs', line 52
def schema_opt: () -> String?
|
#validate_adapter_option! ⇒ void
This method returns an undefined value.
48
|
# File 'sig/lib/arfi/commands/functions.rbs', line 48
def validate_adapter_option!: () -> void
|
#validate_function_ref! ⇒ void
This method returns an undefined value.
96
|
# File 'sig/lib/arfi/commands/functions.rbs', line 96
def validate_function_ref!: (String ref) -> void
|
#validate_identifiers! ⇒ void
This method returns an undefined value.
54
|
# File 'sig/lib/arfi/commands/functions.rbs', line 54
def validate_identifiers!: (String? schema, String function_name) -> void
|
This method returns an undefined value.
46
|
# File 'sig/lib/arfi/commands/functions.rbs', line 46
def validate_schema_format!: () -> void
|
#write_file ⇒ void
This method returns an undefined value.
62
|
# File 'sig/lib/arfi/commands/functions.rbs', line 62
def write_file: (String? schema, String function_name, String content) -> void
|