web

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHealthHandler added in v0.1.4

func DefaultHealthHandler(c *gin.Context)

func ErrCodeHandler

func ErrCodeHandler(c *gin.Context)

func FlagSet

func FlagSet(defaultPort int) *pflag.FlagSet

func RequestID added in v0.1.1

func RequestID(c *gin.Context) string

func VersionHandler

func VersionHandler(info *Info) gin.HandlerFunc

func ZapRequestID added in v0.1.1

func ZapRequestID(c *gin.Context) zap.Field

Types

type Config

type Config struct {
	Prefix   string `json:"prefix" yaml:"prefix" default:"/"`
	Endpoint string `json:"endpoint" yaml:"endpoint"`
	Host     string `json:"host" yaml:"host" default:"127.0.0.1"`
	Port     int    `json:"port" yaml:"port"`
	Debug    bool   `json:"debug" yaml:"debug"`
	Pprof    bool   `json:"pprof" yaml:"pprof"`
	Metrics  bool   `json:"metrics" yaml:"metrics"`
}

func (*Config) Addr

func (c *Config) Addr() string

func (*Config) FlagSet

func (c *Config) FlagSet(defaultPort int) *pflag.FlagSet

func (*Config) GetEndpoint

func (c *Config) GetEndpoint() string

func (*Config) WithDebug

func (s *Config) WithDebug(v bool) *Config

func (*Config) WithEndpoint

func (s *Config) WithEndpoint(v string) *Config

func (*Config) WithHost

func (s *Config) WithHost(v string) *Config

func (*Config) WithMetrics added in v0.1.3

func (s *Config) WithMetrics(v bool) *Config

func (*Config) WithPort

func (s *Config) WithPort(v int) *Config

func (*Config) WithPprof

func (s *Config) WithPprof(v bool) *Config

func (*Config) WithPrefix

func (s *Config) WithPrefix(v string) *Config

type Handler

type Handler interface {
	Register(gin.IRouter)
}

type Info

type Info struct {
	Name    string
	Version string
	Commit  string
	BuildAt string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(conf *Config, info *Info, fn func(gin.IRouter)) *Service

func (*Service) Build

func (s *Service) Build() *Service

func (*Service) Close

func (s *Service) Close() error

func (*Service) Engine

func (s *Service) Engine() *gin.Engine

func (*Service) Routes

func (s *Service) Routes() []gin.RouteInfo

func (*Service) Serve

func (s *Service) Serve() error

func (*Service) Server

func (s *Service) Server() *http.Server

func (*Service) SetHealthzHandler added in v0.1.4

func (s *Service) SetHealthzHandler(h gin.HandlerFunc)

func (*Service) SetReadinessHandler added in v0.1.4

func (s *Service) SetReadinessHandler(h gin.HandlerFunc)

func (*Service) SetVersionHandler added in v0.1.4

func (s *Service) SetVersionHandler(h gin.HandlerFunc)

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址