go-cve-dictionary: github.com/kotakanbe/go-cve-dictionary/db Index | Files

package db

import "github.com/kotakanbe/go-cve-dictionary/db"

Index

Package Files

db.go rdb.go redis.go

type DB Uses

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
    InsertNvdXML([]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 Uses

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

NewDB return DB accessor.

type RDBDriver Uses

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

RDBDriver is Driver for RDB

func NewRDB Uses

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

NewRDB return RDB driver

func (*RDBDriver) CloseDB Uses

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

CloseDB close Database

func (*RDBDriver) CountNvd Uses

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

CountNvd count nvd table

func (*RDBDriver) Get Uses

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

Get Select Cve information from DB.

func (*RDBDriver) GetByCpeURI Uses

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

GetByCpeURI Select Cve information from DB.

func (*RDBDriver) GetCveIDsByCpeURI Uses

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

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RDBDriver) GetFetchedFeedMeta Uses

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

GetFetchedFeedMeta selects fetchmeta of the year

func (*RDBDriver) GetFetchedFeedMetas Uses

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

GetFetchedFeedMetas selects a list of FeedMeta

func (*RDBDriver) GetMulti Uses

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

GetMulti Select Cves information from DB.

func (*RDBDriver) InsertJvn Uses

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

InsertJvn inserts Cve Information into DB

func (*RDBDriver) InsertNvdJSON Uses

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

InsertNvdJSON Cve information from DB.

func (*RDBDriver) InsertNvdXML Uses

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

InsertNvdXML inserts CveInformation into DB

func (*RDBDriver) MigrateDB Uses

func (r *RDBDriver) MigrateDB() error

MigrateDB migrates Database

func (*RDBDriver) Name Uses

func (r *RDBDriver) Name() string

Name return db name

func (*RDBDriver) OpenDB Uses

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

OpenDB opens Database

func (*RDBDriver) UpsertFeedHash Uses

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

UpsertFeedHash selects sha1 in metafile of the year

type RedisDriver Uses

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

RedisDriver is Driver for Redis

func NewRedis Uses

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

NewRedis return Redis driver

func (*RedisDriver) CloseDB Uses

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

CloseDB close Database

func (*RedisDriver) CountNvd Uses

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

CountNvd count nvd table

func (*RedisDriver) Get Uses

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

Get Select Cve information from DB.

func (*RedisDriver) GetByCpeURI Uses

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

GetByCpeURI Select Cve information from DB.

func (*RedisDriver) GetCveIDsByCpeURI Uses

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

GetCveIDsByCpeURI Select Cve Ids by by pseudo-CPE

func (*RedisDriver) GetFetchedFeedMeta Uses

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

GetFetchedFeedMeta selects hash in metafile of the year

func (*RedisDriver) GetFetchedFeedMetas Uses

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

GetFetchedFeedMetas selects a list of FeedMeta

func (*RedisDriver) GetMulti Uses

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

GetMulti Select Cves information from DB.

func (*RedisDriver) InsertJvn Uses

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

InsertJvn insert items fetched from JVN.

func (*RedisDriver) InsertNvdJSON Uses

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

InsertNvdJSON Cve information from DB.

func (*RedisDriver) InsertNvdXML Uses

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

InsertNvdXML inserts CveInformation into DB

func (*RedisDriver) Name Uses

func (r *RedisDriver) Name() string

Name return db name

func (*RedisDriver) OpenDB Uses

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

OpenDB opens Database

func (*RedisDriver) UpsertFeedHash Uses

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

UpsertFeedHash selects hash in metafile of the year

Package db imports 20 packages (graph) and is imported by 34 packages. Updated 2019-11-29. Refresh now. Tools for package owners.