package database

import (
	"database/sql"
	"fmt"
	_ "github.com/lib/pq"
)

const (
	host     = "localhost"
	port     = 5432
	user     = "svevijesti"
	password = "salmonela pljusti 221 hamo"
	dbname   = "svevijestiweb"
)

type Store = sql.DB

func Connect() (*Store, error) {
	psqlInfo := fmt.Sprintf("host=%s port=%d user=%s "+
		"password='%s' dbname=%s sslmode=disable",
		host, port, user, password, dbname)
	db, err := sql.Open("postgres", psqlInfo)
	return db, err
}
