Documentation ¶
Index ¶
- Variables
- func HandleContext(pattern string, handler ContextHandlerFunc, builder ContextBuilder)
- func HandleContextGzip(pattern string, handler ContextHandlerFunc, builder ContextBuilder)
- func HandleFiles(path string)
- func HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request, *Session))
- func HandleReflect(pattern string, handler interface{}, builder ContextBuilder)
- func IsHttps(r *http.Request) bool
- func ListenAndServe(addr string)
- func LogAccess(req *http.Request, elapsed time.Duration)
- func LogError(req *http.Request, err *AppError)
- func LogReload()
- func Register(name string) error
- func RegisterAlt(name string) error
- func RegisterLayout(name, header, footer string) error
- func RegisterLayoutAlt(name, header, footer string) error
- func RegisterMulti(name string, filenames ...string) error
- func RegisterNotFound(name string) error
- func RegisterServerError(name string) error
- func RegisterString(name, content string) error
- func RemoveCookie(w http.ResponseWriter, name string)
- func SetCookie(w http.ResponseWriter, name, value string)
- func SetCookieWithExpiration(w http.ResponseWriter, name, value string, seconds int)
- func WantsJSON(r *http.Request) bool
- func WriteSessionCookie(w http.ResponseWriter, s *Session)
- type AppError
- func NewServerError(msg string) *AppError
- func NotFoundErr() *AppError
- func Redirect(c Context, path string) *AppError
- func RedirectToHttps(c Context) *AppError
- func Render(layout, template string, data interface{}, c Context) *AppError
- func RenderAtom(template string, data interface{}, context Context) *AppError
- func RenderCSV(c Context, records [][]string, filename string) *AppError
- func RenderJS(c Context, js string) *AppError
- func RenderJSON(c Context, obj interface{}) *AppError
- func RenderJSONP(c Context, obj interface{}, jsonpCallback string) *AppError
- func RenderMulti(layout, name, innerName string, data interface{}, c Context) *AppError
- func RenderNoLayout(template string, data interface{}, c Context) *AppError
- func RenderNoLayoutNoContext(template string, data interface{}, w http.ResponseWriter, s *Session) *AppError
- func RenderNoLayoutToHTML(template string, data interface{}) (htemplate.HTML, *AppError)
- func RenderNoLayoutToString(template string, data interface{}) (string, *AppError)
- func RenderString(c Context, content string) *AppError
- func RenderToString(layout, template string, data interface{}) (string, *AppError)
- func ServerError(err error, msg string) *AppError
- func StoreAndRedirect(c Context, path string) *AppError
- type Context
- type ContextBuilder
- type ContextHandlerFunc
- type Env
- type GPath
- type Session
- func (s *Session) AddErrMsg(msg string)
- func (s *Session) AddFlash(msg string)
- func (s *Session) AddRecent(key, val string)
- func (s *Session) Get(key string) (val string, ok bool)
- func (s *Session) GetAndResetErrMsgs() []string
- func (s *Session) GetAndResetFlash() []string
- func (s *Session) GetList(key string) []string
- func (s *Session) HasErrMsgs() bool
- func (s *Session) HasFlash() bool
- func (s *Session) Push(key, val string)
- func (s *Session) Remove(key string)
- func (s *Session) Set(key, val string)
- func (s Session) Token() string
- func (s Session) ValidToken(t string) bool
- type TemplateData
- type TemplatePool
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessLogFilename = "/tmp/access.log"
View Source
var AfterErrorFunc func(Context, *AppError)
View Source
var ContentDir string
View Source
var ErrorLogFilename = "/tmp/error.log"
View Source
var NotifyRequestTime func(elapsed time.Duration, path string)
View Source
var SessionCookieLifetimeSeconds = 3600 * 24 * 14
View Source
var TokenSecret = []byte("CHANGEME")
Functions ¶
func HandleContext ¶
func HandleContext(pattern string, handler ContextHandlerFunc, builder ContextBuilder)
func HandleContextGzip ¶
func HandleContextGzip(pattern string, handler ContextHandlerFunc, builder ContextBuilder)
func HandleFunc ¶
func HandleReflect ¶
func HandleReflect(pattern string, handler interface{}, builder ContextBuilder)
func ListenAndServe ¶
func ListenAndServe(addr string)
func RegisterAlt ¶
func RegisterLayout ¶
func RegisterLayoutAlt ¶
func RegisterMulti ¶
func RegisterNotFound ¶
func RegisterServerError ¶
func RegisterString ¶
func RemoveCookie ¶
func RemoveCookie(w http.ResponseWriter, name string)
func SetCookie ¶
func SetCookie(w http.ResponseWriter, name, value string)
func SetCookieWithExpiration ¶
func SetCookieWithExpiration(w http.ResponseWriter, name, value string, seconds int)
XXX change seconds to duration?
func WriteSessionCookie ¶
func WriteSessionCookie(w http.ResponseWriter, s *Session)
Types ¶
type AppError ¶
func NewServerError ¶
func NotFoundErr ¶
func NotFoundErr() *AppError
func RedirectToHttps ¶
func RenderAtom ¶
func RenderJSON ¶
func RenderJSONP ¶
func RenderMulti ¶
func RenderNoLayout ¶
func RenderNoLayoutNoContext ¶
func RenderNoLayoutNoContext(template string, data interface{}, w http.ResponseWriter, s *Session) *AppError
func RenderNoLayoutToHTML ¶
func RenderNoLayoutToString ¶
func RenderString ¶
func RenderToString ¶
func ServerError ¶
func StoreAndRedirect ¶
type Context ¶
type Context interface { Request() *http.Request Writer() http.ResponseWriter Session() *Session Before() (bool, error) After() ResultData(title string) TemplateData }
type ContextBuilder ¶
type ContextHandlerFunc ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) GetAndResetErrMsgs ¶
func (*Session) GetAndResetFlash ¶
func (*Session) HasErrMsgs ¶
func (Session) ValidToken ¶
type TemplateData ¶
type TemplateData map[string]interface{}
type TemplatePool ¶
type TemplatePool interface { Register(name string, leftDelim, rightDelim string) error RegisterLayout(name, header, footer string, leftDelim, rightDelim string) error RegisterString(name, content string) error RegisterMulti(name, leftDelim, rightDelim string, filenames ...string) error Render(layout, name string, data interface{}, wr io.Writer) error RenderNoLayout(name string, data interface{}, wr io.Writer) error RenderMulti(layout, name, innerName string, data interface{}, wr io.Writer) error }
var DefaultPool TemplatePool
Click to show internal directories.
Click to hide internal directories.