go-scopes/tests/storage_test.go

43 lines
902 B
Go

package scopes
import (
"fmt"
tbase "testing"
"git.sr.ht/~cco/go-scopes/common/testing"
"git.sr.ht/~cco/go-scopes/storage/sql"
_ "git.sr.ht/~cco/go-scopes/storage/sql/sqlite"
"git.sr.ht/~cco/go-scopes/tests/etc"
)
var (
cfg_sqlite *sql.Cfg
db_sqlite *sql.Storage
)
func TestSqlite(tb *tbase.T) {
cfg_sqlite = etc.ConfigSqlite()
db_sqlite = sql.Open(cfg_sqlite)
t := testing.SetUp(tb)
t.Run("sqlite-base", SqliteBaseTest)
}
func SqliteBaseTest(t *testing.T) {
fmt.Println(cfg_sqlite.Connstr)
}
// SQL statements
var sqlite_drop_table = `drop table test`
// note: ... integer ... primary key ... automatically fills row sequentially
var sqlite_create_table = `create table test (
id integer not null primary key,
label text)`
var sqlite_insert = `insert into test (label) values
('Hello World'),
('Good Afternoon')`
var sqlite_query = `select label from test
where id = $1`