Documentation ¶
Index ¶
- Constants
- func CreateDatabaseIfNotExists(postgresDbConfig *Config) (bool, error)
- func ExecuteStatement(db *sql.DB, sqlStatement string) error
- type Config
- func (c *Config) GetDbName() string
- func (c *Config) GetHost() string
- func (c *Config) GetPassword() string
- func (c *Config) GetPort() uint16
- func (c *Config) GetSSLMode() string
- func (c *Config) GetUser() string
- func (c *Config) MakeConnectString() string
- func (c *Config) MakeConnectStringWithoutDB() string
Constants ¶
const DateFormatString = "2006/01/02"
DateFormatString is the format to be used when converting a timestamp to a date
const TimestampFormatString = "2006/01/02 15:04:05 MST"
TimestampFormatString is the format to be used when inserting timestamps in the database
Variables ¶
This section is empty.
Functions ¶
func CreateDatabaseIfNotExists ¶
CreateDatabaseIfNotExists returns whether the db was created and an error if creation failed
Types ¶
type Config ¶
type Config struct { Host string `toml:"HOST"` Port uint16 `toml:"PORT"` DbName string `toml:"DB_NAME"` User string `toml:"USER"` Password string `toml:"PASSWORD"` SSLEnable bool `toml:"SSL_ENABLE"` }
Config takes in the information needed to connect to a postgres database
func (*Config) GetPassword ¶
GetPassword returns the password to the database, no defaulting
func (*Config) GetSSLMode ¶
GetSSLMode returns the sslmode string to the database after converting the input boolean value
func (*Config) MakeConnectString ¶
MakeConnectString returns the string to be used to open this db
func (*Config) MakeConnectStringWithoutDB ¶
MakeConnectStringWithoutDB returns the string to be used when connecting to a postgres instance without a database