Resource
DearDiary.get_resource — Function
get_resource(id::Integer)::Optional{Resource}Get a Resource by id.
Arguments
id::Integer: The id of the resource to query.
Returns
A Resource object. If the record does not exist, return nothing.
DearDiary.get_resources — Function
get_resources(experiment_id::Integer)::Array{Resource, 1}Get all Resource for a given experiment.
Arguments
experiment_id::Integer: The id of the experiment to query.
Returns
An array of Resource objects.
DearDiary.create_resource — Function
create_resource(experiment_id::Integer, name::AbstractString, data::AbstractArray{UInt8,1})::NamedTuple{id::Optional{<:Int64},status::UpsertResult}Create a new Resource record.
Arguments
experiment_id::Integer: The id of the experiment to create the resource for.name::AbstractString: The name of the resource.data::AbstractArray{UInt8,1}: The binary data of the resource.
Returns
- The created resource ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
DearDiary.update_resource — Function
update_resource(id::Integer, name::Optional{AbstractString}, description::Optional{AbstractString}, data::Optional{AbstractArray{UInt8,1}})::UpsertResultUpdate a Resource record.
Arguments
id::Integer: The id of the resource to update.name::Optional{AbstractString}: The new name for the resource.description::Optional{AbstractString}: The new description for the resource.data::Optional{AbstractArray{UInt8,1}}: The new binary data for the resource.
Returns
An UpsertResult. Updated if the record was successfully updated (or no changes were made), Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.
DearDiary.delete_resource — Function
delete_resource(id::Integer)::BoolDelete a Resource record.
Arguments
id::Integer: The id of the resource to delete.
Returns
true if the record was successfully deleted, false otherwise.