kvclient

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: ISC Imports: 12 Imported by: 1

README

Kilovolt client

Go client for Kilovolt websocket servers, supports Kilovolt Protocol v3/v4

Getting started

Depending on what version of kilovolt you need to interface with, you'll need to pick a corresponding version of kilovolt-client-go:

Protocol Go URL
v3 go get github.com/strimertul/kilovolt-client-go
v4 go get github.com/strimertul/kilovolt-client-go/v2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAuthenticated     = errors.New("not authenticated")
	ErrSubscriptionNotFound = errors.New("subscription not found")
	ErrEmptyKey             = errors.New("key empty or unset")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Endpoint string
	Logger   logrus.FieldLogger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string, options ClientOptions) (*Client, error)

func (*Client) Close

func (s *Client) Close()

func (*Client) ConnectToWebsocket

func (s *Client) ConnectToWebsocket() error

func (*Client) GetByPrefix

func (s *Client) GetByPrefix(prefix string) (map[string]string, error)

func (*Client) GetJSON

func (s *Client) GetJSON(key string, dst interface{}) error

func (*Client) GetKey

func (s *Client) GetKey(key string) (string, error)

func (*Client) GetKeys

func (s *Client) GetKeys(keys []string) (map[string]string, error)

func (*Client) SetJSON

func (s *Client) SetJSON(key string, data interface{}) error

func (*Client) SetJSONs

func (s *Client) SetJSONs(data map[string]interface{}) error

func (*Client) SetKey

func (s *Client) SetKey(key string, data string) error

func (*Client) SetKeys

func (s *Client) SetKeys(data map[string]string) error

func (*Client) SubscribeKey

func (s *Client) SubscribeKey(key string) (chan KeyValuePair, error)

func (*Client) SubscribePrefix

func (s *Client) SubscribePrefix(prefix string) (chan KeyValuePair, error)

func (*Client) UnsubscribeKey

func (s *Client) UnsubscribeKey(key string, chn chan KeyValuePair) error

func (*Client) UnsubscribePrefix

func (s *Client) UnsubscribePrefix(prefix string, chn chan KeyValuePair) error

type ClientOptions

type ClientOptions struct {
	Headers http.Header
	Logger  logrus.FieldLogger
}

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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