db

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignArrayPropertyFromString

func AssignArrayPropertyFromString(st interface{}, field string, arrString string, delimiter string) error

Function mostly from https://coderedirect.com/questions/432349/golang-dynamic-access-to-a-struct-property A function that splits a string based on a delimiter and assigns it to a slice in a struct's field Ex: a struct 's' with field 'MyArr', and string "val1::val2::val3"

This function will assign ["val1", "val2", "val3"] into s.MyArr

func CheckAndRetry

func CheckAndRetry(checkerFunc func() error, maxTries int, secondsToWait int, debug bool) (err error)

func CheckDBConnection

func CheckDBConnection(dbConn *sql.DB, maxTries int, secondsToWait int, debug bool) error

func CheckRedisConnection

func CheckRedisConnection(redisClient *redis.Client, maxTries int, secondsToWait int, debug bool) error

func CheckRequiredPostgresEnvs

func CheckRequiredPostgresEnvs(envVarPrefix string)

func CheckRequiredRedisEnvs

func CheckRequiredRedisEnvs(envVarPrefix string, useTLS bool)

func CheckStructFieldsForInjection

func CheckStructFieldsForInjection(st interface{}) error

Generally this function isn't necessary because we use prepared statements, but more safety is good

func InitPostgres

func InitPostgres(envVarPrefix string, debug bool) (dbConn *sql.DB)

func InitPostgresMigrations

func InitPostgresMigrations(dbConn *sql.DB, maxMsToWait int, isRunningLocally bool, debug bool)

func InitRedis

func InitRedis(envVarPrefix string, useTLS bool, debug bool) (redisClient *redis.Client)

func ValidateDBConnOrPanic

func ValidateDBConnOrPanic(dbConn *sql.DB, debug bool)

func ValidateRedisConnOrPanic

func ValidateRedisConnOrPanic(redisClient *redis.Client, debug bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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