bottle

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

README

Bottle

⚙️ Bottle is a modular toolkit that accelerates the development of scalable and maintainable APIs in Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(ctx *fiber.Ctx, err error) error

Types

type Application

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

func New

func New(opts ...Option) *Application

func (*Application) Router added in v1.0.0

func (a *Application) Router() *Router

func (*Application) Run

func (a *Application) Run()

func (*Application) Shutdown added in v1.0.0

func (a *Application) Shutdown() error
type Cookie struct {
	Name        string    `json:"name"`
	Value       string    `json:"value"`
	Path        string    `json:"path"`
	Domain      string    `json:"domain"`
	MaxAge      int       `json:"max_age"`
	Expires     time.Time `json:"expires"`
	Secure      bool      `json:"secure"`
	HTTPOnly    bool      `json:"http_only"`
	SameSite    string    `json:"same_site"`
	SessionOnly bool      `json:"session_only"`
}

type Handler added in v1.0.0

type Handler = func(c *HandlerCtx) error

type HandlerCtx added in v1.0.0

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

func WrapEngineContext added in v1.0.0

func WrapEngineContext(c *fiber.Ctx) *HandlerCtx

func (*HandlerCtx) Accepts added in v1.0.0

func (c *HandlerCtx) Accepts(offers ...string) string

func (*HandlerCtx) AcceptsCharsets added in v1.0.0

func (c *HandlerCtx) AcceptsCharsets(offers ...string) string

func (*HandlerCtx) AcceptsEncodings added in v1.0.0

func (c *HandlerCtx) AcceptsEncodings(offers ...string) string

func (*HandlerCtx) AcceptsLanguages added in v1.0.0

func (c *HandlerCtx) AcceptsLanguages(offers ...string) string

func (*HandlerCtx) AllParams added in v1.0.0

func (c *HandlerCtx) AllParams() map[string]string

func (*HandlerCtx) Append added in v1.0.0

func (c *HandlerCtx) Append(field string, values ...string)

func (*HandlerCtx) Attachment added in v1.0.0

func (c *HandlerCtx) Attachment(filename ...string)

func (*HandlerCtx) BaseURL added in v1.0.0

func (c *HandlerCtx) BaseURL() string

func (*HandlerCtx) Body added in v1.0.0

func (c *HandlerCtx) Body() []byte

func (*HandlerCtx) BodyParser added in v1.0.0

func (c *HandlerCtx) BodyParser(out interface{}) error

func (*HandlerCtx) BodyRaw added in v1.0.0

func (c *HandlerCtx) BodyRaw() []byte

func (*HandlerCtx) ClearCookie added in v1.0.0

func (c *HandlerCtx) ClearCookie(key ...string)

func (*HandlerCtx) ClientHelloInfo added in v1.0.0

func (c *HandlerCtx) ClientHelloInfo() *tls.ClientHelloInfo

func (*HandlerCtx) Context added in v1.0.0

func (c *HandlerCtx) Context() *fasthttp.RequestCtx

func (*HandlerCtx) Cookie added in v1.0.0

func (c *HandlerCtx) Cookie(cookie Cookie)

func (*HandlerCtx) CookieParser added in v1.0.0

func (c *HandlerCtx) CookieParser(out interface{}) error

func (*HandlerCtx) Cookies added in v1.0.0

func (c *HandlerCtx) Cookies(key string, defaultValue ...string) string

func (*HandlerCtx) Download added in v1.0.0

func (c *HandlerCtx) Download(file string, filename ...string) error

func (*HandlerCtx) EngineCtx added in v1.0.0

func (c *HandlerCtx) EngineCtx() *fiber.Ctx

func (*HandlerCtx) FormFile added in v1.0.0

func (c *HandlerCtx) FormFile(key string) (*multipart.FileHeader, error)

func (*HandlerCtx) FormValue added in v1.0.0

func (c *HandlerCtx) FormValue(key string, defaultValue ...string) string

func (*HandlerCtx) Format added in v1.0.0

func (c *HandlerCtx) Format(body interface{}) error

func (*HandlerCtx) Fresh added in v1.0.0

func (c *HandlerCtx) Fresh() bool

func (*HandlerCtx) Get added in v1.0.0

