19 lines
323 B
Go
19 lines
323 B
Go
package database
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"gorm.io/driver/sqlite"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Connect opens a SQLite database connection.
|
|
func Connect(dbPath string) (*gorm.DB, error) {
|
|
db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
|
if err != nil {
|
|
return nil, fmt.Errorf("open database: %w", err)
|
|
}
|
|
|
|
return db, nil
|
|
}
|