http

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 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

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 OrderBy

type OrderBy struct {
	Direction string
	NullsLast *bool
}

type PaginatedItemsResponse

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

type Pagination

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

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

func (*Pagination) ToLimit

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

type QueryFilter

type QueryFilter = map[string][]string

func ParseQueryFilter

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

type QueryOrderBy

type QueryOrderBy = map[string]OrderBy

func ParseQueryOrderBy

func ParseQueryOrderBy(c *gin.Context) (QueryOrderBy, error)

type ResponseInterceptor

type ResponseInterceptor struct {
	gin.ResponseWriter

	Rewrite bool
	// contains filtered or unexported fields
}

func (*ResponseInterceptor) GetBody

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

func (*ResponseInterceptor) Intercept

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

func (*ResponseInterceptor) Stop

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

func (*ResponseInterceptor) Write

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