Documentation
¶
Index ¶
- Constants
- func GetUptime() int64
- type App
- type HealthStats
- type Middleware
- type Option
- func WithAddress(address string) Option
- func WithCORS(enabled bool) Option
- func WithDebug(debug bool) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMiddleware(middleware Middleware) Option
- func WithPathPrefix(prefix string) Option
- func WithPort(port int) Option
- func WithShutdownTimeout(timeout time.Duration) Option
- func WithStartupTimeout(timeout time.Duration) Option
- type Server
Constants ¶
View Source
const MB float64 = 1.0 * 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App interface { http.Handler // Startup controls app startup Startup(ctx context.Context) error // Shutdown controls app shutdown Shutdown(ctx context.Context) error }
App is a http.Handler with Startup and Shutdown lifecycle
type HealthStats ¶
type HealthStats struct { Uptime int64 `json:"uptime"` AllocatedMemory float64 `json:"allocated_memory"` TotalAllocatedMemory float64 `json:"total_allocated_memory"` Goroutines int `json:"goroutines"` GCCycles uint32 `json:"gc_cycles"` NumberOfCPUs int `json:"number_of_cpus"` HeapSys float64 `json:"heap_sys"` HeapAllocated float64 `json:"heap_allocated"` ObjectsInUse uint64 `json:"objects_in_use"` OSMemoryObtained float64 `json:"os_memory_obtained"` }
func GetHealthStats ¶
func GetHealthStats() *HealthStats
type Option ¶
type Option func(s *Server)
func WithAddress ¶
func WithLogger ¶
func WithMiddleware ¶
func WithMiddleware(middleware Middleware) Option
func WithPathPrefix ¶
func WithShutdownTimeout ¶ added in v0.1.5
func WithStartupTimeout ¶ added in v0.1.5
Click to show internal directories.
Click to hide internal directories.