web

package
v0.4.29 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler added in v0.4.24

func Handler(handler func(ctx *Ctx) error) http.HandlerFunc

func HandlerSSE added in v0.4.24

func HandlerSSE(handler func(ctx *CtxSse)) http.HandlerFunc

Types

type Ctx added in v0.3.100

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

func NewCtx added in v0.3.100

func NewCtx(ctx context.Context, w http.ResponseWriter, r *http.Request) *Ctx

func (Ctx) Deadline added in v0.3.100

func (ctx Ctx) Deadline() (time.Time, bool)

func (Ctx) Done added in v0.3.100

func (ctx Ctx) Done() <-chan struct{}

func (Ctx) Err added in v0.3.100

func (ctx Ctx) Err() error

func (Ctx) Req added in v0.3.100

func (ctx Ctx) Req() *request.Request

func (Ctx) Res added in v0.3.100

func (ctx Ctx) Res() *response.Response

func (*Ctx) SetContext added in v0.3.100

func (ctx *Ctx) SetContext(ctxNew context.Context)

func (*Ctx) SetValue added in v0.3.100

func (ctx *Ctx) SetValue(key, value any)

func (Ctx) Value added in v0.3.100

func (ctx Ctx) Value(key any) any

func (*Ctx) Write added in v0.3.100

func (ctx *Ctx) Write(content []byte) (int, error)

type CtxSse added in v0.3.100

type CtxSse struct {
	*Ctx
	// contains filtered or unexported fields
}

func NewCtxSse added in v0.3.100

func NewCtxSse(ctx *Ctx) (*CtxSse, error)

func (*CtxSse) Emit added in v0.3.100

func (ctx *CtxSse) Emit(event string, message []byte) error

func (*CtxSse) Flush added in v0.3.100

func (ctx *CtxSse) Flush()

func (*CtxSse) Publish added in v0.3.100

func (ctx *CtxSse) Publish(message []byte) error

func (*CtxSse) PublishRaw added in v0.3.100

func (ctx *CtxSse) PublishRaw(format string, a ...any) error

type Pagination added in v0.4.22

type Pagination[T any] struct {
	Filter map[string]any    `query:"filter" json:"filter"`
	Fields []string          `query:"fields" json:"fields"`
	Sort   map[string]string `query:"sort" json:"sort"`

	Data []T `json:"data"`

	Page        int `query:"page" json:"page"`
	PerPage     int `query:"per_page" json:"per_page"`
	TotalRecord int `json:"total_record"`
}

func PaginationFromPagination added in v0.4.22

func PaginationFromPagination[T, U any](input Pagination[U]) Pagination[T]

func PaginationFromReq added in v0.4.22

func PaginationFromReq[T any](r *http.Request) Pagination[T]

func (Pagination[T]) MarshalJSON added in v0.4.22

func (p Pagination[T]) MarshalJSON() ([]byte, error)

func (*Pagination[T]) SetData added in v0.4.22

func (p *Pagination[T]) SetData(data ...T)

func (Pagination[T]) Skip added in v0.4.22

func (p Pagination[T]) Skip() int

func (Pagination[T]) TotalPage added in v0.4.22

func (p Pagination[T]) TotalPage() float64

type ResourceHandler

type ResourceHandler interface {
	Index(http.ResponseWriter, *http.Request)
	Show(http.ResponseWriter, *http.Request)
	Store(http.ResponseWriter, *http.Request)
	Update(http.ResponseWriter, *http.Request)
	Destroy(http.ResponseWriter, *http.Request)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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