Rockset Go Client

CircleCI Documentation License GitHub issues Release

Official Go client library for Rockset


Install the Rockset Go client from Github:

go get

or install it from a source code checkout:

cd $GOPATH/src/
mkdir rockset
cd rockset
git clone
go install rockset-go-client/rockclient.go


You can see a few examples in the godoc of how to create a collection, how to put documents in a collection and how to use SQL to query your collections.

client, err := rockset.NewClient(rockset.WithAPIKey("..."))
if err != nil {

q := models.QueryRequest{
    Sql: &models.QueryRequestSql{
        Query: `SELECT * FROM "_events" LIMIT 1`,

res, _, err := client.Query(q)
if err != nil {

fmt.Printf("%+v\n", res)


Tests are available in the test folder.

Set ROCKSET_APIKEY and ROCKSET_APISERVER endpoint in the environment variables. To run tests:

go test ./...


Feel free to log issues against this client through GitHub.


The Rockset Go Client is licensed under the Apache 2.0 License

Expand ▾ Collapse ▴



Example (AddDocument)

created collection go-test-add-docs-collection
document status: ADDED
deleted collection go-test-add-docs-collection
Example (CreateCollection)

created collection go-test-collection
collection status for go-test-collection: CREATED
deleted collection go-test-collection
Example (CreateIntegration)

Example (CreateS3Collection)

Example (ErrorHandling)

NotFound: Could not find workspace with name 'non-existing-workspace'
Example (QueryLambda)

    Example code to create, use, and delete a Query Lambda

    created Query Lambda MyQueryLambda
    query result: map[echo:Hello, world!]
    query result: map[echo:All work and no play makes Jack a dull boy]
    deleted Query Lambda MyQueryLambda




    View Source
    const APIKeyEnvironmentVariableName = "ROCKSET_APIKEY"
    View Source
    const APIServerEnvironmentVariableName = "ROCKSET_APISERVER"
    View Source
    const DefaultAPIServer = ""

      DefaultAPIServer is the default Rockset API server to use

      View Source
      const Version = "0.10.0"

        Version is the Rockset client version


        This section is empty.


        func AsRocksetError

        func AsRocksetError(err error) (api.ErrorModel, bool)

          AsRocksetError takes an error returned from an API call and returns the underlying error message


          type RockClient

          type RockClient struct {
          	// API Services
          	ApiKeys       *api.ApiKeysApiService
          	Collection    *api.CollectionsApiService
          	Integration   *api.IntegrationsApiService
          	Documents     *api.DocumentsApiService
          	QueryApi      *api.QueriesApiService
          	Users         *api.UsersApiService
          	Organizations *api.OrganizationsApiService
          	QueryLambdas  *api.QueryLambdasApiService
          	Workspaces    *api.WorkspacesApiService
          	// contains filtered or unexported fields
          Example (QueryParam)
          got 1 response(s)

          func Client

          func Client(apiKey string, apiServer string) *RockClient

            Create a Client object to securely connect to Rockset using an API key Optionally, an alternate API server host can also be provided.

            Deprecated: this function has been superseded by NewClient()

            func NewClient

            func NewClient(options ...RockOption) (*RockClient, error)

              NewClient creates a new Rockset client.

              Accessing the online database requires an API key, which you either have to supply through the ROCKSET_APIKEY environment variable and pass the FromEnv() option

              c, err := rockset.NewClient(rockset.FromEnv())

              or explicitly using the WithAPIKey() option

              c, err := rockset.NewClient(rockset.WithAPIKey("..."))

              func (*RockClient) CreateWorkspace

              func (rc *RockClient) CreateWorkspace(name, description string) (api.Workspace, *http.Response, error)

                CreateWorkspace creates a new workspace

                func (*RockClient) DeleteWorkspace

                func (rc *RockClient) DeleteWorkspace(name string) (api.Workspace, *http.Response, error)

                  DeleteWorkspace deletes the workspace with name

                  func (*RockClient) GetWorkspace

                  func (rc *RockClient) GetWorkspace(name string) (api.Workspace, *http.Response, error)

                    GetWorkspace gets the workspace with name

                    func (*RockClient) ListWorkspaces

                    func (rc *RockClient) ListWorkspaces() ([]api.Workspace, *http.Response, error)

                      ListWorkspaces list all workspaces

                      func (*RockClient) Organization

                      func (rc *RockClient) Organization() (api.Organization, *http.Response, error)

                        Organization returns the organization the RockClient belongs to

                        func (*RockClient) Query

                        func (rc *RockClient) Query(request api.QueryRequest) (api.QueryResponse, *http.Response, error)

                          Query executes a query request against Rockset


                            This example runs a query against Rockset

                            got 1 row(s)

                            func (*RockClient) Validate

                            func (rc *RockClient) Validate() error

                              Validate validates and sets the Rockset client configuration options

                              type RockOption

                              type RockOption func(rc *RockClient)

                                RockOption is the type for RockClient options

                                func FromEnv

                                func FromEnv() RockOption

                                  FromEnv sets API key and API server from the environment variables ROCKSET_APIKEY and ROCKSET_APISERVER, and if ROCKSET_APISERVER is not set, it will use the default API server.

                                  func WithAPIKey

                                  func WithAPIKey(key string) RockOption

                                    WithAPIKey sets the API key to key

                                    func WithAPIServer

                                    func WithAPIServer(s string) RockOption

                                      WithAPIServer sets the API server

                                      func WithHTTPClient

                                      func WithHTTPClient(c *http.Client) RockOption

                                        WithHTTPClient sets the HTTP client. Without this option RockClient uses the http.DefaultClient, which does not have a timeout.

                                        func WithTimeout

                                        func WithTimeout(t time.Duration) RockOption

                                          WithTimeout sets the HTTP client timeout, and will override any value set using using the WithHTTPClient() option


                                          Path Synopsis