Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Set(key, value interface{}) (err error) Get(key interface{}) (value interface{}, err error) }
Cache interface uses for middleware as key-value storage for requests.
type Middleware ¶
type Middleware func(service.UserService) service.UserService
Service middleware (closure).
func CachingMiddleware ¶
func CachingMiddleware(cache Cache) Middleware
func ErrorLoggingMiddleware ¶
func ErrorLoggingMiddleware(logger log.Logger) Middleware
ErrorLoggingMiddleware writes to logger any error, if it is not nil.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
LoggingMiddleware writes params, results and working time of method call to provided logger after its execution.
func RecoveringMiddleware ¶
func RecoveringMiddleware(logger log.Logger) Middleware
RecoveringMiddleware recovers panics from method calls, writes to provided logger and returns the error of panic as method error.
Click to show internal directories.
Click to hide internal directories.