Documentation
¶
Index ¶
Constants ¶
View Source
const CookieSession = "SESSION"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application[T HttpContext] interface { ServeUnix(socketFile string) ServeTcp(address string) RawHandle(pattern string, handler http.Handler) Handle(pattern string, handler func(T)) }
func NewApplication ¶
func NewApplication[T HttpContext](contextFactory ContextFactory[T]) Application[T]
type BasicContext ¶
type BasicContext interface {
HttpRequest() *http.Request
HttpResponseWriter() http.ResponseWriter
Session() Session
}
type CacheProvider ¶
type ContextFactory ¶
type ContextFactory[T HttpContext] interface { NewContext(w http.ResponseWriter, r *http.Request) T }
func NewContextFactory ¶
func NewContextFactory(cp CacheProvider) ContextFactory[HttpContext]
type HttpContext ¶
type HttpContext interface {
io.Closer
BasicContext
RequestReader
ResponseWriter
}
func NewHttpContext ¶
func NewHttpContext(w http.ResponseWriter, r *http.Request, sm SessionManager) HttpContext
type HttpServer ¶
func NewTcpServer ¶ added in v1.0.9
func NewTcpServer(address string, handler http.Handler, errorChan chan error) HttpServer
func NewUnixServer ¶ added in v1.0.9
func NewUnixServer(socketFile string, handler http.Handler, errorChan chan error) HttpServer
type RequestReader ¶
type RequestReader interface {
GetQueryStrings() map[string][]string
GetQueryStringValues(key string) []string
GetQueryStringValue(key string) string
GetRequestBodyAsBytes() ([]byte, error)
GetRequestBodyAsString() (string, error)
GetRequestBodyAsXml(v interface{}) error
GetRequestBodyAsJson(v interface{}) error
}
type ResponseWriter ¶
type RouterInterface ¶
type RouterInterface[T HttpContext] interface { http.Handler RawHandle(pattern string, handler http.Handler) Handle(pattern string, handler func(T)) }
func NewRouter ¶
func NewRouter[T HttpContext](cf ContextFactory[T]) RouterInterface[T]
type SessionManager ¶
type SessionManager interface {
GetSession(sessionId string) Session
CreateSession() (string, Session)
}
func NewSessionManager ¶
func NewSessionManager(cacheProvider CacheProvider) SessionManager
Click to show internal directories.
Click to hide internal directories.