parrot

package
v0.0.0-...-e43fadc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Example of a daemon with echo service

Index

Constants

View Source
const (
	ModeInstall  = "install"
	ModeRun      = "run"
	ModeConf     = "conf"
	ModeRegistry = "registry"
	ModeService  = "service"
)

Variables

View Source
var (
	VERSION   = "2.0.0"
	BuildTime = ""
)

VERSION 版本号

Functions

func Newparrot

func Newparrot(appName string, platName string, systemName string, serverTypes []string, clusterName string, trace string, registryAddr string, isDebug bool, remoteLogger bool, logger *logger.Logger, r component.IComponentHandler, PbFunc func(component.IContainer, *grpc.Server)) *parrot

Newparrot 创建parrot服务器

Types

type Cli

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

func NewCli

func NewCli() *Cli

func (*Cli) Append

func (c *Cli) Append(mode string, flag cli.Flag)

func (*Cli) Context

func (c *Cli) Context() *cli.Context

func (*Cli) Validate

func (c *Cli) Validate(mode string, f func(*cli.Context) error)

type ICli

type ICli interface {

	//Append 添加命令行参数
	Append(mode string, flag cli.Flag)

	//Validate 添加验证函数
	Validate(mode string, f func(*cli.Context) error)

	//Context 获取命令行上下文
	Context() *cli.Context
	// contains filtered or unexported methods
}

ICli 命令行参数

type MicroApp

type MicroApp struct {

	//Conf 绑定安装程序
	Conf *creator.Binder

	//	registry           registry.IRegistry
	component.IComponentRegistry

	Cli ICli
	// contains filtered or unexported fields
}

MicroApp 微服务应用

func NewApp

func NewApp(opts ...Option) (m *MicroApp)

NewApp 创建微服务应用

func (*MicroApp) Shutdown

func (m *MicroApp) Shutdown()

func (*MicroApp) Start

func (m *MicroApp) Start()

Start 启动服务器

func (*MicroApp) Use

func (m *MicroApp) Use(r func(r component.IServiceRegistry))

Use 注册所有服务

type Option

type Option func(*option)

Option 配置选项

func WithClusterName

func WithClusterName(clusterName string) Option

WithClusterName 设置集群名称

func WithDebug

func WithDebug() Option

WithDebug 设置dubug模式

func WithName

func WithName(name string) Option

WithName 设置系统全名 格式:/[platName]/[sysName]/[typeName]/[clusterName]

func WithPbRegister

func WithPbRegister(f func(component.IContainer, *grpc.Server)) Option

func WithPlatName

func WithPlatName(platName string) Option

WithPlatName 设置平台名称

func WithProduct

func WithProduct() Option

WithProduct 设置产品模式

func WithRegistry

func WithRegistry(addr string) Option

WithRegistry 设置注册中心地址

func WithRemoteLogger

func WithRemoteLogger() Option

WithRemoteLogger 设置产品模式

func WithRemoteQueryService

func WithRemoteQueryService(remoteQueryService bool) Option

WithRemoteQueryService 启动远程查询服务

func WithServerTypes

func WithServerTypes(serverType ...string) Option

WithServerTypes 设置系统类型

func WithSystemName

func WithSystemName(systemName string) Option

WithSystemName 设置系统名称

Directories

Path Synopsis
Package daemon 0.11.0 for use with Go (golang) services.
Package daemon 0.11.0 for use with Go (golang) services.

Jump to

Keyboard shortcuts

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