database

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//NullText is null text data
	NullText = sql.NullString{String: "", Valid: false}
	//NullInteger is null integer data
	NullInteger = sql.NullInt64{Int64: 0, Valid: false}
	//NullNumeric is null numeric data
	NullNumeric = sql.NullFloat64{Float64: 0.0, Valid: false}
)

Functions

func GetLogLevel

func GetLogLevel(s string) logf.Level

func Integer

func Integer(i int64) sql.NullInt64

Integer returns sql.NullInt64 (not NULL)

func NewLogger

func NewLogger(w io.Writer, lv logf.Level) *logf.Logger

func Numeric

func Numeric(f float64) sql.NullFloat64

Numeric returns sql.NullFloat64 (not NULL)

func Text

func Text(s string) sql.NullString

Text returns sql.NullString (not NULL)

Types

type Affected

type Affected struct {
	ID            sql.NullString `db:"id,primarykey"`
	Name          sql.NullString `db:"name,primarykey"`
	ProductName   sql.NullString `db:"product_name,primarykey"`
	VersionNumber sql.NullString `db:"version_number,primarykey"`
}

Affected is definition of affected table

func NewAffected

func NewAffected(id, name, productName, versionNumber string) *Affected

NewAffected returns Affected instance

type CVSS

type CVSS struct {
	ID         sql.NullString  `db:"id,primarykey"`
	Version    sql.NullString  `db:"version,primarykey"`
	BaseVector sql.NullString  `db:"base_vector"`
	BaseScore  sql.NullFloat64 `db:"base_score"`
	Severity   sql.NullString  `db:"severity"`
}

CVSS is definition of cvss table

func NewCVSS

func NewCVSS(id, version, baseVector, severity string, baseScore float64) *CVSS

NewCVSS returns CVSS instance

type DB

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

DB is type of database

func New

func New(dbf string, logger *logf.Logger) (*DB, error)

New returns DB instance

func (*DB) GetAPI

func (db *DB) GetAPI() *myjvn.APIs

GetAPI returns myjvn.APIs instance

func (*DB) GetAffected

func (db *DB) GetAffected(id string) []Affected

GetAffected returns []Affected instance

func (*DB) GetCVSS

func (db *DB) GetCVSS(id string) *CVSS

GetCVSS returns CVSS instance

func (*DB) GetDB

func (db *DB) GetDB() *gorp.DbMap

GetDB returns sql.DB instance

func (*DB) GetDBFile

func (db *DB) GetDBFile() string

GetDBFile returns SQLite file path

func (*DB) GetJVNRSS

func (db *DB) GetJVNRSS(start time.Time, month bool, keyword string) (*rss.JVNRSS, error)

GetJVNRSS returns rss.JVNRSS (datePublished condition)

func (*DB) GetJVNRSSByKeyword

func (db *DB) GetJVNRSSByKeyword(keyword string) (*rss.JVNRSS, error)

GetJVNRSSByKeyword returns rss.JVNRSS (keyword condition)

func (*DB) GetLastUpdate

func (db *DB) GetLastUpdate() time.Time

GetLastUpdate returns last update time.Time

func (*DB) GetLogger

func (db *DB) GetLogger() *logf.Logger

GetLogger returns logf.Logger instance

func (*DB) GetRelated

func (db *DB) GetRelated(id string) []Related

GetRelated returns []Affected instance

func (*DB) GetVULDEF

func (db *DB) GetVULDEF(idlist []string) (*vuldef.VULDEF, error)

GetVULDEF returns vuldef.VULDEF

func (*DB) GetVulnview

func (db *DB) GetVulnview(id string) *Vulnview

GetVulnview returns Vulnview instance

func (*DB) GetVulnviewList

func (db *DB) GetVulnviewList(days int, score float64, product, cve string) ([]Vulnview, error)

GetVulnviewList returns []Vulnview instance

func (*DB) Initialize

func (db *DB) Initialize() error

Initialize returns result for initializing

func (*DB) Update

func (db *DB) Update(month bool, keyword string) error

