http

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 25 Imported by: 7

Documentation

Index

Constants

View Source
const Binding = "goravel.http"

Variables

View Source
var (
	ConfigFacade      config.Config
	CacheFacade       cache.Cache
	LogFacade         log.Log
	RateLimiterFacade http.RateLimiter
	ValidationFacade  validation.Validation
)

Functions

func Background added in v1.2.0

func Background() http.Context

func GinResponseMiddleware added in v1.8.0

func GinResponseMiddleware() httpcontract.Middleware

func NewGinContext added in v1.0.1

func NewGinContext(ctx *gin.Context) http.Context

func NewGinRequest added in v1.0.0

func NewGinRequest(ctx *GinContext, log log.Log, validation validatecontract.Validation) httpcontract.Request

func NewGinSuccess added in v1.0.0

func NewGinSuccess(instance *gin.Context) httpcontract.ResponseSuccess

Types

type BodyWriter added in v1.8.0

type BodyWriter struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (*BodyWriter) Body added in v1.8.0

func (w *BodyWriter) Body() *bytes.Buffer

func (*BodyWriter) Write added in v1.8.0

func (w *BodyWriter) Write(b []byte) (int, error)

func (*BodyWriter) WriteString added in v1.8.0

func (w *BodyWriter) WriteString(s string) (int, error)

type GinContext added in v1.0.1

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

func (*GinContext) Context added in v1.4.0

func (c *GinContext) Context() context.Context

func (*GinContext) Deadline added in v1.0.1

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

func (*GinContext) Done added in v1.0.1

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

func (*GinContext) Err added in v1.0.1

func (c *GinContext) Err() error

func (*GinContext) Instance added in v1.3.0

func (c *GinContext) Instance() *gin.Context

func (*GinContext) Request added in v1.0.1

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

func (*GinContext) Response added in v1.0.1

func (c *GinContext) Response() http.Response

func (*GinContext) Value added in v1.0.1

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

func (*GinContext) WithValue added in v1.0.1

func (c *GinContext) WithValue(key string, value any)

type GinRequest added in v1.0.0

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

func (*GinRequest) AbortWithStatus added in v1.0.0

func (r *GinRequest) AbortWithStatus(code int)

func (*GinRequest) AbortWithStatusJson added in v1.4.0

func (r *GinRequest) AbortWithStatusJson(code int, jsonObj any)

func (*GinRequest) All added in v1.11.1

func (r *GinRequest) All() map[string]any

func (*GinRequest) Bind added in v1.0.0

func (r *GinRequest) Bind(obj any) error

func (*GinRequest) File added in v1.0.0

func (r *GinRequest) File(name string) (filesystemcontract.File, error)

func (*GinRequest) Form added in v1.0.0

func (r *GinRequest) Form(key string, defaultValue ...string) string

func (*GinRequest) FullUrl added in v1.0.0

func (r *GinRequest) FullUrl() string

func (*GinRequest) Header added in v1.0.0

func (r *GinRequest) Header(key string, defaultValue ...string) string

func (*GinRequest) Headers added in v1.0.0

func (r *GinRequest) Headers() http.Header

func (*GinRequest) Host added in v1.11.1

func (r *GinRequest) Host() string

func (*GinRequest) Input added in v1.0.0

func (r *GinRequest) Input(key string, defaultValue ...string) string

func (*GinRequest) InputBool added in v1.10.0

func (r *GinRequest) InputBool(key string, defaultValue ...bool) bool

func (*GinRequest) InputInt added in v1.10.0

func (r *GinRequest) InputInt(key string, defaultValue ...int) int

func (*GinRequest) InputInt64 added in v1.10.0

func (r *GinRequest) InputInt64(key string, defaultValue ...int64) int64

func (*GinRequest) Ip added in v1.0.0

func (r *GinRequest) Ip() string

func (*GinRequest) Json added in v1.10.0

func (r *GinRequest) Json(key string, defaultValue ...string) string

func (*GinRequest) Method added in v1.0.0

func (r *GinRequest) Method() string

