Documentation
¶
Index ¶
- type Client
- func (c *Client) Action() string
- func (c *Client) ColumnCount() int
- func (c *Client) Columns() []string
- func (c *Client) Connect(address string) bool
- func (c *Client) Connected() bool
- func (c *Client) Disconnect()
- func (c *Client) Error() string
- func (c *Client) Execute(command string) bool
- func (c *Client) Failed() bool
- func (c *Client) HasColumn(column string) bool
- func (c *Client) JSON() string
- func (c *Client) NextRow() bool
- func (c *Client) Ok() bool
- func (c *Client) PubSubId() string
- func (c *Client) RowCount() int
- func (c *Client) Stream(command string) bool
- func (c *Client) Value(column string) string
- func (c *Client) ValueByOrdinal(ordinal int) string
- func (c *Client) WaitForPubSub(timeout int) bool
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 ¶
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 ¶
ColumnCount returns the number of columns in the columns collection of the result set.
func (*Client) Columns ¶
Columns returns the column names in the columns collection of the result set.
func (*Client) Connect ¶
Connect connects the Client to the pubsubsql server. Address string has the form host:port.
func (*Client) Connected ¶
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 ¶
Functions that may generate an error are [Connect, Execute, NextRow, WaitForPubSub]
func (*Client) Execute ¶
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 ¶
Failed determines if the last command executed against the pubsubsql server failed.
func (*Client) HasColumn ¶
HasColumn determines if the column name exists in the columns collection of the result set.
func (*Client) JSON ¶
JSON returns a response string in JSON format from the last command executed against the pubsubsql server.
func (*Client) NextRow ¶
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 ¶
Ok determines if the last command executed against the pubsubsql server succeeded.
func (*Client) PubSubId ¶
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 ¶
RowCount returns the number of rows in the result set returned by the pubsubsql server.
func (*Client) Stream ¶
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 ¶
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 ¶
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 ¶
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.