Initial commit

This commit is contained in:
2022-06-30 02:35:37 +02:00
commit 8d16099c10
21 changed files with 4323 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
package database
type Database interface{}
+7
View File
@@ -0,0 +1,7 @@
package database
type memDB struct {}
func NewInMemoryDB() Database {
return &memDB{}
}
+19
View File
@@ -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
}