utils

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 DisableSuperuserPassword added in v1.18.5

func DisableSuperuserPassword(db *sql.DB) error

DisableSuperuserPassword disables the password for the `postgres` user

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

func SetUserPassword added in v1.18.5

func SetUserPassword(username string, password string, db *sql.DB) error

SetUserPassword change the password of a user in the PostgreSQL database

Types

This section is empty.

Jump to

Keyboard shortcuts

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