Documentation ¶
Index ¶
- Variables
- func AssignLogID(ctx *Context)
- func CtxLogID(ctx *Context) string
- func CtxValue[T any](ctx *Context, key any) (ret T, ok bool)
- func DecodeForm(r *http.Request, ptr any) error
- func InitLogID(ctx *Context)
- func RenderTime(ts time.Time) string
- func SetDefaultLogLevel(level LogLevel)
- func SetDefaultLogRenderer(r LogRenderer)
- func SetDefaultLogWriter(out io.Writer)
- type APIServer
- type Context
- type Engine
- type FileServer
- type HandlerFunc
- type LogLevel
- type LogRenderer
- type Logger
- func (l *Logger) Debug(format string, params ...any)
- func (l *Logger) Error(format string, params ...any)
- func (l *Logger) Info(format string, params ...any)
- func (l *Logger) SetLevel(level LogLevel)
- func (l *Logger) SetRenderer(r LogRenderer)
- func (l *Logger) SetWriter(out io.Writer)
- func (l *Logger) Warn(format string, params ...any)
- type SweError
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var CtxKeyLogID string = "ctx_logid"
Functions ¶
func AssignLogID ¶ added in v1.0.11
func AssignLogID(ctx *Context)
func RenderTime ¶
func SetDefaultLogLevel ¶
func SetDefaultLogLevel(level LogLevel)
func SetDefaultLogRenderer ¶
func SetDefaultLogRenderer(r LogRenderer)
func SetDefaultLogWriter ¶
Types ¶
type APIServer ¶
type APIServer struct {
// contains filtered or unexported fields
}
func NewAPIServer ¶
func NewAPIServer() *APIServer
func (*APIServer) RegisterHandler ¶
func (s *APIServer) RegisterHandler(method, path string, handler HandlerFunc, middlewares ...HandlerFunc)
type Context ¶
type Context struct { Request *http.Request Response http.ResponseWriter // contains filtered or unexported fields }
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
type FileServer ¶
type FileServer struct {
// contains filtered or unexported fields
}
func NewFileServer ¶
func NewFileServer(root, tryFile string, forbidDir bool) *FileServer
func (*FileServer) ServeHTTP ¶
func (s *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandlerFunc ¶
type HandlerFunc func(*Context)
func MakeAPIHandler ¶
func MakeAPIHandler[InType, OutType any](handler func(*Context, *InType) (*OutType, SweError)) HandlerFunc
type LogRenderer ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) SetRenderer ¶
func (l *Logger) SetRenderer(r LogRenderer)
Click to show internal directories.
Click to hide internal directories.