Documentation
¶
Index ¶
- func DisableMock()
- func EnableMock() (*sql.DB, sqlmock.Sqlmock)
- func InitTracing(cfg *config.TracingConfig) io.Closer
- func MockFailOpenDB()
- func OpenDB(config *config.DatabaseConfig) (*sql.DB, error)
- func OpenGRPC(cfg *config.ClientConfig) *grpc.ClientConn
- func SetGlobalDI(di DependencyInjecter)
- type Container
- type DependencyInjecter
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTracing ¶
func InitTracing(cfg *config.TracingConfig) io.Closer
InitTracing initializes global tracer
func OpenDB ¶
func OpenDB(config *config.DatabaseConfig) (*sql.DB, error)
OpenDB opens a DB connection
func OpenGRPC ¶ added in v0.2.0
func OpenGRPC(cfg *config.ClientConfig) *grpc.ClientConn
OpenGRPC opens gRPC connection
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is the structure representing the dependency injecter
func (*Container) Bind ¶
func (di *Container) Bind(k interface{}, v interface{}) DependencyInjecter
Bind binds a value to a key
func (*Container) Get ¶
func (di *Container) Get(key interface{}) interface{}
Get gets the value bound to the key or nil if no value is present.
func (*Container) Unbind ¶
func (di *Container) Unbind(k interface{}) DependencyInjecter
Unbind unbinds a value from a key
type DependencyInjecter ¶ added in v0.1.1
type DependencyInjecter interface { Bind(k interface{}, v interface{}) DependencyInjecter Unbind(k interface{}) DependencyInjecter Get(key interface{}) interface{} }
DependencyInjecter is the interface of dependency injecter
func MustGetGlobalDI ¶
func MustGetGlobalDI() DependencyInjecter
MustGetGlobalDI returns the global DI, panic when it is nil
type RedisClient ¶
type RedisClient interface { redis.UniversalClient }
RedisClient is the redis client wrapper
func OpenRedis ¶
func OpenRedis(config *config.RedisConfig) RedisClient
OpenRedis connects to redis server and get a redis client.
Please note that IdleTimeout option should be smaller than timeout, refer: https://github.com/go-redis/redis/issues/84
Source Files
¶
Click to show internal directories.
Click to hide internal directories.