pgpassfile

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: MIT Imports: 5 Imported by: 46 modules, 48 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.

README

Build Status

pgpassfile

Package pgpassfile is a parser PostgreSQL .pgpass files.

Extracted and rewritten from original implementation in https://github.com/jackc/pgx.

Documentation

Overview

Package pgpassfile is a parser PostgreSQL .pgpass files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Hostname string
	Port     string
	Database string
	Username string
	Password string
}

Entry represents a line in a PG passfile.

type Passfile

type Passfile struct {
	Entries []*Entry
}

Passfile is the in memory data structure representing a PG passfile.

func ParsePassfile

func ParsePassfile(r io.Reader) (*Passfile, error)

ParsePassfile reads r and parses it into a Passfile.

func ReadPassfile

func ReadPassfile(path string) (*Passfile, error)

ReadPassfile reads the file at path and parses it into a Passfile.

func (*Passfile) FindPassword

func (pf *Passfile) FindPassword(hostname, port, database, username string) (password string)

FindPassword finds the password for the provided hostname, port, database, and username. For a Unix domain socket hostname must be set to "localhost". An empty string will be returned if no match is found.

See https://www.postgresql.org/docs/current/libpq-pgpass.html for more password file information.

Jump to

Keyboard shortcuts

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