creator

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Translate

func Translate(format string, data map[string]string) string

Translate 翻译带有@变量的字符串

Types

type ApiBinder

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

func NewApiBinder

func NewApiBinder(params map[string]string, inputs map[string]*Input) *ApiBinder

func (ApiBinder) SetAuthes

func (b ApiBinder) SetAuthes(a *conf.Authes)

func (ApiBinder) SetCircuitBreaker

func (b ApiBinder) SetCircuitBreaker(c *conf.CircuitBreaker)

func (*ApiBinder) SetCrossDomain

func (b *ApiBinder) SetCrossDomain()

func (ApiBinder) SetHeaders

func (b ApiBinder) SetHeaders(h conf.Headers)

func (*ApiBinder) SetMain

func (b *ApiBinder) SetMain(c *conf.APIServerConf)

func (*ApiBinder) SetResponse

func (b *ApiBinder) SetResponse(h *conf.Response)

func (ApiBinder) SetRouters

func (b ApiBinder) SetRouters(r *conf.Routers)

func (*ApiBinder) SetStatic

func (b *ApiBinder) SetStatic(c *conf.Static)

type Binder

type Binder struct {
	API  IApiBinder
	RPC  IRPCBinder
	WS   IWSBinder
	WEB  IWebBinder
	MQC  IMQCBinder
	CRON ICronBinder
	Plat IPlatBinder
	Log  logger.ILogging
	// contains filtered or unexported fields
}

func NewBinder

func NewBinder(log logger.ILogging) *Binder

func (*Binder) Confirm

func (s *Binder) Confirm(msg string) bool

Confirm 用户确认

func (*Binder) GetInput

func (s *Binder) GetInput() map[string]*Input

func (*Binder) GetInstallers

func (s *Binder) GetInstallers(serverType string) []func(c component.IContainer) error

func (*Binder) GetMainConf

func (s *Binder) GetMainConf(serverType string) string

GetMainConf 获取主配置信息

func (*Binder) GetMainConfNames

func (s *Binder) GetMainConfNames(platName string, systemName string, tp string, clusterName string) []string

GetMainConfNames 获取已配置的主配置名称

func (*Binder) GetMainConfScanNum

func (s *Binder) GetMainConfScanNum(serverType string) int

GetMainConfScanNum 获取主配置待扫描参数个数

func (*Binder) GetOrSet

func (s *Binder) GetOrSet(tp string) IExtBinder

func (*Binder) GetSQL

func (s *Binder) GetSQL(dir string) ([]string, error)

GetSQL 获取指定目录下所有.sql文件中的SQL语句,并用分号拆分

func (*Binder) GetSubConf

func (s *Binder) GetSubConf(serverType string, subName string) string

GetSubConf 获取子配置信息

func (*Binder) GetSubConfNames

func (s *Binder) GetSubConfNames(serverType string) []string

GetSubConfNames 获取已配置的主配置名称

func (*Binder) GetSubConfScanNum

func (s *Binder) GetSubConfScanNum(serverType string, subName string) int

GetSubConfScanNum 获取子配置待扫描参数个数

func (*Binder) GetVarConf

func (s *Binder) GetVarConf(nodeName string) string

GetVarConf 获取平台配置信息

func (*Binder) GetVarConfNames

func (s *Binder) GetVarConfNames() []string

GetVarConfNames 获取已配置的主配置名称

func (*Binder) GetVarConfScanNum

func (s *Binder) GetVarConfScanNum(nodeName string) int

GetVarConfScanNum 获取var配置待扫描参数个数

func (*Binder) Print

func (s *Binder) Print()

Print 输出配置信息

func (*Binder) ScanMainConf

func (s *Binder) ScanMainConf(mainPath string, serverType string) error

ScanMainConf 扫描主配置

func (*Binder) ScanSubConf

func (s *Binder) ScanSubConf(mainPath string, serverType string, subName string) error

ScanSubConf 扫描子配置

func (*Binder) ScanVarConf

func (s *Binder) ScanVarConf(platName string, nodeName string) error

ScanVarConf 扫描平台配置

func (*Binder) SetInput

func (s *Binder) SetInput(fieldName, showName, desc string, filters ...func(v string) (string, error))

func (*Binder) SetParam

func (s *Binder) SetParam(k, v string)

type Creator

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

Creator 配置文件创建器

func NewCreator

