database

package
v0.0.0-...-4f36034 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(db Datastore) func(http.Handler) http.Handler

Middleware packs a pointer to the datastore into context

Types

type Datastore

type Datastore interface {
	Create(entity *models.ProblemReport) (*models.ProblemReport, error)
	GetAll() ([]models.ProblemReport, error)
	GetAllByPeriod(startDate time.Time, endDate time.Time) ([]models.ProblemReport, error)
	GetCategories() ([]models.ProblemReportCategory, error)
}

func ConnectToDB

func ConnectToDB() (Datastore, error)

ConnectToDB extracts connection information from environment variables and initiates a connection to the database.

Jump to

Keyboard shortcuts

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