Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DocumentStoreModule = fx.Provide( func( lc fx.Lifecycle, l *zap.Logger, mp MongoParams, sp SettingsParams, ) (dOut DocumentStoreResult, err error) { err = dOut.NewDocument( lc, l, mp.MongoClient, sp.DatabaseURL, ) return }, )
DocumentStoreModule provides to the mfx dependency graph.
var GormModule = fx.Provide( func( lc fx.Lifecycle, l *zap.Logger, dParams GormDriverParams, ) (dOut GormResult, err error) { err = dOut.NewDocument(lc, l, dParams.Dialector) return }, )
GormModule is the module for gorm driver https://github.com/go-gorm/gorm
var MongoPureModule = fx.Provide( func( lc fx.Lifecycle, l *zap.Logger, n SettingsParams, ) (dOut MongoResult, err error) { err = dOut.NewDocument(lc, l, n) return }, )
MongoPureModule is the module for mongo driver https://github.com/mongodb/mongo-go-driver
var RedisCacheModule = fx.Provide( func( lc fx.Lifecycle, l *zap.Logger, rParams RedisParams, ) (out RedisCacheResult, err error) { err = out.Execute(l, rParams) return }, )
RedisCacheModule provides the RedisCacheModule to the mfx dependency graph.
var RedisModule = fx.Provide( func( lc fx.Lifecycle, l *zap.Logger, n SettingsParams, ) (out RedisResult, err error) { err = out.Execute(lc, l, n) return }, )
RedisModule is the module for redis driver github.com/redis/go-redis/v9
var SettingsModule = fx.Provide( func() (out SettingsResult, err error) { err = out.LoadFromEnv() return }, )
Functions ¶
This section is empty.
Types ¶
type DocumentStoreParams ¶
type DocumentStoreParams struct { fx.In DriverProvider diface.IDocumentProvider `name:"DriverProvider"` }
type DocumentStoreResult ¶
type DocumentStoreResult struct { fx.Out DriverProvider diface.IDocumentProvider `name:"DriverProvider"` }
type GormDriverParams ¶
type GormDriverResult ¶
type GormResult ¶
func (*GormResult) NewDocument ¶
type MongoParams ¶
type MongoResult ¶
func (*MongoResult) NewDocument ¶
func (mr *MongoResult) NewDocument( lc fx.Lifecycle, l *zap.Logger, n SettingsParams, ) (err error)
type RedisCacheParams ¶
RedisCacheParams provides the RedisCacheParams to the mfx dependency graph.
type RedisCacheResult ¶
RedisCacheResult provides the RedisCacheResult to the mfx dependency graph.
func (*RedisCacheResult) Execute ¶
func (c *RedisCacheResult) Execute( l *zap.Logger, rParams RedisParams, ) (err error)
Execute initializes the RedisCacheResult.
type RedisParams ¶
type RedisParams struct { fx.In Redis *goredis.Client `name:"Redis"` Cache *goredis.Client `name:"Cache"` }
RedisParams provides the RedisParams to the mfx dependency graph.
type RedisResult ¶
type RedisResult struct { fx.Out Redis *goredis.Client `name:"Redis"` Cache *goredis.Client `name:"Cache"` }
RedisResult provides the RedisResult to the mfx dependency graph.
func (*RedisResult) Execute ¶
func (rr *RedisResult) Execute( lc fx.Lifecycle, l *zap.Logger, n SettingsParams, ) error
type SettingsParams ¶
type SettingsParams struct { fx.In DatabaseURL string `name:"DatabaseURL"` DatabaseUser string `name:"DatabaseUser"` // will replace database url username DatabasePassword string `name:"DatabasePassword"` // will replace database url password CacheURL string `name:"CacheURL"` CacheUser string `name:"CacheUser"` // will replace cache url username CachePassword string `name:"CachePassword"` // will replace cache url password }
type SettingsResult ¶
type SettingsResult struct { fx.Out DocumentURL string `name:"DatabaseURL" envconfig:"DATABASE_URL" default:"mongodb://localhost:27017"` DatabaseUser string `name:"DatabaseUser" envconfig:"DATABASE_USER" default:""` DatabasePassword string `name:"DatabasePassword" envconfig:"DATABASE_PASSWORD" default:""` CacheURL string `name:"CacheURL" envconfig:"CACHE_URL" default:"redis://localhost:6379"` CacheUser string `name:"CacheUser" envconfig:"CACHE_USER" default:""` CachePassword string `name:"CachePassword" envconfig:"CACHE_PASSWORD" default:""` }
func (*SettingsResult) LoadFromEnv ¶
func (sr *SettingsResult) LoadFromEnv() (err error)