func NewCreator(platName string, systemName string, serverTypes []string, clusterName string, binder IBinder, registryAddr string, rgst registry.IRegistry, logger logger.ILogging) (w *Creator)

NewCreator 配置文件创建器

func (*Creator) Start

func (c *Creator) Start() (err error)

Start 扫描并绑定所有参数

type CronBinder

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

func (CronBinder) Installer

func (c CronBinder) Installer(f func(c component.IContainer) error)

func (CronBinder) SetApp

func (c CronBinder) SetApp(m interface{})

SetMetric 设置服务器监控配置项

func (*CronBinder) SetMain

func (b *CronBinder) SetMain(c *conf.CronServerConf)

func (CronBinder) SetMainConf

func (c CronBinder) SetMainConf(input interface{})

SetMainConf 设置主配置内容

func (CronBinder) SetMetric

func (c CronBinder) SetMetric(m *conf.Metric)

SetMetric 设置服务器监控配置项

func (CronBinder) SetSubConf

func (c CronBinder) SetSubConf(n string, input interface{})

SetSubConf 设置子配置内容

func (*CronBinder) SetTasks

func (b *CronBinder) SetTasks(c *conf.Tasks)

type ExtBinder

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

func NewExtBinder

func NewExtBinder(params map[string]string, inputs map[string]*Input) *ExtBinder

func (ExtBinder) SetAuthes

func (b ExtBinder) SetAuthes(a *conf.Authes)

func (ExtBinder) SetCircuitBreaker

func (b ExtBinder) SetCircuitBreaker(c *conf.CircuitBreaker)

func (ExtBinder) SetHeaders

func (b ExtBinder) SetHeaders(h conf.Headers)

func (ExtBinder) SetRouters

func (b ExtBinder) SetRouters(r *conf.Routers)

type IApiBinder

type IApiBinder interface {
	SetStatic(*conf.Static)
	SetMain(*conf.APIServerConf)
	SetResponse(*conf.Response)
	SetCrossDomain()
	// contains filtered or unexported methods
}

type IBinder

type IBinder interface {
	GetMainConfNames(platName string, systemName string, tp string, clusterName string) []string
	GetSubConfNames(serverType string) []string
	GetVarConfNames() []string
	ScanMainConf(mainPath string, serverType string) error
	ScanSubConf(mainPath string, serverType string, subName string) error
	ScanVarConf(platName string, nodeName string) error
	GetMainConf(serverType string) string
	GetSubConf(serverType string, subName string) string
	GetVarConf(nodeName string) string
	GetMainConfScanNum(serverType string) int
	GetSubConfScanNum(serverType string, subName string) int
	GetVarConfScanNum(nodeName string) int
	GetInstallers(serverType string) []func(c component.IContainer) error
	GetSQL(dir string) ([]string, error)
	GetInput() map[string]*Input
	SetParam(k, v string)
	Confirm(msg string) bool
	Print()
}

type ICronBinder

type ICronBinder interface {
	SetMain(*conf.CronServerConf)
	SetTasks(*conf.Tasks)
	IExtBinder
}

type IExtBinder

type IExtBinder interface {
	SetMainConf(input interface{})
	SetSubConf(n string, input interface{})
	SetMetric(m *conf.Metric)
	SetApp(interface{})

	Installer(func(c component.IContainer) error)
	// contains filtered or unexported methods
}

type IMQCBinder

type IMQCBinder interface {
	SetMain(*conf.MQCServerConf)
	SetServer(conf.QueueConf)
	SetQueues(*conf.Queues)
	IExtBinder
}

type IPlatBinder

type IPlatBinder interface {
	SetDB(*conf.DBConf)
	SetDBByName(name string, d *conf.DBConf)
	SetQueue(d conf.QueueConf)
	SetQueueByName(name string, d conf.QueueConf)
	SetCache(conf.CacheConf)
	SetCacheByName(name string, d conf.CacheConf)
	// contains filtered or unexported methods
}

type IRPCBinder

type IRPCBinder interface {
	SetMain(c *conf.RPCServerConf)
	// contains filtered or unexported methods
}

type IWSBinder

type IWSBinder interface {
	SetMain(*conf.WSServerConf)
	// contains filtered or unexported methods
}

type IWebBinder

type IWebBinder interface {
	SetStatic(*conf.Static)
	SetMain(*conf.WebServerConf)
	// contains filtered or unexported methods
}

type Input

