1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

Move the kataras/go-serializer into one iris' file.

Start organising the kataras/go-*package which are relative to the Iris
project. The kataras/go-*package will be exists and their features will
be adapted to Iris every 2 months, as we say at readme, iris-relative
packages should be tested for a long time before adapted to Iris.

With this way we have stability, code readability(the developer can
easly navigate to iris' code without need to move across different
kataras/ projects).


Former-commit-id: db291faaf59d4f53f14ce5800fde805f56c8b802
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-03-01 15:04:42 +02:00
parent a4ff95f1d9
commit 57aea4aa75
7 changed files with 287 additions and 54 deletions

View File

@@ -379,7 +379,7 @@ func (r RouterWrapperPolicy) Adapt(frame *Policies) {
// - the first registered is executing last.
// So a custom adaptor that the community can create and share with each other
// can override the existing one with just a simple registration.
type RenderPolicy func(out io.Writer, name string, bind interface{}, options ...map[string]interface{}) (error, bool)
type RenderPolicy func(out io.Writer, name string, bind interface{}, options ...map[string]interface{}) (bool, error)
// Adapt adaps a RenderPolicy object to the main *Policies.
func (r RenderPolicy) Adapt(frame *Policies) {
@@ -388,14 +388,14 @@ func (r RenderPolicy) Adapt(frame *Policies) {
prevRenderer := frame.RenderPolicy
if prevRenderer != nil {
nextRenderer := r
renderer = func(out io.Writer, name string, binding interface{}, options ...map[string]interface{}) (error, bool) {
renderer = func(out io.Writer, name string, binding interface{}, options ...map[string]interface{}) (bool, error) {
// Remember: RenderPolicy works in the opossite order of declaration,
// the last registered is trying to be executed first,
// the first registered is executing last.
err, ok := nextRenderer(out, name, binding, options...)
ok, err := nextRenderer(out, name, binding, options...)
if !ok {
prevErr, prevOk := prevRenderer(out, name, binding, options...)
prevOk, prevErr := prevRenderer(out, name, binding, options...)
if err != nil {
if prevErr != nil {
err = errors.New(prevErr.Error()).Append(err.Error())
@@ -407,7 +407,7 @@ func (r RenderPolicy) Adapt(frame *Policies) {
}
// this renderer is responsible for this name
// but it has an error, so don't continue to the next
return err, ok
return ok, err
}
}