web

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxHeaderBytes = 8192
View Source
const MaxReadHeaderTimeout = time.Second * 30
View Source
const MaxReadTimeout = time.Minute * 10

Variables

This section is empty.

Functions

func SaveUploadedFile

func SaveUploadedFile(file *multipart.FileHeader, dst string) error

func ToGinHandlerFunc

func ToGinHandlerFunc(handler HandlerFunc, digestAuth *login.DigestAuth) gin.HandlerFunc

func ToGinHandlerFuncs

func ToGinHandlerFuncs(handlers []HandlerFunc, digestAuth *login.DigestAuth) []gin.HandlerFunc

Types

type File

type File struct {
	Path     string
	FileName string
}

func (*File) GetFilename

func (f *File) GetFilename() string

func (*File) GetPath

func (f *File) GetPath() string

type HandlerFunc

type HandlerFunc func(req *Request) (any, error)

type HttpServer

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

func NewServer

func NewServer(digestAuth *login.DigestAuth) *HttpServer

func (*HttpServer) Any

func (hs *HttpServer) Any(pattern string, handlers ...HandlerFunc)

func (*HttpServer) DELETE

func (hs *HttpServer) DELETE(pattern string, handlers ...HandlerFunc)

func (*HttpServer) GET

func (hs *HttpServer) GET(pattern string, handlers ...HandlerFunc)

func (*HttpServer) HasPaths

func (hs *HttpServer) HasPaths(queryPath string) bool

func (*HttpServer) IsTls

func (hs *HttpServer) IsTls() bool

func (*HttpServer) POST

func (hs *HttpServer) POST(pattern string, handlers ...HandlerFunc)

func (*HttpServer) PUT

func (hs *HttpServer) PUT(pattern string, handlers ...HandlerFunc)

func (*HttpServer) SignIn

func (hs *HttpServer) SignIn(pattern string, handlers ...HandlerFunc)

func (*HttpServer) Start

func (hs *HttpServer) Start(port int) error

func (*HttpServer) StartAutoTLS

func (hs *HttpServer) StartAutoTLS(port int, certFile, keyFile string) error

func (*HttpServer) StartTLS

func (hs *HttpServer) StartTLS(port int, certFile, keyFile string) error

func (*HttpServer) StaticHandle

func (hs *HttpServer) StaticHandle(relativePath string, filepath string)

func (*HttpServer) Stop added in v0.1.12

func (hs *HttpServer) Stop()

type Page

type Page struct {
	PageNo   int
	PageSize int
}

type PageAble

type PageAble struct {
	Total int64 `json:"total"`
	List  any   `json:"list"`
}

type Request

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

func NewRequest

func NewRequest(context *gin.Context, digestAuth *login.DigestAuth) *Request

func (*Request) BodyJson

func (r *Request) BodyJson(v any) ([]byte, error)

func (*Request) FormFile

func (r *Request) FormFile(name string) (*multipart.FileHeader, error)

func (*Request) FormInt64Value

func (r *Request) FormInt64Value(key string) int64

func (*Request) FormIntValue

func (r *Request) FormIntValue(key string) int

func (*Request) FormValue

func (r *Request) FormValue(key string) string

func (*Request) GetContext

func (r *Request) GetContext() *gin.Context

func (*Request) GetDigestAuth

func (r *Request) GetDigestAuth() *login.DigestAuth

func (*Request) GetHeader

func (r *Request) GetHeader(key string) string

func (*Request) GetPage

func (r *Request) GetPage() *Page

func (*Request) GetRawRequest

func (r *Request) GetRawRequest() *http.Request

func (*Request) GetRemoteAddress

func (r *Request) GetRemoteAddress() string

func (*Request) GetResponseWriter

func (r *Request) GetResponseWriter() http.ResponseWriter

func (*Request) Header

func (r *Request) Header(key, value string)

func (*Request) IsForm

func (r *Request) IsForm() bool

func (*Request) IsMultipartForm

func (r *Request) IsMultipartForm() bool

func (*Request) MultipartForm

func (r *Request) MultipartForm() (*multipart.Form, error)

func (*Request) Param

func (r *Request) Param(key string) string

func (*Request) ShouldBindBodyWithJSON

func (r *Request) ShouldBindBodyWithJSON(obj any) error

func (*Request) Status

func (r *Request) Status(code int)

func (*Request) String

func (r *Request) String(code int, format string, values ...any)

Jump to

Keyboard shortcuts

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