testdb

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyTestFeed added in v1.4.0

func CopyTestFeed(t testing.TB, tx *sqlx.Tx, reader adapters.Reader) int

CopyTestFeed copies a feed into a new feed version within tx, deduplicating journey patterns as the server's imports do, and returns the feed version's id.

func CreateTestFeed added in v0.8.0

func CreateTestFeed(atx tldb.Adapter, url string) dmfr.Feed

CreateTestFeed returns a simple feed inserted into a database.

func CreateTestFeedVersion added in v1.4.0

func CreateTestFeedVersion(atx tldb.Adapter, file string) dmfr.FeedVersion

CreateTestFeedVersion inserts a feed version and its owning feed into a database, returning the feed version.

The feed is named uniquely per call: TempPostgres commits and current_feeds.onestop_id is unique, so a stable name would wedge reruns.

func MustFind

func MustFind(atx tldb.Adapter, ent interface{})

MustFind panics on failure

func MustGet

func MustGet(atx tldb.Adapter, ent interface{}, qstr string, qargs ...interface{})

MustGet panics on failure

func MustInsert

func MustInsert(atx tldb.Adapter, ent interface{}) int

MustInsert panics on failure

func MustOpenWriter added in v0.10.0

func MustOpenWriter(dburl string, create bool) *tldb.Writer

func MustSelect

func MustSelect(atx tldb.Adapter, ent interface{}, qstr string, qargs ...interface{})

MustSelect panics on failure

func MustUpdate

func MustUpdate(atx tldb.Adapter, ent interface{}, columns ...string)

MustUpdate panics on failure

func ShouldFind

func ShouldFind(t *testing.T, atx tldb.Adapter, ent interface{})

ShouldFind sends a test error on failure

func ShouldGet

func ShouldGet(t *testing.T, atx tldb.Adapter, ent interface{}, qstr string, qargs ...interface{})

ShouldGet sends a test error on failure

func ShouldInsert

func ShouldInsert(t *testing.T, atx tldb.Adapter, ent interface{}) int

ShouldInsert sends a test error on failure

func ShouldSelect

func ShouldSelect(t *testing.T, atx tldb.Adapter, ent interface{}, qstr string, qargs ...interface{})

ShouldSelect sends a test error on failure

func ShouldUpdate

func ShouldUpdate(t *testing.T, atx tldb.Adapter, ent interface{}, columns ...string)

ShouldUpdate sends a test error on failure

func TempPostgres added in v0.18.0

func TempPostgres(dburl string, cb func(tldb.Adapter) error) error

func TempSqlite added in v0.11.0

func TempSqlite(cb func(tldb.Adapter) error) error

TempSqlite creates a temporary in-memory database and runs the callback inside a tx.

func TempSqliteAdapter added in v0.13.0

func TempSqliteAdapter() tldb.Adapter

Types

type AdapterIgnoreTx

type AdapterIgnoreTx struct {
	tldb.Adapter
}

AdapterIgnoreTx .

func (*AdapterIgnoreTx) Tx

func (atx *AdapterIgnoreTx) Tx(cb func(tldb.Adapter) error) error

Tx runs in same tx if tx already open, otherwise runs without tx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL