Documentation ¶
Index ¶
- Variables
- func Binding(ctx *gin.Context) binding.Binding
- func GetLogger(ctx context.Context) *log.Log
- func NewGrpcServer(interceptors ...grpc.UnaryServerInterceptor) *grpc.Server
- type Context
- type Controller
- type Denny
- func (r *Denny) Controller(path string, method HttpMethod, ctl controller) *Denny
- func (r *Denny) GraceFulStart(addrs ...string) error
- func (r *Denny) NewGroup(path string) *group
- func (r *Denny) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Denny) SetValidator(v binding.StructValidator) *Denny
- func (r *Denny) Start(addrs ...string) error
- func (r *Denny) WithGrpcServer(server *grpc.Server) *Denny
- func (r *Denny) WithMiddleware(middleware ...HandleFunc)
- func (r *Denny) WithRegistry(registry naming.Registry) *Denny
- type HandleFunc
- type HttpMethod
Constants ¶
This section is empty.
Variables ¶
var Validator = binding.Validator
Functions ¶
func NewGrpcServer ¶
func NewGrpcServer(interceptors ...grpc.UnaryServerInterceptor) *grpc.Server
Types ¶
type Controller ¶
type Controller struct { binding.StructValidator *log.Log }
func (*Controller) SetValidator ¶
func (c *Controller) SetValidator(v binding.StructValidator)
type Denny ¶
func (*Denny) Controller ¶
func (r *Denny) Controller(path string, method HttpMethod, ctl controller) *Denny
Controller register a controller with given path, method to http routes
func (*Denny) GraceFulStart ¶
GraceFulStart uses net http standard server it also detect if grpc server and discovery registry are available to start Denny in brpc mode, in this mode, server will support both protocol using same port and register channel listen to os signals to make it graceful stop
func (*Denny) ServeHTTP ¶
func (r *Denny) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP conforms to the http.Handler interface.
func (*Denny) SetValidator ¶
func (r *Denny) SetValidator(v binding.StructValidator) *Denny
SetValidator overwrites default gin validate with provides validator we're using v10 validator
func (*Denny) Start ¶
Start http server with given address Deprecated: use GraceFulStart(addrs ...string) instead.
func (*Denny) WithGrpcServer ¶
WithGrpcServer turns Denny into grpc server
func (*Denny) WithMiddleware ¶
func (r *Denny) WithMiddleware(middleware ...HandleFunc)
WithMiddleware registers middleware to http server only gin style middleware is supported
type HandleFunc ¶
type HandleFunc = gin.HandlerFunc
type HttpMethod ¶
type HttpMethod string
const ( HttpGet HttpMethod = "GET" HttpPost HttpMethod = "POST" HttpPatch HttpMethod = "PATCH" HttpOption HttpMethod = "OPTION" HttpDelete HttpMethod = "DELETE" )
Directories ¶
Path | Synopsis |
---|---|
Package config is an interface for dynamic configuration.
|
Package config is an interface for dynamic configuration. |
encoder
Package encoder handles source encoding formats
|
Package encoder handles source encoding formats |
loader
package loader manages loading from multiple sources
|
package loader manages loading from multiple sources |
options
Package options provides a way to initialise options
|
Package options provides a way to initialise options |
reader
Package reader parses change sets and provides config values
|
Package reader parses change sets and provides config values |
source
Package source is the interface for sources
|
Package source is the interface for sources |
source/file
Package file is a file source.
|
Package file is a file source. |
source/memory
Package memory is a memory source
|
Package memory is a memory source |
middleware contains built-in/necessary middleware (http) and interceptor (grpc)
|
middleware contains built-in/necessary middleware (http) and interceptor (grpc) |
package naming is interface for both registry register/unregister and grpc builder/resolver
|
package naming is interface for both registry register/unregister and grpc builder/resolver |