type Input struct {
	FiledName string
	ShowName  string
	Desc      string
	Filters   []func(string) (string, error)
}

type MQCBinder

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

func NewMQCBinder

func NewMQCBinder(params map[string]string, inputs map[string]*Input) *MQCBinder

func (MQCBinder) Installer

func (c MQCBinder) Installer(f func(c component.IContainer) error)

func (MQCBinder) SetApp

func (c MQCBinder) SetApp(m interface{})

SetMetric 设置服务器监控配置项

func (*MQCBinder) SetMain

func (b *MQCBinder) SetMain(c *conf.MQCServerConf)

func (MQCBinder) SetMainConf

func (c MQCBinder) SetMainConf(input interface{})

SetMainConf 设置主配置内容

func (MQCBinder) SetMetric

func (c MQCBinder) SetMetric(m *conf.Metric)

SetMetric 设置服务器监控配置项

func (*MQCBinder) SetQueues

func (b *MQCBinder) SetQueues(c *conf.Queues)

func (*MQCBinder) SetServer

func (b *MQCBinder) SetServer(c conf.QueueConf)

func (MQCBinder) SetSubConf

func (c MQCBinder) SetSubConf(n string, input interface{})

SetSubConf 设置子配置内容

type PlatBinder

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

func NewPlatBinder

func NewPlatBinder(params map[string]string, inputs map[string]*Input) *PlatBinder

func (*PlatBinder) SetCache

func (b *PlatBinder) SetCache(d conf.CacheConf)

func (*PlatBinder) SetCacheByName

func (b *PlatBinder) SetCacheByName(name string, d conf.CacheConf)

func (*PlatBinder) SetDB

func (b *PlatBinder) SetDB(d *conf.DBConf)

func (*PlatBinder) SetDBByName

func (b *PlatBinder) SetDBByName(name string, d *conf.DBConf)

func (*PlatBinder) SetQueue

func (b *PlatBinder) SetQueue(d conf.QueueConf)

func (*PlatBinder) SetQueueByName

func (b *PlatBinder) SetQueueByName(name string, d conf.QueueConf)

func (PlatBinder) SetVarConf

func (c PlatBinder) SetVarConf(t string, s string, input interface{})

SetVarConf 设置var配置内容

type RpcBinder

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

func NewRpcBinder

func NewRpcBinder(params map[string]string, inputs map[string]*Input) *RpcBinder

func (RpcBinder) SetAuthes

func (b RpcBinder) SetAuthes(a *conf.Authes)

func (RpcBinder) SetCircuitBreaker

func (b RpcBinder) SetCircuitBreaker(c *conf.CircuitBreaker)

func (RpcBinder) SetHeaders

func (b RpcBinder) SetHeaders(h conf.Headers)

func (*RpcBinder) SetMain

func (b *RpcBinder) SetMain(c *conf.RPCServerConf)

func (RpcBinder) SetRouters

func (b RpcBinder) SetRouters(r *conf.Routers)

type WSBinder

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

func NewWSBinder

func NewWSBinder(params map[string]string, inputs map[string]*Input) *WSBinder

func (WSBinder) SetAuthes

func (b WSBinder) SetAuthes(a *conf.Authes)

func (WSBinder) SetCircuitBreaker

func (b WSBinder) SetCircuitBreaker(c *conf.CircuitBreaker)

func (WSBinder) SetHeaders

func (b WSBinder) SetHeaders(h conf.Headers)

func (*WSBinder) SetMain

func (b *WSBinder) SetMain(c *conf.WSServerConf)

func (WSBinder) SetRouters

func (b WSBinder) SetRouters(r *conf.Routers)

type WebBinder

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

func NewWebBinder

func NewWebBinder(params map[string]string, inputs map[string]*Input) *WebBinder

func (WebBinder) SetAuthes

func (b WebBinder) SetAuthes(a *conf.Authes)

func (WebBinder) SetCircuitBreaker

func (b WebBinder) SetCircuitBreaker(c *conf.CircuitBreaker)

func (WebBinder) SetHeaders

func (b WebBinder) SetHeaders(h conf.Headers)

func (*WebBinder) SetMain

func (b *WebBinder) SetMain(c *conf.WebServerConf)

func (WebBinder) SetRouters

func (b WebBinder) SetRouters(r *conf.Routers)

func (*WebBinder) SetStatic

func (b *WebBinder) SetStatic(c *conf.Static)

Jump to

Keyboard shortcuts

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