Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Connect() error
- func (c *Client) Create(key string, value interface{}, handleFunc func(*Message)) *Operation
- func (c *Client) Delete(key string, handleFunc func(*Message)) *Operation
- func (c *Client) Get(key string, handleFunc func(*Message)) *Operation
- func (c *Client) Insert(key string, value interface{}, handleFunc func(*Message)) *Operation
- func (c *Client) NewOperation(handleFunc func(*Message)) *Operation
- func (c *Client) Offline() <-chan struct{}
- func (c *Client) Online() <-chan struct{}
- func (c *Client) Qsub(query string, handleFunc func(*Message)) *Operation
- func (c *Client) Query(query string, handleFunc func(*Message)) *Operation
- func (c *Client) Shutdown()
- func (c *Client) StayConnected()
- func (c *Client) Sub(query string, handleFunc func(*Message)) *Operation
- func (c *Client) Update(key string, value interface{}, handleFunc func(*Message)) *Operation
- type Message
- type Operation
Constants ¶
View Source
const ( MsgOk = "ok" MsgError = "error" MsgDone = "done" MsgSuccess = "success" MsgUpdate = "upd" MsgNew = "new" MsgDelete = "del" MsgWarning = "warning" MsgOffline = "offline" // special message type for signaling the handler that the connection was lost )
Message Types.
Variables ¶
View Source
var (
ErrMalformedMessage = errors.New("malformed message")
)
Client errors.
Functions ¶
This section is empty.
Types ¶
type Client ¶
The Client enables easy interaction with the API.
func (*Client) NewOperation ¶
NewOperation returns a new operation.
func (*Client) Offline ¶
func (c *Client) Offline() <-chan struct{}
Offline returns a closed channel read if the client is not connected to the API.
func (*Client) Online ¶
func (c *Client) Online() <-chan struct{}
Online returns a closed channel read if the client is connected to the API.
func (*Client) StayConnected ¶
func (c *Client) StayConnected()
StayConnected calls Connect again whenever the connection is lost.
type Message ¶
type Message struct { OpID string Type string Key string RawValue []byte Value interface{} // contains filtered or unexported fields }
Message is an API message.
func ParseMessage ¶
ParseMessage parses the given raw data and returns a Message.
type Operation ¶
type Operation struct { ID string // contains filtered or unexported fields }
Operation represents a single operation by a client.
func (*Operation) EnableResuscitation ¶
func (op *Operation) EnableResuscitation()
EnableResuscitation will resend the request after reconnecting to the API.
Click to show internal directories.
Click to hide internal directories.