package main import ( "database/sql" "log" "git.nochill.in/nochill/hiling_go/api" db "git.nochill.in/nochill/hiling_go/db/sqlc" "git.nochill.in/nochill/hiling_go/util" _ "github.com/lib/pq" ) // "database/sql"? // "git.nochill.in/nochill/naice_pos/util" func main() { config, err := util.LoadConfig(".") if err != nil { log.Fatal("cannot load config: ", err) } dbConn, err := sql.Open(config.DBDriver, config.DBSource) if err != nil { log.Fatal("cannot connect to db: ", err) } // limit db connection dbConn.SetConnMaxLifetime(100) dbConn.SetMaxOpenConns(100) store := db.NewStore(dbConn) server, err := api.NewServer(config, store) if err != nil { log.Fatal("cannot make server: ", err) } err = server.Start(config.ServerAddress) if err != nil { log.Fatal("cannot start server: ", err) } }