Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DSNOption ¶
type DSNOption func(*PostgreSQLDSN)
DSNOption defines a function that configures a PostgreSQLDSN.
func WithDBName ¶
WithDBName sets the database name for the DSN.
func WithPassword ¶
WithPassword sets the password for the DSN.
func WithSSLMode ¶
WithSSLMode sets the SSL mode for the DSN.
func WithUsername ¶
WithUsername sets the username for the DSN.
type PostgreSQLDSN ¶
type PostgreSQLDSN struct {
Addr string `json:"addr"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
DBName string `json:"dbname"`
SSLMode SSLMode `json:"sslmode"`
}
func NewDSN ¶
func NewDSN(opts ...DSNOption) *PostgreSQLDSN
NewDSN creates a new PostgreSQLDSN with the given options.
func (PostgreSQLDSN) DSN ¶
func (p PostgreSQLDSN) DSN() string
func (*PostgreSQLDSN) Info ¶
func (p *PostgreSQLDSN) Info() string
Info implements database.DataSourceNamer.
func (PostgreSQLDSN) Type ¶
func (p PostgreSQLDSN) Type() database.Type
Type implements database.DataSourceNamer.
Click to show internal directories.
Click to hide internal directories.