feat(rdb): add sqlite as a dependency

This commit is contained in:
hexxa 2022-08-30 15:54:46 +08:00 committed by Hexxa
parent cb478ca266
commit f95a611204
6 changed files with 90 additions and 19 deletions

View file

@ -0,0 +1,25 @@
package sqlite
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"github.com/ihexxa/quickshare/src/db/rdb"
)
type SQLite struct {
rdb.IDB
dbPath string
}
func NewSQLite(dbPath string) (*SQLite, error) {
db, err := sql.Open("sqlite3", dbPath)
if err != nil {
return nil, err
}
return &SQLite{
IDB: db,
dbPath: dbPath,
}, nil
}