vervet

package module
v0.0.0-...-f76493d Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseHandler

type BaseHandler struct {
	Config
	Logger
}

func NewBaseHandler

func NewBaseHandler(config Config, logger Logger) *BaseHandler

func (*BaseHandler) Process

func (this *BaseHandler) Process(r *http.Request, resources []string, f ProcessFunc) (string, error)

type Config

type Config interface {
	GetUrlPattern() (string, error)
	GetLogIdLiteral() (string, error)
	GetErrorCodeLiteral() (string, error)
	GetErrorMessageLiteral() (string, error)
	GetTimeCostLiteral() (string, error)
	GetRequestUrlLiteral() (string, error)
}

type Handler

type Handler interface {
	Process(
		r *http.Request,
		resources []string,
		f ProcessFunc) (string, error)

	ProcessFunc(
		method string,
		resources []string,
		params map[string]string,
		body []byte,
		result map[string]interface{}) error
}

type Logger

type Logger interface {
	Fatal(format string, args ...interface{}) error
	Error(format string, args ...interface{}) error
	Warn(format string, args ...interface{}) error
	Info(format string, args ...interface{}) error
	Debug(format string, args ...interface{}) error
	Trace(format string, args ...interface{}) error
}

type ProcessFunc

type ProcessFunc func(
	method string,
	resources []string,
	params map[string]string,
	body []byte,
	result map[string]interface{}) error

type Router

type Router struct {
	Config
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(config Config, routes map[string]Handler) *Router

func (*Router) ServeHTTP

func (this *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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