hltscl

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePool

func CreatePool(conf PgConf) (*pgxpool.Pool, error)

Types

type Entry

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

func (*Entry) Bool added in v0.0.4

func (e *Entry) Bool(key string, value bool) *Entry

func (*Entry) ExportForSQL

func (e *Entry) ExportForSQL(table, tsCol string) (string, []any)

func (*Entry) Float

func (e *Entry) Float(key string, value float64) *Entry

func (*Entry) Int

func (e *Entry) Int(key string, value int) *Entry

func (*Entry) Str

func (e *Entry) Str(key, value string) *Entry

func (*Entry) String added in v0.0.4

func (e *Entry) String() string

type OptsFn added in v0.1.0

type OptsFn func(*optItems)

func WithBufferSize added in v0.1.0

func WithBufferSize(size int) OptsFn

func WithMinTimeout added in v0.2.0

func WithMinTimeout(tm time.Duration) OptsFn

func WithTimeout added in v0.1.0

func WithTimeout(tm time.Duration) OptsFn

type PgConf

type PgConf struct {
	User   string `json:"user"`
	Passwd string `json:"passwd"`
	Host   string `json:"host"`
	Port   int    `json:"port"`
	DBName string `json:"dbName"`
}

func (PgConf) CreateConnString

func (conf PgConf) CreateConnString() string

CreateConnString produces Postgres connection string with the form: "postgres://username:password@host:port/dbname"

type TableWriter

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

func NewTableWriter

func NewTableWriter(conn *pgxpool.Pool, name, tsColName string, loc *time.Location) *TableWriter

func (*TableWriter) Activate

func (table *TableWriter) Activate(ctx context.Context, opts ...OptsFn) (chan<- Entry, <-chan WriteError)

Activate starts TimescaleDB writer and provides a writing channel to the client along with a reading channel for error reporting. Writing uses an adaptive timeout to prevent flooding of the incoming channel with requests in case the target database cannot handle queries.

defaults:

defaultTimeout = 10 * time.Second
defaultMinTimeout = 1 * time.Second
defaultBufferSize = 100

func (*TableWriter) CurrentQueryTimeout added in v0.2.0

func (table *TableWriter) CurrentQueryTimeout() time.Duration

func (*TableWriter) NewEntry

func (table *TableWriter) NewEntry(ts time.Time) *Entry

type WriteError

type WriteError struct {
	Entry Entry
	Err   error
}

Jump to

Keyboard shortcuts

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