Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfiguration() iris.Configuration
- func NewApplication(controllers ...interface{}) app.Application
- func RegisterInitializer(initializer ...interface{})
- func RestController(controllers ...interface{})
- type AnonController
- type ApplicationContext
- type Context
- func (ctx *Context) Do(handlers context.Handlers)
- func (ctx *Context) HTML(htmlContents string) (int, error)
- func (ctx *Context) Next()
- func (ctx *Context) RequestBody(data interface{}) error
- func (ctx *Context) RequestEx(data interface{}, cb func() error) error
- func (ctx *Context) RequestForm(data interface{}) error
- func (ctx *Context) RequestParams(data interface{}) error
- func (ctx *Context) ResponseBody(message string, data interface{})
- func (ctx *Context) ResponseError(message string, code int)
- func (ctx *Context) ResponseString(data string)
- func (ctx *Context) Translate(format string, args ...interface{}) string
- type Controller
- type ExtendedContext
- type TestApplication
Constants ¶
const ( BeforeMethod = "Before" AfterMethod = "After" )
Variables ¶
Functions ¶
func DefaultConfiguration ¶
func DefaultConfiguration() iris.Configuration
DefaultConfiguration returns the default configuration for an iris station, fills the main Configuration
func NewApplication ¶
func NewApplication(controllers ...interface{}) app.Application
NewApplication create new web application instance and init it
func RegisterInitializer ¶
func RegisterInitializer(initializer ...interface{})
func RestController ¶
func RestController(controllers ...interface{})
Add add controller to controllers container
Types ¶
type AnonController ¶
type AnonController interface{}
type ApplicationContext ¶
type ApplicationContext interface { context.Context ExtendedContext }
type Context ¶
type Context struct { // Optional Part 1: embed (optional but required if you don't want to override all context's methods) // it's the context/context.go#context struct but you don't need to know it. context.Context ExtendedContext }
Context Create your own custom Context, put any fields you wanna need.
func (*Context) Do ¶
Do: The only one important if you will override the Context with an embedded context.Context inside it. Required in order to run the handlers via this "*Context".
func (*Context) HTML ¶
HTML Override any context's method you want... [...]
func (*Context) Next ¶
func (ctx *Context) Next()
Next: The second one important if you will override the Context with an embedded context.Context inside it. Required in order to run the chain of handlers via this "*Context".
func (*Context) RequestBody ¶
RequestBody get RequestBody
func (*Context) RequestEx ¶
RequestEx get RequestBody
func (*Context) RequestForm ¶
RequestForm get RequestFrom
func (*Context) RequestParams ¶
RequestParams get RequestParams
func (*Context) ResponseBody ¶
ResponseBody set response
func (*Context) ResponseError ¶
Response Errorset response
func (*Context) ResponseString ¶
ResponseBody set response
type Controller ¶
type Controller struct { AnonController ContextMapping string Ctx *Context }
Controller is the web base controller
type ExtendedContext ¶
type TestApplication ¶
type TestApplication interface { app.Application RunTestServer(t *testing.T) *httpexpect.Expect Request(method, path string, pathargs ...interface{}) *httpexpect.Request Post(path string, pathargs ...interface{}) *httpexpect.Request Get(path string, pathargs ...interface{}) *httpexpect.Request Put(path string, pathargs ...interface{}) *httpexpect.Request Delete(path string, pathargs ...interface{}) *httpexpect.Request Patch(path string, pathargs ...interface{}) *httpexpect.Request }
TestApplicationInterface the test web application interface for unit test only
func NewTestApplication ¶
func NewTestApplication(t *testing.T, controllers ...interface{}) TestApplication
NewTestApplication returns the new test application