Go Client API
You can develop applications and tools using Riak TS with the Riak Go client. This document covers the Go API for Riak TS.
You will need to use version 1.7.0 or later of the Go client to use the TS API.
Overview
TS support within the Go client is implemented through the following 5 command builders, each with a factory:
- TsStoreRowsCommandBuilder which is assembled via NewTsStoreRowsCommandBuilder
- TsFetchRowCommandBuilder which is assembled via NewTsFetchRowCommandBuilder
- TsDeleteRowCommandBuilder which is assembled via NewTsDeleteRowCommandBuilder
- TsQueryCommandBuilder which is assembled via NewTsQueryCommandBuilder
- TsListKeysCommandBuilder which is assembled via NewTsListKeysCommandBuilder
Language | Source | Documentation |
---|---|---|
Go | riak-go-client | GoDoc |
Data Types
TsColumnDescription
- Holds the data that describes a columnTsCell
- Holds the data and data typeRow
- A slice of cells
Data Type Details
TsColumnDescription
A TsColumnDescription contains the column name and column data type. They are generated when receiving responses from the TsFetchRowCommand
and TsQueryCommand
operations.
TsCell
A cell contains a piece of data for a row in a Riak TS table and can hold 5 different types of raw data:
Varchar
- standard Go stringSInt64
- any signed 64-bit integersDouble
- any 64-bit floating point numberTimestamp
- any Unix epoch timestamp as int64Boolean
- a true/false value.
Constructors
A cell is constructed by using one of the cell factory methods for the various data types, e.g. cell := NewStringTsCell("South Atlantic")
.
Instance Methods
Cells have struct
getters to retrieve the cell value and the value’s data type.
Row
A row contains a slice of cells, e.g. row := make([]TsCell, 5)
Responses
TsStoreRowsCommand, TsDeleteRowCommand
Have a boolean response value to signal if the operation was successful.
TsFetchRowCommand
Returns a TsFetchRowResponse
containing IsNotFound
a flag for if the row was found, a []TsColumnDescription
describing the table’s columns, and a []TsCell
providing the row data.
TsQueryCommand
Returns a TsQueryResponse
containing a []TsColumnDescription
describing the table’s columns and a [][]TsCell
providing the data for each row.
TsListKeysCommand
Returns a TsListKeysResponse
containing a [][]TsCell
with each outer slice element representing a Primary Key for a row.