ofx

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

View Source
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

View Source
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.

View Source
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

View Source
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"`
}

func (*DocumentStoreResult) NewDocument

func (dsr *DocumentStoreResult) NewDocument(
	lc fx.Lifecycle,
	l *zap.Logger,
	mClient *mongo2.Client,
	connect string,
) (err error)

type GormDriverParams

type GormDriverParams struct {
	fx.In

	Dialector gorm.Dialector `name:"Dialector"`
}

type GormDriverResult

type GormDriverResult struct {
	fx.Out

	Dialector gorm.Dialector `name:"Dialector"`
}

type GormParams

type GormParams struct {
	fx.In

	GormDB *gorm.DB `name:"GormDB"`
}

type GormResult

type GormResult struct {
	fx.Out

	GormDB *gorm.DB `name:"GormDB"`
}

func (*GormResult) NewDocument

func (mr *GormResult) NewDocument(
	lc fx.Lifecycle,
	logger *zap.Logger,
	dialector gorm.Dialector,
) (err error)

type MongoParams

type MongoParams struct {
	fx.In

	MongoClient *mongo2.Client `name:"MongoClient"`
}

type MongoResult

type MongoResult struct {
	fx.Out

	MongoClient *mongo2.Client `name:"MongoClient"`
}

func (*MongoResult) NewDocument

func (mr *MongoResult) NewDocument(
	lc fx.Lifecycle,
	l *zap.Logger,
	n SettingsParams,
) (err error)

type RedisCacheParams

type RedisCacheParams struct {
	fx.In
	RedisCache diface.ICache `name:"RedisCache"`
}

RedisCacheParams provides the RedisCacheParams to the mfx dependency graph.

type RedisCacheResult

type RedisCacheResult struct {
	fx.Out
	RedisCache diface.ICache `name:"RedisCache"`
}

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL