Documentation
¶
Index ¶
- func DD(input any) error
- func FlagParse()
- func Flags() *flags
- func Handler(handler func(ctx *WebCtx) error) http.HandlerFunc
- func HandlerSse(handler func(ctx *WebSseCtx)) http.HandlerFunc
- func Hooks() *runtime.Hooks
- func HttpAccepted(w http.ResponseWriter, body ...any)
- func HttpBadRequest(w http.ResponseWriter, body any)
- func HttpConflict(w http.ResponseWriter, body ...any)
- func HttpCreated(w http.ResponseWriter, body ...any)
- func HttpForbidden(w http.ResponseWriter)
- func HttpInternalServerError(w http.ResponseWriter, body ...any)
- func HttpNoContent(w http.ResponseWriter)
- func HttpNotFound(w http.ResponseWriter)
- func HttpOk(w http.ResponseWriter, body ...any)
- func HttpUnauthorized(w http.ResponseWriter)
- func Router() *ngamux.HttpServeMux
- func Run(config ...Config)
- func Server() *http.Server
- func ToPtr[T any](v T) *T
- type Config
- type ConfigureFunc
- type HttpRequest
- type Pagination
- type Project
- type WebCtx
- func (ctx WebCtx) Deadline() (time.Time, bool)
- func (ctx WebCtx) Done() <-chan struct{}
- func (ctx WebCtx) Err() error
- func (ctx WebCtx) Req() *HttpRequest
- func (ctx WebCtx) Res() *web.HttpResponse
- func (ctx *WebCtx) SetContext(ctxNew context.Context)
- func (ctx *WebCtx) SetValue(key, value any)
- func (ctx WebCtx) Value(key any) any
- func (ctx *WebCtx) Write(content []byte) (int, error)
- type WebSseCtx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandlerSse ¶ added in v0.3.95
func HandlerSse(handler func(ctx *WebSseCtx)) http.HandlerFunc
func HttpAccepted ¶
func HttpAccepted(w http.ResponseWriter, body ...any)
func HttpBadRequest ¶
func HttpBadRequest(w http.ResponseWriter, body any)
func HttpConflict ¶
func HttpConflict(w http.ResponseWriter, body ...any)
func HttpCreated ¶
func HttpCreated(w http.ResponseWriter, body ...any)
func HttpForbidden ¶
func HttpForbidden(w http.ResponseWriter)
func HttpInternalServerError ¶
func HttpInternalServerError(w http.ResponseWriter, body ...any)
func HttpNoContent ¶
func HttpNoContent(w http.ResponseWriter)
func HttpNotFound ¶
func HttpNotFound(w http.ResponseWriter)
func HttpOk ¶
func HttpOk(w http.ResponseWriter, body ...any)
func HttpUnauthorized ¶
func HttpUnauthorized(w http.ResponseWriter)
func Router ¶ added in v0.3.92
func Router() *ngamux.HttpServeMux
Types ¶
type Config ¶
type Config struct {
Key string `json:"key,omitempty"`
Web config.Web `json:"web,omitempty"`
Grpc config.Grpc `json:"grpc,omitempty"`
Security config.Security `json:"security,omitempty"`
SQLs map[string]config.SQL `json:"sql,omitempty"`
Smtp map[string]config.Smtp `json:"smtp,omitempty"`
Others map[string]any `json:"others,omitempty"`
EnvFile string `json:"env_file,omitempty"`
IsTesting bool `json:"is_testing,omitempty"`
Forever bool `json:"-"`
}
type ConfigureFunc ¶
type ConfigureFunc func(*Project)
type HttpRequest ¶ added in v0.3.97
type Pagination ¶
type Pagination[T any] struct { Page int `query:"page" json:"page"` PerPage int `query:"per_page" json:"per_page"` TotalRecord int `json:"total_record"` 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"` }
func PaginationFromReq ¶
func PaginationFromReq[T any](r *http.Request) Pagination[T]
func (Pagination[T]) MarshalJSON ¶
func (p Pagination[T]) MarshalJSON() ([]byte, error)
func (*Pagination[T]) SetData ¶
func (p *Pagination[T]) SetData(data ...T)
func (Pagination[T]) Skip ¶
func (p Pagination[T]) Skip() int
func (Pagination[T]) TotalPage ¶
func (p Pagination[T]) TotalPage() float64
type Project ¶
type Project struct {
Config *Config
ConfigMap map[string]any
// contains filtered or unexported fields
}
func Configures ¶ added in v0.3.94
func Configures(configures ...ConfigureFunc) *Project
func (*Project) Configures ¶
func (p *Project) Configures(configures ...ConfigureFunc) *Project
type WebCtx ¶ added in v0.3.95
type WebCtx struct {
// contains filtered or unexported fields
}
func (WebCtx) Req ¶ added in v0.3.95
func (ctx WebCtx) Req() *HttpRequest
func (WebCtx) Res ¶ added in v0.3.95
func (ctx WebCtx) Res() *web.HttpResponse
func (*WebCtx) SetContext ¶ added in v0.3.95
Click to show internal directories.
Click to hide internal directories.