Get returns an Iris Application based on its "appName". It returns nil when no application was found with the given exact name. If "appName" parameter is missing then it returns the last registered one. When no application is registered yet then it creates a new on-fly with a "Default" name and ret
(appName ...string)
| 22 | // To check if at least one application is registered or not |
| 23 | // use the `GetAll` function instead. |
| 24 | func Get(appName ...string) *iris.Application { |
| 25 | if len(appName) == 0 || appName[0] == "" { |
| 26 | if app := context.LastApplication(); app != nil { |
| 27 | return app.(*iris.Application) |
| 28 | } |
| 29 | |
| 30 | return iris.New().SetName("Default") |
| 31 | } |
| 32 | |
| 33 | if app, ok := context.GetApplication(appName[0]); ok { |
| 34 | return app.(*iris.Application) |
| 35 | } |
| 36 | |
| 37 | return nil |
| 38 | } |
| 39 | |
| 40 | // GetAll returns a slice of all registered Iris Applications. |
| 41 | func GetAll() []*iris.Application { |
nothing calls this directly
no test coverage detected