日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)GoFrame教程:GoFrame配置管理-接口化設(shè)計(jì)

?gcfg?組件采用了接口化設(shè)計(jì),以實(shí)現(xiàn)高擴(kuò)展性。通過接口化設(shè)計(jì)的方式,使用者可以自定義對接的配置獲取方式,例如?etcd?, ?zookeeper?, ?consule?, ?kubernetes ??configmap?, ?apollo?等等。

接口定義

https://github.com/GOgf/gf/v2/blob/master/os/gcfg/gcfg_adaper.go

// Adapter is the interface for configuration retrieving.
type Adapter interface {
	// Available checks and returns the configuration service is available.
	// The optional parameter `resource` specifies certain configuration resource.
	//
	// It returns true if configuration file is present in default AdapterFile, or else false.
	// Note that this function does not return error as it just does simply check for backend configuration service.
	Available(ctx context.Context, resource ...string) (ok bool)

	// Get retrieves and returns value by specified `pattern`.
	Get(ctx context.Context, pattern string) (value interface{}, err error)

	// Data retrieves and returns all configuration data as map type.
	// Note that this function may lead lots of memory usage if configuration data is too large,
	// you can implement this function if necessary.
	Data(ctx context.Context) (data map[string]interface{}, err error)
}

設(shè)置接口實(shí)現(xiàn)

// SetAdapter sets the adapter of current Config object.
func (c *Config) SetAdapter(adapter Adapter)

獲取接口實(shí)現(xiàn)

// GetAdapter returns the adapter of current Config object.
func (c *Config) GetAdapter() Adapter

網(wǎng)站名稱:創(chuàng)新互聯(lián)GoFrame教程:GoFrame配置管理-接口化設(shè)計(jì)
網(wǎng)址分享:http://m.5511xx.com/article/cdspdge.html