Documentation ¶
Index ¶
- Constants
- func Debug(r *http.Request, v ...interface{})
- func Debugf(r *http.Request, format string, v ...interface{})
- func Error(r *http.Request, v ...interface{})
- func Errorf(r *http.Request, format string, v ...interface{})
- func Fatal(r *http.Request, v ...interface{})
- func Fatalf(r *http.Request, format string, v ...interface{})
- func InDevelopmentStage(r *http.Request) bool
- func InProductionStage(r *http.Request) bool
- func InTestingStage(r *http.Request) bool
- func Info(r *http.Request, v ...interface{})
- func Infof(r *http.Request, format string, v ...interface{})
- func ListenOSInterrupt(cancel context.CancelFunc)
- func Parameters(r *http.Request) map[string]string
- func Pg(r *http.Request) orm.DB
- func RenderGuestLayout(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
- func RenderLayout(w http.ResponseWriter, r *http.Request, layoutName, templateName string, ...)
- func RenderUserLayout(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
- func ResponseUnauthorized(w http.ResponseWriter, r *http.Request)
- func ResponseWithError(w http.ResponseWriter, r *http.Request, err error)
- func Stage(r *http.Request) string
- func Warning(r *http.Request, v ...interface{})
- func Warningf(r *http.Request, format string, v ...interface{})
- type App
- type Authenticator
- type Logger
- type MiddlewareFunc
- type Pagination
- type SessionValidator
- type SimpleAuthenticator
- type TemplateConfig
- type TemplatePathResolver
Constants ¶
View Source
const ( StageDevelopment = "dev" StageTesting = "test" StageProduction = "prod" )
Variables ¶
This section is empty.
Functions ¶
func InDevelopmentStage ¶
func InProductionStage ¶
func InTestingStage ¶
func ListenOSInterrupt ¶
func ListenOSInterrupt(cancel context.CancelFunc)
func RenderGuestLayout ¶
func RenderGuestLayout(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
func RenderLayout ¶
func RenderLayout(w http.ResponseWriter, r *http.Request, layoutName, templateName string, data interface{})
func RenderUserLayout ¶
func RenderUserLayout(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
func ResponseUnauthorized ¶
func ResponseUnauthorized(w http.ResponseWriter, r *http.Request)
func ResponseWithError ¶
func ResponseWithError(w http.ResponseWriter, r *http.Request, err error)
Types ¶
type App ¶
type App struct { Logger Logger Stage string Template TemplateConfig UseTemplate bool Authenticator Authenticator ErrorPath string Address string // contains filtered or unexported fields }
func (*App) InDevelopmentStage ¶
func (*App) InProductionStage ¶
func (*App) InTestingStage ¶
func (*App) Middleware ¶
func (a *App) Middleware(m MiddlewareFunc)
type Logger ¶
type Logger interface { Debugf(format string, v ...interface{}) Debug(v ...interface{}) Infof(format string, v ...interface{}) Info(v ...interface{}) Warningf(format string, v ...interface{}) Warning(v ...interface{}) Errorf(format string, v ...interface{}) Error(v ...interface{}) Fatalf(format string, v ...interface{}) Fatal(v ...interface{}) }
type MiddlewareFunc ¶
func PostgreDBMiddleware ¶
func PostgreDBMiddleware(db orm.DB) MiddlewareFunc
type Pagination ¶
type Pagination struct { Page int `json:"page"` PageSize int `json:"page_size"` TotalData int `json:"total_data"` TotalPage int `json:"total_page"` }
func CalculatePagination ¶
func CalculatePagination(page, pageSize, totalData int) *Pagination
func (*Pagination) HasMultiplePages ¶
func (p *Pagination) HasMultiplePages() bool
func (*Pagination) NextPage ¶
func (p *Pagination) NextPage() int
func (*Pagination) Offset ¶
func (p *Pagination) Offset() int
func (*Pagination) PageIsFirst ¶
func (p *Pagination) PageIsFirst() bool
func (*Pagination) PageIsLast ¶
func (p *Pagination) PageIsLast() bool
func (*Pagination) PrevPage ¶
func (p *Pagination) PrevPage() int
type SessionValidator ¶
type SimpleAuthenticator ¶
type SimpleAuthenticator struct { GuestPaths []string CookiePrefix string SessionValidator SessionValidator }
type TemplateConfig ¶
type TemplateConfig struct { GuestLayoutName string UserLayoutName string PathResolver TemplatePathResolver Functions template.FuncMap }
type TemplatePathResolver ¶
Click to show internal directories.
Click to hide internal directories.