Skip to content

Commit

Permalink
Project updates
Browse files Browse the repository at this point in the history
  • Loading branch information
raphasampaio committed Aug 20, 2024
1 parent ffce5e9 commit caf7083
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/data/time_series_file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ function Base.convert(::Type{TimeSeriesFileData}, id::AbstractString)
return TimeSeriesFileData(id = id)
end

function Base.call(parameter::TimeSeriesFileData)
return parameter.path
end

function initialize!(parameter::TimeSeriesFileData, collection::AbstractCollection, db::DatabaseSQLite; kwargs...)
parameter.path = PSRDatabaseSQLite.read_time_series_file(db, collection.id, parameter.id)
return nothing
Expand Down
40 changes: 39 additions & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ macro collection(expression)

function_name = Symbol(name_snakecase, :_, field_name)

if field_type == :String || field_type == :TimeSeriesFileData
if field_type == :String
description = "Get the value of the $field_name field from the $name collection."

doc_string =
Expand Down Expand Up @@ -54,6 +54,44 @@ $description
return $function_name(inputs.collections.$name_snakecase)
end
end)
elseif field_type == :TimeSeriesFileData
description = "Get the value of the $field_name field from the $name collection."

doc_string =
"""
$function_name($name_snakecase::$name)
$description
"""
push!(getters, quote
@doc $doc_string function $function_name($name_snakecase::$name)
return $name_snakecase.$field_name()
end
end)

doc_string =
"""
$function_name(collections::AbstractCollections)
$description
"""
push!(getters, quote
@doc $doc_string function $function_name(collections::AbstractCollections)
return $function_name(collections.$name_snakecase)
end
end)

doc_string =
"""
$function_name(inputs::AbstractInputs)
$description
"""
push!(getters, quote
@doc $doc_string function $function_name(inputs::AbstractInputs)
return $function_name(inputs.collections.$name_snakecase)
end
end)
else
description = "Get the value of the $field_name field from the $name collection at index i."

Expand Down

0 comments on commit caf7083

Please sign in to comment.