Documentation
¶
Index ¶
- Constants
- func CurrentPath(r *http.Request) string
- func Path(root string, id string, suffixes ...string) string
- func Url(root string, id string, suffixes ...string) string
- type BranchType
- type ErrorPageType
- type Flash
- type FlashRenderer
- type Flashes
- func (f *Flashes) Add(msg string, ugency Urgency, expiry int)
- func (f *Flashes) Clear(w http.ResponseWriter)
- func (f *Flashes) Decode(encoded string) error
- func (f *Flashes) Encode() ([]byte, error)
- func (f *Flashes) Error(msg string)
- func (f *Flashes) Info(msg string)
- func (f *Flashes) Save(w http.ResponseWriter) error
- func (f *Flashes) Success(msg string)
- func (f *Flashes) Warning(msg string)
- type Handler
- type Layout
- type PathType
- func (r *PathType) Delete(handler Handler) *PathType
- func (r *PathType) Get(handler Handler) *PathType
- func (r *PathType) Handle(method string, handler Handler) *PathType
- func (r *PathType) Map(route PathType) *PathType
- func (r *PathType) Patch(handler Handler) *PathType
- func (r *PathType) Post(handler Handler) *PathType
- func (r *PathType) Put(handler Handler) *PathType
- type Response
- func (r Response) Back() Response
- func (r Response) Content(content ...fido.Element) Response
- func (r Response) Error(err error) Response
- func (r Response) GetContent() []fido.Element
- func (r Response) Header(key, value string) Response
- func (r Response) Info(msg string, expiry ...int) Response
- func (r Response) Notify(msg string, urgency Urgency, expiry ...int) Response
- func (r Response) PushUrl(url string) Response
- func (r Response) Redirect(url string) Response
- func (r Response) ReplaceUrl(url string) Response
- func (r Response) Success(msg string, expiry ...int) Response
- func (r Response) Warning(msg string, expiry ...int) Response
- type Router
- type Urgency
Constants ¶
View Source
const FlashCookieName = "flash"
Variables ¶
This section is empty.
Functions ¶
func CurrentPath ¶
Types ¶
type ErrorPageType ¶
type Flashes ¶ added in v1.0.4
type Flashes []Flash
func (*Flashes) Clear ¶ added in v1.0.4
func (f *Flashes) Clear(w http.ResponseWriter)
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func Respond ¶ added in v1.0.4
func Respond() Response
Error(err).WrapErr("This dog has wandered off.")
func (r Response) Wrap(msg string) Response {
r.err = fmt.Errorf("%s: %w", msg, r.err)
return r
}
func (Response) GetContent ¶ added in v1.0.4
func (r Response) ErrPublic() string {
if r.err == nil {
return ""
}
parts := strings.Split(r.err.Error(), ":")
if len(parts) < 1 {
return ""
}
return strings.TrimSpace(parts[0])
}
func (r Response) ErrDetail() string {
if r.err == nil {
return ""
}
parts := strings.Split(r.err.Error(), ":")
if len(parts) < 2 {
return ""
}
// join all the parts after the first one with :
return strings.TrimSpace(strings.Join(parts[1:], ": "))
}
func (Response) ReplaceUrl ¶ added in v1.0.4
Click to show internal directories.
Click to hide internal directories.