Closed mikedonnici closed 6 years ago
Trying to keep this simple, and in most cases, a datastore will be set up from the env vars. Here's an example of setting up the datastore with only MySQL:
func main() {
envr.New("testEnv", []string{
"MAPPCPD_MYSQL_DESC",
"MAPPCPD_MYSQL_URL",
}).Auto()
ds := datastore.New()
ds.MySQL = datastore.MySQLConnection{
DSN: os.Getenv("MAPPCPD_MYSQL_URL"),
Description: os.Getenv("MAPPCPD_MYSQL_DESC"),
}
err := ds.ConnectMySQL()
if err != nil {
fmt.Println(err)
}
err = ds.MySQL.Session.Ping()
if err != nil {
fmt.Println(err)
}
fmt.Println("Connected!")
}
Have completed this one - still need to refactor alg
', fixr
etc, and write up the datastore
README
The
datastore
package is directly tied to env vars - time to clean this up.