Documentation ¶
Index ¶
- Variables
- func AssetCssPreprocessor(assets *Assets, path string, content []byte) ([]byte, error)
- func AssetSourceMapPreprocessor(assets *Assets, path string, content []byte) ([]byte, error)
- func RemoveAssetsFilter(events []logkit.Event) []logkit.Event
- type Action
- type Assets
- func (f *Assets) AddDirectory(directory string, virtualPath string, ignoreDirs ...string) error
- func (f *Assets) AddFile(file string, virtualPath string)
- func (f *Assets) AddMinifyPreprocessors(minifyCSS, minifyJavascript, minifySVG, minifyHTML, minifyTmpl bool)
- func (f *Assets) AddPreprocessor(extension string, processor Preprocessor)
- func (f *Assets) ClearPreprocessors(extension string)
- func (f *Assets) Get(virtualPath string) (*File, error)
- func (f *Assets) GetTemplate(templatePathArr []string) (*template.Template, error)
- func (f *Assets) GetUrl(virtualPath string) (string, error)
- func (f *Assets) RenderNamedTemplate(templatePathArr []string, name string, w http.ResponseWriter, data interface{}) error
- func (f *Assets) RenderNamedTemplateString(templatePathArr []string, name string, data interface{}) (string, error)
- func (f *Assets) RenderTemplate(templatePathArr []string, w http.ResponseWriter, data interface{}) error
- func (f *Assets) RenderTemplateString(templatePathArr []string, data interface{}) (string, error)
- func (f *Assets) Serve(url string, w http.ResponseWriter, r *http.Request)
- func (f *Assets) SetTemplateFunc(name string, templateFunc interface{})
- type Context
- func (c *Context) CheckErr(err error)
- func (c *Context) ClientIP() net.IP
- func (c *Context) Cookie(name string) (*http.Cookie, error)
- func (c *Context) Flush()
- func (c *Context) GetData(key string) (interface{}, bool)
- func (c *Context) Header() http.Header
- func (c *Context) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (c *Context) JSON(data interface{}) error
- func (c *Context) NotFound()
- func (c *Context) Redirect(urlStr string)
- func (c *Context) RedirectPermanent(urlStr string)
- func (c *Context) RemoveData(key string)
- func (c *Context) Render(data interface{})
- func (c *Context) RenderTemplate(templatePath string, data interface{}) error
- func (c *Context) RouteArg(name string) string
- func (c *Context) RouteArgInt64(name string) (int64, error)
- func (c *Context) ServerError(err string, code int)
- func (c *Context) SetData(key string, value interface{})
- func (c *Context) Write(data []byte) (int, error)
- func (c *Context) WriteHeader(statusCode int)
- func (c *Context) WriteString(value string) (int, error)
- type File
- type InputReader
- type Middleware
- type Preprocessor
- type Route
- type Site
- type TemplateDataWrapper
- type TestSession
- func (s *TestSession) Action(action Action, req *http.Request) *TestSessionResponse
- func (s *TestSession) Get(url string) *TestSessionResponse
- func (s *TestSession) Post(url string, bodyType string, body io.Reader) *TestSessionResponse
- func (s *TestSession) PostAction(url string, data url.Values, action Action) *TestSessionResponse
- func (s *TestSession) PostForm(url string, data url.Values) *TestSessionResponse
- func (s *TestSession) Request(req *http.Request) *TestSessionResponse
- type TestSessionResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var SingleServerSite = false
SingleServerSite can be set to true if you know you're never going to deploy to a cluster of multiple web servers (like during development). This will make startup faster as assets can be procssed ad-hoc instead of all up front.
Functions ¶
func AssetCssPreprocessor ¶
Types ¶
type Assets ¶
type Assets struct {
// contains filtered or unexported fields
}
func (*Assets) AddDirectory ¶
func (*Assets) AddMinifyPreprocessors ¶
func (*Assets) AddPreprocessor ¶
func (f *Assets) AddPreprocessor(extension string, processor Preprocessor)
func (*Assets) ClearPreprocessors ¶
func (*Assets) GetTemplate ¶
func (*Assets) RenderNamedTemplate ¶
func (*Assets) RenderNamedTemplateString ¶
func (*Assets) RenderTemplate ¶
func (f *Assets) RenderTemplate(templatePathArr []string, w http.ResponseWriter, data interface{}) error
func (*Assets) RenderTemplateString ¶
func (*Assets) SetTemplateFunc ¶
type Context ¶
type Context struct { *logkit.Context Site *Site Route *Route Request *http.Request MasterFile string Form formInputReader PostForm formInputReader Cookies cookieInputReader // contains filtered or unexported fields }
func CreateContext ¶
func (*Context) ClientIP ¶
ClientIP trys to get the ip of the client by inspecting common headers and the ip of remote endpoint of the tcp connection
func (*Context) RedirectPermanent ¶
func (*Context) RemoveData ¶
func (*Context) RenderTemplate ¶
func (*Context) ServerError ¶
func (*Context) WriteHeader ¶
type InputReader ¶
type InputReader interface { String(name string, fallback string) string Bool(name string, fallback bool) bool Int(name string, min, max, fallback int) int }
InputReader makes it easy to read input
type Middleware ¶
type Preprocessor ¶
type Site ¶
type Site struct { NoRequestLogkitOperation bool Development bool DefaultMasterFile string TemplateDataWrapper TemplateDataWrapper Assets *Assets NotFound Route ServerError Route PanicHandler func(c *Context, err interface{}) bool RedirectTrailingSlash bool BufferedEventsFilter logkit.BufferedEventsFilter // contains filtered or unexported fields }
func (*Site) AddMiddleware ¶
func (s *Site) AddMiddleware(middleware Middleware)
func (*Site) ListenAndServe ¶
type TemplateDataWrapper ¶
type TestSession ¶
type TestSession struct { Cookies string // contains filtered or unexported fields }
TestSession represents a test session for a single user
func NewTestSession ¶
func NewTestSession(t *testing.T, site *Site) *TestSession
func (*TestSession) Action ¶
func (s *TestSession) Action(action Action, req *http.Request) *TestSessionResponse
func (*TestSession) Get ¶
func (s *TestSession) Get(url string) *TestSessionResponse
func (*TestSession) Post ¶
func (s *TestSession) Post(url string, bodyType string, body io.Reader) *TestSessionResponse
func (*TestSession) PostAction ¶
func (s *TestSession) PostAction(url string, data url.Values, action Action) *TestSessionResponse
func (*TestSession) PostForm ¶
func (s *TestSession) PostForm(url string, data url.Values) *TestSessionResponse
func (*TestSession) Request ¶
func (s *TestSession) Request(req *http.Request) *TestSessionResponse
type TestSessionResponse ¶
type TestSessionResponse struct { Code int // the HTTP response code from WriteHeader HeaderMap http.Header // the HTTP response headers Body *bytes.Buffer // if non-nil, the bytes.Buffer to append written data to // contains filtered or unexported fields }
func (*TestSessionResponse) AssertBodyEquals ¶
func (r *TestSessionResponse) AssertBodyEquals(comparision string) *TestSessionResponse
Click to show internal directories.
Click to hide internal directories.