func setupWithSession(driver string, t *testing.T) (db *sql.DB, session *Session) {
	db = setup(driver, t)
	if db == nil {
		return nil, nil
	}
	switch driver {
	case "mymysql":
		session = New(db).Dialect(MySQL)
	case "mysql":
		session = New(db).Dialect(MySQL)
	case "sqlite3":
		session = New(db).Dialect(Sqlite3)
	case "postgres":
		session = New(db).Dialect(PostgreSQL)
	default:
		t.Fatalf("unknown driver: %s", driver)
		return nil, nil
	}
	return db, session
}
-- Setup -----------------------------------------------------------------
package dapper
import (
	"database/sql"
	"fmt"
	"os"
	"reflect"
	"testing"
	"time"
	_ "github.com/go-sql-driver/mysql"
	_ "github.com/lib/pq"
	_ "github.com/mattn/go-sqlite3"
	_ "github.com/ziutek/mymysql/godrv"
)
const (
	testDBName = "dapper_test"
	testDBUser = "travis"
	testDBPass = ""
)
var (
	drivers = []string{"mymysql", "mysql", "sqlite3", "postgres"}
)
type cruddy struct {
	Id          int64      `dapper:"id,primarykey,autoincrement,table=cruddy"`
	Int         int        `dapper:"c_int"`
	Int32       int32      `dapper:"c_int32"`
	Int64       int64      `dapper:"c_int64"`
	Uint        uint       `dapper:"c_uint"`
	Uint32      uint32     `dapper:"c_uint32"`
	Uint64      uint64     `dapper:"c_uint64"`
	Float32     float32    `dapper:"c_float32"`
	Float64     float64    `dapper:"c_float64"`
	Decimal     float64    `dapper:"c_decimal"`
	DateTime    time.Time  `dapper:"c_datetime"`
	DateTimePtr *time.Time `dapper:"c_datetime_ptr"`
	Timestamp   *time.Time `dapper:"c_timestamp"`
	Bool        bool       `dapper:"c_bool"`
	Char        string     `dapper:"c_char"`
	Varchar     string     `dapper:"c_varchar"`
	Text        string     `dapper:"c_text"`
}
type tweet struct {
	Id       int64  `dapper:"id,primarykey,autoincrement,table=tweets"`
	UserId   int64  `dapper:"user_id"`
	Message  string `dapper:"message"`
	Retweets int64  `dapper:"retweets"`
	CreatedStr string `dapper:"created"`
}
type tweetById struct {
	Id int64
}
type tweetByUserId struct {
	UserId int64
}
type tweetByUserAndMinRetweets struct {
	UserId      int64
	NumRetweets int64
}
type sampleQuery struct {
	Id     int64  `dapper:"id,primarykey,autoincrement"`
	Ignore string `dapper:"-"`
	UserId int64
}
func (t *tweet) String() string {
	return fmt.Sprintf("tweet[Id=%v,UserId=%v,Message=%v,Retweets=%v,Created=%v]",
		t.Id, t.UserId, t.Message, t.Retweets, t.Created())
}
func (t *tweet) Created() *time.Time {
	tm, err := time.Parse(time.RFC3339, t.CreatedStr)
	if err != nil {
		return nil
	}
	return &tm
}
type validater interface {
	Validate() bool
}
type user struct {
	validater
	Id        int64    `dapper:"id,primarykey,autoincrement,table=users"`
	Name      string   `dapper:"name"`
	Karma     *float64 `dapper:"karma"`
	Suspended bool     `dapper:"suspended"`
}
type userWithoutTableNameTag struct {
	Id        int64    `dapper:"id,primarykey,autoincrement"`
	Name      string   `dapper:"name"`
	Karma     *float64 `dapper:"karma"`
	Suspended bool     `dapper:"suspended"`
}
type userWithoutPrimaryKeyTag struct {
	Id        int64    `dapper:"id,autoincrement,table=users"`
	Name      string   `dapper:"name"`
	Karma     *float64 `dapper:"karma"`
	Suspended bool     `dapper:"suspended"`
}
type userWithMissingColumns struct {
	Id   int64  `dapper:"id,primarykey,autoincrement,table=users"`
	Name string `dapper:"name"`
}
func (u *user) String() string {
	return fmt.Sprintf("user[Id=%v,Name=%v,Karma=%v,Suspended=%v]",
		u.Id, u.Name, u.Karma, u.Suspended)
}
func (u *user) Validate() bool {
	return u.Name != ""
}
type Order struct {
	Id         int64             `dapper:"id,primarykey,autoincrement,table=orders"`
	RefId      string            `dapper:"ref_id"`
	User       *user             `dapper:"-"`
	Items      []*OrderItem      `dapper:"oneToMany=OrderId"`
	Extensions []*OrderExtension `dapper:"oneToMany=OrderId"`
}
func (o Order) String() string {
	return fmt.Sprintf("<Order{Id:%d,RefId:%s,len(Items):%d}>", o.Id, o.RefId, len(o.Items))
}
type OrderItem struct {
	Id      int64             `dapper:"id,primarykey,autoincrement,table=order_items"`
	OrderId int64             `dapper:"order_id"`
	Order   *Order            `dapper:"oneToOne=OrderId"`
	Name    string            `dapper:"name"`
	Price   float64           `dapper:"price"`
	Qty     float64           `dapper:"qty"`
	Images  []*OrderItemImage `dapper:"oneToMany=OrderItemId"`
}
func (item OrderItem) String() string {
	return fmt.Sprintf("<OrderItem{Id:%d,OrderId:%d,Name:%s,Order:%v}>",
		item.Id, item.OrderId, item.Name, item.Order)
}
type OrderItemImage struct {
	Id          int64      `dapper:"id,primarykey,autoincrement,table=order_item_images"`
	OrderItemId int64      `dapper:"order_item_id"`
	Item        *OrderItem `dapper:"oneToOne=OrderItemId"`
	Image       string     `dapper:"image"`
}
func (img OrderItemImage) String() string {
	return fmt.Sprintf("<OrderItemImage{Id:%d,OrderItemId:%d,Image:%s}>",
		img.Id, img.OrderItemId, img.Image)
}
type OrderExtension struct {
	Id      int64   `dapper:"id,primarykey,autoincrement,table=order_extensions"`
	OrderId *int64  `dapper:"order_id"`  
	Order   *Order  `dapper:"oneToOne=OrderId"`
	Field   string  `dapper:"field"`
	Value   *string `dapper:"value"`
}
func (ext OrderExtension) String() string {
	return fmt.Sprintf("<OrderExtension{Id:%d,OrderId:%v,Field:%s,Value:%v}>",
		ext.Id, ext.OrderId, ext.Field, ext.Value)
}