Documentation
¶
Index ¶
- Variables
- func AllowAllCorsMiddleware(h http.Handler) http.Handler
- type AppHandler
- type AppHandlerWithUserID
- type BuildInfo
- type Config
- type ConfigureRouterHandler
- type GelfFormatter
- type ServerStatus
- type Timeouts
- type WebService
- type WebServiceBase
- type WebServiceBeforeEnd
- type WebServiceBeforeStart
- type WebServiceGetHTTPHandlerObsolete
- type WebServiceGetStatusHandler
- type WebServiceObject
- type WebServiceOption
- func WithBuildInfo(bi BuildInfo) WebServiceOption
- func WithIdleTimeout(timeout time.Duration) WebServiceOption
- func WithReadTimeout(timeout time.Duration) WebServiceOption
- func WithTimeouts(write, read, idle time.Duration) WebServiceOption
- func WithWriteTimeout(timeout time.Duration) WebServiceOption
- type WebServicePreparePFlags
Constants ¶
This section is empty.
Variables ¶
var ( Version string BuildTime string CommitSHA string )
Functions ¶
Types ¶
type AppHandler ¶
type AppHandler func(w http.ResponseWriter, r *http.Request) error
AppHandler is handler that take care of content type and error handling
func (AppHandler) ServeHTTP ¶
func (ah AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Satisfies the http.Handler interface
type AppHandlerWithUserID ¶
AppHandlerWithUserID is handler that take care of userID, content type and error handling
func (AppHandlerWithUserID) ServeHTTP ¶
func (ah AppHandlerWithUserID) ServeHTTP(w http.ResponseWriter, r *http.Request)
Satisfies the http.Handler interface
type BuildInfo ¶ added in v0.5.0
type BuildInfo struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` BuildTime string `json:"build_time,omitempty"` CommitSHA string `json:"commit_sha,omitempty"` PreferLdflags bool `json:"-"` }
BuildInfo represents build information for the service
type Config ¶ added in v0.5.0
type Config struct {
// contains filtered or unexported fields
}
Config holds all configuration for WebService
type ConfigureRouterHandler ¶ added in v0.4.0
type ConfigureRouterHandler interface {
ConfigureRouter(router *mux.Router) (handler http.Handler, err error)
}
ConfigureRouterHandler ...
type GelfFormatter ¶
type GelfFormatter struct {
// contains filtered or unexported fields
}
GelfFormatter ...
type ServerStatus ¶
type ServerStatus struct { Running bool `json:"running,omitempty"` Process string `json:"process,omitempty"` Pid int `json:"pid,omitempty"` StripPath string `json:"strip_path,omitempty"` JwksURL string `json:"jwks_url,omitempty"` BuildInfo }
ServerStatus return actual state and process data so you can test with url/state the correct installation of microservice
func NewServerStatus ¶
func NewServerStatus(bi BuildInfo) *ServerStatus
NewServerStatus create default service status
type WebService ¶ added in v0.5.0
type WebService interface {
Start() (err error) // Start service
}
WebService ...
func New ¶ added in v0.5.0
func New(obj WebServiceObject, options ...WebServiceOption) WebService
New creates new web service object
type WebServiceBase ¶ added in v0.5.0
type WebServiceBase struct {
// contains filtered or unexported fields
}
WebServiceBase ...
func (*WebServiceBase) Start ¶ added in v0.5.0
func (s *WebServiceBase) Start() (err error)
Start starts service
type WebServiceBeforeEnd ¶ added in v0.5.0
type WebServiceBeforeEnd interface {
BeforeEnd()
}
WebServiceBeforeEnd ...
type WebServiceBeforeStart ¶ added in v0.5.0
type WebServiceBeforeStart interface {
BeforeStart() (err error)
}
WebServiceBeforeStart ...
type WebServiceGetHTTPHandlerObsolete ¶ added in v0.5.0
type WebServiceGetHTTPHandlerObsolete interface {
GetHTTPHandler() (handler http.Handler, err error)
}
WebServiceGetHTTPHandlerObsolete ...
type WebServiceGetStatusHandler ¶ added in v0.5.0
type WebServiceGetStatusHandler interface {
GetServerStatus() (status interface{})
}
WebServiceGetStatusHandler ...
type WebServiceOption ¶ added in v0.5.0
type WebServiceOption func(*Config)
WebServiceOption defines a function type for setting options
func WithBuildInfo ¶ added in v0.5.0
func WithBuildInfo(bi BuildInfo) WebServiceOption
WithBuildInfo sets the build information
func WithIdleTimeout ¶ added in v0.5.0
func WithIdleTimeout(timeout time.Duration) WebServiceOption
WithIdleTimeout sets the idle timeout
func WithReadTimeout ¶ added in v0.5.0
func WithReadTimeout(timeout time.Duration) WebServiceOption
WithReadTimeout sets the read timeout
func WithTimeouts ¶ added in v0.5.0
func WithTimeouts(write, read, idle time.Duration) WebServiceOption
WithTimeouts sets all timeout values at once
func WithWriteTimeout ¶ added in v0.5.0
func WithWriteTimeout(timeout time.Duration) WebServiceOption
WithWriteTimeout sets the write timeout
type WebServicePreparePFlags ¶ added in v0.5.0
type WebServicePreparePFlags interface {
PreparePFlags() (err error)
}
WebServicePreparePFlags ...