kvclient

package module
v8.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: ISC Imports: 15 Imported by: 1

README

Kilovolt client

Go client for Kilovolt websocket servers, supports Kilovolt Protocol v3+

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
v8 go get github.com/strimertul/kilovolt-client-go/v8
v7 go get github.com/strimertul/kilovolt-client-go/v7
v6 go get github.com/strimertul/kilovolt-client-go/v6
v5 go get github.com/strimertul/kilovolt-client-go/v3
v4 go get github.com/strimertul/kilovolt-client-go/v2
v3 go get github.com/strimertul/kilovolt-client-go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	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   *zap.Logger
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) Authenticate

func (s *Client) Authenticate(password string) error

func (*Client) Close

func (s *Client) Close() error

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) ListKeys

func (s *Client) ListKeys(prefix 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
	Password string
	Logger   *zap.Logger
}

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