testdb

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestFeed added in v0.8.0

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

CreateTestFeed returns a simple feed inserted into a database.

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 pasends a test error on failure

func ShouldGet

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

ShouldGet pansends 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 WithAdapterRollback

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

WithAdapterRollback runs a callback inside a Tx and then aborts, returns any error from original callback.

func WithAdapterTx

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

WithAdapterTx runs a callback inside a Tx, commits if callback returns nil.

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