aboutsummaryrefslogtreecommitdiff
path: root/dbstore/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'dbstore/util.go')
-rw-r--r--dbstore/util.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/dbstore/util.go b/dbstore/util.go
new file mode 100644
index 0000000..2b8d444
--- /dev/null
+++ b/dbstore/util.go
@@ -0,0 +1,27 @@
+package dbstore
+
+import (
+ "fmt"
+ "github.com/pablotron/cvez/feed"
+)
+
+// Check data type, data format, and data version in NVD feed entry.
+func checkNvdData(dt feed.DataType, df feed.DataFormat, dv feed.DataVersion) error {
+ // check data type
+ if dt != feed.CveType {
+ return fmt.Errorf("unknown data type: %s", dt)
+ }
+
+ // check data format
+ if df != feed.MitreFormat {
+ return fmt.Errorf("unknown data format: %s", df)
+ }
+
+ // check data version
+ if dv != feed.V40 {
+ return fmt.Errorf("unknown data version: %s", dv)
+ }
+
+ // return success
+ return nil
+}