consul

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SUBSYTEM = "consul"

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Host       string `yaml:"host" json:"host" mapstructure:"host" validate:"required"`                   // Consul host inclusive protocol and port, for example http://consul11.mar.eosn.io:8500
	Datacenter string `yaml:"datacenter" json:"datacenter" mapstructure:"datacenter" validate:"required"` // Consul datacenter, for example "march"
	Folder     string `yaml:"folder" json:"folder" mapstructure:"folder" validate:"required"`             // Consul folder for KV pairs, for example "test"
}

type KVClient

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

func NewKVClient

func NewKVClient(config *Config) (*KVClient, error)

func (*KVClient) Get

func (k *KVClient) Get(key string, queryOptions *api.QueryOptions) (*api.KVPair, *api.QueryMeta, error)

func (*KVClient) GetInt

func (k *KVClient) GetInt(key string) (int, error)

func (*KVClient) GetString

func (k *KVClient) GetString(key string) (string, error)

func (*KVClient) Put

func (k *KVClient) Put(key string, value []byte, writeOptions *api.WriteOptions) (*api.WriteMeta, error)

func (*KVClient) PutInt

func (k *KVClient) PutInt(key string, value int) error

func (*KVClient) PutString

func (k *KVClient) PutString(key, value string) error

Jump to

Keyboard shortcuts

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