23 lines
255 B
Go
23 lines
255 B
Go
|
package db
|
||
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
|
||
|
_ "github.com/mattn/go-sqlite3"
|
||
|
)
|
||
|
|
||
|
type DB struct {
|
||
|
DB *sql.DB
|
||
|
}
|
||
|
|
||
|
func NewDB(path string) (*DB, error) {
|
||
|
db, err := sql.Open("sqlite3", path)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &DB{
|
||
|
DB: db,
|
||
|
}, nil
|
||
|
}
|