Documentation
¶
Index ¶
- Constants
- Variables
- func PathValue[T Assert](c RequestContext, key string, defaultValue ...T) T
- func Query[T Assert](c RequestContext, key string, defaultValue ...T) T
- type Assert
- type Config
- type Context
- type Handler
- type Hook
- type Interceptor
- type LangContext
- type ParseContext
- type RequestContext
- type RequestIsContext
- type Route
- type Router
- type SendContext
- type Sense
- type WsWriter
Constants ¶
View Source
const (
LangCookieKey = "X-Lang"
)
View Source
const (
Main = "main"
)
Variables ¶
View Source
var ( ErrorInvalidDatabase = errors.New("invalid database") ErrorInvalidWebsocket = errors.New("invalid websocket") ErrorInvalidLang = errors.New("invalid lang") ErrorInvalidMultipart = errors.New("request has not multipart content type") ErrorOpenFile = errors.New("file cannot be opened") ErrorReadData = errors.New("cannot read data") )
View Source
var ( BlueColor = lipgloss.NewStyle().Foreground(lipgloss.Color("#60a5fa")) EmeraldColor = lipgloss.NewStyle().Foreground(lipgloss.Color("#34d399")) WhiteColor = lipgloss.NewStyle().Foreground(lipgloss.Color("#ffffff")) )
View Source
var (
Divider = WhiteColor.Render("------------------------------")
)
Functions ¶
func PathValue ¶
func PathValue[T Assert](c RequestContext, key string, defaultValue ...T) T
func Query ¶
func Query[T Assert](c RequestContext, key string, defaultValue ...T) T
Types ¶
type Context ¶
type Context interface {
Auth(dbname ...string) auth.Manager
Cache() cache.Client
Cookie() cookie.Cookie
Config() Config
Continue() error
Db(dbname ...string) *quirk.Quirk
Email() mailer.Mailer
Files() filesystem.Client
Lang() LangContext
Parse() ParseContext
Request() RequestContext
Send() SendContext
Translate(key string, args ...map[string]any) string
}
type Hook ¶
type Hook interface {
OnError(fn func(req RequestContext, err error)) Hook
}
type Interceptor ¶
type Interceptor interface {
OnJson(fn func(req RequestContext, json any) any) Interceptor
OnXml(fn func(req RequestContext, xml any) any) Interceptor
OnText(fn func(req RequestContext, text string) string) Interceptor
OnError(fn func(req RequestContext, err error) error) Interceptor
}
type LangContext ¶
type ParseContext ¶
type RequestContext ¶
type RequestIsContext ¶
type Router ¶
type Router interface {
Hook() Hook
Intercept() Interceptor
Static(path, dir string) Router
Use(handler Handler) Router
Group(pathPrefix string) Router
Get(path string, handler Handler)
Post(path string, handler Handler)
Put(path string, handler Handler)
Patch(path string, handler Handler)
Delete(path string, handler Handler)
Ws(path, name string, handler Handler)
}
type SendContext ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.