http

package
v0.0.0-...-12a6c45 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(url string, handlers ...Handler)

func Get

func Get(url string, handlers ...Handler)

func Patch

func Patch(url string, handlers ...Handler)

func Post

func Post(url string, handlers ...Handler)

func Put

func Put(url string, handlers ...Handler)

func RegCreator

func RegCreator(typeName string, creator Creator)

func Start

func Start()

func Static

func Static(prefix, path string)

Types

type Context

type Context interface {
	Bind(target interface{}) error
	Param(key string, defaultVal ...string) string
	Query(key string, defaultValue ...string) string
	QueryInt(key string, defaultValue ...int) int
	Body() []byte
	FormFile(key string) (*multipart.FileHeader, error)
	SaveFile(key string, path string) error
	FormValue(key string, defaultValue ...string) string
	Status(code int)
	Next() error
	ReqHeader(key string) string
	SetHeader(key, value string)
	GetHeader(key string) string
	RequestURL() string
	Redirect(to string) error
	Reply(data interface{}) error
	ReplyPage(data interface{}, pageNo int, hasNext bool) error
	ReplyRaw(httpCode int, data ...[]byte) error
	Error(code int, msg string, data ...interface{}) error
	Download(fileName string) error
	Set(key string, val interface{})
	Get(key string) interface{}
	Raw() interface{}
}

type Creator

type Creator func(configName string) (Server, error)

type FiberContext

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

func (*FiberContext) Bind

func (o *FiberContext) Bind(target interface{}) error

func (*FiberContext) Body

func (o *FiberContext) Body() []byte

func (*FiberContext) Download

func (o *FiberContext) Download(fileName string) error

func (*FiberContext) Error

func (o *FiberContext) Error(code int, msg string, data ...interface{}) error

func (*FiberContext) FormFile

func (o *FiberContext) FormFile(key string) (*multipart.FileHeader, error)

func (*FiberContext) FormValue

func (o *FiberContext) FormValue(key string, defaultValue ...string) string

func (*FiberContext) Get

func (o *FiberContext) Get(key string) interface{}

func (*FiberContext) GetHeader

func (o *FiberContext) GetHeader(key string) string

func (*FiberContext) Next

func (o *FiberContext) Next() error

func (*FiberContext) Param

func (o *FiberContext) Param(key string, defaultVal ...string) string

func (*FiberContext) Query

func (o *FiberContext) Query(key string, defaultVal ...string) string

func (*FiberContext) QueryInt

func (o *FiberContext) QueryInt(key string, defaultVal ...int) int

func (*FiberContext) Raw

func (o *FiberContext) Raw() interface{}

func (*FiberContext) Redirect

func (o *FiberContext) Redirect(to string) error

func (*FiberContext) Reply

func (o *FiberContext) Reply(data interface{}) error

func (*FiberContext) ReplyPage

func (o *FiberContext) ReplyPage(data interface{}, pageNo int, hasNext bool) error

func (*FiberContext) ReplyRaw

func (o *FiberContext) ReplyRaw(httpCode int, data ...[]byte) error

func (*FiberContext) ReqHeader

func (o *FiberContext) ReqHeader(key string) string

func (*FiberContext) RequestURL

func (o *FiberContext) RequestURL() string

func (*FiberContext) SaveFile

func (o *FiberContext) SaveFile(key string, path string) error

func (*FiberContext) SendFile

func (o *FiberContext) SendFile(fileName string) error

func (*FiberContext) Set

func (o *FiberContext) Set(key string, val interface{})

func (*FiberContext) SetHeader

func (o *FiberContext) SetHeader(key, value string)

func (*FiberContext) Status

func (o *FiberContext) Status(code int)

type FiberServer

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

func (*FiberServer) Delete

func (o *FiberServer) Delete(path string, handlers ...Handler)

func (*FiberServer) Get

func (o *FiberServer) Get(path string, handlers ...Handler)

func (*FiberServer) Patch

func (o *FiberServer) Patch(path string, handlers ...Handler)

func (*FiberServer) Post

func (o *FiberServer) Post(path string, handlers ...Handler)

func (*FiberServer) Put

func (o *FiberServer) Put(path string, handlers ...Handler)

func (*FiberServer) Raw

func (o *FiberServer) Raw() interface{}

func (*FiberServer) Start

func (o *FiberServer) Start()

func (*FiberServer) Static

func (o *FiberServer) Static(prefix string, path string)

type Handler

type Handler func(ctx Context) error

type ReplyObj

type ReplyObj struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

type ReplyPageObj

type ReplyPageObj struct {
	ReplyObj
	PageNo  int  `json:"pageNo"`
	HasNext bool `json:"hasNext"`
}

type Server

type Server interface {
	Get(path string, handler ...Handler)
	Post(path string, handler ...Handler)
	Put(path string, handler ...Handler)
	Delete(path string, handler ...Handler)
	Patch(path string, handler ...Handler)
	Static(prefix string, path string)
	Raw() interface{}
	Start()
}

func Svr

func Svr(name ...string) Server

Jump to

Keyboard shortcuts

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