PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
585 B

package Database
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"PackageManager/Variables"
)
var (
DB *sql.DB
)
func init() {
var e error
DB, e = sql.Open("sqlite3", Variables.DatabaseName)
if e != nil {
panic(e)
}
}
func InitDB() error {
var (
sqlStmt string
e error
)
sqlStmt = `
CREATE TABLE IF NOT EXISTS filesystem_hash (
id INTEGER NOT NULL PRIMARY KEY,
path VARCHAR(256),
hash VARCHAR(64),
created_at INTEGER DEFAULT CURRENT_TIMESTAMP,
updated_at INTEGER
)
`
_, e = DB.Exec(sqlStmt)
if e != nil {
return e
}
return nil
}