Skip to content

cshenton/seer-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seer Golang Client

Build Status Coverage Status Go Report Card

The golang client for the seer forecasting server.

Installation

To install the seer client library, use go get

go get github.com/cshenton/seer-golang/seer

Usage

Since this is a client library, you'll need a server to communicate with. To get up and running just:

docker run -d -p 8080:8080 cshenton/seer

Check out the project repo over here

Then, to interact over localhost

package main

import (
        "log"
        "time"

        "github.com/cshenton/seer-golang/client"
)

func main() {
        // Create a client
        c, err := client.New("localhost:8080")
        if err != nil {
                log.Fatal(err)
        }

        // Create a stream
        _, err = c.CreateStream("myStream", 3600)
        if err != nil {
                log.Fatal(err)
        }

        // Add in data
        _, err = c.UpdateStream(
                "myStream",
                []float64{10, 9, 6},
                []time.Time{
                        time.Date(2016, 1, 1, 0, 0, 0, 0, time.UTC),
                        time.Date(2016, 1, 2, 0, 0, 0, 0, time.UTC),
                        time.Date(2016, 1, 3, 0, 0, 0, 0, time.UTC),
                },
        )
        if err != nil {
                log.Fatal(err)
        }

        // Generate and display forecast
        f, err = c.GetForecast("myStream", 10)
        fmt.Println(f)
}

(For Contributors) Generating gRPC Client stubs

protoc -I ../seer/seer --go_out=plugins=grpc:seer ../seer/seer/seer.proto

We then add //+build !test to the top of the file to exclude it from coverage statistics (since it has a tonne of redundant code, like the Get* methods and the server interfaces, which are not used, and therefore don't require testing).

About

The golang client library for seer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages