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 ErrorsWrapper
- type ExportContext
- type Handler
- 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") ErrorPointerTarget = errors.New("target must be a pointer") ErrorQueryParamMissing = errors.New("query param is missing") ErrorPathValueMissing = errors.New("path value is missing") )
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
Export() ExportContext
Files() filesystem.Client
Lang() LangContext
Parse() ParseContext
Request() RequestContext
Send() SendContext
Translate(key string, args ...map[string]any) string
Validate(s validator.Schema, data any) (bool, ErrorsWrapper[validator.Errors])
}
type ErrorsWrapper ¶ added in v0.1.2
type ErrorsWrapper[T any] struct { Errors T `json:"errors"` }
type ExportContext ¶ added in v0.1.3
type LangContext ¶
type ParseContext ¶
type ParseContext interface {
QueryParam(key string, target any) error
PathValue(key string, target any) error
File(filename string) (form.Multipart, error)
Files(filesnames ...string) ([]form.Multipart, error)
Json(target any) error
Text() (string, error)
Xml(target any) error
Url(target any) error
MustQueryParam(key string, target any)
MustPathValue(key string, target any)
MustFile(filename string) form.Multipart
MustFiles(filesnames ...string) []form.Multipart
MustJson(target any)
MustText() string
MustXml(target any)
MustUrl(target any)
}
type RequestContext ¶
type RequestIsContext ¶
type Router ¶
type Router interface {
Static(path, dir string) Router
Use(handler Handler) Router
Group(pathPrefix string) Router
Head(path string, handler Handler)
Get(path string, handler Handler)
Post(path string, handler Handler)
Options(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 ¶
type SendContext interface {
Header() http.Header
Status(statusCode int) SendContext
Error(err any) error
Text(value string) error
Html(value string) error
Bool(value bool) error
Json(value any) error
Xml(value string) error
Redirect(url string) error
File(name string, bytes []byte) error
Ws(name string) WsWriter
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.