clickhouse-go – github.com/ClickHouse/clickhouse-go Index | Files | Directories

package clickhouse

import "github.com/ClickHouse/clickhouse-go"

Index

Constants

const (
	DefaultDatabase     = "default"
	DefaultUsername     = "default"
	DefaultReadTimeout  = time.Minute
	DefaultWriteTimeout = time.Minute
)

Variables

var (
	ErrInsertInNotBatchMode = errors.New("insert statement supported only in the batch mode (use begin/commit)")
	ErrLimitDataRequestInTx = errors.New("data request has already been prepared in transaction")
)
var InvalidUUIDFormatError = errors.New("invalid UUID format")

Functions

func Array

func Array(v interface{}) *types.Array

func ArrayDate

func ArrayDate(v []time.Time) *types.Array

func ArrayDateTime

func ArrayDateTime(v []time.Time) *types.Array

func ArrayFixedString

func ArrayFixedString(len int, v interface{}) *types.Array

func Open

func Open(dsn string) (driver.Conn, error)

func SetLogOutput

func SetLogOutput(output io.Writer)

Types

type Clickhouse

type Clickhouse interface {
	Block() (*data.Block, error)
	Prepare(query string) (driver.Stmt, error)
	Begin() (driver.Tx, error)
	Commit() error
	Rollback() error
	Close() error
	WriteBlock(block *data.Block) error
}

Interface for Clickhouse driver

func OpenDirect

func OpenDirect(dsn string) (Clickhouse, error)

type ColumnWriter

type ColumnWriter interface {
	WriteDate(c int, v time.Time) error
	WriteDateTime(c int, v time.Time) error
	WriteUInt8(c int, v uint8) error
	WriteUInt16(c int, v uint16) error
	WriteUInt32(c int, v uint32) error
	WriteUInt64(c int, v uint64) error
	WriteFloat32(c int, v float32) error
	WriteFloat64(c int, v float64) error
	WriteBytes(c int, v []byte) error
	WriteArray(c int, v *types.Array) error
	WriteString(c int, v string) error
	WriteFixedString(c int, v []byte) error
}

Interface for Block allowing writes to individual columns

type Date

type Date time.Time

Truncate timezone

clickhouse.Date(time.Date(2017, 1, 1, 0, 0, 0, 0, time.Local)) -> time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC)

func (Date) Value

func (date Date) Value() (driver.Value, error)

type DateTime

type DateTime time.Time

Truncate timezone

clickhouse.DateTime(time.Date(2017, 1, 1, 0, 0, 0, 0, time.Local)) -> time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC)

func (DateTime) Value

func (datetime DateTime) Value() (driver.Value, error)

type Exception

type Exception struct {
	Code       int32
	Name       string
	Message    string
	StackTrace string
	// contains filtered or unexported fields
}

func (*Exception) Error

func (e *Exception) Error() string

type IP

type IP net.IP

IP column type

func (IP) MarshalBinary

func (ip IP) MarshalBinary() ([]byte, error)

func (*IP) Scan

func (ip *IP) Scan(value interface{}) (err error)

Scan implements the driver.Valuer interface, json field interface

func (IP) String

func (ip IP) String() string

String implements the fmt.Stringer interface

func (IP) Value

func (ip IP) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface Alignment on the right side

type UUID

type UUID string

this type will be deprecated because the ClickHouse server (>=1.1.54276) has a built-in type UUID

func (UUID) MarshalBinary

func (str UUID) MarshalBinary() ([]byte, error)

func (*UUID) Scan

func (str *UUID) Scan(v interface{}) error

func (UUID) Value

func (str UUID) Value() (driver.Value, error)

Source Files

array.go bootstrap.go clickhouse.go clickhouse_exception.go clickhouse_ping.go clickhouse_profile_info.go clickhouse_progress.go clickhouse_read_block.go clickhouse_read_meta.go clickhouse_send_query.go clickhouse_write_block.go connect.go helpers.go ip.go result.go rows.go stmt.go uuid.go value_converter.go write_column.go

Directories

PathSynopsis
examples
lib
lib/binary
lib/column
lib/data
lib/protocol
lib/types
lib/writebuffer
Version
v1.3.4
Published
May 23, 2018
Platform
js/wasm
Imports
27 packages
Last checked
now

Tools for package owners.