dbtest

package
v0.89.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultVulnerabilities

func DefaultVulnerabilities() []vulnerability.Vulnerability

Types

type ServerBuilder

type ServerBuilder struct {
	DBFormat        string
	DBBuildTime     time.Time
	DBVersion       schemaver.SchemaVer
	Vulnerabilities []vulnerability.Vulnerability
	LatestDoc       *distribution.LatestDocument
	ServerSubdir    string
	LatestDocFile   string
	RequestHandler  http.HandlerFunc
	// contains filtered or unexported fields
}

func NewServer

func NewServer(t *testing.T) *ServerBuilder

NewServer creates a new test db server building a single database from the provided vulnerabilities, along with a latest.json pointing to it, optionally with any properties specified in the provided latest parameter

func (*ServerBuilder) SetDBBuilt

func (s *ServerBuilder) SetDBBuilt(t time.Time) *ServerBuilder

func (*ServerBuilder) SetDBVersion

func (s *ServerBuilder) SetDBVersion(major, minor, patch int) *ServerBuilder

func (*ServerBuilder) Start

func (s *ServerBuilder) Start() (url string)

Start starts builds a database and starts a server with the current settings if you need to rebuild a DB or modify the behavior, you can either set a custom RequestHandler func or modify the settings and call Start() again. Returns a URL to the latest.json file, e.g. http://127.0.0.1:5678/v6/latest.json

func (*ServerBuilder) WithHandler

func (s *ServerBuilder) WithHandler(handler http.HandlerFunc) *ServerBuilder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