MCPcopy Create free account
hub / github.com/kataras/iris / Get

Function Get

apps/apps.go:24–38  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

22// To check if at least one application is registered or not
23// use the `GetAll` function instead.
24func 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.
41func GetAll() []*iris.Application {

Callers

nothing calls this directly

Calls 4

LastApplicationFunction · 0.92
GetApplicationFunction · 0.92
NewMethod · 0.80
SetNameMethod · 0.45

Tested by

no test coverage detected