package pqutil

import "github.com/lib/pq/internal/pqutil"

Index

Functions

func Home

func Home() string

Home gets the user's home directory. Matches pqGetHomeDirectory() from PostgreSQL

https://github.com/postgres/postgres/blob/2b117bb/src/interfaces/libpq/fe-connect.c#L8214

func Join

func Join[S ~[]E, E ~string](s S) string

func ParseBool

func ParseBool(str string) (bool, error)

ParseBool is like strconv.ParseBool, but also accepts "yes"/"no" and "on"/"off".

func Pgpass

func Pgpass(passfile string) string

Pgpass gets the filepath to the pgpass file to use, returning "" if a pgpass file shouldn't be used.

func User

func User() (string, error)

Perform Windows user name lookup identically to libpq.

The PostgreSQL code makes use of the legacy Win32 function GetUserName, and that function has not been imported into stock Go. GetUserNameEx is available though, the difference being that a wider range of names are available. To get the output to be the same as GetUserName, only the base (or last) component of the result is returned.

Source Files

path.go perm_unsupported.go pqutil.go user_windows.go

Version
v1.11.0
Published
Jan 28, 2026
Platform
windows/amd64
Imports
8 packages
Last checked
1 hour ago

Tools for package owners.