Skip to content

Commit

Permalink
Added support to set value of GenericDatum for enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
vnayar committed Apr 3, 2022
1 parent b94b2bc commit e1a5fad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/avro/generic/genericdata.d
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ class GenericDatum {
}
}

public void setValue(string val) {
if (type == Type.UNION) {
value.get!(GenericUnion).getDatum().setValue(val);
} else if (type == Type.ENUM) {
value.get!(GenericEnum).setSymbol(val);
} else {
value = val;
}
}

/// ditto
public void opAssign(T)(T val)
if (!is(T : GenericDatum)) {
Expand Down

0 comments on commit e1a5fad

Please sign in to comment.