utils

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package utils holds generic utils about postgres instances

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBToFloat64

func DBToFloat64(t interface{}) (float64, bool)

DBToFloat64 convert a dynamic value to float64s for Prometheus consumption. Null types are mapped to NaN. string and []byte types are mapped as NaN and !ok

func DBToString

func DBToString(t interface{}) (string, bool)

DBToString convert a dynamic type to string for Prometheus labels. Null types are mapped to empty strings.

func DBToUint64

func DBToUint64(t interface{}) (uint64, bool)

DBToUint64 convert a dynamic type to uint64 for Prometheus consumption. Null types are mapped to 0. string and []byte types are mapped as 0 and !ok

func GetAllAccessibleDatabases

func GetAllAccessibleDatabases(tx *sql.Tx, whereClause string) (databases []string, errors []error)

GetAllAccessibleDatabases returns the list of all the accessible databases using the superuser

func GetMajorVersion

func GetMajorVersion(pgData string) (int, error)

GetMajorVersion read the PG_VERSION file in the data directory returning the major version of the database

func GetPgVersion

func GetPgVersion(db *sql.DB) (*semver.Version, error)

GetPgVersion returns the version of postgres in a semantic format or an error

Types

This section is empty.

Jump to

Keyboard shortcuts

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