avatica

package module
v5.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 32 Imported by: 11

README

Apache Avatica/Phoenix SQL Driver

Go Reference 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

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/v5"

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. For further information, please see the JIRA accounts guide.

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/v5"

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnector

func NewConnector(dsn string) driver.Connector

NewConnector creates a new connector

func NewHTTPClient

func NewHTTPClient(host string, baseClient *http.Client, config *Config) (*httpClient, error)

NewHTTPClient creates a new httpClient from a host.

func WithAdditionalHeaders

func WithAdditionalHeaders(cli *http.Client, headers http.Header) *http.Client

WithAdditionalHeaders wraps a http client to always include the given set of headers

func WithBasicAuth

func WithBasicAuth(cli *http.Client, username, password string) *http.Client

WithBasicAuth takes a http client and prepares it to authenticate using basic authentication

func WithDigestAuth

func WithDigestAuth(cli *http.Client, username, password string) *http.Client

WithDigestAuth takes a http client and prepares it to authenticate using digest authentication

func WithKerberosAuth

func WithKerberosAuth(cli *http.Client, username, realm, keyTab, krb5Conf, krb5CredentialCache string) (*http.Client, error)

WithKerberosAuth takes a http client prepares it to authenticate using kerberos

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 Connector

type Connector struct {
	Info   map[string]string
	Client *http.Client
	// contains filtered or unexported fields
}

Connector implements the driver.Connector interface

func (*Connector) Connect

func (c *Connector) Connect(context.Context) (driver.Conn, error)

func (*Connector) Driver

func (c *Connector) Driver() driver.Driver

Driver returns the underlying driver

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