testutil

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbName = "datauxtest"
)

Variables

View Source
var (
	Articles = make([]*Article, 0)
	Users    = make([]*User, 0)
)
View Source
var (
	ArticleCsv = `` /* 398-byte string literal not displayed */

)

Functions

func Setup

func Setup()

func ValidateQuery

func ValidateQuery(t testing.TB, querySql string, expectCols []string, expectColCt, expectRowCt int, rowValidate func([]interface{}))

func ValidateQuerySpec

func ValidateQuerySpec(t testing.TB, testSpec QuerySpec)

Types

type Article

type Article struct {
	Title    string
	Author   string
	Count    int
	Count64  int64
	Deleted  bool
	Category datasource.StringArray
	Created  time.Time
	Updated  *time.Time
	F        float64
	Embedded struct {
		Tag string
		ICt int
	}
	Body *json.RawMessage
}

func (*Article) ColNames

func (a *Article) ColNames() []string

func (*Article) Header

func (a *Article) Header() string

func (*Article) Row

func (a *Article) Row() string

func (*Article) UrlMsg

func (a *Article) UrlMsg() url.Values

func (*Article) ValueI

func (a *Article) ValueI() []interface{}

func (*Article) Values

func (a *Article) Values() []driver.Value

type QuerySpec

type QuerySpec struct {
	Sql             string
	Exec            string
	Cols            []string
	ValidateRow     func([]interface{})
	ExpectRowCt     int
	ExpectColCt     int
	RowData         interface{}
	ValidateRowData func()
}

type StructRow

type StructRow interface {
	Values() []driver.Value
	ValueI() []interface{}
	ColNames() []string
}

type User

type User struct {
	Id      string
	Name    string
	Deleted bool
	Roles   datasource.StringArray
	Created time.Time
	Updated *time.Time
}

func (*User) ColNames

func (a *User) ColNames() []string

func (*User) Header

func (u *User) Header() string

func (*User) Row

func (u *User) Row() string

func (*User) ValueI

func (u *User) ValueI() []interface{}

func (*User) Values

func (u *User) Values() []driver.Value

Jump to

Keyboard shortcuts

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