db

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 22 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
	CloseDB() error
	MigrateDB() error
	GetExploitByID(string) ([]models.Exploit, error)
	GetExploitMultiByID([]string) (map[string][]models.Exploit, error)
	GetExploitByCveID(string) ([]models.Exploit, error)
	GetExploitMultiByCveID([]string) (map[string][]models.Exploit, error)
	InsertExploit(models.ExploitType, []models.Exploit) error
	GetExploitAll() ([]models.Exploit, error)

	IsExploitModelV1() (bool, error)
	GetFetchMeta() (*models.FetchMeta, error)
	UpsertFetchMeta(*models.FetchMeta) error
}

DB :

func NewDB

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

NewDB :

type IndexChunk added in v0.2.0

type IndexChunk struct {
	From, To int
}

IndexChunk has a starting point and an ending point for Chunk

type Option added in v0.4.2

type Option struct {
	RedisTimeout time.Duration
}

Option :

type RDBDriver

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

RDBDriver :

func (*RDBDriver) CloseDB added in v0.1.7

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

CloseDB close Database

func (*RDBDriver) GetExploitAll

func (r *RDBDriver) GetExploitAll() ([]models.Exploit, error)

GetExploitAll :

func (*RDBDriver) GetExploitByCveID

func (r *RDBDriver) GetExploitByCveID(cveID string) ([]models.Exploit, error)

GetExploitByCveID :

func (*RDBDriver) GetExploitByID

func (r *RDBDriver) GetExploitByID(exploitUniqueID string) ([]models.Exploit, error)

GetExploitByID :

func (*RDBDriver) GetExploitMultiByCveID

func (r *RDBDriver) GetExploitMultiByCveID(cveIDs []string) (map[string][]models.Exploit, error)

GetExploitMultiByCveID :

func (*RDBDriver) GetExploitMultiByID

func (r *RDBDriver) GetExploitMultiByID(exploitUniqueIDs []string) (map[string][]models.Exploit, error)

GetExploitMultiByID :

func (*RDBDriver) GetFetchMeta added in v0.2.0

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

GetFetchMeta get FetchMeta from Database

func (*RDBDriver) InsertExploit

func (r *RDBDriver) InsertExploit(exploitType models.ExploitType, exploits []models.Exploit) (err error)

InsertExploit :

func (*RDBDriver) IsExploitModelV1 added in v0.2.0

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

IsExploitModelV1 determines if the DB was created at the time of go-exploitdb 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 added in v0.2.0

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

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

CloseDB close Database

func (*RedisDriver) GetExploitAll

func (r *RedisDriver) GetExploitAll() ([]models.Exploit, error)

GetExploitAll :

func (*RedisDriver) GetExploitByCveID

func (r *RedisDriver) GetExploitByCveID(cveID string) ([]models.Exploit, error)

GetExploitByCveID :

func (*RedisDriver) GetExploitByID

func (r *RedisDriver) GetExploitByID(exploitDBID string) ([]models.Exploit, error)

GetExploitByID :

func (*RedisDriver) GetExploitMultiByCveID

func (r *RedisDriver) GetExploitMultiByCveID(cveIDs []string) (map[string][]models.Exploit, error)

GetExploitMultiByCveID :

func (*RedisDriver) GetExploitMultiByID added in v0.4.0

func (r *RedisDriver) GetExploitMultiByID(exploitUniqueIDs []string) (map[string][]models.Exploit, error)

GetExploitMultiByID :

func (*RedisDriver) GetFetchMeta added in v0.2.0

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

GetFetchMeta get FetchMeta from Database

func (*RedisDriver) InsertExploit

func (r *RedisDriver) InsertExploit(exploitType models.ExploitType, exploits []models.Exploit) (err error)

InsertExploit :

func (*RedisDriver) IsExploitModelV1 added in v0.2.0

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

IsExploitModelV1 determines if the DB was created at the time of go-exploitdb 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 added in v0.2.0

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

UpsertFetchMeta upsert FetchMeta to Database

Jump to

Keyboard shortcuts

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