Update update JVN vulnerability data

func (*DB) UpdateID

func (db *DB) UpdateID(id string) error

UpdateID update JVN vulnerability data by ID

type History

type History struct {
	ID          sql.NullString `db:"id,primarykey"`
	HistoryNo   sql.NullInt64  `db:"history_no,primarykey"`
	Description sql.NullString `db:"description"`
	DateTime    sql.NullInt64  `db:"date_time"`
}

History is definition of history table

func NewHistory

func NewHistory(id string, historyNo int64, description string, dateTime int64) *History

NewHistory returns History instance

func (*History) GetDateTime

func (ds *History) GetDateTime() time.Time

GetDateTime returns time.Time instance of History.DateTime

type Related struct {
	ID        sql.NullString `db:"id,primarykey"`
	Type      sql.NullString `db:"type,primarykey"`
	Name      sql.NullString `db:"name,primarykey"`
	VulinfoID sql.NullString `db:"vulinfo_id,primarykey"`
	Title     sql.NullString `db:"title"`
	URL       sql.NullString `db:"url"`
}

Related is definition of related table

func NewRelated

func NewRelated(id, typeR, name, vulinfoID, title, url string) *Related

NewRelated returns Related instance

type Vulnlist

type Vulnlist struct {
	ID          sql.NullString `db:"id,primarykey"`
	Title       sql.NullString `db:"title"`
	Description sql.NullString `db:"description"`
	URI         sql.NullString `db:"uri"`
	Creator     sql.NullString `db:"creator"`
	Impact      sql.NullString `db:"impact"`
	Solution    sql.NullString `db:"solution"`
	DatePublic  sql.NullInt64  `db:"date_public"`
	DatePublish sql.NullInt64  `db:"date_publish"`
	DateUpdate  sql.NullInt64  `db:"date_update"`
}

Vulnlist is definition of vulnlist table

func NewVulnlist

func NewVulnlist(id, title, description, uri, creator, impact, solution string, datePublic, datePublish, dateUpdate int64) *Vulnlist

NewVulnlist returns Vulnlist instance

func (*Vulnlist) GetDatePublic

func (ds *Vulnlist) GetDatePublic() time.Time

GetDatePublic returns time.Time instance of Vulnlist.DatePublic

func (*Vulnlist) GetDatePublish

func (ds *Vulnlist) GetDatePublish() time.Time

GetDatePublish returns time.Time instance of Vulnlist.DatePublish

func (*Vulnlist) GetDateUpdate

func (ds *Vulnlist) GetDateUpdate() time.Time

GetDateUpdate returns time.Time instance of Vulnlist.DateUpdate

type Vulnview

type Vulnview struct {
	ID           sql.NullString  `db:"id"`
	Title        sql.NullString  `db:"title"`
	Description  sql.NullString  `db:"description"`
	URI          sql.NullString  `db:"uri"`
	Impact       sql.NullString  `db:"impact"`
	Solution     sql.NullString  `db:"solution"`
	CVSSScore    sql.NullFloat64 `db:"cvss_score"`
	CVSSVector   sql.NullString  `db:"cvss_vector"`
	CVSSSeverity sql.NullString  `db:"cvss_severity"`
	DatePublic   sql.NullInt64   `db:"date_public"`
	DatePublish  sql.NullInt64   `db:"date_publish"`
	DateUpdate   sql.NullInt64   `db:"date_update"`
}

Vulnview is definition of vulnview view

func (*Vulnview) GetDatePublic

func (ds *Vulnview) GetDatePublic() time.Time

GetDatePublic returns time.Time instance of Vulnview.DatePublic

func (*Vulnview) GetDatePublish

func (ds *Vulnview) GetDatePublish() time.Time

GetDatePublish returns time.Time instance of Vulnview.DatePublish

func (*Vulnview) GetDateUpdate

func (ds *Vulnview) GetDateUpdate() time.Time

GetDateUpdate returns time.Time instance of Vulnview.DateUpdate

Jump to

Keyboard shortcuts

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