consulagent

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 5 Imported by: 0

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

func ConsulHost(hostName string) Options

ConsulHost sets the IP for consul agent. Defults to 127.0.0.1

func ConsulPort

func ConsulPort(portNumber int) Options

ConsulPort sets the port for consul agent. Defaults to 8500

func Logger

func Logger(customLogger gologger.ILogger) Options

Logger sets the logger for consul Defaults to consul logger

Jump to

Keyboard shortcuts

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