service

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevMode  = "dev"
	TestMode = "test"
	PreMode  = "pre"
	ProMode  = "pro"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	Starter
	Stopper
}

func WithStart

func WithStart(start func()) Service

func WithStarter

func WithStarter(start Starter) Service

type ServiceConf

type ServiceConf struct {
	Name       string
	Log        logx.LogConf
	Mode       string            `json:",default=pro,options=dev|test|pre|pro"`
	MetricsUrl string            `json:",optional"`
	Prometheus prometheus.Config `json:",optional"`
}

func (ServiceConf) MustSetUp

func (sc ServiceConf) MustSetUp()

func (ServiceConf) SetUp

func (sc ServiceConf) SetUp() error

type ServiceGroup

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

func NewServiceGroup

func NewServiceGroup() *ServiceGroup

func (*ServiceGroup) Add

func (sg *ServiceGroup) Add(service Service)

func (*ServiceGroup) Start

func (sg *ServiceGroup) Start()

There should not be any logic code after calling this method, because this method is a blocking one. Also, quitting this method will close the logx output.

func (*ServiceGroup) Stop

func (sg *ServiceGroup) Stop()

type Starter

type Starter interface {
	Start()
}

type Stopper

type Stopper interface {
	Stop()
}

Jump to

Keyboard shortcuts

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