api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Unlicense Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(

	fx.Provide(
		environment.NewEnvironment,
		func(lc fx.Lifecycle, e environment.Environment, t tracer.Tracer) (database.Database, error) {
			return database.Setup(lc, t, e.DatabaseURL, e.DatabaseURL)
		},
		func(env environment.Environment) (redis.Client, error) {
			return redis.NewClient(env.RedisURL, env.RedisCACert)
		},
		func(env environment.Environment, db database.Database, redisClient redis.Client) healthcheck.HealthCheck {
			return healthcheck.NewChain(
				healthcheck.NewDatabaseConnectivity(db.Master()),
				healthcheck.NewDatabaseMigration(db.Master(), "schema_migrations"),
				healthcheck.NewDatabaseConnectivity(db.Replica()),
				healthcheck.NewDatabaseMigration(db.Replica(), "schema_migrations"),
				redis.NewHealthCheck(redisClient),
			)
		},
		func(lc fx.Lifecycle, e environment.Environment) (tracer.Tracer, error) {
			return tracer.Setup(lc, e.OtelCollectorHost, e.Service, e.Environment, e.Version)
		},
		distlock.NewDistock,
	),

	fx.Provide(
		holders.NewRepository,
		holders.NewService,
		accounts.NewRepository,
		accounts.NewService,
		transactions.NewRepository,
		transactions.NewService,
		statements.NewRepository,
		statements.NewService,
		balances.NewRepository,
		balances.NewService,
	),

	fx.Provide(
		handlers.NewLivenessFunc,
		handlers.NewReadinessFunc,
		holdersh.NewCreateHolderFunc,
		holdersh.NewGetByIDHolderFunc,
		holdersh.NewListHoldersFunc,
		accountsh.NewCreateAccountFunc,
		accountsh.NewBlockByIDFunc,
		accountsh.NewUnblockByIDFunc,
		accountsh.NewCloseByIDFunc,
		accountsh.NewGetByIDFunc,
		accountsh.NewListAccountsFunc,
		statementsh.NewListAccountStatementFunc,
		balancesh.NewGetBalanceByAccountIDFunc,
		transactionsh.NewCreateCreditTransactionFunc,
		transactionsh.NewCreateDebitTransactionFunc,
		transactionsh.NewCreateP2PTransactionFunc,
		transactionsh.NewGetByIDTransactionFunc,
	),

	fx.Invoke(func(
		env environment.Environment,
	) (*zap.Logger, error) {
		return setupLogger(
			env.Service,
			env.Version,
			env.Environment,
		)
	}),
	fx.Invoke(runHTTPServer),
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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