Documentation ¶
Index ¶
- Variables
- func Biller(i interface{}) billing.Biller
- func Captcha(i interface{}) auth.Captcha
- func Config(i interface{}) *config.Config
- func Data(i interface{}) *data.Client
- func I18n(i interface{}) *in.Bundle
- func IpStrategy(i interface{}) realclientipgo.Strategy
- func Limiter(i interface{}) *v1.Limiter
- func Logger(i interface{}) *slog.Logger
- func Messenger(i interface{}) messaging.Messenger
- func NewBuilder(scopes ...string) (*builder, error)
- func Redis(i interface{}) *v.Client
- func Resolver(i interface{}) *resolvers.Resolver
- func Scheduler(i interface{}) *tasks.Scheduler
- func Ses(i interface{}) *ses.SES
- type Container
- func (c *Container) Clean() error
- func (c *Container) Delete() error
- func (c *Container) DeleteWithSubContainers() error
- func (c *Container) Fill(name string, dst interface{}) error
- func (c *Container) Get(name string) interface{}
- func (c *Container) GetBiller() billing.Biller
- func (c *Container) GetCaptcha() auth.Captcha
- func (c *Container) GetConfig() *config.Config
- func (c *Container) GetData() *data.Client
- func (c *Container) GetI18n() *in.Bundle
- func (c *Container) GetIpStrategy() realclientipgo.Strategy
- func (c *Container) GetLimiter() *v1.Limiter
- func (c *Container) GetLogger() *slog.Logger
- func (c *Container) GetMessenger() messaging.Messenger
- func (c *Container) GetRedis() *v.Client
- func (c *Container) GetResolver() *resolvers.Resolver
- func (c *Container) GetScheduler() *tasks.Scheduler
- func (c *Container) GetSes() *ses.SES
- func (c *Container) IsClosed() bool
- func (c *Container) Parent() *Container
- func (c *Container) ParentScopes() []string
- func (c *Container) SafeGet(name string) (interface{}, error)
- func (c *Container) SafeGetBiller() (billing.Biller, error)
- func (c *Container) SafeGetCaptcha() (auth.Captcha, error)
- func (c *Container) SafeGetConfig() (*config.Config, error)
- func (c *Container) SafeGetData() (*data.Client, error)
- func (c *Container) SafeGetI18n() (*in.Bundle, error)
- func (c *Container) SafeGetIpStrategy() (realclientipgo.Strategy, error)
- func (c *Container) SafeGetLimiter() (*v1.Limiter, error)
- func (c *Container) SafeGetLogger() (*slog.Logger, error)
- func (c *Container) SafeGetMessenger() (messaging.Messenger, error)
- func (c *Container) SafeGetRedis() (*v.Client, error)
- func (c *Container) SafeGetResolver() (*resolvers.Resolver, error)
- func (c *Container) SafeGetScheduler() (*tasks.Scheduler, error)
- func (c *Container) SafeGetSes() (*ses.SES, error)
- func (c *Container) Scope() string
- func (c *Container) Scopes() []string
- func (c *Container) SubContainer() (*Container, error)
- func (c *Container) SubScopes() []string
- func (c *Container) UnscopedFill(name string, dst interface{}) error
- func (c *Container) UnscopedGet(name string) interface{}
- func (c *Container) UnscopedGetBiller() billing.Biller
- func (c *Container) UnscopedGetCaptcha() auth.Captcha
- func (c *Container) UnscopedGetConfig() *config.Config
- func (c *Container) UnscopedGetData() *data.Client
- func (c *Container) UnscopedGetI18n() *in.Bundle
- func (c *Container) UnscopedGetIpStrategy() realclientipgo.Strategy
- func (c *Container) UnscopedGetLimiter() *v1.Limiter
- func (c *Container) UnscopedGetLogger() *slog.Logger
- func (c *Container) UnscopedGetMessenger() messaging.Messenger
- func (c *Container) UnscopedGetRedis() *v.Client
- func (c *Container) UnscopedGetResolver() *resolvers.Resolver
- func (c *Container) UnscopedGetScheduler() *tasks.Scheduler
- func (c *Container) UnscopedGetSes() *ses.SES
- func (c *Container) UnscopedSafeGet(name string) (interface{}, error)
- func (c *Container) UnscopedSafeGetBiller() (billing.Biller, error)
- func (c *Container) UnscopedSafeGetCaptcha() (auth.Captcha, error)
- func (c *Container) UnscopedSafeGetConfig() (*config.Config, error)
- func (c *Container) UnscopedSafeGetData() (*data.Client, error)
- func (c *Container) UnscopedSafeGetI18n() (*in.Bundle, error)
- func (c *Container) UnscopedSafeGetIpStrategy() (realclientipgo.Strategy, error)
- func (c *Container) UnscopedSafeGetLimiter() (*v1.Limiter, error)
- func (c *Container) UnscopedSafeGetLogger() (*slog.Logger, error)
- func (c *Container) UnscopedSafeGetMessenger() (messaging.Messenger, error)
- func (c *Container) UnscopedSafeGetRedis() (*v.Client, error)
- func (c *Container) UnscopedSafeGetResolver() (*resolvers.Resolver, error)
- func (c *Container) UnscopedSafeGetScheduler() (*tasks.Scheduler, error)
- func (c *Container) UnscopedSafeGetSes() (*ses.SES, error)
Constants ¶
This section is empty.
Variables ¶
var C = func(i interface{}) *Container { if c, ok := i.(*Container); ok { return c } r, ok := i.(*http.Request) if !ok { panic("could not get the container with dic.C()") } c, ok := r.Context().Value(dingo.ContainerKey("dingo")).(*Container) if !ok { panic("could not get the container from the given *http.Request in dic.C()") } return c }
C retrieves a Container from an interface. The function panics if the Container can not be retrieved.
The interface can be :
- a *Container
- an *http.Request containing a *Container in its context.Context for the dingo.ContainerKey("dingo") key.
The function can be changed to match the needs of your application.
Functions ¶
func Biller ¶
Biller retrieves the "biller" object from the app scope.
---------------------------------------------
name: "biller" type: billing.Biller scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*slog.Logger) ["logger"] - "2": Service(*data.Client) ["data"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetBiller method. If the container can not be retrieved, it panics.
func Captcha ¶
Captcha retrieves the "captcha" object from the app scope.
---------------------------------------------
name: "captcha" type: auth.Captcha scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetCaptcha method. If the container can not be retrieved, it panics.
func Config ¶
Config retrieves the "config" object from the main scope.
---------------------------------------------
name: "config" type: *config.Config scope: "main" build: func params: nil unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetConfig method. If the container can not be retrieved, it panics.
func Data ¶
Data retrieves the "data" object from the main scope.
---------------------------------------------
name: "data" type: *data.Client scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: true
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetData method. If the container can not be retrieved, it panics.
func I18n ¶
I18n retrieves the "i18n" object from the app scope.
---------------------------------------------
name: "i18n" type: *in.Bundle scope: "app" build: func params: nil unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetI18n method. If the container can not be retrieved, it panics.
func IpStrategy ¶
func IpStrategy(i interface{}) realclientipgo.Strategy
IpStrategy retrieves the "ipStrategy" object from the main scope.
---------------------------------------------
name: "ipStrategy" type: realclientipgo.Strategy scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetIpStrategy method. If the container can not be retrieved, it panics.
func Limiter ¶
Limiter retrieves the "limiter" object from the app scope.
---------------------------------------------
name: "limiter" type: *v1.Limiter scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*v.Client) ["redis"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetLimiter method. If the container can not be retrieved, it panics.
func Logger ¶
Logger retrieves the "logger" object from the main scope.
---------------------------------------------
name: "logger" type: *slog.Logger scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetLogger method. If the container can not be retrieved, it panics.
func Messenger ¶
Messenger retrieves the "messenger" object from the app scope.
---------------------------------------------
name: "messenger" type: messaging.Messenger scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*ses.SES) ["ses"] - "2": Service(*in.Bundle) ["i18n"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetMessenger method. If the container can not be retrieved, it panics.
func NewBuilder ¶
NewBuilder creates a builder that can be used to create a Container. You probably should use NewContainer to create the container directly. But using NewBuilder allows you to redefine some di services. This can be used for testing. But this behavior is not safe, so be sure to know what you are doing.
func Redis ¶
Redis retrieves the "redis" object from the app scope.
---------------------------------------------
name: "redis" type: *v.Client scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetRedis method. If the container can not be retrieved, it panics.
func Resolver ¶
Resolver retrieves the "resolver" object from the app scope.
---------------------------------------------
name: "resolver" type: *resolvers.Resolver scope: "app" build: func params: - "0": Service(billing.Biller) ["biller"] - "1": Service(auth.Captcha) ["captcha"] - "2": Service(*config.Config) ["config"] - "3": Service(*data.Client) ["data"] - "4": Service(*v1.Limiter) ["limiter"] - "5": Service(messaging.Messenger) ["messenger"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetResolver method. If the container can not be retrieved, it panics.
func Scheduler ¶
Scheduler retrieves the "scheduler" object from the app scope.
---------------------------------------------
name: "scheduler" type: *tasks.Scheduler scope: "app" build: func params: nil unshared: false close: true
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetScheduler method. If the container can not be retrieved, it panics.
func Ses ¶
Ses retrieves the "ses" object from the app scope.
---------------------------------------------
name: "ses" type: *ses.SES scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
It tries to find the container with the C method and the given interface. If the container can be retrieved, it calls the GetSes method. If the container can not be retrieved, it panics.
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container represents a generated dependency injection container. It is a wrapper around a di.Container.
A Container has a scope and may have a parent in a more generic scope and children in a more specific scope. Objects can be retrieved from the Container. If the requested object does not already exist in the Container, it is built thanks to the object definition. The following attempts to get this object will return the same object.
func NewContainer ¶
NewContainer creates a new Container. If no scope is provided, di.App, di.Request and di.SubRequest are used. The returned Container has the most generic scope (di.App). The SubContainer() method should be called to get a Container in a more specific scope.
func (*Container) Clean ¶
Clean deletes the sub-container created by UnscopedSafeGet, UnscopedGet or UnscopedFill.
func (*Container) Delete ¶
Delete works like DeleteWithSubContainers if the Container does not have any child. But if the Container has sub-containers, it will not be deleted right away. The deletion only occurs when all the sub-containers have been deleted manually. So you have to call Delete or DeleteWithSubContainers on all the sub-containers.
func (*Container) DeleteWithSubContainers ¶
DeleteWithSubContainers takes all the objects saved in this Container and calls the Close function of their Definition on them. It will also call DeleteWithSubContainers on each child and remove its reference in the parent Container. After deletion, the Container can no longer be used. The sub-containers are deleted even if they are still used in other goroutines. It can cause errors. You may want to use the Delete method instead.
func (*Container) Fill ¶
Fill is similar to SafeGet but it does not return the object. Instead it fills the provided object with the value returned by SafeGet. The provided object must be a pointer to the value returned by SafeGet.
func (*Container) Get ¶
Get is similar to SafeGet but it does not return the error. Instead it panics.
func (*Container) GetBiller ¶
GetBiller retrieves the "biller" object from the app scope.
---------------------------------------------
name: "biller" type: billing.Biller scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*slog.Logger) ["logger"] - "2": Service(*data.Client) ["data"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetCaptcha ¶
GetCaptcha retrieves the "captcha" object from the app scope.
---------------------------------------------
name: "captcha" type: auth.Captcha scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetConfig ¶
GetConfig retrieves the "config" object from the main scope.
---------------------------------------------
name: "config" type: *config.Config scope: "main" build: func params: nil unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetData ¶
GetData retrieves the "data" object from the main scope.
---------------------------------------------
name: "data" type: *data.Client scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: true
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetI18n ¶
GetI18n retrieves the "i18n" object from the app scope.
---------------------------------------------
name: "i18n" type: *in.Bundle scope: "app" build: func params: nil unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetIpStrategy ¶
func (c *Container) GetIpStrategy() realclientipgo.Strategy
GetIpStrategy retrieves the "ipStrategy" object from the main scope.
---------------------------------------------
name: "ipStrategy" type: realclientipgo.Strategy scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetLimiter ¶
GetLimiter retrieves the "limiter" object from the app scope.
---------------------------------------------
name: "limiter" type: *v1.Limiter scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*v.Client) ["redis"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetLogger ¶
GetLogger retrieves the "logger" object from the main scope.
---------------------------------------------
name: "logger" type: *slog.Logger scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetMessenger ¶
GetMessenger retrieves the "messenger" object from the app scope.
---------------------------------------------
name: "messenger" type: messaging.Messenger scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*ses.SES) ["ses"] - "2": Service(*in.Bundle) ["i18n"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetRedis ¶
GetRedis retrieves the "redis" object from the app scope.
---------------------------------------------
name: "redis" type: *v.Client scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetResolver ¶
GetResolver retrieves the "resolver" object from the app scope.
---------------------------------------------
name: "resolver" type: *resolvers.Resolver scope: "app" build: func params: - "0": Service(billing.Biller) ["biller"] - "1": Service(auth.Captcha) ["captcha"] - "2": Service(*config.Config) ["config"] - "3": Service(*data.Client) ["data"] - "4": Service(*v1.Limiter) ["limiter"] - "5": Service(messaging.Messenger) ["messenger"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetScheduler ¶
GetScheduler retrieves the "scheduler" object from the app scope.
---------------------------------------------
name: "scheduler" type: *tasks.Scheduler scope: "app" build: func params: nil unshared: false close: true
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) GetSes ¶
GetSes retrieves the "ses" object from the app scope.
---------------------------------------------
name: "ses" type: *ses.SES scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it panics.
func (*Container) ParentScopes ¶
ParentScopes returns the list of scopes wider than the Container scope.
func (*Container) SafeGet ¶
SafeGet retrieves an object from the Container. The object has to belong to this scope or a more generic one. If the object does not already exist, it is created and saved in the Container. If the object can not be created, it returns an error.
func (*Container) SafeGetBiller ¶
SafeGetBiller retrieves the "biller" object from the app scope.
---------------------------------------------
name: "biller" type: billing.Biller scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*slog.Logger) ["logger"] - "2": Service(*data.Client) ["data"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetCaptcha ¶
SafeGetCaptcha retrieves the "captcha" object from the app scope.
---------------------------------------------
name: "captcha" type: auth.Captcha scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetConfig ¶
SafeGetConfig retrieves the "config" object from the main scope.
---------------------------------------------
name: "config" type: *config.Config scope: "main" build: func params: nil unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetData ¶
SafeGetData retrieves the "data" object from the main scope.
---------------------------------------------
name: "data" type: *data.Client scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: true
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetI18n ¶
SafeGetI18n retrieves the "i18n" object from the app scope.
---------------------------------------------
name: "i18n" type: *in.Bundle scope: "app" build: func params: nil unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetIpStrategy ¶
func (c *Container) SafeGetIpStrategy() (realclientipgo.Strategy, error)
SafeGetIpStrategy retrieves the "ipStrategy" object from the main scope.
---------------------------------------------
name: "ipStrategy" type: realclientipgo.Strategy scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetLimiter ¶
SafeGetLimiter retrieves the "limiter" object from the app scope.
---------------------------------------------
name: "limiter" type: *v1.Limiter scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*v.Client) ["redis"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetLogger ¶
SafeGetLogger retrieves the "logger" object from the main scope.
---------------------------------------------
name: "logger" type: *slog.Logger scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetMessenger ¶
SafeGetMessenger retrieves the "messenger" object from the app scope.
---------------------------------------------
name: "messenger" type: messaging.Messenger scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*ses.SES) ["ses"] - "2": Service(*in.Bundle) ["i18n"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetRedis ¶
SafeGetRedis retrieves the "redis" object from the app scope.
---------------------------------------------
name: "redis" type: *v.Client scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetResolver ¶
SafeGetResolver retrieves the "resolver" object from the app scope.
---------------------------------------------
name: "resolver" type: *resolvers.Resolver scope: "app" build: func params: - "0": Service(billing.Biller) ["biller"] - "1": Service(auth.Captcha) ["captcha"] - "2": Service(*config.Config) ["config"] - "3": Service(*data.Client) ["data"] - "4": Service(*v1.Limiter) ["limiter"] - "5": Service(messaging.Messenger) ["messenger"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetScheduler ¶
SafeGetScheduler retrieves the "scheduler" object from the app scope.
---------------------------------------------
name: "scheduler" type: *tasks.Scheduler scope: "app" build: func params: nil unshared: false close: true
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SafeGetSes ¶
SafeGetSes retrieves the "ses" object from the app scope.
---------------------------------------------
name: "ses" type: *ses.SES scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
If the object can not be retrieved, it returns an error.
func (*Container) SubContainer ¶
SubContainer creates a new Container in the next sub-scope that will have this Container as parent.
func (*Container) SubScopes ¶
SubScopes returns the list of scopes that are more specific than the Container scope.
func (*Container) UnscopedFill ¶
UnscopedFill is similar to UnscopedSafeGet but copies the object in dst instead of returning it.
func (*Container) UnscopedGet ¶
UnscopedGet is similar to UnscopedSafeGet but it does not return the error. Instead it panics.
func (*Container) UnscopedGetBiller ¶
UnscopedGetBiller retrieves the "biller" object from the app scope.
---------------------------------------------
name: "biller" type: billing.Biller scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*slog.Logger) ["logger"] - "2": Service(*data.Client) ["data"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetCaptcha ¶
UnscopedGetCaptcha retrieves the "captcha" object from the app scope.
---------------------------------------------
name: "captcha" type: auth.Captcha scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetConfig ¶
UnscopedGetConfig retrieves the "config" object from the main scope.
---------------------------------------------
name: "config" type: *config.Config scope: "main" build: func params: nil unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetData ¶
UnscopedGetData retrieves the "data" object from the main scope.
---------------------------------------------
name: "data" type: *data.Client scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: true
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetI18n ¶
UnscopedGetI18n retrieves the "i18n" object from the app scope.
---------------------------------------------
name: "i18n" type: *in.Bundle scope: "app" build: func params: nil unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetIpStrategy ¶
func (c *Container) UnscopedGetIpStrategy() realclientipgo.Strategy
UnscopedGetIpStrategy retrieves the "ipStrategy" object from the main scope.
---------------------------------------------
name: "ipStrategy" type: realclientipgo.Strategy scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetLimiter ¶
UnscopedGetLimiter retrieves the "limiter" object from the app scope.
---------------------------------------------
name: "limiter" type: *v1.Limiter scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*v.Client) ["redis"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetLogger ¶
UnscopedGetLogger retrieves the "logger" object from the main scope.
---------------------------------------------
name: "logger" type: *slog.Logger scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetMessenger ¶
UnscopedGetMessenger retrieves the "messenger" object from the app scope.
---------------------------------------------
name: "messenger" type: messaging.Messenger scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*ses.SES) ["ses"] - "2": Service(*in.Bundle) ["i18n"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetRedis ¶
UnscopedGetRedis retrieves the "redis" object from the app scope.
---------------------------------------------
name: "redis" type: *v.Client scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetResolver ¶
UnscopedGetResolver retrieves the "resolver" object from the app scope.
---------------------------------------------
name: "resolver" type: *resolvers.Resolver scope: "app" build: func params: - "0": Service(billing.Biller) ["biller"] - "1": Service(auth.Captcha) ["captcha"] - "2": Service(*config.Config) ["config"] - "3": Service(*data.Client) ["data"] - "4": Service(*v1.Limiter) ["limiter"] - "5": Service(messaging.Messenger) ["messenger"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetScheduler ¶
UnscopedGetScheduler retrieves the "scheduler" object from the app scope.
---------------------------------------------
name: "scheduler" type: *tasks.Scheduler scope: "app" build: func params: nil unshared: false close: true
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedGetSes ¶
UnscopedGetSes retrieves the "ses" object from the app scope.
---------------------------------------------
name: "ses" type: *ses.SES scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it panics.
func (*Container) UnscopedSafeGet ¶
UnscopedSafeGet retrieves an object from the Container, like SafeGet. The difference is that the object can be retrieved even if it belongs to a more specific scope. To do so, UnscopedSafeGet creates a sub-container. When the created object is no longer needed, it is important to use the Clean method to delete this sub-container.
func (*Container) UnscopedSafeGetBiller ¶
UnscopedSafeGetBiller retrieves the "biller" object from the app scope.
---------------------------------------------
name: "biller" type: billing.Biller scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*slog.Logger) ["logger"] - "2": Service(*data.Client) ["data"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetCaptcha ¶
UnscopedSafeGetCaptcha retrieves the "captcha" object from the app scope.
---------------------------------------------
name: "captcha" type: auth.Captcha scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetConfig ¶
UnscopedSafeGetConfig retrieves the "config" object from the main scope.
---------------------------------------------
name: "config" type: *config.Config scope: "main" build: func params: nil unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetData ¶
UnscopedSafeGetData retrieves the "data" object from the main scope.
---------------------------------------------
name: "data" type: *data.Client scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: true
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetI18n ¶
UnscopedSafeGetI18n retrieves the "i18n" object from the app scope.
---------------------------------------------
name: "i18n" type: *in.Bundle scope: "app" build: func params: nil unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetIpStrategy ¶
func (c *Container) UnscopedSafeGetIpStrategy() (realclientipgo.Strategy, error)
UnscopedSafeGetIpStrategy retrieves the "ipStrategy" object from the main scope.
---------------------------------------------
name: "ipStrategy" type: realclientipgo.Strategy scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetLimiter ¶
UnscopedSafeGetLimiter retrieves the "limiter" object from the app scope.
---------------------------------------------
name: "limiter" type: *v1.Limiter scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*v.Client) ["redis"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetLogger ¶
UnscopedSafeGetLogger retrieves the "logger" object from the main scope.
---------------------------------------------
name: "logger" type: *slog.Logger scope: "main" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if main is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetMessenger ¶
UnscopedSafeGetMessenger retrieves the "messenger" object from the app scope.
---------------------------------------------
name: "messenger" type: messaging.Messenger scope: "app" build: func params: - "0": Service(*config.Config) ["config"] - "1": Service(*ses.SES) ["ses"] - "2": Service(*in.Bundle) ["i18n"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetRedis ¶
UnscopedSafeGetRedis retrieves the "redis" object from the app scope.
---------------------------------------------
name: "redis" type: *v.Client scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetResolver ¶
UnscopedSafeGetResolver retrieves the "resolver" object from the app scope.
---------------------------------------------
name: "resolver" type: *resolvers.Resolver scope: "app" build: func params: - "0": Service(billing.Biller) ["biller"] - "1": Service(auth.Captcha) ["captcha"] - "2": Service(*config.Config) ["config"] - "3": Service(*data.Client) ["data"] - "4": Service(*v1.Limiter) ["limiter"] - "5": Service(messaging.Messenger) ["messenger"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetScheduler ¶
UnscopedSafeGetScheduler retrieves the "scheduler" object from the app scope.
---------------------------------------------
name: "scheduler" type: *tasks.Scheduler scope: "app" build: func params: nil unshared: false close: true
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.
func (*Container) UnscopedSafeGetSes ¶
UnscopedSafeGetSes retrieves the "ses" object from the app scope.
---------------------------------------------
name: "ses" type: *ses.SES scope: "app" build: func params: - "0": Service(*config.Config) ["config"] unshared: false close: false
---------------------------------------------
This method can be called even if app is a sub-scope of the container. If the object can not be retrieved, it returns an error.