diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-03-19 07:42:10 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-03-19 07:42:10 -0400 |
commit | 8b9e4eeead8717974d34839c7b32cf9324b860db (patch) | |
tree | 1dabbb8b001b4b75377f7023d8a93c1cff2c7df9 /feed/cveid.go | |
parent | 5ae828ed1feb978dc24acc8545c4d56b4262a7f5 (diff) | |
download | cvez-8b9e4eeead8717974d34839c7b32cf9324b860db.tar.bz2 cvez-8b9e4eeead8717974d34839c7b32cf9324b860db.zip |
feed: add MarshalJSON for several types
Diffstat (limited to 'feed/cveid.go')
-rw-r--r-- | feed/cveid.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/feed/cveid.go b/feed/cveid.go index 5e43ad3..d7d9a32 100644 --- a/feed/cveid.go +++ b/feed/cveid.go @@ -75,6 +75,11 @@ func NewCveId(s string) (CveId, error) { return CveId(encodeCveId(year, num)), nil } +// Marshal CVE ID to JSON. +func (me CveId) MarshalJSON() ([]byte, error) { + return json.Marshal(me.String()) +} + // Unmarshal CVE ID from JSON. func (me *CveId) UnmarshalJSON(b []byte) error { // decode string, check for error |