aboutsummaryrefslogtreecommitdiff
path: root/dbstore/dbstore.go
diff options
context:
space:
mode:
Diffstat (limited to 'dbstore/dbstore.go')
-rw-r--r--dbstore/dbstore.go29
1 files changed, 2 insertions, 27 deletions
diff --git a/dbstore/dbstore.go b/dbstore/dbstore.go
index 840f268..6ff0ced 100644
--- a/dbstore/dbstore.go
+++ b/dbstore/dbstore.go
@@ -365,31 +365,6 @@ func (me DbStore) CpeMatchSearch(
return r, err
}
-// Check data type, data format, and data version.
-func (me DbStore) checkData(
- dataType nvd_feed.DataType,
- dataFormat nvd_feed.DataFormat,
- dataVersion nvd_feed.DataVersion,
-) error {
- // check data type
- if dataType != nvd_feed.CveType {
- return fmt.Errorf("unknown data type: %s", dataType)
- }
-
- // check data format
- if dataFormat != nvd_feed.MitreFormat {
- return fmt.Errorf("unknown data format: %s", dataFormat)
- }
-
- // check data version
- if dataVersion != nvd_feed.V40 {
- return fmt.Errorf("unknown data version: %s", dataVersion)
- }
-
- // return success
- return nil
-}
-
// Add description.
func (me DbStore) addDescriptions(ctx context.Context, tx Tx, ds []nvd_feed.Description) ([]int64, error) {
r := make([]int64, len(ds))
@@ -427,7 +402,7 @@ func (me DbStore) addCve(ctx context.Context, tx Tx, itemId int64, cve nvd_feed.
var cveId int64
// check data type, data format, and data version
- if err := me.checkData(cve.DataType, cve.DataFormat, cve.DataVersion); err != nil {
+ if err := checkNvdData(cve.DataType, cve.DataFormat, cve.DataVersion); err != nil {
return err
}
@@ -650,7 +625,7 @@ func (me DbStore) addFeed(ctx context.Context, tx Tx, feed nvd_feed.Feed) (int64
var feedId int64
// check feed data type, data format, and data version
- if err := me.checkData(feed.DataType, feed.DataFormat, feed.DataVersion); err != nil {
+ if err := checkNvdData(feed.DataType, feed.DataFormat, feed.DataVersion); err != nil {
return feedId, err
}