storage/sql: add a SQL storage implementation

This change adds support for SQLite3, and Postgres.
This commit is contained in:
Eric Chiang
2016-09-14 18:11:57 -07:00
committed by Eric Chiang
parent 82a55cf785
commit 87a7d093b2
10 changed files with 1116 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package sql
import (
"database/sql"
"testing"
)
func TestMigrate(t *testing.T) {
db, err := sql.Open("sqlite3", ":memory:")
if err != nil {
t.Fatal(err)
}
defer db.Close()
c := &conn{db, flavorSQLite3}
for _, want := range []int{len(migrations), 0} {
got, err := c.migrate()
if err != nil {
t.Fatal(err)
}
if got != want {
t.Errorf("expected %d migrations, got %d", want, got)
}
}
}