apollo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCluster 默认集群
	DefaultCluster = "default"
)

Variables

This section is empty.

Functions

func MustUnmarshalYaml

func MustUnmarshalYaml(content string, value any, zeroFields ...bool)

MustUnmarshalYaml 将 content 字符串 yaml 反序列化到 value 中

func UnmarshalYaml

func UnmarshalYaml(content string, value any, zeroFields ...bool) error

UnmarshalYaml 将 content 字符串 yaml 反序列化到 value 中

Types

type Apollo

type Apollo struct {
	agollo.Client // 客户端
	// contains filtered or unexported fields
}

Apollo 阿波罗配置中心客户端

func MustNewApollo

func MustNewApollo(c Config) *Apollo

MustNewApollo 新建阿波罗配置中心客户端

func NewApollo

func NewApollo(c Config) (*Apollo, error)

NewApollo 新建阿波罗配置中心客户端

func (*Apollo) GetDumpFileName

func (a *Apollo) GetDumpFileName() string

GetDumpFileName 获取备份文件名称

func (*Apollo) GetNamespaceContent

func (a *Apollo) GetNamespaceContent(namespace string) string

GetNamespaceContent 获取给定 namespace 的具体 content

func (*Apollo) GetNamespaceValue

func (a *Apollo) GetNamespaceValue(namespace, key string) string

GetNamespaceValue 获取给定 namespace 的 key 所对应的 value

type Config

type Config struct {
	IsMock             bool     `json:",optional"`        // 是否模拟
	AppID              string   `json:",optional"`        // 应用ID
	Cluster            string   `json:",default=default"` // 集群
	NameSpaceNames     []string `json:",optional"`        // 命名空间
	CacheDir           string   `json:",optional"`        // 配置缓存目录
	MetaAddr           string   `json:",optional"`        // 服务地址
	AccessKeySecret    string   `json:",optional"`        // 访问鉴权密钥
	InsecureSkipVerify bool     `json:",optional"`        // 跳过安全验证
}

Config 阿波罗配置中心客户端配置

type MockClient

type MockClient struct{}

MockClient ...

func (*MockClient) GetAllKeys

func (c *MockClient) GetAllKeys(opts ...agollo.OpOption) []string

GetAllKeys ...

func (*MockClient) GetContent

func (c *MockClient) GetContent(opts ...agollo.OpOption) string

GetContent ...

func (*MockClient) GetPropertiesContent

func (c *MockClient) GetPropertiesContent(opts ...agollo.OpOption) string

GetPropertiesContent ...

func (*MockClient) GetReleaseKey

func (c *MockClient) GetReleaseKey(opts ...agollo.OpOption) string

GetReleaseKey ...

func (*MockClient) GetString

func (c *MockClient) GetString(key string, opts ...agollo.OpOption) string

GetString ...

func (*MockClient) OnUpdate

func (c *MockClient) OnUpdate(f func(*agollo.ChangeEvent))

OnUpdate ...

func (*MockClient) Start

func (c *MockClient) Start() error

Start ...

func (*MockClient) Stop

func (c *MockClient) Stop() error

Stop ...

func (*MockClient) SubscribeToNamespaces

func (c *MockClient) SubscribeToNamespaces(namespaces ...string) error

SubscribeToNamespaces ...

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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