db

package
v0.15.14 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0 Imports: 22 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.1.1

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 added in v0.1.1

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

NewDB return DB accessor.

type RDBDriver added in v0.1.1

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

RDBDriver is Driver for RDB

func NewRDB added in v0.2.0

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

NewRDB return RDB driver

func (*RDBDriver) CloseDB added in v0.2.0

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

CloseDB close Database

func (*RDBDriver) CountNvd added in v0.1.1

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

CountNvd count nvd table

func (*RDBDriver) Get added in v0.1.1

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

Get Select Cve information from DB.

func (*RDBDriver) GetByCpeURI added in v0.2.0

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

GetByCpeURI Select Cve information from DB.

func (*RDBDriver) GetCveIDsByCpeURI added in v0.4.0

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

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RDBDriver) GetFetchedFeedMeta added in v0.2.0

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

GetFetchedFeedMeta selects fetchmeta of the year

func (*RDBDriver) GetFetchedFeedMetas added in v0.2.0

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

GetFetchedFeedMetas selects a list of FeedMeta

func (*RDBDriver) GetMulti added in v0.2.0

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

GetMulti Select Cves information from DB.

func (*RDBDriver) InsertJvn added in v0.1.1

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

InsertJvn inserts Cve Information into DB

func (*RDBDriver) InsertNvdJSON added in v0.2.0

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

InsertNvdJSON Cve information from DB.

func (*RDBDriver) MigrateDB added in v0.1.1

func (r *RDBDriver) MigrateDB() error

MigrateDB migrates Database

func (*RDBDriver) Name added in v0.1.1

func (r *RDBDriver) Name() string

Name return db name

func (*RDBDriver) OpenDB added in v0.1.1

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

OpenDB opens Database

func (*RDBDriver) UpsertFeedHash added in v0.2.0

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

UpsertFeedHash selects sha1 in metafile of the year

type RedisDriver added in v0.1.1

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

RedisDriver is Driver for Redis

func NewRedis added in v0.2.0

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

NewRedis return Redis driver

func (*RedisDriver) CloseDB added in v0.2.0

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

CloseDB close Database

func (*RedisDriver) CountNvd added in v0.1.1

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

CountNvd count nvd table

func (*RedisDriver) Get added in v0.1.1

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

Get Select Cve information from DB.

func (*RedisDriver) GetByCpeURI added in v0.2.0

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

GetByCpeURI Select Cve information from DB.

func (*RedisDriver) GetCveIDsByCpeURI added in v0.4.0

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

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RedisDriver) GetFetchedFeedMeta added in v0.2.0

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

GetFetchedFeedMeta selects hash in metafile of the year

func (*RedisDriver) GetFetchedFeedMetas added in v0.2.0

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

GetFetchedFeedMetas selects a list of FeedMeta

func (*RedisDriver) GetMulti added in v0.2.0

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

GetMulti Select Cves information from DB.

func (*RedisDriver) InsertJvn added in v0.1.1

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

InsertJvn insert items fetched from JVN.

func (*RedisDriver) InsertNvdJSON added in v0.2.0

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

InsertNvdJSON Cve information from DB.

func (*RedisDriver) Name added in v0.1.1

func (r *RedisDriver) Name() string

Name return db name

func (*RedisDriver) OpenDB added in v0.1.1

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

OpenDB opens Database

func (*RedisDriver) UpsertFeedHash added in v0.2.0

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