http

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pagination_Offset string = "offset"
	Pagination_Limit  string = "limit"

	DefaultLimit uint64 = 10
)

Variables

This section is empty.

Functions

func ServeFile added in v0.6.0

func ServeFile(c *gin.Context, code int, filename string, content []byte)

ServeFile is a variation of the Gin Web Framework FileAttachment to support serving of a file for download from a []byte. https://github.com/gin-gonic/gin/blob/v1.10.0/context.go#L1097

Types

type PaginatedItemsResponse added in v0.9.0

type PaginatedItemsResponse struct {
	Items      json.RawMessage `json:"items"`
	Pagination Pagination      `json:"pagination"`
}

type Pagination added in v0.9.0

type Pagination struct {
	Offset uint64 `json:"offset"`
	Limit  uint64 `json:"limit"`
	Total  int64  `json:"total"`
}

TODO(slax0rr): Move to a more appropriate location, having it in infra is not appropriate with the onion architecture but is being kept here for the purposes of quicker delivery.

func ParsePagination added in v0.9.0

func ParsePagination(c *gin.Context) (*Pagination, error)

func (*Pagination) ToLimit added in v0.9.0

func (p *Pagination) ToLimit() query.Limit

type QueryFilter

type QueryFilter = map[string][]string

TODO(slax0rr): Move to a more appropriate location, having it in infra is not appropriate with the onion architecture but is being kept here for the purposes of quicker delivery.

func ParseQueryFilter

func ParseQueryFilter(c *gin.Context) (QueryFilter, error)

type ResponseInterceptor added in v0.9.0

type ResponseInterceptor struct {
	gin.ResponseWriter

	Rewrite bool
	// contains filtered or unexported fields
}

func (*ResponseInterceptor) GetBody added in v0.9.0

func (w *ResponseInterceptor) GetBody() []byte

func (*ResponseInterceptor) Intercept added in v0.9.0

func (w *ResponseInterceptor) Intercept(ctx *gin.Context)

func (*ResponseInterceptor) Stop added in v0.9.0

func (w *ResponseInterceptor) Stop(ctx *gin.Context)

func (*ResponseInterceptor) Write added in v0.9.0

func (w *ResponseInterceptor) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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