Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
package database
|
||||
|
||||
type Database interface{}
|
||||
@@ -0,0 +1,7 @@
|
||||
package database
|
||||
|
||||
type memDB struct {}
|
||||
|
||||
func NewInMemoryDB() Database {
|
||||
return &memDB{}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package database
|
||||
|
||||
import "database/sql"
|
||||
|
||||
// Uncomment if actually using SQLite, the first build will be fairly slow
|
||||
// import _ "github.com/mattn/go-sqlite3"
|
||||
|
||||
type sqliteDatabase struct {
|
||||
Db *sql.DB
|
||||
}
|
||||
|
||||
func NewSQLite(filename string) (Database, error) {
|
||||
db, err := sql.Open("sqlite3", filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &sqliteDatabase{db}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user