Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionInfo ¶
type ConnectionInfo struct {
Host string `env:"PGHOST" envDefault:"localhost"`
Port uint16 `env:"PGPORT" envDefault:"5432"`
User string `env:"PGUSER" envDefault:"postgres"`
Database string `env:"PGDATABASE" envDefault:"postgres"`
Password string `env:"PGPASS"`
}
func LoadConnectionInfoEnv ¶
func LoadConnectionInfoEnv() *ConnectionInfo
func LoadConnectionInfoWithConfigFile ¶
func LoadConnectionInfoWithConfigFile(configFile *config.ConfigEnvironment) *ConnectionInfo
func NewConnectionInfo ¶
func (*ConnectionInfo) String ¶
func (c *ConnectionInfo) String() string
type PgxIface ¶
type PgxIface interface {
Begin(context.Context) (pgx.Tx, error)
Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
QueryRow(context.Context, string, ...interface{}) pgx.Row
Query(context.Context, string, ...interface{}) (pgx.Rows, error)
Ping(context.Context) error
Prepare(context.Context, string, string) (*pgconn.StatementDescription, error)
Close(context.Context) error
}
func Connect ¶
func Connect(connectionInfo *ConnectionInfo) PgxIface
creates a pgx connection to postgres database
Click to show internal directories.
Click to hide internal directories.