Giter Club home page Giter Club logo

rockset-go-client's Introduction

Rockset Go Client

CircleCI Documentation License GitHub issues Release Coverage Status

Official Go client library for Rockset

Installation

Install the Rockset Go client from Github:

go get github.com/rockset/rockset-go-client

or install it from a source code checkout:

cd $GOPATH/src/github.com
mkdir rockset
cd rockset
git clone [email protected]:rockset/rockset-go-client.git
go install rockset-go-client/rockclient.go

Usage

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()
if err != nil {
    log.Fatal(err)
}

ctx := context.TODO()
q := `SELECT * FROM "_events" LIMIT 1`

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

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

Updating the OpenAPI specification

If the OpenAPI specification has changed, you need to regenerate the OpenAPI client

# bump the minor version
vi version.go 
# generate a new client
./generate.sh
# record new VCR cassettes
VCR_MODE=record go test ./...

Testing

There are a number of testable examples which require an API key, i.e. set the ROCKSET_APIKEY and ROCKSET_APISERVER environment variables.

To run tests:

go test -v -timeout 30m ./...

To generate the fakes used for testing:

go generate ./...

Go VCR

Most tests use Go VCR, and they will use a cassette (recorded response) by default, so if you want to re-record a cassette, set the environment variable VCR_MODE to record.

The VCR tracks ignore the patch version of the client version, so when the OpenAPI spec is updated you have to re-record the VCR cassettes.

If you don't have git lfs set up, install before committing new recordings:

brew install git-lfs
git lfs install
git lfs track "*.cassette.gz"

Code Coverage

go test ./... -coverprofile cover.out
go tool cover -func=cover.out
go tool cover -html=cover.out -o coverage.html

Support

Feel free to log issues against this client through GitHub.

License

The Rockset Go Client is licensed under the Apache 2.0 License

Cutting a New Release

  • Update the version in version.go
  • Run generate.sh
    • If you run into issues with this script, try running git submodule update --init
  • Run go mod tidy
  • Re-record VCR cassettes rm -rf testdata/cassettes/ && VCR_MODE=record go test -v -timeout 30m ./...
    • If you have not already, make sure to set up git lfs before committing: brew install git-lfs && git lfs install && git lfs track "*.cassette.gz"
  • Push and merge branch
  • Run git tag v{version_number} on master
  • Run git push origin v{version_number}

rockset-go-client's People

Contributors

ari-e avatar clowenhg avatar dependabot[bot] avatar dhruba avatar gracebrill avatar karenl1 avatar kristielim avatar kwadhwa18 avatar pmenglund avatar rockset-io avatar sbaldwin-rs avatar sbruceheart avatar scottwmorris avatar vahidfazelrezai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.