db

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// These maps contain struct representations of dummy data stored
	// in the database for testing (sourced from the sql files in the
	// request-manager/test/data directory). Callers should never
	// modify them.
	//
	// IMPORTANT: if you change the structs below, you will also need
	// to update the corresponding sql that inserts them into the
	// database (in the request-manager/test/data directory).
	SavedRequests map[string]proto.Request           // requestId => request
	SavedJLs      map[string][]proto.JobLog          // requestId => []jl
	SavedJCs      map[string]proto.JobChain          // requestId => jc
	SavedSJCs     map[string]proto.SuspendedJobChain // requestId => sjc
)

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Create creates a new db and populates it the the given data file.
	// It returns the name of the db it creates.
	Create(dataFile string) (string, error)

	// CreateBlank creates a new db without loading the default schema
	// or populating it with any data. It returns the name of the db created.
	CreateBlank() (string, error)

	// LoadSQLFile loads a SQL file to the given schema.
	LoadSQLFile(dbName, file string) error

	// Connect takes a db name and returns a *sql.DB for it.
	Connect(dbName string) (*sql.DB, error)

	// Destroy closes a db's connection and then drops the db.
	Destroy(dbName string) error
}

A Manager manages the lifecycle of test databases. It is safe to use with multiple databases concurrently.

func NewManager

func NewManager() (Manager, error)

Jump to

Keyboard shortcuts

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