pubsubsql

package module
v1.1.0 Latest Latest
Warning

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

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

README

client

Go client for PubSubSQL

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) Action

func (c *Client) Action() string

Action returns an action string from the response returned by the last command executed against the pubsubsql server. Valid actions are [status, insert, select, delete, update, add, remove, subscribe, unsubscribe]

func (*Client) ColumnCount

func (c *Client) ColumnCount() int

ColumnCount returns the number of columns in the columns collection of the result set.

func (*Client) Columns

func (c *Client) Columns() []string

Columns returns the column names in the columns collection of the result set.

func (*Client) Connect

func (c *Client) Connect(address string) bool

Connect connects the Client to the pubsubsql server. Address string has the form host:port.

func (*Client) Connected

func (c *Client) Connected() bool

Connected returns true if the Client is currently connected to the pubsubsql server.

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect disconnects the Client from the pubsubsql server.

func (*Client) Error

func (c *Client) Error() string

Functions that may generate an error are [Connect, Execute, NextRow, WaitForPubSub]

func (*Client) Execute

func (c *Client) Execute(command string) bool

Execute executes a command against the pubsubsql server and returns true on success. The pubsubsql server returns to the Client a response in JSON format.

func (*Client) Failed

func (c *Client) Failed() bool

Failed determines if the last command executed against the pubsubsql server failed.

func (*Client) HasColumn

func (c *Client) HasColumn(column string) bool

HasColumn determines if the column name exists in the columns collection of the result set.

func (*Client) JSON

func (c *Client) JSON() string

JSON returns a response string in JSON format from the last command executed against the pubsubsql server.

func (*Client) NextRow

func (c *Client) NextRow() bool

NextRow is used to move to the next row in the result set returned by the pubsubsql server. When called for the first time, NextRow moves to the first row in the result set. Returns false when all rows are read or if there is an error. To find out if false was returned because of an error, use Ok or Failed functions.

func (*Client) Ok

func (c *Client) Ok() bool

Ok determines if the last command executed against the pubsubsql server succeeded.

func (*Client) PubSubId

func (c *Client) PubSubId() string

PubSubId returns a unique identifier generated by the pubsubsql server when a Client subscribes to a table. If the client has subscribed to more than one table, PubSubId should be used by the Client to uniquely identify messages published by the pubsubsql server.

func (*Client) RowCount

func (c *Client) RowCount() int

RowCount returns the number of rows in the result set returned by the pubsubsql server.

func (*Client) Stream

func (c *Client) Stream(command string) bool

Stream sends a command to the pubsubsql server and returns true on success. The pubsubsql server does not return a response to the Client.

func (*Client) Value

func (c *Client) Value(column string) string

Value returns the value within the current row for the given column name. If the column name does not exist, Value returns an empty string.

func (*Client) ValueByOrdinal

func (c *Client) ValueByOrdinal(ordinal int) string

ValueByOrdinal returns the value within the current row for the given column ordinal. The column ordinal represents the zero based position of the column in the Columns collection of the result set. If the column ordinal is out of range, ValueByOrdinal returns an empty string.

func (*Client) WaitForPubSub

func (c *Client) WaitForPubSub(timeout int) bool

WaitForPubSub waits until the pubsubsql server publishes a message for the subscribed Client or until the timeout interval elapses. Returns false when timeout interval elapses or if there is and error. To find out if false was returned because of an error, use Ok or Failed functions.

Jump to

Keyboard shortcuts

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