Documentation ¶
Index ¶
- Variables
- func BadRequest(w http.ResponseWriter, r *http.Request)
- func Execute(w http.ResponseWriter, r *http.Request, templateName string, p *Page)
- func ExecuteTemplateStatus(w http.ResponseWriter, r *http.Request, templateName string, p *Page, ...)
- func Forbidden(w http.ResponseWriter, r *http.Request)
- func GET(url string, handler httprouter.Handle)
- func GetLocale(r *http.Request) int
- func GetUrl(r *http.Request, index int) string
- func GetUrlByLocale(locale int, index int) string
- func Init(c *Config)
- func InternalServerError(w http.ResponseWriter, r *http.Request, e error)
- func MakeMap(keyValue ...interface{}) myMap
- func NotFound(w http.ResponseWriter, r *http.Request)
- func NotImplemented(w http.ResponseWriter, r *http.Request)
- func POST(url string, handler httprouter.Handle)
- func PreloadTemplate(templateName ...string)
- func PreloadTemplates()
- func Render(c *iris.Context, tmpl string, p *Page)
- func RenderWithStatus(c *iris.Context, templateName string, p *Page, status int)
- func WriteInternalError(w http.ResponseWriter, err string)
- func WritePlain(w http.ResponseWriter, status int, msg string)
- type Alternative
- type Config
- type Language
- type LazyInterface
- type Page
- func (p *Page) ActiveLanguage() string
- func (p *Page) Alternatives() []*Alternative
- func (p *Page) BenchNanoseconds() int64
- func (p *Page) DefaultLanguage() string
- func (p *Page) DivideInt64(a, b int64) int64
- func (p *Page) Flush() string
- func (p *Page) FormatCurrency(f float64) string
- func (p *Page) Get(key string) interface{}
- func (p *Page) GetUrl(key int) string
- func (p *Page) IsSet(something interface{}) bool
- func (p *Page) Lang(s string) string
- func (p *Page) Languages() []Language
- func (p *Page) Lazy(lazy LazyInterface) string
- func (p *Page) Plus(a, b int) int
- func (p *Page) Times(a, b float64) float64
- func (p *Page) Tuple(somethings ...interface{}) *Tuple
- type PageHandler
- type Tuple
Constants ¶
This section is empty.
Variables ¶
var ( LTrace = log.New(ioutil.Discard, "TRACE:\t\t", log.Ldate|log.Ltime|log.Lshortfile) LInfo = log.New(os.Stdout, "INFO:\t\t", log.Ldate|log.Ltime|log.Lshortfile) LWarning = log.New(os.Stdout, "WARNING:\t", log.Ldate|log.Ltime|log.Lshortfile) LError = log.New(os.Stderr, "ERROR:\t\t", log.Ldate|log.Ltime|log.Lshortfile) ErrorPage string )
var HttpMux = httprouter.New()
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, r *http.Request)
func Execute ¶
ExecuteTemplate executes the given template using the Page given, setting Cache-Control if unset
func ExecuteTemplateStatus ¶
func GET ¶
func GET(url string, handler httprouter.Handle)
func GetLocale ¶
GetLocale accesses the locale-integer set by LanguageHandler, and returning it - panics on failure.
func GetUrlByLocale ¶
GetUrlByLocale returns the localised-url for the given locale and url
func Init ¶
func Init(c *Config)
Init makes sure all variables are set up correctly before any function can be used
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, r *http.Request, e error)
func MakeMap ¶
func MakeMap(keyValue ...interface{}) myMap
MakeMap allows the initialization of a myMap-instance, { key1, value1, key2, value2, ... }
func NotImplemented ¶
func NotImplemented(w http.ResponseWriter, r *http.Request)
func POST ¶
func POST(url string, handler httprouter.Handle)
func PreloadTemplate ¶
func PreloadTemplate(templateName ...string)
PreloadTemplate adds the given template names to the queue to be preloaded
func PreloadTemplates ¶
func PreloadTemplates()
PreloadTemplates actually preloads the queued template names
func RenderWithStatus ¶
func WriteInternalError ¶
func WriteInternalError(w http.ResponseWriter, err string)
WriteInternalError writes the given error to the ResponseWriter as plaintext, and logs the error.
func WritePlain ¶
func WritePlain(w http.ResponseWriter, status int, msg string)
WritePlain writes the given message to the ResponseWriter, with Status code 'status'
Types ¶
type Alternative ¶
type LazyInterface ¶
type Page ¶
type Page struct { Data myMap Locale int Url string Start time.Time // contains filtered or unexported fields }
Page is a struct allowing data to be passed to the template
func (*Page) ActiveLanguage ¶
func (*Page) Alternatives ¶
func (p *Page) Alternatives() []*Alternative
func (*Page) BenchNanoseconds ¶
func (*Page) DefaultLanguage ¶
func (*Page) DivideInt64 ¶
func (*Page) Lazy ¶
func (p *Page) Lazy(lazy LazyInterface) string
type PageHandler ¶
type PageHandler interface {
Handle(http.ResponseWriter, *http.Request, *Page)
}
func DefaultHandler ¶
func DefaultHandler() PageHandler