MCPcopy
hub / github.com/benbjohnson/litestream / NewDB

Function NewDB

internal/testingutil/testingutil.go:143–158  ·  view source on GitHub ↗
(tb testing.TB, path string)

Source from the content-addressed store, hash-verified

141}
142
143func NewDB(tb testing.TB, path string) *litestream.DB {
144 tb.Helper()
145 tb.Logf("db=%s", path)
146
147 level := slog.LevelDebug
148 if strings.EqualFold(*logLevel, "trace") {
149 level = internal.LevelTrace
150 }
151
152 db := litestream.NewDB(path)
153 db.Logger = slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
154 Level: level,
155 ReplaceAttr: internal.ReplaceAttr,
156 }))
157 return db
158}
159
160// MustOpenDBs returns a new instance of a DB & associated SQL DB.
161func MustOpenDBs(tb testing.TB) (*litestream.DB, *sql.DB) {

Calls 1

NewDBFunction · 0.92