package pqutil
import "github.com/lib/pq/internal/pqutil"
Index ¶
- Variables
- func Home() string
- func Join[S ~[]E, E ~string](s S) string
- func ParseBool(str string) (bool, error)
- func Pgpass(passfile string) string
- func SSLKeyPermissions(sslkey string) error
- func User() (string, error)
Variables ¶
var ( ErrSSLKeyUnknownOwnership = errors.New("pq: could not get owner information for private key, may not be properly protected") ErrSSLKeyHasWorldPermissions = errors.New("pq: private key has world access; permissions should be u=rw,g=r (0640) if owned by root, or u=rw (0600), or less") )
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 ParseBool ¶
ParseBool is like strconv.ParseBool, but also accepts "yes"/"no" and "on"/"off".
func Pgpass ¶
Pgpass gets the filepath to the pgpass file to use, returning "" if a pgpass file shouldn't be used.
func SSLKeyPermissions ¶
SSLKeyPermissions checks the permissions on user-supplied SSL key files, which should have very little access. libpq does not check key file permissions on Windows.
If the file is owned by the same user the process is running as, the file should only have 0600. If the file is owned by root, and the group matches the group that the process is running in, the permissions cannot be more than 0640. The file should never have world permissions.
Returns an error when the permission check fails.
func User ¶
Source Files ¶
path.go perm.go pqutil.go user_posix.go
- Version
- v1.11.2
- Published
- Feb 10, 2026
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 hours ago –
Tools for package owners.