feat(db): implement basic db
This commit is contained in:
+32
-1
@@ -1 +1,32 @@
|
||||
package cmd
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/database"
|
||||
)
|
||||
|
||||
var config pq.Config
|
||||
|
||||
func main() {
|
||||
handleflag()
|
||||
|
||||
database.OpenDB(config)
|
||||
defer database.CloseDB()
|
||||
|
||||
for {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func handleflag() {
|
||||
config.SSLMode = pq.SSLModePrefer
|
||||
flag.StringVar(&config.Host, "dbhost", "localhost", "Postgres host")
|
||||
config.Port = uint16(*flag.Uint("dbport", 5432, "Postgres port"))
|
||||
flag.StringVar(&config.Database, "dbname", "postgres", "Postgres db name")
|
||||
flag.StringVar(&config.User, "dbuser", "postgres", "Postgres user")
|
||||
flag.StringVar(&config.Password, "dbpass", "", "Postgres password")
|
||||
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user