Documentation
¶
Overview ¶
Package sqlite provides a PostgreSQL based database configuration.
Index ¶
Constants ¶
const Type database.Type = "postgres"
Type of PostgreSQL database configurations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents the PostgreSQL database configuration.
func NewConfig ¶
func NewConfig(dbName, user, password string, options ...ConfigSetter) (*Config, error)
NewConfig creates a new PostgreSQL database configuration using the given options.
This function uses to pgx.ParseConfig to parse the connection string and create the actual connection config. As a result the acompanying features are active as well.
func (*Config) DriverName ¶
DriverName gets the name of the sql driver providing access to the database represented by this configuration.
func (*Config) Name ¶ added in v0.0.2
Name gets the name of the database represented by this configuration.
func (*Config) RedactedDSN ¶
DSN get the Data Source Name with any sensitive data redacted.
func (*Config) SchemaScripts ¶
SchemaScripts gets the schema updated scripts to be applied to the database during schema initialization or a schema update.
type ConfigSetter ¶
type ConfigSetter interface {
Apply(*Config)
}
ConfigSetter interface is used to set database configuration options during a NewConfig call.
func WithAddress ¶
func WithAddress(address string) ConfigSetter
WithAddress sets the address string to use to connect to the PostgreSQL database.
func WithOption ¶ added in v0.0.2
func WithOption(key, value string) ConfigSetter
WithOption adds a PostgreSQL specific option to the DSN.
func WithOptions ¶ added in v0.0.2
func WithOptions(options map[string]string) ConfigSetter
WithOptions adds PostgreSQL specific options to the DSN.
func WithSchemaScripts ¶
func WithSchemaScripts(scripts ...[]byte) ConfigSetter
WithSchemaScripts defines the schema update scripts to be applied during database schema update.
type ConfigSetterFunc ¶
type ConfigSetterFunc func(*Config)
ConfigSetterFunc functions are used to set database configuration options during a NewConfig call.
func (ConfigSetterFunc) Apply ¶
func (f ConfigSetterFunc) Apply(c *Config)
type PGXConnConfigSetterFunc ¶ added in v0.0.2
type PGXConnConfigSetterFunc func(*pgx.ConnConfig)
PGXConnConfigSetterFunc functions are used to set pgx.ConnConfig specific options.
func (PGXConnConfigSetterFunc) Apply ¶ added in v0.0.2
func (f PGXConnConfigSetterFunc) Apply(c *Config)