...
  Package endpoint
	
	
		
		
		
		
			
				
			
			
				
				
Package endpoint defines an abstraction for RPCs.
Endpoints are a fundamental building block for many Go kit components.
Endpoints are implemented by servers, and called by clients.
			 
		 
		
		
		
		
			
		
 
		
			
			
			  In the call graph viewer below, each node
			  is a function belonging to this package
			  and its children are the functions it
			  calls—perhaps dynamically.
			
			
			  The root nodes are the entry points of the
			  package: functions that may be called from
			  outside the package.
			  There may be non-exported or anonymous
			  functions among them if they are called
			  dynamically from another package.
			
			
			  Click a node to visit that function's source code.
			  From there you can visit its callers by
			  clicking its declaring func
			  token.
			
			
			  Functions may be omitted if they were
			  determined to be unreachable in the
			  particular programs or tests that were
			  analyzed.
			
			
			
		 
		  
		
		
		
			
			
			
			func Nop(context.Context, interface{}) (interface{}, error)
			
Nop is an endpoint that does nothing and returns a nil error.
Useful for tests.
			
			
		
		
			
			
			
			
Endpoint is the fundamental building block of servers and clients.
It represents a single RPC method.
			type Endpoint func(ctx context.Context, request interface{}) (response interface{}, err error)
			
			
			
			
			
			
			
		
			
			
			
			
Middleware is a chainable behavior modifier for endpoints.
			type Middleware func(Endpoint) Endpoint
			
			
			
			
			
			
				
				
				func Chain(outer Middleware, others ...Middleware) Middleware
				
Chain is a helper function for composing middlewares. Requests will
traverse them in the order they're declared. That is, the first middleware
is treated as the outermost middleware.
				
	
	
		▾ Example
		
		
		
			Code:
			package endpoint_test
import (
    "context"
    "fmt"
    "github.com/go-kit/kit/endpoint"
)
func ExampleChain() {
    e := endpoint.Chain(
        annotate("first"),
        annotate("second"),
        annotate("third"),
    )(myEndpoint)
    if _, err := e(ctx, req); err != nil {
        panic(err)
    }
    
    
    
    
    
    
    
    
}
var (
    ctx = context.Background()
    req = struct{}{}
)
func annotate(s string) endpoint.Middleware {
    return func(next endpoint.Endpoint) endpoint.Endpoint {
        return func(ctx context.Context, request interface{}) (interface{}, error) {
            fmt.Println(s, "pre")
            defer fmt.Println(s, "post")
            return next(ctx, request)
        }
    }
}
func myEndpoint(context.Context, interface{}) (interface{}, error) {
    fmt.Println("my endpoint!")
    return struct{}{}, nil
}