utils

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldListToJSON

func FieldListToJSON(fieldList []*telegraf.Field) ([]byte, error)

func FullTableName

func FullTableName(schema, name string) pgx.Identifier

FullTableName returns a sanitized table name with its schema (if supplied)

func GetTagID

func GetTagID(metric telegraf.Metric) int64

func QuoteIdentifier

func QuoteIdentifier(name string) string

QuoteIdentifier returns a sanitized string safe to use in SQL as an identifier

func QuoteLiteral

func QuoteLiteral(name string) string

QuoteLiteral returns a sanitized string safe to use in sql as a string literal

func TagListToJSON

func TagListToJSON(tagList []*telegraf.Tag) []byte

Types

type Column

type Column struct {
	Name string
	// the data type of each column should have in the db. used when checking
	// if the schema matches or it needs updates
	Type string
	// the role each column has, helps properly map the metric to the db
	Role ColumnRole
}

type ColumnList

type ColumnList []Column

ColumnList implements sort.Interface. Columns are sorted first into groups of time,tag_id,tags,fields, and then alphabetically within each group.

func (ColumnList) Len

func (cl ColumnList) Len() int

func (ColumnList) Less

func (cl ColumnList) Less(i, j int) bool

func (ColumnList) Sort

func (cl ColumnList) Sort()

func (ColumnList) Swap

func (cl ColumnList) Swap(i, j int)

type ColumnRole

type ColumnRole int

ColumnRole specifies the role of a column in a metric. It helps map the columns to the DB.

const (
	TimeColType ColumnRole = iota + 1
	TagsIDColType
	TagColType
	FieldColType
)

type PGXLogger

type PGXLogger struct {
	telegraf.Logger
}

PGXLogger makes telegraf.Logger compatible with pgx.Logger

func (PGXLogger) Log

func (l PGXLogger) Log(_ context.Context, level pgx.LogLevel, msg string, data map[string]interface{})

type WaitGroup

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

WaitGroup is similar to sync.WaitGroup, but allows interruptable waiting (e.g. a timeout).

func NewWaitGroup

func NewWaitGroup() *WaitGroup

func (*WaitGroup) Add

func (wg *WaitGroup) Add(i int32)

func (*WaitGroup) C

func (wg *WaitGroup) C() <-chan struct{}

func (*WaitGroup) Done

func (wg *WaitGroup) Done()

Jump to

Keyboard shortcuts

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