Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulAgent ¶
type ConsulAgent struct {
// contains filtered or unexported fields
}
ConsulAgent holds a singleton consul agent and a logger
func (*ConsulAgent) CreateKV ¶
func (ca *ConsulAgent) CreateKV(key string, value interface{}) bool
CreateKV creates a key value pair
func (*ConsulAgent) DeleteKV ¶
func (ca *ConsulAgent) DeleteKV(key string) bool
DeleteKV creates a key value pair
func (*ConsulAgent) GetKeyValuePairs ¶
func (ca *ConsulAgent) GetKeyValuePairs(prefix string) map[string][]byte
GetKeyValuePairs gets the list of keys and corresponding values for a prefix string
func (*ConsulAgent) GetKeys ¶
func (ca *ConsulAgent) GetKeys(prefix string) []string
GetKeys gets the list of keys for the prefix string
func (*ConsulAgent) GetValue ¶
func (ca *ConsulAgent) GetValue(key string) []byte
GetValue gets the value of the key
type IConsulAgent ¶ added in v1.15.0
type IConsulAgent interface {
GetKeys(prefix string) []string
GetKeyValuePairs(prefix string) map[string][]byte
GetValue(key string) []byte
CreateKV(key string, value interface{}) bool
DeleteKV(key string) bool
}
func NewConsulAgent ¶
func NewConsulAgent(options ...Options) IConsulAgent
NewConsulAgent will initialize consul client.
type Options ¶
type Options func(c *ConsulAgent)
Options sets a parameter for consul agent
func ConsulHost ¶
ConsulHost sets the IP for consul agent. Defults to 127.0.0.1
func ConsulPort ¶
ConsulPort sets the port for consul agent. Defaults to 8500
Click to show internal directories.
Click to hide internal directories.