package db

import (
	"database/sql"

	_ "github.com/glebarez/go-sqlite"
)

type EmployeeStore struct {
	Db *sql.DB
}

func NewEmployeeStore(dbName string) (EmployeeStore, error) {
	Db, err := getConnection(dbName)
	if err != nil {
		return EmployeeStore{}, err
	}

	if err := createMigrations(dbName, Db); err != nil {
		return EmployeeStore{}, err
	}

	return EmployeeStore{
		Db,
	}, nil
}
