Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions conformance_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package dalgo2sql

import (
"fmt"
"testing"

"github.com/dal-go/dalgo/dal"
"github.com/dal-go/dalgo/dalgotest"
)

// TestConformance runs the shared dalgotest suite against a real (in-memory)
// SQLite database, via the same modernc.org/sqlite driver already used by
// sql_map_get_test.go — no external database or env-gate is needed.
//
// dalgo2sql itself validates nothing (there is no Validate call anywhere in
// this adapter). Every check here passes because dal.NewDB's write pipeline
// runs BeforeSave validation and hooks before this adapter's code is ever
// entered — see database.go's NewDatabase.
func TestConformance(t *testing.T) {
createSQL := fmt.Sprintf(`CREATE TABLE %s (
ID TEXT PRIMARY KEY,
Name TEXT
)`, dalgotest.DefaultCollection)

opts := DbOptions{
Recordsets: map[string]*Recordset{
dalgotest.DefaultCollection: NewRecordset(
dalgotest.DefaultCollection, Table, []dal.FieldRef{dal.Field("ID")},
),
},
}

dalgotest.RunConformance(t, func(t *testing.T) (dal.DB, func()) {
sqlDB := openTestSQLiteDB(t, createSQL)
return NewDatabase(sqlDB, newSchema(), opts), nil
})
}
28 changes: 14 additions & 14 deletions coverage_additions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func TestUpdater_Errors(t *testing.T) {
t.Fatal(err)
}
defer closeDatabase(t, sqlDB)
db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
// no recordsets and no top-level PrimaryKey -> PrimaryKeyFieldNames returns nil
key := record.NewKeyWithID("users", "u1")
// update without primary key -> error
Expand All @@ -766,11 +766,11 @@ func TestUpdater_Errors(t *testing.T) {
t.Fatal(err)
}
defer closeDatabase(t, sqlDB)
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("a"), dal.Field("b")}),
},
}).(*database)
})).(*database)
key := record.NewKeyWithID("users", "u1")
err = db.Update(ctx, key, nil)
if !errors.Is(err, dal.ErrNotImplementedYet) {
Expand All @@ -784,11 +784,11 @@ func TestUpdater_Errors(t *testing.T) {
t.Fatal(err)
}
defer closeDatabase(t, sqlDB)
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)
mock.ExpectExec("UPDATE users SET").WillReturnError(errors.New("exec fail"))
err = db.Update(ctx, record.NewKeyWithID("users", "u1"), nil)
if err == nil {
Expand All @@ -802,11 +802,11 @@ func TestUpdater_Errors(t *testing.T) {
t.Fatal(err)
}
defer closeDatabase(t, sqlDB)
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)
mock.ExpectExec("UPDATE users SET").WillReturnError(errors.New("nope"))
err = db.UpdateMulti(ctx, []*record.Key{record.NewKeyWithID("users", "u1")}, nil)
if err == nil {
Expand All @@ -826,11 +826,11 @@ func TestInserter_Errors(t *testing.T) {
t.Fatal(err)
}
defer closeDatabase(t, sqlDB)
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)
mock.ExpectExec("INSERT INTO users").WillReturnError(errors.New("insert fail"))
rec := record.NewRecordWithData(record.NewKeyWithID("users", "u1"), &user{Name: "J"})
err = db.Insert(ctx, rec)
Expand Down Expand Up @@ -873,11 +873,11 @@ func TestDeleter_MultiInSingleTable_CustomPK(t *testing.T) {
}
defer closeDatabase(t, sqlDB)
ctx := context.Background()
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("uid")}),
},
}).(*database)
})).(*database)
keys := []*record.Key{
record.NewKeyWithID("users", "u1"),
record.NewKeyWithID("users", "u2"),
Expand All @@ -897,7 +897,7 @@ func TestDeleter_MultiInSingleTable_ExecError(t *testing.T) {
}
defer closeDatabase(t, sqlDB)
ctx := context.Background()
db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
keys := []*record.Key{
record.NewKeyWithID("users", "u1"),
record.NewKeyWithID("users", "u2"),
Expand All @@ -919,11 +919,11 @@ func TestSetter_SetMulti_Error(t *testing.T) {
}
defer closeDatabase(t, sqlDB)
ctx := context.Background()
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)
mock.ExpectBegin()
mock.ExpectQuery("SELECT ID FROM users WHERE ID = ?").
WithArgs("u1").
Expand Down
14 changes: 8 additions & 6 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/dal-go/dalgo/recordset"
)

