app

package
v0.0.0-...-7c1bd43 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationContext

func ApplicationContext() context.Context

ApplicationContext returns global application context for graceful shutdown

func Fatal

func Fatal(vararg ...interface{})

Fatal writes error to stderr and stops program with error exit code.

used when no config or logger available and service is unable to initialize.

func ProvideConfig

func ProvideConfig(cfgPath string) (*config.Config, error)

ProvideConfig reads and provides config.

If config path is empty, config is loaded from environment variables and defaults.

func ProvideLogger

func ProvideLogger(cfg *config.Config) (*zap.Logger, error)

ProvideLogger returns logger according to environment

Types

type Connectors

type Connectors struct {
	// DB is database connection
	DB *sqlx.DB

	// Redis is redis connection
	Redis *redis.Client
}

Connectors contains set of I/O connectors for ledger service.

func InstantiateConnectors

func InstantiateConnectors(ctx context.Context, cfg *config.Config) (*Connectors, error)

InstantiateConnectors establishes connections to database, cache, etc. and returns set of connectors for further application initialization.

func (Connectors) Close

func (c Connectors) Close()

Close closes all connections

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(baseCtx context.Context, logger *zap.Logger, conn *Connectors, cfg *config.Config) *Service

func (Service) Start

func (s Service) Start(ctx context.Context)

Start starts the service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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