func ConvertRedHatToModel(root *oval.Root) (defs []Definition) {
	for _, d := range root.Definitions.Definitions {
		if strings.Contains(d.Description, "** REJECT **") {
			continue
		}
		cves := []Cve{}
		for _, c := range d.Advisory.Cves {
			cves = append(cves, Cve{
				CveID:  c.CveID,
				Cvss2:  c.Cvss2,
				Cvss3:  c.Cvss3,
				Cwe:    c.Cwe,
				Impact: c.Impact,
				Href:   c.Href,
				Public: c.Public,
			})
		}
		rs := []Reference{}
		for _, r := range d.References {
			rs = append(rs, Reference{
				Source: r.Source,
				RefID:  r.RefID,
				RefURL: r.RefURL,
			})
		}
		cl := []Cpe{}
		for _, cpe := range d.Advisory.AffectedCPEList {
			cl = append(cl, Cpe{
				Cpe: cpe,
			})
		}
		bs := []Bugzilla{}
		for _, b := range d.Advisory.Bugzillas {
			bs = append(bs, Bugzilla{
				BugzillaID: b.ID,
				URL:        b.URL,
				Title:      b.Title,
			})
		}
		const timeformat = "2006-01-02"
		issued, _ := time.Parse(timeformat, d.Advisory.Issued.Date)
		updated, _ := time.Parse(timeformat, d.Advisory.Updated.Date)
		def := Definition{
			DefinitionID: d.ID,
			Title:        d.Title,
			Description:  d.Description,
			Advisory: Advisory{
				Severity:        d.Advisory.Severity,
				Cves:            cves,
				Bugzillas:       bs,
				AffectedCPEList: cl,
				Issued:          issued,
				Updated:         updated,
			},
			Debian:        nil,
			AffectedPacks: collectRedHatPacks(d.Criteria),
			References:    rs,
		}
		if viper.GetBool("no-details") {
			def.Title = ""
			def.Description = ""
			def.Advisory.Severity = ""
			def.Advisory.AffectedCPEList = []Cpe{}
			def.Advisory.Bugzillas = []Bugzilla{}
			def.Advisory.Issued = time.Time{}
			def.Advisory.Updated = time.Time{}
			def.References = []Reference{}
		}
		defs = append(defs, def)
	}
	return
}
ConvertRedHatToModel Convert OVAL to models
package models
import (
	"regexp"
	"strings"
	"time"
	"github.com/spf13/viper"
	"github.com/ymomoi/goval-parser/oval"
)
var cveIDPattern = regexp.MustCompile(`(CVE-\d{4}-\d{4,})`)