Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Service = dependency.Service{ ConfigFunc: func(set dependency.FlagSet) { set.String("postgres-dbname", "postgres", "The name of the database to connect to") set.String("postgres-user", "postgres", "The name of the user to connect to the postgres db with") set.String("postgres-password", "", "The password to connect to the postgres database") set.String("postgres-host", "localhost", "The host to connect to the postgres database on") set.Int("postgres-port", 5432, "The port to connect to the postgres database on") set.String("postgres-sslmode", "disable", "What sslmode to use with the postgres database") set.String("postgres-fallback-application-name", "", "An application_name for postgres to fall back to if one isn't provided.") set.Duration("postgres-connect-timeout", 0, "Maximum wait for connection, 0 means wait indefinitely") set.String("postgres-sslcert", "", "Cert file location. The file must contain PEM encoded data.") set.String("postgres-sslkey", "", "Key file location. The file must contain PEM encoded data.") set.String("postgres-sslrootkey", "", "The location of the root certificate file. The file must contain PEM encoded data.") }, Dependencies: fx.Provide( NewConfig, NewSQLX, ), Constructor: NewFactory().DB, }
Service defines the configuration and constructors required to get a postgres *sql.DB
Functions ¶
Types ¶
type Config ¶
type Config struct { DBName string User string Password string Host string Port int SSLMode string FallbackApplicationName string ConnectTimeout time.Duration SSLCert string SSLKey string SSLRootCert string }
Config defines the configuration required to create a postgres database connection
func NewConfig ¶
func NewConfig(config dependency.ConfigGetter) Config
NewConfig creates a new instance of the configuration from app configuration
type Factory ¶
Factory is a type that can create
func NewFactory ¶
func NewFactory() Factory
NewFactory creates a new instance of a Factory that can create postgres *sql.DBs
Click to show internal directories.
Click to hide internal directories.