var _ dal.DB = (*database)(nil)
var _ dal.Backend = (*database)(nil)

type database struct {
dal.ConcurrencyAvailable // SupportsConcurrentConnections() = true (standard SQL pool)
Expand Down Expand Up @@ -103,23 +103,25 @@ func (dtb *database) ExecuteQueryToRecordsReader(ctx context.Context, query dal.
return getRecordsReader(ctx, query, dtb.db.QueryContext)
}

var _ dal.DB = (*database)(nil)

// NewDatabase creates a new instance of DALgo adapter to SQL database
// NewDatabase creates a new instance of DALgo adapter to SQL database.
//
// The returned dal.DB is sealed by dal.NewDB: every read-write transaction it
// starts hands the worker a transaction whose writes run the framework's
// BeforeSave validation and hooks before reaching this adapter's code.
func NewDatabase(db *sql.DB, schema dal.Schema, options DbOptions) dal.DB {
if db == nil {
panic("db is a required parameter, got nil")
}
if schema == nil {
panic("schema is a required parameter, got nil")
}
return &database{
return dal.NewDB(&database{
recordsReaderProvider: recordsReaderProvider{
executeQuery: db.QueryContext,
},
id: options.ID,
db: db,
schema: schema,
options: options,
}
})
}
2 changes: 1 addition & 1 deletion database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestOptions_PrimaryKeyFieldNames(t *testing.T) {

func newDatabase(t *testing.T) (sqlDB *sql.DB, mock sqlmock.Sqlmock, db *database, closer func(), err error) {
sqlDB, mock, err = sqlmock.New()
db = NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db = dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
closer = func() {
closeDatabase(t, sqlDB)
}
Expand Down
14 changes: 7 additions & 7 deletions deleter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestDeleter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
key := record.NewKeyWithID("users", "u1")

mock.ExpectExec("DELETE FROM users WHERE ID = ?").
Expand All @@ -41,11 +41,11 @@ func TestDeleter(t *testing.T) {
defer closeDatabase(t, sqlDB)

rs := NewRecordset("users", Table, []dal.FieldRef{dal.Field("uid")})
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": rs,
},
}).(*database)
})).(*database)
key := record.NewKeyWithID("users", "u1")

