bingo: Index | Files

package bingo

import ""


Package Files

context.go cookie.go error.go handler.go log.go path.go pool.go render.go request.go server.go session.go


var AccessLogFilename = "/tmp/access.log"
var AfterErrorFunc func(Context, *AppError)
var ContentDir string
var ErrorLogFilename = "/tmp/error.log"
var NotifyRequestTime func(elapsed time.Duration, path string)
var SessionCookieLifetimeSeconds = 3600 * 24 * 14
var TokenSecret = []byte("CHANGEME")

func HandleContext Uses

func HandleContext(pattern string, handler ContextHandlerFunc, builder ContextBuilder)

func HandleContextGzip Uses

func HandleContextGzip(pattern string, handler ContextHandlerFunc, builder ContextBuilder)

func HandleFiles Uses

func HandleFiles(path string)

pass in something like "images" to serve /images

func HandleFunc Uses

func HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request, *Session))

func HandleReflect Uses

func HandleReflect(pattern string, handler interface{}, builder ContextBuilder)

func IsHttps Uses

func IsHttps(r *http.Request) bool

func ListenAndServe Uses

func ListenAndServe(addr string)

func LogAccess Uses

func LogAccess(req *http.Request, elapsed time.Duration)

func LogError Uses

func LogError(req *http.Request, err *AppError)

func LogReload Uses

func LogReload()

func Register Uses

func Register(name string) error

func RegisterAlt Uses

func RegisterAlt(name string) error

func RegisterLayout Uses

func RegisterLayout(name, header, footer string) error

func RegisterLayoutAlt Uses

func RegisterLayoutAlt(name, header, footer string) error

func RegisterMulti Uses

func RegisterMulti(name string, filenames ...string) error

func RegisterNotFound Uses

func RegisterNotFound(name string) error

func RegisterServerError Uses

func RegisterServerError(name string) error

func RegisterString Uses

func RegisterString(name, content string) error

func RemoveCookie Uses

func RemoveCookie(w http.ResponseWriter, name string)

func RenderNoLayoutToHTML Uses

func RenderNoLayoutToHTML(template string, data interface{}) (htemplate.HTML, *AppError)

func RenderNoLayoutToString Uses

func RenderNoLayoutToString(template string, data interface{}) (string, *AppError)

func RenderToString Uses

func RenderToString(layout, template string, data interface{}) (string, *AppError)

func SetCookie Uses

func SetCookie(w http.ResponseWriter, name, value string)

func SetCookieWithExpiration Uses

func SetCookieWithExpiration(w http.ResponseWriter, name, value string, seconds int)

XXX change seconds to duration?

func WantsJSON Uses

func WantsJSON(r *http.Request) bool

func WriteSessionCookie Uses

func WriteSessionCookie(w http.ResponseWriter, s *Session)

type AppError Uses

type AppError struct {
    Err     error
    Message string
    Code    int

func NewServerError Uses

func NewServerError(msg string) *AppError

func NotFoundErr Uses

func NotFoundErr() *AppError

func Redirect Uses

func Redirect(c Context, path string) *AppError

func RedirectToHttps Uses

func RedirectToHttps(c Context) *AppError

func Render Uses

func Render(layout, template string, data interface{}, c Context) *AppError

func RenderAtom Uses

func RenderAtom(template string, data interface{}, context Context) *AppError

func RenderCSV Uses

func RenderCSV(c Context, records [][]string, filename string) *AppError

func RenderJS Uses

func RenderJS(c Context, js string) *AppError

func RenderJSON Uses

func RenderJSON(c Context, obj interface{}) *AppError

func RenderJSONP Uses

func RenderJSONP(c Context, obj interface{}, jsonpCallback string) *AppError

func RenderMulti Uses

func RenderMulti(layout, name, innerName string, data interface{}, c Context) *AppError

func RenderNoLayout Uses

func RenderNoLayout(template string, data interface{}, c Context) *AppError

func RenderNoLayoutNoContext Uses

func RenderNoLayoutNoContext(template string, data interface{}, w http.ResponseWriter, s *Session) *AppError

func RenderString Uses

func RenderString(c Context, content string) *AppError

func ServerError Uses

func ServerError(err error, msg string) *AppError

func StoreAndRedirect Uses

func StoreAndRedirect(c Context, path string) *AppError

type Context Uses

type Context interface {
    Request() *http.Request
    Writer() http.ResponseWriter
    Session() *Session

    Before() (bool, error)

    ResultData(title string) TemplateData

type ContextBuilder Uses

type ContextBuilder func(*http.Request, http.ResponseWriter, *Session) Context

type ContextHandlerFunc Uses

type ContextHandlerFunc func(Context) *AppError

type Env Uses

type Env int
const (
    EnvProduction Env = iota
var Environment Env

type GPath Uses

type GPath []string

func Path Uses

func Path(r *http.Request, prefixLen int) GPath

func (GPath) Basename Uses

func (p GPath) Basename() string

func (GPath) Extension Uses

func (p GPath) Extension() string

type Session Uses

type Session struct {
    // contains filtered or unexported fields

func (*Session) AddErrMsg Uses

func (s *Session) AddErrMsg(msg string)

func (*Session) AddFlash Uses

func (s *Session) AddFlash(msg string)

func (*Session) AddRecent Uses

func (s *Session) AddRecent(key, val string)

func (*Session) Get Uses

func (s *Session) Get(key string) (val string, ok bool)

func (*Session) GetAndResetErrMsgs Uses

func (s *Session) GetAndResetErrMsgs() []string

func (*Session) GetAndResetFlash Uses

func (s *Session) GetAndResetFlash() []string

func (*Session) GetList Uses

func (s *Session) GetList(key string) []string

func (*Session) HasErrMsgs Uses

func (s *Session) HasErrMsgs() bool

func (*Session) HasFlash Uses

func (s *Session) HasFlash() bool

func (*Session) Push Uses

func (s *Session) Push(key, val string)

pushes a value onto a string list

func (*Session) Remove Uses

func (s *Session) Remove(key string)

func (*Session) Set Uses

func (s *Session) Set(key, val string)

func (Session) Token Uses

func (s Session) Token() string

func (Session) ValidToken Uses

func (s Session) ValidToken(t string) bool

type TemplateData Uses

type TemplateData map[string]interface{}

type TemplatePool Uses

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

Package bingo imports 23 packages (graph). Updated 2016-07-20. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).