1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-24 12:25:57 +00:00

add database/orm/reform example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-01 03:46:51 +03:00
parent eacbcea653
commit acf058b006
10 changed files with 339 additions and 2 deletions

View File

@@ -3,12 +3,15 @@ package hero
import (
stdContext "context"
"errors"
"net"
"net/http"
"reflect"
"time"
"github.com/kataras/iris/v12/context"
"github.com/kataras/iris/v12/sessions"
"github.com/kataras/golog"
)
// Default is the default container value which can be used for dependencies share.
@@ -57,6 +60,10 @@ var BuiltinDependencies = []*Dependency{
return session
}).Explicitly(),
// application's logger.
NewDependency(func(ctx *context.Context) *golog.Logger {
return ctx.Application().Logger()
}).Explicitly(),
// time.Time to time.Now dependency.
NewDependency(func(ctx *context.Context) time.Time {
return time.Now()
@@ -73,6 +80,10 @@ var BuiltinDependencies = []*Dependency{
NewDependency(func(ctx *context.Context) http.Header {
return ctx.Request().Header
}).Explicitly(),
// Client IP.
NewDependency(func(ctx *context.Context) net.IP {
return net.ParseIP(ctx.RemoteAddr())
}).Explicitly(),
// payload and param bindings are dynamically allocated and declared at the end of the `binding` source file.
}