Documentation ¶
Index ¶
- type BaseSessionStore
- type Context
- type Request
- type Response
- func (r *Response) Append(content string)
- func (r *Response) DelCookie(name string)
- func (r *Response) DelHeader(key string)
- func (r *Response) FlushCookies()
- func (r *Response) FlushHeaders()
- func (r *Response) Prepend(content string)
- func (r *Response) SetCookie(cookie *http.Cookie)
- func (r *Response) SetHeader(key string, val string)
- type Server
- type SessionCookieFactory
- type SessionCookieStore
- type SessionFactory
- type SessionFileFactory
- type SessionFileStore
- type SessionStore
- type View
- type ViewAfterRequest
- type ViewBeforeRequest
- type ViewDispatchRequest
- type ViewDoDelete
- type ViewDoGet
- type ViewDoHead
- type ViewDoPatch
- type ViewDoPost
- type ViewDoPut
- type ViewHandleRequest
- type ViewMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseSessionStore ¶
func NewBaseSessionStore ¶
func NewBaseSessionStore() *BaseSessionStore
func (*BaseSessionStore) Buffer ¶
func (s *BaseSessionStore) Buffer() map[string]any
func (*BaseSessionStore) Del ¶
func (s *BaseSessionStore) Del(key string)
func (*BaseSessionStore) Reset ¶
func (s *BaseSessionStore) Reset()
func (*BaseSessionStore) Set ¶
func (s *BaseSessionStore) Set(key string, value any)
type Context ¶
type Context struct { // server handler Server *Server // log handler for request Logger *xlog.Logger // request handler Request *Request // session store Session SessionStore }
type Response ¶
type Response struct { Headers map[string]string Cookies map[string]*http.Cookie Content []byte RedirectUrl string StatusCode int }
func ErrorResponse ¶
func NewResponse ¶
func RedirectResponse ¶
func (*Response) FlushCookies ¶
func (r *Response) FlushCookies()
delete all response cookie fields from buffer
func (*Response) FlushHeaders ¶
func (r *Response) FlushHeaders()
delete all response header fields from buffer
type Server ¶
type Server struct { Name string Logger *xlog.Logger Reqlogger *xlog.Logger // server session factory SessionFactory SessionFactory // path for serving static contents StaticPath string // max request content length MaxContentLength int // default response content type DefaultContentType string // contains filtered or unexported fields }
type SessionCookieFactory ¶
type SessionCookieFactory struct { SecretKey string CookieName string CookiePath string CookieDomain string CookieMaxAge int CookieSecure bool CookieHttpOnly bool CookieSameSite http.SameSite }
session cookie factory, saves session data in browser cookies
func NewSessionCookieFactory ¶
func NewSessionCookieFactory(opts map[string]any) *SessionCookieFactory
func (*SessionCookieFactory) Create ¶
func (f *SessionCookieFactory) Create( r *http.Request, w http.ResponseWriter) SessionStore
type SessionCookieStore ¶
type SessionCookieStore struct { *BaseSessionStore // contains filtered or unexported fields }
func (*SessionCookieStore) Load ¶
func (s *SessionCookieStore) Load() error
func (*SessionCookieStore) Purge ¶
func (s *SessionCookieStore) Purge() error
func (*SessionCookieStore) Save ¶
func (s *SessionCookieStore) Save() error
type SessionFactory ¶
type SessionFactory interface { // create new session store handler Create(*http.Request, http.ResponseWriter) SessionStore }
type SessionFileFactory ¶
type SessionFileFactory struct { SecretKey string CookieName string CookiePath string CookieDomain string CookieMaxAge int CookieSecure bool CookieHttpOnly bool CookieSameSite http.SameSite StorePath string }
session file factory, saves session data in server side files
func NewSessionFileFactory ¶
func NewSessionFileFactory(opts map[string]any) *SessionFileFactory
func (*SessionFileFactory) Create ¶
func (f *SessionFileFactory) Create( r *http.Request, w http.ResponseWriter) SessionStore
type SessionFileStore ¶
type SessionFileStore struct { *BaseSessionStore // contains filtered or unexported fields }
func (*SessionFileStore) Load ¶
func (s *SessionFileStore) Load() error
func (*SessionFileStore) Purge ¶
func (s *SessionFileStore) Purge() error
func (*SessionFileStore) Save ¶
func (s *SessionFileStore) Save() error
type SessionStore ¶
type SessionStore interface { // load data from session actual store into data buffer Load() error // save data from data buffer into session actual store Save() error // delete all data buffer and session actual store Purge() error // return the whole internal data buffer Buffer() map[string]any // get item by key from data buffer Get(string) (any, bool) // set item by key in data buffer Set(string, any) // delete item by key from data buffer Del(string) // reset data buffer, delete all keys Reset() }
type ViewAfterRequest ¶
type ViewBeforeRequest ¶
type ViewDispatchRequest ¶
type ViewDoDelete ¶
type ViewDoHead ¶
type ViewDoPatch ¶
type ViewDoPost ¶
type ViewHandleRequest ¶
Click to show internal directories.
Click to hide internal directories.