db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBLocked = xerrors.New("database is locked")

ErrDBLocked :

Functions

This section is empty.

Types

type DB

type DB interface {
	Name() string
	OpenDB(dbType, dbPath string, debugSQL bool, option Option) error
	MigrateDB() error
	CloseDB() error

	IsGoKEVModelV1() (bool, error)
	GetFetchMeta() (*models.FetchMeta, error)
	UpsertFetchMeta(*models.FetchMeta) error

	InsertKEVulns([]models.KEVuln) error
	InsertVulnCheck([]models.VulnCheck) error
	GetKEVByCveID(string) (Response, error)
	GetKEVByMultiCveID([]string) (map[string]Response, error)
}

DB :

func NewDB

func NewDB(dbType string, dbPath string, debugSQL bool, option Option) (driver DB, err error)

NewDB :

type Option

type Option struct {
	RedisTimeout time.Duration
}

Option :

type RDBDriver

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

RDBDriver :

func (*RDBDriver) CloseDB

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

CloseDB close Database

func (*RDBDriver) GetFetchMeta

func (r *RDBDriver) GetFetchMeta() (fetchMeta *models.FetchMeta, err error)

GetFetchMeta get FetchMeta from Database

func (*RDBDriver) GetKEVByCveID added in v0.2.0

func (r *RDBDriver) GetKEVByCveID(cveID string) (Response, error)

GetKEVByCveID :

func (*RDBDriver) GetKEVByMultiCveID added in v0.2.0

func (r *RDBDriver) GetKEVByMultiCveID(cveIDs []string) (map[string]Response, error)

GetKEVByMultiCveID :

func (*RDBDriver) InsertKEVulns

func (r *RDBDriver) InsertKEVulns(records []models.KEVuln) (err error)

InsertKEVulns :

func (*RDBDriver) InsertVulnCheck added in v0.2.0

func (r *RDBDriver) InsertVulnCheck(records []models.VulnCheck) (err error)

InsertVulnCheck :

func (*RDBDriver) IsGoKEVModelV1

func (r *RDBDriver) IsGoKEVModelV1() (bool, error)

IsGoKEVModelV1 determines if the DB was created at the time of go-kev Model v1

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, _ Option) (err error)

OpenDB opens Database

func (*RDBDriver) UpsertFetchMeta

func (r *RDBDriver) UpsertFetchMeta(fetchMeta *models.FetchMeta) error

UpsertFetchMeta upsert FetchMeta to Database

type RedisDriver

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

RedisDriver is Driver for Redis

func (*RedisDriver) CloseDB

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

CloseDB close Database

func (*RedisDriver) GetFetchMeta

func (r *RedisDriver) GetFetchMeta() (*models.FetchMeta, error)

GetFetchMeta get FetchMeta from Database

func (*RedisDriver) GetKEVByCveID added in v0.2.0

func (r *RedisDriver) GetKEVByCveID(cveID string) (Response, error)

GetKEVByCveID :

func (*RedisDriver) GetKEVByMultiCveID added in v0.2.0

func (r *RedisDriver) GetKEVByMultiCveID(cveIDs []string) (map[string]Response, error)

GetKEVByMultiCveID :

func (*RedisDriver) InsertKEVulns

func (r *RedisDriver) InsertKEVulns(records []models.KEVuln) (err error)

InsertKEVulns :

func (*RedisDriver) InsertVulnCheck added in v0.2.0

func (r *RedisDriver) InsertVulnCheck(records []models.VulnCheck) (err error)

InsertVulnCheck :

func (*RedisDriver) IsGoKEVModelV1

func (r *RedisDriver) IsGoKEVModelV1() (bool, error)

IsGoKEVModelV1 determines if the DB was created at the time of go-kev Model v1

func (*RedisDriver) MigrateDB

func (r *RedisDriver) MigrateDB() error

MigrateDB migrates Database

func (*RedisDriver) Name

func (r *RedisDriver) Name() string

Name return db name

func (*RedisDriver) OpenDB

func (r *RedisDriver) OpenDB(_, dbPath string, _ bool, option Option) error

OpenDB opens Database

func (*RedisDriver) UpsertFetchMeta

func (r *RedisDriver) UpsertFetchMeta(fetchMeta *models.FetchMeta) error

UpsertFetchMeta upsert FetchMeta to Database

type Response added in v0.2.0

type Response struct {
	CISA      []models.KEVuln    `json:"cisa,omitempty"`
	VulnCheck []models.VulnCheck `json:"vulncheck,omitempty"`
}

Response :

Jump to

Keyboard shortcuts

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