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 }