db

package
v0.5.1-0...-a058e20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Name() string
	CloseDB() error
	Get(string) (*models.CveDetail, error)
	GetMulti([]string) (map[string]models.CveDetail, error)
	GetCveIDsByCpeURI(string) ([]string, error)
	GetByCpeURI(string) ([]models.CveDetail, error)
	InsertJvn([]models.CveDetail) error
	InsertNvdJSON([]models.CveDetail) error
	CountNvd() (int, error)
	UpsertFeedHash(models.FeedMeta) error
	GetFetchedFeedMeta(string) (*models.FeedMeta, error)
	GetFetchedFeedMetas() ([]models.FeedMeta, error)
}

DB is interface for a database driver

func NewDB

func NewDB(dbType, dbpath string, debugSQL bool) (DB, bool, error)

NewDB return DB accessor.

type RDBDriver

type RDBDriver struct {
	// contains filtered or unexported fields
}

RDBDriver is Driver for RDB

func NewRDB

func NewRDB(dbType, dbpath string, debugSQL bool) (driver *RDBDriver, locked bool, err error)

NewRDB return RDB driver

func (*RDBDriver) CloseDB

func (r *RDBDriver) CloseDB() (err error)

CloseDB close Database

func (*RDBDriver) CountNvd

func (r *RDBDriver) CountNvd() (int, error)

CountNvd count nvd table

func (*RDBDriver) Get

func (r *RDBDriver) Get(cveID string) (*models.CveDetail, error)

Get Select Cve information from DB.

func (*RDBDriver) GetByCpeURI

func (r *RDBDriver) GetByCpeURI(uri string) ([]models.CveDetail, error)

GetByCpeURI Select Cve information from DB.

func (*RDBDriver) GetCveIDsByCpeURI

func (r *RDBDriver) GetCveIDsByCpeURI(uri string) ([]string, error)

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RDBDriver) GetFetchedFeedMeta

func (r *RDBDriver) GetFetchedFeedMeta(url string) (*models.FeedMeta, error)

GetFetchedFeedMeta selects fetchmeta of the year

func (*RDBDriver) GetFetchedFeedMetas

func (r *RDBDriver) GetFetchedFeedMetas() ([]models.FeedMeta, error)

GetFetchedFeedMetas selects a list of FeedMeta

func (*RDBDriver) GetMulti

func (r *RDBDriver) GetMulti(cveIDs []string) (map[string]models.CveDetail, error)

GetMulti Select Cves information from DB.

func (*RDBDriver) InsertJvn

func (r *RDBDriver) InsertJvn(cves []models.CveDetail) error

InsertJvn inserts Cve Information into DB

func (*RDBDriver) InsertNvdJSON

func (r *RDBDriver) InsertNvdJSON(cves []models.CveDetail) (err error)

InsertNvdJSON Cve information from DB.

func (*RDBDriver) MigrateDB

func (r *RDBDriver) MigrateDB() error

MigrateDB migrates Database

func (*RDBDriver) Name

func (r *RDBDriver) Name() string

Name return db name

func (*RDBDriver) OpenDB

func (r *RDBDriver) OpenDB(dbType, dbPath string, debugSQL bool) (locked bool, err error)

OpenDB opens Database

func (*RDBDriver) UpsertFeedHash

func (r *RDBDriver) UpsertFeedHash(mm models.FeedMeta) error

UpsertFeedHash selects sha1 in metafile of the year

type RedisDriver

type RedisDriver struct {
	// contains filtered or unexported fields
}

RedisDriver is Driver for Redis

func NewRedis

func NewRedis(dbType, dbpath string, debugSQL bool) (driver *RedisDriver, locked bool, err error)

NewRedis return Redis driver

func (*RedisDriver) CloseDB

func (r *RedisDriver) CloseDB() (err error)

CloseDB close Database

func (*RedisDriver) CountNvd

func (r *RedisDriver) CountNvd() (int, error)

CountNvd count nvd table

func (*RedisDriver) Get

func (r *RedisDriver) Get(cveID string) (*models.CveDetail, error)

Get Select Cve information from DB.

func (*RedisDriver) GetByCpeURI

func (r *RedisDriver) GetByCpeURI(uri string) ([]models.CveDetail, error)

GetByCpeURI Select Cve information from DB.

func (*RedisDriver) GetCveIDsByCpeURI

func (r *RedisDriver) GetCveIDsByCpeURI(uri string) ([]string, error)

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RedisDriver) GetFetchedFeedMeta

func (r *RedisDriver) GetFetchedFeedMeta(url string) (*models.FeedMeta, error)

GetFetchedFeedMeta selects hash in metafile of the year

func (*RedisDriver) GetFetchedFeedMetas

func (r *RedisDriver) GetFetchedFeedMetas() (metas []models.FeedMeta, err error)

GetFetchedFeedMetas selects a list of FeedMeta

func (*RedisDriver) GetMulti

func (r *RedisDriver) GetMulti(cveIDs []string) (map[string]models.CveDetail, error)

GetMulti Select Cves information from DB.

func (*RedisDriver) InsertJvn

func (r *RedisDriver) InsertJvn(cves []models.CveDetail) error

InsertJvn insert items fetched from JVN.

func (*RedisDriver) InsertNvdJSON

func (r *RedisDriver) InsertNvdJSON(cves []models.CveDetail) error

InsertNvdJSON Cve information from DB.

func (*RedisDriver) Name

func (r *RedisDriver) Name() string

Name return db name

func (*RedisDriver) OpenDB

func (r *RedisDriver) OpenDB(dbType, dbPath string, debugSQL bool) (err error)

OpenDB opens Database

func (*RedisDriver) UpsertFeedHash

func (r *RedisDriver) UpsertFeedHash(m models.FeedMeta) error

UpsertFeedHash selects hash in metafile of the year

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL