Skip to content

Commit dbbab3c

Browse files
committed
Adding flag to deleteFactor
1 parent 94fcd59 commit dbbab3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ end
360360
#Alias
361361
deleteVariable!(dfg::CloudGraphsDFG, variable::DFGVariable) = deleteVariable!(dfg, variable.label)
362362

363-
function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
364-
factor = getFactor(dfg, label)
365-
if factor == nothing
363+
function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol; suppressGetFactor::Bool=false)::Union{Nothing, DFGFactor}
364+
factor = suppressGetFactor ? nothing : getFactor(dfg, label)
365+
if factor === nothing && !suppressGetFactor
366366
error("Unable to retrieve the ID for factor '$label'. Please check your connection to the database and that the factor exists.")
367367
end
368368
# Perform detach+deletion
@@ -378,7 +378,7 @@ function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
378378
end
379379

380380
# Alias
381-
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor)::DFGFactor = deleteFactor!(dfg, factor.label)
381+
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor; suppressGetFactor::Bool=false)::Union{Nothing, DFGFactor} = deleteFactor!(dfg, factor.label, suppressGetFactor=suppressGetFactor)
382382

383383
function getVariables(dfg::CloudGraphsDFG, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0)::Vector{DFGVariable}
384384
variableIds = listVariables(dfg, regexFilter, tags=tags, solvable=solvable)

0 commit comments

Comments
 (0)