Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElasticEndpointRequestHandler ¶
type ElasticEndpointRequestHandler func(string, string, string, *http.Request, PGElasticServer) (interface{}, error)
ElasticEndpointRequestHandler is a handler function for requests with URL: /<index>/<type>/<endpoint>. Index, type and endpoint are automatically extracted from URL
type ElasticHandler ¶
type ElasticHandler struct {
// contains filtered or unexported fields
}
ElasticHandler contains information how to precess all routes of the server
func NewElasticHandler ¶
func NewElasticHandler(s PGElasticServer) (result *ElasticHandler)
NewElasticHandler creates a new instance of handler-router for PGElasticServer
func (*ElasticHandler) HandleFunc ¶
func (h *ElasticHandler) HandleFunc(pattern *regexp.Regexp, handler ElasticRequestHandler, methods []string)
HandleFunc adds a handler for request. URL is described via pattern
func (*ElasticHandler) HandleFuncEndpoint ¶
func (h *ElasticHandler) HandleFuncEndpoint(pattern *regexp.Regexp, handler ElasticEndpointRequestHandler, methods []string)
HandleFuncEndpoint adds a handler for request with URL: /<index>/<type>/<endpoint>. Endpoint format is described via pattern
func (*ElasticHandler) ServeHTTP ¶
func (h *ElasticHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles and route request to appropriate handler
type ElasticRequestHandler ¶
type ElasticRequestHandler func(string, *http.Request, PGElasticServer) (interface{}, error)
ElasticRequestHandler is a handler function for any request
type PGElasticServer ¶
type PGElasticServer interface { GetConfiguration() utils.PGElasticConfig GetDBClient() *db.Client Start() }
PGElasticServer represents a HTTP server which provides an ElasticSearch like API