feat(rdb): add sqlite as a dependency
This commit is contained in:
parent
cb478ca266
commit
f95a611204
6 changed files with 90 additions and 19 deletions
25
src/db/rdb/sqlite/sqlite.go
Normal file
25
src/db/rdb/sqlite/sqlite.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue