postgres

package
v1.3.24 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_DIAL_TIMEOUT = 10 * 1000 // 10 seconds in milliseconds
View Source
const DEFAULT_READ_TIMEOUT = 30 * 1000 // 30 seconds in milliseconds
View Source
const DEFAULT_STATEMENT_TIMEOUT = 30 * 1000 // 30 seconds in milliseconds
View Source
const DEFAULT_WRITE_TIMEOUT = 20 * 1000 // 20 seconds in milliseconds

Variables

This section is empty.

Functions

func ConnectToDatabase

func ConnectToDatabase(cfg *ConnectionConfig) (*relational.DB, error)

ConnectToDatabase - Creates a new connection to a PSQL database with the given configuration.

func CreateDatabase

func CreateDatabase(cfg ConnectionConfig) error

CreateDatabase - Creates a new database with the given configuration

func DeleteDatabase

func DeleteDatabase(cfg ConnectionConfig) error

DeleteDatabase - Deletes an existing database with the given configuration

Types

type ConnectionConfig

type ConnectionConfig struct {
	Username         string `mapstructure:"username"`
	Password         string `mapstructure:"password"`
	Host             string `mapstructure:"host"`
	Database         string `mapstructure:"database"`
	SSL              bool   `mapstructure:"ssl"`
	Verbose          bool   `mapstructure:"verbose"`
	DialTimeout      int    `mapstructure:"dial_timeout"`
	ReadTimeout      int    `mapstructure:"read_timeout"`
	WriteTimeout     int    `mapstructure:"write_timeout"`
	StatementTimeout int    `mapstructure:"statement_timeout"` // Timeout in miliseconds for how long can a statement last before being canceled
}

Jump to

Keyboard shortcuts

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