Documentation
¶
Index ¶
- Constants
- Variables
- func BuildSvelte(inputSvelteFile string, options ...SvelteOption) (string, string, error)
- type Context
- func (c *Context) Args() *fasthttp.Args
- func (c *Context) Blob(code int, b []byte) error
- func (c *Context) CDel(key string)
- func (c *Context) CGet(key string) string
- func (c *Context) CReset()
- func (c *Context) CSet(key, value string)
- func (c *Context) Cookie(key string) string
- func (c *Context) File(code int, file string, compress ...bool) error
- func (c *Context) GetForm(key string) []byte
- func (c *Context) Html(code int, t string, args ...any) error
- func (c *Context) Json(code int, j interface{}) error
- func (c *Context) Method() string
- func (c *Context) Param(key interface{}) interface{}
- func (c *Context) Path() string
- func (c *Context) Proto(code int, p proto.Message) error
- func (c *Context) Protocol() string
- func (c *Context) Redirect(code int, url string) error
- func (c *Context) Req() *fasthttp.Request
- func (c *Context) Res() *fasthttp.Response
- func (c *Context) Secure() bool
- func (c *Context) SetCType(ctype string)
- func (c *Context) SetCookie(k, v string, expire time.Time)
- func (c *Context) SetHeader(key, value string)
- func (c *Context) SetStatusCode(code int)
- func (c *Context) Sse(datach chan interface{}, closech chan struct{}, fn func()) error
- func (c *Context) Text(code int, t string) error
- func (c *Context) Write(body []byte)
- func (c *Context) Ws(handler websocket.FastHTTPHandler) error
- type ErrorHandlerFunc
- type GoSvelt
- func (gs *GoSvelt) Connect(path string, h HandlerFunc)
- func (gs *GoSvelt) Delete(path string, h HandlerFunc)
- func (gs *GoSvelt) Get(path string, h HandlerFunc)
- func (gs *GoSvelt) Middleware(path string, fn MiddlewareFunc)
- func (gs *GoSvelt) Options(path string, h HandlerFunc)
- func (gs *GoSvelt) Post(path string, h HandlerFunc)
- func (gs *GoSvelt) Put(path string, h HandlerFunc)
- func (gs *GoSvelt) Sse(path string, datach chan interface{}, closech chan struct{}, fn func())
- func (gs *GoSvelt) Start(addr string)
- func (gs *GoSvelt) StartTLS(addr, cert, key string)
- func (gs *GoSvelt) Static(path, file string)
- func (gs *GoSvelt) Svelte(path, svelteFile string, handlerFn SvelteHandlerFunc, options ...SvelteOption)
- func (gs *GoSvelt) SvelteMiddleware(path string, fn SvelteMiddlewareFunc)
- type HandlerFunc
- type Map
- type MiddlewareFunc
- type Option
- type Options
- type SseEvent
- type SvelteHandlerFunc
- type SvelteMiddlewareFunc
- type SvelteOption
- type SvelteOptions
Constants ¶
View Source
const ( CharsetUTF8 = "charset=UTF-8" // Methods MGet = http.MethodGet // get MPost = http.MethodPost // post MPut = http.MethodPut // put MDelete = http.MethodDelete // delete MConnect = http.MethodConnect // connect MOptions = http.MethodOptions // options // Mime MAppJSON = "application/json" // json MAppProto = "application/protobuf" // protobuf MAppJS = "application/javascript" // js MAppXML = "application/xml" // xml MAppForm = "application/x-www-form-urlencoded" // form MOctStream = "application/octet-stream" // octet stream MTextPlain = "text/plain" // text MTextHTML = "text/html" // html MTextXML = "text/xml" // xml text MAppJsonUTF8 = MAppJSON + "; " + CharsetUTF8 // json utf8 MAppJsUTF8 = MAppJS + "; " + CharsetUTF8 // js utf8 MAppXmlUTF8 = MAppXML + "; " + CharsetUTF8 // xml utf8 MTextPlainUTF8 = MTextPlain + "; " + CharsetUTF8 // text utf8 MTextHtmlUTF8 = MTextHTML + "; " + CharsetUTF8 // html utf8 MTextXmlUTF8 = MTextXML + "; " + CharsetUTF8 // xml text utf8 )
Variables ¶
View Source
var ( WithLog = func(o *Options) { o.log = true } WithHttp2 = func(o *Options) { o.http2 = true } WithErrorHandler = func(errorHandler ErrorHandlerFunc) Option { return func(o *Options) { o.errorHandler = errorHandler } } WithTailwind = func(tailwindConfig string) Option { return func(o *Options) { o.tailwindcssCfg = &tailwindConfig } } WithPostcss = func(postcssConfig string) Option { return func(o *Options) { o.postcssCfg = &postcssConfig } } )
View Source
var ( WithTailwindcss = func(o *SvelteOptions) { o.tailwindcss = true } WithPackageManager = func(packageManager string) SvelteOption { return func(o *SvelteOptions) { o.packageManager = packageManager } } WithRoot = func(rootFolder string) SvelteOption { return func(o *SvelteOptions) { o.rootFolder = &rootFolder } } )
Functions ¶
func BuildSvelte ¶ added in v1.4.0
func BuildSvelte(inputSvelteFile string, options ...SvelteOption) (string, string, error)
Types ¶
type Context ¶
func (*Context) Param ¶
func (c *Context) Param(key interface{}) interface{}
get the url params with key
func (*Context) SetStatusCode ¶
set response status code in int
type ErrorHandlerFunc ¶
type ErrorHandlerFunc func(c *fasthttp.RequestCtx, err error)
type GoSvelt ¶
type GoSvelt struct {
// contains filtered or unexported fields
}
func (*GoSvelt) Connect ¶
func (gs *GoSvelt) Connect(path string, h HandlerFunc)
func (*GoSvelt) Delete ¶
func (gs *GoSvelt) Delete(path string, h HandlerFunc)
func (*GoSvelt) Get ¶
func (gs *GoSvelt) Get(path string, h HandlerFunc)
func (*GoSvelt) Middleware ¶
func (gs *GoSvelt) Middleware(path string, fn MiddlewareFunc)
func (*GoSvelt) Options ¶
func (gs *GoSvelt) Options(path string, h HandlerFunc)
func (*GoSvelt) Post ¶
func (gs *GoSvelt) Post(path string, h HandlerFunc)
func (*GoSvelt) Put ¶
func (gs *GoSvelt) Put(path string, h HandlerFunc)
func (*GoSvelt) Svelte ¶
func (gs *GoSvelt) Svelte( path, svelteFile string, handlerFn SvelteHandlerFunc, options ...SvelteOption, )
help to server Svelte files to client
func (*GoSvelt) SvelteMiddleware ¶
func (gs *GoSvelt) SvelteMiddleware(path string, fn SvelteMiddlewareFunc)
type HandlerFunc ¶
func Json ¶ added in v1.4.0
func Json(j interface{}) HandlerFunc
func Status ¶ added in v1.4.0
func Status(code int) HandlerFunc
func String ¶ added in v1.4.0
func String(str string) HandlerFunc
type MiddlewareFunc ¶
type MiddlewareFunc func(next HandlerFunc) HandlerFunc
type SvelteHandlerFunc ¶
type SvelteMiddlewareFunc ¶
type SvelteMiddlewareFunc func(next SvelteHandlerFunc) SvelteHandlerFunc
type SvelteOption ¶ added in v1.4.0
type SvelteOption func(*SvelteOptions)
type SvelteOptions ¶ added in v1.4.0
type SvelteOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.