aboutsummaryrefslogtreecommitdiff
path: root/dbstore/util.go
blob: 2b8d44450e96e571a40fe7afe6b7c1afcab8d008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
}