web

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr                           string
	ReadTimeout, ReadHeaderTimeout time.Duration
	WriteTimeout, IdleTimeout      time.Duration
	ShutdownTimeout                time.Duration
	CertFile, KeyFile              string
}

type Context

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

func (*Context) Abort

func (c *Context) Abort()

func (*Context) Cookie

func (c *Context) Cookie(name string) (string, error)

func (*Context) Deadline

func (c *Context) Deadline() (deadline time.Time, ok bool)

func (*Context) Done

func (c *Context) Done() <-chan struct{}

func (*Context) Err

func (c *Context) Err() error

func (*Context) FormFileHeader

func (c *Context) FormFileHeader(name string) (*multipart.FileHeader, error)

func (*Context) Get

func (c *Context) Get(key string) (value any, exists bool)

func (*Context) GetBool

func (c *Context) GetBool(key string) (b bool)

func (*Context) GetFloat64

func (c *Context) GetFloat64(key string) (f64 float64)

func (*Context) GetHeader

func (c *Context) GetHeader(key string) string

func (*Context) GetInt

func (c *Context) GetInt(key string) (i int)

func (*Context) GetInt64

func (c *Context) GetInt64(key string) (i64 int64)

func (*Context) GetString

func (c *Context) GetString(key string) (s string)

func (*Context) Header

func (c *Context) Header(key, value string)

func (*Context) IsAbort

func (c *Context) IsAbort() bool

func (*Context) Json

func (c *Context) Json(data any) error

func (*Context) JsonBinding

func (c *Context) JsonBinding(d any) error

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) ParamBool

func (c *Context) ParamBool(key string) bool

func (*Context) ParamFloat64

func (c *Context) ParamFloat64(key string) float64

func (*Context) ParamInt

func (c *Context) ParamInt(key string) int

func (*Context) ParamInt64

func (c *Context) ParamInt64(key string) int64

func (*Context) PostForm

func (c *Context) PostForm(key string) (string, bool)

func (*Context) PostFormArray

func (c *Context) PostFormArray(key string) (values []string, ok bool)

func (*Context) PostFormBool

func (c *Context) PostFormBool(key string) bool

func (*Context) PostFormFloat64

func (c *Context) PostFormFloat64(key string) float64

func (*Context) PostFormInt

func (c *Context) PostFormInt(key string) int

func (*Context) PostFormInt64

func (c *Context) PostFormInt64(key string) int64

func (*Context) PostFormString

func (c *Context) PostFormString(key string) string

func (*Context) Query

func (c *Context) Query(key string) (string, bool)

func (*Context) QueryArray

func (c *Context) QueryArray(key string) (values []string, ok bool)

func (*Context) QueryBool

func (c *Context) QueryBool(key string) bool

func (*Context) QueryFloat64

func (c *Context) QueryFloat64(key string) float64

func (*Context) QueryInt

func (c *Context) QueryInt(key string) int

func (*Context) QueryInt64

func (c *Context) QueryInt64(key string) int64

func (*Context) QueryString

func (c *Context) QueryString(key string) string

func (*Context) Request

func (c *Context) Request() *http.Request

func (*Context) Response

func (c *Context) Response(data []byte) error

func (*Context) ResponseWithStatus

func (c *Context) ResponseWithStatus(code int, data []byte) error

func (*Context) Set

func (c *Context) Set(key string, value any)

func (*Context) SetCookie

func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool, sameSite http.SameSite)

func (*Context) Status

func (c *Context) Status(code int)

func (*Context) Value

func (c *Context) Value(key any) any

type Handler

type Handler func(ctx *Context)

type Option

type Option struct {
	Config

	MaxHeaderBytes     int
	MaxMultipartMemory int64
	ConnState          func(net.Conn, http.ConnState)
	TLSConfig          *tls.Config
	TLSNextProto       map[string]func(*http.Server, *tls.Conn, http.Handler)
	ErrorLog           *log.Logger
	BaseContext        func(net.Listener) context.Context
	ConnContext        func(ctx context.Context, c net.Conn) context.Context
}

type Server

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

func New

func New(opt Option) *Server

func (Server) Connect

func (r Server) Connect(path string, f Handler)

func (Server) Delete

func (r Server) Delete(path string, f Handler)

func (Server) Get

func (r Server) Get(path string, f Handler)

func (Server) Head

func (r Server) Head(path string, f Handler)

func (Server) HostPrefix

func (r Server) HostPrefix(host string) *router

func (Server) Options

func (r Server) Options(path string, f Handler)

func (Server) Patch

func (r Server) Patch(path string, f Handler)

func (Server) PathPrefix

func (r Server) PathPrefix(prefix string) *router

func (Server) Post

func (r Server) Post(path string, f Handler)

func (Server) Put

func (r Server) Put(path string, f Handler)

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (Server) Trace

func (r Server) Trace(path string, f Handler)

func (Server) Use

func (r Server) Use(fs ...Handler)

Jump to

Keyboard shortcuts

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