Open initializes a new connection to the sqlite database
(dbPath string)
| 117 | |
| 118 | // Open initializes a new connection to the sqlite database |
| 119 | func Open(dbPath string) (*DB, error) { |
| 120 | dbConn, err := sql.Open("sqlite3", dbPath) |
| 121 | if err != nil { |
| 122 | return nil, errors.Wrap(err, "opening db connection") |
| 123 | } |
| 124 | |
| 125 | db := &DB{ |
| 126 | Conn: dbConn, |
| 127 | Filepath: dbPath, |
| 128 | } |
| 129 | |
| 130 | return db, nil |
| 131 | } |