gendry

package
v0.0.0-...-32a2369 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIEndpoint

type APIEndpoint interface {
	Get(http.ResponseWriter, *http.Request, url.Values)
	Post(http.ResponseWriter, *http.Request, url.Values)
	Delete(http.ResponseWriter, *http.Request, url.Values)
}

APIEndpoint represents a single route that is can respond to various HTTP methods.

func NewDisplayAPI

func NewDisplayAPI(reports models.ReportStore, projects models.ProjectStore, files FileStore) APIEndpoint

NewDisplayAPI returns a new APIEndpoint capable of returning badge data from shields.io.

func NewProjectAPI

func NewProjectAPI(store models.ProjectStore, log LeveledLogger) APIEndpoint

NewProjectAPI creates the api endpoint that is able to create new projects.

func NewReportAPI

NewReportAPI returns an api for storing and retreiving reports

type Action

type Action func(http.ResponseWriter, *http.Request, url.Values)

Action types represent a single http request handler, wearere the last url.Values parameter contains path params.

type FileStore

type FileStore interface {
	NewFile(string, string) (string, io.WriteCloser, error)
	FindFile(string) (io.ReadCloser, error)
}

FileStore defines an interface that is useful for creating writer that persist files.

func NewFileStore

func NewFileStore(driver string, configuration *url.Values, db *sql.DB) FileStore

NewFileStore returns an implementation of the FileStore interface.

type LeveledLogger

type LeveledLogger interface {
	Infof(string, ...interface{})
	Debugf(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
}

LeveledLogger is a simple interface for logging messages at different "levels"

type RouteList

type RouteList map[*regexp.Regexp]APIEndpoint

RouteList is map of path expressions and their endpoints; matches an incoming request to a single action.

func (*RouteList) Match

func (l *RouteList) Match(request *http.Request) (Action, url.Values, bool)

Match performs a lookup based on a given http.Reqest record, returning the action associated w/ the path/method.

type Runtime

type Runtime interface {
	Start(string, chan<- error)
}

Runtime defines an interface that is used as the http runtime for the gendry api.

func NewRuntime

func NewRuntime(routes *RouteList, log LeveledLogger) Runtime

NewRuntime returns an initialized runtime using the provided route list.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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