Push v8.3.4 | Read HISTORY.md

Former-commit-id: e660dd91a4aae6d58c823f89cca733f02256c819
This commit is contained in:
kataras 2017-08-23 17:01:51 +03:00
parent 8b3c44b0a3
commit 91bad4b82b
7 changed files with 47 additions and 8 deletions

View File

@ -18,6 +18,30 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`. **How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
# We, 23 August 2017 | v8.3.4
Give read access to the current request context's route, a feature that many of you asked a lot.
```go
func(ctx context.Context) {
_ = ctx.GetCurrentRoute().Name()
// .Method() returns string, same as ctx.Method().
// .Subdomain() returns string, the registered subdomain.
// .Path() returns string, the registered path.
// .IsOnline() returns boolean.
}
```
```go
type MyController struct {
mvc.Controller
}
func (c *MyController) Get(){
_ = c.Route.Name() // same as `c.Ctx.GetCurrentRoute().Name()`.
// [...]
}
```
# We, 23 August 2017 | v8.3.3 # We, 23 August 2017 | v8.3.3
@ -340,7 +364,7 @@ Access to the low-level `context.Context` via the `Ctx` field.
Get the relative request path by using the controller's name via `RelPath()`. Get the relative request path by using the controller's name via `RelPath()`.
Get the relative template path directory by using the controller's name via `RelTmpl`(). Get the relative template path directory by using the controller's name via `RelTmpl()`.
Flow as you used to, `Controllers` can be registered to any `Party`, Flow as you used to, `Controllers` can be registered to any `Party`,
including Subdomains, the Party's begin and done handlers work as expected. including Subdomains, the Party's begin and done handlers work as expected.
@ -353,6 +377,7 @@ Optional `EndRequest(ctx)` function to perform any finalization after any method
Inheritance, recursively, see for example our `mvc.SessionController`, it has the `mvc.Controller` as an embedded field Inheritance, recursively, see for example our `mvc.SessionController`, it has the `mvc.Controller` as an embedded field
and it adds its logic to its `BeginRequest`, [here](https://github.com/kataras/iris/blob/master/mvc/session_controller.go). and it adds its logic to its `BeginRequest`, [here](https://github.com/kataras/iris/blob/master/mvc/session_controller.go).
Read access to the current route via the `Route` field.
**Using Iris MVC for code reuse** **Using Iris MVC for code reuse**

View File

@ -38,7 +38,7 @@ Iris may have reached version 8, but we're not stopping there. We have many feat
### 📑 Table of contents ### 📑 Table of contents
* [Installation](#-installation) * [Installation](#-installation)
* [Latest changes](https://github.com/kataras/iris/blob/master/HISTORY.md#we-23-august-2017--v833) * [Latest changes](https://github.com/kataras/iris/blob/master/HISTORY.md#we-23-august-2017--v834)
* [Learn](#-learn) * [Learn](#-learn)
* [HTTP Listening](_examples/#http-listening) * [HTTP Listening](_examples/#http-listening)
* [Configuration](_examples/#configuration) * [Configuration](_examples/#configuration)

View File

@ -1 +1 @@
8.3.3:https://github.com/kataras/iris/blob/master/HISTORY.md#we-23-august-2017--v833 8.3.4:https://github.com/kataras/iris/blob/master/HISTORY.md#we-23-august-2017--v834

View File

@ -5,11 +5,19 @@ package context
type RouteReadOnly interface { type RouteReadOnly interface {
// Name returns the route's name. // Name returns the route's name.
Name() string Name() string
// String returns the form of METHOD, SUBDOMAIN, TMPL PATH.
String() string // Method returns the route's method.
Method() string
// Subdomains returns the route's subdomain.
Subdomain() string
// Path returns the route's original registered path. // Path returns the route's original registered path.
Path() string Path() string
// String returns the form of METHOD, SUBDOMAIN, TMPL PATH.
String() string
// IsOnline returns true if the route is marked as "online" (state). // IsOnline returns true if the route is marked as "online" (state).
IsOnline() bool IsOnline() bool

View File

@ -189,6 +189,10 @@ type routeReadOnlyWrapper struct {
*Route *Route
} }
func (rd routeReadOnlyWrapper) Method() string {
return rd.Route.Method
}
func (rd routeReadOnlyWrapper) Name() string { func (rd routeReadOnlyWrapper) Name() string {
return rd.Route.Name return rd.Route.Name
} }

6
doc.go
View File

@ -35,7 +35,7 @@ Source code and other details for the project are available at GitHub:
Current Version Current Version
8.3.3 8.3.4
Installation Installation
@ -810,7 +810,7 @@ Access to the low-level `context.Context` via the `Ctx` field.
Get the relative request path by using the controller's name via `RelPath()`. Get the relative request path by using the controller's name via `RelPath()`.
Get the relative template path directory by using the controller's name via `RelTmpl`(). Get the relative template path directory by using the controller's name via `RelTmpl()`.
Flow as you used to, `Controllers` can be registered to any `Party`, Flow as you used to, `Controllers` can be registered to any `Party`,
including Subdomains, the Party's begin and done handlers work as expected. including Subdomains, the Party's begin and done handlers work as expected.
@ -823,6 +823,8 @@ Optional `EndRequest(ctx)` function to perform any finalization after any method
Inheritance, recursively, see for example our `mvc.SessionController`, it has the `mvc.Controller` as an embedded field Inheritance, recursively, see for example our `mvc.SessionController`, it has the `mvc.Controller` as an embedded field
and it adds its logic to its `BeginRequest`. Source file: https://github.com/kataras/iris/blob/master/mvc/session_controller.go. and it adds its logic to its `BeginRequest`. Source file: https://github.com/kataras/iris/blob/master/mvc/session_controller.go.
Read access to the current route via the `Route` field.
Using Iris MVC for code reuse Using Iris MVC for code reuse

View File

@ -32,7 +32,7 @@ import (
const ( const (
// Version is the current version number of the Iris Web Framework. // Version is the current version number of the Iris Web Framework.
Version = "8.3.3" Version = "8.3.4"
) )
// HTTP status codes as registered with IANA. // HTTP status codes as registered with IANA.