func (c *HandlerCtx) Get(key string, defaultValue ...string) string

func (*HandlerCtx) GetReqHeaders added in v1.0.0

func (c *HandlerCtx) GetReqHeaders() map[string][]string

func (*HandlerCtx) GetRespHeader added in v1.0.0

func (c *HandlerCtx) GetRespHeader(key string, defaultValue ...string) string

func (*HandlerCtx) GetRespHeaders added in v1.0.0

func (c *HandlerCtx) GetRespHeaders() map[string][]string

func (*HandlerCtx) Hostname added in v1.0.0

func (c *HandlerCtx) Hostname() string

func (*HandlerCtx) IP added in v1.0.0

func (c *HandlerCtx) IP() string

func (*HandlerCtx) IPs added in v1.0.0

func (c *HandlerCtx) IPs() []string

func (*HandlerCtx) Is added in v1.0.0

func (c *HandlerCtx) Is(extension string) bool

func (*HandlerCtx) IsFromLocal added in v1.0.0

func (c *HandlerCtx) IsFromLocal() bool

func (*HandlerCtx) IsProxyTrusted added in v1.0.0

func (c *HandlerCtx) IsProxyTrusted() bool

func (*HandlerCtx) JSON added in v1.0.0

func (c *HandlerCtx) JSON(data interface{}, ctype ...string) error

func (*HandlerCtx) JSONP added in v1.0.0

func (c *HandlerCtx) JSONP(data interface{}, callback ...string) error
func (c *HandlerCtx) Links(link ...string)

func (*HandlerCtx) Locals added in v1.0.0

func (c *HandlerCtx) Locals(key interface{}, value ...interface{}) interface{}

func (*HandlerCtx) Location added in v1.0.0

func (c *HandlerCtx) Location(path string)

func (*HandlerCtx) Method added in v1.0.0

func (c *HandlerCtx) Method(override ...string) string

func (*HandlerCtx) MultipartForm added in v1.0.0

func (c *HandlerCtx) MultipartForm() (*multipart.Form, error)

func (*HandlerCtx) Next added in v1.0.0

func (c *HandlerCtx) Next() error

func (*HandlerCtx) OriginalURL added in v1.0.0

func (c *HandlerCtx) OriginalURL() string

func (*HandlerCtx) Params added in v1.0.0

func (c *HandlerCtx) Params(key string, defaultValue ...string) string

func (*HandlerCtx) ParamsInt added in v1.0.0

func (c *HandlerCtx) ParamsInt(key string, defaultValue ...int) (int, error)

func (*HandlerCtx) ParamsParser added in v1.0.0

func (c *HandlerCtx) ParamsParser(out interface{}) error

func (*HandlerCtx) Path added in v1.0.0

func (c *HandlerCtx) Path(override ...string) string

func (*HandlerCtx) Port added in v1.0.0

func (c *HandlerCtx) Port() string

func (*HandlerCtx) Protocol added in v1.0.0

func (c *HandlerCtx) Protocol() string

func (*HandlerCtx) Queries added in v1.0.0

func (c *HandlerCtx) Queries() map[string]string

func (*HandlerCtx) Query added in v1.0.0

func (c *HandlerCtx) Query(key string, defaultValue ...string) string

func (*HandlerCtx) QueryBool added in v1.0.0

func (c *HandlerCtx) QueryBool(key string, defaultValue ...bool) bool

func (*HandlerCtx) QueryFloat added in v1.0.0

func (c *HandlerCtx) QueryFloat(key string, defaultValue ...float64) float64

func (*HandlerCtx) QueryInt added in v1.0.0

func (c *HandlerCtx) QueryInt(key string, defaultValue ...int) int

func (*HandlerCtx) QueryParser added in v1.0.0

func (c *HandlerCtx) QueryParser(out interface{}) error

func (*HandlerCtx) Redirect added in v1.0.0

func (c *HandlerCtx) Redirect(location string, status ...int) error

func (*HandlerCtx) RedirectBack added in v1.0.0

func (c *HandlerCtx) RedirectBack(fallback string, status ...int) error

func (*HandlerCtx) Render added in v1.0.0

func (c *HandlerCtx) Render(name string, bind interface{}, layouts ...string) error

