router

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ctx

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

func NewCtx

func NewCtx() *Ctx

func (*Ctx) Context

func (c *Ctx) Context() context.Context

func (*Ctx) Error

func (c *Ctx) Error(err error, code ...int)

func (*Ctx) JSON

func (c *Ctx) JSON(data any) error

func (*Ctx) Params

func (c *Ctx) Params(p string) string

func (*Ctx) ParseBody

func (c *Ctx) ParseBody(v any) error

func (*Ctx) Query

func (c *Ctx) Query(p string) URLParam

func (*Ctx) SetContext

func (c *Ctx) SetContext(ctx context.Context)

func (*Ctx) SetMiddleware

func (c *Ctx) SetMiddleware(writer http.ResponseWriter, request *http.Request)

func (*Ctx) Span

func (c *Ctx) Span() trace.Span

func (*Ctx) WrapHTTPHandler

func (c *Ctx) WrapHTTPHandler(h http.HandlerFunc) error

type HTTPHandler

type HTTPHandler interface {
	Register(r *Server)
}

type HTTPMethod

type HTTPMethod string
const (
	GET  HTTPMethod = "GET"
	POST HTTPMethod = "POST"
)

type HandlerFunc

type HandlerFunc func(*Ctx) error

type Map

type Map map[string]interface{}

type Router

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

type Server

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

func New

func New(port string, logger *logger.Logger) *Server

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(method HTTPMethod, path string, handler HandlerFunc)

func (*Server) SetTimeout

func (s *Server) SetTimeout(timeout time.Duration)

func (*Server) Start

func (s *Server) Start() error

type URLParam

type URLParam string

func (URLParam) String

func (p URLParam) String() string

func (URLParam) Validate

func (p URLParam) Validate() error

Jump to

Keyboard shortcuts

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