clickhouse

package
v0.0.0-...-c24cb56 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagRowBinary = 1 << iota
	FlagLZ4
)

Variables

View Source
var (
	// ErrMustBeSelect means that you sent something that is probably not a SELECT query.
	// We do not support other queries because we do not know where to send query without a table name.
	ErrMustBeSelect = errors.New("Query must be in form 'SELECT ... FROM table'")

	// ErrTooBigResult means that daemon would probably exceed maximum response size if full result is sent.
	ErrTooBigResult = fmt.Errorf("Result exceeds %d MiB", maxResultSize/(1<<20))

	// ErrTooBigResponse means that ClickHouse server was going to send too big of a response to INSERT
	ErrTooBigResponse = fmt.Errorf("Too big response from server")

	// ErrTemporarilyUnavailable means that there are no servers alive that have the requested table
	ErrTemporarilyUnavailable = errors.New("No servers available")
)

Functions

func Escape

func Escape(txt string) string

Escape escapes string for MySQL. It should work for ClickHouse as well.

func Flush

func Flush(dst *destination.Setting, table string, body []byte, rowBinary bool) error

Flush sends data to clickhouse and returns errors if any

func GetDestinationSetting

func GetDestinationSetting(tableName string) *destination.Setting

GetDestinationSetting returns setting for specified table name

func Init

func Init()

Init starts off useful goroutines

func IsSyntaxError

func IsSyntaxError(err error) bool

IsSyntaxError returns whether or not error was caused by wrong syntax in a query

func QueryDeadline

func QueryDeadline(deadline time.Time, query string) (httpCode int, res []byte, err error)

QueryDeadline performs supplied query at appropriate server. There is no limit on number of concurrent queries, so use this method with care.

func RunReverseProxy

func RunReverseProxy(listenAddr, chAddr string) error

RunReverseProxy starts a web server that proxies INSERTs and SELECTs to ClickHouse. INSERTs are grouped by query text in URL.

listenAddr is in form "0.0.0.0:1234"
chAddr     is the address of ClickHouse and must be in form "127.0.0.1:2345" as well

func UpdateDestinationsConfig

func UpdateDestinationsConfig(m destination.Map)

UpdateDestinationsConfig is used for QueryDeadline to determine where to send query.

Types

This section is empty.

Jump to

Keyboard shortcuts

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