utils

package
v0.0.0-...-0178fca Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, value string) (index int, ok bool)

func FilterNotContainsString

func FilterNotContainsString(slice []string, filterElements []string) (filtered []string)

FilterNotContainsString removes all items in 'filterElements' from the 'slice'.

func IntersectStringSlice

func IntersectStringSlice(sliceA []string, sliceB []string) (intersect []string)

IntersectStringSlice returns intersections.

func RemoveFromStringSlice

func RemoveFromStringSlice(slice []string, value string) (removed []string)

RemoveFromStringSlice removes a string entity from the string slice.

Types

type Consul

type Consul struct {
	Client     *api.Client
	Datacenter string
}

func NewConsul

func NewConsul(url *url.URL, token string, datacenter string) (*Consul, error)

func NewConsulMock

func NewConsulMock() *Consul

only for test

func (*Consul) DeleteTreeIfExists

func (c *Consul) DeleteTreeIfExists(key string) (bool, error)

returns whether or not to delete

func (*Consul) GetKV

func (c *Consul) GetKV(key string) (value string, ok bool, err error)

func (*Consul) GetKVBoolExactly

func (c *Consul) GetKVBoolExactly(key string) (value bool, err error)

returns an error if key doesn't exist

func (*Consul) GetKVExactly

func (c *Consul) GetKVExactly(key string) (value string, err error)

returns an error if key doesn't exist

func (*Consul) GetKVIntExactly

func (c *Consul) GetKVIntExactly(key string) (value int, err error)

returns an error if key doesn't exist

func (*Consul) GetKeys

func (c *Consul) GetKeys(prefix string, recurse bool) ([]string, error)

func (*Consul) GetSubKeyNames

func (c *Consul) GetSubKeyNames(prefix string) ([]string, error)

get keys which is first children of the prefix and removes the prefix

func (*Consul) PutKV

func (c *Consul) PutKV(key string, value string) error

func (*Consul) PutKVBool

func (c *Consul) PutKVBool(key string, value bool) error

func (*Consul) PutKVInt

func (c *Consul) PutKVInt(key string, num int) error

Jump to

Keyboard shortcuts

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