http

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context
	WithValue(key string, value interface{})
	Request() Request
	Response() Response
	Header(key, defaultValue string) string
	Headers() http.Header
	Method() string
	Path() string
	Url() string
	FullUrl() string
	Ip() string

	//Input Retrieve  an input item from the request: /users/{id}
	Params(key string) string
	// Query Retrieve a query string item form the request: /users?id=1
	Query(key, defaultValue string) string
	// Form Retrieve a form string item form the post: /users POST:id=1
	Form(key, defaultValue string) string
	Bind(obj interface{}) error
	File(name string) (File, error)

	AbortWithStatus(code int)
	Next() error
}

type File

type File interface {
	Store(dst string) error
	File() *multipart.FileHeader
}

type FormRequest

type FormRequest interface {
	Messages() map[string]string
	Authorize() bool
}

type HandlerFunc

type HandlerFunc func(Context) error

type Json

type Json map[string]interface{}

type Request

type Request interface {
	Origin() *http.Request
	Response() Response
}

type Response

type Response interface {
	String(code int, format string, values ...interface{}) error
	Json(code int, obj interface{}) error
	File(filepath string, compress ...bool) error
	Download(filepath, filename string) error
	Success() ResponseSuccess
	Header(key, value string) Response
}

type ResponseSuccess

type ResponseSuccess interface {
	String(format string, values ...interface{}) error
	Json(obj interface{}) error
}

Jump to

Keyboard shortcuts

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