Add default values for the parameters in the functions

This commit is contained in:
Mario de Frutos
2016-01-22 10:38:34 +01:00
parent bd8ec71855
commit 4bffdb5de1
2 changed files with 15 additions and 1 deletions

View File

@@ -40,7 +40,14 @@ class SqlTemplateRenderer
end
def params_with_type
@function_signature['params'].map { |p| "#{p['name']} #{p['type']}"}.join(', ')
parameters = @function_signature['params'].map do |p|
if not p['default'].nil?
"#{p['name']} #{p['type']} DEFAULT #{p['default']}"
else
"#{p['name']} #{p['type']}"
end
end
return parameters.join(', ')
end
end