Documentation ¶
Index ¶
- func InitializeContextDatabase() error
- type ContextDb
- type Etcd
- type EtcdClient
- func (e *EtcdClient) Delete(key string) error
- func (e *EtcdClient) DeleteAll(key string) error
- func (e *EtcdClient) Get(key string, value interface{}) error
- func (e *EtcdClient) GetAllKeys(key string) ([]string, error)
- func (e *EtcdClient) HealthCheck() error
- func (e *EtcdClient) Put(key string, value interface{}) error
- type EtcdConfig
- type MockConDb
- func (c *MockConDb) Delete(key string) error
- func (c *MockConDb) DeleteAll(key string) error
- func (c *MockConDb) Get(key string, value interface{}) error
- func (c *MockConDb) GetAllKeys(path string) ([]string, error)
- func (c *MockConDb) HealthCheck() error
- func (c *MockConDb) Put(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeContextDatabase ¶
func InitializeContextDatabase() error
InitializeContextDatabase sets up the connection to the configured database to allow the application to talk to it.
Types ¶
type ContextDb ¶
type ContextDb interface { // Returns nil if db health is good HealthCheck() error // Puts Json Struct in db with key Put(key string, value interface{}) error // Delete k,v Delete(key string) error // Delete all keys in heirarchy DeleteAll(key string) error // Gets Json Struct from db Get(key string, value interface{}) error // Returns all keys with a prefix GetAllKeys(path string) ([]string, error) }
ContextDb is an interface for accessing the context database
var Db ContextDb
Db interface used to talk a concrete Database connection
func NewEtcdClient ¶
func NewEtcdClient(store *clientv3.Client, c EtcdConfig) (ContextDb, error)
NewEtcdClient function initializes Etcd client
type Etcd ¶
type Etcd interface { Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error) }
Etcd For Mocking purposes
type EtcdClient ¶
type EtcdClient struct {
// contains filtered or unexported fields
}
EtcdClient for Etcd
func (*EtcdClient) Delete ¶
func (e *EtcdClient) Delete(key string) error
Delete values from Etcd DB
func (*EtcdClient) DeleteAll ¶
func (e *EtcdClient) DeleteAll(key string) error
DeleteAll keys from Etcd DB
func (*EtcdClient) Get ¶
func (e *EtcdClient) Get(key string, value interface{}) error
Get values from Etcd DB and decodes from json
func (*EtcdClient) GetAllKeys ¶
func (e *EtcdClient) GetAllKeys(key string) ([]string, error)
GetAllKeys values from Etcd DB
func (*EtcdClient) HealthCheck ¶
func (e *EtcdClient) HealthCheck() error
HealthCheck for checking health of the etcd cluster
func (*EtcdClient) Put ¶
func (e *EtcdClient) Put(key string, value interface{}) error
Put values in Etcd DB
type EtcdConfig ¶
EtcdConfig Configuration values needed for Etcd Client
type MockConDb ¶
func (*MockConDb) HealthCheck ¶
Click to show internal directories.
Click to hide internal directories.