microservice

package module
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 18 Imported by: 0

README

micro-service

Documentation

Index

Constants

View Source
const CfgContext = "cfg"

Variables

View Source
var ConsulClient *api.Client

ConsulClient - client for consul (if it is using)

Functions

func BlockExit

func BlockExit(callback BlockExitEndCallback)

BlockExit - block exit (daemon mode)

func InitContextService added in v2.1.0

func InitContextService[T any](appName string, settingsInst T, initFunction InitContextFunction, service ConsulService[T], version string)

func InitService

func InitService(appName string, settingsInst interface{}, initFunction InitFunction[interface{}], service ConsulService[interface{}], version string)

func ServiceSettings

func ServiceSettings[T any](creator settings.WatcherSettingsCreator[T], service ConsulService[T]) (result *settings.Configuration[T], err error)

ServiceSettings - setup micro-service configuration

Types

type BlockExitEndCallback

type BlockExitEndCallback func()

BlockExitEndCallback - callback function

type ConsulRemoveRegistration added in v2.1.1

type ConsulRemoveRegistration func()

type ConsulService

type ConsulService[T any] interface {
	Init(config settings.Configuration[T])
	GetServiceInfo() ServiceInfo
	GetServiceHealthCheck() []ServiceHealthCheck
}

ConsulService - consul service

type Env

type Env struct {
	Env string
	App string
}

type InitContextFunction added in v2.1.0

type InitContextFunction func(ctx context.Context) error

type InitFunction

type InitFunction[T any] func(config *appSettings.Configuration[T]) error

type ServiceHealthCheck

type ServiceHealthCheck struct {
	Name  string
	Notes string
	TTL   time.Duration
	Check func() error
}

ServiceHealthCheck - service health checker

type ServiceInfo

type ServiceInfo struct {
	Ports *[]int
}

ServiceInfo - service information

Jump to

Keyboard shortcuts

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