Documentation ¶
Overview ¶
Package utils holds generic utils about postgres instances
Index ¶
- func DBToFloat64(t interface{}) (float64, bool)
- func DBToString(t interface{}) (string, bool)
- func DBToUint64(t interface{}) (uint64, bool)
- func DisableSuperuserPassword(db *sql.DB) error
- func GetAllAccessibleDatabases(tx *sql.Tx, whereClause string) (databases []string, errors []error)
- func GetMajorVersion(pgData string) (int, error)
- func GetPgVersion(db *sql.DB) (*semver.Version, error)
- func SetUserPassword(username string, password string, db *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBToFloat64 ¶
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 ¶
DBToString convert a dynamic type to string for Prometheus labels. Null types are mapped to empty strings.
func DBToUint64 ¶
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
DisableSuperuserPassword disables the password for the `postgres` user
func GetAllAccessibleDatabases ¶
GetAllAccessibleDatabases returns the list of all the accessible databases using the superuser
func GetMajorVersion ¶
GetMajorVersion read the PG_VERSION file in the data directory returning the major version of the database
func GetPgVersion ¶
GetPgVersion returns the version of postgres in a semantic format or an error
Types ¶
This section is empty.