mock.ExpectExec("DELETE FROM users WHERE uid = ?").
Expand All @@ -65,7 +65,7 @@ func TestDeleter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
keys := []*record.Key{
record.NewKeyWithID("users", "u1"),
record.NewKeyWithID("users", "u2"),
Expand All @@ -90,7 +90,7 @@ func TestDeleter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
keys := []*record.Key{
record.NewKeyWithID("users", "u1"),
record.NewKeyWithID("posts", "p1"),
Expand All @@ -112,7 +112,7 @@ func TestDeleter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
key := record.NewKeyWithID("users", "u1")

mock.ExpectExec("DELETE FROM users WHERE ID = ?").
Expand All @@ -132,7 +132,7 @@ func TestDeleter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{}).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{})).(*database)
keys := []*record.Key{
record.NewKeyWithID("users", "u1"),
record.NewKeyWithID("users", "u2"),
Expand Down
6 changes: 3 additions & 3 deletions end2end/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ go 1.25.0
toolchain go1.26.5

require (
github.com/dal-go/dalgo v0.63.2
github.com/dal-go/dalgo v0.64.2
github.com/dal-go/dalgo2sql v0.9.6 // No version as we alway replace it with local version
github.com/mattn/go-sqlite3 v1.14.48
)

replace github.com/dal-go/dalgo2sql => ./../

require (
github.com/RoaringBitmap/roaring/v2 v2.22.0 // indirect
github.com/RoaringBitmap/roaring/v2 v2.24.0 // indirect
github.com/bits-and-blooms/bitset v1.24.6 // indirect
github.com/dal-go/record v0.1.0 // indirect
github.com/dal-go/record v0.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/georgysavva/scany/v2 v2.1.4 // indirect
github.com/jackc/pgx/v5 v5.7.6 // indirect
Expand Down
14 changes: 6 additions & 8 deletions end2end/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/RoaringBitmap/roaring/v2 v2.22.0 h1:aGqjvTSkJSTP7W6q518EHiK9RRRb5gJbCaaciCFr/Lg=
github.com/RoaringBitmap/roaring/v2 v2.22.0/go.mod h1:SfT3of9nYh3vis1dIbCj4Yw6KQGujTN+f345nrN/0JA=
github.com/RoaringBitmap/roaring/v2 v2.24.0 h1:zQkkBZtG3WRP4j+P3A5DO221SvL1Br88TJkhyqEQRZo=
github.com/RoaringBitmap/roaring/v2 v2.24.0/go.mod h1:SfT3of9nYh3vis1dIbCj4Yw6KQGujTN+f345nrN/0JA=
github.com/bits-and-blooms/bitset v1.24.6 h1:qcrftZUVBIwfs+m+nhoCBAPT+ZPZZjti8SbHbDQQkZ4=
github.com/bits-and-blooms/bitset v1.24.6/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs=
github.com/cockroachdb/cockroach-go/v2 v2.2.0/go.mod h1:u3MiKYGupPPjkn3ozknpMUpxPaNLTFWAya419/zv6eI=
github.com/dal-go/dalgo v0.63.1 h1:GEJAGlNH5xGLdFasSIRrYdqGfd0+4A9DGQ843qJQbyA=
github.com/dal-go/dalgo v0.63.1/go.mod h1:LtD5XVzb1kAdXaRcWVNy4F2ROC4fqR4jqD3q/GD4fJQ=
github.com/dal-go/dalgo v0.63.2 h1:L3hDte5QaorZngNK619V1zKach4qfeb9jOQQUsn4vrc=
github.com/dal-go/dalgo v0.63.2/go.mod h1:LtD5XVzb1kAdXaRcWVNy4F2ROC4fqR4jqD3q/GD4fJQ=
github.com/dal-go/record v0.1.0 h1:hA4143oZwIgtBH/1BRTUEZMCpDfXQr3ONlVXX8USCNg=
github.com/dal-go/record v0.1.0/go.mod h1:quwsVJTT0f6y3Mhx+yHpTobY7luX1M6kyO6fdJ/AFYE=
github.com/dal-go/dalgo v0.64.2 h1:uWCRISCMTpuwjq+VKlymq3kBtdr0c09gcsr75zmeqrw=
github.com/dal-go/dalgo v0.64.2/go.mod h1:PZGzE0AqnaJgPEDTSo7ayfKZaoglhFQ9FxHecF3aQAc=
github.com/dal-go/record v0.1.1 h1:N2WVDBnm2tOb83h5DJqFyINB5kH0vLjKlYFAgCJWv2g=
github.com/dal-go/record v0.1.1/go.mod h1:quwsVJTT0f6y3Mhx+yHpTobY7luX1M6kyO6fdJ/AFYE=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
Expand Down
4 changes: 2 additions & 2 deletions getter_map_coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestMapDataGetIntoNilMapPointer(t *testing.T) {
name TEXT NOT NULL
)`
sqlDB := openTestSQLiteDB(t, createSQL)
db := NewDatabase(sqlDB, newSchema(), opts).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), opts)).(*database)

rec := record.NewRecordWithData(
record.NewKeyWithID("widgets", "w1"),
Expand Down Expand Up @@ -85,7 +85,7 @@ func TestMapDataGetBlobAsString(t *testing.T) {
payload BLOB NOT NULL
)`
sqlDB := openTestSQLiteDB(t, createSQL)
db := NewDatabase(sqlDB, newSchema(), opts).(*database)
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), opts)).(*database)

// Insert a genuine BLOB value directly so the driver returns []byte on read.
if _, err := sqlDB.Exec(`INSERT INTO blobs (id, payload) VALUES (?, ?)`, "b1", []byte("hello-blob")); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ toolchain go1.26.5

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/dal-go/dalgo v0.63.2
github.com/dal-go/record v0.1.0
github.com/dal-go/dalgo v0.64.2
github.com/dal-go/record v0.1.1
github.com/georgysavva/scany/v2 v2.1.4
modernc.org/sqlite v1.54.0
)

