17 lines
260 B
Go
17 lines
260 B
Go
|
package database
|
||
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
_ "github.com/mattn/go-sqlite3"
|
||
|
)
|
||
|
|
||
|
const database string = "database/main.db"
|
||
|
|
||
|
func OpenDatabase() (*sql.DB, error) {
|
||
|
db, err := sql.Open("sqlite3", database)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return db, nil
|
||
|
}
|