Documentation
¶
Overview ¶
Package rockset provides a go driver for the Rockset database
Something about the package.
Index ¶
- Variables
- func ParseConnStr(s string) (key string, server string, err error)
- type Conn
- func (c *Conn) Begin() (driver.Tx, error)
- func (c *Conn) Close() error
- func (c *Conn) Ping(ctx context.Context) error
- func (c *Conn) Prepare(_ string) (driver.Stmt, error)
- func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)
- func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.Value) (driver.Rows, error)
- func (c *Conn) Rollback() error
- type Driver
- type Int64
- type Time
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrConnectionString = errors.New("incorrect connection string") )
View Source
var ErrUnsupportedConversion = errors.New("unsupported conversion")
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
type Driver ¶
type Driver struct{}
Example ¶
Example usage of the Rockset SQL driver
package main import ( "context" "database/sql" "log" _ "github.com/rockset/go-sql-driver" ) func main() { ctx := context.TODO() // connect using environment variables ROCKSET_APIKEY and ROCKSET_APISERVER db, err := sql.Open("rockset", "rockset://") if err != nil { log.Fatal(err) } rows, err := db.QueryContext(ctx, `SELECT kind, count(kind) as total FROM commons._events group by kind order by total DESC `) if err != nil { log.Fatal(err) } var kind string var total int64 for rows.Next() { err = rows.Scan(&kind, &total) if err != nil { log.Fatal(err) } } }
type Int64 ¶
type Int64 int64
Int64 is used to handle int values, as the Rockset go client uses json.Unmarshal into an interface value, which makes all numbers become float64.
To unmarshal JSON into an interface value, Unmarshal stores one of these in the interface value:
- bool, for JSON booleans
- float64, for JSON numbers
- string, for JSON strings
- []interface{}, for JSON arrays
- map[string]interface{}, for JSON objects
- nil for JSON null
Click to show internal directories.
Click to hide internal directories.