Documentation ¶
Overview ¶
Wrapper defines the struct to be passed back to the controller. It contains the entirety of the response and performs all marshalling and write operations
Index ¶
- type Session
- type Wrapper
- func (w *Wrapper) DeleteAPayload(n string)
- func (w *Wrapper) GetAPayload(n string) (interface{}, error)
- func (w *Wrapper) GetPayload() map[string]interface{}
- func (w *Wrapper) GetSessionValue(n string, i interface{}) error
- func (w *Wrapper) NewSession() error
- func (w *Wrapper) Serve()
- func (w *Wrapper) SetClasses(c string)
- func (w *Wrapper) SetContent(c interface{})
- func (w *Wrapper) SetDynamicId(i string)
- func (w *Wrapper) SetPayload(n string, v interface{})
- func (w *Wrapper) SetSession() error
- func (w *Wrapper) SetSessionValue(k string, v interface{}) error
- func (w *Wrapper) SetTemplate(t string)
- func (w *Wrapper) Shift()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wrapper ¶
type Wrapper struct { Writer http.ResponseWriter // The response writer Request *http.Request // The request SiteConfig *configs.SiteConfig // The configuration for the site being accessed Session *Session // Session for user Payload map[string]interface{} // This is the sum of the payload that will be returned to the user DbSession *mgo.Session // The master MongoDb session that gets copied APIParams []string }
Wrapper structure required to be passed back to the Controller
func New ¶
func New(w http.ResponseWriter, r *http.Request, s *configs.SiteConfig) *Wrapper
Constructor for the Wrapper
func (*Wrapper) DeleteAPayload ¶
Gets payload based on a keyvalue
func (*Wrapper) GetAPayload ¶
Gets payload based on a keyvalue
func (*Wrapper) GetPayload ¶
Gets entire payload
func (*Wrapper) GetSessionValue ¶
Get a session value by key.
func (*Wrapper) Serve ¶
func (w *Wrapper) Serve()
The final serve function. This will marshall the payload and serve it to the user.
func (*Wrapper) SetClasses ¶
Helper function for the controller to easily add its final content to the Payload
func (*Wrapper) SetContent ¶
func (w *Wrapper) SetContent(c interface{})
Helper function for the controller to easily add its final content to the Payload
func (*Wrapper) SetDynamicId ¶
Helper function for the controller to easily add its final content to the Payload
func (*Wrapper) SetPayload ¶
Sets payload based on a keyvalue
func (*Wrapper) SetSession ¶
func (*Wrapper) SetSessionValue ¶
Get current session data
func (*Wrapper) SetTemplate ¶
Helper function for the controller to easily add its final content to the Payload