func (*HandlerCtx) ReqHeaderParser added in v1.0.0

func (c *HandlerCtx) ReqHeaderParser(out interface{}) error

func (*HandlerCtx) Request added in v1.0.0

func (c *HandlerCtx) Request() *fasthttp.Request

func (*HandlerCtx) Response added in v1.0.0

func (c *HandlerCtx) Response() *fasthttp.Response

func (*HandlerCtx) RestartRouting added in v1.0.0

func (c *HandlerCtx) RestartRouting() error

func (*HandlerCtx) Secure added in v1.0.0

func (c *HandlerCtx) Secure() bool

func (*HandlerCtx) Send added in v1.0.0

func (c *HandlerCtx) Send(body []byte) error

func (*HandlerCtx) SendFile added in v1.0.0

func (c *HandlerCtx) SendFile(file string, compress ...bool) error

func (*HandlerCtx) SendStatus added in v1.0.0

func (c *HandlerCtx) SendStatus(status int) error

func (*HandlerCtx) SendStream added in v1.0.0

func (c *HandlerCtx) SendStream(stream io.Reader, size ...int) error

func (*HandlerCtx) SendString added in v1.0.0

func (c *HandlerCtx) SendString(body string) error

func (*HandlerCtx) Set added in v1.0.0

func (c *HandlerCtx) Set(key, val string)

func (*HandlerCtx) SetUserContext added in v1.0.0

func (c *HandlerCtx) SetUserContext(ctx context.Context)

func (*HandlerCtx) Stale added in v1.0.0

func (c *HandlerCtx) Stale() bool

func (*HandlerCtx) Status added in v1.0.0

func (c *HandlerCtx) Status(status int) *HandlerCtx

func (*HandlerCtx) String added in v1.0.0

func (c *HandlerCtx) String() string

func (*HandlerCtx) Subdomains added in v1.0.0

func (c *HandlerCtx) Subdomains(offset ...int) []string

func (*HandlerCtx) Type added in v1.0.0

func (c *HandlerCtx) Type(extension string, charset ...string) *HandlerCtx

func (*HandlerCtx) UserContext added in v1.0.0

func (c *HandlerCtx) UserContext() context.Context

func (*HandlerCtx) Vary added in v1.0.0

func (c *HandlerCtx) Vary(fields ...string)

func (*HandlerCtx) Write added in v1.0.0

func (c *HandlerCtx) Write(p []byte) (int, error)

func (*HandlerCtx) WriteString added in v1.0.0

func (c *HandlerCtx) WriteString(s string) (int, error)

func (*HandlerCtx) Writef added in v1.0.0

func (c *HandlerCtx) Writef(f string, a ...interface{}) (int, error)

func (*HandlerCtx) XHR added in v1.0.0

func (c *HandlerCtx) XHR() bool

func (*HandlerCtx) XML added in v1.0.0

func (c *HandlerCtx) XML(data interface{}) error

type Option added in v1.0.0

type Option func(*options)

func WithUploadLimit added in v1.0.0

func WithUploadLimit(limit int64) Option

type Router added in v1.0.0

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

func (*Router) Connect added in v1.0.0

func (r *Router) Connect(path string, handlers ...Handler)

func (*Router) Delete added in v1.0.0

func (r *Router) Delete(path string, handlers ...Handler)

func (*Router) Get added in v1.0.0

func (r *Router) Get(path string, handlers ...Handler)

func (*Router) Group added in v1.0.0

func (r *Router) Group(prefix string, handlers ...Handler) *Router

func (*Router) Head added in v1.0.0

func (r *Router) Head(path string, handlers ...Handler)

func (*Router) Options added in v1.0.0

func (r *Router) Options(path string, handlers ...Handler)

func (*Router) Patch added in v1.0.0

func (r *Router) Patch(path string, handlers ...Handler)

func (*Router) Post added in v1.0.0

func (r *Router) Post(path string, handlers ...Handler)

func (*Router) Put added in v1.0.0

func (r *Router) Put(path string, handlers ...Handler)

func (*Router) Trace added in v1.0.0

func (r *Router) Trace(path string, handlers ...Handler)

func (*Router) Use added in v1.0.0

func (r *Router) Use(args ...interface{})

Jump to

Keyboard shortcuts

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