require (
github.com/RoaringBitmap/roaring/v2 v2.22.0 // indirect
github.com/RoaringBitmap/roaring/v2 v2.24.0 // indirect
github.com/bits-and-blooms/bitset v1.24.6 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/RoaringBitmap/roaring/v2 v2.22.0 h1:aGqjvTSkJSTP7W6q518EHiK9RRRb5gJbCaaciCFr/Lg=
github.com/RoaringBitmap/roaring/v2 v2.22.0/go.mod h1:SfT3of9nYh3vis1dIbCj4Yw6KQGujTN+f345nrN/0JA=
github.com/RoaringBitmap/roaring/v2 v2.24.0 h1:zQkkBZtG3WRP4j+P3A5DO221SvL1Br88TJkhyqEQRZo=
github.com/RoaringBitmap/roaring/v2 v2.24.0/go.mod h1:SfT3of9nYh3vis1dIbCj4Yw6KQGujTN+f345nrN/0JA=
github.com/bits-and-blooms/bitset v1.24.6 h1:qcrftZUVBIwfs+m+nhoCBAPT+ZPZZjti8SbHbDQQkZ4=
github.com/bits-and-blooms/bitset v1.24.6/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs=
github.com/cockroachdb/cockroach-go/v2 v2.2.0/go.mod h1:u3MiKYGupPPjkn3ozknpMUpxPaNLTFWAya419/zv6eI=
github.com/dal-go/dalgo v0.63.1 h1:GEJAGlNH5xGLdFasSIRrYdqGfd0+4A9DGQ843qJQbyA=
github.com/dal-go/dalgo v0.63.1/go.mod h1:LtD5XVzb1kAdXaRcWVNy4F2ROC4fqR4jqD3q/GD4fJQ=
github.com/dal-go/dalgo v0.63.2 h1:L3hDte5QaorZngNK619V1zKach4qfeb9jOQQUsn4vrc=
github.com/dal-go/dalgo v0.63.2/go.mod h1:LtD5XVzb1kAdXaRcWVNy4F2ROC4fqR4jqD3q/GD4fJQ=
github.com/dal-go/record v0.1.0 h1:hA4143oZwIgtBH/1BRTUEZMCpDfXQr3ONlVXX8USCNg=
github.com/dal-go/record v0.1.0/go.mod h1:quwsVJTT0f6y3Mhx+yHpTobY7luX1M6kyO6fdJ/AFYE=
github.com/dal-go/dalgo v0.64.2 h1:uWCRISCMTpuwjq+VKlymq3kBtdr0c09gcsr75zmeqrw=
github.com/dal-go/dalgo v0.64.2/go.mod h1:PZGzE0AqnaJgPEDTSo7ayfKZaoglhFQ9FxHecF3aQAc=
github.com/dal-go/record v0.1.1 h1:N2WVDBnm2tOb83h5DJqFyINB5kH0vLjKlYFAgCJWv2g=
github.com/dal-go/record v0.1.1/go.mod h1:quwsVJTT0f6y3Mhx+yHpTobY7luX1M6kyO6fdJ/AFYE=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
Expand Down
4 changes: 2 additions & 2 deletions inserter_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ func newUsersDatabaseWithMock(t *testing.T) (*database, sqlmock.Sqlmock, func())
if err != nil {
t.Fatal(err)
}
db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)
return db, mock, func() { closeDatabase(t, sqlDB) }
}

Expand Down
8 changes: 4 additions & 4 deletions inserter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ func TestInserter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)

u := user{Name: "u1"}
record := dalrecord.NewRecordWithData(dalrecord.NewKeyWithID("users", "id1"), &u)
Expand All @@ -49,11 +49,11 @@ func TestInserter(t *testing.T) {
}
defer closeDatabase(t, sqlDB)

db := NewDatabase(sqlDB, newSchema(), DbOptions{
db := dal.BackendOf(NewDatabase(sqlDB, newSchema(), DbOptions{
Recordsets: map[string]*Recordset{
"users": NewRecordset("users", Table, []dal.FieldRef{dal.Field("ID")}),
},
}).(*database)
})).(*database)

records := []dalrecord.Record{
dalrecord.NewRecordWithData(dalrecord.NewKeyWithID("users", "id1"), &user{Name: "u1"}),
Expand Down
Loading