func (*GinRequest) Next added in v1.0.0

func (r *GinRequest) Next()

func (*GinRequest) Origin added in v1.0.4

func (r *GinRequest) Origin() *http.Request

func (*GinRequest) Path added in v1.0.0

func (r *GinRequest) Path() string

func (*GinRequest) Queries added in v1.11.1

func (r *GinRequest) Queries() map[string]string

func (*GinRequest) Query added in v1.0.0

func (r *GinRequest) Query(key string, defaultValue ...string) string

func (*GinRequest) QueryArray added in v1.8.0

func (r *GinRequest) QueryArray(key string) []string

func (*GinRequest) QueryBool added in v1.10.0

func (r *GinRequest) QueryBool(key string, defaultValue ...bool) bool

func (*GinRequest) QueryInt added in v1.10.0

func (r *GinRequest) QueryInt(key string, defaultValue ...int) int

func (*GinRequest) QueryInt64 added in v1.10.0

func (r *GinRequest) QueryInt64(key string, defaultValue ...int64) int64

func (*GinRequest) QueryMap added in v1.8.0

func (r *GinRequest) QueryMap(key string) map[string]string

func (*GinRequest) Route added in v1.10.0

func (r *GinRequest) Route(key string) string

func (*GinRequest) RouteInt added in v1.10.0

func (r *GinRequest) RouteInt(key string) int

func (*GinRequest) RouteInt64 added in v1.10.0

func (r *GinRequest) RouteInt64(key string) int64

func (*GinRequest) Url added in v1.0.0

func (r *GinRequest) Url() string

func (*GinRequest) Validate added in v1.7.0

func (r *GinRequest) Validate(rules map[string]string, options ...validatecontract.Option) (validatecontract.Validator, error)

func (*GinRequest) ValidateRequest added in v1.7.0

func (r *GinRequest) ValidateRequest(request httpcontract.FormRequest) (validatecontract.Errors, error)

type GinResponse added in v1.0.0

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

func NewGinResponse added in v1.0.0

func NewGinResponse(instance *gin.Context, origin httpcontract.ResponseOrigin) *GinResponse

func (*GinResponse) Data added in v1.9.0

func (r *GinResponse) Data(code int, contentType string, data []byte)

func (*GinResponse) Download added in v1.0.0

func (r *GinResponse) Download(filepath, filename string)

func (*GinResponse) File added in v1.0.0

func (r *GinResponse) File(filepath string)

func (*GinResponse) Header added in v1.0.0

func (r *GinResponse) Header(key, value string) httpcontract.Response

func (*GinResponse) Json added in v1.0.0

func (r *GinResponse) Json(code int, obj any)

func (*GinResponse) Origin added in v1.8.0

func (*GinResponse) Redirect added in v1.9.0

func (r *GinResponse) Redirect(code int, location string)

func (*GinResponse) String added in v1.0.0

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

func (*GinResponse) Success added in v1.0.0

func (*GinResponse) Writer added in v1.8.3

func (r *GinResponse) Writer() http.ResponseWriter

type GinSuccess added in v1.0.0

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

func (*GinSuccess) Data added in v1.9.0

func (r *GinSuccess) Data(contentType string, data []byte)

func (*GinSuccess) Json added in v1.0.0

func (r *GinSuccess) Json(obj any)

func (*GinSuccess) String added in v1.0.0

func (r *GinSuccess) String(format string, values ...any)

type RateLimiter added in v1.10.0

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

func NewRateLimiter added in v1.10.0

func NewRateLimiter() *RateLimiter

func (*RateLimiter) For added in v1.10.0

func (r *RateLimiter) For(name string, callback func(ctx http.Context) http.Limit)

func (*RateLimiter) ForWithLimits added in v1.10.0

func (r *RateLimiter) ForWithLimits(name string, callback func(ctx http.Context) []http.Limit)

func (*RateLimiter) Limiter added in v1.10.0

func (r *RateLimiter) Limiter(name string) func(ctx http.Context) []http.Limit

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (database *ServiceProvider) Register(app foundation.Application)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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