wresource

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 4 Imported by: 23

Documentation

Index

Constants

View Source
const (
	ResourceTagName = "service-name"
	MethodTagName   = "method"
	EndpointTagName = "endpoint"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource interface {
	// Register performs the same operation as the Router.Register, but registers the route using the provided
	// resourceName as the resource name that will be used as the tag in the recorded metric.
	Register(endpointName, method, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Get is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Get(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Head is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Head(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Post is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Post(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Put is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Put(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Patch is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Patch(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error

	// Delete is a shorthand for Register(endpointName, http.MethodGet, handler, params...)
	Delete(endpointName, path string, handler http.Handler, params ...wrouter.RouteParam) error
}

Resource provides a way to register a collection of endpoints. All of the routes registered using Resource will be tagged with the "service-name" and "endpoint" metrics.

func New

func New(resourceName string, router wrouter.Router) Resource

Jump to

Keyboard shortcuts

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