Documentation ¶
Index ¶
- type GhastController
- func (c GhastController) Config(key string) interface{}
- func (c GhastController) Container() *ghastContainer.Container
- func (c GhastController) PathParam(r *http.Request, key string) interface{}
- func (c GhastController) QueryParam(r *http.Request, key string) []string
- func (c GhastController) Unmarshal(r *http.Request, s interface{}) error
- func (c GhastController) View(name string, vars jet.VarMap, contextualData interface{}) (router.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GhastController ¶
type GhastController struct{}
GhastController should be embedded into consumer controllers and provides helper functions for working with the responseWriter, etc.
func (GhastController) Config ¶
func (c GhastController) Config(key string) interface{}
Config gets a config value from the controller's container. Config keys map to YAML in a flattened dot structure prefixed by an @. For example: a:
b: "c"
"c" can be retrieved via @a.b We can't guarantee the type, so we return interface{}
func (GhastController) Container ¶
func (c GhastController) Container() *ghastContainer.Container
Container returns the DI container associated with the given controller/request pairing.
func (GhastController) PathParam ¶
func (c GhastController) PathParam(r *http.Request, key string) interface{}
PathParam Get a Path Parameter from a given request and key
func (GhastController) QueryParam ¶
func (c GhastController) QueryParam(r *http.Request, key string) []string
PathParam Get a Path Parameter from a given request and key returns a list of strings as it supports multiple values for a given path param
func (GhastController) Unmarshal ¶
func (c GhastController) Unmarshal(r *http.Request, s interface{}) error
Unmarshal unmarshalls a request with a body into the provided struct returns an error or nil value depending on if the unmarshall succeeded or not.
func (GhastController) View ¶
func (c GhastController) View(name string, vars jet.VarMap, contextualData interface{}) (router.Response, error)
View executes a view from the app templates returns a response with the body set to the template Feel free to modify the response object further before returning in your controller