Peter Kurfer
9ea9a8f658
Some checks failed
Go build / build (push) Failing after 1m58s
- setup ent scheme - add command to create users - document API - add helpers to create migrations - add command to run migrations - add basic compose file
19 lines
395 B
Go
19 lines
395 B
Go
package dbtest
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect"
|
|
)
|
|
|
|
func TestDatabaseForDialect(ctx context.Context, dbDialect string) (string, DbCloser, error) {
|
|
switch dbDialect {
|
|
case dialect.Postgres:
|
|
return TestPostgresDatabase(ctx)
|
|
case dialect.SQLite:
|
|
return TestSQLiteDB(), NoOpCloser(nil), nil
|
|
default:
|
|
return "", nil, fmt.Errorf("unsupported dialect: %s", dbDialect)
|
|
}
|
|
}
|