Skip to content

Commit d3135f8

Browse files
committed
Bugfix on converting empty vector to vector of enums
1 parent 652c3a6 commit d3135f8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PostgresORM"
22
uuid = "748b5efa-ed57-4836-b183-a38105a77fdd"
33
authors = ["Vincent Laugier <vincent.laugier@gmail.com>"]
4-
version = "0.5.0"
4+
version = "0.5.1"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

src/Controller/coreORM.utils.part1.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ function util_dict2entity(props_dict::Dict{Symbol,T},
429429

430430
elseif ftype <: Vector{T} where T <: Base.Enums.Enum
431431

432-
if isa(props_dict[fsymbol],Union{Vector{T},Vector{Union{T,Missing}}} where T <: Integer)
432+
# Treat the case where we can an empty vector, no matter the type (eg. Any[])
433+
if props_dict[fsymbol] isa Vector && isempty(props_dict[fsymbol])
434+
props_dict[fsymbol] = Vector{T}()
435+
elseif isa(props_dict[fsymbol],Union{Vector{T},Vector{Union{T,Missing}}} where T <: Integer)
433436
props_dict[fsymbol] = vector_of_integers2vector_of_enums(ftype,props_dict[fsymbol])
434437
elseif isa(props_dict[fsymbol],Union{Vector{String},Vector{Union{String,Missing}}})
435438
props_dict[fsymbol] = vector_of_strings2vector_of_enums(ftype,props_dict[fsymbol])

0 commit comments

Comments
 (0)