Versions in this module Expand all Collapse all v0 v0.1.0 Apr 2, 2026 Changes in this version + const RealIPKey + const RequestIDKey + const UserIDKey + const Version + var ErrInvalidToken = NewError(ErrCodeInvalidToken, "Invalid token") + var ErrKeyExpired = fmt.Errorf("key expired") + var ErrKeyNotFound = fmt.Errorf("key not found") + var ErrServiceUnavailable = NewError(ErrCodeServiceUnavailable, "Service temporarily unavailable") + var ErrTokenExpired = NewError(ErrCodeTokenExpired, "Token expired") + func CORSMiddlewareFunc(cfg *CORSConfig) func(http.Handler) http.Handler + func GenerateSessionID() (string, error) + func GetUserFromContext(ctx context.Context) (string, string, string) + func GetUserIDFromContext(ctx context.Context) string + func HealthMiddleware(app *App) func(http.Handler) http.Handler + func HelmetCSPDefault() string + func HelmetCSPStrict() string + func IsXError(err error) bool + func LoadConfigFromFile(path string, cfg interface{}) error + func LoadConfigFromFiles(paths []string, cfg interface{}) error + func LoadEnvConfig(prefix string, cfg interface{}) error + func NoCache() func(http.Handler) http.Handler + func RecordCacheHit() + func RecordCacheMiss() + func RecordDBQuery(query string, duration time.Duration) + func RecordWSConnection() + func RecordWSDisconnection() + func RecordWSMessage() + func RegisterCustomValidator(tag string, fn CustomValidator) error + func SetDefaultLogger(logger *Logger) + func StaticCache(maxAge int) func(http.Handler) http.Handler + func Validate(s interface{}) error + func ValidateContext(ctx context.Context, s interface{}) error + func ValidateVar(field interface{}, tag string) error + type App struct + func New() *App + func (a *App) Cache() Cache + func (a *App) Cron() *Cron + func (a *App) Database() *Database + func (a *App) Graceful() *Graceful + func (a *App) Logger() *Logger + func (a *App) Router() *Router + func (a *App) Run() error + func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (a *App) Services() *ServiceManager + func (a *App) Use(mw func(http.Handler) http.Handler) *App + func (a *App) WebSocket() *WebSocket + func (a *App) WithCache(cfg *CacheConfig) *App + func (a *App) WithConfig(cfg *Config) *App + func (a *App) WithCron(cfg *CronConfig) *App + func (a *App) WithDatabase(cfg *DatabaseConfig) *App + func (a *App) WithGraceful(cfg *GracefulConfig) *App + func (a *App) WithHTTP(cfg *HTTPConfig) *App + func (a *App) WithLogger(cfg *LoggerConfig) *App + func (a *App) WithService(service Service) *App + func (a *App) WithWebSocket(cfg *WebsocketConfig) *App + type Binding interface + Bind func(*http.Request, interface{}) error + Name func() string + var Form Binding = &FormBinding{} + var Header Binding = &HeaderBinding{} + var JSON Binding = &JSONBinding{} + var Query Binding = &QueryBinding{} + type BodyParser struct + func NewBodyParser(maxSize int64) *BodyParser + func (p *BodyParser) Middleware(next http.Handler) http.Handler + type CORSConfig struct + AllowCredentials bool + AllowedHeaders []string + AllowedMethods []string + AllowedOrigins []string + Enabled bool + ExposedHeaders []string + MaxAge int + type CORSMiddleware struct + func NewCORSMiddleware(cfg *CORSConfig) *CORSMiddleware + func (m *CORSMiddleware) Handler(next http.Handler) http.Handler + func (m *CORSMiddleware) MiddlewareFunc() func(http.Handler) http.Handler + type CSRF struct + func NewCSRF(cfg *CSRFConfig) *CSRF + func (c *CSRF) Middleware(next http.Handler) http.Handler + func (c *CSRF) TokenGenerator() http.HandlerFunc + type CSRFConfig struct + CookieDomain string + CookieHTTPOnly bool + CookieName string + CookiePath string + CookieSameSite http.SameSite + CookieSecure bool + ExpireDuration time.Duration + FormKeyName string + HeaderName string + IgnoredMethods []string + TokenLength int + TokenName string + TrustedOrigins []string + func NewCSRFConfig() *CSRFConfig + type Cache interface + Clear func(ctx context.Context) error + Close func() error + Delete func(ctx context.Context, key string) error + Exists func(ctx context.Context, key string) (bool, error) + Get func(ctx context.Context, key string) (interface{}, error) + Keys func(ctx context.Context, pattern string) ([]string, error) + MGet func(ctx context.Context, keys ...string) ([]interface{}, error) + MSet func(ctx context.Context, items map[string]interface{}) error + Set func(ctx context.Context, key string, value interface{}, ttl time.Duration) error + TTL func(ctx context.Context, key string) (time.Duration, error) + Tags func() CacheTags + func NewCache(cfg *CacheConfig) (Cache, error) + type CacheConfig struct + CleanupInterval int + Driver string + Enabled bool + FilePath string + RedisAddr string + RedisDB int + RedisPassword string + RedisPoolSize int + RedisTLS bool + TTL int + type CacheTags interface + GetTags func(ctx context.Context, key string) ([]string, error) + InvalidateByTag func(ctx context.Context, tag string) error + InvalidateByTags func(ctx context.Context, tags ...string) error + SetTags func(ctx context.Context, key string, tags ...string) error + type ComponentHealth struct + Message string + Status string + type Compression struct + func NewCompression(level int) *Compression + func (c *Compression) Middleware(next http.Handler) http.Handler + type Config struct + Cache *CacheConfig + Cron *CronConfig + Database *DatabaseConfig + Graceful *GracefulConfig + HTTP *HTTPConfig + Logger *LoggerConfig + Websocket *WebsocketConfig + type ConfigLoader struct + func NewConfigLoader() *ConfigLoader + func (cl *ConfigLoader) AddConfigPath(path string) *ConfigLoader + func (cl *ConfigLoader) AutomaticEnv() *ConfigLoader + func (cl *ConfigLoader) GetBool(key string) bool + func (cl *ConfigLoader) GetInt(key string) int + func (cl *ConfigLoader) GetString(key string) string + func (cl *ConfigLoader) GetStringSlice(key string) []string + func (cl *ConfigLoader) Load(cfg interface{}) error + func (cl *ConfigLoader) LoadStrict(cfg interface{}) error + func (cl *ConfigLoader) MergeConfigOverride(override map[string]interface{}) error + func (cl *ConfigLoader) OnConfigChange(run func(e fsnotify.Event)) + func (cl *ConfigLoader) SetConfigFile(path string) *ConfigLoader + func (cl *ConfigLoader) SetConfigType(typ string) *ConfigLoader + func (cl *ConfigLoader) SetEnvKeyReplacer(oldNew ...string) *strings.Replacer + func (cl *ConfigLoader) SetEnvPrefix(prefix string) *ConfigLoader + func (cl *ConfigLoader) WatchConfig() + type ConnStats struct + IdleConns int + InUseConns int + MaxOpenConns int + OpenConns int + WaitCount int64 + WaitDuration time.Duration + type ConsoleLoggerConfig struct + Colorable bool + type Context struct + App *App + Params map[string]string + Query url.Values + Request *http.Request + Response http.ResponseWriter + Router *Router + StatusCode int + func NewContext(w http.ResponseWriter, r *http.Request) *Context + func (c *Context) Abort() + func (c *Context) AbortWithError(code int, err error) error + func (c *Context) AbortWithStatus(code int) + func (c *Context) AddError(err error) + func (c *Context) BindBody(bindFunc func([]byte, interface{}) error, obj interface{}) error + func (c *Context) BindForm(v interface{}) error + func (c *Context) BindHeader(v interface{}) error + func (c *Context) BindJSON(v interface{}) error + func (c *Context) BindQuery(v interface{}) error + func (c *Context) BindURI(v interface{}) error + func (c *Context) Body() ([]byte, error) + func (c *Context) Bytes(code int, contentType string, data []byte) error + func (c *Context) ClientIP() string + func (c *Context) ContentType() string + func (c *Context) Context() context.Context + func (c *Context) Cookie(name string) (*http.Cookie, error) + func (c *Context) Cookies() []*http.Cookie + func (c *Context) Data(code int, contentType string, data []byte) error + func (c *Context) DefaultParam(key, defaultValue string) string + func (c *Context) DefaultPostForm(key, defaultValue string) string + func (c *Context) DefaultQuery(key, defaultValue string) string + func (c *Context) DeleteCookie(name string, path string, domains ...string) + func (c *Context) Error() error + func (c *Context) Errors() []error + func (c *Context) File(filepath string) error + func (c *Context) FileInline(filepath string, name string) error + func (c *Context) FormFile(key string) (multipart.File, *multipart.FileHeader, error) + func (c *Context) Get(key string) interface{} + func (c *Context) GetBody() ([]byte, error) + func (c *Context) GetBool(key string) (bool, error) + func (c *Context) GetFloat64(key string) (float64, error) + func (c *Context) GetHeader(key string) string + func (c *Context) GetHeaderReal(key string) string + func (c *Context) GetInt(key string) (int, error) + func (c *Context) GetInt64(key string) (int64, error) + func (c *Context) GetQuery(key string) (string, bool) + func (c *Context) HTML(code int, html string) error + func (c *Context) Handler() HandlerFunc + func (c *Context) Header(key, value string) + func (c *Context) Host() string + func (c *Context) IsAjax() bool + func (c *Context) IsSecure() bool + func (c *Context) IsWebSocket() string + func (c *Context) JSON(code int, obj interface{}) error + func (c *Context) JSONCreated(data interface{}, message string) error + func (c *Context) JSONError(code int, message string) error + func (c *Context) JSONP(callback string, obj interface{}) error + func (c *Context) JSONPaginated(data interface{}, page, perPage int, total int64) error + func (c *Context) JSONSuccess(data interface{}) error + func (c *Context) JSONValidationError(errors []ResponseError) error + func (c *Context) Logger() *Logger + func (c *Context) Loggerf(format string, args ...interface{}) + func (c *Context) Method() string + func (c *Context) MultipartForm() (*multipart.Form, error) + func (c *Context) Next() error + func (c *Context) NoContent(code int) error + func (c *Context) Param(key string) string + func (c *Context) PostForm(key string) string + func (c *Context) QueryParam(key string) string + func (c *Context) RealIP() string + func (c *Context) Redirect(code int, url string) error + func (c *Context) RemoteAddr() string + func (c *Context) RequestID() string + func (c *Context) Reset(w http.ResponseWriter, r *http.Request) + func (c *Context) SendFile(file string, name string) error + func (c *Context) ServeFile(file string) + func (c *Context) Set(key string, value interface{}) + func (c *Context) SetCacheControl(seconds int) + func (c *Context) SetContentType(contentType string) + func (c *Context) SetCookie(cookie *http.Cookie) + func (c *Context) SetLogger(logger *Logger) + func (c *Context) Status(code int) + func (c *Context) Stream(code int, contentType string, readFunc func(w io.Writer, fl http.Flusher) bool) error + func (c *Context) String(code int, format string, args ...interface{}) error + func (c *Context) URL() *url.URL + func (c *Context) UserAgent() string + func (c *Context) UserID() string + func (c *Context) XML(code int, obj interface{}) error + func (c Context) Deadline() (deadline time.Time, ok bool) + func (c Context) Done() <-chan struct{} + func (c Context) Err() error + func (c Context) Value(key interface{}) interface{} + type Cron struct + func NewCron(cfg *CronConfig, logger *Logger) *Cron + func (c *Cron) AddFunc(name, spec string, fn func() error) (*CronJob, error) + func (c *Cron) AddJob(name, spec string, fn func() error) (*CronJob, error) + func (c *Cron) Entries() []cron.Entry + func (c *Cron) ListJobs() []*CronJob + func (c *Cron) Remove(id cron.EntryID) + func (c *Cron) Run() + func (c *Cron) Start() + func (c *Cron) Stop() + type CronConfig struct + MaxJobs int + RecoverPan bool + Timezone string + type CronJob struct + Func func() error + Name string + Spec string + type CustomValidator func(interface{}) error + type DBHealth struct + ConnStats ConnStats + Error string + Latency time.Duration + Status string + type Database struct + func NewDatabase(cfg *DatabaseConfig, logger *Logger) (*Database, error) + func (d *Database) Close() error + func (d *Database) ConnectWithRetry(cfg *DatabaseConfig, logger *Logger, maxRetries int, retryDelay time.Duration) (*Database, error) + func (d *Database) Database() (*sql.DB, error) + func (d *Database) Health(ctx context.Context) DBHealth + func (d *Database) Ping(ctx context.Context) error + func (d *Database) PoolStats(ctx context.Context) (ConnStats, error) + func (d *Database) Transaction(ctx context.Context, fn func(ctx context.Context) error) error + type DatabaseConfig struct + Charset string + ConnMaxIdleTime int + ConnMaxLifetime int + ConnectTimeout int + ConnectionName string + CustomLogger bool + DBName string + Driver string + Enabled bool + Host string + LogLevel string + MaxIdleConns int + MaxOpenConns int + Password string + PoolMode string + Port int + QueryTimeout int + SSLMode string + Timezone string + User string + type ErrorCode string + const ErrCodeAlreadyExists + const ErrCodeBadRequest + const ErrCodeCacheError + const ErrCodeCanceled + const ErrCodeConflict + const ErrCodeDatabaseError + const ErrCodeExternalAPI + const ErrCodeForbidden + const ErrCodeGatewayTimeout + const ErrCodeInternal + const ErrCodeInvalidInput + const ErrCodeInvalidToken + const ErrCodeMethodNotAllowed + const ErrCodeNotFound + const ErrCodeRateLimitExceeded + const ErrCodeServiceUnavailable + const ErrCodeTimeout + const ErrCodeTokenExpired + const ErrCodeTooManyRequests + const ErrCodeUnauthorized + const ErrCodeValidation + type ErrorHandler struct + func NewErrorHandler(logger *Logger) *ErrorHandler + func (h *ErrorHandler) Handle(err error) (int, interface{}) + func (h *ErrorHandler) HandleError(c *Context, err error) error + func (h *ErrorHandler) Middleware(next HandlerFunc) HandlerFunc + type ErrorResponse struct + Code int + Errors []ResponseError + Message string + Meta *ResponseMeta + Status ResponseStatus + func NewErrorResponse(code int, msg string) *ErrorResponse + func (e *ErrorResponse) WithErrors(errors []ResponseError) *ErrorResponse + func (e *ErrorResponse) Write(w http.ResponseWriter) error + type FileCache struct + func NewFileCache(basePath string, ttl int) (*FileCache, error) + func (c *FileCache) Clear(ctx context.Context) error + func (c *FileCache) Close() error + func (c *FileCache) Delete(ctx context.Context, key string) error + func (c *FileCache) Exists(ctx context.Context, key string) (bool, error) + func (c *FileCache) Get(ctx context.Context, key string) (interface{}, error) + func (c *FileCache) Keys(ctx context.Context, pattern string) ([]string, error) + func (c *FileCache) MGet(ctx context.Context, keys ...string) ([]interface{}, error) + func (c *FileCache) MSet(ctx context.Context, items map[string]interface{}) error + func (c *FileCache) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (c *FileCache) TTL(ctx context.Context, key string) (time.Duration, error) + func (c *FileCache) Tags() CacheTags + type FormBinding struct + func (f *FormBinding) Bind(req *http.Request, v interface{}) error + func (f *FormBinding) Name() string + type GormLogger struct + func (g *GormLogger) Error(ctx context.Context, msg string, args ...interface{}) + func (g *GormLogger) Info(ctx context.Context, msg string, args ...interface{}) + func (g *GormLogger) LogMode(level logger.LogLevel) logger.Interface + func (g *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) + func (g *GormLogger) Warn(ctx context.Context, msg string, args ...interface{}) + type Graceful struct + func NewGraceful(timeout int, logger *Logger) *Graceful + func (g *Graceful) AddCache(cache Cache) + func (g *Graceful) AddCallback(fn func() error) + func (g *Graceful) AddCallbackFunc(name string, fn func() error) + func (g *Graceful) AddDatabase(db *Database) + func (g *Graceful) AddServer(server *http.Server) + func (g *Graceful) AddWebSocket(ws *WebSocket) + func (g *Graceful) Run(servers ...*http.Server) + func (g *Graceful) SetCallbackTimeout(timeout time.Duration) *Graceful + func (g *Graceful) SetLogger(logger *Logger) + func (g *Graceful) Shutdown() + func (g *Graceful) SignalChannel() chan os.Signal + func (g *Graceful) Wait() + type GracefulConfig struct + Timeout int + type HTTPConfig struct + CORS *CORSConfig + EnablePprof bool + Host string + IdleTimeout int + Middlewares []string + Port int + RateLimit *RateLimitConfig + ReadTimeout int + StaticDir string + StaticPath string + WriteTimeout int + type HandlerFunc func(c *Context) error + type HeaderBinding struct + func (h *HeaderBinding) Bind(req *http.Request, v interface{}) error + func (h *HeaderBinding) Name() string + type HealthChecker interface + Health func() ComponentHealth + type HealthStatus struct + Components map[string]ComponentHealth + Status string + Timestamp time.Time + type Hub struct + func (h *Hub) BroadcastToRoom(room string, message []byte) + func (h *Hub) Stop() + type JSONBinding struct + func (j *JSONBinding) Bind(req *http.Request, v interface{}) error + func (j *JSONBinding) Name() string + type JWTClaims struct + Email string + Role string + UserID string + Username string + func GetJWTClaims(ctx context.Context) *JWTClaims + func NewJWTClaims(userID, username, email, role string) *JWTClaims + func (c *JWTClaims) GetEmail() string + func (c *JWTClaims) GetRole() string + func (c *JWTClaims) GetUserID() string + func (c *JWTClaims) GetUsername() string + type JWTConfig struct + Algorithm string + Claims jwt.Claims + ContextKey string + CookieDomain string + CookieHTTPOnly bool + CookieName string + CookiePath string + CookieSameSite http.SameSite + CookieSecure bool + Expiration time.Duration + HeaderName string + Lookup string + Prefix string + RefreshExpiration time.Duration + Secret string + SignKey interface{} + TokenLookup string + VerifyKey interface{} + func NewJWTConfig(secret string) *JWTConfig + func (c *JWTConfig) WithAlgorithm(alg string) *JWTConfig + func (c *JWTConfig) WithContextKey(key string) *JWTConfig + func (c *JWTConfig) WithCookieHTTPOnly(httpOnly bool) *JWTConfig + func (c *JWTConfig) WithCookieName(name string) *JWTConfig + func (c *JWTConfig) WithCookieSameSite(sameSite http.SameSite) *JWTConfig + func (c *JWTConfig) WithCookieSecure(secure bool) *JWTConfig + func (c *JWTConfig) WithExpiration(exp time.Duration) *JWTConfig + func (c *JWTConfig) WithRSAPrivateKey(pemData []byte) (*JWTConfig, error) + func (c *JWTConfig) WithRSAPublicKey(pemData []byte) (*JWTConfig, error) + func (c *JWTConfig) WithRSAPublicKeyFromPrivateKey(pemData []byte) (*JWTConfig, error) + type JWTMiddleware struct + func NewJWTMiddleware(config *JWTConfig) *JWTMiddleware + func (m *JWTMiddleware) ClearTokenCookie(w http.ResponseWriter) + func (m *JWTMiddleware) Exclude(paths ...string) *JWTMiddleware + func (m *JWTMiddleware) ExtractClaims(r *http.Request) (jwt.Claims, error) + func (m *JWTMiddleware) GenerateToken(claims *JWTClaims) (string, error) + func (m *JWTMiddleware) GenerateTokenWithClaims(claims jwt.Claims) (string, error) + func (m *JWTMiddleware) Middleware(next http.Handler) http.Handler + func (m *JWTMiddleware) ParseToken(tokenString string) (jwt.Claims, error) + func (m *JWTMiddleware) SetTokenCookie(w http.ResponseWriter, token string) + type Logger struct + func DefaultLogger() *Logger + func NewLogger(cfg *LoggerConfig) (*Logger, error) + func (l *Logger) Debug() *zerolog.Event + func (l *Logger) Error() *zerolog.Event + func (l *Logger) Fatal() *zerolog.Event + func (l *Logger) Hook(h zerolog.Hook) *Logger + func (l *Logger) Info() *zerolog.Event + func (l *Logger) Level(level string) *Logger + func (l *Logger) Log() *zerolog.Event + func (l *Logger) LogLevel() string + func (l *Logger) Output(w io.Writer) *Logger + func (l *Logger) Panic() *zerolog.Event + func (l *Logger) Warn() *zerolog.Event + func (l *Logger) With() zerolog.Context + func (l *Logger) WithErrorFile(path string, maxSize, maxAge, maxBackups int, compress bool) error + type LoggerConfig struct + Caller bool + Compress bool + Console *ConsoleLoggerConfig + FilePath string + Format string + Level string + MaxAge int + MaxBackups int + MaxSize int + Output string + TimestampField string + type MemoryCache struct + func NewMemoryCache(cleanupInterval int) *MemoryCache + func (c *MemoryCache) Clear(ctx context.Context) error + func (c *MemoryCache) Close() error + func (c *MemoryCache) Delete(ctx context.Context, key string) error + func (c *MemoryCache) Exists(ctx context.Context, key string) (bool, error) + func (c *MemoryCache) Get(ctx context.Context, key string) (interface{}, error) + func (c *MemoryCache) Keys(ctx context.Context, pattern string) ([]string, error) + func (c *MemoryCache) MGet(ctx context.Context, keys ...string) ([]interface{}, error) + func (c *MemoryCache) MSet(ctx context.Context, items map[string]interface{}) error + func (c *MemoryCache) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (c *MemoryCache) TTL(ctx context.Context, key string) (time.Duration, error) + func (c *MemoryCache) Tags() CacheTags + type MemorySessionStore struct + func NewMemorySessionStore(cleanupInterval time.Duration) *MemorySessionStore + func (s *MemorySessionStore) Delete(ctx context.Context, id string) error + func (s *MemorySessionStore) Get(ctx context.Context, id string) (*Session, error) + func (s *MemorySessionStore) Set(ctx context.Context, session *Session) error + func (s *MemorySessionStore) Stop() + type MethodOverride struct + func NewMethodOverride() *MethodOverride + func (m *MethodOverride) Middleware(next http.Handler) http.Handler + type MetricCounter struct + func NewMetricCounter(name, help string, labels ...string) *MetricCounter + func (c *MetricCounter) Add(n uint64, labels ...string) + func (c *MetricCounter) GetValue(labels ...string) uint64 + func (c *MetricCounter) Inc(labels ...string) + func (c *MetricCounter) String() string + type MetricGauge struct + func NewMetricGauge(name, help string) *MetricGauge + func (g *MetricGauge) Dec(labels ...string) + func (g *MetricGauge) GetValue(labels ...string) int64 + func (g *MetricGauge) Inc(labels ...string) + func (g *MetricGauge) Set(val int64, labels ...string) + type MetricHistogram struct + func NewMetricHistogram(name, help string, bounds []float64) *MetricHistogram + func (h *MetricHistogram) GetCount(labels ...string) uint64 + func (h *MetricHistogram) Observe(val float64, labels ...string) + type MetricsConfig struct + Buckets []float64 + EnableAPIMetrics bool + EnableDBMetrics bool + Path string + func NewMetricsConfig() *MetricsConfig + type MetricsMiddleware struct + func NewMetricsMiddleware(cfg *MetricsConfig) *MetricsMiddleware + func (m *MetricsMiddleware) Middleware(next http.Handler) http.Handler + type Pagination struct + Page int + PerPage int + Total int64 + type PrometheusExporter struct + func NewPrometheusExporter() *PrometheusExporter + func (p *PrometheusExporter) RegisterCounter(name, help string, labels ...string) *MetricCounter + func (p *PrometheusExporter) RegisterGauge(name, help string) *MetricGauge + func (p *PrometheusExporter) RegisterHistogram(name, help string, bounds []float64) *MetricHistogram + func (p *PrometheusExporter) ServeHTTP(w http.ResponseWriter, r *http.Request) + type QueryBinding struct + func (q *QueryBinding) Bind(req *http.Request, v interface{}) error + func (q *QueryBinding) Name() string + type RateLimitConfig struct + Burst int + RequestsPerSecond int + type RateLimiter struct + func NewRateLimiter(requestsPerSecond, burst int) *RateLimiter + func (r *RateLimiter) EnablePerIP() *RateLimiter + func (r *RateLimiter) Middleware(next http.Handler) http.Handler + func (r *RateLimiter) Reset() + func (r *RateLimiter) Stop() + type RealIP struct + func NewRealIP() *RealIP + func (r *RealIP) Middleware(next http.Handler) http.Handler + type Recovery struct + func NewRecovery(logger *Logger) *Recovery + func (r *Recovery) Middleware(next http.Handler) http.Handler + type RedisCache struct + func NewRedisCache(cfg *CacheConfig) (*RedisCache, error) + func (c *RedisCache) Clear(ctx context.Context) error + func (c *RedisCache) Close() error + func (c *RedisCache) Delete(ctx context.Context, key string) error + func (c *RedisCache) Exists(ctx context.Context, key string) (bool, error) + func (c *RedisCache) Get(ctx context.Context, key string) (interface{}, error) + func (c *RedisCache) Keys(ctx context.Context, pattern string) ([]string, error) + func (c *RedisCache) MGet(ctx context.Context, keys ...string) ([]interface{}, error) + func (c *RedisCache) MSet(ctx context.Context, items map[string]interface{}) error + func (c *RedisCache) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (c *RedisCache) TTL(ctx context.Context, key string) (time.Duration, error) + func (c *RedisCache) Tags() CacheTags + type RequestBodyLogger struct + func NewRequestBodyLogger(logger *Logger) *RequestBodyLogger + func (l *RequestBodyLogger) Middleware(next http.Handler) http.Handler + type RequestID struct + func NewRequestID() *RequestID + func (r *RequestID) Middleware(next http.Handler) http.Handler + type RequestLogger struct + func NewRequestLogger(logger *Logger) *RequestLogger + func (l *RequestLogger) Middleware(next http.Handler) http.Handler + type Response struct + Code int + Data interface{} + Errors []ResponseError + Message string + Meta *ResponseMeta + Status ResponseStatus + func AlreadyExists(msg string) *Response + func BadRequest(msg string) *Response + func Conflict(msg string) *Response + func Created(data interface{}, msg string) *Response + func Error(msg string) *Response + func ErrorWithCode(code int, msg string) *Response + func Forbidden(msg string) *Response + func GatewayTimeout(msg string) *Response + func MethodNotAllowed(msg string) *Response + func NewResponse() *Response + func NotFound(msg string) *Response + func Paginate(data interface{}, page, perPage int, total int64) *Response + func RequestTimeout(msg string) *Response + func ServiceUnavailable(msg string) *Response + func Success(data interface{}) *Response + func SuccessMessage(msg string) *Response + func TooManyRequests(msg string) *Response + func Unauthorized(msg string) *Response + func ValidationErrorResp(errors []ResponseError) *Response + func (r *Response) ToJSON() ([]byte, error) + func (r *Response) WithCode(code int) *Response + func (r *Response) WithData(data interface{}) *Response + func (r *Response) WithError(err ResponseError) *Response + func (r *Response) WithErrors(errs []ResponseError) *Response + func (r *Response) WithMessage(msg string) *Response + func (r *Response) WithMeta(meta *ResponseMeta) *Response + func (r *Response) WithPageMeta(page, perPage int, total int64) *Response + func (r *Response) WithRequestID(id string) *Response + func (r *Response) WithStatus(status ResponseStatus) *Response + func (r *Response) Write(w http.ResponseWriter) error + type ResponseData struct + Code int + Data interface{} + Errors []ResponseError + Message string + Meta *ResponseMeta + Status string + type ResponseError struct + Code string + Field string + Message string + type ResponseLogger struct + func NewResponseLogger(logger *Logger) *ResponseLogger + func (l *ResponseLogger) Middleware(next http.Handler) http.Handler + type ResponseMeta struct + Page int + PerPage int + RequestID string + Timestamp time.Time + Total int64 + TotalPages int + type ResponseStatus string + const StatusError + const StatusFail + const StatusSuccess + type Router struct + func NewRouter(cfg *HTTPConfig) *Router + func (r *Router) DeleteHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) Favicon(file string) + func (r *Router) GetHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) Group(prefix string, fn func(*Router)) *Router + func (r *Router) HandleContext(path string, handler HandlerFunc) *mux.Route + func (r *Router) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request)) *mux.Route + func (r *Router) Name(name string) *mux.Route + func (r *Router) NotFoundHandler(handler http.HandlerFunc) + func (r *Router) OptionsHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) PatchHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) PostHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) PutHandler(path string, handler HandlerFunc) *mux.Route + func (r *Router) Router() *mux.Router + func (r *Router) ServeHTTP(w http.ResponseWriter, rq *http.Request) + func (r *Router) Server() *http.Server + func (r *Router) SetAddress(addr string) + func (r *Router) SetHandler(handler http.Handler) + func (r *Router) SetIdleTimeout(timeout int) + func (r *Router) SetReadTimeout(timeout int) + func (r *Router) SetWriteTimeout(timeout int) + func (r *Router) Static(path, dir string) + func (r *Router) StaticFS(path string, fs http.FileSystem) + func (r *Router) StaticWithOptions(path, dir string, opts StaticOptions) + func (r *Router) Use(middleware ...mux.MiddlewareFunc) + func (r *Router) UseBodyParser(maxSize int64) + func (r *Router) UseCORS(cfg *CORSConfig) + func (r *Router) UseCompression(level int) + func (r *Router) UseErrorHandler() + func (r *Router) UseHandler(h http.Handler) + func (r *Router) UseMethodOverride() + func (r *Router) UseMiddleware(mw func(http.Handler) http.Handler) + func (r *Router) UseRateLimiter(rps, burst int) + func (r *Router) UseRateLimiterPerIP(rps, burst int) + func (r *Router) UseRealIP() + func (r *Router) UseRecovery() + func (r *Router) UseRequestID() + func (r *Router) UseRequestLogger() + func (r *Router) UseTimeout(timeout time.Duration) + func (r *Router) Vars(rq *http.Request) map[string]string + func (r *Router) WithLogger(logger *Logger) *Router + type SecureHeadersMiddleware struct + func NewSecureHeadersMiddleware() *SecureHeadersMiddleware + func (m *SecureHeadersMiddleware) HandlerFunc(w http.ResponseWriter, r *http.Request) + func (m *SecureHeadersMiddleware) Middleware(next http.Handler) http.Handler + func (m *SecureHeadersMiddleware) WithCSP(csp string) *SecureHeadersMiddleware + func (m *SecureHeadersMiddleware) WithHSTS(maxAge int, includeSubDomains bool) *SecureHeadersMiddleware + type SecurityHeaders struct + ContentSecurityPolicy string + ContentTypeNosniff string + PermissionsPolicy string + ReferrerPolicy string + StrictTransportSecurity string + XContentTypeOptions string + XFrameOptions string + XXSSProtection string + func NewHelmet() *SecurityHeaders + func NewSecurityHeaders() *SecurityHeaders + func (s *SecurityHeaders) Middleware(next http.Handler) http.Handler + func (s *SecurityHeaders) WithCSP(csp string) *SecurityHeaders + func (s *SecurityHeaders) WithHSTS(maxAge int, includeSubDomains bool) *SecurityHeaders + func (s *SecurityHeaders) WithReferrerPolicy(policy string) *SecurityHeaders + func (s *SecurityHeaders) WithXFO(xfo string) *SecurityHeaders + type Service interface + Name func() string + Start func() error + Stop func() error + type ServiceManager struct + func NewServiceManager(logger *Logger) *ServiceManager + func (sm *ServiceManager) Add(service Service) + func (sm *ServiceManager) Count() int + func (sm *ServiceManager) Services() []Service + func (sm *ServiceManager) StartAll() error + func (sm *ServiceManager) StopAll() + type Session struct + CreatedAt time.Time + ExpiresAt time.Time + ID string + Values map[string]interface{} + func GetSession(ctx context.Context) *Session + func NewSession(id string) *Session + func (s *Session) Clear() + func (s *Session) Delete(key string) + func (s *Session) Get(key string) interface{} + func (s *Session) IsExpired() bool + func (s *Session) Len() int + func (s *Session) Set(key string, value interface{}) + type SessionManager struct + func NewSessionManager(store SessionStore) *SessionManager + func (m *SessionManager) Middleware(next http.Handler) http.Handler + func (m *SessionManager) WithCookieName(name string) *SessionManager + func (m *SessionManager) WithCookiePath(path string) *SessionManager + func (m *SessionManager) WithHTTPOnly(httpOnly bool) *SessionManager + func (m *SessionManager) WithMaxAge(maxAge int) *SessionManager + func (m *SessionManager) WithSameSite(sameSite http.SameSite) *SessionManager + func (m *SessionManager) WithSecure(secure bool) *SessionManager + type SessionMiddleware struct + func NewSessionMiddleware(manager *SessionManager) *SessionMiddleware + func (m *SessionMiddleware) Middleware(next http.Handler) http.Handler + type SessionStore interface + Delete func(ctx context.Context, id string) error + Get func(ctx context.Context, id string) (*Session, error) + Set func(ctx context.Context, session *Session) error + type ShutdownCallback func() error + type StaticOptions struct + DirectoryListing bool + Fallback string + Index string + type StreamResponse struct + ContentType string + Data interface{} + Headers map[string]string + func (s *StreamResponse) Write(w http.ResponseWriter) error + type StructuredLogger struct + func NewStructuredLogger(logger *Logger) *StructuredLogger + func (l *StructuredLogger) Middleware(next http.Handler) http.Handler + func (l *StructuredLogger) WithBody(include bool) *StructuredLogger + func (l *StructuredLogger) WithHeader(include bool) *StructuredLogger + type Timeout struct + func NewTimeout(timeout time.Duration) *Timeout + func (t *Timeout) Middleware(next http.Handler) http.Handler + type ValidationError struct + Field string + Message string + Tag string + Value interface{} + func AsValidationError(err error) ([]ValidationError, bool) + func GetXErrorValidationErrors(err error) []ValidationError + func NewValidationError(field, message string) ValidationError + type ValidationErrors []ValidationError + func GetValidationErrors(err error) ValidationErrors + func (v ValidationErrors) Error() string + func (v ValidationErrors) ToResponseErrors() []ResponseError + type Validator struct + func NewValidator() *Validator + func (v *Validator) RegisterValidation(tag string, fn validator.Func) error + func (v *Validator) ValidateStruct(s interface{}) error + func (v *Validator) ValidateVar(field interface{}, tag string) error + type ValidatorMiddleware struct + func NewValidatorMiddleware(logger *Logger) *ValidatorMiddleware + type WSAuthFunc func(r *http.Request) (bool, string) + type WSConnection struct + func NewWSConnection(conn *websocket.Conn, ws *WebSocket, id string) *WSConnection + func (c *WSConnection) Close() error + func (c *WSConnection) ID() string + func (c *WSConnection) JoinRoom(room string) + func (c *WSConnection) LeaveRoom(room string) + func (c *WSConnection) ReadLoop() + func (c *WSConnection) RemoteAddr() string + func (c *WSConnection) Rooms() []string + func (c *WSConnection) Send(message []byte) bool + func (c *WSConnection) SendBinary(msg []byte) bool + func (c *WSConnection) SendJSON(v interface{}) error + func (c *WSConnection) SendText(msg string) bool + func (c *WSConnection) WriteLoop() + type WSMessage struct + Payload []byte + Room string + Type WSMessageType + type WSMessageType int + const WSMessageBinary + const WSMessageClose + const WSMessagePing + const WSMessagePong + const WSMessageText + type WebSocket struct + func NewWebSocket(cfg *WebsocketConfig, logger *Logger) *WebSocket + func (ws *WebSocket) Broadcast(message []byte) + func (ws *WebSocket) BroadcastJSON(v interface{}) error + func (ws *WebSocket) BroadcastText(msg string) + func (ws *WebSocket) BroadcastToRoom(room string, message []byte) + func (ws *WebSocket) BroadcastToRoomJSON(room string, v interface{}) error + func (ws *WebSocket) BroadcastToRoomText(room string, msg string) + func (ws *WebSocket) HandleFunc(w http.ResponseWriter, r *http.Request) + func (ws *WebSocket) HandleHTTP(w http.ResponseWriter, r *http.Request) + func (ws *WebSocket) Hub() *Hub + func (ws *WebSocket) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (ws *WebSocket) Shutdown() + func (ws *WebSocket) WithAuth(authFn WSAuthFunc) *WebSocket + func (ws *WebSocket) WithUpgrader(upgrader websocket.Upgrader) *WebSocket + type WebsocketConfig struct + AllowedOrigins []string + Enabled bool + MaxMessageSize int64 + PingInterval int + PongTimeout int + ReadBufferSize int + WriteBufferSize int + type XError struct + Code ErrorCode + Errors []ValidationError + Message string + Meta map[string]interface{} + StatusCode int + func ErrAlreadyExists(msg string) *XError + func ErrBadRequest(msg string) *XError + func ErrCache(err error) *XError + func ErrCanceled(msg string) *XError + func ErrConflict(msg string) *XError + func ErrDatabase(err error) *XError + func ErrExternalAPI(err error, service string) *XError + func ErrForbidden(msg string) *XError + func ErrGatewayTimeout(msg string) *XError + func ErrInternal(msg string) *XError + func ErrInvalidInput(msg string) *XError + func ErrMethodNotAllowed(msg string) *XError + func ErrNotFound(msg string) *XError + func ErrTimeout(msg string) *XError + func ErrTooManyRequests(msg string) *XError + func ErrUnauthorized(msg string) *XError + func ErrValidation(msg string) *XError + func GetXError(err error) *XError + func NewError(code ErrorCode, message string) *XError + func NewErrorWithStatus(code ErrorCode, message string, statusCode int) *XError + func WrapError(err error, code ErrorCode, message string) *XError + func WrapErrorWithStatus(err error, code ErrorCode, message string, statusCode int) *XError + func (e *XError) Error() string + func (e *XError) Is(target error) bool + func (e *XError) Unwrap() error + func (e *XError) WithErrors(errs []ValidationError) *XError + func (e *XError) WithMeta(key string, value interface{}) *XError