avatica

package module
v3.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 31 Imported by: 1

README

Apache Avatica/Phoenix SQL Driver

GoDoc Build Status

Apache Calcite's Avatica Go is a Go database/sql driver for the Avatica server.

Avatica is a sub-project of Apache Calcite.

Quick Start

If you are using Go 1.10 and below, install using dep:

$ dep ensure -add github.com/apache/calcite-avatica-go

If you are using Go 1.11 and above, install using Go modules:

$ go get github.com/apache/calcite-avatica-go

The Phoenix/Avatica driver implements Go's database/sql/driver interface, so, import the database/sql package and the driver:

import "database/sql"
import _ "github.com/apache/calcite-avatica-go/v3"

db, err := sql.Open("avatica", "http://localhost:8765")

Then simply use the database connection to query some data, for example:

rows := db.Query("SELECT COUNT(*) FROM test")

For more details, see the home page.

Release notes for all published versions are available on the history page.

Issues

We do not use Github to file issues. Please create an issue on Calcite's JIRA and select avatica-go as the component.

Documentation

Overview

Package avatica provides an Apache Phoenix Query Server/Avatica driver for Go's database/sql package.

Quickstart

Import the database/sql package along with the avatica driver.

import "database/sql"
import _ "github.com/apache/calcite-avatica-go/v3"

db, err := sql.Open("avatica", "http://phoenix-query-server:8765")

See https://calcite.apache.org/avatica/go_client_reference.html for more details

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(host string, authenticationConf httpClientAuthConfig) (*httpClient, error)

NewHTTPClient creates a new httpClient from a host.

Types

type Adapter

type Adapter interface {
	GetPingStatement() string
	GetColumnTypeDefinition(*message.ColumnMetaData) *internal.Column
	ErrorResponseToResponseError(*message.ErrorResponse) errors.ResponseError
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is a configuration parsed from a DSN string

func ParseDSN

func ParseDSN(dsn string) (*Config, error)

ParseDSN parses a DSN string to a Config

type Driver

type Driver struct{}

Driver is exported to allow it to be used directly.

func (*Driver) Open

func (a *Driver) Open(dsn string) (driver.Conn, error)

Open a Connection to the server. See https://github.com/apache/calcite-avatica-go#dsn for more information on how the DSN is formatted.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL