summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2017-01-26 10:48:40 -0800
committerGitHub <noreply@github.com>2017-01-26 10:48:40 -0800
commit16a159acec94fd391e840fab061ed08cf894369f (patch)
tree3418b9e58c9b967171bb5e5138a36cae3384f5c5 /system/item
parent3dea30f62a274db3e0cc95441338b2b71a751198 (diff)
[core] Embedded and implement http.Pusher into http.ResponseWriter+gzip Writer (#47)
* added http Pusher interface to gzip response writer * implement Pusher on gzipResponseWriter and pass encoding header to pusher options * providing a generic error view fuction for code that calls a interface method which will have access to the response * fix []byte -> string type for fmt string * adding the res, req pattern for method arguments in interfaces and their method calls * fix for spacing in generic error message * remove default error views displayed in lifecycle hooks - will rely on custom views or redirects inside hook now that user has ResponseWriter. Otherwise, multiple WriteHeader calls would be warned * removing WriteHeader calls before return in external handlers * bump version 0.8.1
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/system/item/item.go b/system/item/item.go
index e631b36..e356c7c 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -42,22 +42,22 @@ type Sortable interface {
// to the different lifecycles/events a struct may encounter. Item implements
// Hookable with no-ops so our user can override only whichever ones necessary.
type Hookable interface {
- BeforeSave(req *http.Request) error
- AfterSave(req *http.Request) error
+ BeforeSave(http.ResponseWriter, *http.Request) error
+ AfterSave(http.ResponseWriter, *http.Request) error
- BeforeDelete(req *http.Request) error
- AfterDelete(req *http.Request) error
+ BeforeDelete(http.ResponseWriter, *http.Request) error
+ AfterDelete(http.ResponseWriter, *http.Request) error
- BeforeApprove(req *http.Request) error
- AfterApprove(req *http.Request) error
+ BeforeApprove(http.ResponseWriter, *http.Request) error
+ AfterApprove(http.ResponseWriter, *http.Request) error
- BeforeReject(req *http.Request) error
- AfterReject(req *http.Request) error
+ BeforeReject(http.ResponseWriter, *http.Request) error
+ AfterReject(http.ResponseWriter, *http.Request) error
}
// Hideable lets a user keep items hidden
type Hideable interface {
- Hide(*http.Request) error
+ Hide(http.ResponseWriter, *http.Request) error
}
// Pushable lets a user define which values of certain struct fields are
@@ -122,42 +122,42 @@ func (i Item) String() string {
}
// BeforeSave is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeSave(req *http.Request) error {
+func (i Item) BeforeSave(res http.ResponseWriter, req *http.Request) error {
return nil
}
// AfterSave is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterSave(req *http.Request) error {
+func (i Item) AfterSave(res http.ResponseWriter, req *http.Request) error {
return nil
}
// BeforeDelete is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeDelete(req *http.Request) error {
+func (i Item) BeforeDelete(res http.ResponseWriter, req *http.Request) error {
return nil
}
// AfterDelete is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterDelete(req *http.Request) error {
+func (i Item) AfterDelete(res http.ResponseWriter, req *http.Request) error {
return nil
}
// BeforeApprove is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeApprove(req *http.Request) error {
+func (i Item) BeforeApprove(res http.ResponseWriter, req *http.Request) error {
return nil
}
// AfterApprove is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterApprove(req *http.Request) error {
+func (i Item) AfterApprove(res http.ResponseWriter, req *http.Request) error {
return nil
}
// BeforeReject is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeReject(req *http.Request) error {
+func (i Item) BeforeReject(res http.ResponseWriter, req *http.Request) error {
return nil
}
// AfterReject is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterReject(req *http.Request) error {
+func (i Item) AfterReject(res http.ResponseWriter, req *http.Request) error {
return nil
}